You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/09/21 19:49:20 UTC

svn commit: r697562 - in /poi/trunk/src: documentation/content/xdocs/ java/org/apache/poi/hssf/record/ testcases/org/apache/poi/hssf/data/ testcases/org/apache/poi/hssf/usermodel/

Author: nick
Date: Sun Sep 21 10:49:20 2008
New Revision: 697562

URL: http://svn.apache.org/viewvc?rev=697562&view=rev
Log:
Fix bug #45784 - Support long chart titles in SeriesTextRecords

Added:
    poi/trunk/src/testcases/org/apache/poi/hssf/data/45784.xls   (with props)
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/SeriesTextRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.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=697562&r1=697561&r2=697562&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Sun Sep 21 10:49:20 2008
@@ -37,6 +37,7 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.2-alpha1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">45784 - Support long chart titles in SeriesTextRecords</action>
            <action dev="POI-DEVELOPERS" type="fix">45777 - Throw an exception if HSSF Footer or Header is attemped to be set too long, rather than having it break during writing out</action>
            <action dev="POI-DEVELOPERS" type="add">45844 - Addtional diagnostics for HSLF SlideShowRecordDumper</action>
            <action dev="POI-DEVELOPERS" type="fix">45829 - HSSFPicture.getImageDimension() failed when DPI of image is zero</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=697562&r1=697561&r2=697562&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sun Sep 21 10:49:20 2008
@@ -34,6 +34,7 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.2-alpha1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">45784 - Support long chart titles in SeriesTextRecords</action>
            <action dev="POI-DEVELOPERS" type="fix">45777 - Throw an exception if HSSF Footer or Header is attemped to be set too long, rather than having it break during writing out</action>
            <action dev="POI-DEVELOPERS" type="add">45844 - Addtional diagnostics for HSLF SlideShowRecordDumper</action>
            <action dev="POI-DEVELOPERS" type="fix">45829 - HSSFPicture.getImageDimension() failed when DPI of image is zero</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java?rev=697562&r1=697561&r2=697562&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java Sun Sep 21 10:49:20 2008
@@ -75,7 +75,8 @@
         field_1_id                     = in.readShort();
         field_2_textLength             = in.readByte();
         field_3_undocumented           = in.readByte();
-        field_4_text                   = in.readUnicodeLEString(field_2_textLength);
+        field_4_text                   = in.readUnicodeLEString(
+        		LittleEndian.ubyteToInt(field_2_textLength));
     }
 
     public String toString()
@@ -163,18 +164,34 @@
     /**
      * Get the text length field for the SeriesText record.
      */
-    public byte getTextLength()
+    public int getTextLength()
     {
-        return field_2_textLength;
+        return LittleEndian.ubyteToInt(field_2_textLength);
     }
 
     /**
      * Set the text length field for the SeriesText record.
+     * Needs to be wrapped.
      */
     public void setTextLength(byte field_2_textLength)
     {
         this.field_2_textLength = field_2_textLength;
     }
+    /**
+     * Set the text length field for the SeriesText record.
+     */
+    public void setTextLength(int field_2_textLength)
+    {
+    	if(field_2_textLength > 255) {
+    		throw new IllegalArgumentException("Length must be 0-255");
+    	}
+    	if(field_2_textLength > 127) {
+    		this.field_2_textLength = (byte)
+    			(field_2_textLength-256);
+    	} else {
+    		this.field_2_textLength = (byte)field_2_textLength;
+    	}
+    }
 
     /**
      * Get the undocumented field for the SeriesText record.

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

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

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=697562&r1=697561&r2=697562&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Sun Sep 21 10:49:20 2008
@@ -1474,4 +1474,14 @@
     		fail();
     	} catch(IllegalArgumentException e) {}
     }
+    
+    /**
+     * Charts with long titles
+     */
+    public void test45784() {
+    	// This used to break
+        HSSFWorkbook wb = openSample("45784.xls");
+        assertEquals(1, wb.getNumberOfSheets());
+    	
+    }
 }



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