Bug 17445 - [PATCH] Keep current formats when adding a new one
Summary: [PATCH] Keep current formats when adding a new one
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-dev
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-26 18:34 UTC by Alessandro Vernet
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Patch against CVS (753 bytes, patch)
2003-02-26 18:35 UTC, Alessandro Vernet
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Vernet 2003-02-26 18:34:04 UTC
When HSSFDataFormat.getFormat need to add an entry in the "formats" table and
that "!movedBuiltins", it will first move the content of the "builtinFormats"
table to "formats". It does this with a (line 272):

                formats.add( ind, i.next() );

This will move the entries that are already there in "formats". Instead, I
changed that to:

                formats.set( ind, i.next() );

This solves the problem I was experimenting. Just let me know if you need any
additional information.
Comment 1 Alessandro Vernet 2003-02-26 18:35:44 UTC
Created attachment 5050 [details]
Patch against CVS
Comment 2 Avik Sengupta 2003-04-02 13:21:46 UTC
Testcase fails. 
Testsuite: org.apache.poi.hssf.usermodel.TestWorkbook
Testcase: testWriteDataFormat took 0.01 sec
        Caused an ERROR
Array index out of range: 45
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 45
        at java.util.Vector.set(Vector.java:713)
        at
org.apache.poi.hssf.usermodel.HSSFDataFormat.getFormat(HSSFDataFormat.java:272)
        at
org.apache.poi.hssf.usermodel.TestWorkbook.testWriteDataFormat(TestWorkbook.java:285)