The following issue has been updated:

    Updater: Brett Porter (mailto:[EMAIL PROTECTED])
       Date: Sat, 21 Feb 2004 7:45 PM
    Changes:
             Fix Version changed to 1.0-final
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1129&page=history

---------------------------------------------------------------------
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: Unassigned
   Priority: Blocker

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

    Project: maven
   Fix Fors:
             1.0-final

   Assignee: 
   Reporter: Dalibor Topic

    Created: Fri, 23 Jan 2004 10:36 AM
    Updated: Sat, 21 Feb 2004 7:45 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to