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

Allen D. Ball commented on JAMES-325:
-------------------------------------

I agree *two* slashes are required: The generated URL has *three* which I think 
is causing me trouble.

As soon as I can build the latest source, I will try with the new class loader 
(which I agree will likely fix my problem).

Thanks!

> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to