Skip to content
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

EPUB Check Java code depends on specific Saxon 9.5 class #647

Closed
raducoravu opened this issue Nov 2, 2015 · 13 comments
Closed

EPUB Check Java code depends on specific Saxon 9.5 class #647

raducoravu opened this issue Nov 2, 2015 · 13 comments
Labels
status: has PR The issue is being processed in a pull request
Milestone

Comments

@raducoravu
Copy link

So sometimes when using EPUB validation with more recent versions of Saxon (9.6.0.7 in our case) we obtain:

        java.lang.ClassNotFoundException: net.sf.saxon.om.Name10Checker
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at ro.sync.util.LateDelegationClassLoader.java.lang.Class loadClass(java.lang.String, boolean)(LateDelegationClassLoader.java:0)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at com.adobe.epubcheck.vocab.PrefixDeclarationParser.parsePrefixMappings(PrefixDeclarationParser.java:105)
            at com.adobe.epubcheck.vocab.VocabUtil.parsePrefixDeclaration(VocabUtil.java:183)
            at com.adobe.epubcheck.opf.OPFHandler30.startElement(OPFHandler30.java:145)
            at com.adobe.epubcheck.xml.XMLParser.startElement(XMLParser.java:542)
            at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImplXerces$NSContentDispatcher.scanRootElementHook(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(
@raducoravu raducoravu changed the title EPUB Check depends on specific Saxon 9 class EPUB Check Java code depends on specific Saxon 9.5 class Nov 2, 2015
@rdeltour
Copy link
Member

rdeltour commented Nov 2, 2015

Oh, it seems Name10Checker has been renamed to NameChecker in 9.6, more details in the class Javadoc.

I suppose that to cover both versions we'll have to use reflexion...

@rdeltour rdeltour self-assigned this Nov 2, 2015
@rdeltour rdeltour added this to the Next milestone Nov 2, 2015
@raducoravu
Copy link
Author

How about if you use org.apache.xerces.util.XMLChar.isValidNCName instead?

@rdeltour
Copy link
Member

rdeltour commented Nov 2, 2015

How about if you use org.apache.xerces.util.XMLChar.isValidNCName instead?

Xerces is not used explicitly as a 3d party dependency, so I suppose EpubCheck uses the JVM's internal version of it (exposed in a com.sun package).

Anyway, on 2nd look it seems Saxon's NameChecker can be accessed via the Configuration object too, which would work with both 9.5 and 9.6.

@raducoravu
Copy link
Author

If Xerces is not explicitly listed as a dependency, indeed sometimes EpubCheck might use the Xerces bundled with Java, sometimes like in the case of our application (Oxygen XML Editor) it will use the Xerces libraries which come with Oxygen. Another approach would be to copy the entire isValidNCName implementation from the Saxon or Xerces code to a class in the checker and remove the dependencies.
There seem to be other explicit dependencies on Saxon. Some seem to be extension function definitions which should be OK because they are API.

@tofi86
Copy link
Collaborator

tofi86 commented Dec 21, 2016

@rdeltour I just had a look at this and couldn't find a way to support both saxon 9.5 and 9.6 – though I didn't try Reflexions yet...

Why would you like to maintain support for both Saxon versions anyways?

@tofi86
Copy link
Collaborator

tofi86 commented Dec 22, 2016

Upgrade of Saxon to 9.7 has also been requested in #674

@mkraetke
Copy link
Contributor

see my comment in #674

@tofi86
Copy link
Collaborator

tofi86 commented Jan 30, 2017

Thanks Martin!

I would really like to update this with the next minor release.

@rdeltour Question from above again: Why would you like to support multiple Saxon versions anyways? Is there a specific reason?

If not, @mkraetke could make a PR for this...

@tofi86 tofi86 added the status: has PR The issue is being processed in a pull request label Jun 7, 2017
@tofi86
Copy link
Collaborator

tofi86 commented Jun 7, 2017

@mkraetke sent a PullRequest with those changes today (see #767) which upgrades the Saxon dependency to 9.6.0-7 and drops Saxon 9.5 compatibility.

Thanks, Martin!

@rdeltour I'm asking my question from above again: Why would you like to support multiple Saxon versions anyways? Is there a specific reason? I would be fine with supporting just Saxon 9.6 and later.

@tofi86
Copy link
Collaborator

tofi86 commented Sep 17, 2017

FYI: We will update to Saxon 9.6.0-10 soon with PR #767. Thanks for your contribution @mkraetke!

Is there a specific need by someone (@raducoravu / @oxygenxml ?? ) to update further to 9.7 or 9.8? If so, let's discuss it in #674.

@raducoravu
Copy link
Author

raducoravu commented Sep 18, 2017

Oxygen XML Editor 19.1 will come bundled with Saxon 9.7.0.19 and EPUB Checked 4.0.2 (just as 19.0 did). Until now we have been patching a couple of EPUB Checker classes which did not work with 9.7 (having copies of the same classes which were rewritten to be compatible with 9.7 in our own JAR library).
So we have our workarounds for this.... but probably when an EPUB Checker version is released to support Saxon 9.7 we can remove our patches.

@tofi86
Copy link
Collaborator

tofi86 commented Sep 18, 2017

Okay, thanks for the information. I'm going to cross-post this statement in #674 and assigned the ticket to the 4.1 milestone in order to discuss a second Saxon update to 9.7.

Closing this as I'm merging PR #767 now.

@tofi86 tofi86 closed this as completed in 8f56c01 Sep 18, 2017
@tofi86
Copy link
Collaborator

tofi86 commented Feb 10, 2018

Note: The Saxon dependency was updated to 9.8.0-8 with PR #830 by @mkraetke. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: has PR The issue is being processed in a pull request
Projects
None yet
Development

No branches or pull requests

4 participants