Page 1 of 1

assorted patches

PostPosted: Thu Apr 28, 2011 9:16 am
by davebrown
These have accumulated in my workspace, and IMHO improve things. Thanks again for all your work, Jason. Let me know what you think of the BinaryPart <-> Exception tradeoff in LoadFromZipNG.


src/diffx/com/topologi/diffx/Docx4jDriver.java
Convert debug true -> false

src/main/java/org/docx4j/convert/out/html/docx2xhtmlNG2.xslt
Use CSS styles for inserted/deleted markup, instead of inline
styles directly in the HTML, so that calling code can override
those styles.

src/main/java/org/docx4j/fonts/IdentityPlusMapper.java
Convert a recoverable log error() to a warn()

src/main/java/org/docx4j/fonts/PhysicalFonts.java
Convert a recoverable log error() to a warn()

src/main/java/org/docx4j/model/properties/run/Font.java
Convert a recoverable log error() to a warn()

src/main/java/org/docx4j/model/properties/PropertyFactory.java
Add a null check before using NumberingDefinitionsPart

src/main/java/org/docx4j/XmlUtils.java
- Add a (commented-out) debugging section (labeled "SUPER DEBUGGING")
that proves very useful when diagnosing XSLT problems.
- Re-raise, do not squelch, exceptions raised that arise from XPath.

src/main/java/org/docx4j/openpackaging/io/LoadFromZipNG.java
- Raise explicit exception when a part referred to by a
relationship is not found. This only happens on broken
documents, but without this exception, the problem
is difficult to track down by the ensuing NPE: the errant
relationship/missing part is not named in the exception otherwise.
- When failing to parse an XmlPart, do not just load it
as BinaryPart. Instead, just let the ensuing exception
be raised to the calling code. *** I suppose this one
may come down to a philosophical difference, but I greatly
prefer reporting exceptions. In this case, it was
masking a tough concurrency bug in XmlPart's parsing, see
below.

src/main/java/org/docx4j/openpackaging/parts/XmlPart.java
Do not use a static xml parser (DocumentBuilder), as it
is not thread-safe:
http://download.oracle.com/javase/1.4.2 ... ilder.html
The patch makes the parser not even a member variable at all,
only using the parser within the bounds of the setDocument() method.

src/main/java/org/docx4j/dml/wordprocessingDrawing/Anchor.java
Make this implement org.jvnet.jaxb2_commons.ppp.Child like
other types in docx4j.

src/main/java/org/docx4j/dml/wordprocessingDrawing/Inline.java
Make this implement org.jvnet.jaxb2_commons.ppp.Child like
other types in docx4j.

src/main/java/org/docx4j/dml/CTBlip.java
Make this implement org.jvnet.jaxb2_commons.ppp.Child like
other types in docx4j.

Re: assorted patches

PostPosted: Wed Jun 22, 2011 12:41 pm
by jason
Hi Dave

Thanks for these, and the accompanying explanation, which makes it very easy to review.

Applied. http://dev.plutext.org/trac/docx4j/changeset/1555

Sorry for the delay in doing so.

davebrown wrote:src/main/java/org/docx4j/openpackaging/io/LoadFromZipNG.java
- Raise explicit exception when a part referred to by a
relationship is not found. This only happens on broken
documents, but without this exception, the problem
is difficult to track down by the ensuing NPE: the errant
relationship/missing part is not named in the exception otherwise.


I moved the if (part == null) { throw new Docx4JException ..
into the getRawPart method, but the effect is the same.

cheers ... Jason