[asterisk-scf-commits] asterisk-scf/integration/ice.git branch "review/java-windows-fix-props-load" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Oct 17 10:58:56 CDT 2011


branch "review/java-windows-fix-props-load" has been created
        at  ff4e5b38363534e002c6c58134612b0653d38c7b (commit)

- Log -----------------------------------------------------------------
commit ff4e5b38363534e002c6c58134612b0653d38c7b
Author: David M. Lee <dlee at digium.com>
Date:   Mon Oct 17 10:52:09 2011 -0500

    Fix IllegalArgumentException on Windows.
    
    When attempting to load a properties file, Ice first tries to open the
    given path as a resource.  Normally this fails by returning null, but on
    Windows there are times where this can throw an
    IllegalArgumentException.

diff --git a/java/src/IceInternal/Util.java b/java/src/IceInternal/Util.java
index c19e370..7e30015 100644
--- a/java/src/IceInternal/Util.java
+++ b/java/src/IceInternal/Util.java
@@ -40,7 +40,17 @@ public final class Util
         //
         // getResourceAsStream returns null if the resource can't be found.
         //
-        java.io.InputStream stream = cl.getResourceAsStream(path);
+        java.io.InputStream stream = null;
+        try
+        {
+            cl.getResourceAsStream(path);
+        }
+        catch(IllegalArgumentException e)
+        {
+            // If certain URL's are in the ClassLoader (i.e. http://felix.extensions:9),
+            // an absolute path to a file on Windows will cause an IllegalArgumentException.
+            // Since it's a file and not  a resource, ignore the exception.
+        }
         if(stream == null)
         {
             try

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/ice.git



More information about the asterisk-scf-commits mailing list