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 se...@james.apache.org on 2004/10/08 21:30:51 UTC

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

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
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:30 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


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

Posted by "Noel J. Bergman (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-325?page=comments#action_12361783 ] 

Noel J. Bergman commented on JAMES-325:
---------------------------------------

If I recall correctly, file:// is the required prefix.  The "extra" '/' is not at all extra.  That means that the path starts with '/' and is absolute, whereas without the '/' it is treated as a relative path.

Hope that helps.

> 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


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

Posted by "Allen D. Ball (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-325?page=comments#action_12361774 ] 

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

I'm sorry: "<James>" was supposed to simply indicate the root directory of the installed James hierarchy.  I typically install in /opt/james-2.2.1-RC1.  (I also apologize about following-up late; I only received an e'mail with the last comment.)  The actual URLs in my example are:

file:///opt/james-2.2.1-RC1/apps/james/SAR-INF/lib/custom.jar

and

jar:file:///opt/james-2.2.1-RC1/apps/james/SAR-INF/lib/custom.jar!properties

Where (I believe) the issue is the extra "/" after the "file:".  This is why my patch suggests using File.toURL() to generate the URL.

Thanks for your consideration.

> 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


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

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-325?page=all ]
     
Stefano Bagnara resolved JAMES-325:
-----------------------------------

    Resolution: Cannot Reproduce

I cannot reproduce the issue.
How can your base baseDirectory contain the &lt;JAMES&gt; string? 
baseDirectory is initialized to ((File)context.get( "app.home") ).getCanonicalPath()  and should not contain "<JAMES>".

> 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


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

Posted by "Bernd Fondermann (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-325?page=comments#action_12361676 ] 

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

I'm sure somehow it has to do with encoding and URL/File transformations. Searching in Sun's bugbase for "URL File encoding" brings up plenty of back and forth discussion (#6179468, #4273532 for starters), even the ftp-behavior is described (#4501830, not-a-bug).

But I cannot reproduce it, too. Being under Linux/JDK1.4.2 for which the issue was reported.

I am tempted now to agree that <James> is not that good a directory name...


> 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


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

Posted by se...@james.apache.org.
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


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

Posted by "Allen D. Ball (JIRA)" <se...@james.apache.org>.
    [ 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


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

Posted by "Bernd Fondermann (JIRA)" <se...@james.apache.org>.
    [ 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


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

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


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

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ 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