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/03/03 18:47:37 UTC
svn commit: r633205 -
/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java
Author: nick
Date: Mon Mar 3 09:47:36 2008
New Revision: 633205
URL: http://svn.apache.org/viewvc?rev=633205&view=rev
Log:
Fix indent, add more documentation, and make the error message more helpful
Modified:
poi/trunk/src/java/org/apache/poi/hssf/record/formula/ArrayPtg.java
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=633205&r1=633204&r2=633205&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 Mon Mar 3 09:47:36 2008
@@ -72,8 +72,10 @@
field_7_reserved = in.readByte();
}
- /** Read in the actual token (array) values. This occurs AFTER the last
- * Ptg in the expression.
+ /**
+ * Read in the actual token (array) values. This occurs
+ * AFTER the last Ptg in the expression.
+ * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf
*/
public void readTokenValues(RecordInputStream in) {
token_1_columns = (short)(0x00ff & in.readByte());
@@ -88,18 +90,17 @@
token_3_arrayValues = new Object[token_1_columns][token_2_rows];
for (int x=0;x<token_1_columns;x++) {
- for (int y=0;y<token_2_rows;y++) {
- byte grbit = in.readByte();
- if (grbit == 0x01) {
- token_3_arrayValues[x][y] = new Double(in.readDouble());
- } else if (grbit == 0x02) {
- //Ignore the doco, it is actually a unicode string with all the
- //trimmings ie 16 bit size, option byte etc
- token_3_arrayValues[x][y] = in.readUnicodeString();
- } else throw new RecordFormatException("Unknown grbit '"+grbit+"'");
- }
+ for (int y=0;y<token_2_rows;y++) {
+ byte grbit = in.readByte();
+ if (grbit == 0x01) {
+ token_3_arrayValues[x][y] = new Double(in.readDouble());
+ } else if (grbit == 0x02) {
+ //Ignore the doco, it is actually a unicode string with all the
+ //trimmings ie 16 bit size, option byte etc
+ token_3_arrayValues[x][y] = in.readUnicodeString();
+ } else throw new RecordFormatException("Unknown grbit '"+grbit+"' at " + x + "," + y + " with " + in.remaining() + " bytes left");
+ }
}
-
}
public String toString()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org