You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2012/02/07 11:46:55 UTC
svn commit: r1241419 - in /poi/trunk: src/documentation/content/xdocs/
src/java/org/apache/poi/hssf/record/aggregates/
src/testcases/org/apache/poi/hssf/record/aggregates/ test-data/spreadsheet/
Author: yegor
Date: Tue Feb 7 10:46:55 2012
New Revision: 1241419
URL: http://svn.apache.org/viewvc?rev=1241419&view=rev
Log:
Bugzilla 52527: avoid exception when matching shared formula records in HSSF
Added:
poi/trunk/test-data/spreadsheet/52527.xls (with props)
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestSharedValueManager.java
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1241419&r1=1241418&r2=1241419&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Tue Feb 7 10:46:55 2012
@@ -34,6 +34,7 @@
<changes>
<release version="3.8-beta6" date="2012-??-??">
+ <action dev="poi-developers" type="fix">52527 - avoid exception when matching shared formula records in HSSF</action>
<action dev="poi-developers" type="add">52568 - Added methods to set/get an XWPFRun's text color</action>
<action dev="poi-developers" type="add">52566 - Added methods to set/get vertical alignment and color in XWPFTableCell</action>
<action dev="poi-developers" type="add">52562 - Added methods to get/set a table row's Can't Split and Repeat Header attributes in XWPF</action>
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java?rev=1241419&r1=1241418&r2=1241419&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/SharedValueManager.java Tue Feb 7 10:46:55 2012
@@ -158,6 +158,9 @@ public final class SharedValueManager {
*/
public SharedFormulaRecord linkSharedFormulaRecord(CellReference firstCell, FormulaRecordAggregate agg) {
SharedFormulaGroup result = findFormulaGroupForCell(firstCell);
+ if(null == result) {
+ throw new RuntimeException("Failed to find a matching shared formula record");
+ }
result.add(agg);
return result.getSFR();
}
@@ -170,10 +173,6 @@ public final class SharedValueManager {
}
}
SharedFormulaGroup sfg = _groupsCache.get(getKeyForCache(cellRef));
- if(null == sfg) {
- // TODO - fix file "15228.xls" so it opens in Excel after rewriting with POI
- throw new RuntimeException("Failed to find a matching shared formula record");
- }
return sfg;
}
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestSharedValueManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestSharedValueManager.java?rev=1241419&r1=1241418&r2=1241419&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestSharedValueManager.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestSharedValueManager.java Tue Feb 7 10:46:55 2012
@@ -192,4 +192,24 @@ public final class TestSharedValueManage
throw new RuntimeException(e);
}
}
+
+ public void testBug52527() {
+ HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("52527.xls");
+ HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1);
+
+ assertEquals("IF(H3,LINEST(N9:N14,K9:M14,FALSE),LINEST(N8:N14,K8:M14,FALSE))",
+ wb1.getSheetAt(0).getRow(4).getCell(11).getCellFormula());
+ assertEquals("IF(H3,LINEST(N9:N14,K9:M14,FALSE),LINEST(N8:N14,K8:M14,FALSE))",
+ wb2.getSheetAt(0).getRow(4).getCell(11).getCellFormula());
+
+ assertEquals("1/SQRT(J9)",
+ wb1.getSheetAt(0).getRow(8).getCell(10).getCellFormula());
+ assertEquals("1/SQRT(J9)",
+ wb2.getSheetAt(0).getRow(8).getCell(10).getCellFormula());
+
+ assertEquals("1/SQRT(J26)",
+ wb1.getSheetAt(0).getRow(25).getCell(10).getCellFormula());
+ assertEquals("1/SQRT(J26)",
+ wb2.getSheetAt(0).getRow(25).getCell(10).getCellFormula());
+ }
}
Added: poi/trunk/test-data/spreadsheet/52527.xls
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/52527.xls?rev=1241419&view=auto
==============================================================================
Binary file - no diff available.
Propchange: poi/trunk/test-data/spreadsheet/52527.xls
------------------------------------------------------------------------------
svn:mime-type = application/msword
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org