Fixed issue where adding builtin types pushed other formats later in the list.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353677 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shawn Laubach 2005-05-09 20:37:35 +00:00
parent 588c498c5b
commit 789d4f55a7
1 changed files with 7 additions and 2 deletions

View File

@ -232,7 +232,12 @@ public class HSSFDataFormat
while ( i.hasNext() ) while ( i.hasNext() )
{ {
ind = i.nextIndex(); ind = i.nextIndex();
formats.add( ind, i.next() ); if ( formats.size() < ind + 1 )
{
formats.setSize( ind + 1 );
}
formats.set( ind, i.next() );
} }
movedBuiltins = true; movedBuiltins = true;
} }
@ -247,7 +252,7 @@ public class HSSFDataFormat
ind = workbook.getFormat( format, true ); ind = workbook.getFormat( format, true );
if ( formats.size() <= ind ) if ( formats.size() <= ind )
formats.setSize( ind + 1 ); formats.setSize( ind + 1 );
formats.add( ind, format ); formats.set( ind, format );
return (short) ind; return (short) ind;
} }