IllegalArgumentException in 5.2.3 #184
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When I use 5.2.3 with Saxon, I got the IllegalArgumentException shown below. This prevents to upgrade Saxon to 12.5.
We got the normal result in 4.4.0
I attached gls.ent file for your investigation.
gls.zip
I also attached the PS script. I used it in Windows 11.
build-db2db.zip
Regards,
Where does
..\master\glossary\gls.entoccur? Is it in anhrefattribute value or a DTD system identifier, or somewhere else? (If it's possible to send a complete test case that demonstrates the problem, that would be great.)You say this prevents upgrading to Saxon 12.5, what version are you attempting to upgrade from?
The problem here is that
\is not a legal character in URIs, although it's obviously a perfectly legal character in Windows file names. I would have expected the resolver to change that into a/before attempting to resolve it withjava.net.URIbut without a test case, I can only speculate about why it isn't.I'm also curious, do you have additional Java customizations? I can't find anything in Saxon or XML Resolver that would print the message
Start expanding entities in XML fileSorry for the late reply.
The customer is planning to upgrade Saxon 12.0 to Saxon 12.5.
I attached small input file to reproduce the problem.
SBBVT0T-Deployment-Flat-mod.zip
If you do need the DTD, I will negotiate with user because it is proprietary.
Regards,
When I supply the document as a source document to Saxon Transform, I get
So the question is, what would we expect to happen?
The XML spec says:
I doubt that escaping (that is, percent-encoding) the "unwise" character "" as suggested here is going to be helpful; the backslash is almost certainly intended as a Windows path separator, and the only helpful action would be to convert it to "/". I guess that if that is anyone's job, it's the resolver's. This isn't strictly conformant with the XML spec, but I doubt anyone will mind.
Saxon could usefully catch the
IllegalArgumentExceptionand turn it into something more meaningful at the XSLT level, treating it like any other XML parsing failure.The best course of action, of course, would be to use valid URIs, rather than relying on behaviour beyond what's mandated in the standards. I do recognize that a lot of XML software tolerates Windows filenames in contexts where URIs are expected, but it's never entirely clear, for example, how relative filenames should be resolved against absolute URIs.
Saxon does in fact catch the
IllegalArgumentExceptionand wrap it in aSAXException, which seems to me to be the right course of action.Yes, I absolutely agree. This user has been using Adobe FrameMaker for over 20 years and it uses Windows path as URI without the slightest hesitation. I'm struggling this kind of problem because there are bunch of XML files in their CMS and I cannot fix them because they are user data.
I do expect resolver to have good solution for this kind of complex problem.
I think I've managed to reproduce it. It appears to be somewhere deep in Xerces:
Debugging in Xerces is always a challenge. My best guess is that
setupCurrentEntityis trying to make a URL out of the entity system identifier before passing it to the resolver. There's nothing I can do about that.This doesn't explain why it works with Saxon 12.0 though.
I get exactly the same failure with Saxon 12.0 which suggests there's something else going on in your environment:
Forgive me submitting basic question.
In this command-line, how Saxon find xmlresolver jar file?
In my case, I invoked Saxon using following Power Shell script code. (Attached as build-db2db.zip for your reference)
[Excerpt from attached build-db2db.ps1]
build-db2db.zip
I'm using Saxon-PE because XSL stylesheet uses reflexive extension functions.
I doubt that HE/PE/EE is going to make any difference here. In my command line example, Saxon finds the jar file because if you use
java -jarto run it, it adds the files in thelib/directory of the distribution to the classpath automatically. I'm no Powershell expert and that's a quite complex looking Powershell script, but I shall see if I can reproduce it.Finding out how it works for you with 12.0 is the next key step in working out what is different in 12.5.
Here's my attempt to reproduce the Powershell script:
That runs
and fails in just the same way that it did before. My source document
src/SBBVT0T-Deployment-Flat-mod.xmlismy DTD,
src/ymcsm2-4.dtdisand my entity file,
master/glossary/gls.entisCan you reproduce a working example using those files and with a simpler driver script?
Thank you for your reply.
I am testing more simpler one without PowerShell.
In my operating environment, at least saxon-pe-12.0.jar plus xmlresolver-4.6.0.jar seems to be working. Other combination will report java.lang.IllegalArgumentException.
I attached the test data folder: saxon-test-3-2024-07-18.zip
In this test data, the DTD file is empty. The original DTD file refers lots of entities and it is meaningless to attach them all.
Here are my screen shots.
All of the command-lines are stored in invoke.txt.
saxon-test-3-2024-07-18.zip
Is this information useful for you??
Yes. Very. I have construct a passing case on a Windows machine. That's difficult and tedious for debugging, but it's a place to start. Thank you.
Right. I believe I've found and fixed the bug in (what will be 5.2.4). Next, I want to see if I can fix it in the 6.x branch.
I've published a 5.2.4 release and pushed the 5.2.4 release to Maven. There's a little weirdness in the unit tests, but I think the problem is resolved. Please do let me know if I'm mistaken!