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/06/28 20:48:35 UTC

svn commit: r672567 - in /poi/trunk/src: documentation/content/xdocs/ scratchpad/src/org/apache/poi/hwpf/sprm/ testcases/org/apache/poi/hssf/eventusermodel/

Author: nick
Date: Sat Jun 28 11:48:35 2008
New Revision: 672567

URL: http://svn.apache.org/viewvc?rev=672567&view=rev
Log:
Patch from dnapoletano from bug #45175 - Support for variable length operands in org.apache.poi.hwpf.sprm.SprmOperation

Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java
    poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.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=672567&r1=672566&r2=672567&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Sat Jun 28 11:48:35 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">45175 - Support for variable length operands in org.apache.poi.hwpf.sprm.SprmOperation</action>
            <action dev="POI-DEVELOPERS" type="fix">Avoid spurious missing lines with the MissingRecordAware event code, and odd files that contain RowRecords in the middle of the cell Records.</action>
            <action dev="POI-DEVELOPERS" type="add">Support for parsing formulas during EventUserModel processing, via the new EventWorkbookBuilder</action>
         </release>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=672567&r1=672566&r2=672567&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat Jun 28 11:48:35 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">45175 - Support for variable length operands in org.apache.poi.hwpf.sprm.SprmOperation</action>
            <action dev="POI-DEVELOPERS" type="fix">Avoid spurious missing lines with the MissingRecordAware event code, and odd files that contain RowRecords in the middle of the cell Records.</action>
            <action dev="POI-DEVELOPERS" type="add">Support for parsing formulas during EventUserModel processing, via the new EventWorkbookBuilder</action>
         </release>

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java?rev=672567&r1=672566&r2=672567&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java Sat Jun 28 11:48:35 2008
@@ -101,7 +101,14 @@
       case 3:
         return LittleEndian.getInt(_grpprl, _gOffset);
       case 6:
-        throw new UnsupportedOperationException("This SPRM contains a variable length operand");
+          byte operandLength = _grpprl[_gOffset + 1];   //surely shorter than an int...
+    	  
+          byte [] codeBytes = new byte[LittleEndian.INT_SIZE]; //initialized to zeros by JVM
+          for(int i = 0; i < operandLength; i++)
+              if(_gOffset + i < _grpprl.length)
+    			  codeBytes[i] = _grpprl[_gOffset + 1 + i];
+
+          return LittleEndian.getInt(codeBytes, 0);
       case 7:
         byte threeByteInt[] = new byte[4];
         threeByteInt[0] = _grpprl[_gOffset];

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java?rev=672567&r1=672566&r2=672567&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java Sat Jun 28 11:48:35 2008
@@ -353,9 +353,6 @@
 	public void testNoExtraNewLines() throws Exception {
 		// Load a different file
 		openAlt();
-		for(int i=0; i<r.length; i++) {
-			System.err.println(r[i]);
-		}
 		
 		
 		// This file has has something in lines 1-33



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