New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default catalog addition fails for invocation with relative -jar path (and absolute path on Windows) #270

Closed
gimsieke opened this Issue Mar 13, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@gimsieke
Contributor

gimsieke commented Mar 13, 2018

Lines 222 and 226 in core/XProcConfiguration.java in the Saxon 9.7 branch should be:

catalogs.add(getClass().getResource("/catalog.xml").toString());

and

catalogs.add(getClass().getResource("/META-INF/catalog.xml").toString());

respectively.

I can create a pull request but I don’t know whether this will work. In order to make it compile, I needed to change Configuration.softwareEdition into Version.softwareEdition.

But then I could add my top-level catalog as /META-INF/catalog.xml and it would work on Cygwin with a Windows Java using both java -jar $(cygpath -ma xmlcalabash-1.1.19-97.jar) and java -jar xmlcalabash-1.1.19-97.jar. Yay!

Otherwise, it would try to load jar:file://xmlcalabash-1.1.19-97.jar!/META-INF/catalog.xml for the relative path or jar:file://C:/cygwin/home/gerrit/…/xmlcalabash-1.1.19-97.jar!/META-INF/catalog.xml for the absolute path. The first one doesn’t exist even on Linux and the second one should start with either jar:file:///C:/ or jar:file:/C:/. This string fumbling can be avoided with getClass().getResource() which will return the correct jar: URLs in any case.

@ndw

This comment has been minimized.

Owner

ndw commented Mar 13, 2018

getClass().getResource() only returns the first catalog file, not all of the catalog files, so I think I still have to do the loop. And I really don't understand your comment about Version.softwareEdition.
Can you please test #271 and tell me if it works for you?

@gimsieke

This comment has been minimized.

Contributor

gimsieke commented Mar 13, 2018

Re Configuration.softwareEdition:

When running javac, I received errors like this one:

XProcConfiguration.java:178: error: cannot find symbol
        saxonProcessor = Configuration.softwareEdition.toLowerCase();

I could avoid them by adding import net.sf.saxon.Version; and changing Configuration.softwareEdition to Version.softwareEdition. When i look at the API docs, only Version seems to have a property called softwareEdition, not Configuration. But what do I know about Java?

@gimsieke

This comment has been minimized.

Contributor

gimsieke commented Mar 13, 2018

I compiled the core/XProcConfiguration.java of #271, this time without a javac complaint.
After I updated the resulting classes in xmlcalabash-1.1.19-97.jar, my test case still worked, both for the absolute Windows path and for the relative path invocations. Thanks!

@ndw

This comment has been minimized.

Owner

ndw commented Mar 13, 2018

In XProcConfiguration.java in the saxon97 branch of XML Calabash, line 178 is:

saxonProcessor = Version.softwareEdition.toLowerCase();

So I think you must have had the wrong branch checked out or something.

But it sounds like my patch worked for you. I'll apply it and make a new release this evening.

@gimsieke

This comment has been minimized.

Contributor

gimsieke commented Mar 13, 2018

Ah yes, I cloned the saxon96 branch, apparently.

ndw added a commit that referenced this issue Mar 14, 2018

ndw added a commit that referenced this issue Mar 14, 2018

@ndw

This comment has been minimized.

Owner

ndw commented Mar 15, 2018

Fixed in 1.1.20.

@ndw ndw closed this Mar 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment