james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefano Bagnara (JIRA)" <server-...@james.apache.org>
Subject [jira] Commented: (JAMES-325) org.apache.james.transport.Loader supplies malformed URLs to the classpath for the mailet class loader
Date Wed, 04 Jan 2006 18:39:03 GMT
    [ http://issues.apache.org/jira/browse/JAMES-325?page=comments#action_12361776 ] 

Stefano Bagnara commented on JAMES-325:
---------------------------------------

I removed the classloader code with the last commit.
I would like to know if the latest trunk solve the issue (now we delegate the classloading
to the updated Phoenix) so I really hope this fixed this problem, too!


> org.apache.james.transport.Loader supplies malformed URLs to the classpath for the mailet
class loader
> ------------------------------------------------------------------------------------------------------
>
>          Key: JAMES-325
>          URL: http://issues.apache.org/jira/browse/JAMES-325
>      Project: James
>         Type: Bug
>   Components: James Core
>     Versions: 2.3.0
>  Environment: Linux/J2SDK 1.4.2
>     Reporter: Allen D. Ball
>  Attachments: Loader.diff
>
> 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");
>                  }
>              }
>          }

-- 
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
-
For more information on JIRA, 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