Issue Details (XML | Word | Printable)

Key: XALANJ-1706
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Brian Minchau
Reporter: Jeremias Maerki
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XalanJ2

[PATCH] DocumentFragment returned by extension element causes multiple SAX endDocument() events

Created: 29/Oct/03 11:01 PM   Updated: 12/Dec/07 07:14 AM
Return to search
Component/s: Other
Affects Version/s: 2.7
Fix Version/s: 2.7.1

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive Licensed for inclusion in ASF works BugzillaExtElemSAXendDocumentCheck.zip 2005-10-21 06:29 AM Jeremias Maerki 4 kB
Zip Archive BugzillaExtElemSAXendDocumentCheck.zip 2003-10-29 11:03 PM Jeremias Maerki 4 kB
Text File endDocumentPatch.diff 2004-08-26 03:24 AM Jeremias Maerki 2 kB
File Licensed for inclusion in ASF works XALANJ-1706-patch.diff 2005-10-21 06:29 AM Jeremias Maerki 2 kB
Environment:
Operating System: All
Platform: All

Bugzilla Id: 24220
Resolution Date: 22/Oct/05 11:48 AM


 Description  « Hide
At Krysalis Barcode (http://www.krysalis.org/barcode) I have a Xalan extension
which creates barcodes in SVG format [1]. Until recently I've used an
extension function for that. As I was able to create an extension element for
SAXON I wanted to do the same for the Xalan-extension. But here's the problem:

The extension element (like the extension function where it works correctly)
returns a DocumentFragment containing the generated barcode in SVG format. In
the case of the extension element the DocumentFragment is processed by a
TreeWalker which issues start/endDocument() SAX events although it shouldn't
IMO. This behaviour causes Apache FOP to crash with an NPE because more than
one endDocument() SAX event is sent to FOP by Xalan.

I will attach a test case for the bugzilla test directory. Current CVS (HEAD)
and 2.5.1 fail in this test. I will try to find a bugfix but if someone more
intimate with the code beats me to it, so much better.

[1] http://cvs.sourceforge.net/viewcvs.py/krysalis/krysalis-
barcode/src/java/org/krysalis/barcode/xalan/BarcodeExt.java

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jeremias Maerki added a comment - 29/Oct/03 11:03 PM
Created an attachment (id=8802)
Testcase

Christine Li added a comment - 19/Feb/04 06:30 AM


*** This bug has been marked as a duplicate of 25710 ***

Jeremias Maerki added a comment - 26/Aug/04 03:24 AM
I don't know what triggered Christine Li to believe that this bug is a
duplicate of 25710. That bug is something totally different IMO.

Anyway I'm reopening this bug as it still persists in the current CVS HEAD and
it renders Barcode4J's (formerly Krysalis Barcode) Xalan extension virtually
useless in conjunction with Apache FOP if output from Xalan is piped into FOP
using SAX.

I've also finally managed to find the time to fix the bug. Since I haven't
managed, yet, to run all the test suites I can't tell if the patch breaks
anything. At least it passes the test case I've attached when submitting this
bug. I will give the test suites another try tomorrow when I'm fully awake
again.

Jeremias Maerki added a comment - 26/Aug/04 03:24 AM
Created an attachment (id=12533)
Proposed patch to fix the bug

Jeremias Maerki added a comment - 26/Aug/04 10:56 PM
I've been able to run the tests. With and without my patch Xalan-J's smoketest
shows one failure. Unfortunately, "build alltest" simply had too many failures
to be helpful. Maybe I did something wrong running these tests.

Serge Knystautas made changes - 02/Sep/04 09:54 PM
Field Original Value New Value
issue.field.bugzillaimportkey 24220 26615
Henry Zongaro made changes - 16/Dec/04 04:06 PM
Priority Major [ 3 ]
Jeremias Maerki added a comment - 11/Aug/05 06:45 AM
Is there anything I can do to finally get this patch applied? It is a simple patch including a test case. This fixes a very annoying problem. Thanks!

Jeremias Maerki added a comment - 20/Oct/05 09:36 PM
Ping!

Brian Minchau made changes - 21/Oct/05 04:46 AM
Assignee Xalan Developers Mailing List [ xalan-dev@xml.apache.org ] Brian Minchau [ minchau@ca.ibm.com ]
Brian Minchau added a comment - 21/Oct/05 05:19 AM
Jeremias,
your "Ping!" caught my attention. For some reason I have an interest in SAX events, and that the events are, shall we say, well-formed.

Thanks for the full testcase, and patch. Sorry one of the Xalan committers didn't have a look earlier. Assuming the patch is OK, and applied to CVS HEAD, is that sufficient, or are you wanting it in an official release, e.g. 2.7.1 ?

One other point, since the patch was migrated from bugzilla, it is not marked as giving the rights to Apache. It seems silly, but please attach that patch yet again, with the appropriate checkbox set.

Jeremias Maerki added a comment - 21/Oct/05 06:29 AM
Thanks Brian! I've attached a new patch created against latest CVS today. And I've reattached the test case. Since the test case is a set of three new files, one could argue that ALv2 §5 doesn't apply, but my CLA is on file. :-)

I'm happy if the patch makes it into CVS. I don't expect a bugfix release just because of the patch. But obviously, it will be helpful to point Barcode4J users to a Xalan release that has the bug fixed. So, if the fix makes it into the next normally scheduled release, I'm happy.

Jeremias Maerki made changes - 21/Oct/05 06:29 AM
Attachment XALANJ-1706-patch.diff [ 12315006 ]
Attachment BugzillaExtElemSAXendDocumentCheck.zip [ 12315007 ]
Repository Revision Date User Message
ASF #338264 Sat Oct 22 02:47:51 UTC 2005 minchau Commiting fix for XALANJ-1706 that removes startDocument()/endDocument() calls for result tree fragments.
Files Changed
MODIFY /xalan/java/trunk/src/org/apache/xml/utils/TreeWalker.java
MODIFY /xalan/java/trunk/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java

Brian Minchau added a comment - 22/Oct/05 11:48 AM
I reviewed the patch and approve it. I have applied it to CVS head branch.

The fix only impacts DOM2DTM, and only its dispatchToEvents() method with is called by
SerializerUtils.outputResultTreeFragment(), which is used in ElemCopyOf. So all in all
it looks like the startDocument() endDocument() is not correct for outputting a fragment.

It also passes the smoke test and conformance tests.

Brian Minchau made changes - 22/Oct/05 11:48 AM
Fix Version/s Latest Development Code [ 10863 ]
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Jeremias Maerki added a comment - 24/Oct/05 09:20 PM
Thanks, Brian. A question though: What's the reason you didn't commit the test case, too? Anything wrong with it?

Brian Minchau added a comment - 11/Dec/07 04:33 PM
The fixed version is marked as 2.7.1.
The affecteced version was marked as 2.7.1, which is clearly wrong.
Changing the affected version to 2.7, which is better, though perhaps not fully accurate.

Brian Minchau made changes - 11/Dec/07 04:33 PM
Affects Version/s 2.7.1 [ 10863 ]
Affects Version/s 2.7 [ 11080 ]
Brian Minchau added a comment - 11/Dec/07 04:57 PM
Would the originator of this issue please verify that this issue is fixed in the 2.7.1 release, by adding a comment to this issue, so that we can close this issue.

A lack of response by February 1, 2008 will be taken as consent that we can close this resolved issue.

Regards,
Brian Minchau

Jeremias Maerki added a comment - 11/Dec/07 06:13 PM
Works fine with 2.7.1. Issue can be closed. Thanks, Brian.

Brian Minchau added a comment - 12/Dec/07 07:14 AM
Closing this issue.
Jeremias: I'm impressed, 4 years later and you are still watching this issue!

Brian Minchau made changes - 12/Dec/07 07:14 AM
Status Resolved [ 5 ] Closed [ 6 ]