james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From server-...@james.apache.org
Subject [jira] Updated: (JAMES-325) org.apache.james.transport.Loader supplies malformed URLs to the classpath for the mailet class loader
Date Fri, 08 Oct 2004 19:32:51 GMT
The following issue has been updated:

    Updater: Allen D. Ball (mailto:ball@iprotium.com)
       Date: Fri, 8 Oct 2004 12:31 PM
    Comment:
Actual patch included in the text of the report
    Changes:
             Attachment changed to Loader.diff
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/JAMES-325?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/JAMES-325

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JAMES-325
    Summary: org.apache.james.transport.Loader supplies malformed URLs to the classpath for
the mailet class loader
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: James
 Components: 
             James Core
   Versions:
             2.2.1

   Assignee: 
   Reporter: Allen D. Ball

    Created: Fri, 8 Oct 2004 12:30 PM
    Updated: Fri, 8 Oct 2004 12:31 PM
Environment: Linux/J2SDK 1.4.2

Description:
An attempt to load a property file via the mailet class loader getResourceAsStream() method
always fails because the URLs supplied to the classpath of the form:

file://<JAMES>/apps/james/SAR-INF/lib/custom.jar

If a properties file is loaded as a resource from this class path element, the URL looks like:

jar:file://<JAMES>/apps/james/SAR-INF/lib/custom.jar!properties

The URL connection handler for FTP is invoked and the resource isn't found.  The issue is
the extra '/' in the pathname portion of the URL.

The following patch fixes the issue in my environment.  Thanks for considering it.

--- ./src/java/org/apache/james/transport/Loader.java.orig	2004-03-14 22:54:18.000000000 -0800
+++ ./src/java/org/apache/james/transport/Loader.java	2004-10-08 11:57:08.000000000 -0700
@@ -92,11 +92,11 @@
         Vector jarlist = new Vector();
         URL[] classPath = null;
         try {
-            jarlist.add(new URL("file:///" + baseDirectory + "/SAR-INF/classes/"));
+            jarlist.add(new File(baseDirectory + "/SAR-INF/classes/").toURL());
         } catch (MalformedURLException e) {
             logger.error(
                 "can't add "
-                    + "file:///"
+                    + "file:"
                     + baseDirectory
                     + "/SAR-INF/classes/ to mailet classloader");
         }
@@ -104,11 +104,11 @@
             for (int i = 0; i < flist.length; i++) {
                 try {
                     if (flist[i].indexOf("jar") == flist[i].length() - 3) {
-                        jarlist.add(new URL("file:///" + baseDirectory +"/SAR-INF/lib/"+
flist[i]));
-                        logger.debug("added file:///" + baseDirectory +"/SAR-INF/lib/" +
flist[i] + " to mailet Classloader");
+                        jarlist.add(new File(baseDirectory +"/SAR-INF/lib/"+ flist[i]).toURL());
+                        logger.debug("added file:" + baseDirectory +"/SAR-INF/lib/" + flist[i]
+ " to mailet Classloader");
                     }
                 } catch (MalformedURLException e) {
-                    logger.error("can't add file:///" + baseDirectory +"/SAR-INF/lib/"+ flist[i]
+ " to mailet classloader");
+                    logger.error("can't add file:" + baseDirectory +"/SAR-INF/lib/"+ flist[i]
+ " to mailet classloader");
                 }
             }
         }



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

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message