Author: josh
Date: Sun Jul 13 16:23:13 2008
New Revision: 676457

URL: http://svn.apache.org/viewvc?rev=676457&view=rev
Log:
Fix for bug 45380 - added return keyword in ArrayPtg.toFormulaString()

Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestArrayPtg.java

Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=676457&r1=676456&r2=676457&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Sun Jul 13 16:23:13 
2008
@@ -37,6 +37,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.1.1-alpha1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="add">45380 - Missing return 
keyword in ArrayPtg.toFormulaString()</action>
            <action dev="POI-DEVELOPERS" type="add">44958 - Record level 
support for Data Tables. (No formula parser support though)</action>
            <action dev="POI-DEVELOPERS" type="add">35583 - Include a version 
class, org.apache.poi.Version, to allow easy introspection of the POI 
version</action>
            <action dev="POI-DEVELOPERS" type="add">Allow the cloning of one 
HSSFCellStyle onto another, including cloning styles from one HSSFWorkbook onto 
another</action>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=676457&r1=676456&r2=676457&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sun Jul 13 16:23:13 
2008
@@ -34,6 +34,7 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1.1-alpha1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="add">45380 - Missing return 
keyword in ArrayPtg.toFormulaString()</action>
            <action dev="POI-DEVELOPERS" type="add">44958 - Record level 
support for Data Tables. (No formula parser support though)</action>
            <action dev="POI-DEVELOPERS" type="add">35583 - Include a version 
class, org.apache.poi.Version, to allow easy introspection of the POI 
version</action>
            <action dev="POI-DEVELOPERS" type="add">Allow the cloning of one 
HSSFCellStyle onto another, including cloning styles from one HSSFWorkbook onto 
another</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java?rev=676457&r1=676456&r2=676457&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java 
(original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java Sun Jul 
13 16:23:13 2008
@@ -176,7 +176,7 @@
                        return ((Double)o).toString();
                }
                if (o instanceof Boolean) {
-                       ((Boolean)o).toString();
+                       return ((Boolean)o).booleanValue() ? "TRUE" : "FALSE";
                }
                if (o instanceof ErrorConstant) {
                        return ((ErrorConstant)o).getText();

Modified: 
poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestArrayPtg.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestArrayPtg.java?rev=676457&r1=676456&r2=676457&view=diff
==============================================================================
--- 
poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestArrayPtg.java 
(original)
+++ 
poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/TestArrayPtg.java 
Sun Jul 13 16:23:13 2008
@@ -102,7 +102,7 @@
        public void testElementOrderingInSpreadsheet() {
                HSSFWorkbook wb = 
HSSFTestDataSamples.openSampleWorkbook("ex42564-elementOrder.xls");
 
-               // The formula has an array with 3 rows and 5 column 
+               // The formula has an array with 3 rows and 5 columns 
                String formula = 
wb.getSheetAt(0).getRow(0).getCell((short)0).getCellFormula();
                // TODO - These number literals should not have '.0'. Excel has 
different number rendering rules
 
@@ -111,4 +111,21 @@
                }
                
assertEquals("SUM({1.0,2.0,3.0;4.0,5.0,6.0;7.0,8.0,9.0;10.0,11.0,12.0;13.0,14.0,15.0})",
 formula);
        }
+
+       public void testToFormulaString() {
+               ArrayPtg ptg = new ArrayPtg(new 
TestcaseRecordInputStream(ArrayPtg.sid, ENCODED_PTG_DATA));
+               
+               ptg.readTokenValues(new TestcaseRecordInputStream(0, 
ENCODED_CONSTANT_DATA));
+               
+               String actualFormula;
+               try {
+                       actualFormula = ptg.toFormulaString(null);
+               } catch (IllegalArgumentException e) {
+                       if (e.getMessage().equals("Unexpected constant class 
(java.lang.Boolean)")) {
+                               throw new AssertionFailedError("Identified bug 
45380");
+                       }
+                       throw e;
+               }
+               assertEquals("{TRUE,\"ABCD\";\"E\",0.0;FALSE,\"FG\"}", 
actualFormula);
+       }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to