Skip to content
Permalink
Browse files
Commit @bertfrees patch in #272
  • Loading branch information
ndw committed Mar 6, 2019
1 parent 0e488ca commit 461f1812e7a8089b8df4631c9b959f27764c75f3
Showing with 9 additions and 18 deletions.
  1. +9 −18 src/main/java/com/xmlcalabash/core/XProcConfiguration.java
@@ -37,13 +37,12 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
@@ -216,35 +215,27 @@ private void init() {
findStepClasses();
findExtensionFunctions();

URI cwd = URIUtils.cwdAsURI();

String classPath = System.getProperty("java.class.path");
String[] pathElements = classPath.split(System.getProperty("path.separator"));
for (String path : pathElements) {
// Issue #272, make sure the path is UTF-8
try {
path = URLEncoder.encode(path, "utf-8");
} catch (UnsupportedEncodingException uee) {
// This can't happen with utf-8!?
}

// Make the path absolute wrt the cwd so that it can be opened later regardless of context
String s = cwd.resolve(path).getPath();
path = new File(path).getAbsolutePath();
String jarFileURL = URLDecoder.decode(new File(path).toURI().toString().replace("+", "%2B"));
try {
JarFile jar = new JarFile(s);
JarFile jar = new JarFile(path);
ZipEntry catalog = jar.getEntry("catalog.xml");
if (catalog != null) {
catalogs.add("jar:file://" + s + "!/catalog.xml");
logger.debug("Using catalog: jar:file://" + s + "!/catalog.xml");
catalogs.add("jar:" + jarFileURL + "!/catalog.xml");
logger.debug("Using catalog: jar:" + jarFileURL + "!/catalog.xml");
}
catalog = jar.getEntry("META-INF/catalog.xml");
if (catalog != null) {
catalogs.add("jar:file://" + s + "!/META-INF/catalog.xml");
logger.debug("Using catalog: jar:file://" + s + "!/META-INF/catalog.xml");
catalogs.add("jar:" + jarFileURL + "!/META-INF/catalog.xml");
logger.debug("Using catalog: jar:file://" + jarFileURL + "!/META-INF/catalog.xml");

This comment has been minimized.

Copy link
@bertfrees

bertfrees Mar 6, 2019

A file:// been left over here.

This comment has been minimized.

Copy link
@ndw

ndw Mar 6, 2019

Author Owner

🤦‍♂️ Thank you. Fixed.

}
} catch (IOException e) {
// If it's not a jar file, maybe it's a directory with a catalog
String catfn = s;
String catfn = path;
if (!catfn.endsWith("/")) {
catfn += "/";
}

0 comments on commit 461f181

Please sign in to comment.