poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r653675 - in /poi/trunk/src: documentation/content/xdocs/ java/org/apache/poi/hssf/record/ testcases/org/apache/poi/hssf/data/ testcases/org/apache/poi/hssf/record/
Date Tue, 06 May 2008 03:57:17 GMT
Author: josh
Date: Mon May  5 20:57:15 2008
New Revision: 653675

URL: http://svn.apache.org/viewvc?rev=653675&view=rev
Log:
42570 - fixed LabelRecord to use empty string instead of null when the length is zero.

Added:
    poi/trunk/src/testcases/org/apache/poi/hssf/data/ex42570-20305.xls   (with props)
    poi/trunk/src/testcases/org/apache/poi/hssf/record/TestLabelRecord.java
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/LabelRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/AllRecordTests.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=653675&r1=653674&r2=653675&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Mon May  5 20:57:15 2008
@@ -37,6 +37,7 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.1-beta2" date="2008-05-??">
+           <action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use
empty string instead of null when the length is zero.</action>
            <action dev="POI-DEVELOPERS" type="fix">42564 - fixed ArrayPtg to use ConstantValueParser.
 Fixed a few other ArrayPtg encoding issues.</action>
            <action dev="POI-DEVELOPERS" type="fix">Follow-on from 28754 - StringPtg.toFormulaString()
should escape double quotes</action>
            <action dev="POI-DEVELOPERS" type="fix">44929 - Improved error handling
in HSSFWorkbook when attempting to read a BIFF5 file</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=653675&r1=653674&r2=653675&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Mon May  5 20:57:15 2008
@@ -34,6 +34,7 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1-beta2" date="2008-05-??">
+           <action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use
empty string instead of null when the length is zero.</action>
            <action dev="POI-DEVELOPERS" type="fix">42564 - fixed ArrayPtg to use ConstantValueParser.
 Fixed a few other ArrayPtg encoding issues.</action>
            <action dev="POI-DEVELOPERS" type="fix">Follow-on from 28754 - StringPtg.toFormulaString()
should escape double quotes</action>
            <action dev="POI-DEVELOPERS" type="fix">44929 - Improved error handling
in HSSFWorkbook when attempting to read a BIFF5 file</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/LabelRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/LabelRecord.java?rev=653675&r1=653674&r2=653675&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/LabelRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/LabelRecord.java Mon May  5 20:57:15 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
-/*
- * LabelRecord.java
- *
- * Created on November 11, 2001, 12:51 PM
- */
 package org.apache.poi.hssf.record;
 
 /**
@@ -33,14 +26,10 @@
  * @version 2.0-pre
  * @see org.apache.poi.hssf.record.LabelSSTRecord
  */
-
-public class LabelRecord
-    extends Record
-    implements CellValueRecordInterface
-{
+public final class LabelRecord extends Record implements CellValueRecordInterface {
     public final static short sid = 0x204;
-    //private short             field_1_row;
-    private int             field_1_row;
+
+    private int               field_1_row;
     private short             field_2_column;
     private short             field_3_xf_index;
     private short             field_4_string_len;
@@ -85,35 +74,30 @@
 
     protected void fillFields(RecordInputStream in)
     {
-        //field_1_row          = LittleEndian.getShort(data, 0 + offset);
         field_1_row          = in.readUShort();
         field_2_column       = in.readShort();
         field_3_xf_index     = in.readShort();
         field_4_string_len   = in.readShort();
         field_5_unicode_flag = in.readByte();
         if (field_4_string_len > 0) {
-          if (isUnCompressedUnicode()) {
-            field_6_value = in.readUnicodeLEString(field_4_string_len);
-          } else {
-            field_6_value = in.readCompressedUnicode(field_4_string_len);
+            if (isUnCompressedUnicode()) {
+                field_6_value = in.readUnicodeLEString(field_4_string_len);
+            } else {
+                field_6_value = in.readCompressedUnicode(field_4_string_len);
+            }
+        } else {
+            field_6_value = "";
         }
-        } else field_6_value = null;
     }
 
-/* READ ONLY ACCESS... THIS IS FOR COMPATIBILITY ONLY...USE LABELSST!
-      public void setRow(short row) {
-        field_1_row = row;
-      }
-
-      public void setColumn(short col) {
-        field_2_column = col;
-      }
-
-      public void setXFIndex(short index) {
-        field_3_xf_index = index;
-      }
-  */
-    //public short getRow()
+/*
+ * READ ONLY ACCESS... THIS IS FOR COMPATIBILITY ONLY...USE LABELSST! public
+ * void setRow(short row) { field_1_row = row; }
+ * 
+ * public void setColumn(short col) { field_2_column = col; }
+ * 
+ * public void setXFIndex(short index) { field_3_xf_index = index; }
+ */
     public int getRow()
     {
         return field_1_row;

Added: poi/trunk/src/testcases/org/apache/poi/hssf/data/ex42570-20305.xls
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/data/ex42570-20305.xls?rev=653675&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/src/testcases/org/apache/poi/hssf/data/ex42570-20305.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java?rev=653675&r1=653674&r2=653675&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java Mon May  5 20:57:15
2008
@@ -67,6 +67,7 @@
 		result.addTestSuite(TestFormulaRecord.class);
 		result.addTestSuite(TestFrameRecord.class);
 		result.addTestSuite(TestHyperlinkRecord.class);
+		result.addTestSuite(TestLabelRecord.class);
 		result.addTestSuite(TestLegendRecord.class);
 		result.addTestSuite(TestLineFormatRecord.class);
 		result.addTestSuite(TestLinkedDataRecord.class);

Added: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestLabelRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestLabelRecord.java?rev=653675&view=auto
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestLabelRecord.java (added)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestLabelRecord.java Mon May  5 20:57:15
2008
@@ -0,0 +1,41 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+/**
+ * Tests for <tt>LabelRecord</tt>
+ * 
+ * @author Josh Micich
+ */
+public final class TestLabelRecord extends TestCase {
+
+	public void testEmptyString() {
+		HSSFWorkbook wb;
+		try {
+			wb = HSSFTestDataSamples.openSampleWorkbook("ex42570-20305.xls");
+		} catch (NullPointerException e) {
+			throw new AssertionFailedError("Identified bug 42570");
+		}
+		HSSFTestDataSamples.writeOutAndReadBack(wb);
+	}
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message