Page 1 of 1

Warning "sourcePartStore undefined" from org.docx4j.openpack

PostPosted: Thu Dec 18, 2014 1:05 am
by c.keimel
Hello

I am just getting started with docx4j version 3.2.1.

I am wondering about this warning message I see on the log:
WARN org.docx4j.openpackaging.io3.Save sourcePartStore undefined

Looking at the code, it seams as if OpcPackage.getSourcePartStore() is expected to be set already.

I will receive this warning if I do something simple like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
WordprocessingMLPackage pkg = WordprocessingMLPackage.createPackage();
pkg.save(file);
Parsed in 0.014 seconds, using GeSHi 1.0.8.4

Am I missing a dependency, that would hook this automatically? This could be the case, since our application is based on equinox and I am integrating docx4j as an OSGi bundle, trying to include only the necessary dependencies that we will actualy need. I was able to set this up with the available documentation and I have tested creating simple docx files (i.e. with the sample CreateWordprocessingMLDocument) successfully.

Or do I need to do some additional steps to configure docx4j?

Any pointers are very welcome.

Regards
Christoph Keimel

Re: Warning "sourcePartStore undefined" from org.docx4j.open

PostPosted: Thu Dec 18, 2014 1:36 am
by jason
That's normal in the case where you have created a docx with createPackage()

It would be a problem in the case where you have opened an existing docx with docx4j (since it expects to find the parts in the sourcePartStore).

Regarding OSGi, there are some docx4j OSGi bundle definitions floating around on the web if you need to look at one.

Re: Warning "sourcePartStore undefined" from org.docx4j.open

PostPosted: Tue Jan 13, 2015 9:58 pm
by c.keimel
Hi Jason

thanks for your reply. That is good to know! I get a lot of warnings that seem to be similar:

[2015-01-13 11:34:07,326] WARN org.docx4j.openpackaging.parts.JaxbXmlPart No PartStore defined for this package (it was probably created, not loaded).
[2015-01-13 11:34:07,326] WARN org.docx4j.openpackaging.parts.JaxbXmlPart /word/settings.xml: did you initialise its contents to something?
[2015-01-13 11:34:07,328] WARN org.docx4j.openpackaging.io3.Save sourcePartStore undefined

Is there a way to create a PartStore for a new package, so that these warnings disappear?

Here is another warning that seems to be of no consequence, because it is always issued by DocumentSettingsPart.setMceIgnorable() by default, regardless of it's state:
[2015-01-13 11:34:07,466] WARN org.docx4j.openpackaging.parts.WordprocessingML.DocumentSettingsPart

We treat warnings almost like errors, in the sense that we try to get rid of them. Our worse: If our customer finds stuff like this in his log, he will think something is wrong, or at least "not optimal". Of course I could set the log-level of org.docx4j.openpackaging to ERROR by default, but that way I am afraid that I might miss some important warnings.

Or could we get rid of these warnings all together? In my opinion, a warning should not be logged in cases that are "normal". I would do the work and send a pull request, if a committer gives me a positive sign ...

Regards
Christoph

Re: Warning "sourcePartStore undefined" from org.docx4j.open

PostPosted: Thu Jan 15, 2015 10:50 am
by jason
Hi Christoph, I hear what you are saying. Let me take a look at it (hopefully in the next week). After I've refined the log handling, you can review.