You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2022/11/02 17:54:26 UTC
[Bug 66337] New: In-Memory HSSF warns about missing SummaryInformation
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
Bug ID: 66337
Summary: In-Memory HSSF warns about missing SummaryInformation
Product: POI
Version: 5.2.2-FINAL
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
Assignee: dev@poi.apache.org
Reporter: nicolas.herzog@emineo.ch
Target Milestone: ---
I am creating a new HSSFWorkbook in memory and want to get the bytes (via an
OutputStream). I don't want to write it to a file.
Apache POI 5.2.2 then gives the following warnings
> 1085068 [main] WARN org.apache.poi.POIDocument - DocumentSummaryInformation property set came back as null
> 1087737 [main] WARN org.apache.poi.POIDocument - SummaryInformation property set came back as null
Digging into the source of Apache POI, this seems to be a (small) bug, since
HSSFWorkbook#getBytes reads the above properties, which cannot be read in the
case of a non-saved document. See the remark "directory can be null when
creating new documents" in
https://svn.apache.org/repos/asf/poi/tags/REL_5_2_2/poi/src/main/java/org/apache/poi/POIDocument.java
In the case of creating a Workbook in memory and afterwards just getting the
bytes , shouldn't these warnings be silenced?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
nicolas.herzog@emineo.ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #4 from nicolas.herzog@emineo.ch ---
Thank you for your quick response!
I'll give it a try tomorrow if I get on with the whole project setup...
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #5 from nicolas.herzog@emineo.ch ---
Created attachment 38432
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38432&action=edit
Proposed patch
Proposed patch to not warn about missing property sets the first time (when
they are about to be created).
I'm happy for corrections or improvements.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
rasmus.berggren@netset.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rasmus.berggren@netset.com
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #13 from Arthur <ar...@entsia.com> ---
Yes I'm using POI 5.2.5 for these artifacts:
* poi
* poi-ooxml
* poi-ooxml-lite
* poi-scratchpad
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
If you're creating a file from scratch, you may want to have the normal
document properties setup. POIDocument.html#createInformationProperties-- will
do that for you
Also, calling HSSFWorkbook.getBytes() isn't normally recommended. For almost
all use cases you should use HSSFWorkbook.write, for in-memory writing pass a
ByteArrayOutputStream
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
Arthur <ar...@entsia.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #11 from Arthur <ar...@entsia.com> ---
Hi, I also get the same codepage warnings after doing:
```
HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
hssfWorkbook.createInformationProperties();
```
I tried to find ways to set the codepage but I didn't succeed.
Things tried:
* finding a direct setter (none exist)
* trying to add a manual property to the map (failed unmodifiable)
* trying to set a cell style with a font (no changes)
It seems it is only settable by creating a workbook from a POIFSFileSystem but
this requires an existing file otherwise I get an error saying POIFSFileSystem
might not be an excel file.
Is there an other way, or is a setter missing for the codepage
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #7 from PJ Fanning <fa...@yahoo.com> ---
I added r1905045 - thanks
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
Create shouldn't issue warnings about missing bits, that does seem like a bug
I guess we should override readProperties and readPropertySet with a boolean
for "being null is fine", which the createInformationProperties call can set
Don't suppose you fancy working up a patch? :)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
rasmus.berggren@netset.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|rasmus.berggren@netset.com |
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #2 from nicolas.herzog@emineo.ch ---
Hi Nick!
Thanks for the explanation!
I'm actually not using HSSFWorkbook#getBytes() directly, but using
HSSFWorkbook#write(OutputStream).
Unfortunately, if I use PoiDocument#createInformationProiperties(), the very
same warnings appear, because the method tries to read the properties
beforehand.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #6 from nicolas.herzog@emineo.ch ---
NB. I didn't override readPropertySet(Class, String) because its private and
only used twice.
I think it would be rather difficult to write a test (static mocking of
logger...) The only test I could see that invokes
POIDocument#createInformationProperties() without first invoking
#get[Document]SummaryInformation() is TestHPSFBugs#bug62451(), and this now
doesn't output the warnings any more. Of course, one needs to change the
test-loglevels to (not) see this.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #8 from willy.gwerder@emineo.ch ---
There have been two releases since this issue had been fixed. However, it was
not included in either release.
Any chance this will make it to the next release? Thanks!
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
dstieg1@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|5.2.2-FINAL |5.4.1-FINAL
--- Comment #14 from dstieg1@gmail.com ---
I am seeing similar errors when I am creating an HSSFWorkbook with an
Inputstream.
Depending on the file upload I have warnings
[main] WARN org.apache.poi.POIDocument - DocumentSummaryInformation property
set came back as null
[main] WARN org.apache.poi.POIDocument - SummaryInformation property set came
back as null
[main] WARN org.apache.poi.hpsf.Section - The codepage property is not set
although a dictionary is present. Defaulting to ISO-8859-1.
or
[main] WARN org.apache.poi.POIDocument - DocumentSummaryInformation property
set came back as null
[main] WARN org.apache.poi.POIDocument - SummaryInformation property set came
back as null
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #12 from PJ Fanning <fa...@yahoo.com> ---
Are you using POI 5.2.5? The change that was made is only in the most recent
version(s).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #10 from markuswueest@hotmail.com ---
Hi
Thanks for your reply. You're right, the change is included.
What i don't understand is, if i need to call
workbook#createInformationProperties() after object creation so that it is
fully initialized:
> HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
> hssfWorkbook.createInformationProperties();
If i do this, i get a new warning about a missing codepage when calling
hssfWorkbook#write(OutputStream):
"The codepage property is not set although a dictionary is present. Defaulting
to ISO-8859-1."
Is there something missing in the initialization?
Thanks for the help.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #9 from PJ Fanning <fa...@yahoo.com> ---
The commit is in the code - see
https://github.com/apache/poi/commits/8690df1d28991ad482fa39181fd2a81fa2163301/poi/src/main/java/org/apache/poi/POIDocument.java
Is it possible the commit does not work?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66337] In-Memory HSSF warns about missing SummaryInformation
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66337
--- Comment #15 from toralfniebuhr@icloud.com ---
I analyzed this here https://github.com/apache/poi/issues/1051
“
If I create a new HSSFWorkbook without a template.
Like
HSSFWorkbook wb = new HSSFWorkbook(); wb.write(new
FileOutputStream("testfile"));
Then, all versions above "5.0.1" create this warning
08:38:09,198 WARN POIDocument - DocumentSummaryInformation property set came
back as null 08:38:09,205 WARN POIDocument - SummaryInformation property set
came back as null
The cause is, that when "getBytes()" is called; then updateEncryptionInfo calls
readProperties() from an empty POIDocument. The missing Records are only added
later in getBytes(), when they are read from the internal wb.
I don't know what the correct fix is here. Replace readProperties() with
readProperties(false) (same behavior as in older versions)
Or, updateEncryptionInfo working agains the wb, or calling updateEncryptionInfo
later.
“
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org