Skip to content

Commit

Permalink
npe fix
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Jan 16, 2016
1 parent fcf6010 commit f0748e3
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -158,12 +158,13 @@ public static boolean copyFile(InputStream srcStream, String srcName, OutputStre
* a directory on a file system.
*/
public static boolean extractFilesFromClassPath(String srcPath, String dstPath, boolean overwrite) throws URISyntaxException, IOException {
URI srcUrl = ClassPathUtil.class.getClassLoader().getResource(srcPath).toURI();
// URL srcUrl = ClassLoader.getSystemResource(srcPath);
if (srcUrl == null) {
URL src = ClassPathUtil.class.getClassLoader().getResource(srcPath);
if (src == null) {
LOGGER.debug("No resource for {}", srcPath);
return false;
}
URI srcUrl = src.toURI();
// URL srcUrl = ClassLoader.getSystemResource(srcPath);
LOGGER.trace("URL: {}", srcUrl);
if (srcUrl.getPath().contains("!/")) {
URI srcFileUri = new URI(srcUrl.getPath().split("!/")[0]); // e.g. file:/C:/Documents%20and%20Settings/user/.m2/repository/com/evolveum/midpoint/infra/test-util/2.1-SNAPSHOT/test-util-2.1-SNAPSHOT.jar
Expand Down Expand Up @@ -223,7 +224,7 @@ public static boolean extractFilesFromClassPath(String srcPath, String dstPath,
/**
* Get clasess from JAR
*
* @param candidateUrl
* @param srcUrl
* @param packageName
* @return
*/
Expand Down

0 comments on commit f0748e3

Please sign in to comment.