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

Alban Perillat-Merceroz updated SQOOP-504:
------------------------------------------

    Description: 
A piece of code was unix specific for loading a jar.

The attached file is the a for a generic implementation (works for windows too).

  was:
A piece of code was unix specific for loading a jar.

Here is the patch for a generic implementation (works for windows too):

(Or see github pull request : https://github.com/apache/sqoop/pull/1)

src/java/org/apache/sqoop/util/ClassLoaderStack.java
old     new     
...     ...     @@ -75,10 +75,10 @@ public final class ClassLoaderStack {
75      75             }
76      76           }
77      77       
78              -    String urlPath = "jar:file://" + new 
File(jarFile).getAbsolutePath() + "!/";
79              -    LOG.debug("Attempting to load jar through URL: " + 
urlPath);
        78      +    URL url = new File(jarFile).toURI().toURL();
        79      +    LOG.debug("Attempting to load jar through URL: " + url);
80      80           LOG.debug("Previous classloader is " + prevClassLoader);
81              -    URL [] jarUrlArray = {new URL(urlPath)};
        81      +    URL[] jarUrlArray = { url };
82      82           URLClassLoader cl = URLClassLoader.newInstance(jarUrlArray,
83      83               prevClassLoader);
84      84           try {
...     ...     @@ -87,7 +87,7 @@ public final class ClassLoaderStack {
87      87               LOG.debug("Testing class in jar: " + testClassName);
88      88               Class.forName(testClassName, true, cl);
89      89             }
90              -      LOG.debug("Loaded jar into current JVM: " + urlPath);
        90      +      LOG.debug("Loaded jar into current JVM: " + url);
91      91           } catch (ClassNotFoundException cnfe) {
92      92             throw new IOException("Could not load jar " + jarFile
93      93                 + " into JVM. (Could not find class "


    
> Windows bug: unable to load jar
> -------------------------------
>
>                 Key: SQOOP-504
>                 URL: https://issues.apache.org/jira/browse/SQOOP-504
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.4.2
>         Environment: Windows
>            Reporter: Alban Perillat-Merceroz
>         Attachments: SQOOP-504.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> A piece of code was unix specific for loading a jar.
> The attached file is the a for a generic implementation (works for windows 
> too).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to