Page 1 of 1

Several patch submissions

PostPosted: Fri Dec 03, 2010 10:15 am
by davebrown
Hello all,

My company and I continue to make progress manipulating MS Office documents
with docx4j. Having the full-fidelity JAXB tree of every part of every
document type is indispensible. POI is simply unsatisfactory for the xml
formats, as unsatisfactory as the Hawaiian foodstuff.

I have a few patches that I've accumulated. They're separated out here into 4
pieces, so they can be analyzed/accepted/rejected separately. They will all
apply cleanly on trunk as of today's revision 1342.

These patches are submitted in accordance with the docx4j contributor policy
as described here:
http://dev.plutext.org/docx4j/docx4j_In ... butor.docx

pom.xml.diff:
- configure the maven surefire plugin from trying to run certain classes as
JUnit tests. The following samples get picked up as tests, since they match
*Test.java:
src/pptx4j/java/org/pptx4j/samples/RoundTripTest.java
src/main/java/org/docx4j/samples/HyperlinkTest.java
src/main/java/org/docx4j/samples/OpenAndSaveRoundTripTest.java

- configure the 'copy-resources' part of the build to pick up xslt and xml
files in the src/main/java and src/pptx/java parts of the tree. Otherwise
these are missing for me from the resultant jar. (Note: are release jars
built some other way than maven that picks up these resources?)

docx.diff:
- declare a JAXB type adapter (package-info.java) for java.math.BigInteger
(BigIntegerAdapter.java) in the org/docx4j/wml package. This works around
a bug in old JAXB releases, where null numbers are serialized out as empty
string "", and cause deserialization errors later, on the way back in. I
would normally try to ensure a proper JAXB on installation, but I need to
run in environments where I cannot easily do so. This simple workaround
avoids great pain.

- re-raise several caught/swallowed Exceptions in XmlUtils.java. They are
re-raised as RuntimeException where the enclosing method sigature doesn't
allow any declared exception.

pptx.diff:
- guard against null elements in a couple of places (ResolvedLayout.java,
TextStyles.java) The null elements guarded against occurred with files
generated by OpenOffice, I imagine that MS Office always has the elements
in question present.

Re: Several patch submissions

PostPosted: Fri Dec 03, 2010 10:17 am
by davebrown
One more patch, I can only attach three at a time. Submitted in accordance w/ the contributor guidelines.

tests.diff:
- remove hard-coded local file path from code (ListNumberIdTest.java) and
instead assume we're running in the root of the project tree
- remove hard-coded path (ParagraphDifferencerTest.java)
- remove @Test annotation from static method where it isn't legal
(ParagraphDifferencerTest.java)
- save result file to java.io.tmpdir rather than hard-coded path
(ParagraphDifferencerTest.java)

Re: Several patch submissions

PostPosted: Sun Dec 12, 2010 10:52 pm
by jason
Hi Dave

A (slightly belated) thank you very much for these.

I've just applied them all. See http://dev.plutext.org/trac/docx4j/timeline (changesets of 12/12/10)

davebrown wrote:are release jars
built some other way than maven that picks up these resources?


Yes, I build them with ant.

davebrown wrote:configure the 'copy-resources' part of the build to pick up xslt and xml
files in the src/main/java and src/pptx/java parts of the tree.


I added another line to this, to pick up xslt in the pptx4j tree.

davebrown wrote:re-raise several caught/swallowed Exceptions in XmlUtils.java. They are
re-raised as RuntimeException where the enclosing method signature doesn't
allow any declared exception.


docx4j v3.0 should probably change to signature to declare an appropriate exception.

thanks again .. Jason