[
http://issues.apache.org/jira/browse/JAMES-325?page=comments#action_12361659 ]
Stefano Bagnara commented on JAMES-325:
---------------------------------------
He doesn't talk about encoding.
In fact it's not clear what exactly happes: he talks about an FTP handler
invoked for the url but I don't understand how as the Url starts with file: and
not with ftp:
My main problem with this issue is that I don't undestand how the ftp handler
can be invoked and I'm not able to reproduce it. Furthermore I don't know the
low-level differences between a "new File(path);" and a "new
URL("file://"+path);" so I don't know if the patch can brake something: any
hint?
> 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]