I have attached some patches in order to make joid compile and run also
with Java 1.4
It's basically replacing
Boolean.parseBoolean
String.contains
Cheers
Michael
--
Michael Wechner
Wyona - Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael...@wyona.com, mi...@apache.org
+41 44 272 91 61
>Hi
>
>I have attached some patches in order to make joid compile and run also
>with Java 1.4
>
>
I have attached an improved version of the patch resp. deleted some
obsolete lines, which I forgot about to remove.
Sorry for the noise.
Thanks
Michael
>It's basically replacing
>
>Boolean.parseBoolean
>String.contains
>
>Cheers
>
>Michael
>
>
>
>------------------------------------------------------------------------
>
>Index: src/org/verisign/joid/consumer/OpenIdFilter.java
>===================================================================
>--- src/org/verisign/joid/consumer/OpenIdFilter.java (Revision 84)
>+++ src/org/verisign/joid/consumer/OpenIdFilter.java (Arbeitskopie)
>@@ -45,7 +45,8 @@
> log.info("init OpenIdFilter");
> String saveInCookie = filterConfig.getInitParameter("saveInCookie");
> if(saveInCookie != null){
>- saveIdentityUrlAsCookie = Boolean.parseBoolean(saveInCookie);
>+ saveIdentityUrlAsCookie = org.verisign.joid.util.Boolean.parseBoolean(saveInCookie);
>+ //saveIdentityUrlAsCookie = Boolean.parseBoolean(saveInCookie);
> log.debug("saving identities in cookie: " + saveIdentityUrlAsCookie);
> }
> cookieDomain = filterConfig.getInitParameter("cookieDomain");
>Index: src/org/verisign/joid/consumer/Discoverer.java
>===================================================================
>--- src/org/verisign/joid/consumer/Discoverer.java (Revision 84)
>+++ src/org/verisign/joid/consumer/Discoverer.java (Arbeitskopie)
>@@ -36,7 +36,7 @@
> if(serverAndDelegate.getDelegate() == null) {
> serverAndDelegate.setDelegate(findLinkTag(str, "openid.delegate", in));
> }
>- if(str.contains("</head>")){
>+ if(str.indexOf("</head>") >= 0){
> break;
> }
> }
>Index: src/org/verisign/joid/CheckAuthenticationResponse.java
>===================================================================
>--- src/org/verisign/joid/CheckAuthenticationResponse.java (Revision 84)
>+++ src/org/verisign/joid/CheckAuthenticationResponse.java (Arbeitskopie)
>@@ -55,7 +55,8 @@
> if (AuthenticationResponse.OPENID_MODE.equals(key)) {
> mode = value;
> } else if (OPENID_IS_VALID.equals(key)) {
>- isValid = Boolean.parseBoolean(value);
>+ isValid = org.verisign.joid.util.Boolean.parseBoolean(value);
>+ //isValid = Boolean.parseBoolean(value);
> } else if(OPENID_INVALIDATE_HANDLE.equals(key)) {
> invalidateHandle = value;
> }
>@@ -128,4 +129,24 @@
> {
> return invalidateHandle;
> }
>-}
>\ Kein Zeilenvorschub am Ende der Datei
>+
>+ /**
>+ *
>+ */
>+/*
>+ private static boolean parseBoolean(String s) {
>+ if (s != null) {
>+ if (s.equals("true")) {
>+ return true;
>+ } else if (s.equals("false")) {
>+ return false;
>+ } else {
>+ // TBD: Throw an exception!
>+ return false;
>+ }
>+ }
>+ // TBD: Throw an exception!
>+ return false;
>+ }
>+*/
>+}
>Index: src/org/verisign/joid/util/Boolean.java
>===================================================================
>--- src/org/verisign/joid/util/Boolean.java (Revision 0)
>+++ src/org/verisign/joid/util/Boolean.java (Revision 0)
>@@ -0,0 +1,46 @@
>+//
>+// (C) Copyright 2008 VeriSign, Inc. All Rights Reserved.
>+//
>+// VeriSign, Inc. shall have no responsibility, financial or
>+// otherwise, for any consequences arising out of the use of
>+// this material. The program material is provided on an "AS IS"
>+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
>+// express or implied.
>+//
>+// Distributed under an Apache License
>+// http://www.apache.org/licenses/LICENSE-2.0
>+//
>+
>+package org.verisign.joid.util;
>+
>+import org.apache.commons.logging.LogFactory;
>+import org.apache.commons.logging.Log;
>+
>+
>+/**
>+ * Boolean in order to comply with Java 1.4.
>+ */
>+public class Boolean
>+{
>+ private final static Log log = LogFactory.getLog(Boolean.class);
>+
>+ /**
>+ *
>+ */
>+ public static boolean parseBoolean(String s) {
>+ if (s != null) {
>+ if (s.equals("true")) {
>+ return true;
>+ } else if (s.equals("false")) {
>+ return false;
>+ } else {
>+ // TBD: Throw an exception!
>+ log.error("No such value: " + s);
>+ return false;
>+ }
>+ }
>+ // TBD: Throw an exception!
>+ log.error("No such value: " + s);
>+ return false;
>+ }
>+}
@@ -128,4 +129,4 @@
{
return invalidateHandle;
}
-}
\ Kein Zeilenvorschub am Ende der Datei
+}
> Why not using Retrotranslator while building?
I guess you mean http://retrotranslator.sourceforge.net/, right?
For building libs and providing them for instance via a remote Maven dir
that would make sense.
But when telling people that joid is 1.4 compatible to compile from
source, then it doesn't I would say.
I guess it depends what the maintainers of JOID want:
- Either say JOID requires 1.5 (and tell people to use retrotranslator
to make it compile and run on 1.4)
- Or keep saying it requires 1.4 and apply for instance my patches to
make this happen :-)
So, what do the maintainers of JOID want? ;-)
Cheers
Michael
>
> 2008/1/22, Michael Wechner <michael...@wyona.com
> <mailto:michael...@wyona.com>>:
> michael...@wyona.com <mailto:michael...@wyona.com>,
> mi...@apache.org <mailto:mi...@apache.org>
The fact it still says 1.4 is only an oversight from code that has been added
since initial release on google code.
Is there any reason to *not* use 1.5 and require retrotranslator for 1.4?
I have never used retrotranslator so I don't know if it's good.
-Hans
>I always loved for 1.4 compatibility, but was convinced a few months
>back that I need to get with the program :)
>
>The fact it still says 1.4 is only an oversight from code that has been added
>since initial release on google code.
>
>Is there any reason to *not* use 1.5 and require retrotranslator for 1.4?
>
>
well, I think there are still some "enterprises" relying on Java 1.4 and
if the code itself is 1.4 compatible, then you don't have to provide to
kind of libs and tell people about it.
So far the changes where
String.contains versus String.indexOf
StringBuilder versus StringBuffer
Boolean.parseBoolean versus some homemade parseBoolean method
Sure the above are convenient, but I guess it's a question of what is
more annoying.
- Having to offer two kind of libs resp. tell people to use retrotranslator
- Using 1.4 methods (which I prefer at least for the moment :-)
I am clearly biased, so I will stop it here ;-)
Cheers
Michael
>I have never used retrotranslator so I don't know if it's good.
>
>-Hans
>
>On 1/21/08, Michael Wechner <michael...@wyona.com> wrote:
>
>
>>Sutra Zhou wrote:
>>
>>
>>
>>>Why not using Retrotranslator while building?
>>>
>>>
>>
>
>
> > >- if(str.contains ("</head>")){
> > Boolean.parseBoolean (saveInCookie);
> > + saveIdentityUrlAsCookie =
> > org.verisign.joid.util.Boolean.parseBoolean(saveInCookie);
> > + //saveIdentityUrlAsCookie =
> > Boolean.parseBoolean(saveInCookie);
> > log.debug("saving identities in cookie: "
> > + saveIdentityUrlAsCookie);
> > }
> > cookieDomain =
> > filterConfig.getInitParameter("cookieDomain");
> > Index: src/org/verisign/joid/consumer/Discoverer.java
> > ===================================================================
> > --- src/org/verisign/joid/consumer/Discoverer.java (Revision 84)
> > +++ src/org/verisign/joid/consumer/Discoverer.java (Arbeitskopie)
> > @@ -36,7 +36,7 @@
> > if( serverAndDelegate.getDelegate()