Project

Profile

Help

Bug #3856

closed

Premature end of primary result serialization

Added by John Lumley almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Serialization
Sprint/Milestone:
-
Start date:
2018-07-23
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
trunk
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Recent refactorisation of the transformer->destination interface, pushing the responsibility for receiver closure onto Destination.closeAndNotify() appears in at least one instance, not to be flushing the XMLEmitter.writer buffer.

The circumstances appear difficult to minimise (it's the XSLT-based compiler running, carrying out a normal XML serialization to primary output, with no additional result documents), but in this case in XSLT30Transformer.applyTemplates()#305 at the invocation of destination.closeAndNotify(), the Receiver sOut (which is actually a CloseNotifier) has a trail:

RegularSequenceChecker -> SequenceNormalizerWithSpaceSeparator -> XMLIndenterPE -> XMLEmitter

with a UTF-8Writer as the writer field of the XMLEmitter and for which the buffer hasn't been flushed to the file output stream.

destination is a Serializer whose helper field is a DestinationHelper with no listeners. Consequently on closeAndNotify() the output stream is closed and no action is taken on flushing or closing the UTF8Writer, which in any case would have to happen before the stream was closed.

As a temporary measure restoring a sOut.close() action before destination.closeAndNotify() fixes the issue, but I think something elsewhere might be better.

Please register to edit this issue

Also available in: Atom PDF