Author: snoopdave
Date: Fri May 18 13:03:55 2007
New Revision: 539581
URL: http://svn.apache.org/viewvc?view=rev&rev=539581
Log:
Use Commons Codec for Base64, not Sun internal classes
Modified:
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldUtilities.java
roller/trunk/src/org/apache/roller/util/Utilities.java
Modified:
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldUtilities.java
URL:
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldUtilities.java?view=diff&rev=539581&r1=539580&r2=539581
==============================================================================
---
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldUtilities.java
(original)
+++
roller/trunk/src/org/apache/roller/ui/rendering/velocity/deprecated/OldUtilities.java
Fri May 18 13:03:55 2007
@@ -32,7 +32,7 @@
import org.apache.roller.util.DateUtil;
import org.apache.roller.util.RegexUtil;
import org.apache.roller.util.Utilities;
-
+import org.apache.commons.codec.binary.Base64;
/**
* Utility methods needed by old Roller 2.X macros/templates.
@@ -487,9 +487,8 @@
* @throws IOException
*/
public static String encodeString(String str) throws IOException {
- sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
- String encodedStr = encoder.encodeBuffer(str.getBytes());
-
+ Base64 base64 = new Base64();
+ String encodedStr = new String(base64.encodeBase64(str.getBytes()));
return (encodedStr.trim());
}
@@ -501,9 +500,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));
-
+ Base64 base64 = new Base64();
+ String value = new String(base64.decodeBase64(str.getBytes()));
return (value);
}
Modified: roller/trunk/src/org/apache/roller/util/Utilities.java
URL:
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/util/Utilities.java?view=diff&rev=539581&r1=539580&r2=539581
==============================================================================
--- roller/trunk/src/org/apache/roller/util/Utilities.java (original)
+++ roller/trunk/src/org/apache/roller/util/Utilities.java Fri May 18 13:03:55
2007
@@ -23,10 +23,9 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.commons.codec.binary.Base64;
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
-
+
/**
* General purpose utilities, not for use in templates.
*/
@@ -433,9 +432,8 @@
* @throws IOException
*/
public static String encodeString(String str) throws IOException {
- BASE64Encoder encoder = new BASE64Encoder();
- String encodedStr = encoder.encodeBuffer(str.getBytes());
-
+ Base64 base64 = new Base64();
+ String encodedStr = new String(base64.encodeBase64(str.getBytes()));
return (encodedStr.trim());
}
@@ -447,9 +445,8 @@
* @throws IOException
*/
public static String decodeString(String str) throws IOException {
- BASE64Decoder dec = new BASE64Decoder();
- String value = new String(dec.decodeBuffer(str));
-
+ Base64 base64 = new Base64();
+ String value = new String(base64.decodeBase64(str.getBytes()));
return (value);
}