[ 
https://issues.apache.org/jira/browse/CXF-1583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alton Idowu updated CXF-1583:
-----------------------------

    Description: 
The setupClasspath method in the DynamicClientFactory class cannot handle 
spaces in the path to jar files.  It throws the following exception:

Caused by: java.net.URISyntaxException: Illegal character in path at index 16: 
file:/C:/Program Files/Apache/Tomcat-5.5.20/common/i18n/tomcat-i18n-en.jar
        at java.net.URI$Parser.fail(URI.java:2816)
        at java.net.URI$Parser.checkChars(URI.java:2989)
        at java.net.URI$Parser.parseHierarchical(URI.java:3073)
        at java.net.URI$Parser.parse(URI.java:3021)
        at java.net.URI.<init>(URI.java:578)
        at java.net.URL.toURI(URL.java:916)
        at 
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.setupClasspath(DynamicClientFactory.java:405)

This is a know issue withthe URL.toURI() method.

A possible solution would be to replace the following:
                    if (url.getProtocol().startsWith("file")) {
                        try {
                            File file = new File(url.toURI().getPath());
                            if (file.exists()) {
                                classPath.append(file.getAbsolutePath())
                                    .append(System
                                            .getProperty("path.separator"));    
                            
                            }
                               
                            if (file.getName().endsWith(".jar")) {
                                addClasspathFromManifest(classPath, file);
                            }
                        } catch (URISyntaxException e) {
                            throw new UncheckedException(e);
                        }
                    }


with
                    if (url.getProtocol().startsWith("file")) {
                        File file;
                        try {
                                file = new File(url.toURI().getPath());
                        } catch (catch catch(URISyntaxException urise) { 
                            file = new File(url.getPath()); 
                        }

                        if (file.exists()) {
                            classPath.append(file.getAbsolutePath())
                                .append(System
                                        .getProperty("path.separator"));        
                        
                        }
                           
                        if (file.getName().endsWith(".jar")) {
                            addClasspathFromManifest(classPath, file);
                        }
                    }




  was:
The setupClasspath method in the DynamicClientFactory class cannot handle 
spaces in the path to jar files.  It throws the following exception:

Caused by: java.net.URISyntaxException: Illegal character in path at index 16: 
file:/C:/Program Files/Apache/Tomcat-5.5.20/common/i18n/tomcat-i18n-en.jar
        at java.net.URI$Parser.fail(URI.java:2816)
        at java.net.URI$Parser.checkChars(URI.java:2989)
        at java.net.URI$Parser.parseHierarchical(URI.java:3073)
        at java.net.URI$Parser.parse(URI.java:3021)
        at java.net.URI.<init>(URI.java:578)
        at java.net.URL.toURI(URL.java:916)
        at 
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.setupClasspath(DynamicClientFactory.java:405)

This is a know issue withthe URL.toURI() method.

A possible solution would be to replace the following:
                for (URL url : urls) {
                    if (url.getProtocol().startsWith("file")) {
                        try {
                            File file = new File(url.toURI().getPath());


with
                for (URL url : urls) {
                    if (url.getProtocol().startsWith("file")) {
                        try {
                            File file;
                            try {
                                file = new File(url.toURI().getPath());
                             } catch catch(URISyntaxException urise) {
                                 file  = new File(url.getPath());
                             }


> DynamicClientFactory.setupClasspath method cannot handle spaces in path to 
> jar file
> -----------------------------------------------------------------------------------
>
>                 Key: CXF-1583
>                 URL: https://issues.apache.org/jira/browse/CXF-1583
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1
>         Environment: Ubuntu 7.04, Windows XP, jdk 1.5_09, cxf 2.1 
>            Reporter: Alton Idowu
>
> The setupClasspath method in the DynamicClientFactory class cannot handle 
> spaces in the path to jar files.  It throws the following exception:
> Caused by: java.net.URISyntaxException: Illegal character in path at index 
> 16: file:/C:/Program Files/Apache/Tomcat-5.5.20/common/i18n/tomcat-i18n-en.jar
>       at java.net.URI$Parser.fail(URI.java:2816)
>       at java.net.URI$Parser.checkChars(URI.java:2989)
>       at java.net.URI$Parser.parseHierarchical(URI.java:3073)
>       at java.net.URI$Parser.parse(URI.java:3021)
>       at java.net.URI.<init>(URI.java:578)
>       at java.net.URL.toURI(URL.java:916)
>       at 
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.setupClasspath(DynamicClientFactory.java:405)
> This is a know issue withthe URL.toURI() method.
> A possible solution would be to replace the following:
>                     if (url.getProtocol().startsWith("file")) {
>                         try {
>                             File file = new File(url.toURI().getPath());
>                             if (file.exists()) {
>                                 classPath.append(file.getAbsolutePath())
>                                     .append(System
>                                             .getProperty("path.separator"));  
>                               
>                             }
>                                
>                             if (file.getName().endsWith(".jar")) {
>                                 addClasspathFromManifest(classPath, file);
>                             }
>                         } catch (URISyntaxException e) {
>                             throw new UncheckedException(e);
>                         }
>                     }
> with
>                     if (url.getProtocol().startsWith("file")) {
>                       File file;
>                       try {
>                               file = new File(url.toURI().getPath());
>                       } catch (catch catch(URISyntaxException urise) { 
>                             file = new File(url.getPath()); 
>                         }
>                         if (file.exists()) {
>                             classPath.append(file.getAbsolutePath())
>                                 .append(System
>                                         .getProperty("path.separator"));      
>                           
>                         }
>                            
>                         if (file.getName().endsWith(".jar")) {
>                             addClasspathFromManifest(classPath, file);
>                         }
>                     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to