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 2008/03/27 19:30:49 UTC

DO NOT REPLY [Bug 44695] New: HSSF: Formulas are broken after re-save

https://issues.apache.org/bugzilla/show_bug.cgi?id=44695

           Summary: HSSF: Formulas are broken after re-save
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: yegor@dinom.ru


Actually there are two problems:
 (1) In some cases formulas are broken after save. 
 (2) POI can't read the saved file with the broken formulas. I'm getting the
following exception:

Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException:
Unable to construct record instance
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:204)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:122)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:204)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:256)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:237)
        at org.apache.poi.hssf.scratchpad.Scratchpad.main(Scratchpad.java:44)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:192)
        ... 10 more
Caused by: java.lang.IllegalArgumentException: Illegal length 17478
        at
org.apache.poi.hssf.record.RecordInputStream.readCompressedUnicode(RecordInputStream.java:270)
        at
org.apache.poi.hssf.record.ExternalNameRecord.fillFields(ExternalNameRecord.java:162)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at
org.apache.poi.hssf.record.ExternalNameRecord.<init>(ExternalNameRecord.java:54)
        ... 15 more


This bug has appeared recently. The attached unit test passes with POI 3.0.2
but fails with trunk.

I attached a failing unit test and two files:

formulas.xls            initial file with a formula in A1
formulas-saved.xls      saved by POI. The formula in A1 is broken


It seems to be related to bug #44504. Josh, any ideas?  


Regards,
Yegor


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 44695] HSSF: Formulas are broken after re-save

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44695


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #4 from Josh Micich <jo...@gildedtree.com>  2008-03-27 13:15:41 PST ---
Fixed in svn r641967/r641964

This was a problem in ExternalNameRecord.serialize(int, byte[]).  I originally
left a TODO in that method to write a junit, because the code seemed difficult
to read.

Perhaps at some stage we could re-visit these serialize() / fillFields()
methods of the org.apache.poi.hssf.record.Record hierarchy.  It's difficult to
keep track of byte array offsets while streaming record fields.  The JDK (with
DataInputStream / DataOutputStream) shows better examples of how to do this.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 44695] HSSF: Formulas are broken after re-save

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44695





--- Comment #2 from Yegor Kozlov <ye...@dinom.ru>  2008-03-27 11:32:06 PST ---
Created an attachment (id=21724)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21724)
saved by POI


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 44695] HSSF: Formulas are broken after re-save

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44695





--- Comment #3 from Yegor Kozlov <ye...@dinom.ru>  2008-03-27 11:33:39 PST ---
Created an attachment (id=21725)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21725)
failing test 


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 44695] HSSF: Formulas are broken after re-save

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44695





--- Comment #1 from Yegor Kozlov <ye...@dinom.ru>  2008-03-27 11:31:25 PST ---
Created an attachment (id=21723)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21723)
initial file


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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