Author: snoopdave
Date: Sat Jun 23 09:02:33 2007
New Revision: 550062

URL: http://svn.apache.org/viewvc?view=rev&rev=550062
Log:
Don't use those Sun-internal Base64 calls

Modified:
    
roller/trunk/apps/planet/src/java/org/apache/roller/planet/util/Utilities.java
    roller/trunk/apps/planet/src/java/org/apache/roller/util/OldUtilities.java

Modified: 
roller/trunk/apps/planet/src/java/org/apache/roller/planet/util/Utilities.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/util/Utilities.java?view=diff&rev=550062&r1=550061&r2=550062
==============================================================================
--- 
roller/trunk/apps/planet/src/java/org/apache/roller/planet/util/Utilities.java 
(original)
+++ 
roller/trunk/apps/planet/src/java/org/apache/roller/planet/util/Utilities.java 
Sat Jun 23 09:02:33 2007
@@ -18,15 +18,13 @@
 import java.util.Locale;
 import java.util.NoSuchElementException;
 import java.util.StringTokenizer;
+import org.apache.commons.codec.binary.Base64;
 
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
-
 /**
  * General purpose utilities, not for use in templates.
  */
@@ -433,9 +431,7 @@
      * @throws IOException
      */
     public static String encodeString(String str) throws IOException {
-        BASE64Encoder encoder = new BASE64Encoder();
-        String encodedStr = encoder.encodeBuffer(str.getBytes());
-        
+        String encodedStr = new String(Base64.encodeBase64(str.getBytes()));  
         return (encodedStr.trim());
     }
     
@@ -447,10 +443,8 @@
      * @throws IOException
      */
     public static String decodeString(String str) throws IOException {
-        BASE64Decoder dec = new BASE64Decoder();
-        String value = new String(dec.decodeBuffer(str));
-        
-        return (value);
+        String value = new String(Base64.decodeBase64(str.getBytes()));        
+        return (value); 
     }
     
     /**

Modified: 
roller/trunk/apps/planet/src/java/org/apache/roller/util/OldUtilities.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/util/OldUtilities.java?view=diff&rev=550062&r1=550061&r2=550062
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/util/OldUtilities.java 
(original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/util/OldUtilities.java 
Sat Jun 23 09:02:33 2007
@@ -25,11 +25,11 @@
 import java.util.Date;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.util.DateUtil;
 import org.apache.roller.planet.util.RegexUtil;
 import org.apache.roller.planet.util.Utilities;
 
@@ -487,9 +487,7 @@
      * @throws IOException
      */
     public static String encodeString(String str) throws IOException {
-        sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
-        String encodedStr = encoder.encodeBuffer(str.getBytes());
-        
+        String encodedStr = new String(Base64.encodeBase64(str.getBytes()));  
         return (encodedStr.trim());
     }
     
@@ -501,10 +499,8 @@
      * @throws IOException
      */
     public static String decodeString(String str) throws IOException {
-        sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder();
-        String value = new String(dec.decodeBuffer(str));
-        
-        return (value);
+        String value = new String(Base64.decodeBase64(str.getBytes()));        
+        return (value); 
     }
                
     /**


Reply via email to