From: Yegor Kozlov Date: Sat, 11 Sep 2010 12:45:59 +0000 (+0000) Subject: fixed inconsistent behaviour between HSSF and XSSF when creating consecutive names... X-Git-Tag: REL_3_7_BETA3~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=eac4e0b4859e4c19a1b65f0beca89a27d04fad32;p=poi.git fixed inconsistent behaviour between HSSF and XSSF when creating consecutive names, see Bugzilla 49907 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@996136 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 193752ed3a..a837169ed3 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 49907 - fixed inconsistent behaviour between HSSF and XSSF when creating consecutive names Add getMimeType() method to HWPF Picture, alongside existing file extension Add code for reading Ole10Native data Add getMimeType() method to HSSF/XSSF PictureData, alongside existing file extension diff --git a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java index 1ac6a2a375..28b6ac6263 100644 --- a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java +++ b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java @@ -1863,11 +1863,6 @@ public final class InternalWorkbook { { LinkTable linkTable = getOrCreateLinkTable(); - if(linkTable.nameAlreadyExists(name)) { - throw new IllegalArgumentException( - "You are trying to assign a duplicated name record: " - + name.getNameText()); - } linkTable.addName(name); return name; @@ -1884,7 +1879,7 @@ public final class InternalWorkbook { NameRecord name = new NameRecord(builtInName, sheetNumber); - while(linkTable.nameAlreadyExists(name)) { + if(linkTable.nameAlreadyExists(name)) { throw new RuntimeException("Builtin (" + builtInName + ") already exists for sheet (" + sheetNumber + ")"); } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index 42ce4bcb87..8ae7f9a858 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -465,7 +465,9 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable