Bug 17445

Summary: [PATCH] Keep current formats when adding a new one
Product: POI Reporter: Alessandro Vernet <avernet>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 2.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: Patch against CVS

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)