You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Bernd Fondermann (JIRA)" <se...@james.apache.org> on 2006/01/03 14:22:02 UTC

[jira] Commented: (JAMES-325) org.apache.james.transport.Loader supplies malformed URLs to the classpath for the mailet class loader

    [ http://issues.apache.org/jira/browse/JAMES-325?page=comments#action_12361619 ] 

Bernd Fondermann commented on JAMES-325:
----------------------------------------

To me, using a directory named "<JAMES>" seems a rather unusual but legal thing to do. 
Isn't the problem the reporter pointed out, that the special characters get encoded? In this respect, the patch seems to be a good thing, if the problem really does go away.



> 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