Issue Details (XML | Word | Printable)

Key: APF-583
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: Andr? Faria
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse

BASE64Encoder is Sun proprietary API and may be removed in a future release

Created: 20/Jan/07 05:41 AM   Updated: 20/Jan/07 11:28 PM   Resolved: 20/Jan/07 11:28 PM
Component/s: i18n
Affects Version/s: 2.0-M2
Fix Version/s: 1.9.5, 2.0-M3

Environment:


 Description  « Hide
 Warnings with Base64...

 build:
     [javac] Compiling 376 source files to /mnt/develop/ant/finan/build
     [javac]
/mnt/develop/ant/finan/tecFinan/src/service/br/com/bluesoft/tecfinan/util/StringUtil.java:81:
warning: sun.misc.BASE64Encoder is Sun proprietary API and may be removed in
a future release
     [javac] sun.misc.BASE64Encoder encoder = new
sun.misc.BASE64Encoder();
     [javac] ^
     [javac]
/mnt/develop/ant/finan/tecFinan/src/service/br/com/bluesoft/tecfinan/util/StringUtil.java:81:
warning: sun.misc.BASE64Encoder is Sun proprietary API and may be removed in
a future release
     [javac] sun.misc.BASE64Encoder encoder = new
sun.misc.BASE64Encoder();
     [javac]
      ^
     [javac]
/mnt/develop/ant/finan/tecFinan/src/service/br/com/bluesoft/tecfinan/util/StringUtil.java:92:
warning: sun.misc.BASE64Decoder is Sun proprietary API and may be removed in
a future release
     [javac] sun.misc.BASE64Decoder dec = new
sun.misc.BASE64Decoder();
     [javac] ^
     [javac]
/mnt/develop/ant/finan/tecFinan/src/service/br/com/bluesoft/tecfinan/util/StringUtil.java:92:
warning: sun.misc.BASE64Decoder is Sun proprietary API and may be removed in
a future release
     [javac] sun.misc.BASE64Decoder dec = new
sun.misc.BASE64Decoder();
     [javac]
  ^
     [javac] 4 warnings
      [copy] Copying 11 files to /mnt/develop/ant/finan/build

Matt Raible added a comment - 20/Jan/07 02:13 PM
Here's a proposed patch:

Index: C:/Source/appfuse/src/service/org/appfuse/util/StringUtil.java
===================================================================
--- C:/Source/appfuse/src/service/org/appfuse/util/StringUtil.java (revision 2229)
+++ C:/Source/appfuse/src/service/org/appfuse/util/StringUtil.java (working copy)
@@ -1,8 +1,9 @@
 package org.appfuse.util;
 
-import java.io.IOException;
 import java.security.MessageDigest;
 
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -10,10 +11,7 @@
 /**
  * String Utility Class This is used to encode passwords programmatically
  *
- * <p>
- * <a h
- * ref="StringUtil.java.html"><i>View Source</i></a>
- * </p>
+ * <p><a href="StringUtil.java.html"><i>View Source</i></a>
  *
  * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
  */
@@ -82,8 +80,8 @@
      * @return String
      */
     public static String encodeString(String str) {
- sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
- return encoder.encodeBuffer(str.getBytes()).trim();
+ Base64 encoder = new Base64();
+ return String.valueOf(encoder.encode(str.getBytes())).trim();
     }
 
     /**
@@ -93,11 +91,11 @@
      * @return String
      */
     public static String decodeString(String str) {
- sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder();
+ Base64 dec = new Base64();
         try {
- return new String(dec.decodeBuffer(str));
- } catch (IOException io) {
- throw new RuntimeException(io.getMessage(), io.getCause());
+ return String.valueOf(dec.decode(str));
+ } catch (DecoderException de) {
+ throw new RuntimeException(de.getMessage(), de.getCause());
         }
     }
 }

Matt Raible made changes - 20/Jan/07 08:19 PM
Field Original Value New Value
Fix Version/s 1.9.5 [ 10114 ]
Fix Version/s 2.0-M3 [ 10112 ]
2328 by  Matt Raible (1 file)
20/Jan/07 11:28 PM (42 months, 18 days ago)
APF-583: Changed from Sun's BASE64Encoder to Base64 from Commons Codec project.
appfuse: trunk/service/src/main/java/org/appfuse/util/StringUtil.java 2328 history download (+10 -9) diffs

Matt Raible made changes - 20/Jan/07 11:28 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
2330 by  Matt Raible (1 file)
20/Jan/07 11:30 PM (42 months, 18 days ago)
APF-583: Changed from Sun's BASE64Encoder to Base64 from Commons Codec project.
appfuse: branches/BRANCH_1-9-x/src/service/org/appfuse/util/StringUtil.java 2330 history download (+9 -11) diffs