[vlma-devel] commit: Use Apache commons-codec Base64 encoder. (Adrien Grand )

git version control git at videolan.org
Sun Nov 30 01:48:40 CET 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Nov 29 23:33:13 2008 +0100| [fc8675afbde73166837af8262e2c93cb4643e28f] | committer: Adrien Grand 

Use Apache commons-codec Base64 encoder.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=fc8675afbde73166837af8262e2c93cb4643e28f
---

 vlma-core/pom.xml                                  |    5 +++++
 .../videolan/vlma/retriever/HttpDataRetriever.java |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/vlma-core/pom.xml b/vlma-core/pom.xml
index 2d45614..fb6ee78 100644
--- a/vlma-core/pom.xml
+++ b/vlma-core/pom.xml
@@ -46,6 +46,11 @@
             <version>1.4.0</version>
         </dependency>
         <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.3</version>
+        </dependency>
+        <dependency>
             <groupId>commons-configuration</groupId>
             <artifactId>commons-configuration</artifactId>
             <version>1.5</version>
diff --git a/vlma-core/src/main/java/org/videolan/vlma/retriever/HttpDataRetriever.java b/vlma-core/src/main/java/org/videolan/vlma/retriever/HttpDataRetriever.java
index 10e8c9d..5b7b22a 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/retriever/HttpDataRetriever.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/retriever/HttpDataRetriever.java
@@ -27,6 +27,7 @@ import java.net.URLConnection;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.configuration.Configuration;
 import org.apache.log4j.Logger;
 import org.videolan.vlma.messages.Data;
@@ -44,7 +45,7 @@ public class HttpDataRetriever implements DataRetriever {
         URLConnection conn = url.openConnection();
         String userPassword = configuration.getString("vlc.monitor.http.login") + ":"
                 + configuration.getString("vlc.monitor.http.password");
-        String encodedUserPassword = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
+        String encodedUserPassword = new String(Base64.encodeBase64(userPassword.getBytes()));
         conn.setRequestProperty("Authorization", "Basic " + encodedUserPassword);
         return conn.getInputStream();
     }



More information about the vlma-devel mailing list