From 789d4f55a7ce96c30bff570ff7d91bf1c975f0a8 Mon Sep 17 00:00:00 2001 From: Shawn Laubach Date: Mon, 9 May 2005 20:37:35 +0000 Subject: [PATCH] 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 --- .../org/apache/poi/hssf/usermodel/HSSFDataFormat.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java b/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java index 7cd244468f..15362bbfdd 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java @@ -232,7 +232,12 @@ public class HSSFDataFormat while ( i.hasNext() ) { ind = i.nextIndex(); - formats.add( ind, i.next() ); + if ( formats.size() < ind + 1 ) + { + formats.setSize( ind + 1 ); + } + + formats.set( ind, i.next() ); } movedBuiltins = true; } @@ -247,7 +252,7 @@ public class HSSFDataFormat ind = workbook.getFormat( format, true ); if ( formats.size() <= ind ) formats.setSize( ind + 1 ); - formats.add( ind, format ); + formats.set( ind, format ); return (short) ind; }