[fedora-java] Alternative to com.sun class

Robert Marcano robert at marcanoonline.com
Sat May 24 16:09:56 UTC 2008


On Fri, 2008-05-23 at 16:09 -0600, Orion Poplawski wrote:
> Robert Marcano wrote:
> > jakarta-commons-codec
> > 
> > http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Base64.html
> 

Ohh sorry, but I am not sure you will find a drop in replacement, the
commons-codec version does not convert to Strings always works with byte
arrays, but you can change a little the code, for example

// sun code
String encodedData = Base64.encode(data);

// new code
String encodedData = null;
try {
    encodedData = new String(Base64.encodeBase64(data), "UTF-8");
} catch (UnsupportedEncodingException e) {
    // can not happen, UTF-8 is always supported
}

Hope this helps

> 
> Finally figured out where to add the path, but it looks like it's not a 
> drop in replacement for the com.sun class:
> 
> 
>       [java]     [javac] Compiling 1 source file to 
> /export/home/orion/fedora/gridengine/devel/gridengine/source/CLASSES/juti/classes
>       [java]     [javac] ----------
>       [java]     [javac] 1. ERROR in 
> /export/home/orion/fedora/gridengine/devel/gridengine/source/libs/juti/java/com/sun/grid/security/login/GECATrustManagerLoginModule.java 
> (at line 203)
>       [java]     [javac]         byte[] message = Base64.decode(messa
>       [java]     [javac] geStr);
>       [java]     [javac]                          ^^^^^^^^^^^^^^^^^^^^^^^^^
>       [java]     [javac] Cannot make a static reference to the 
> non-static method decode(Object) from the type Base64
>       [java]     [javac] ----------
>       [java]     [javac] 2. ERROR in 
> /export/home/orion/fedora/gridengine/devel/gridengine/source/libs/juti/java/com/sun/grid/security/login/GECATrustManagerLoginModule.java 
> (at line 203)
>       [java]     [javac]         byte[] message = Base64.decode(messa
>       [java]     [javac] geStr);
>       [java]     [javac]                          ^^^^^^^^^^^^^^^^^^^^^^^^^
>       [java]     [javac] Type mismatch: cannot convert from Object to byte[]
>       [java]     [javac] ----------
>       [java]     [javac] 3. ERROR in 
> /export/home/orion/fedora/gridengine/devel/gridengine/source/libs/juti/java/com/sun/grid
>       [java]     [javac] 
> /security/login/GECATrustManagerLoginModule.java (at line 210)
>       [java]     [javac]         byte[] signature = 
> Base64.decode(signatureStr);
>       [java]     [javac] 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>       [java]     [javac] Cannot make a static reference to the 
> non-static method decode(Object) from the type Base64
>       [java]     [javac] ----------
>       [java]     [javac] 4. ERROR in 
> /export/home/orion/fedora/gridengine/devel/gridengine/source/libs/juti/java/com/sun/grid
>       [java]     [javac] 
> /security/login/GECATrustManagerLoginModule.java (at line 210)
>       [java]     [javac]         byte[] signature = 
> Base64.decode(signatureStr);
>       [java]     [javac] 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>       [java]     [javac] Type mismatch: cannot convert from Object to byte[]
>       [java]     [javac] ----------
>       [java]     [javac] 4 problems (4 errors)
> 
________________________________________
Robert Marcano

web: http://www.marcanoonline.com/
gpg --keyserver hkp://pgp.mit.edu/ --recv-key 72A0DCFD






More information about the fedora-devel-java-list mailing list