You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/04/28 05:34:04 UTC

[jira] Commented: (MAVEN-1129) Maven uses sun.* classes directly to access Base64 codec

The following comment has been added to this issue:

     Author: Brett Porter
    Created: Tue, 27 Apr 2004 11:32 PM
       Body:
sorry, commented on wrong bug.

Should be:

applied - Thanks!
---------------------------------------------------------------------
View this comment:
  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1129&page=comments#action_19158

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1129

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-1129
    Summary: Maven uses sun.* classes directly to access Base64 codec
       Type: Bug

     Status: Closed
   Priority: Blocker
 Resolution: FIXED

 Original Estimate: 1 hour
 Time Spent: Unknown
  Remaining: 1 hour

    Project: maven
   Fix Fors:
             1.0-rc3

   Assignee: Brett Porter
   Reporter: Dalibor Topic

    Created: Fri, 23 Jan 2004 10:36 AM
    Updated: Tue, 27 Apr 2004 11:32 PM
Environment: Building Maven CVS HEAD, on a free runtime (Kaffe, CVS HEAD) with Maven 1.0-rc1.

Description:
Code in src/java/org/apache/maven/util/HttpUtils.java uses a 'forbidden' class in sun.* package hierarchy directly to access a Base64 encoder.  Instead, it should use Jakarta's own commons-codec package.

The patch below adds a dependency to commons-codec (1.1, because 1.2 is not on ibiblio.org/maven yet), and fixes the code to use jakarta's own portable implementaion.

With this patch, using kaffe from CVS [1] and a slighlty patched maven 1.0-rc1 [2], I can build maven's CVS HEAD using 

MAVEN_OPTS=-Dbuild.compiler=kjc maven jars

and run maven's tests just fine (except for the online tests, but that seems to be an unrelated issue).

This bug is filed as blocker, because it blocks development of maven on free runtimes using free tools. 

<vision>
Given that free runtimes are starting to become suitable for a lot of tasks, it would be nice to make developers of free java software take a notice and work with us to make the free runtimes an equivalently suitable (or preferably better ;) choice for development of free java software as non-free runtimes.
</vision>

Index: project.xml
===================================================================
RCS file: /home/cvspublic/maven/project.xml,v
retrieving revision 1.327
diff -u -r1.327 project.xml
--- project.xml	28 Dec 2003 23:04:13 -0000	1.327
+++ project.xml	22 Jan 2004 17:48:12 -0000
@@ -431,6 +431,11 @@
       <version>1.4.1</version>
       <url>http://jakarta.apache.org/commons/digester.html</url>
     </dependency>
+    <dependency>
+      <id>commons-codec</id>
+      <version>1.1</version>
+      <url>http://jakarta.apache.org/commons/codec/</url>
+    </dependency>
 
     <dependency>
       <id>commons-jelly</id>
Index: src/java/org/apache/maven/util/HttpUtils.java
===================================================================
RCS file: /home/cvspublic/maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.28
diff -u -r1.28 HttpUtils.java
--- src/java/org/apache/maven/util/HttpUtils.java	27 Oct 2003 16:33:11 -0000	1.28
+++ src/java/org/apache/maven/util/HttpUtils.java	22 Jan 2004 17:48:12 -0000
@@ -67,6 +67,9 @@
 import java.net.URL;
 import java.net.URLConnection;
 
+import org.apache.commons.codec.BinaryEncoder;
+import org.apache.commons.codec.binary.Base64;
+
 /**
  * Http utils for retrieving files.
  *
@@ -238,14 +241,9 @@
         {
             String up = username + ":" + password;
             String encoding = null;
-            // check to see if sun's Base64 encoder is available.
-            try
-            {
-                sun.misc.BASE64Encoder encoder =
-                    (sun.misc.BASE64Encoder) Class.forName(
-                        "sun.misc.BASE64Encoder" ).newInstance();
-
-                encoding = encoder.encode( up.getBytes() );
+	    try {
+                BinaryEncoder encoder = new Base64();
+                encoding = new String( encoder.encode( up.getBytes() ) );
             }
             catch ( Exception ex )
             {
@@ -405,4 +403,4 @@
         file.setLastModified( modifiedTime );
         return true;
     }
-}
\ No newline at end of file
+}

thanks a lot for taking your time to encourage me to post this fix.

cheers,
dalibor topic

[1] http://www.kaffe.org/anoncvs.shtml
[2] You need to remove tools.jar entries from forehead.conf. Free runtimes are not allowed to ship Sun's java compiler, so a direct dependency on tools.jar is pointless in their case, and the lack of a tools.jar in kaffe needlessly causes forehead to abort. Instead, you should let ant sort out the compiler. Ant works fine with jikes, and kaffe's java compiler, with an appropriate build.compiler option.
Of course, you also need to set JAVA_HOME to where you installed kaffe from CVS HEAD ;)


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org