+ * Title: HCenter record (0x0083)
* Description: whether to center between horizontal margins
* REFERENCE: PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
* @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height (jheight at chariot dot net dot au) * @version 2.0-pre */ - -public class HCenterRecord - extends Record -{ - public final static short sid = 0x83; +public final class HCenterRecord extends Record { + public final static short sid = 0x0083; private short field_1_hcenter; public HCenterRecord() { } - /** - * Constructs an HCenter record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public HCenterRecord(RecordInputStream in) - { - super(in); - } - - protected void validateSid(short id) - { - if (id != sid) - { - throw new RecordFormatException("NOT A HCenter RECORD"); - } - } - - protected void fillFields(RecordInputStream in) { field_1_hcenter = in.readShort(); } @@ -104,8 +81,8 @@ public class HCenterRecord public int serialize(int offset, byte [] data) { LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); - LittleEndian.putShort(data, 4 + offset, ( short ) field_1_hcenter); + LittleEndian.putUShort(data, 2 + offset, 0x2); + LittleEndian.putUShort(data, 4 + offset, field_1_hcenter); return getRecordSize(); } diff --git a/src/java/org/apache/poi/hssf/record/HeaderRecord.java b/src/java/org/apache/poi/hssf/record/HeaderRecord.java index e8190364a8..61ff851306 100644 --- a/src/java/org/apache/poi/hssf/record/HeaderRecord.java +++ b/src/java/org/apache/poi/hssf/record/HeaderRecord.java @@ -45,25 +45,7 @@ public class HeaderRecord { } - /** - * Constructs an Header record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public HeaderRecord(RecordInputStream in) - { - super(in); - } - - protected void validateSid(short id) - { - if (id != sid) - { - throw new RecordFormatException("NOT A HEADERRECORD"); - } - } - - protected void fillFields(RecordInputStream in) { if (in.remaining() > 0) { diff --git a/src/java/org/apache/poi/hssf/record/HideObjRecord.java b/src/java/org/apache/poi/hssf/record/HideObjRecord.java index 1496720d4f..496002618a 100644 --- a/src/java/org/apache/poi/hssf/record/HideObjRecord.java +++ b/src/java/org/apache/poi/hssf/record/HideObjRecord.java @@ -42,25 +42,7 @@ public class HideObjRecord { } - /** - * Constructs an HideObj record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public HideObjRecord(RecordInputStream in) - { - super(in); - } - - protected void validateSid(short id) - { - if (id != sid) - { - throw new RecordFormatException("NOT A HIDEOBJ RECORD"); - } - } - - protected void fillFields(RecordInputStream in) { field_1_hide_obj = in.readShort(); } diff --git a/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java b/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java index a6846300cb..63e757f8df 100644 --- a/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java +++ b/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java @@ -44,13 +44,6 @@ public final class HorizontalPageBreakRecord extends PageBreakRecord { super(in); } - protected void validateSid(short id) { - if (id != getSid()) { - throw new RecordFormatException( - "NOT A HorizontalPageBreak or VerticalPageBreak RECORD!! " + id); - } - } - public short getSid() { return sid; } diff --git a/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java b/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java index e28cf5bf86..6fc5b97163 100644 --- a/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java +++ b/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java @@ -130,16 +130,6 @@ public class HyperlinkRecord extends Record { } - /** - * Read hyperlink from input stream - * - * @param in the stream to read from - */ - public HyperlinkRecord(RecordInputStream in) - { - super(in); - } - /** * Return the column of the first cell that contains the hyperlink * @@ -315,7 +305,7 @@ public class HyperlinkRecord extends Record { /** * @param in the RecordInputstream to read the record from */ - protected void fillFields(RecordInputStream in) + public HyperlinkRecord(RecordInputStream in) { try { rwFirst = in.readShort(); @@ -372,14 +362,6 @@ public class HyperlinkRecord extends Record { return HyperlinkRecord.sid; } - protected void validateSid(short id) - { - if (id != sid) - { - throw new RecordFormatException("NOT A HYPERLINKRECORD!"); - } - } - public int serialize(int offset, byte[] data) { int pos = offset; diff --git a/src/java/org/apache/poi/hssf/record/IndexRecord.java b/src/java/org/apache/poi/hssf/record/IndexRecord.java index 957a047eaa..c7c3cfbb5a 100644 --- a/src/java/org/apache/poi/hssf/record/IndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/IndexRecord.java @@ -48,25 +48,7 @@ public class IndexRecord { } - /** - * Constructs an Index record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from - */ - public IndexRecord(RecordInputStream in) - { - super(in); - } - - protected void validateSid(short id) - { - if (id != sid) - { - throw new RecordFormatException("NOT An Index RECORD"); - } - } - - protected void fillFields(RecordInputStream in) { field_5_dbcells = new IntList(DBCELL_CAPACITY); // initial capacity of 30 diff --git a/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java b/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java index bb92c974ca..2a9de8e563 100644 --- a/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java +++ b/src/java/org/apache/poi/hssf/record/InterfaceEndRecord.java @@ -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,49 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package org.apache.poi.hssf.record; import org.apache.poi.util.LittleEndian; /** - * Title: Interface End Record
+ * Title: Interface End Record (0x00E2)
* Description: Shows where the Interface Records end (MMS) * (has no fields)
* REFERENCE: PG 324 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
* @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/
-
-public class InterfaceEndRecord
- extends Record
-{
- public final static short sid = 0xe2;
+public final class InterfaceEndRecord extends Record {
+ public final static short sid = 0x00E2;
public InterfaceEndRecord()
{
}
/**
- * Constructs an InterfaceEnd record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
+ * @param in unused (since this record has no data)
*/
-
public InterfaceEndRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A INTERFACEEND RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
}
diff --git a/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java b/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java
index 637e2c6794..617e95855f 100644
--- a/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java
+++ b/src/java/org/apache/poi/hssf/record/InterfaceHdrRecord.java
@@ -45,25 +45,7 @@ public class InterfaceHdrRecord
{
}
- /**
- * Constructs an Codepage record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public InterfaceHdrRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A INTERFACEHDR RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_codepage = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/IterationRecord.java b/src/java/org/apache/poi/hssf/record/IterationRecord.java
index 16ab1d0741..400ee0a8c5 100644
--- a/src/java/org/apache/poi/hssf/record/IterationRecord.java
+++ b/src/java/org/apache/poi/hssf/record/IterationRecord.java
@@ -43,25 +43,7 @@ public class IterationRecord
{
}
- /**
- * Constructs an Iteration record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public IterationRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT An ITERATION RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_iteration = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/LabelRecord.java b/src/java/org/apache/poi/hssf/record/LabelRecord.java
index 844d86a0c6..f4bbfb85da 100644
--- a/src/java/org/apache/poi/hssf/record/LabelRecord.java
+++ b/src/java/org/apache/poi/hssf/record/LabelRecord.java
@@ -44,33 +44,9 @@ public final class LabelRecord extends Record implements CellValueRecordInterfac
}
/**
- * Constructs an Label record and sets its fields appropriately.
- *
* @param in the RecordInputstream to read the record from
*/
public LabelRecord(RecordInputStream in)
- {
- super(in);
- }
-
- /**
- * called by constructor, should throw runtime exception in the event of a
- * record passed with a differing ID.
- *
- * @param id alleged id for this record
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a valid LabelRecord");
- }
- }
-
- /**
- * @param in the RecordInputstream to read the record from
- */
- protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_column = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java b/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java
index 92b3436d36..f2eae83deb 100644
--- a/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java
+++ b/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java
@@ -40,25 +40,7 @@ public final class LabelSSTRecord extends Record implements CellValueRecordInter
{
}
- /**
- * Constructs an LabelSST record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
public LabelSSTRecord(RecordInputStream in)
- {
- super(in);
- }
-
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A valid LabelSST RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_column = in.readUShort();
diff --git a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java
index 9e5883c5a0..92da85ceaa 100644
--- a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java
+++ b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java
@@ -31,28 +31,7 @@ public class LeftMarginRecord extends Record implements Margin
public LeftMarginRecord() { }
- /**
- * Constructs a LeftMargin record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
public LeftMarginRecord(RecordInputStream in)
- { super(in); }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid( short id )
- {
- if ( id != sid )
- {
- throw new RecordFormatException( "Not a LeftMargin record" );
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_margin = in.readDouble();
}
@@ -106,4 +85,4 @@ public class LeftMarginRecord extends Record implements Margin
rec.field_1_margin = this.field_1_margin;
return rec;
}
-} // END OF CLASS
+} // END OF CLAS
\ No newline at end of file
diff --git a/src/java/org/apache/poi/hssf/record/LegendRecord.java b/src/java/org/apache/poi/hssf/record/LegendRecord.java
index e9c529ea3c..08ff6513fc 100644
--- a/src/java/org/apache/poi/hssf/record/LegendRecord.java
+++ b/src/java/org/apache/poi/hssf/record/LegendRecord.java
@@ -62,32 +62,7 @@ public final class LegendRecord extends Record {
}
- /**
- * Constructs a Legend record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public LegendRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a Legend record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_xAxisUpperLeft = in.readInt();
field_2_yAxisUpperLeft = in.readInt();
diff --git a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java b/src/java/org/apache/poi/hssf/record/LineFormatRecord.java
index 8caa8e4a4b..c3f0197f38 100644
--- a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java
+++ b/src/java/org/apache/poi/hssf/record/LineFormatRecord.java
@@ -61,32 +61,7 @@ public final class LineFormatRecord extends Record {
}
- /**
- * Constructs a LineFormat record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public LineFormatRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a LineFormat record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_lineColor = in.readInt();
field_2_linePattern = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java b/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java
index be5d1fd841..9e82adec6e 100644
--- a/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java
+++ b/src/java/org/apache/poi/hssf/record/LinkedDataFormulaField.java
@@ -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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -31,9 +29,7 @@ import java.util.Iterator;
*
* @author Glen Stampoultzis (glens at apache.org)
*/
-public class LinkedDataFormulaField
- implements CustomField
-{
+public final class LinkedDataFormulaField implements CustomField {
Stack formulaTokens = new Stack();
public int getSize()
diff --git a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java b/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java
index 093c1a86cb..673fc85f4b 100644
--- a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java
+++ b/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java
@@ -54,32 +54,7 @@ public final class LinkedDataRecord extends Record {
}
- /**
- * Constructs a LinkedData record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public LinkedDataRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a LinkedData record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_linkType = in.readByte();
field_2_referenceType = in.readByte();
@@ -155,7 +130,7 @@ public final class LinkedDataRecord extends Record {
rec.field_2_referenceType = field_2_referenceType;
rec.field_3_options = field_3_options;
rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord;
- rec.field_5_formulaOfLink = ((LinkedDataFormulaField)field_5_formulaOfLink.clone());;
+ rec.field_5_formulaOfLink = ((LinkedDataFormulaField)field_5_formulaOfLink.clone());
return rec;
}
diff --git a/src/java/org/apache/poi/hssf/record/MMSRecord.java b/src/java/org/apache/poi/hssf/record/MMSRecord.java
index c38e9df244..c11e2d510d 100644
--- a/src/java/org/apache/poi/hssf/record/MMSRecord.java
+++ b/src/java/org/apache/poi/hssf/record/MMSRecord.java
@@ -41,25 +41,7 @@ public class MMSRecord
{
}
- /**
- * Constructs a MMS record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public MMSRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A MMS RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_addMenuCount = in.readByte();
field_2_delMenuCount = in.readByte();
diff --git a/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java b/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java
index 525749dffa..7683c6b863 100644
--- a/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java
+++ b/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java
@@ -56,9 +56,6 @@ public final class MergeCellsRecord extends Record {
_startIndex = 0;
_regions = cras;
}
- protected void fillFields(RecordInputStream in) {
- throw new RuntimeException("obsolete");
- }
/**
* get the number of merged areas. If this drops down to 0 you should just go
* ahead and delete the record.
@@ -119,13 +116,6 @@ public final class MergeCellsRecord extends Record {
return retval.toString();
}
- protected void validateSid(short id) {
- if (id != sid) {
- throw new RecordFormatException("NOT A MERGEDCELLS RECORD!! "
- + id);
- }
- }
-
public Object clone() {
int nRegions = _numberOfRegions;
CellRangeAddress[] clonedRegions = new CellRangeAddress[nRegions];
diff --git a/src/java/org/apache/poi/hssf/record/MulBlankRecord.java b/src/java/org/apache/poi/hssf/record/MulBlankRecord.java
index dffdb2fe80..8d461fe975 100644
--- a/src/java/org/apache/poi/hssf/record/MulBlankRecord.java
+++ b/src/java/org/apache/poi/hssf/record/MulBlankRecord.java
@@ -52,17 +52,6 @@ public class MulBlankRecord
{
}
- /**
- * Constructs a MulBlank record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
- public MulBlankRecord(RecordInputStream in)
- {
- super(in);
- }
-
/**
* get the row number of the cells this represents
*
@@ -119,7 +108,7 @@ public class MulBlankRecord
/**
* @param in the RecordInputstream to read the record from
*/
- protected void fillFields(RecordInputStream in)
+ public MulBlankRecord(RecordInputStream in)
{
//field_1_row = LittleEndian.getShort(data, 0 + offset);
field_1_row = in.readUShort();
@@ -159,21 +148,6 @@ public class MulBlankRecord
return buffer.toString();
}
- /**
- * called by constructor, should throw runtime exception in the event of a
- * record passed with a differing ID.
- *
- * @param id alleged id for this record
- */
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a MulBlankRecord!");
- }
- }
-
public short getSid()
{
return sid;
diff --git a/src/java/org/apache/poi/hssf/record/MulRKRecord.java b/src/java/org/apache/poi/hssf/record/MulRKRecord.java
index c301d52a8a..0419f4921d 100644
--- a/src/java/org/apache/poi/hssf/record/MulRKRecord.java
+++ b/src/java/org/apache/poi/hssf/record/MulRKRecord.java
@@ -37,15 +37,6 @@ public final class MulRKRecord extends Record {
private RkRec[] field_3_rks;
private short field_4_last_col;
- /**
- * Constructs a MulRK record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
- public MulRKRecord(RecordInputStream in) {
- super(in);
- }
-
public int getRow() {
return field_1_row;
}
@@ -93,7 +84,7 @@ public final class MulRKRecord extends Record {
/**
* @param in the RecordInputstream to read the record from
*/
- protected void fillFields(RecordInputStream in) {
+ public MulRKRecord(RecordInputStream in) {
field_1_row = in.readUShort();
field_2_first_col = in.readShort();
field_3_rks = RkRec.parseRKs(in);
@@ -117,21 +108,6 @@ public final class MulRKRecord extends Record {
return buffer.toString();
}
- /**
- * called by constructor, should throw runtime exception in the event of a
- * record passed with a differing ID.
- *
- * @param id alleged id for this record
- */
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a MulRKRecord!");
- }
- }
-
public short getSid()
{
return sid;
diff --git a/src/java/org/apache/poi/hssf/record/NameRecord.java b/src/java/org/apache/poi/hssf/record/NameRecord.java
index 29834b9d16..512e784c0d 100644
--- a/src/java/org/apache/poi/hssf/record/NameRecord.java
+++ b/src/java/org/apache/poi/hssf/record/NameRecord.java
@@ -107,15 +107,6 @@ public final class NameRecord extends Record {
field_17_status_bar_text = "";
}
- /**
- * Constructs a Name record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
- public NameRecord(RecordInputStream in) {
- super(in);
- }
-
/**
* Constructor to create a built-in named region
* @param builtin Built-in byte representation for the name record, use the public constants
@@ -340,18 +331,6 @@ public final class NameRecord extends Record {
return field_17_status_bar_text;
}
- /**
- * called by constructor, should throw runtime exception in the event of a
- * record passed with a differing ID.
- *
- * @param id alleged id for this record
- */
- protected void validateSid(short id) {
- if (id != sid) {
- throw new RecordFormatException("NOT A valid Name RECORD");
- }
- }
-
/**
* called by the class that is responsible for writing this sucker.
@@ -551,7 +530,7 @@ public final class NameRecord extends Record {
*
* @param in the RecordInputstream to read the record from
*/
- protected void fillFields(RecordInputStream in) {
+ public NameRecord(RecordInputStream in) {
field_1_option_flag = in.readShort();
field_2_keyboard_shortcut = in.readByte();
int field_3_length_name_text = in.readByte();
diff --git a/src/java/org/apache/poi/hssf/record/NoteRecord.java b/src/java/org/apache/poi/hssf/record/NoteRecord.java
index a9e83806f8..2f506f115d 100644
--- a/src/java/org/apache/poi/hssf/record/NoteRecord.java
+++ b/src/java/org/apache/poi/hssf/record/NoteRecord.java
@@ -53,18 +53,6 @@ public class NoteRecord extends Record {
field_3_flags = 0;
}
- /**
- * Constructs a NoteRecord
and fills its fields
- * from the supplied RecordInputStream
.
- *
- * @param in the stream to read from
- */
- public NoteRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
/**
* @return id of this record.
*/
@@ -73,23 +61,10 @@ public class NoteRecord extends Record {
return sid;
}
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a NoteRecord record");
- }
- }
-
/**
* Read the record data from the supplied RecordInputStream
*/
- protected void fillFields(RecordInputStream in)
+ public NoteRecord(RecordInputStream in)
{
field_1_row = in.readShort();
field_2_col = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java
index c99f29be35..4b96a0ee45 100644
--- a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java
+++ b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java
@@ -45,33 +45,10 @@ public class NoteStructureSubRecord
reserved = new byte[22];
}
- /**
- * Constructs a NoteStructureSubRecord and sets its fields appropriately.
- *
- */
- public NoteStructureSubRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a Note Structure record");
- }
- }
-
/**
* Read the record data from the supplied RecordInputStream
*/
- protected void fillFields(RecordInputStream in)
+ public NoteStructureSubRecord(RecordInputStream in)
{
//just grab the raw data
reserved = in.readRemainder();
diff --git a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java b/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java
index 15f9c367d8..00307e141f 100644
--- a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java
+++ b/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java
@@ -42,32 +42,7 @@ public class NumberFormatIndexRecord
}
- /**
- * Constructs a NumberFormatIndex record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public NumberFormatIndexRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a NumberFormatIndex record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_formatIndex = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/NumberRecord.java b/src/java/org/apache/poi/hssf/record/NumberRecord.java
index f3d906155c..e4283f0eac 100644
--- a/src/java/org/apache/poi/hssf/record/NumberRecord.java
+++ b/src/java/org/apache/poi/hssf/record/NumberRecord.java
@@ -41,19 +41,9 @@ public final class NumberRecord extends Record implements CellValueRecordInterfa
}
/**
- * Constructs a Number record and sets its fields appropriately.
- *
* @param in the RecordInputstream to read the record from
*/
public NumberRecord(RecordInputStream in)
- {
- super(in);
- }
-
- /**
- * @param in the RecordInputstream to read the record from
- */
- protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_col = in.readUShort();
@@ -157,21 +147,6 @@ public final class NumberRecord extends Record implements CellValueRecordInterfa
return 18;
}
- /**
- * called by constructor, should throw runtime exception in the event of a
- * record passed with a differing ID.
- *
- * @param id alleged id for this record
- */
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A Number RECORD");
- }
- }
-
public short getSid()
{
return sid;
diff --git a/src/java/org/apache/poi/hssf/record/ObjRecord.java b/src/java/org/apache/poi/hssf/record/ObjRecord.java
index 0e424eed2f..03ea7d1f55 100644
--- a/src/java/org/apache/poi/hssf/record/ObjRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ObjRecord.java
@@ -43,31 +43,7 @@ public final class ObjRecord extends Record {
// TODO - ensure 2 sub-records (ftCmo 15h, and ftEnd 00h) are always created
}
- /**
- * Constructs a OBJ record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public ObjRecord(RecordInputStream in)
- {
- super(in);
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not an OBJ record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
// TODO - problems with OBJ sub-records stream
// MS spec says first sub-records is always CommonObjectDataSubRecord, and last is
diff --git a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java b/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java
index 0d64ee3d6b..7a86fe2ec4 100644
--- a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java
@@ -49,32 +49,7 @@ public class ObjectLinkRecord
}
- /**
- * Constructs a ObjectLink record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public ObjectLinkRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a ObjectLink record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_anchorId = in.readShort();
field_2_link1 = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java b/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java
index 64d50cb339..cdbb56d873 100644
--- a/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java
@@ -41,25 +41,7 @@ public class ObjectProtectRecord
{
}
- /**
- * Constructs a Protect record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public ObjectProtectRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT AN OBJECTPROTECT RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_protect = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/PageBreakRecord.java b/src/java/org/apache/poi/hssf/record/PageBreakRecord.java
index f11e3395cd..654439f316 100644
--- a/src/java/org/apache/poi/hssf/record/PageBreakRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PageBreakRecord.java
@@ -83,11 +83,7 @@ public abstract class PageBreakRecord extends Record {
_breakMap = new HashMap();
}
- protected PageBreakRecord(RecordInputStream in) {
- super(in);
- }
-
- protected void fillFields(RecordInputStream in)
+ public PageBreakRecord(RecordInputStream in)
{
int nBreaks = in.readShort();
_breaks = new ArrayList(nBreaks + 2);
diff --git a/src/java/org/apache/poi/hssf/record/PaletteRecord.java b/src/java/org/apache/poi/hssf/record/PaletteRecord.java
index d626baa2d3..0cf7856361 100644
--- a/src/java/org/apache/poi/hssf/record/PaletteRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PaletteRecord.java
@@ -48,25 +48,7 @@ public class PaletteRecord
createDefaultPalette();
}
- /**
- * Constructs a PaletteRecord record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public PaletteRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT An Palette RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_numcolors = in.readShort();
field_2_colors = new ArrayList(field_1_numcolors);
diff --git a/src/java/org/apache/poi/hssf/record/PaneRecord.java b/src/java/org/apache/poi/hssf/record/PaneRecord.java
index f02e411655..f02b0795b9 100644
--- a/src/java/org/apache/poi/hssf/record/PaneRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PaneRecord.java
@@ -49,32 +49,7 @@ public final class PaneRecord extends Record {
}
- /**
- * Constructs a Pane record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public PaneRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a Pane record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_x = in.readShort();
field_2_y = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/PasswordRecord.java b/src/java/org/apache/poi/hssf/record/PasswordRecord.java
index 67f210da5b..b7b9d075ab 100644
--- a/src/java/org/apache/poi/hssf/record/PasswordRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PasswordRecord.java
@@ -36,22 +36,7 @@ public class PasswordRecord extends Record {
public PasswordRecord() {
}
- /**
- * Constructs a Password record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public PasswordRecord(RecordInputStream in) {
- super(in);
- }
-
- protected void validateSid(short id) {
- if (id != sid) {
- throw new RecordFormatException("NOT A PASSWORD RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in) {
field_1_password = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java b/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java
index 8d31860af4..5c5567a86b 100644
--- a/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java
+++ b/src/java/org/apache/poi/hssf/record/PasswordRev4Record.java
@@ -40,25 +40,7 @@ public class PasswordRev4Record
{
}
- /**
- * Constructs a PasswordRev4 (PROT4REVPASS) record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public PasswordRev4Record(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A PROT4REVPASSWORD RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_password = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java b/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java
index e149c39ebb..e678eac782 100644
--- a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java
@@ -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,10 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
-
-
-import org.apache.poi.util.*;
+import org.apache.poi.util.LittleEndian;
/**
* preceeds and identifies a frame as belonging to the plot area.
@@ -30,9 +26,7 @@ import org.apache.poi.util.*;
* @author Andrew C. Oliver (acoliver at apache.org)
*/
-public class PlotAreaRecord
- extends Record
-{
+public final class PlotAreaRecord extends Record {
public final static short sid = 0x1035;
@@ -42,31 +36,9 @@ public class PlotAreaRecord
}
/**
- * Constructs a PlotArea record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
+ * @param in unused (since this record has no data)
*/
-
public PlotAreaRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a PlotArea record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
}
diff --git a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java b/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java
index 29c3259923..9df6811e2a 100644
--- a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java
@@ -43,32 +43,7 @@ public class PlotGrowthRecord
}
- /**
- * Constructs a PlotGrowth record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public PlotGrowthRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a PlotGrowth record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_horizontalScale = in.readInt();
field_2_verticalScale = in.readInt();
diff --git a/src/java/org/apache/poi/hssf/record/PrecisionRecord.java b/src/java/org/apache/poi/hssf/record/PrecisionRecord.java
index dd7b719221..a147cfff18 100644
--- a/src/java/org/apache/poi/hssf/record/PrecisionRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PrecisionRecord.java
@@ -40,25 +40,7 @@ public class PrecisionRecord
{
}
- /**
- * Constructs a Precision record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public PrecisionRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A PRECISION RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_precision = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java b/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java
index ff0eaac18d..7b4de7c68e 100644
--- a/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java
@@ -40,25 +40,7 @@ public class PrintGridlinesRecord
{
}
- /**
- * Constructs a PrintGridlines record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public PrintGridlinesRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A PrintGridlines RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_print_gridlines = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java b/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java
index d3a69e5136..61c1cce86e 100644
--- a/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java
@@ -41,25 +41,7 @@ public class PrintHeadersRecord
{
}
- /**
- * Constructs a PrintHeaders record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public PrintHeadersRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A PrintHeaders RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_print_headers = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java b/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java
index a8518c7b31..e41f278d54 100644
--- a/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java
+++ b/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java
@@ -66,26 +66,7 @@ public class PrintSetupRecord extends Record {
{
}
- /**
- * Constructs a PrintSetup (SETUP) record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public PrintSetupRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException(
- "NOT A valid PrintSetup record RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_paper_size = in.readShort();
field_2_scale = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/ProtectRecord.java b/src/java/org/apache/poi/hssf/record/ProtectRecord.java
index 94868e0a60..d5425c5523 100644
--- a/src/java/org/apache/poi/hssf/record/ProtectRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ProtectRecord.java
@@ -42,25 +42,7 @@ public class ProtectRecord
{
}
- /**
- * Constructs a Protect record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public ProtectRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A PROTECT RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_protect = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java b/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java
index 68678799dc..b7d2f4323f 100644
--- a/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java
+++ b/src/java/org/apache/poi/hssf/record/ProtectionRev4Record.java
@@ -40,25 +40,7 @@ public class ProtectionRev4Record
{
}
- /**
- * Constructs a ProtectionRev4 record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public ProtectionRev4Record(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A PROTECTION REV 4 RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_protect = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/RKRecord.java b/src/java/org/apache/poi/hssf/record/RKRecord.java
index ce9c84c6ec..c4b25a5bea 100644
--- a/src/java/org/apache/poi/hssf/record/RKRecord.java
+++ b/src/java/org/apache/poi/hssf/record/RKRecord.java
@@ -52,24 +52,7 @@ public final class RKRecord extends Record implements CellValueRecordInterface {
{
}
- /**
- * Constructs a RK record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
public RKRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A valid RK RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_row = in.readUShort();
field_2_col = in.readUShort();
diff --git a/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java b/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java
index e076b2bab5..c0cab053c9 100644
--- a/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java
+++ b/src/java/org/apache/poi/hssf/record/RecalcIdRecord.java
@@ -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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -37,9 +35,7 @@ import org.apache.poi.util.LittleEndian;
* @see org.apache.poi.hssf.model.Workbook
*/
-public class RecalcIdRecord
- extends Record
-{
+public final class RecalcIdRecord extends Record {
public final static short sid = 0x1c1;
public short[] field_1_recalcids;
@@ -49,25 +45,7 @@ public class RecalcIdRecord
{
}
- /**
- * Constructs a RECALCID record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public RecalcIdRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A RECALCID RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_recalcids = new short[ in.remaining() / 2 ];
for (int k = 0; k < field_1_recalcids.length; k++)
@@ -126,9 +104,8 @@ public class RecalcIdRecord
short length = ( short ) (tabids.length * 2);
int byteoffset = 4;
- LittleEndian.putShort(data, 0 + offset, sid);
- LittleEndian.putShort(data, 2 + offset,
- (( short ) length));
+ LittleEndian.putUShort(data, 0 + offset, sid);
+ LittleEndian.putUShort(data, 2 + offset, length);
// 2 (num bytes in a short)
for (int k = 0; k < (length / 2); k++)
diff --git a/src/java/org/apache/poi/hssf/record/Record.java b/src/java/org/apache/poi/hssf/record/Record.java
index c33da57deb..29c37d7047 100644
--- a/src/java/org/apache/poi/hssf/record/Record.java
+++ b/src/java/org/apache/poi/hssf/record/Record.java
@@ -40,35 +40,6 @@ public abstract class Record extends RecordBase {
{
}
- /**
- * Constructor Record
- *
- * @param in the RecordInputstream to read the record from
- */
- protected Record(RecordInputStream in)
- {
- validateSid(in.getSid());
- fillFields(in);
- }
-
- /**
- * called by constructor, should throw runtime exception in the event of a
- * record passed with a differing ID.
- *
- * @param id alleged id for this record
- */
-
- protected abstract void validateSid(short id);
-
- /**
- * called by the constructor, should set class level fields. Should throw
- * runtime exception for bad/icomplete data.
- *
- * @param in the RecordInputstream to read the record from
- */
-
- protected abstract void fillFields(RecordInputStream in);
-
/**
* called by the class that is responsible for writing this sucker.
* Subclasses should implement this so that their data is passed back in a
diff --git a/src/java/org/apache/poi/hssf/record/RefModeRecord.java b/src/java/org/apache/poi/hssf/record/RefModeRecord.java
index c99d02e5c8..f0567509bf 100644
--- a/src/java/org/apache/poi/hssf/record/RefModeRecord.java
+++ b/src/java/org/apache/poi/hssf/record/RefModeRecord.java
@@ -42,25 +42,7 @@ public class RefModeRecord
{
}
- /**
- * Constructs a RefMode record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public RefModeRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT An RefMode RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_mode = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java b/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java
index eae7a532ed..021a34c69b 100644
--- a/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java
+++ b/src/java/org/apache/poi/hssf/record/RefreshAllRecord.java
@@ -40,25 +40,7 @@ public class RefreshAllRecord
{
}
- /**
- * Constructs a RefreshAll record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public RefreshAllRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A REFRESHALL RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_refreshall = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java
index 34c7d8e123..75cdb2c2f3 100644
--- a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java
+++ b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java
@@ -30,24 +30,7 @@ public class RightMarginRecord extends Record implements Margin
public RightMarginRecord() { }
- /**
- * Constructs a RightMargin record and sets its fields appropriately. * * @param id id must be 0x27 or an exception * will be throw upon validation * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len)
- */
public RightMarginRecord( RecordInputStream in )
- { super( in ); }
-
- /**
- * Checks the sid matches the expected side for this record * * @param id the expected sid.
- */
- protected void validateSid( short id )
- {
- if ( id != sid )
- {
- throw new RecordFormatException( "Not a RightMargin record" );
- }
- }
-
- protected void fillFields( RecordInputStream in )
{
field_1_margin = in.readDouble();
}
@@ -93,4 +76,4 @@ public class RightMarginRecord extends Record implements Margin
rec.field_1_margin = this.field_1_margin;
return rec;
}
-} // END OF CLASS
\ No newline at end of file
+} // END OF CLA
\ No newline at end of file
diff --git a/src/java/org/apache/poi/hssf/record/RowRecord.java b/src/java/org/apache/poi/hssf/record/RowRecord.java
index 8b49523a86..f893bf2831 100644
--- a/src/java/org/apache/poi/hssf/record/RowRecord.java
+++ b/src/java/org/apache/poi/hssf/record/RowRecord.java
@@ -74,24 +74,7 @@ public final class RowRecord extends Record {
field_8_xf_index = ( short ) 0xf;
}
- /**
- * Constructs a Row record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
public RowRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A valid ROW RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_row_number = in.readUShort();
field_2_first_col = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/SCLRecord.java b/src/java/org/apache/poi/hssf/record/SCLRecord.java
index f06694b865..7295ad61ed 100644
--- a/src/java/org/apache/poi/hssf/record/SCLRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SCLRecord.java
@@ -43,32 +43,7 @@ public class SCLRecord
}
- /**
- * Constructs a SCL record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SCLRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SCL record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_numerator = in.readShort();
field_2_denominator = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/SSTRecord.java b/src/java/org/apache/poi/hssf/record/SSTRecord.java
index 9c67c8dca4..ca75af00d4 100644
--- a/src/java/org/apache/poi/hssf/record/SSTRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SSTRecord.java
@@ -90,17 +90,6 @@ public class SSTRecord
deserializer = new SSTDeserializer(field_3_strings);
}
- /**
- * Constructs an SST record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
- public SSTRecord( RecordInputStream in )
- {
- super( in );
- }
-
/**
* Add a string.
*
@@ -256,23 +245,6 @@ public class SSTRecord
.equals( other.field_3_strings ) );
}
- /**
- * validate SID
- *
- * @param id the alleged SID
- *
- * @exception RecordFormatException if validation fails
- */
-
- protected void validateSid( final short id )
- throws RecordFormatException
- {
- if ( id != sid )
- {
- throw new RecordFormatException( "NOT An SST RECORD" );
- }
- }
-
/**
* Fill the fields from the data
*
@@ -352,7 +324,7 @@ public class SSTRecord
* @param in the RecordInputstream to read the record from
*/
- protected void fillFields( RecordInputStream in )
+ public SSTRecord( RecordInputStream in )
{
// this method is ALWAYS called after construction -- using
// the nontrivial constructor, of course -- so this is where
diff --git a/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java b/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java
index 96ff53af24..9cf008fe18 100644
--- a/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java
@@ -40,25 +40,7 @@ public class SaveRecalcRecord
{
}
- /**
- * Constructs an SaveRecalc record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public SaveRecalcRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A Save Recalc RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_recalc = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java b/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java
index f84316362c..037eed0206 100644
--- a/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ScenarioProtectRecord.java
@@ -42,25 +42,7 @@ public class ScenarioProtectRecord
{
}
- /**
- * Constructs a Protect record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public ScenarioProtectRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A SCENARIOPROTECT RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_protect = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/SelectionRecord.java b/src/java/org/apache/poi/hssf/record/SelectionRecord.java
index e1849a7d75..ca2bf22fc1 100644
--- a/src/java/org/apache/poi/hssf/record/SelectionRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SelectionRecord.java
@@ -51,21 +51,7 @@ public final class SelectionRecord extends Record {
};
}
- /**
- * Constructs a Selection record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
public SelectionRecord(RecordInputStream in) {
- super(in);
- }
-
- protected void validateSid(short id) {
- if (id != sid) {
- throw new RecordFormatException("NOT A valid Selection RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in) {
field_1_pane = in.readByte();
field_2_row_active_cell = in.readUShort();
field_3_col_active_cell = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java
index 076687d69f..acc9665ae3 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java
@@ -42,32 +42,7 @@ public class SeriesChartGroupIndexRecord
}
- /**
- * Constructs a SeriesChartGroupIndex record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SeriesChartGroupIndexRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SeriesChartGroupIndex record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_chartGroupIndex = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java
index dcc2ebe4a3..6896a0a217 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java
@@ -42,32 +42,7 @@ public class SeriesIndexRecord
}
- /**
- * Constructs a SeriesIndex record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SeriesIndexRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SeriesIndex record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_index = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java b/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java
index e18ae4be83..a3e8089bfb 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java
@@ -46,32 +46,7 @@ public final class SeriesLabelsRecord extends Record {
}
- /**
- * Constructs a SeriesLabels record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SeriesLabelsRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SeriesLabels record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_formatFlags = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/SeriesListRecord.java b/src/java/org/apache/poi/hssf/record/SeriesListRecord.java
index 0825e68e6c..2894f15877 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesListRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesListRecord.java
@@ -42,32 +42,7 @@ public class SeriesListRecord
}
- /**
- * Constructs a SeriesList record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SeriesListRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SeriesList record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_seriesNumbers = in.readShortArray();
}
diff --git a/src/java/org/apache/poi/hssf/record/SeriesRecord.java b/src/java/org/apache/poi/hssf/record/SeriesRecord.java
index c13ff35e7c..34b3c94a66 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesRecord.java
@@ -59,32 +59,7 @@ public class SeriesRecord
}
- /**
- * Constructs a Series record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SeriesRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a Series record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_categoryDataType = in.readShort();
field_2_valuesDataType = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java b/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java
index 66c26b3214..a445dc6166 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java
@@ -45,32 +45,7 @@ public class SeriesTextRecord
}
- /**
- * Constructs a SeriesText record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SeriesTextRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SeriesText record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_id = in.readShort();
field_2_textLength = in.readByte();
diff --git a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java b/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java
index 96e882e7c5..ff69ec5469 100644
--- a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java
@@ -42,32 +42,7 @@ public class SeriesToChartGroupRecord
}
- /**
- * Constructs a SeriesToChartGroup record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SeriesToChartGroupRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SeriesToChartGroup record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_chartGroupIndex = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java b/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
index 16a73d0a81..fc51de8465 100644
--- a/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
+++ b/src/java/org/apache/poi/hssf/record/SharedValueRecordBase.java
@@ -45,12 +45,6 @@ public abstract class SharedValueRecordBase extends Record {
_range = new CellRangeAddress8Bit(in);
}
- protected final void validateSid(short id) {
- if (id != getSid()) {
- throw new RecordFormatException("Not a valid SharedFormula");
- }
- }
-
public final CellRangeAddress8Bit getRange() {
return _range;
}
@@ -92,10 +86,6 @@ public abstract class SharedValueRecordBase extends Record {
return dataSize + 4;
}
- protected final void fillFields(RecordInputStream in) {
- throw new RuntimeException("Should not be called. Fields are filled in constructor");
- }
-
/**
* @return true
if (rowIx, colIx) is within the range ({@link #getRange()})
* of this shared value object.
diff --git a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java
index c919278b42..9ae777e1e6 100644
--- a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java
@@ -50,32 +50,7 @@ public final class SheetPropertiesRecord extends Record {
}
- /**
- * Constructs a SheetProperties record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public SheetPropertiesRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a SheetProperties record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_flags = in.readShort();
field_2_empty = in.readByte();
diff --git a/src/java/org/apache/poi/hssf/record/StringRecord.java b/src/java/org/apache/poi/hssf/record/StringRecord.java
index d7eb11efcf..e4e71f7db8 100644
--- a/src/java/org/apache/poi/hssf/record/StringRecord.java
+++ b/src/java/org/apache/poi/hssf/record/StringRecord.java
@@ -37,34 +37,9 @@ public class StringRecord extends Record {
}
/**
- * Constructs a String record and sets its fields appropriately.
- *
* @param in the RecordInputstream to read the record from
*/
- public StringRecord(RecordInputStream in)
- {
- super(in);
- }
-
-
- /**
- * Throw a runtime exception in the event of a
- * record passed with a differing ID.
- *
- * @param id alleged id for this record
- */
- protected void validateSid( short id )
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a valid StringRecord");
- }
- }
-
- /**
- * @param in the RecordInputstream to read the record from
- */
- protected void fillFields( RecordInputStream in)
+ public StringRecord( RecordInputStream in)
{
field_1_string_length = in.readShort();
field_2_unicode_flag = in.readByte();
diff --git a/src/java/org/apache/poi/hssf/record/StyleRecord.java b/src/java/org/apache/poi/hssf/record/StyleRecord.java
index c6591f550d..5b746e8d4b 100644
--- a/src/java/org/apache/poi/hssf/record/StyleRecord.java
+++ b/src/java/org/apache/poi/hssf/record/StyleRecord.java
@@ -54,25 +54,7 @@ public final class StyleRecord extends Record {
{
}
- /**
- * Constructs a Style record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public StyleRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A STYLE RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_xf_index = in.readShort();
if (getType() == STYLE_BUILT_IN)
diff --git a/src/java/org/apache/poi/hssf/record/SubRecord.java b/src/java/org/apache/poi/hssf/record/SubRecord.java
index 6b836c6ca6..1333ef1910 100644
--- a/src/java/org/apache/poi/hssf/record/SubRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SubRecord.java
@@ -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,23 +14,14 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
/**
* Subrecords are part of the OBJ class.
*/
-abstract public class SubRecord
- extends Record
-{
- public SubRecord()
- {
- }
-
- public SubRecord( RecordInputStream in )
- {
- super( in );
+abstract public class SubRecord extends Record {
+ protected SubRecord() {
}
public static Record createSubRecord(RecordInputStream in)
diff --git a/src/java/org/apache/poi/hssf/record/SupBookRecord.java b/src/java/org/apache/poi/hssf/record/SupBookRecord.java
index b4e46c6fdc..30e337e2d5 100644
--- a/src/java/org/apache/poi/hssf/record/SupBookRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SupBookRecord.java
@@ -66,23 +66,6 @@ public final class SupBookRecord extends Record {
_isAddInFunctions = false;
}
- /**
- * Constructs a Extern Sheet record and sets its fields appropriately.
- *
- * @param id id must be 0x16 or an exception will be throw upon validation
- * @param size the size of the data area of the record
- * @param data data of the record (should not contain sid/len)
- */
- public SupBookRecord(RecordInputStream in) {
- super(in);
- }
-
- protected void validateSid(short id) {
- if (id != sid) {
- throw new RecordFormatException("NOT An ExternSheet RECORD");
- }
- }
-
public boolean isExternalReferences() {
return field_3_sheet_names != null;
}
@@ -100,7 +83,7 @@ public final class SupBookRecord extends Record {
* @param size size of data
* @param offset of the record's data (provided a big array of the file)
*/
- protected void fillFields(RecordInputStream in) {
+ public SupBookRecord(RecordInputStream in) {
field_1_number_of_sheets = in.readShort();
if(in.getLength() > SMALL_RECORD_SIZE) {
diff --git a/src/java/org/apache/poi/hssf/record/TabIdRecord.java b/src/java/org/apache/poi/hssf/record/TabIdRecord.java
index 7e924c3373..d5aca3e045 100644
--- a/src/java/org/apache/poi/hssf/record/TabIdRecord.java
+++ b/src/java/org/apache/poi/hssf/record/TabIdRecord.java
@@ -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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -29,10 +27,7 @@ import org.apache.poi.util.LittleEndian;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/
-
-public class TabIdRecord
- extends Record
-{
+public final class TabIdRecord extends Record {
public final static short sid = 0x13d;
public short[] field_1_tabids;
@@ -40,25 +35,7 @@ public class TabIdRecord
{
}
- /**
- * Constructs a TabID record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public TabIdRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A TABID RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_tabids = new short[ in.remaining() / 2 ];
for (int k = 0; k < field_1_tabids.length; k++)
@@ -105,13 +82,12 @@ public class TabIdRecord
public int serialize(int offset, byte [] data)
{
- short[] tabids = getTabIdArray();
- short length = ( short ) (tabids.length * 2);
- int byteoffset = 4;
+ short[] tabids = getTabIdArray();
+ int length = tabids.length * 2;
+ int byteoffset = 4;
- LittleEndian.putShort(data, 0 + offset, sid);
- LittleEndian.putShort(data, 2 + offset,
- (( short ) length)); // nubmer tabids *
+ LittleEndian.putUShort(data, 0 + offset, sid);
+ LittleEndian.putUShort(data, 2 + offset, length); // nubmer tabids *
// 2 (num bytes in a short)
for (int k = 0; k < (length / 2); k++)
diff --git a/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java b/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java
index 2d649247b5..8a27d163da 100644
--- a/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java
+++ b/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java
@@ -69,32 +69,7 @@ public class TextObjectBaseRecord extends Record {
}
- /**
- * Constructs a TextObjectBase record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public TextObjectBaseRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a TextObjectBase record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_options = in.readShort();
field_2_textOrientation = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java
index 5201a7292b..600aaf1542 100644
--- a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java
+++ b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java
@@ -17,11 +17,11 @@
package org.apache.poi.hssf.record;
-import org.apache.poi.hssf.usermodel.HSSFRichTextString;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.HexDump;
import java.io.UnsupportedEncodingException;
-import java.io.ByteArrayOutputStream;
+
+import org.apache.poi.hssf.usermodel.HSSFRichTextString;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
public class TextObjectRecord
extends TextObjectBaseRecord
@@ -35,13 +35,7 @@ public class TextObjectRecord
public TextObjectRecord( RecordInputStream in )
{
super( in );
- if (str == null)
- str = new HSSFRichTextString("");
- }
- protected void fillFields(RecordInputStream in)
- {
- super.fillFields(in);
if (getTextLength() > 0) {
if (in.isContinueNext() && in.remaining() == 0) {
//1st Continue
@@ -56,6 +50,8 @@ public class TextObjectRecord
processFontRuns(in);
} else throw new RecordFormatException("Expected Continue Record to hold font runs for TextObjectRecord");
}
+ if (str == null)
+ str = new HSSFRichTextString("");
}
diff --git a/src/java/org/apache/poi/hssf/record/TextRecord.java b/src/java/org/apache/poi/hssf/record/TextRecord.java
index 0840fe1932..60c05e6d0a 100644
--- a/src/java/org/apache/poi/hssf/record/TextRecord.java
+++ b/src/java/org/apache/poi/hssf/record/TextRecord.java
@@ -93,32 +93,7 @@ public final class TextRecord extends Record {
}
- /**
- * Constructs a Text record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public TextRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a Text record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_horizontalAlignment = in.readByte();
field_2_verticalAlignment = in.readByte();
diff --git a/src/java/org/apache/poi/hssf/record/TickRecord.java b/src/java/org/apache/poi/hssf/record/TickRecord.java
index 1b950e3ed4..7e216156c6 100644
--- a/src/java/org/apache/poi/hssf/record/TickRecord.java
+++ b/src/java/org/apache/poi/hssf/record/TickRecord.java
@@ -56,32 +56,7 @@ public final class TickRecord extends Record {
}
- /**
- * Constructs a Tick record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public TickRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a Tick record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_majorTickType = in.readByte();
diff --git a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java
index 5c507a211b..d67509e6c6 100644
--- a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java
+++ b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java
@@ -33,30 +33,9 @@ public class TopMarginRecord extends Record implements Margin
public TopMarginRecord() { }
/**
- * Constructs a TopMargin record and sets its fields appropriately.
- *
* @param in the RecordInputstream to read the record from
*/
public TopMarginRecord( RecordInputStream in )
- { super( in ); }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid( short id )
- {
- if ( id != sid )
- {
- throw new RecordFormatException( "Not a TopMargin record" );
- }
- }
-
- /**
- * @param in the RecordInputstream to read the record from
- */
- protected void fillFields( RecordInputStream in )
{
field_1_margin = in.readDouble();
}
@@ -102,4 +81,4 @@ public class TopMarginRecord extends Record implements Margin
rec.field_1_margin = this.field_1_margin;
return rec;
}
-} // END OF CLASS
+} // END OF CLAS
\ No newline at end of file
diff --git a/src/java/org/apache/poi/hssf/record/UncalcedRecord.java b/src/java/org/apache/poi/hssf/record/UncalcedRecord.java
index a67b0b5af4..adc2cdeb90 100644
--- a/src/java/org/apache/poi/hssf/record/UncalcedRecord.java
+++ b/src/java/org/apache/poi/hssf/record/UncalcedRecord.java
@@ -37,25 +37,13 @@ public class UncalcedRecord extends Record
*/
public UncalcedRecord() {
}
- /**
- * read constructor
- */
- public UncalcedRecord(RecordInputStream in) {
- super(in);
- }
public short getSid() {
return sid;
}
- protected void validateSid(short id) {
- if (id != sid) {
- throw new RecordFormatException("NOT AN UNCALCED RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in) {
- short unused = in.readShort();
+ public UncalcedRecord(RecordInputStream in) {
+ in.readShort(); // unused
}
public String toString() {
@@ -66,9 +54,9 @@ public class UncalcedRecord extends Record
}
public int serialize(int offset, byte[] data) {
- LittleEndian.putShort(data, 0 + offset, sid);
- LittleEndian.putShort(data, 2 + offset, (short) 2);
- LittleEndian.putShort(data, 4 + offset, (short) 0); // unused
+ LittleEndian.putUShort(data, 0 + offset, sid);
+ LittleEndian.putUShort(data, 2 + offset, 2);
+ LittleEndian.putUShort(data, 4 + offset, 0); // unused
return getRecordSize();
}
diff --git a/src/java/org/apache/poi/hssf/record/UnicodeString.java b/src/java/org/apache/poi/hssf/record/UnicodeString.java
index 9919d52c3d..4258d0a6d5 100644
--- a/src/java/org/apache/poi/hssf/record/UnicodeString.java
+++ b/src/java/org/apache/poi/hssf/record/UnicodeString.java
@@ -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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -111,8 +109,7 @@ public class UnicodeString
public UnicodeString(RecordInputStream in)
{
- validateSid(in.getSid());
- fillFields(in);
+ fillFields(in); // TODO - inline
}
@@ -188,16 +185,6 @@ public class UnicodeString
return true;
}
- /**
- * NO OP
- */
-
- protected void validateSid(short id)
- {
-
- // included only for interface compliance
- }
-
/**
* @param in the RecordInputstream to read the record from
*/
@@ -236,9 +223,7 @@ public class UnicodeString
throw new RecordFormatException("Expected continue record.");
}
if (isCompressed) {
- //Typecast direct to char from byte with high bit set causes all ones
- //in the high byte of the char (which is of course incorrect)
- char ch = (char)( (short)0xff & (short)in.readByte() );
+ char ch = (char)in.readUByte(); // avoid sex
tmpString.append(ch);
} else {
char ch = (char) in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/UnitsRecord.java b/src/java/org/apache/poi/hssf/record/UnitsRecord.java
index a427a6c739..4295cfe79b 100644
--- a/src/java/org/apache/poi/hssf/record/UnitsRecord.java
+++ b/src/java/org/apache/poi/hssf/record/UnitsRecord.java
@@ -42,31 +42,7 @@ public class UnitsRecord
}
- /**
- * Constructs a Units record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
public UnitsRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a Units record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_units = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/UnknownRecord.java b/src/java/org/apache/poi/hssf/record/UnknownRecord.java
index 851dbfbf55..77de66d9b3 100644
--- a/src/java/org/apache/poi/hssf/record/UnknownRecord.java
+++ b/src/java/org/apache/poi/hssf/record/UnknownRecord.java
@@ -91,13 +91,6 @@ public final class UnknownRecord extends Record {
return 4 + _rawData.length;
}
- /**
- * NO OP!
- */
- protected void validateSid(short id) {
- // if we had a valid sid we wouldn't be using the "Unknown Record" record now would we?
- }
-
/**
* print a sort of string representation ([UNKNOWN RECORD] id = x [/UNKNOWN RECORD])
*/
@@ -276,11 +269,6 @@ public final class UnknownRecord extends Record {
return false;
}
- protected final void fillFields(RecordInputStream in) {
- throw new RecordFormatException(
- "Unknown record cannot be constructed via offset -- we need a copy of the data");
- }
-
public final Object clone() {
// immutable - ok to return this
return this;
diff --git a/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java b/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java
index 107792eb3e..8e64ef3d4a 100644
--- a/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java
+++ b/src/java/org/apache/poi/hssf/record/UseSelFSRecord.java
@@ -42,25 +42,7 @@ public class UseSelFSRecord
{
}
- /**
- * Constructs a UseSelFS record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public UseSelFSRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A UseSelFS RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_flag = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/VCenterRecord.java b/src/java/org/apache/poi/hssf/record/VCenterRecord.java
index e221b35f1c..7326a32929 100644
--- a/src/java/org/apache/poi/hssf/record/VCenterRecord.java
+++ b/src/java/org/apache/poi/hssf/record/VCenterRecord.java
@@ -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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -30,35 +28,15 @@ import org.apache.poi.util.LittleEndian;
* @version 2.0-pre
*/
-public class VCenterRecord
- extends Record
-{
+public final class VCenterRecord extends Record {
public final static short sid = 0x84;
- private short field_1_vcenter;
+ private int field_1_vcenter;
public VCenterRecord()
{
}
- /**
- * Constructs a VCENTER record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public VCenterRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A VCenter RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_vcenter = in.readShort();
}
@@ -70,14 +48,7 @@ public class VCenterRecord
public void setVCenter(boolean hc)
{
- if (hc == true)
- {
- field_1_vcenter = 1;
- }
- else
- {
- field_1_vcenter = 0;
- }
+ field_1_vcenter = hc ? 1 : 0;
}
/**
@@ -103,9 +74,9 @@ public class VCenterRecord
public int serialize(int offset, byte [] data)
{
- LittleEndian.putShort(data, 0 + offset, sid);
- LittleEndian.putShort(data, 2 + offset, ( short ) 0x2);
- LittleEndian.putShort(data, 4 + offset, ( short ) field_1_vcenter);
+ LittleEndian.putUShort(data, 0 + offset, sid);
+ LittleEndian.putUShort(data, 2 + offset, 0x2);
+ LittleEndian.putUShort(data, 4 + offset, field_1_vcenter);
return getRecordSize();
}
diff --git a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java b/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java
index 6c94c5c54c..bc5023212c 100644
--- a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java
@@ -55,32 +55,7 @@ public final class ValueRangeRecord extends Record {
}
- /**
- * Constructs a ValueRange record and sets its fields appropriately.
- *
- * @param in the RecordInputstream to read the record from
- */
-
public ValueRangeRecord(RecordInputStream in)
- {
- super(in);
-
- }
-
- /**
- * Checks the sid matches the expected side for this record
- *
- * @param id the expected sid.
- */
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("Not a ValueRange record");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_minimumAxisValue = in.readDouble();
field_2_maximumAxisValue = in.readDouble();
diff --git a/src/java/org/apache/poi/hssf/record/VerticalPageBreakRecord.java b/src/java/org/apache/poi/hssf/record/VerticalPageBreakRecord.java
index fccb7ccdaa..3dc5348f97 100644
--- a/src/java/org/apache/poi/hssf/record/VerticalPageBreakRecord.java
+++ b/src/java/org/apache/poi/hssf/record/VerticalPageBreakRecord.java
@@ -43,13 +43,6 @@ public final class VerticalPageBreakRecord extends PageBreakRecord {
super(in);
}
- protected void validateSid(short id) {
- if (id != getSid()) {
- throw new RecordFormatException(
- "NOT A HorizontalPageBreak or VerticalPageBreak RECORD!! " + id);
- }
- }
-
public short getSid() {
return sid;
}
diff --git a/src/java/org/apache/poi/hssf/record/WSBoolRecord.java b/src/java/org/apache/poi/hssf/record/WSBoolRecord.java
index 480b7f240e..bdb1cb4847 100644
--- a/src/java/org/apache/poi/hssf/record/WSBoolRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WSBoolRecord.java
@@ -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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -33,63 +31,33 @@ import org.apache.poi.util.LittleEndian;
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
-
-public class WSBoolRecord
- extends Record
-{
+public final class WSBoolRecord extends Record {
public final static short sid = 0x81;
private byte field_1_wsbool; // crappy names are because this is really one big short field (2byte)
- private byte field_2_wsbool; // but the docs inconsistantly use it as 2 seperate bytes
+ private byte field_2_wsbool; // but the docs inconsistently use it as 2 separate bytes
- // I decided to be consistant in this way.
- static final private BitField autobreaks =
- BitFieldFactory.getInstance(0x01); // are automatic page breaks visible
+ // I decided to be consistent in this way.
+ private static final BitField autobreaks = BitFieldFactory.getInstance(0x01); // are automatic page breaks visible
// bits 1 to 3 unused
- static final private BitField dialog =
- BitFieldFactory.getInstance(0x10); // is sheet dialog sheet
- static final private BitField applystyles =
- BitFieldFactory.getInstance(0x20); // whether to apply automatic styles to outlines
- static final private BitField rowsumsbelow = BitFieldFactory.getInstance(
- 0x40); // whether summary rows will appear below detail in outlines
- static final private BitField rowsumsright = BitFieldFactory.getInstance(
- 0x80); // whether summary rows will appear right of the detail in outlines
- static final private BitField fittopage =
- BitFieldFactory.getInstance(0x01); // whether to fit stuff to the page
+ private static final BitField dialog = BitFieldFactory.getInstance(0x10); // is sheet dialog sheet
+ private static final BitField applystyles = BitFieldFactory.getInstance(0x20); // whether to apply automatic styles to outlines
+ private static final BitField rowsumsbelow = BitFieldFactory.getInstance(0x40); // whether summary rows will appear below detail in outlines
+ private static final BitField rowsumsright = BitFieldFactory.getInstance(0x80); // whether summary rows will appear right of the detail in outlines
+ private static final BitField fittopage = BitFieldFactory.getInstance(0x01); // whether to fit stuff to the page
// bit 2 reserved
- static final private BitField displayguts = BitFieldFactory.getInstance(
- 0x06); // whether to display outline symbols (in the gutters)
+ private static final BitField displayguts = BitFieldFactory.getInstance(0x06); // whether to display outline symbols (in the gutters)
// bits 4-5 reserved
- static final private BitField alternateexpression = // whether to use alternate expression eval
- BitFieldFactory.getInstance(0x40);
- static final private BitField alternateformula = // whether to use alternate formula entry
- BitFieldFactory.getInstance(0x80);
+ private static final BitField alternateexpression = BitFieldFactory.getInstance(0x40); // whether to use alternate expression eval
+ private static final BitField alternateformula = BitFieldFactory.getInstance(0x80); // whether to use alternate formula entry
public WSBoolRecord()
{
}
- /**
- * Constructs a WSBool record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public WSBoolRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A WSBoolRECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
byte data[] = in.readRemainder();
field_1_wsbool =
diff --git a/src/java/org/apache/poi/hssf/record/WindowOneRecord.java b/src/java/org/apache/poi/hssf/record/WindowOneRecord.java
index 4c836f2ee8..7afc5fa1f8 100644
--- a/src/java/org/apache/poi/hssf/record/WindowOneRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WindowOneRecord.java
@@ -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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -32,10 +30,7 @@ import org.apache.poi.util.LittleEndian;
* @author Andrew C. Oliver (acoliver at apache dot org)
* @version 2.0-pre
*/
-
-public class WindowOneRecord
- extends Record
-{
+public final class WindowOneRecord extends Record {
public final static short sid = 0x3d;
// our variable names stolen from old TV sets.
@@ -66,25 +61,7 @@ public class WindowOneRecord
{
}
- /**
- * Constructs a WindowOne record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public WindowOneRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A WINDOW1 RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_h_hold = in.readShort();
field_2_v_hold = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java b/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java
index 9a5bc45dce..13d54e9b5e 100644
--- a/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WindowProtectRecord.java
@@ -39,25 +39,7 @@ public class WindowProtectRecord
{
}
- /**
- * Constructs a WindowProtect record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public WindowProtectRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A WINDOWPROTECT RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
field_1_protect = in.readShort();
}
diff --git a/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java b/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java
index 6e60ef41a6..9023d2d692 100644
--- a/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java
@@ -61,25 +61,7 @@ public final class WindowTwoRecord extends Record {
{
}
- /**
- * Constructs a WindowTwo record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public WindowTwoRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A valid WindowTwo RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
int size = in.remaining();
field_1_options = in.readShort();
diff --git a/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java b/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
index af5f06e04f..d73687f186 100644
--- a/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
@@ -42,25 +42,7 @@ public class WriteAccessRecord
{
}
- /**
- * Constructs a WriteAccess record and sets its fields appropriately.
- * @param in the RecordInputstream to read the record from
- */
-
public WriteAccessRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A WRITEACCESS RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
{
byte[] data = in.readRemainder();
//The string is always 112 characters (padded with spaces), therefore
diff --git a/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java b/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java
index 9b3daf2a16..eb27e0ec12 100644
--- a/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java
@@ -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,12 +14,10 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.StringUtil;
/**
* Title: Write Protect Record
@@ -28,10 +25,7 @@ import org.apache.poi.util.StringUtil; * REFERENCE: PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
* @version 3.0-pre */ - -public class WriteProtectRecord - extends Record -{ +public final class WriteProtectRecord extends Record { public final static short sid = 0x86; public WriteProtectRecord() @@ -39,24 +33,9 @@ public class WriteProtectRecord } /** - * Constructs a WriteAccess record and sets its fields appropriately. - * @param in the RecordInputstream to read the record from + * @param in unused (since this record has no data) */ - public WriteProtectRecord(RecordInputStream in) - { - super(in); - } - - protected void validateSid(short id) - { - if (id != sid) - { - throw new RecordFormatException("NOT A WRITEPROTECT RECORD"); - } - } - - protected void fillFields(RecordInputStream in) { } @@ -71,8 +50,8 @@ public class WriteProtectRecord public int serialize(int offset, byte [] data) { - LittleEndian.putShort(data, 0 + offset, sid); - LittleEndian.putShort(data, 2 + offset, (short)0); + LittleEndian.putUShort(data, 0 + offset, sid); + LittleEndian.putUShort(data, 2 + offset, 0); return getRecordSize(); } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java index 2f30d15c81..0c666847af 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java @@ -147,22 +147,19 @@ public class HSSFFormulaEvaluator /* almost implements FormulaEvaluator */ { /** - * If cell contains formula, it evaluates the formula, - * and saves the result of the formula. The cell - * remains as a formula cell. - * Else if cell does not contain formula, this method leaves - * the cell unchanged. - * Note that the type of the formula result is returned, - * so you know what kind of value is also stored with - * the formula. + * If cell contains formula, it evaluates the formula, and saves the result of the formula. The + * cell remains as a formula cell. If the cell does not contain formula, this method returns -1 + * and leaves the cell unchanged. + * + * Note that the type of the formula result is returned, so you know what kind of + * cached formula result is also stored with the formula. *
* int evaluatedCellType = evaluator.evaluateFormulaCell(cell); *- * Be aware that your cell will hold both the formula, - * and the result. If you want the cell replaced with - * the result of the formula, use {@link #evaluateInCell(HSSFCell)} + * Be aware that your cell will hold both the formula, and the result. If you want the cell + * replaced with the result of the formula, use {@link #evaluateInCell(HSSFCell)} * @param cell The cell to evaluate - * @return The type of the formula result (the cell's type remains as HSSFCell.CELL_TYPE_FORMULA however) + * @return -1 for non-formula cells, or the type of the formula result */ public int evaluateFormulaCell(Cell cell) { if (cell == null || cell.getCellType() != HSSFCell.CELL_TYPE_FORMULA) { diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index aa0b720132..aacf663863 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -516,15 +516,17 @@ public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.userm } /** - * set the sheet name. - * Will throw IllegalArgumentException if the name is greater than 31 chars - * or contains /\?*[] + * Sets the sheet name. + * Will throw IllegalArgumentException if the name is duplicated or contains /\?*[] + * Note - Excel allows sheet names up to 31 chars in length but other applications allow more. + * Excel does not crash with names longer than 31 chars, but silently truncates such names to + * 31 chars. POI enforces uniqueness on the first 31 chars. + * * @param sheetIx number (0 based) */ - public void setSheetName(int sheetIx, String name) - { - if (workbook.doesContainsSheetName( name, sheetIx )) { - throw new IllegalArgumentException( "The workbook already contains a sheet with this name" ); + public void setSheetName(int sheetIx, String name) { + if (workbook.doesContainsSheetName(name, sheetIx)) { + throw new IllegalArgumentException("The workbook already contains a sheet with this name"); } validateSheetIndex(sheetIx); workbook.setSheetName(sheetIx, name); @@ -764,14 +766,14 @@ public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.userm * create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and * returns the high level representation. Use this to create new sheets. * - * @param sheetname - * sheetname to set for the sheet. + * @param sheetname the name for the new sheet. Note - certain length limits + * apply. See {@link #setSheetName(int, String)}. + * * @return HSSFSheet representing the new sheet. * @throws IllegalArgumentException * if there is already a sheet present with a case-insensitive * match for the specified name. */ - public HSSFSheet createSheet(String sheetname) { if (workbook.doesContainsSheetName( sheetname, _sheets.size() )) diff --git a/src/testcases/org/apache/poi/hssf/record/TestAreaFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAreaFormatRecord.java index 7d543c451f..de834be95e 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAreaFormatRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAreaFormatRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestAreaFormatRecord - extends TestCase -{ +public final class TestAreaFormatRecord extends TestCase { byte[] data = new byte[] { (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00, // forecolor (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // backcolor @@ -44,14 +39,7 @@ public class TestAreaFormatRecord }; - public TestAreaFormatRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { AreaFormatRecord record = new AreaFormatRecord(new TestcaseRecordInputStream((short)0x100a, (short)data.length, data)); assertEquals( 0xFFFFFF, record.getForegroundColor()); @@ -65,8 +53,6 @@ public class TestAreaFormatRecord assertEquals( 20, record.getRecordSize() ); - - record.validateSid((short)0x100a); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestAreaRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAreaRecord.java index 23b50a5ffe..2131e73192 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAreaRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAreaRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,21 +28,12 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestAreaRecord - extends TestCase -{ +public final class TestAreaRecord extends TestCase { byte[] data = new byte[] { (byte)0x02,(byte)0x00 // format flags }; - public TestAreaRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { AreaRecord record = new AreaRecord(new TestcaseRecordInputStream((short)0x101A, (short)data.length, data)); assertEquals( 2, record.getFormatFlags()); @@ -55,8 +43,6 @@ public class TestAreaRecord assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x101A); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisLineFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisLineFormatRecord.java index 5340e20d98..2146a31cfb 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisLineFormatRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAxisLineFormatRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,28 +28,16 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestAxisLineFormatRecord - extends TestCase -{ +public final class TestAxisLineFormatRecord extends TestCase { byte[] data = new byte[] { (byte)0x01,(byte)0x00 }; - public TestAxisLineFormatRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { AxisLineFormatRecord record = new AxisLineFormatRecord(new TestcaseRecordInputStream((short)0x1021, (short)data.length, data)); assertEquals( AxisLineFormatRecord.AXIS_TYPE_MAJOR_GRID_LINE, record.getAxisType()); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1021); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisOptionsRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisOptionsRecord.java index 498f896a76..4d88e18a69 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisOptionsRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAxisOptionsRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Andrew C. Oliver(acoliver at apache.org) */ -public class TestAxisOptionsRecord - extends TestCase -{ +public final class TestAxisOptionsRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00, @@ -41,14 +36,7 @@ public class TestAxisOptionsRecord (byte)0x00,(byte)0xEF,(byte)0x00 }; - public TestAxisOptionsRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { AxisOptionsRecord record = new AxisOptionsRecord(new TestcaseRecordInputStream((short)0x1062, (short)data.length, data)); assertEquals( 0, record.getMinimumCategory()); assertEquals( 0, record.getMaximumCategory()); @@ -68,10 +56,7 @@ public class TestAxisOptionsRecord assertEquals( true, record.isDefaultCross() ); assertEquals( true, record.isDefaultDateSettings() ); - assertEquals( 22, record.getRecordSize() ); - - record.validateSid((short)0x1062); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisParentRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisParentRecord.java index 0d5cdb1719..a9787a2e8b 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisParentRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAxisParentRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,9 +27,7 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestAxisParentRecord - extends TestCase -{ +public final class TestAxisParentRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00, // axis type (byte)0x1D,(byte)0x02,(byte)0x00,(byte)0x00, // x @@ -41,14 +36,7 @@ public class TestAxisParentRecord (byte)0x56,(byte)0x0B,(byte)0x00,(byte)0x00 // height }; - public TestAxisParentRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { AxisParentRecord record = new AxisParentRecord(new TestcaseRecordInputStream((short)0x1041, (short)data.length, data)); assertEquals( AxisParentRecord.AXIS_TYPE_MAIN, record.getAxisType()); assertEquals( 0x021d, record.getX()); @@ -56,10 +44,7 @@ public class TestAxisParentRecord assertEquals( 0x0b31, record.getWidth()); assertEquals( 0x0b56, record.getHeight()); - assertEquals( 22, record.getRecordSize() ); - - record.validateSid((short)0x1041); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisRecord.java index 76c53bd164..719e930d25 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAxisRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,26 +28,16 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestAxisRecord - extends TestCase -{ +public final class TestAxisRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00, // type (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 - }; - public TestAxisRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { AxisRecord record = new AxisRecord(new TestcaseRecordInputStream((short)0x101d, (short)data.length, data)); assertEquals( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS, record.getAxisType()); @@ -59,10 +46,7 @@ public class TestAxisRecord assertEquals( 0, record.getReserved3()); assertEquals( 0, record.getReserved4()); - assertEquals( 4 + 18, record.getRecordSize() ); - - record.validateSid((short)0x101d); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisUsedRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisUsedRecord.java index 24516e095a..98812ddd6f 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisUsedRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAxisUsedRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,28 +28,16 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestAxisUsedRecord - extends TestCase -{ +public final class TestAxisUsedRecord extends TestCase { byte[] data = new byte[] { (byte)0x01,(byte)0x00, }; - public TestAxisUsedRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { AxisUsedRecord record = new AxisUsedRecord(new TestcaseRecordInputStream((short)0x1046, (short)data.length, data)); assertEquals( 1, record.getNumAxis()); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1046); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestBarRecord.java b/src/testcases/org/apache/poi/hssf/record/TestBarRecord.java index 99cf367887..1da17aae92 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestBarRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestBarRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,23 +28,14 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestBarRecord - extends TestCase -{ +public final class TestBarRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00, // bar space (byte)0x96,(byte)0x00, // category space (byte)0x00,(byte)0x00 // format flags }; - public TestBarRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { BarRecord record = new BarRecord(new TestcaseRecordInputStream((short)0x1017, (short)data.length, data)); assertEquals( 0, record.getBarSpace()); @@ -58,10 +46,7 @@ public class TestBarRecord assertEquals( false, record.isDisplayAsPercentage() ); assertEquals( false, record.isShadow() ); - assertEquals( 10, record.getRecordSize() ); - - record.validateSid((short)0x1017); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java b/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java index e80afe973b..f973da37db 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java @@ -45,13 +45,6 @@ public final class TestBoundSheetRecord extends TestCase { public void testName() { BoundSheetRecord record = new BoundSheetRecord("1234567890223456789032345678904"); - try { - record.setSheetname("12345678902234567890323456789042"); - throw new AssertionFailedError("Should have thrown IllegalArgumentException, but didnt"); - } catch (IllegalArgumentException e) { - // expected - } - try { record.setSheetname("s//*s"); throw new AssertionFailedError("Should have thrown IllegalArgumentException, but didnt"); diff --git a/src/testcases/org/apache/poi/hssf/record/TestCategorySeriesAxisRecord.java b/src/testcases/org/apache/poi/hssf/record/TestCategorySeriesAxisRecord.java index d0baf9b95b..415b302e87 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestCategorySeriesAxisRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestCategorySeriesAxisRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestCategorySeriesAxisRecord - extends TestCase -{ +public final class TestCategorySeriesAxisRecord extends TestCase { byte[] data = new byte[] { (byte)0x01,(byte)0x00, // crossing point (byte)0x01,(byte)0x00, // label frequency @@ -41,14 +36,7 @@ public class TestCategorySeriesAxisRecord (byte)0x01,(byte)0x00 // options }; - public TestCategorySeriesAxisRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { CategorySeriesAxisRecord record = new CategorySeriesAxisRecord(new TestcaseRecordInputStream((short)0x1020, (short)data.length, data)); assertEquals( 1, record.getCrossingPoint()); @@ -59,10 +47,7 @@ public class TestCategorySeriesAxisRecord assertEquals( false, record.isCrossesFarRight() ); assertEquals( false, record.isReversed() ); - assertEquals( 4 + 8, record.getRecordSize() ); - - record.validateSid((short)0x1020); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestChartRecord.java b/src/testcases/org/apache/poi/hssf/record/TestChartRecord.java index 16591a209b..996fb1102b 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestChartRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestChartRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestChartRecord - extends TestCase -{ +public final class TestChartRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, @@ -41,14 +36,7 @@ public class TestChartRecord (byte)0xC8,(byte)0xCC,(byte)0xE5,(byte)0x00 }; - public TestChartRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { ChartRecord record = new ChartRecord(new TestcaseRecordInputStream((short)0x1002, (short)data.length, data)); assertEquals( 0, record.getX()); @@ -56,10 +44,7 @@ public class TestChartRecord assertEquals( 30474216, record.getWidth()); assertEquals( 15060168, record.getHeight()); - assertEquals( 20, record.getRecordSize() ); - - record.validateSid((short)0x1002); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestCommonObjectDataSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestCommonObjectDataSubRecord.java index 0f7ba72969..e68b5026d8 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestCommonObjectDataSubRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestCommonObjectDataSubRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestCommonObjectDataSubRecord - extends TestCase -{ +public final class TestCommonObjectDataSubRecord extends TestCase { byte[] data = new byte[] { (byte)0x12,(byte)0x00,(byte)0x01,(byte)0x00, (byte)0x01,(byte)0x00,(byte)0x11,(byte)0x60, @@ -42,16 +37,8 @@ public class TestCommonObjectDataSubRecord (byte)0x00,(byte)0x00, }; - public TestCommonObjectDataSubRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { CommonObjectDataSubRecord record = new CommonObjectDataSubRecord(new TestcaseRecordInputStream((short)0x15, (short)data.length, data)); - assertEquals( CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX, record.getObjectType()); assertEquals( (short)1, record.getObjectId()); @@ -64,8 +51,6 @@ public class TestCommonObjectDataSubRecord assertEquals( (int)218103808, record.getReserved2()); assertEquals( (int)294, record.getReserved3()); assertEquals( 22 , record.getRecordSize() ); - - record.validateSid((short)0x15); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestDatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDatRecord.java index 3cd7a06030..8efbe70ecb 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestDatRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestDatRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,21 +28,12 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestDatRecord - extends TestCase -{ +public final class TestDatRecord extends TestCase { byte[] data = new byte[] { (byte)0x0D,(byte)0x00 // options }; - public TestDatRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { DatRecord record = new DatRecord(new TestcaseRecordInputStream((short)0x1063, (short)data.length, data)); assertEquals( 0xD, record.getOptions()); @@ -54,10 +42,7 @@ public class TestDatRecord assertEquals( true, record.isBorder() ); assertEquals( true, record.isShowSeriesKey() ); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1063); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestDataFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDataFormatRecord.java index ff8111ced5..8de2f24dac 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestDataFormatRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestDataFormatRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestDataFormatRecord - extends TestCase -{ +public final class TestDataFormatRecord extends TestCase { byte[] data = new byte[] { (byte)0xFF,(byte)0xFF, // point number (byte)0x00,(byte)0x00, // series index @@ -41,14 +36,7 @@ public class TestDataFormatRecord (byte)0x00,(byte)0x00 // format flags }; - public TestDataFormatRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { DataFormatRecord record = new DataFormatRecord(new TestcaseRecordInputStream((short)0x1006, (short)data.length, data)); assertEquals( (short)0xFFFF, record.getPointNumber()); @@ -57,10 +45,7 @@ public class TestDataFormatRecord assertEquals( 0, record.getFormatFlags()); assertEquals( false, record.isUseExcel4Colors() ); - assertEquals( 12, record.getRecordSize() ); - - record.validateSid((short)0x1006); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestDefaultDataLabelTextPropertiesRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDefaultDataLabelTextPropertiesRecord.java index 61a3dd5926..f96dca90bf 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestDefaultDataLabelTextPropertiesRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestDefaultDataLabelTextPropertiesRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,29 +28,17 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestDefaultDataLabelTextPropertiesRecord - extends TestCase -{ +public final class TestDefaultDataLabelTextPropertiesRecord extends TestCase { byte[] data = new byte[] { (byte)0x02,(byte)0x00 }; - public TestDefaultDataLabelTextPropertiesRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { DefaultDataLabelTextPropertiesRecord record = new DefaultDataLabelTextPropertiesRecord(new TestcaseRecordInputStream((short)0x1024, (short)data.length, data)); assertEquals( 2, record.getCategoryDataType()); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1024); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestEndSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestEndSubRecord.java index 0e48fcb4ca..d809392420 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestEndSubRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestEndSubRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,28 +27,15 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestEndSubRecord - extends TestCase -{ +public final class TestEndSubRecord extends TestCase { byte[] data = new byte[] { }; - public TestEndSubRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { EndSubRecord record = new EndSubRecord(new TestcaseRecordInputStream((short)0x00, (short)data.length, data)); - - assertEquals( 4, record.getRecordSize() ); - - record.validateSid((short)0x00); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java index 5bbf05be77..3faa69ed6a 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestExtendedFormatRecord.java @@ -36,14 +36,7 @@ public final class TestExtendedFormatRecord extends TestCase { 0xC0-256, 0x20 // Fill Palette 20c0 }; - public TestExtendedFormatRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { ExtendedFormatRecord record = new ExtendedFormatRecord(new TestcaseRecordInputStream((short)0xe0, (short)data.length, data)); assertEquals(0, record.getFontIndex()); assertEquals(0, record.getFormatIndex()); @@ -56,7 +49,6 @@ public final class TestExtendedFormatRecord extends TestCase { assertEquals(0x20c0, record.getFillPaletteOptions()); assertEquals( 20 + 4, record.getRecordSize() ); - record.validateSid((short)0xe0); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestFontBasisRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFontBasisRecord.java index 7f59031d9e..acd5a361ad 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestFontBasisRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestFontBasisRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -29,9 +28,7 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestFontBasisRecord - extends TestCase -{ +public final class TestFontBasisRecord extends TestCase { byte[] data = new byte[] { (byte)0x28,(byte)0x1A, // x basis (byte)0x9C,(byte)0x0F, // y basis @@ -40,14 +37,7 @@ public class TestFontBasisRecord (byte)0x05,(byte)0x00 // index to font table }; - public TestFontBasisRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { FontBasisRecord record = new FontBasisRecord(new TestcaseRecordInputStream((short)0x1060, (short)data.length, data)); assertEquals( 0x1a28, record.getXBasis()); @@ -56,10 +46,7 @@ public class TestFontBasisRecord assertEquals( 0x00, record.getScale()); assertEquals( 0x05, record.getIndexToFontTable()); - assertEquals( 14, record.getRecordSize() ); - - record.validateSid((short)0x1060); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestFontIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFontIndexRecord.java index 9509f2662b..49cfe4d650 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestFontIndexRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestFontIndexRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,29 +28,17 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestFontIndexRecord - extends TestCase -{ +public final class TestFontIndexRecord extends TestCase { byte[] data = new byte[] { (byte)0x05,(byte)0x00 }; - public TestFontIndexRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { FontIndexRecord record = new FontIndexRecord(new TestcaseRecordInputStream((short)0x1026, (short)data.length, data)); assertEquals( 5, record.getFontIndex()); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1026); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestFontRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFontRecord.java index d5051e9915..19449c2f56 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestFontRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestFontRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -26,9 +25,7 @@ import junit.framework.TestCase; * class works correctly. Test data taken directly from a real * Excel file. */ -public class TestFontRecord - extends TestCase -{ +public final class TestFontRecord extends TestCase { byte[] header = new byte[] { 0x31, 00, 0x1a, 00, // sid=31, 26 bytes long }; @@ -45,14 +42,7 @@ public class TestFontRecord 0x00, 0x61, 0x00, 0x6C, 0x00 }; - public TestFontRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { FontRecord record = new FontRecord(new TestcaseRecordInputStream((short)0x31, (short)data.length, data)); assertEquals( 0xc8, record.getFontHeight()); @@ -72,7 +62,6 @@ public class TestFontRecord assertEquals( 26 + 4, record.getRecordSize() ); - record.validateSid((short)0x31); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestFrameRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFrameRecord.java index 1ad27bdc30..f35a04b488 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestFrameRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestFrameRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,22 +28,13 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestFrameRecord - extends TestCase -{ +public final class TestFrameRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00, // border type (byte)0x02,(byte)0x00 // options }; - public TestFrameRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { FrameRecord record = new FrameRecord(new TestcaseRecordInputStream((short)0x1032, (short)data.length, data)); assertEquals( FrameRecord.BORDER_TYPE_REGULAR, record.getBorderType()); @@ -54,10 +42,7 @@ public class TestFrameRecord assertEquals( false, record.isAutoSize() ); assertEquals( true, record.isAutoPosition() ); - assertEquals( 8, record.getRecordSize() ); - - record.validateSid((short)0x1032); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestLegendRecord.java b/src/testcases/org/apache/poi/hssf/record/TestLegendRecord.java index be4ab5731f..aaee94fe82 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestLegendRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestLegendRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,21 +28,12 @@ import junit.framework.TestCase; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class TestLegendRecord - extends TestCase -{ +public class TestLegendRecord extends TestCase { byte[] data = new byte[] { (byte)0x76,(byte)0x0E,(byte)0x00,(byte)0x00,(byte)0x86,(byte)0x07,(byte)0x00,(byte)0x00,(byte)0x19,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x8B,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x03,(byte)0x01,(byte)0x1F,(byte)0x00 }; - public TestLegendRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { LegendRecord record = new LegendRecord(new TestcaseRecordInputStream((short)0x1015, (short)data.length, data)); @@ -71,8 +59,6 @@ public class TestLegendRecord assertEquals( 24, record.getRecordSize() ); - - record.validateSid((short)0x1015); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestLineFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestLineFormatRecord.java index d54f862205..f4e833dd7c 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestLineFormatRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestLineFormatRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestLineFormatRecord - extends TestCase -{ +public class TestLineFormatRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // colour (byte)0x00,(byte)0x00, // pattern @@ -42,14 +37,7 @@ public class TestLineFormatRecord (byte)0x4D,(byte)0x00 // index }; - public TestLineFormatRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { LineFormatRecord record = new LineFormatRecord(new TestcaseRecordInputStream((short)0x1007, (short)data.length, data)); assertEquals( 0, record.getLineColor()); assertEquals( 0, record.getLinePattern()); @@ -59,10 +47,7 @@ public class TestLineFormatRecord assertEquals( false, record.isDrawTicks() ); assertEquals( 0x4d, record.getColourPaletteIndex()); - assertEquals( 16, record.getRecordSize() ); - - record.validateSid((short)0x1007); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestLinkedDataRecord.java b/src/testcases/org/apache/poi/hssf/record/TestLinkedDataRecord.java index c7ef2acc1c..641f1e8c54 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestLinkedDataRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestLinkedDataRecord.java @@ -171,9 +171,6 @@ recordid = 0x1051, size =8 assertEquals(ptgExpected.toString(), ptgActual.toString()); assertEquals( data.length + 4, record.getRecordSize() ); - - record.validateSid((short)0x1051); - } public void testStore() { diff --git a/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java index 2f967b66e6..063f34e0c7 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java @@ -39,19 +39,11 @@ public class TestNoteRecord 0x6E, 0x64, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00 }; - public TestNoteRecord(String name) - { - super(name); - } - - public void testRead() - throws Exception - { + public void testRead() { NoteRecord record = new NoteRecord(new TestcaseRecordInputStream(NoteRecord.sid, (short)data.length, data)); assertEquals(NoteRecord.sid, record.getSid()); - record.validateSid(NoteRecord.sid); assertEquals(6, record.getRow()); assertEquals(1, record.getColumn()); assertEquals(NoteRecord.NOTE_VISIBLE, record.getFlags()); @@ -60,11 +52,9 @@ public class TestNoteRecord } - public void testWrite() - { + public void testWrite() { NoteRecord record = new NoteRecord(); assertEquals(NoteRecord.sid, record.getSid()); - record.validateSid(NoteRecord.sid); record.setRow((short)6); record.setColumn((short)1); diff --git a/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java index d6b5a64766..014a5be2ba 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ + package org.apache.poi.hssf.record; @@ -28,37 +29,24 @@ import java.util.Arrays; * * @author Yegor Kozlov */ -public class TestNoteStructureSubRecord - extends TestCase -{ +public final class TestNoteStructureSubRecord extends TestCase { private byte[] data = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)0x80, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)0x81, 0x01, (byte)0xCC, (byte)0xEC }; - public TestNoteStructureSubRecord(String name) - { - super(name); - } - - public void testRead() - throws Exception - { + public void testRead() { NoteStructureSubRecord record = new NoteStructureSubRecord(new TestcaseRecordInputStream(NoteStructureSubRecord.sid, (short)data.length, data)); assertEquals(NoteStructureSubRecord.sid, record.getSid()); - record.validateSid(NoteStructureSubRecord.sid); assertEquals(data.length + 4, record.getRecordSize()); - } - public void testWrite() - { + public void testWrite() { NoteStructureSubRecord record = new NoteStructureSubRecord(); assertEquals(NoteStructureSubRecord.sid, record.getSid()); - record.validateSid(NoteStructureSubRecord.sid); assertEquals(data.length + 4, record.getRecordSize()); byte [] ser = record.serialize(); diff --git a/src/testcases/org/apache/poi/hssf/record/TestNumberFormatIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNumberFormatIndexRecord.java index e891a18413..1ee74f2cc7 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestNumberFormatIndexRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestNumberFormatIndexRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,29 +28,17 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestNumberFormatIndexRecord - extends TestCase -{ +public final class TestNumberFormatIndexRecord extends TestCase { byte[] data = new byte[] { 0x05,0x00 }; - public TestNumberFormatIndexRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { NumberFormatIndexRecord record = new NumberFormatIndexRecord(new TestcaseRecordInputStream((short)0x104e, (short)data.length, data)); assertEquals( 5, record.getFormatIndex()); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x104e); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestObjectLinkRecord.java b/src/testcases/org/apache/poi/hssf/record/TestObjectLinkRecord.java index deaef1a040..e9d536df0a 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestObjectLinkRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestObjectLinkRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,46 +28,26 @@ import junit.framework.TestCase; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class TestObjectLinkRecord - extends TestCase -{ +public final class TestObjectLinkRecord extends TestCase { byte[] data = new byte[] { (byte)0x03,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 }; - public TestObjectLinkRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { ObjectLinkRecord record = new ObjectLinkRecord(new TestcaseRecordInputStream((short)0x1027, (short)data.length, data)); - assertEquals( (short)3, record.getAnchorId()); - assertEquals( (short)0x00, record.getLink1()); - assertEquals( (short)0x00, record.getLink2()); - assertEquals( 10, record.getRecordSize() ); - - record.validateSid((short)0x1027); } - public void testStore() - { + public void testStore() { ObjectLinkRecord record = new ObjectLinkRecord(); - - record.setAnchorId( (short)3 ); - record.setLink1( (short)0x00 ); - record.setLink2( (short)0x00 ); diff --git a/src/testcases/org/apache/poi/hssf/record/TestPaneRecord.java b/src/testcases/org/apache/poi/hssf/record/TestPaneRecord.java index a0d0cf841f..aa80047913 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestPaneRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestPaneRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,9 +27,7 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestPaneRecord - extends TestCase -{ +public final class TestPaneRecord extends TestCase { byte[] data = new byte[] { (byte)0x01, (byte)0x00, (byte)0x02, (byte)0x00, @@ -41,16 +36,8 @@ public class TestPaneRecord (byte)0x02, (byte)0x00, }; - public TestPaneRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { PaneRecord record = new PaneRecord(new TestcaseRecordInputStream((short)0x41, (short)data.length, data)); - assertEquals( (short)1, record.getX()); assertEquals( (short)2, record.getY()); @@ -59,8 +46,6 @@ public class TestPaneRecord assertEquals( PaneRecord.ACTIVE_PANE_LOWER_LEFT, record.getActivePane()); assertEquals( 14, record.getRecordSize() ); - - record.validateSid((short)0x41); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestPlotAreaRecord.java b/src/testcases/org/apache/poi/hssf/record/TestPlotAreaRecord.java index 01848870d3..aa5941a49a 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestPlotAreaRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestPlotAreaRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,37 +28,20 @@ import junit.framework.TestCase; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class TestPlotAreaRecord - extends TestCase -{ +public final class TestPlotAreaRecord extends TestCase { byte[] data = new byte[] { }; - public TestPlotAreaRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { PlotAreaRecord record = new PlotAreaRecord(new TestcaseRecordInputStream((short)0x1035, (short)data.length, data)); - - assertEquals( 4, record.getRecordSize() ); - - record.validateSid((short)0x1035); } - public void testStore() - { + public void testStore() { PlotAreaRecord record = new PlotAreaRecord(); - - - byte [] recordBytes = record.serialize(); assertEquals(recordBytes.length - 4, data.length); for (int i = 0; i < data.length; i++) diff --git a/src/testcases/org/apache/poi/hssf/record/TestPlotGrowthRecord.java b/src/testcases/org/apache/poi/hssf/record/TestPlotGrowthRecord.java index e01e5bca54..2897d8c332 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestPlotGrowthRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestPlotGrowthRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,31 +27,19 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestPlotGrowthRecord - extends TestCase -{ +public final class TestPlotGrowthRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00, // horizontal (byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00 // vertical }; - public TestPlotGrowthRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { PlotGrowthRecord record = new PlotGrowthRecord(new TestcaseRecordInputStream((short)0x1064, (short)data.length, data)); assertEquals( 65536, record.getHorizontalScale()); assertEquals( 65536, record.getVerticalScale()); - assertEquals( 12, record.getRecordSize() ); - - record.validateSid((short)0x1064); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSCLRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSCLRecord.java index 9f2a579774..9b98dab1f6 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSCLRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSCLRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,29 +28,17 @@ import junit.framework.TestCase; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class TestSCLRecord - extends TestCase -{ +public final class TestSCLRecord extends TestCase { byte[] data = new byte[] { (byte)0x3,(byte)0x0,(byte)0x4,(byte)0x0 }; - public TestSCLRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SCLRecord record = new SCLRecord(new TestcaseRecordInputStream((short)0xa0, (short)data.length, data)); assertEquals( 3, record.getNumerator()); assertEquals( 4, record.getDenominator()); - assertEquals( 8, record.getRecordSize() ); - - record.validateSid((short)0xa0); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesChartGroupIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesChartGroupIndexRecord.java index ff541fa9d2..1f30f26ec0 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesChartGroupIndexRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSeriesChartGroupIndexRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,29 +27,16 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestSeriesChartGroupIndexRecord - extends TestCase -{ +public final class TestSeriesChartGroupIndexRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00 }; - public TestSeriesChartGroupIndexRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SeriesChartGroupIndexRecord record = new SeriesChartGroupIndexRecord(new TestcaseRecordInputStream((short)0x1045, (short)data.length, data)); assertEquals( 0, record.getChartGroupIndex()); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1045); - } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesIndexRecord.java index f671ed9b51..b971128c99 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesIndexRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSeriesIndexRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,30 +28,16 @@ import junit.framework.TestCase; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class TestSeriesIndexRecord - extends TestCase -{ +public final class TestSeriesIndexRecord extends TestCase { byte[] data = new byte[] { (byte)0x03,(byte)0x00 }; - public TestSeriesIndexRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SeriesIndexRecord record = new SeriesIndexRecord(new TestcaseRecordInputStream((short)0x1065, (short)data.length, data)); - assertEquals( (short)3, record.getIndex()); - - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1065); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesLabelsRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesLabelsRecord.java index 03550cd3d8..265583655d 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesLabelsRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSeriesLabelsRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,21 +28,12 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestSeriesLabelsRecord - extends TestCase -{ +public final class TestSeriesLabelsRecord extends TestCase { byte[] data = new byte[] { (byte)0x03,(byte)0x00 }; - public TestSeriesLabelsRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SeriesLabelsRecord record = new SeriesLabelsRecord(new TestcaseRecordInputStream((short)0x100c, (short)data.length, data)); assertEquals( 3, record.getFormatFlags()); assertEquals( true, record.isShowActual() ); @@ -57,8 +45,6 @@ public class TestSeriesLabelsRecord assertEquals( 2+4, record.getRecordSize() ); - - record.validateSid((short)0x100c); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesListRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesListRecord.java index 73be41bdc5..7e81f29280 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesListRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSeriesListRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,21 +28,12 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestSeriesListRecord - extends TestCase -{ +public final class TestSeriesListRecord extends TestCase { byte[] data = new byte[] { (byte)0x02,(byte)0x00,(byte)0x01,(byte)0x20,(byte)0xff,(byte)0xf0 }; - public TestSeriesListRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SeriesListRecord record = new SeriesListRecord(new TestcaseRecordInputStream((short)0x1016, (short)data.length, data)); assertEquals( (short)0x2001, record.getSeriesNumbers()[0]); @@ -53,8 +41,6 @@ public class TestSeriesListRecord assertEquals( 2, record.getSeriesNumbers().length); assertEquals( 4 + 6, record.getRecordSize() ); - - record.validateSid((short)0x1016); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesRecord.java index a01f95966b..69232754fb 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSeriesRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,9 +27,7 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestSeriesRecord - extends TestCase -{ +public final class TestSeriesRecord extends TestCase { byte[] data = new byte[] { (byte)0x01,(byte)0x00, // category data type (byte)0x01,(byte)0x00, // values data type @@ -42,14 +37,7 @@ public class TestSeriesRecord (byte)0x00,(byte)0x00 // num bubble values }; - public TestSeriesRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SeriesRecord record = new SeriesRecord(new TestcaseRecordInputStream((short)0x1003, (short)data.length, data)); assertEquals( SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, record.getCategoryDataType()); @@ -61,8 +49,6 @@ public class TestSeriesRecord assertEquals( 16, record.getRecordSize() ); - - record.validateSid((short)0x1003); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesTextRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesTextRecord.java index 5ad41870aa..08e4189afb 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesTextRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSeriesTextRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,50 +28,29 @@ import junit.framework.TestCase; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class TestSeriesTextRecord - extends TestCase -{ +public final class TestSeriesTextRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00,(byte)0x0C,(byte)0x01,(byte)0x56,(byte)0x00,(byte)0x61,(byte)0x00,(byte)0x6C,(byte)0x00,(byte)0x75,(byte)0x00,(byte)0x65,(byte)0x00,(byte)0x20,(byte)0x00,(byte)0x4E,(byte)0x00,(byte)0x75,(byte)0x00,(byte)0x6D,(byte)0x00,(byte)0x62,(byte)0x00,(byte)0x65,(byte)0x00,(byte)0x72,(byte)0x00 }; - public TestSeriesTextRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SeriesTextRecord record = new SeriesTextRecord(new TestcaseRecordInputStream((short)0x100d, (short)data.length, data)); - assertEquals( (short)0, record.getId()); - assertEquals( (byte)0x0C, record.getTextLength()); - assertEquals( (byte)0x01, record.getUndocumented()); - assertEquals( "Value Number", record.getText()); - assertEquals( 32, record.getRecordSize() ); - - record.validateSid((short)0x100d); } public void testStore() { SeriesTextRecord record = new SeriesTextRecord(); - - record.setId( (short)0 ); - record.setTextLength( (byte)0x0C ); - record.setUndocumented( (byte)0x01 ); - record.setText( "Value Number" ); diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesToChartGroupRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesToChartGroupRecord.java index 55e0b94674..4f20e0e696 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesToChartGroupRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSeriesToChartGroupRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,28 +28,16 @@ import junit.framework.TestCase; * @author Andrew C. Oliver (acoliver at apache.org) */ -public class TestSeriesToChartGroupRecord - extends TestCase -{ +public final class TestSeriesToChartGroupRecord extends TestCase { byte[] data = new byte[] { (byte)0x0, (byte)0x0 }; - public TestSeriesToChartGroupRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SeriesToChartGroupRecord record = new SeriesToChartGroupRecord(new TestcaseRecordInputStream((short)0x1045, (short)data.length, data)); assertEquals( 0x0, record.getChartGroupIndex()); - assertEquals( 0x6, record.getRecordSize() ); - - record.validateSid((short)0x1045); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSheetPropertiesRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSheetPropertiesRecord.java index 9fd260c6a4..932ff6eace 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSheetPropertiesRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSheetPropertiesRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,23 +28,14 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestSheetPropertiesRecord - extends TestCase -{ +public final class TestSheetPropertiesRecord extends TestCase { byte[] data = new byte[] { (byte)0x0A,(byte)0x00, (byte)0x00 //,(byte)0x00 // not sure where that last byte comes from }; - public TestSheetPropertiesRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { SheetPropertiesRecord record = new SheetPropertiesRecord(new TestcaseRecordInputStream((short)0x1044, (short)data.length, data)); assertEquals( 10, record.getFlags()); assertEquals( false, record.isChartTypeManuallyFormatted() ); @@ -59,8 +47,6 @@ public class TestSheetPropertiesRecord assertEquals( 7, record.getRecordSize() ); - - record.validateSid((short)0x1044); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestStringRecord.java b/src/testcases/org/apache/poi/hssf/record/TestStringRecord.java index b383c77e86..7f06c54ab3 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestStringRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestStringRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,9 +27,7 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestStringRecord - extends TestCase -{ +public class TestStringRecord extends TestCase { byte[] data = new byte[] { (byte)0x0B,(byte)0x00, // length (byte)0x00, // option @@ -40,21 +35,12 @@ public class TestStringRecord (byte)0x46,(byte)0x61,(byte)0x68,(byte)0x72,(byte)0x7A,(byte)0x65,(byte)0x75,(byte)0x67,(byte)0x74,(byte)0x79,(byte)0x70 }; - public TestStringRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { StringRecord record = new StringRecord(new TestcaseRecordInputStream((short)0x207, (short)data.length, data)); assertEquals( "Fahrzeugtyp", record.getString()); assertEquals( 18, record.getRecordSize() ); - - record.validateSid((short)0x207); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestSupBookRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSupBookRecord.java index e2a61dde79..5506f6abdf 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestSupBookRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestSupBookRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -49,11 +46,6 @@ public final class TestSupBookRecord extends TestCase { (byte)'S', (byte)'h', (byte)'e', (byte)'e', (byte)'t', (byte)'2', }; - public TestSupBookRecord(String name) - { - super(name); - } - /** * tests that we can load the record */ @@ -64,8 +56,6 @@ public final class TestSupBookRecord extends TestCase { assertEquals( 0x4, record.getNumberOfSheets() ); //expected # of sheets assertEquals( 8, record.getRecordSize() ); //sid+size+data - - record.validateSid((short)0x01AE); } /** * tests that we can load the record @@ -83,8 +73,6 @@ public final class TestSupBookRecord extends TestCase { assertEquals(2, sheetNames.length); assertEquals("Sheet1", sheetNames[0].getString()); assertEquals("Sheet2", sheetNames[1].getString()); - - record.validateSid((short)0x01AE); } /** @@ -96,7 +84,6 @@ public final class TestSupBookRecord extends TestCase { assertTrue( record.isAddInFunctions() ); //expected flag assertEquals( 0x1, record.getNumberOfSheets() ); //expected # of sheets assertEquals( 8, record.getRecordSize() ); //sid+size+data - record.validateSid((short)0x01AE); } /** @@ -119,10 +106,4 @@ public final class TestSupBookRecord extends TestCase { TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataER, record.serialize()); } - - public static void main(String [] args) { - System.out - .println("Testing org.apache.poi.hssf.record.SupBookRecord"); - junit.textui.TestRunner.run(TestSupBookRecord.class); - } } diff --git a/src/testcases/org/apache/poi/hssf/record/TestTableRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTableRecord.java index 0f562d1456..19c91bbacb 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestTableRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestTableRecord.java @@ -58,7 +58,6 @@ public final class TestTableRecord extends TestCase { assertEquals(0, record.getColInputCol()); assertEquals( 16 + 4, record.getRecordSize() ); - record.validateSid((short)0x236); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestTextObjectBaseRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTextObjectBaseRecord.java index b7c6367cd2..b9d80dbad5 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestTextObjectBaseRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestTextObjectBaseRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,23 +28,14 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestTextObjectBaseRecord - extends TestCase -{ +public class TestTextObjectBaseRecord extends TestCase { byte[] data = new byte[] { 0x44, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, }; - public TestTextObjectBaseRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { TextObjectBaseRecord record = new TextObjectBaseRecord(new TestcaseRecordInputStream((short)0x1B6, (short)data.length, data)); @@ -68,8 +56,6 @@ public class TestTextObjectBaseRecord assertEquals( 22, record.getRecordSize() ); - - record.validateSid((short)0x1B6); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java index 8f16516ca9..91458e9ddb 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java @@ -1,4 +1,3 @@ - /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -18,11 +17,10 @@ package org.apache.poi.hssf.record; -import junit.framework.*; - -import java.util.Arrays; -import java.util.List; import java.io.ByteArrayInputStream; +import java.util.Arrays; + +import junit.framework.TestCase; import org.apache.poi.hssf.usermodel.HSSFRichTextString; @@ -32,7 +30,7 @@ import org.apache.poi.hssf.usermodel.HSSFRichTextString; * * @author Yegor Kozlov */ -public class TestTextObjectRecord extends TestCase { +public final class TestTextObjectRecord extends TestCase { byte[] data = {(byte)0xB6, 0x01, 0x12, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, @@ -42,17 +40,13 @@ public class TestTextObjectRecord extends TestCase { 0x00, 0x08, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - public void testRead() - throws Exception - { - + public void testRead() { RecordInputStream is = new RecordInputStream(new ByteArrayInputStream(data)); is.nextRecord(); TextObjectRecord record = new TextObjectRecord(is); assertEquals(TextObjectRecord.sid, record.getSid()); - record.validateSid(TextObjectRecord.sid); assertEquals(TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_LEFT_ALIGNED, record.getHorizontalTextAlignment()); assertEquals(TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_TOP, record.getVerticalTextAlignment()); assertEquals(TextObjectRecord.TEXT_ORIENTATION_NONE, record.getTextOrientation()); diff --git a/src/testcases/org/apache/poi/hssf/record/TestTextRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTextRecord.java index 72f2dea8a9..40e98dff93 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestTextRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestTextRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -30,9 +27,7 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestTextRecord - extends TestCase -{ +public class TestTextRecord extends TestCase { byte[] data = new byte[] { (byte)0x02, // horiz align (byte)0x02, // vert align @@ -48,14 +43,7 @@ public class TestTextRecord (byte)0x00,(byte)0x00 // text rotation }; - public TestTextRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { TextRecord record = new TextRecord(new TestcaseRecordInputStream((short)0x1025, (short)data.length, data)); assertEquals( TextRecord.HORIZONTAL_ALIGNMENT_CENTER, record.getHorizontalAlignment()); @@ -87,9 +75,6 @@ public class TestTextRecord assertEquals( 36, record.getRecordSize() ); - - record.validateSid((short)0x1025); - } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestTickRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTickRecord.java index e34feba4f7..4f2d9efd36 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestTickRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestTickRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * @author Andrew C. Oliver(acoliver at apache.org) */ -public class TestTickRecord - extends TestCase -{ +public final class TestTickRecord extends TestCase { byte[] data = new byte[] { (byte)0x02, (byte)0x00, (byte)0x03, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, @@ -44,14 +39,7 @@ public class TestTickRecord (byte)0x4D, (byte)0x00, (byte)0x00, (byte)0x00 }; - public TestTickRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { TickRecord record = new TickRecord(new TestcaseRecordInputStream((short)0x101e, (short)data.length, data)); assertEquals( (byte)2, record.getMajorTickType()); assertEquals( (byte)0, record.getMinorTickType()); @@ -70,8 +58,6 @@ public class TestTickRecord assertEquals( 34, record.getRecordSize() ); - - record.validateSid((short)0x101e); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestUnitsRecord.java b/src/testcases/org/apache/poi/hssf/record/TestUnitsRecord.java index bcf08ea54d..c43828af48 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestUnitsRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestUnitsRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,29 +28,17 @@ import junit.framework.TestCase; * @author Glen Stampoultzis (glens at apache.org) */ -public class TestUnitsRecord - extends TestCase -{ +public final class TestUnitsRecord extends TestCase { byte[] data = new byte[] { (byte)0x00, (byte)0x00 }; - public TestUnitsRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { UnitsRecord record = new UnitsRecord(new TestcaseRecordInputStream((short)0x1001, (short)data.length, data)); assertEquals( 0, record.getUnits()); - assertEquals( 6, record.getRecordSize() ); - - record.validateSid((short)0x1001); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/record/TestValueRangeRecord.java b/src/testcases/org/apache/poi/hssf/record/TestValueRangeRecord.java index ad84b7fcf8..b974bf9759 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestValueRangeRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestValueRangeRecord.java @@ -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,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - - package org.apache.poi.hssf.record; @@ -31,9 +28,7 @@ import junit.framework.TestCase; * * @author Glen Stampoultzis (glens at apache.org) */ -public class TestValueRangeRecord - extends TestCase -{ +public final class TestValueRangeRecord extends TestCase { byte[] data = new byte[] { (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // min axis value (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // max axis value @@ -43,14 +38,7 @@ public class TestValueRangeRecord (byte)0x1F,(byte)0x01 // options }; - public TestValueRangeRecord(String name) - { - super(name); - } - - public void testLoad() - throws Exception - { + public void testLoad() { ValueRangeRecord record = new ValueRangeRecord(new TestcaseRecordInputStream((short)0x101f, (short)data.length, data)); assertEquals( 0.0, record.getMinimumAxisValue(), 0.001); @@ -70,8 +58,6 @@ public class TestValueRangeRecord assertEquals( true, record.isReserved() ); assertEquals( 42+4, record.getRecordSize() ); - - record.validateSid((short)0x101f); } public void testStore() diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index 38b048f719..4757223354 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -892,4 +892,23 @@ public final class TestHSSFSheet extends TestCase { //TODO: check shapeId in the cloned sheet } + + /** + * POI now (Sep 2008) allows sheet names longer than 31 chars (for other apps besides Excel). + * Since Excel silently truncates to 31, make sure that POI enforces uniqueness on the first + * 31 chars. + */ + public void testLongSheetNames() { + HSSFWorkbook wb = new HSSFWorkbook(); + final String SAME_PREFIX = "A123456789B123456789C123456789"; // 30 chars + + wb.createSheet(SAME_PREFIX + "Dxxxx"); + try { + wb.createSheet(SAME_PREFIX + "Dyyyy"); // identical up to the 32nd char + throw new AssertionFailedError("Expected exception not thrown"); + } catch (IllegalArgumentException e) { + assertEquals("The workbook already contains a sheet of this name", e.getMessage()); + } + wb.createSheet(SAME_PREFIX + "Exxxx"); // OK - differs in the 31st char + } } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index 6fb08f4ee3..4357c57e3b 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -498,18 +498,12 @@ public final class TestHSSFWorkbook extends TestCase { public BadlyBehavedRecord() { // } - protected void fillFields(RecordInputStream in) { - throw new RuntimeException("Should not be called"); - } public short getSid() { return 0x777; } public int serialize(int offset, byte[] data) { return 4; } - protected void validateSid(short id) { - throw new RuntimeException("Should not be called"); - } public int getRecordSize() { return 8; }