From 1b2b506edb5f470e8915985b1a9351c2a08eb788 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Mon, 28 Sep 2015 23:16:58 +0000 Subject: [PATCH] Sonar fixes - add cloneable interface to classes with clone() Sonar fixes - remove pubic/static/final modifier from interfaces git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1705789 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/usermodel/RecordsStresser.java | 3 + src/java/org/apache/poi/ddf/EscherRecord.java | 12 ++- .../apache/poi/ddf/EscherTextboxRecord.java | 17 ++-- .../apache/poi/ddf/UnknownEscherRecord.java | 12 ++- .../org/apache/poi/hssf/dev/BiffViewer.java | 2 +- .../apache/poi/hssf/model/InternalSheet.java | 14 ++- .../record/AbstractEscherHolderRecord.java | 8 +- .../apache/poi/hssf/record/ArrayRecord.java | 5 +- .../poi/hssf/record/AutoFilterInfoRecord.java | 8 +- .../org/apache/poi/hssf/record/BOFRecord.java | 5 +- .../apache/poi/hssf/record/BlankRecord.java | 5 +- .../apache/poi/hssf/record/BoolErrRecord.java | 5 +- .../poi/hssf/record/BottomMarginRecord.java | 6 +- .../poi/hssf/record/CFHeader12Record.java | 5 +- .../apache/poi/hssf/record/CFHeaderBase.java | 5 +- .../poi/hssf/record/CFHeaderRecord.java | 5 +- .../poi/hssf/record/CFRule12Record.java | 5 +- .../apache/poi/hssf/record/CFRuleBase.java | 5 +- .../apache/poi/hssf/record/CFRuleRecord.java | 5 +- .../poi/hssf/record/CalcCountRecord.java | 7 +- .../poi/hssf/record/CalcModeRecord.java | 7 +- .../poi/hssf/record/ColumnInfoRecord.java | 5 +- .../record/CommonObjectDataSubRecord.java | 5 +- .../poi/hssf/record/ContinueRecord.java | 5 +- .../apache/poi/hssf/record/DBCellRecord.java | 5 +- .../apache/poi/hssf/record/DVALRecord.java | 5 +- .../org/apache/poi/hssf/record/DVRecord.java | 7 +- .../hssf/record/DefaultColWidthRecord.java | 5 +- .../hssf/record/DefaultRowHeightRecord.java | 7 +- .../apache/poi/hssf/record/DeltaRecord.java | 5 +- .../poi/hssf/record/DimensionsRecord.java | 7 +- .../apache/poi/hssf/record/DrawingRecord.java | 5 +- .../hssf/record/DrawingSelectionRecord.java | 5 +- .../org/apache/poi/hssf/record/EOFRecord.java | 5 +- .../record/EmbeddedObjectRefSubRecord.java | 5 +- .../apache/poi/hssf/record/EndSubRecord.java | 5 +- .../apache/poi/hssf/record/FeatHdrRecord.java | 9 +- .../apache/poi/hssf/record/FeatRecord.java | 9 +- .../poi/hssf/record/FilePassRecord.java | 42 +++++++-- .../poi/hssf/record/FileSharingRecord.java | 8 +- .../apache/poi/hssf/record/FooterRecord.java | 5 +- .../apache/poi/hssf/record/FormatRecord.java | 14 ++- .../apache/poi/hssf/record/FormulaRecord.java | 4 +- .../poi/hssf/record/FtCblsSubRecord.java | 5 +- .../apache/poi/hssf/record/FtCfSubRecord.java | 5 +- .../poi/hssf/record/FtPioGrbitSubRecord.java | 5 +- .../apache/poi/hssf/record/GridsetRecord.java | 7 +- .../poi/hssf/record/GroupMarkerSubRecord.java | 5 +- .../apache/poi/hssf/record/GutsRecord.java | 7 +- .../apache/poi/hssf/record/HCenterRecord.java | 5 +- .../poi/hssf/record/HeaderFooterRecord.java | 9 +- .../apache/poi/hssf/record/HeaderRecord.java | 5 +- .../record/HorizontalPageBreakRecord.java | 5 +- .../poi/hssf/record/HyperlinkRecord.java | 5 +- .../apache/poi/hssf/record/IndexRecord.java | 5 +- .../poi/hssf/record/IterationRecord.java | 5 +- .../apache/poi/hssf/record/LabelRecord.java | 5 +- .../poi/hssf/record/LabelSSTRecord.java | 5 +- .../poi/hssf/record/LbsDataSubRecord.java | 3 +- .../poi/hssf/record/LeftMarginRecord.java | 9 +- .../poi/hssf/record/MergeCellsRecord.java | 5 +- .../poi/hssf/record/MulBlankRecord.java | 2 +- .../apache/poi/hssf/record/NoteRecord.java | 5 +- .../hssf/record/NoteStructureSubRecord.java | 5 +- .../apache/poi/hssf/record/NumberRecord.java | 4 +- .../org/apache/poi/hssf/record/ObjRecord.java | 4 +- .../poi/hssf/record/ObjectProtectRecord.java | 7 +- .../org/apache/poi/hssf/record/Record.java | 12 +-- .../ColumnInfoRecordsAggregate.java | 15 ++-- .../poi/hssf/record/cf/BorderFormatting.java | 5 +- .../record/cf/ColorGradientThreshold.java | 5 +- .../poi/hssf/record/cf/DataBarThreshold.java | 5 +- .../poi/hssf/record/cf/FontFormatting.java | 5 +- .../record/cf/IconMultiStateThreshold.java | 5 +- .../hssf/record/chart/AreaFormatRecord.java | 5 +- .../poi/hssf/record/chart/AreaRecord.java | 5 +- .../record/chart/AxisLineFormatRecord.java | 5 +- .../hssf/record/chart/AxisOptionsRecord.java | 5 +- .../hssf/record/chart/AxisParentRecord.java | 5 +- .../poi/hssf/record/chart/AxisRecord.java | 5 +- .../poi/hssf/record/chart/AxisUsedRecord.java | 5 +- .../poi/hssf/record/chart/BarRecord.java | 5 +- .../poi/hssf/record/chart/BeginRecord.java | 5 +- .../chart/CategorySeriesAxisRecord.java | 5 +- .../record/chart/ChartEndBlockRecord.java | 2 +- .../poi/hssf/record/chart/ChartRecord.java | 5 +- .../record/chart/ChartStartBlockRecord.java | 2 +- .../poi/hssf/record/chart/DatRecord.java | 6 +- .../hssf/record/chart/DataFormatRecord.java | 5 +- .../DefaultDataLabelTextPropertiesRecord.java | 5 +- .../poi/hssf/record/chart/EndRecord.java | 5 +- .../hssf/record/chart/FontBasisRecord.java | 7 +- .../hssf/record/chart/FontIndexRecord.java | 7 +- .../poi/hssf/record/chart/FrameRecord.java | 5 +- .../poi/hssf/record/chart/LegendRecord.java | 5 +- .../hssf/record/chart/LineFormatRecord.java | 5 +- .../hssf/record/chart/LinkedDataRecord.java | 5 +- .../record/chart/NumberFormatIndexRecord.java | 5 +- .../hssf/record/chart/ObjectLinkRecord.java | 5 +- .../poi/hssf/record/common/ExtendedColor.java | 5 +- .../poi/hssf/record/common/FtrHeader.java | 2 +- .../poi/poifs/filesystem/BATManaged.java | 4 +- .../apache/poi/poifs/storage/BlockList.java | 12 ++- .../poi/poifs/storage/BlockWritable.java | 3 +- .../org/apache/poi/sl/usermodel/Insets2D.java | 12 +-- .../org/apache/poi/ss/formula/ptg/AreaI.java | 8 +- .../poi/ss/usermodel/BorderFormatting.java | 28 +++--- .../org/apache/poi/ss/usermodel/Cell.java | 12 +-- .../apache/poi/ss/usermodel/CellStyle.java | 88 +++++++++---------- .../apache/poi/wp/usermodel/CharacterRun.java | 88 +++++++++---------- .../poi/hwpf/model/CharIndexTranslator.java | 4 +- 111 files changed, 490 insertions(+), 397 deletions(-) diff --git a/src/integrationtest/org/apache/poi/hssf/usermodel/RecordsStresser.java b/src/integrationtest/org/apache/poi/hssf/usermodel/RecordsStresser.java index acc8b97cd..1b712f788 100644 --- a/src/integrationtest/org/apache/poi/hssf/usermodel/RecordsStresser.java +++ b/src/integrationtest/org/apache/poi/hssf/usermodel/RecordsStresser.java @@ -56,6 +56,8 @@ public class RecordsStresser { assertArrayEquals("Record of type " + record.getClass() + " should return the same byte array via the clone() method, but did return a different array", origBytes, newBytes); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); } catch (RuntimeException e) { // some Records do not implement clone, ignore those for now assertTrue(e.getMessage().contains("needs to define a clone method")); @@ -70,6 +72,7 @@ public class RecordsStresser { try { HSSFWorkbook wb = new HSSFWorkbook(stream); handleWorkbook(wb); + wb.close(); } finally { stream.close(); } diff --git a/src/java/org/apache/poi/ddf/EscherRecord.java b/src/java/org/apache/poi/ddf/EscherRecord.java index 2fa56d5b5..f09d925f3 100644 --- a/src/java/org/apache/poi/ddf/EscherRecord.java +++ b/src/java/org/apache/poi/ddf/EscherRecord.java @@ -22,7 +22,11 @@ import java.io.PrintWriter; import java.util.Collections; import java.util.List; -import org.apache.poi.util.*; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.Internal; +import org.apache.poi.util.LittleEndian; /** * The base abstract record from which all escher records are defined. Subclasses will need @@ -223,9 +227,9 @@ public abstract class EscherRecord { /** * Escher records may need to be clonable in the future. */ - public Object clone() - { - throw new RuntimeException( "The class " + getClass().getName() + " needs to define a clone method" ); + @Override + public EscherRecord clone() throws CloneNotSupportedException { + throw new CloneNotSupportedException( "The class " + getClass().getName() + " needs to define a clone method" ); } /** diff --git a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java index c21c22796..75d5b2528 100644 --- a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java +++ b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java @@ -26,12 +26,8 @@ import org.apache.poi.util.RecordFormatException; * text in the format of the parent application, rather than in * Escher format. We don't attempt to understand the contents, since * they will be in the parent's format, not Escher format. - * - * @author Glen Stampoultzis (glens at apache.org) - * @author Nick Burch (nick at torchbox dot com) */ -public class EscherTextboxRecord extends EscherRecord -{ +public class EscherTextboxRecord extends EscherRecord implements Cloneable { public static final short RECORD_ID = (short)0xF00D; public static final String RECORD_DESCRIPTION = "msofbtClientTextbox"; @@ -102,10 +98,13 @@ public class EscherTextboxRecord extends EscherRecord return 8 + thedata.length; } - public Object clone() - { - // shallow clone - return super.clone(); + @Override + public EscherTextboxRecord clone() { + EscherTextboxRecord etr = new EscherTextboxRecord(); + etr.setOptions(this.getOptions()); + etr.setRecordId(this.getRecordId()); + etr.thedata = this.thedata.clone(); + return etr; } public String getRecordName() { diff --git a/src/java/org/apache/poi/ddf/UnknownEscherRecord.java b/src/java/org/apache/poi/ddf/UnknownEscherRecord.java index e60703ae3..11a5edb02 100644 --- a/src/java/org/apache/poi/ddf/UnknownEscherRecord.java +++ b/src/java/org/apache/poi/ddf/UnknownEscherRecord.java @@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndian; * @author Glen Stampoultzis (glens at apache.org) * @author Zhang Zhang (zhangzzh at gmail.com) */ -public final class UnknownEscherRecord extends EscherRecord { +public final class UnknownEscherRecord extends EscherRecord implements Cloneable { private static final byte[] NO_BYTES = new byte[0]; /** The data for this record not including the the 8 byte header */ @@ -113,9 +113,13 @@ public final class UnknownEscherRecord extends EscherRecord { _childRecords = childRecords; } - public Object clone() { - // shallow clone - return super.clone(); + @Override + public UnknownEscherRecord clone() { + UnknownEscherRecord uer = new UnknownEscherRecord(); + uer.thedata = this.thedata.clone(); + uer.setOptions(this.getOptions()); + uer.setRecordId(this.getRecordId()); + return uer; } public String getRecordName() { diff --git a/src/java/org/apache/poi/hssf/dev/BiffViewer.java b/src/java/org/apache/poi/hssf/dev/BiffViewer.java index 2f08b6bcc..275216934 100644 --- a/src/java/org/apache/poi/hssf/dev/BiffViewer.java +++ b/src/java/org/apache/poi/hssf/dev/BiffViewer.java @@ -487,7 +487,7 @@ public final class BiffViewer { } } - private static interface IBiffRecordListener { + private interface IBiffRecordListener { void processRecord(int globalOffset, int recordCounter, int sid, int dataSize, byte[] data); diff --git a/src/java/org/apache/poi/hssf/model/InternalSheet.java b/src/java/org/apache/poi/hssf/model/InternalSheet.java index 7eb76c43b..c6d0ae51c 100644 --- a/src/java/org/apache/poi/hssf/model/InternalSheet.java +++ b/src/java/org/apache/poi/hssf/model/InternalSheet.java @@ -390,7 +390,11 @@ public final class InternalSheet { _destList = destList; } public void visitRecord(Record r) { - _destList.add((Record)r.clone()); + try { + _destList.add((Record)r.clone()); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } } } @@ -415,8 +419,12 @@ public final class InternalSheet { */ rb = new DrawingRecord(); } - Record rec = (Record) ((Record) rb).clone(); - clonedRecords.add(rec); + try { + Record rec = (Record) ((Record) rb).clone(); + clonedRecords.add(rec); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } } return createSheet(new RecordStream(clonedRecords, 0)); } diff --git a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java index d3263834c..e55d04188 100644 --- a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java +++ b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java @@ -36,7 +36,7 @@ import org.apache.poi.hssf.util.LazilyConcatenatedByteArray; * @author Glen Stampoultzis (glens at apache.org) * @author Michael Zalewski (zalewski at optonline.net) */ -public abstract class AbstractEscherHolderRecord extends Record { +public abstract class AbstractEscherHolderRecord extends Record implements Cloneable { private static boolean DESERIALISE; static { try { @@ -148,9 +148,9 @@ public abstract class AbstractEscherHolderRecord extends Record { public abstract short getSid(); - public Object clone() - { - return cloneViaReserialise(); + @Override + public AbstractEscherHolderRecord clone() { + return (AbstractEscherHolderRecord)cloneViaReserialise(); } public void addEscherRecord(int index, EscherRecord element) diff --git a/src/java/org/apache/poi/hssf/record/ArrayRecord.java b/src/java/org/apache/poi/hssf/record/ArrayRecord.java index 919822858..abc183971 100644 --- a/src/java/org/apache/poi/hssf/record/ArrayRecord.java +++ b/src/java/org/apache/poi/hssf/record/ArrayRecord.java @@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Josh Micich */ -public final class ArrayRecord extends SharedValueRecordBase { +public final class ArrayRecord extends SharedValueRecordBase implements Cloneable { public final static short sid = 0x0221; private static final int OPT_ALWAYS_RECALCULATE = 0x0001; @@ -96,7 +96,8 @@ public final class ArrayRecord extends SharedValueRecordBase { return sb.toString(); } - public Object clone() { + @Override + public ArrayRecord clone() { ArrayRecord rec = new ArrayRecord(_formula.copy(), getRange()); // they both seem unused, but clone them nevertheless to have an exact copy diff --git a/src/java/org/apache/poi/hssf/record/AutoFilterInfoRecord.java b/src/java/org/apache/poi/hssf/record/AutoFilterInfoRecord.java index 881cf3b01..e514dc21b 100644 --- a/src/java/org/apache/poi/hssf/record/AutoFilterInfoRecord.java +++ b/src/java/org/apache/poi/hssf/record/AutoFilterInfoRecord.java @@ -28,9 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Yegor Kozlov */ -public final class AutoFilterInfoRecord - extends StandardRecord -{ +public final class AutoFilterInfoRecord extends StandardRecord implements Cloneable { public final static short sid = 0x9D; /** * Number of AutoFilter drop-down arrows on the sheet @@ -93,9 +91,9 @@ public final class AutoFilterInfoRecord } @Override - public Object clone() + public AutoFilterInfoRecord clone() { - return cloneViaReserialise(); + return (AutoFilterInfoRecord)cloneViaReserialise(); } } \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/BOFRecord.java b/src/java/org/apache/poi/hssf/record/BOFRecord.java index f6a36bf7f..aca680cf5 100644 --- a/src/java/org/apache/poi/hssf/record/BOFRecord.java +++ b/src/java/org/apache/poi/hssf/record/BOFRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver * @author Jason Height (jheight at chariot dot net dot au) */ -public final class BOFRecord extends StandardRecord { +public final class BOFRecord extends StandardRecord implements Cloneable { /** * for BIFF8 files the BOF is 0x809. For earlier versions see * {@link #biff2_sid} {@link #biff3_sid} {@link #biff4_sid} @@ -268,7 +268,8 @@ public final class BOFRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public BOFRecord clone() { BOFRecord rec = new BOFRecord(); rec.field_1_version = field_1_version; rec.field_2_type = field_2_type; diff --git a/src/java/org/apache/poi/hssf/record/BlankRecord.java b/src/java/org/apache/poi/hssf/record/BlankRecord.java index 8c8a28d97..d465ad3b4 100644 --- a/src/java/org/apache/poi/hssf/record/BlankRecord.java +++ b/src/java/org/apache/poi/hssf/record/BlankRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Jason Height (jheight at chariot dot net dot au) * @version 2.0-pre */ -public final class BlankRecord extends StandardRecord implements CellValueRecordInterface { +public final class BlankRecord extends StandardRecord implements CellValueRecordInterface, Cloneable { public final static short sid = 0x0201; private int field_1_row; private short field_2_col; @@ -137,7 +137,8 @@ public final class BlankRecord extends StandardRecord implements CellValueRecord return 6; } - public Object clone() { + @Override + public BlankRecord clone() { BlankRecord rec = new BlankRecord(); rec.field_1_row = field_1_row; rec.field_2_col = field_2_col; diff --git a/src/java/org/apache/poi/hssf/record/BoolErrRecord.java b/src/java/org/apache/poi/hssf/record/BoolErrRecord.java index 580dc782e..c3bc804dd 100644 --- a/src/java/org/apache/poi/hssf/record/BoolErrRecord.java +++ b/src/java/org/apache/poi/hssf/record/BoolErrRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Michael P. Harhen * @author Jason Height (jheight at chariot dot net dot au) */ -public final class BoolErrRecord extends CellRecord { +public final class BoolErrRecord extends CellRecord implements Cloneable { public final static short sid = 0x0205; private int _value; /** @@ -169,7 +169,8 @@ public final class BoolErrRecord extends CellRecord { return sid; } - public Object clone() { + @Override + public BoolErrRecord clone() { BoolErrRecord rec = new BoolErrRecord(); copyBaseFields(rec); rec._value = _value; diff --git a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java index 406c45a46..a21f1ede0 100644 --- a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.*; * * @author Shawn Laubach (slaubach at apache dot org) */ -public final class BottomMarginRecord extends StandardRecord implements Margin { +public final class BottomMarginRecord extends StandardRecord implements Margin, Cloneable { public final static short sid = 0x29; private double field_1_margin; @@ -80,8 +80,8 @@ public final class BottomMarginRecord extends StandardRecord implements Margin { this.field_1_margin = field_1_margin; } - public Object clone() - { + @Override + public BottomMarginRecord clone() { BottomMarginRecord rec = new BottomMarginRecord(); rec.field_1_margin = this.field_1_margin; return rec; diff --git a/src/java/org/apache/poi/hssf/record/CFHeader12Record.java b/src/java/org/apache/poi/hssf/record/CFHeader12Record.java index 89c4421de..241faf139 100644 --- a/src/java/org/apache/poi/hssf/record/CFHeader12Record.java +++ b/src/java/org/apache/poi/hssf/record/CFHeader12Record.java @@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput; * Conditional Formatting Header v12 record CFHEADER12 (0x0879), * for conditional formattings introduced in Excel 2007 and newer. */ -public final class CFHeader12Record extends CFHeaderBase implements FutureRecord { +public final class CFHeader12Record extends CFHeaderBase implements FutureRecord, Cloneable { public static final short sid = 0x0879; private FtrHeader futureHeader; @@ -79,7 +79,8 @@ public final class CFHeader12Record extends CFHeaderBase implements FutureRecord return futureHeader.getAssociatedRange(); } - public Object clone() { + @Override + public CFHeader12Record clone() { CFHeader12Record result = new CFHeader12Record(); result.futureHeader = (FtrHeader)futureHeader.clone(); super.copyTo(result); diff --git a/src/java/org/apache/poi/hssf/record/CFHeaderBase.java b/src/java/org/apache/poi/hssf/record/CFHeaderBase.java index 4e40a3461..0b8182d55 100644 --- a/src/java/org/apache/poi/hssf/record/CFHeaderBase.java +++ b/src/java/org/apache/poi/hssf/record/CFHeaderBase.java @@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput; * Parent of Conditional Formatting Header records, * {@link CFHeaderRecord} and {@link CFHeader12Record}. */ -public abstract class CFHeaderBase extends StandardRecord { +public abstract class CFHeaderBase extends StandardRecord implements Cloneable { private int field_1_numcf; private int field_2_need_recalculation_and_id; private CellRangeAddress field_3_enclosing_cell_range; @@ -150,4 +150,7 @@ public abstract class CFHeaderBase extends StandardRecord { result.field_3_enclosing_cell_range = field_3_enclosing_cell_range.copy(); result.field_4_cell_ranges = field_4_cell_ranges.copy(); } + + @Override + public abstract CFHeaderBase clone(); } diff --git a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java index a456224a7..c3c6851fe 100644 --- a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java +++ b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java @@ -24,7 +24,7 @@ import org.apache.poi.ss.util.CellRangeAddress; * Used to describe a {@link CFRuleRecord}. * @see CFHeader12Record */ -public final class CFHeaderRecord extends CFHeaderBase { +public final class CFHeaderRecord extends CFHeaderBase implements Cloneable { public static final short sid = 0x01B0; /** Creates new CFHeaderRecord */ @@ -47,7 +47,8 @@ public final class CFHeaderRecord extends CFHeaderBase { return sid; } - public Object clone() { + @Override + public CFHeaderRecord clone() { CFHeaderRecord result = new CFHeaderRecord(); super.copyTo(result); return result; diff --git a/src/java/org/apache/poi/hssf/record/CFRule12Record.java b/src/java/org/apache/poi/hssf/record/CFRule12Record.java index 0f29305c5..2aa5bd1a9 100644 --- a/src/java/org/apache/poi/hssf/record/CFRule12Record.java +++ b/src/java/org/apache/poi/hssf/record/CFRule12Record.java @@ -49,7 +49,7 @@ import org.apache.poi.util.POILogger; * {@link #CONDITION_TYPE_CELL_VALUE_IS} or {@link #CONDITION_TYPE_FORMULA}, * this is only used for the other types */ -public final class CFRule12Record extends CFRuleBase implements FutureRecord { +public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cloneable { public static final short sid = 0x087A; private FtrHeader futureHeader; @@ -409,7 +409,8 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord { return buffer.toString(); } - public Object clone() { + @Override + public CFRule12Record clone() { CFRule12Record rec = new CFRule12Record(getConditionType(), getComparisonOperation()); rec.futureHeader.setAssociatedRange(futureHeader.getAssociatedRange().copy()); diff --git a/src/java/org/apache/poi/hssf/record/CFRuleBase.java b/src/java/org/apache/poi/hssf/record/CFRuleBase.java index 7dfcc376f..a7bfb825c 100644 --- a/src/java/org/apache/poi/hssf/record/CFRuleBase.java +++ b/src/java/org/apache/poi/hssf/record/CFRuleBase.java @@ -39,7 +39,7 @@ import org.apache.poi.util.POILogger; * new-style (Excel 2007+) also make use of {@link CFRule12Record} * and {@link CFExRuleRecord} for their rules. */ -public abstract class CFRuleBase extends StandardRecord { +public abstract class CFRuleBase extends StandardRecord implements Cloneable { public static final class ComparisonOperator { public static final byte NO_COMPARISON = 0; public static final byte BETWEEN = 1; @@ -452,4 +452,7 @@ public abstract class CFRuleBase extends StandardRecord { rec.setFormula1(getFormula1().copy()); rec.setFormula2(getFormula2().copy()); } + + @Override + public abstract CFRuleBase clone(); } diff --git a/src/java/org/apache/poi/hssf/record/CFRuleRecord.java b/src/java/org/apache/poi/hssf/record/CFRuleRecord.java index 52678c0fd..697030b97 100644 --- a/src/java/org/apache/poi/hssf/record/CFRuleRecord.java +++ b/src/java/org/apache/poi/hssf/record/CFRuleRecord.java @@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput; * new-style (Excel 2007+) also make use of {@link CFRule12Record} * and {@link CFExRuleRecord} for their rules. */ -public final class CFRuleRecord extends CFRuleBase { +public final class CFRuleRecord extends CFRuleBase implements Cloneable { public static final short sid = 0x01B1; /** Creates new CFRuleRecord */ @@ -139,7 +139,8 @@ public final class CFRuleRecord extends CFRuleBase { return buffer.toString(); } - public Object clone() { + @Override + public CFRuleRecord clone() { CFRuleRecord rec = new CFRuleRecord(getConditionType(), getComparisonOperation()); super.copyTo(rec); return rec; diff --git a/src/java/org/apache/poi/hssf/record/CalcCountRecord.java b/src/java/org/apache/poi/hssf/record/CalcCountRecord.java index f8b4534bc..f416def2f 100644 --- a/src/java/org/apache/poi/hssf/record/CalcCountRecord.java +++ b/src/java/org/apache/poi/hssf/record/CalcCountRecord.java @@ -33,9 +33,7 @@ import org.apache.poi.util.LittleEndianOutput; * @see org.apache.poi.hssf.record.CalcModeRecord */ -public final class CalcCountRecord - extends StandardRecord -{ +public final class CalcCountRecord extends StandardRecord implements Cloneable { public final static short sid = 0xC; private short field_1_iterations; @@ -92,7 +90,8 @@ public final class CalcCountRecord return sid; } - public Object clone() { + @Override + public CalcCountRecord clone() { CalcCountRecord rec = new CalcCountRecord(); rec.field_1_iterations = field_1_iterations; return rec; diff --git a/src/java/org/apache/poi/hssf/record/CalcModeRecord.java b/src/java/org/apache/poi/hssf/record/CalcModeRecord.java index 538856d57..9f74ecf71 100644 --- a/src/java/org/apache/poi/hssf/record/CalcModeRecord.java +++ b/src/java/org/apache/poi/hssf/record/CalcModeRecord.java @@ -33,9 +33,7 @@ import org.apache.poi.util.LittleEndianOutput; * @see org.apache.poi.hssf.record.CalcCountRecord */ -public final class CalcModeRecord - extends StandardRecord -{ +public final class CalcModeRecord extends StandardRecord implements Cloneable { public final static short sid = 0xD; /** @@ -120,7 +118,8 @@ public final class CalcModeRecord return sid; } - public Object clone() { + @Override + public CalcModeRecord clone() { CalcModeRecord rec = new CalcModeRecord(); rec.field_1_calcmode = field_1_calcmode; return rec; diff --git a/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java b/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java index 4982ef92b..bf27b37a2 100644 --- a/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java +++ b/src/java/org/apache/poi/hssf/record/ColumnInfoRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.BitFieldFactory; * REFERENCE: PG 293 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

* @author Andrew C. Oliver (acoliver at apache dot org) */ -public final class ColumnInfoRecord extends StandardRecord { +public final class ColumnInfoRecord extends StandardRecord implements Cloneable { public static final short sid = 0x007D; private int _firstCol; @@ -244,7 +244,8 @@ public final class ColumnInfoRecord extends StandardRecord { return sb.toString(); } - public Object clone() { + @Override + public ColumnInfoRecord clone() { ColumnInfoRecord rec = new ColumnInfoRecord(); rec._firstCol = _firstCol; rec._lastCol = _lastCol; diff --git a/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java b/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java index 3cd2f282c..30509f3a3 100644 --- a/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class CommonObjectDataSubRecord extends SubRecord { +public final class CommonObjectDataSubRecord extends SubRecord implements Cloneable { public final static short sid = 0x0015; private static final BitField locked = BitFieldFactory.getInstance(0x0001); @@ -153,7 +153,8 @@ public final class CommonObjectDataSubRecord extends SubRecord { return sid; } - public Object clone() { + @Override + public CommonObjectDataSubRecord clone() { CommonObjectDataSubRecord rec = new CommonObjectDataSubRecord(); rec.field_1_objectType = field_1_objectType; diff --git a/src/java/org/apache/poi/hssf/record/ContinueRecord.java b/src/java/org/apache/poi/hssf/record/ContinueRecord.java index d43df86c6..17a0c5165 100644 --- a/src/java/org/apache/poi/hssf/record/ContinueRecord.java +++ b/src/java/org/apache/poi/hssf/record/ContinueRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Csaba Nagy (ncsaba at yahoo dot com) */ -public final class ContinueRecord extends StandardRecord { +public final class ContinueRecord extends StandardRecord implements Cloneable { public final static short sid = 0x003C; private byte[] _data; @@ -69,7 +69,8 @@ public final class ContinueRecord extends StandardRecord { _data = in.readRemainder(); } - public Object clone() { + @Override + public ContinueRecord clone() { return new ContinueRecord(_data); } } diff --git a/src/java/org/apache/poi/hssf/record/DBCellRecord.java b/src/java/org/apache/poi/hssf/record/DBCellRecord.java index b9b9d44c8..e91c30a0e 100644 --- a/src/java/org/apache/poi/hssf/record/DBCellRecord.java +++ b/src/java/org/apache/poi/hssf/record/DBCellRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height */ -public final class DBCellRecord extends StandardRecord { +public final class DBCellRecord extends StandardRecord implements Cloneable { public final static short sid = 0x00D7; public final static int BLOCK_SIZE = 32; @@ -116,7 +116,8 @@ public final class DBCellRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public DBCellRecord clone() { // safe because immutable return this; } diff --git a/src/java/org/apache/poi/hssf/record/DVALRecord.java b/src/java/org/apache/poi/hssf/record/DVALRecord.java index a9559fa6a..be8baa651 100644 --- a/src/java/org/apache/poi/hssf/record/DVALRecord.java +++ b/src/java/org/apache/poi/hssf/record/DVALRecord.java @@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndianOutput; * This record is the list header of all data validation records (0x01BE) in the current sheet. * @author Dragos Buleandra (dragos.buleandra@trade2b.ro) */ -public final class DVALRecord extends StandardRecord { +public final class DVALRecord extends StandardRecord implements Cloneable { public final static short sid = 0x01B2; /** Options of the DVAL */ @@ -159,7 +159,8 @@ public final class DVALRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public DVALRecord clone() { DVALRecord rec = new DVALRecord(); rec.field_1_options = field_1_options; rec.field_2_horiz_pos = field_2_horiz_pos; diff --git a/src/java/org/apache/poi/hssf/record/DVRecord.java b/src/java/org/apache/poi/hssf/record/DVRecord.java index 980e4eeb7..8f6408d1f 100644 --- a/src/java/org/apache/poi/hssf/record/DVRecord.java +++ b/src/java/org/apache/poi/hssf/record/DVRecord.java @@ -36,7 +36,7 @@ import org.apache.poi.util.StringUtil; * @author Dragos Buleandra (dragos.buleandra@trade2b.ro) * @author Josh Micich */ -public final class DVRecord extends StandardRecord { +public final class DVRecord extends StandardRecord implements Cloneable { public final static short sid = 0x01BE; /** the unicode string used for error/prompt title/text when not present */ @@ -345,7 +345,8 @@ public final class DVRecord extends StandardRecord { * Clones the object. Uses serialisation, as the * contents are somewhat complex */ - public Object clone() { - return cloneViaReserialise(); + @Override + public DVRecord clone() { + return (DVRecord)cloneViaReserialise(); } } diff --git a/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java b/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java index 6e3160ff6..c2f37b8c4 100644 --- a/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java +++ b/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Jason Height (jheight at chariot dot net dot au) * @version 2.0-pre */ -public final class DefaultColWidthRecord extends StandardRecord { +public final class DefaultColWidthRecord extends StandardRecord implements Cloneable { public final static short sid = 0x0055; private int field_1_col_width; @@ -91,7 +91,8 @@ public final class DefaultColWidthRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public DefaultColWidthRecord clone() { DefaultColWidthRecord rec = new DefaultColWidthRecord(); rec.field_1_col_width = field_1_col_width; return rec; diff --git a/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java b/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java index 0d015e09a..850e895c9 100644 --- a/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java +++ b/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java @@ -31,9 +31,7 @@ import org.apache.poi.util.LittleEndianOutput; * @version 2.0-pre */ -public final class DefaultRowHeightRecord - extends StandardRecord -{ +public final class DefaultRowHeightRecord extends StandardRecord implements Cloneable { public final static short sid = 0x225; private short field_1_option_flags; private short field_2_row_height; @@ -122,7 +120,8 @@ public final class DefaultRowHeightRecord return sid; } - public Object clone() { + @Override + public DefaultRowHeightRecord clone() { DefaultRowHeightRecord rec = new DefaultRowHeightRecord(); rec.field_1_option_flags = field_1_option_flags; rec.field_2_row_height = field_2_row_height; diff --git a/src/java/org/apache/poi/hssf/record/DeltaRecord.java b/src/java/org/apache/poi/hssf/record/DeltaRecord.java index c6d4577cf..03058c14a 100644 --- a/src/java/org/apache/poi/hssf/record/DeltaRecord.java +++ b/src/java/org/apache/poi/hssf/record/DeltaRecord.java @@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height (jheight at chariot dot net dot au) */ -public final class DeltaRecord extends StandardRecord { +public final class DeltaRecord extends StandardRecord implements Cloneable { public final static short sid = 0x0010; public final static double DEFAULT_VALUE = 0.0010; // should be .001 @@ -71,7 +71,8 @@ public final class DeltaRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public DeltaRecord clone() { // immutable return this; } diff --git a/src/java/org/apache/poi/hssf/record/DimensionsRecord.java b/src/java/org/apache/poi/hssf/record/DimensionsRecord.java index fb4f51d17..e326b5cb6 100644 --- a/src/java/org/apache/poi/hssf/record/DimensionsRecord.java +++ b/src/java/org/apache/poi/hssf/record/DimensionsRecord.java @@ -31,9 +31,7 @@ import org.apache.poi.util.LittleEndianOutput; * @version 2.0-pre */ -public final class DimensionsRecord - extends StandardRecord -{ +public final class DimensionsRecord extends StandardRecord implements Cloneable { public final static short sid = 0x200; private int field_1_first_row; private int field_2_last_row; // plus 1 @@ -170,7 +168,8 @@ public final class DimensionsRecord return sid; } - public Object clone() { + @Override + public DimensionsRecord clone() { DimensionsRecord rec = new DimensionsRecord(); rec.field_1_first_row = field_1_first_row; rec.field_2_last_row = field_2_last_row; diff --git a/src/java/org/apache/poi/hssf/record/DrawingRecord.java b/src/java/org/apache/poi/hssf/record/DrawingRecord.java index fac9e715b..3a64e23a3 100644 --- a/src/java/org/apache/poi/hssf/record/DrawingRecord.java +++ b/src/java/org/apache/poi/hssf/record/DrawingRecord.java @@ -21,7 +21,7 @@ import org.apache.poi.util.LittleEndianOutput; /** * DrawingRecord (0x00EC)

*/ -public final class DrawingRecord extends StandardRecord { +public final class DrawingRecord extends StandardRecord implements Cloneable { public static final short sid = 0x00EC; private static final byte[] EMPTY_BYTE_ARRAY = {}; @@ -75,7 +75,8 @@ public final class DrawingRecord extends StandardRecord { * Cloning of drawing records must be executed through HSSFPatriarch, because all id's must be changed * @return cloned drawing records */ - public Object clone() { + @Override + public DrawingRecord clone() { DrawingRecord rec = new DrawingRecord(); rec.recordData = recordData.clone(); if (contd != null) { diff --git a/src/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java b/src/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java index 4c57395dc..1a1f028ab 100644 --- a/src/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java +++ b/src/java/org/apache/poi/hssf/record/DrawingSelectionRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Josh Micich */ -public final class DrawingSelectionRecord extends StandardRecord { +public final class DrawingSelectionRecord extends StandardRecord implements Cloneable { public static final short sid = 0x00ED; /** @@ -110,7 +110,8 @@ public final class DrawingSelectionRecord extends StandardRecord { } } - public Object clone() { + @Override + public DrawingSelectionRecord clone() { // currently immutable return this; } diff --git a/src/java/org/apache/poi/hssf/record/EOFRecord.java b/src/java/org/apache/poi/hssf/record/EOFRecord.java index 627f74387..02d734a99 100644 --- a/src/java/org/apache/poi/hssf/record/EOFRecord.java +++ b/src/java/org/apache/poi/hssf/record/EOFRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Jason Height (jheight at chariot dot net dot au) * @version 2.0-pre */ -public final class EOFRecord extends StandardRecord { +public final class EOFRecord extends StandardRecord implements Cloneable { public final static short sid = 0x0A; public static final int ENCODED_SIZE = 4; @@ -67,7 +67,8 @@ public final class EOFRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public EOFRecord clone() { return instance; } } diff --git a/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java b/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java index 88fb10005..14eee1c43 100644 --- a/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java @@ -40,7 +40,7 @@ import org.apache.poi.util.StringUtil; * * @author Daniel Noll */ -public final class EmbeddedObjectRefSubRecord extends SubRecord { +public final class EmbeddedObjectRefSubRecord extends SubRecord implements Cloneable { private static POILogger logger = POILogFactory.getLogger(EmbeddedObjectRefSubRecord.class); public static final short sid = 0x0009; @@ -305,7 +305,8 @@ public final class EmbeddedObjectRefSubRecord extends SubRecord { return field_6_unknown; } - public Object clone() { + @Override + public EmbeddedObjectRefSubRecord clone() { return this; // TODO proper clone } diff --git a/src/java/org/apache/poi/hssf/record/EndSubRecord.java b/src/java/org/apache/poi/hssf/record/EndSubRecord.java index e31692b02..482a9825e 100644 --- a/src/java/org/apache/poi/hssf/record/EndSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/EndSubRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class EndSubRecord extends SubRecord { +public final class EndSubRecord extends SubRecord implements Cloneable { public final static short sid = 0x0000; // Note - zero sid is somewhat unusual (compared to plain Records) private static final int ENCODED_SIZE = 0; @@ -75,7 +75,8 @@ public final class EndSubRecord extends SubRecord { return sid; } - public Object clone() { + @Override + public EndSubRecord clone() { EndSubRecord rec = new EndSubRecord(); return rec; diff --git a/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java b/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java index 5382bef34..d12bc8b12 100644 --- a/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java +++ b/src/java/org/apache/poi/hssf/record/FeatHdrRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * The collection of data (Globals Substream ABNF, macro sheet substream * ABNF or worksheet substream ABNF) specifies Shared Feature data. */ -public final class FeatHdrRecord extends StandardRecord { +public final class FeatHdrRecord extends StandardRecord implements Cloneable { /** * Specifies the enhanced protection type. Used to protect a * shared workbook by restricting access to some areas of it @@ -106,9 +106,10 @@ public final class FeatHdrRecord extends StandardRecord { return 12 + 2+1+4+rgbHdrData.length; } - //HACK: do a "cheat" clone, see Record.java for more information - public Object clone() { - return cloneViaReserialise(); + @Override + public FeatHdrRecord clone() { + //HACK: do a "cheat" clone, see Record.java for more information + return (FeatHdrRecord)cloneViaReserialise(); } diff --git a/src/java/org/apache/poi/hssf/record/FeatRecord.java b/src/java/org/apache/poi/hssf/record/FeatRecord.java index fd583a3d7..404fc24c5 100644 --- a/src/java/org/apache/poi/hssf/record/FeatRecord.java +++ b/src/java/org/apache/poi/hssf/record/FeatRecord.java @@ -33,7 +33,7 @@ import org.apache.poi.util.POILogger; * This record specifies Shared Features data. It is normally paired * up with a {@link FeatHdrRecord}. */ -public final class FeatRecord extends StandardRecord { +public final class FeatRecord extends StandardRecord implements Cloneable { private static POILogger logger = POILogFactory.getLogger(FeatRecord.class); public final static short sid = 0x0868; // SIDs from newer versions @@ -175,9 +175,10 @@ public final class FeatRecord extends StandardRecord { } - //HACK: do a "cheat" clone, see Record.java for more information - public Object clone() { - return cloneViaReserialise(); + @Override + public FeatRecord clone() { + //HACK: do a "cheat" clone, see Record.java for more information + return (FeatRecord)cloneViaReserialise(); } diff --git a/src/java/org/apache/poi/hssf/record/FilePassRecord.java b/src/java/org/apache/poi/hssf/record/FilePassRecord.java index 59d144f8c..4793f1305 100644 --- a/src/java/org/apache/poi/hssf/record/FilePassRecord.java +++ b/src/java/org/apache/poi/hssf/record/FilePassRecord.java @@ -28,17 +28,20 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Jason Height (jheight at chariot dot net dot au) */ -public final class FilePassRecord extends StandardRecord { - public final static short sid = 0x002F; +public final class FilePassRecord extends StandardRecord implements Cloneable { + public static final short sid = 0x002F; + private static final int ENCRYPTION_XOR = 0; + private static final int ENCRYPTION_OTHER = 1; private int _encryptionType; private KeyData _keyData; - private static interface KeyData { + private static interface KeyData extends Cloneable { void read(RecordInputStream in); void serialize(LittleEndianOutput out); int getDataSize(); void appendToString(StringBuffer buffer); + KeyData clone(); } public static class Rc4KeyData implements KeyData { @@ -119,6 +122,17 @@ public final class FilePassRecord extends StandardRecord { buffer.append(" .rc4.verifier = ").append(HexDump.toHex(_encryptedVerifier)).append("\n"); buffer.append(" .rc4.verifierHash = ").append(HexDump.toHex(_encryptedVerifierHash)).append("\n"); } + + @Override + public Rc4KeyData clone() { + Rc4KeyData other = new Rc4KeyData(); + other._salt = this._salt.clone(); + other._encryptedVerifier = this._encryptedVerifier.clone(); + other._encryptedVerifierHash = this._encryptedVerifierHash.clone(); + other._encryptionInfo = this._encryptionInfo; + other._minorVersionNo = this._minorVersionNo; + return other; + } } public static class XorKeyData implements KeyData { @@ -170,12 +184,22 @@ public final class FilePassRecord extends StandardRecord { buffer.append(" .xor.key = ").append(HexDump.intToHex(_key)).append("\n"); buffer.append(" .xor.verifier = ").append(HexDump.intToHex(_verifier)).append("\n"); } + + @Override + public XorKeyData clone() { + XorKeyData other = new XorKeyData(); + other._key = this._key; + other._verifier = this._verifier; + return other; + } } - private static final int ENCRYPTION_XOR = 0; - private static final int ENCRYPTION_OTHER = 1; - + private FilePassRecord(FilePassRecord other) { + _encryptionType = other._encryptionType; + _keyData = other._keyData.clone(); + } + public FilePassRecord(RecordInputStream in) { _encryptionType = in.readUShort(); @@ -282,9 +306,9 @@ public final class FilePassRecord extends StandardRecord { return sid; } - public Object clone() { - // currently immutable - return this; + @Override + public FilePassRecord clone() { + return new FilePassRecord(this); } public String toString() { diff --git a/src/java/org/apache/poi/hssf/record/FileSharingRecord.java b/src/java/org/apache/poi/hssf/record/FileSharingRecord.java index a82b4b65b..1834e0c83 100644 --- a/src/java/org/apache/poi/hssf/record/FileSharingRecord.java +++ b/src/java/org/apache/poi/hssf/record/FileSharingRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.StringUtil; * REFERENCE: PG 314 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

* @author Andrew C. Oliver (acoliver at apache dot org) */ -public final class FileSharingRecord extends StandardRecord { +public final class FileSharingRecord extends StandardRecord implements Cloneable { public final static short sid = 0x005B; private short field_1_readonly; @@ -137,10 +137,8 @@ public final class FileSharingRecord extends StandardRecord { return sid; } - /** - * Clone this record. - */ - public Object clone() { + @Override + public FileSharingRecord clone() { FileSharingRecord clone = new FileSharingRecord(); clone.setReadOnly(field_1_readonly); clone.setPassword(field_2_password); diff --git a/src/java/org/apache/poi/hssf/record/FooterRecord.java b/src/java/org/apache/poi/hssf/record/FooterRecord.java index 823372fc6..5031f54cb 100644 --- a/src/java/org/apache/poi/hssf/record/FooterRecord.java +++ b/src/java/org/apache/poi/hssf/record/FooterRecord.java @@ -26,7 +26,7 @@ package org.apache.poi.hssf.record; * @author Jason Height (jheight at chariot dot net dot au) * */ -public final class FooterRecord extends HeaderFooterBase { +public final class FooterRecord extends HeaderFooterBase implements Cloneable { public final static short sid = 0x0015; public FooterRecord(String text) { @@ -50,7 +50,8 @@ public final class FooterRecord extends HeaderFooterBase { return sid; } - public Object clone() { + @Override + public FooterRecord clone() { return new FooterRecord(getText()); } } diff --git a/src/java/org/apache/poi/hssf/record/FormatRecord.java b/src/java/org/apache/poi/hssf/record/FormatRecord.java index f587d57c9..1508bb6fc 100644 --- a/src/java/org/apache/poi/hssf/record/FormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/FormatRecord.java @@ -29,13 +29,19 @@ import org.apache.poi.util.StringUtil; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Shawn M. Laubach (slaubach at apache dot org) */ -public final class FormatRecord extends StandardRecord { +public final class FormatRecord extends StandardRecord implements Cloneable { public final static short sid = 0x041E; private final int field_1_index_code; private final boolean field_3_hasMultibyte; private final String field_4_formatstring; + private FormatRecord(FormatRecord other) { + field_1_index_code = other.field_1_index_code; + field_3_hasMultibyte = other.field_3_hasMultibyte; + field_4_formatstring = other.field_4_formatstring; + } + public FormatRecord(int indexCode, String fs) { field_1_index_code = indexCode; field_4_formatstring = fs; @@ -104,9 +110,9 @@ public final class FormatRecord extends StandardRecord { public short getSid() { return sid; } + @Override - public Object clone() { - // immutable - return this; + public FormatRecord clone() { + return new FormatRecord(this); } } diff --git a/src/java/org/apache/poi/hssf/record/FormulaRecord.java b/src/java/org/apache/poi/hssf/record/FormulaRecord.java index f6c2740cc..91605873e 100644 --- a/src/java/org/apache/poi/hssf/record/FormulaRecord.java +++ b/src/java/org/apache/poi/hssf/record/FormulaRecord.java @@ -33,7 +33,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height (jheight at chariot dot net dot au) */ -public final class FormulaRecord extends CellRecord { +public final class FormulaRecord extends CellRecord implements Cloneable { public static final short sid = 0x0006; // docs say 406...because of a bug Microsoft support site article #Q184647) private static int FIXED_SIZE = 14; // double + short + int @@ -375,7 +375,7 @@ public final class FormulaRecord extends CellRecord { } @Override - public Object clone() { + public FormulaRecord clone() { FormulaRecord rec = new FormulaRecord(); copyBaseFields(rec); rec.field_4_value = field_4_value; diff --git a/src/java/org/apache/poi/hssf/record/FtCblsSubRecord.java b/src/java/org/apache/poi/hssf/record/FtCblsSubRecord.java index 517add94b..14c0ddd15 100644 --- a/src/java/org/apache/poi/hssf/record/FtCblsSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/FtCblsSubRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Yegor Kozlov */ -public final class FtCblsSubRecord extends SubRecord { +public final class FtCblsSubRecord extends SubRecord implements Cloneable { public final static short sid = 0x0C; private static final int ENCODED_SIZE = 20; @@ -90,7 +90,8 @@ public final class FtCblsSubRecord extends SubRecord { return sid; } - public Object clone() { + @Override + public FtCblsSubRecord clone() { FtCblsSubRecord rec = new FtCblsSubRecord(); byte[] recdata = new byte[reserved.length]; System.arraycopy(reserved, 0, recdata, 0, recdata.length); diff --git a/src/java/org/apache/poi/hssf/record/FtCfSubRecord.java b/src/java/org/apache/poi/hssf/record/FtCfSubRecord.java index 1c85e9550..08a661283 100644 --- a/src/java/org/apache/poi/hssf/record/FtCfSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/FtCfSubRecord.java @@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndianOutput; /** * The FtCf structure specifies the clipboard format of the picture-type Obj record containing this FtCf. */ -public final class FtCfSubRecord extends SubRecord { +public final class FtCfSubRecord extends SubRecord implements Cloneable { public final static short sid = 0x07; public final static short length = 0x02; @@ -97,7 +97,8 @@ public final class FtCfSubRecord extends SubRecord { return sid; } - public Object clone() { + @Override + public FtCfSubRecord clone() { FtCfSubRecord rec = new FtCfSubRecord(); rec.flags = this.flags; return rec; diff --git a/src/java/org/apache/poi/hssf/record/FtPioGrbitSubRecord.java b/src/java/org/apache/poi/hssf/record/FtPioGrbitSubRecord.java index 068d17a24..bd5db8ebe 100644 --- a/src/java/org/apache/poi/hssf/record/FtPioGrbitSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/FtPioGrbitSubRecord.java @@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndianOutput; /** * This structure appears as part of an Obj record that represents image display properties. */ -public final class FtPioGrbitSubRecord extends SubRecord { +public final class FtPioGrbitSubRecord extends SubRecord implements Cloneable { public final static short sid = 0x08; public final static short length = 0x02; @@ -151,7 +151,8 @@ public final class FtPioGrbitSubRecord extends SubRecord { return sid; } - public Object clone() { + @Override + public FtPioGrbitSubRecord clone() { FtPioGrbitSubRecord rec = new FtPioGrbitSubRecord(); rec.flags = this.flags; return rec; diff --git a/src/java/org/apache/poi/hssf/record/GridsetRecord.java b/src/java/org/apache/poi/hssf/record/GridsetRecord.java index ae2a71ccd..14f04ab2a 100644 --- a/src/java/org/apache/poi/hssf/record/GridsetRecord.java +++ b/src/java/org/apache/poi/hssf/record/GridsetRecord.java @@ -34,9 +34,7 @@ import org.apache.poi.util.LittleEndianOutput; * @version 2.0-pre */ -public final class GridsetRecord - extends StandardRecord -{ +public final class GridsetRecord extends StandardRecord implements Cloneable { public final static short sid = 0x82; public short field_1_gridset_flag; @@ -102,7 +100,8 @@ public final class GridsetRecord return sid; } - public Object clone() { + @Override + public GridsetRecord clone() { GridsetRecord rec = new GridsetRecord(); rec.field_1_gridset_flag = field_1_gridset_flag; return rec; diff --git a/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java b/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java index 07bc89b3c..b59f9d1d8 100644 --- a/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/GroupMarkerSubRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Glen Stampoultzis (glens at apache.org) */ -public final class GroupMarkerSubRecord extends SubRecord { +public final class GroupMarkerSubRecord extends SubRecord implements Cloneable { public final static short sid = 0x0006; private static final byte[] EMPTY_BYTE_ARRAY = { }; @@ -70,7 +70,8 @@ public final class GroupMarkerSubRecord extends SubRecord { return sid; } - public Object clone() { + @Override + public GroupMarkerSubRecord clone() { GroupMarkerSubRecord rec = new GroupMarkerSubRecord(); rec.reserved = new byte[reserved.length]; for ( int i = 0; i < reserved.length; i++ ) diff --git a/src/java/org/apache/poi/hssf/record/GutsRecord.java b/src/java/org/apache/poi/hssf/record/GutsRecord.java index 2a41902da..97cc0f7c7 100644 --- a/src/java/org/apache/poi/hssf/record/GutsRecord.java +++ b/src/java/org/apache/poi/hssf/record/GutsRecord.java @@ -30,9 +30,7 @@ import org.apache.poi.util.LittleEndianOutput; * @version 2.0-pre */ -public final class GutsRecord - extends StandardRecord -{ +public final class GutsRecord extends StandardRecord implements Cloneable { public final static short sid = 0x80; private short field_1_left_row_gutter; // size of the row gutter to the left of the rows private short field_2_top_col_gutter; // size of the column gutter above the columns @@ -172,7 +170,8 @@ public final class GutsRecord return sid; } - public Object clone() { + @Override + public GutsRecord clone() { GutsRecord rec = new GutsRecord(); rec.field_1_left_row_gutter = field_1_left_row_gutter; rec.field_2_top_col_gutter = field_2_top_col_gutter; diff --git a/src/java/org/apache/poi/hssf/record/HCenterRecord.java b/src/java/org/apache/poi/hssf/record/HCenterRecord.java index 1c1a4201f..604ddeae2 100644 --- a/src/java/org/apache/poi/hssf/record/HCenterRecord.java +++ b/src/java/org/apache/poi/hssf/record/HCenterRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Jason Height (jheight at chariot dot net dot au) * @version 2.0-pre */ -public final class HCenterRecord extends StandardRecord { +public final class HCenterRecord extends StandardRecord implements Cloneable { public final static short sid = 0x0083; private short field_1_hcenter; @@ -91,7 +91,8 @@ public final class HCenterRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public HCenterRecord clone() { HCenterRecord rec = new HCenterRecord(); rec.field_1_hcenter = field_1_hcenter; return rec; diff --git a/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java b/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java index c61725c5f..af4a38598 100644 --- a/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java +++ b/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java @@ -28,7 +28,7 @@ import java.util.Locale; * * @author Yegor Kozlov */ -public final class HeaderFooterRecord extends StandardRecord { +public final class HeaderFooterRecord extends StandardRecord implements Cloneable { private static final byte[] BLANK_GUID = new byte[16]; @@ -95,9 +95,10 @@ public final class HeaderFooterRecord extends StandardRecord { return sb.toString(); } - //HACK: do a "cheat" clone, see Record.java for more information - public Object clone() { - return cloneViaReserialise(); + @Override + public HeaderFooterRecord clone() { + //HACK: do a "cheat" clone, see Record.java for more information + return (HeaderFooterRecord)cloneViaReserialise(); } diff --git a/src/java/org/apache/poi/hssf/record/HeaderRecord.java b/src/java/org/apache/poi/hssf/record/HeaderRecord.java index 23adedc5a..ec6733c23 100644 --- a/src/java/org/apache/poi/hssf/record/HeaderRecord.java +++ b/src/java/org/apache/poi/hssf/record/HeaderRecord.java @@ -25,7 +25,7 @@ package org.apache.poi.hssf.record; * @author Shawn Laubach (slaubach at apache dot org) Modified 3/14/02 * @author Jason Height (jheight at chariot dot net dot au) */ -public final class HeaderRecord extends HeaderFooterBase { +public final class HeaderRecord extends HeaderFooterBase implements Cloneable { public final static short sid = 0x0014; public HeaderRecord(String text) { @@ -49,7 +49,8 @@ public final class HeaderRecord extends HeaderFooterBase { return sid; } - public Object clone() { + @Override + public HeaderRecord clone() { return new HeaderRecord(getText()); } } diff --git a/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java b/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java index 8077efe92..7e18f4650 100644 --- a/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java +++ b/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java @@ -25,7 +25,7 @@ import java.util.Iterator; * @see PageBreakRecord * @author Danny Mui (dmui at apache dot org) */ -public final class HorizontalPageBreakRecord extends PageBreakRecord { +public final class HorizontalPageBreakRecord extends PageBreakRecord implements Cloneable { public static final short sid = 0x001B; @@ -48,7 +48,8 @@ public final class HorizontalPageBreakRecord extends PageBreakRecord { return sid; } - public Object clone() { + @Override + public PageBreakRecord clone() { PageBreakRecord result = new HorizontalPageBreakRecord(); Iterator iterator = getBreaksIterator(); while (iterator.hasNext()) { diff --git a/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java b/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java index 471c1752a..1d7eb2082 100644 --- a/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java +++ b/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java @@ -36,7 +36,7 @@ import org.apache.poi.util.StringUtil; * from the Excel-97 format. * Supports only external links for now (eg http://) */ -public final class HyperlinkRecord extends StandardRecord { +public final class HyperlinkRecord extends StandardRecord implements Cloneable { public final static short sid = 0x01B8; private static POILogger logger = POILogFactory.getLogger(HyperlinkRecord.class); @@ -743,7 +743,8 @@ public final class HyperlinkRecord extends StandardRecord { setTextMark(""); } - public Object clone() { + @Override + public HyperlinkRecord clone() { HyperlinkRecord rec = new HyperlinkRecord(); rec._range = _range.copy(); rec._guid = _guid; diff --git a/src/java/org/apache/poi/hssf/record/IndexRecord.java b/src/java/org/apache/poi/hssf/record/IndexRecord.java index 63727bb94..6e9558db2 100644 --- a/src/java/org/apache/poi/hssf/record/IndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/IndexRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height (jheight at chariot dot net dot au) */ -public class IndexRecord extends StandardRecord { +public class IndexRecord extends StandardRecord implements Cloneable { public final static short sid = 0x020B; private int field_2_first_row; // first row on the sheet private int field_3_last_row_add1; // last row @@ -149,7 +149,8 @@ public class IndexRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public IndexRecord clone() { IndexRecord rec = new IndexRecord(); rec.field_2_first_row = field_2_first_row; rec.field_3_last_row_add1 = field_3_last_row_add1; diff --git a/src/java/org/apache/poi/hssf/record/IterationRecord.java b/src/java/org/apache/poi/hssf/record/IterationRecord.java index 03e77c89e..4d7f4546d 100644 --- a/src/java/org/apache/poi/hssf/record/IterationRecord.java +++ b/src/java/org/apache/poi/hssf/record/IterationRecord.java @@ -32,7 +32,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height (jheight at chariot dot net dot au) */ -public final class IterationRecord extends StandardRecord { +public final class IterationRecord extends StandardRecord implements Cloneable { public final static short sid = 0x0011; private static final BitField iterationOn = BitFieldFactory.getInstance(0x0001); @@ -86,7 +86,8 @@ public final class IterationRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public IterationRecord clone() { return new IterationRecord(getIteration()); } } diff --git a/src/java/org/apache/poi/hssf/record/LabelRecord.java b/src/java/org/apache/poi/hssf/record/LabelRecord.java index c7a585672..68c42f8f2 100644 --- a/src/java/org/apache/poi/hssf/record/LabelRecord.java +++ b/src/java/org/apache/poi/hssf/record/LabelRecord.java @@ -28,7 +28,7 @@ import org.apache.poi.util.POILogger; * * @see org.apache.poi.hssf.record.LabelSSTRecord */ -public final class LabelRecord extends Record implements CellValueRecordInterface { +public final class LabelRecord extends Record implements CellValueRecordInterface, Cloneable { private final static POILogger logger = POILogFactory.getLogger(LabelRecord.class); public final static short sid = 0x0204; @@ -170,7 +170,8 @@ public final class LabelRecord extends Record implements CellValueRecordInterfac { } - public Object clone() { + @Override + public LabelRecord clone() { LabelRecord rec = new LabelRecord(); rec.field_1_row = field_1_row; rec.field_2_column = field_2_column; diff --git a/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java b/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java index e1b4bd20c..ff7277d5a 100644 --- a/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java +++ b/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java @@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput; * value.

* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

*/ -public final class LabelSSTRecord extends CellRecord { +public final class LabelSSTRecord extends CellRecord implements Cloneable { public final static short sid = 0xfd; private int field_4_sst_index; @@ -84,7 +84,8 @@ public final class LabelSSTRecord extends CellRecord { return sid; } - public Object clone() { + @Override + public LabelSSTRecord clone() { LabelSSTRecord rec = new LabelSSTRecord(); copyBaseFields(rec); rec.field_4_sst_index = field_4_sst_index; diff --git a/src/java/org/apache/poi/hssf/record/LbsDataSubRecord.java b/src/java/org/apache/poi/hssf/record/LbsDataSubRecord.java index 93a0430eb..91b9fb752 100644 --- a/src/java/org/apache/poi/hssf/record/LbsDataSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/LbsDataSubRecord.java @@ -258,7 +258,8 @@ public class LbsDataSubRecord extends SubRecord { } @Override - public Object clone() { + public LbsDataSubRecord clone() { + // TODO: is immutable ??? return this; } diff --git a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java index e9eea8d58..5b570487d 100644 --- a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java @@ -24,8 +24,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Shawn Laubach (slaubach at apache dot org) */ -public final class LeftMarginRecord extends StandardRecord implements Margin -{ +public final class LeftMarginRecord extends StandardRecord implements Margin, Cloneable { public final static short sid = 0x0026; private double field_1_margin; @@ -72,10 +71,10 @@ public final class LeftMarginRecord extends StandardRecord implements Margin this.field_1_margin = field_1_margin; } - public Object clone() - { + @Override + public LeftMarginRecord clone() { LeftMarginRecord rec = new LeftMarginRecord(); rec.field_1_margin = this.field_1_margin; return rec; } -} // END OF \ No newline at end of file +} \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java b/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java index c8a1379dc..9fbc676a1 100644 --- a/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java +++ b/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * Description: Optional record defining a square area of cells to "merged" into one cell.
* @author Andrew C. Oliver (acoliver at apache dot org) */ -public final class MergeCellsRecord extends StandardRecord { +public final class MergeCellsRecord extends StandardRecord implements Cloneable { public final static short sid = 0x00E5; /** sometimes the regions array is shared with other MergedCellsRecords */ private CellRangeAddress[] _regions; @@ -102,7 +102,8 @@ public final class MergeCellsRecord extends StandardRecord { return retval.toString(); } - public Object clone() { + @Override + public MergeCellsRecord clone() { int nRegions = _numberOfRegions; CellRangeAddress[] clonedRegions = new CellRangeAddress[nRegions]; for (int i = 0; i < clonedRegions.length; i++) { diff --git a/src/java/org/apache/poi/hssf/record/MulBlankRecord.java b/src/java/org/apache/poi/hssf/record/MulBlankRecord.java index 695c55c87..f48ba5030 100644 --- a/src/java/org/apache/poi/hssf/record/MulBlankRecord.java +++ b/src/java/org/apache/poi/hssf/record/MulBlankRecord.java @@ -135,7 +135,7 @@ public final class MulBlankRecord extends StandardRecord { } @Override - public Object clone() { + public MulBlankRecord clone() { // immutable - so OK to return this return this; } diff --git a/src/java/org/apache/poi/hssf/record/NoteRecord.java b/src/java/org/apache/poi/hssf/record/NoteRecord.java index 86c239c6e..261a523c0 100644 --- a/src/java/org/apache/poi/hssf/record/NoteRecord.java +++ b/src/java/org/apache/poi/hssf/record/NoteRecord.java @@ -25,7 +25,7 @@ import org.apache.poi.util.StringUtil; * * @author Yegor Kozlov */ -public final class NoteRecord extends StandardRecord { +public final class NoteRecord extends StandardRecord implements Cloneable { public final static short sid = 0x001C; public static final NoteRecord[] EMPTY_ARRAY = { }; @@ -235,7 +235,8 @@ public final class NoteRecord extends StandardRecord { field_5_hasMultibyte = StringUtil.hasMultibyte(author); } - public Object clone() { + @Override + public NoteRecord clone() { NoteRecord rec = new NoteRecord(); rec.field_1_row = field_1_row; rec.field_2_col = field_2_col; diff --git a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java index fff3f39f3..50e79173a 100644 --- a/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java +++ b/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java @@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Yegor Kozlov */ -public final class NoteStructureSubRecord extends SubRecord { +public final class NoteStructureSubRecord extends SubRecord implements Cloneable { public final static short sid = 0x0D; private static final int ENCODED_SIZE = 22; @@ -98,7 +98,8 @@ public final class NoteStructureSubRecord extends SubRecord { return sid; } - public Object clone() { + @Override + public NoteStructureSubRecord clone() { NoteStructureSubRecord rec = new NoteStructureSubRecord(); byte[] recdata = new byte[reserved.length]; System.arraycopy(reserved, 0, recdata, 0, recdata.length); diff --git a/src/java/org/apache/poi/hssf/record/NumberRecord.java b/src/java/org/apache/poi/hssf/record/NumberRecord.java index a156863aa..ebc6d9e3f 100644 --- a/src/java/org/apache/poi/hssf/record/NumberRecord.java +++ b/src/java/org/apache/poi/hssf/record/NumberRecord.java @@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) * @author Jason Height (jheight at chariot dot net dot au) */ -public final class NumberRecord extends CellRecord { +public final class NumberRecord extends CellRecord implements Cloneable { public static final short sid = 0x0203; private double field_4_value; @@ -87,7 +87,7 @@ public final class NumberRecord extends CellRecord { } @Override - public Object clone() { + public NumberRecord clone() { NumberRecord rec = new NumberRecord(); copyBaseFields(rec); rec.field_4_value = field_4_value; diff --git a/src/java/org/apache/poi/hssf/record/ObjRecord.java b/src/java/org/apache/poi/hssf/record/ObjRecord.java index fcc9d9f72..cce80f6be 100644 --- a/src/java/org/apache/poi/hssf/record/ObjRecord.java +++ b/src/java/org/apache/poi/hssf/record/ObjRecord.java @@ -33,7 +33,7 @@ import org.apache.poi.util.LittleEndianInputStream; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class ObjRecord extends Record { +public final class ObjRecord extends Record implements Cloneable { public final static short sid = 0x005D; private static final int NORMAL_PAD_ALIGNMENT = 2; @@ -222,7 +222,7 @@ public final class ObjRecord extends Record { } @Override - public Object clone() { + public ObjRecord clone() { ObjRecord rec = new ObjRecord(); for (int i = 0; i < subrecords.size(); i++) { diff --git a/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java b/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java index 0192d8165..06aab4485 100644 --- a/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java +++ b/src/java/org/apache/poi/hssf/record/ObjectProtectRecord.java @@ -31,9 +31,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver at apache dot org) */ -public final class ObjectProtectRecord - extends StandardRecord -{ +public final class ObjectProtectRecord extends StandardRecord implements Cloneable { public final static short sid = 0x63; private short field_1_protect; @@ -97,7 +95,8 @@ public final class ObjectProtectRecord return sid; } - public Object clone() { + @Override + public ObjectProtectRecord clone() { ObjectProtectRecord rec = new ObjectProtectRecord(); rec.field_1_protect = field_1_protect; return rec; diff --git a/src/java/org/apache/poi/hssf/record/Record.java b/src/java/org/apache/poi/hssf/record/Record.java index e1d54a01c..372cc94a7 100644 --- a/src/java/org/apache/poi/hssf/record/Record.java +++ b/src/java/org/apache/poi/hssf/record/Record.java @@ -61,16 +61,8 @@ public abstract class Record extends RecordBase { public abstract short getSid(); @Override - public Object clone() { -// if (false) { -// // TODO - implement clone in a more standardised way -// try { -// return super.clone(); -// } catch (CloneNotSupportedException e) { -// throw new RuntimeException(e); -// } -// } - throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method"); + public Object clone() throws CloneNotSupportedException { + throw new CloneNotSupportedException("The class "+getClass().getName()+" needs to define a clone method"); } /** diff --git a/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java b/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java index a66c0005e..7c02b8bb1 100644 --- a/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java +++ b/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java @@ -28,7 +28,7 @@ import org.apache.poi.hssf.record.ColumnInfoRecord; /** * @author Glen Stampoultzis */ -public final class ColumnInfoRecordsAggregate extends RecordAggregate { +public final class ColumnInfoRecordsAggregate extends RecordAggregate implements Cloneable { /** * List of {@link ColumnInfoRecord}s assumed to be in order */ @@ -75,14 +75,11 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate { } } - /** - * Performs a deep clone of the record - */ - public Object clone() { + @Override + public ColumnInfoRecordsAggregate clone() { ColumnInfoRecordsAggregate rec = new ColumnInfoRecordsAggregate(); - for (int k = 0; k < records.size(); k++) { - ColumnInfoRecord ci = records.get(k); - rec.records.add((ColumnInfoRecord) ci.clone()); + for (ColumnInfoRecord ci : records) { + rec.records.add(ci.clone()); } return rec; } @@ -295,7 +292,7 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate { } private static ColumnInfoRecord copyColInfo(ColumnInfoRecord ci) { - return (ColumnInfoRecord) ci.clone(); + return ci.clone(); } diff --git a/src/java/org/apache/poi/hssf/record/cf/BorderFormatting.java b/src/java/org/apache/poi/hssf/record/cf/BorderFormatting.java index ef003d536..41f465357 100644 --- a/src/java/org/apache/poi/hssf/record/cf/BorderFormatting.java +++ b/src/java/org/apache/poi/hssf/record/cf/BorderFormatting.java @@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput; /** * Border Formatting Block of the Conditional Formatting Rule Record. */ -public final class BorderFormatting { +public final class BorderFormatting implements Cloneable { /** No border */ public final static short BORDER_NONE = 0x0; /** Thin border */ @@ -446,7 +446,8 @@ public final class BorderFormatting { return buffer.toString(); } - public Object clone() { + @Override + public BorderFormatting clone() { BorderFormatting rec = new BorderFormatting(); rec.field_13_border_styles1 = field_13_border_styles1; rec.field_14_border_styles2 = field_14_border_styles2; diff --git a/src/java/org/apache/poi/hssf/record/cf/ColorGradientThreshold.java b/src/java/org/apache/poi/hssf/record/cf/ColorGradientThreshold.java index 32eba56e4..e7bea75a5 100644 --- a/src/java/org/apache/poi/hssf/record/cf/ColorGradientThreshold.java +++ b/src/java/org/apache/poi/hssf/record/cf/ColorGradientThreshold.java @@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianOutput; * Color Gradient / Color Scale specific Threshold / value (CFVO), * for changes in Conditional Formatting */ -public final class ColorGradientThreshold extends Threshold { +public final class ColorGradientThreshold extends Threshold implements Cloneable { private double position; public ColorGradientThreshold() { @@ -49,7 +49,8 @@ public final class ColorGradientThreshold extends Threshold { return super.getDataLength() + 8; } - public Object clone() { + @Override + public ColorGradientThreshold clone() { ColorGradientThreshold rec = new ColorGradientThreshold(); super.copyTo(rec); rec.position = position; diff --git a/src/java/org/apache/poi/hssf/record/cf/DataBarThreshold.java b/src/java/org/apache/poi/hssf/record/cf/DataBarThreshold.java index 9164aadde..63c7f6b36 100644 --- a/src/java/org/apache/poi/hssf/record/cf/DataBarThreshold.java +++ b/src/java/org/apache/poi/hssf/record/cf/DataBarThreshold.java @@ -23,7 +23,7 @@ import org.apache.poi.util.LittleEndianInput; * Data Bar specific Threshold / value (CFVO), * for changes in Conditional Formatting */ -public final class DataBarThreshold extends Threshold { +public final class DataBarThreshold extends Threshold implements Cloneable { public DataBarThreshold() { super(); } @@ -33,7 +33,8 @@ public final class DataBarThreshold extends Threshold { super(in); } - public Object clone() { + @Override + public DataBarThreshold clone() { DataBarThreshold rec = new DataBarThreshold(); super.copyTo(rec); return rec; diff --git a/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java b/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java index 79bdabeda..08f8bf114 100644 --- a/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java +++ b/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndian; /** * Font Formatting Block of the Conditional Formatting Rule Record. */ -public final class FontFormatting { +public final class FontFormatting implements Cloneable { private byte[] _rawData; private static final int OFFSET_FONT_NAME = 0; @@ -541,7 +541,8 @@ public final class FontFormatting { return buffer.toString(); } - public Object clone() + @Override + public FontFormatting clone() { byte[] rawData = _rawData.clone(); return new FontFormatting(rawData); diff --git a/src/java/org/apache/poi/hssf/record/cf/IconMultiStateThreshold.java b/src/java/org/apache/poi/hssf/record/cf/IconMultiStateThreshold.java index 72f6ea370..03d95caf3 100644 --- a/src/java/org/apache/poi/hssf/record/cf/IconMultiStateThreshold.java +++ b/src/java/org/apache/poi/hssf/record/cf/IconMultiStateThreshold.java @@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianOutput; * Icon / Multi-State specific Threshold / value (CFVO), * for changes in Conditional Formatting */ -public final class IconMultiStateThreshold extends Threshold { +public final class IconMultiStateThreshold extends Threshold implements Cloneable { /** * Cell values that are equal to the threshold value do not pass the threshold */ @@ -60,7 +60,8 @@ public final class IconMultiStateThreshold extends Threshold { return super.getDataLength() + 5; } - public Object clone() { + @Override + public IconMultiStateThreshold clone() { IconMultiStateThreshold rec = new IconMultiStateThreshold(); super.copyTo(rec); rec.equals = equals; diff --git a/src/java/org/apache/poi/hssf/record/chart/AreaFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/AreaFormatRecord.java index 661d2dc27..229743ebd 100644 --- a/src/java/org/apache/poi/hssf/record/chart/AreaFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/AreaFormatRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class AreaFormatRecord extends StandardRecord { +public final class AreaFormatRecord extends StandardRecord implements Cloneable { public final static short sid = 0x100A; private static final BitField automatic = BitFieldFactory.getInstance(0x1); @@ -113,7 +113,8 @@ public final class AreaFormatRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public AreaFormatRecord clone() { AreaFormatRecord rec = new AreaFormatRecord(); rec.field_1_foregroundColor = field_1_foregroundColor; diff --git a/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java b/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java index 7d763fa8e..0bc901d0c 100644 --- a/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class AreaRecord extends StandardRecord { +public final class AreaRecord extends StandardRecord implements Cloneable { public final static short sid = 0x101A; private short field_1_formatFlags; private static final BitField stacked = BitFieldFactory.getInstance(0x1); @@ -78,7 +78,8 @@ public final class AreaRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public AreaRecord clone() { AreaRecord rec = new AreaRecord(); rec.field_1_formatFlags = field_1_formatFlags; diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java index 737b474e6..92b0b6af2 100644 --- a/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class AxisLineFormatRecord extends StandardRecord { +public final class AxisLineFormatRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1021; private short field_1_axisType; public final static short AXIS_TYPE_AXIS_LINE = 0; @@ -73,7 +73,8 @@ public final class AxisLineFormatRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public AxisLineFormatRecord clone() { AxisLineFormatRecord rec = new AxisLineFormatRecord(); rec.field_1_axisType = field_1_axisType; diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java index 0b4f9dd4b..e6c4768c8 100644 --- a/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Andrew C. Oliver(acoliver at apache.org) */ -public final class AxisOptionsRecord extends StandardRecord { +public final class AxisOptionsRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1062; private static final BitField defaultMinimum = BitFieldFactory.getInstance(0x01); @@ -145,7 +145,8 @@ public final class AxisOptionsRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public AxisOptionsRecord clone() { AxisOptionsRecord rec = new AxisOptionsRecord(); rec.field_1_minimumCategory = field_1_minimumCategory; diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java index e0d6d5b58..8cf8fdb09 100644 --- a/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class AxisParentRecord extends StandardRecord { +public final class AxisParentRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1041; private short field_1_axisType; public final static short AXIS_TYPE_MAIN = 0; @@ -99,7 +99,8 @@ public final class AxisParentRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public AxisParentRecord clone() { AxisParentRecord rec = new AxisParentRecord(); rec.field_1_axisType = field_1_axisType; diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java index 4eb92dc51..42aefb4a8 100644 --- a/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class AxisRecord extends StandardRecord { +public final class AxisRecord extends StandardRecord implements Cloneable { public final static short sid = 0x101d; private short field_1_axisType; public final static short AXIS_TYPE_CATEGORY_OR_X_AXIS = 0; @@ -100,7 +100,8 @@ public final class AxisRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public AxisRecord clone() { AxisRecord rec = new AxisRecord(); rec.field_1_axisType = field_1_axisType; diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java index b05cf1b9b..baca15b57 100644 --- a/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class AxisUsedRecord extends StandardRecord { +public final class AxisUsedRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1046; private short field_1_numAxis; @@ -69,7 +69,8 @@ public final class AxisUsedRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public AxisUsedRecord clone() { AxisUsedRecord rec = new AxisUsedRecord(); rec.field_1_numAxis = field_1_numAxis; diff --git a/src/java/org/apache/poi/hssf/record/chart/BarRecord.java b/src/java/org/apache/poi/hssf/record/chart/BarRecord.java index 297a27f12..72d418cb7 100644 --- a/src/java/org/apache/poi/hssf/record/chart/BarRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/BarRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class BarRecord extends StandardRecord { +public final class BarRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1017; private static final BitField horizontal = BitFieldFactory.getInstance(0x1); @@ -95,7 +95,8 @@ public final class BarRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public BarRecord clone() { BarRecord rec = new BarRecord(); rec.field_1_barSpace = field_1_barSpace; diff --git a/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java b/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java index 2a7baf149..88a7efcf2 100644 --- a/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class BeginRecord extends StandardRecord { +public final class BeginRecord extends StandardRecord implements Cloneable { public static final short sid = 0x1033; public BeginRecord() @@ -64,7 +64,8 @@ public final class BeginRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public BeginRecord clone() { BeginRecord br = new BeginRecord(); // No data so nothing to copy return br; diff --git a/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java b/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java index 0278d5f3d..6e8216a13 100644 --- a/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class CategorySeriesAxisRecord extends StandardRecord { +public final class CategorySeriesAxisRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1020; private static final BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1); @@ -100,7 +100,8 @@ public final class CategorySeriesAxisRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public CategorySeriesAxisRecord clone() { CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord(); rec.field_1_crossingPoint = field_1_crossingPoint; diff --git a/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java b/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java index dcb722b82..4354b01c5 100644 --- a/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/ChartEndBlockRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Patrick Cheng */ -public final class ChartEndBlockRecord extends StandardRecord { +public final class ChartEndBlockRecord extends StandardRecord implements Cloneable { public static final short sid = 0x0853; private short rt; diff --git a/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java b/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java index 4299e887d..3909a0c41 100644 --- a/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java @@ -40,7 +40,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class ChartRecord extends StandardRecord { +public final class ChartRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1002; private int field_1_x; private int field_2_y; @@ -87,7 +87,8 @@ public final class ChartRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public ChartRecord clone() { ChartRecord rec = new ChartRecord(); rec.field_1_x = field_1_x; diff --git a/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java b/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java index 1bb41ddc7..b35a9ee25 100644 --- a/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/ChartStartBlockRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Patrick Cheng */ -public final class ChartStartBlockRecord extends StandardRecord { +public final class ChartStartBlockRecord extends StandardRecord implements Cloneable { public static final short sid = 0x0852; private short rt; diff --git a/src/java/org/apache/poi/hssf/record/chart/DatRecord.java b/src/java/org/apache/poi/hssf/record/chart/DatRecord.java index 485fea15d..68a0ed60c 100644 --- a/src/java/org/apache/poi/hssf/record/chart/DatRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/DatRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class DatRecord extends StandardRecord { +public final class DatRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1063; private static final BitField horizontalBorder = BitFieldFactory.getInstance(0x1); @@ -81,9 +81,9 @@ public final class DatRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public DatRecord clone() { DatRecord rec = new DatRecord(); - rec.field_1_options = field_1_options; return rec; } diff --git a/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java index bb9d6ad00..b2328943b 100644 --- a/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class DataFormatRecord extends StandardRecord { +public final class DataFormatRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1006; private static final BitField useExcel4Colors = BitFieldFactory.getInstance(0x1); @@ -96,7 +96,8 @@ public final class DataFormatRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public DataFormatRecord clone() { DataFormatRecord rec = new DataFormatRecord(); rec.field_1_pointNumber = field_1_pointNumber; diff --git a/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java index 4967bd35b..06100b77e 100644 --- a/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord { +public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1024; private short field_1_categoryDataType; public final static short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0; @@ -72,7 +72,8 @@ public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public DefaultDataLabelTextPropertiesRecord clone() { DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord(); rec.field_1_categoryDataType = field_1_categoryDataType; diff --git a/src/java/org/apache/poi/hssf/record/chart/EndRecord.java b/src/java/org/apache/poi/hssf/record/chart/EndRecord.java index 487976119..23d09d163 100644 --- a/src/java/org/apache/poi/hssf/record/chart/EndRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/EndRecord.java @@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Glen Stampoultzis (glens at apache.org) */ -public final class EndRecord extends StandardRecord { +public final class EndRecord extends StandardRecord implements Cloneable { public static final short sid = 0x1034; public EndRecord() @@ -65,7 +65,8 @@ public final class EndRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public EndRecord clone() { EndRecord er = new EndRecord(); // No data so nothing to copy return er; diff --git a/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java b/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java index 826a50537..dde683eb5 100644 --- a/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java @@ -27,8 +27,8 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class FontBasisRecord extends StandardRecord { - public final static short sid = 0x1060; +public final class FontBasisRecord extends StandardRecord implements Cloneable { + public final static short sid = 0x1060; private short field_1_xBasis; private short field_2_yBasis; private short field_3_heightBasis; @@ -97,7 +97,8 @@ public final class FontBasisRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public FontBasisRecord clone() { FontBasisRecord rec = new FontBasisRecord(); rec.field_1_xBasis = field_1_xBasis; diff --git a/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java b/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java index b0047b1f3..4faacab13 100644 --- a/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java @@ -27,8 +27,8 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class FontIndexRecord extends StandardRecord { - public final static short sid = 0x1026; +public final class FontIndexRecord extends StandardRecord implements Cloneable { + public final static short sid = 0x1026; private short field_1_fontIndex; @@ -69,7 +69,8 @@ public final class FontIndexRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public FontIndexRecord clone() { FontIndexRecord rec = new FontIndexRecord(); rec.field_1_fontIndex = field_1_fontIndex; diff --git a/src/java/org/apache/poi/hssf/record/chart/FrameRecord.java b/src/java/org/apache/poi/hssf/record/chart/FrameRecord.java index 525741422..473265d75 100644 --- a/src/java/org/apache/poi/hssf/record/chart/FrameRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/FrameRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class FrameRecord extends StandardRecord { +public final class FrameRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1032; private static final BitField autoSize = BitFieldFactory.getInstance(0x1); @@ -86,7 +86,8 @@ public final class FrameRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public FrameRecord clone() { FrameRecord rec = new FrameRecord(); rec.field_1_borderType = field_1_borderType; diff --git a/src/java/org/apache/poi/hssf/record/chart/LegendRecord.java b/src/java/org/apache/poi/hssf/record/chart/LegendRecord.java index 1fd99be97..9a94e0a73 100644 --- a/src/java/org/apache/poi/hssf/record/chart/LegendRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/LegendRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Andrew C. Oliver (acoliver at apache.org) */ -public final class LegendRecord extends StandardRecord { +public final class LegendRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1015; private static final BitField autoPosition = BitFieldFactory.getInstance(0x01); @@ -136,7 +136,8 @@ public final class LegendRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public LegendRecord clone() { LegendRecord rec = new LegendRecord(); rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft; diff --git a/src/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java index ed47dabed..0daabce1e 100644 --- a/src/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class LineFormatRecord extends StandardRecord { +public final class LineFormatRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1007; private static final BitField auto = BitFieldFactory.getInstance(0x1); @@ -121,7 +121,8 @@ public final class LineFormatRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public LineFormatRecord clone() { LineFormatRecord rec = new LineFormatRecord(); rec.field_1_lineColor = field_1_lineColor; diff --git a/src/java/org/apache/poi/hssf/record/chart/LinkedDataRecord.java b/src/java/org/apache/poi/hssf/record/chart/LinkedDataRecord.java index 7e92478de..58c758e4c 100644 --- a/src/java/org/apache/poi/hssf/record/chart/LinkedDataRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/LinkedDataRecord.java @@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class LinkedDataRecord extends StandardRecord { +public final class LinkedDataRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1051; private static final BitField customNumberFormat= BitFieldFactory.getInstance(0x1); @@ -102,7 +102,8 @@ public final class LinkedDataRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public LinkedDataRecord clone() { LinkedDataRecord rec = new LinkedDataRecord(); rec.field_1_linkType = field_1_linkType; diff --git a/src/java/org/apache/poi/hssf/record/chart/NumberFormatIndexRecord.java b/src/java/org/apache/poi/hssf/record/chart/NumberFormatIndexRecord.java index fc9f0d777..7fc944c0c 100644 --- a/src/java/org/apache/poi/hssf/record/chart/NumberFormatIndexRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/NumberFormatIndexRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Glen Stampoultzis (glens at apache.org) */ -public final class NumberFormatIndexRecord extends StandardRecord { +public final class NumberFormatIndexRecord extends StandardRecord implements Cloneable { public final static short sid = 0x104E; private short field_1_formatIndex; @@ -69,7 +69,8 @@ public final class NumberFormatIndexRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public NumberFormatIndexRecord clone() { NumberFormatIndexRecord rec = new NumberFormatIndexRecord(); rec.field_1_formatIndex = field_1_formatIndex; diff --git a/src/java/org/apache/poi/hssf/record/chart/ObjectLinkRecord.java b/src/java/org/apache/poi/hssf/record/chart/ObjectLinkRecord.java index a94921886..27ba9a068 100644 --- a/src/java/org/apache/poi/hssf/record/chart/ObjectLinkRecord.java +++ b/src/java/org/apache/poi/hssf/record/chart/ObjectLinkRecord.java @@ -27,7 +27,7 @@ import org.apache.poi.util.LittleEndianOutput; * * @author Andrew C. Oliver (acoliver at apache.org) */ -public final class ObjectLinkRecord extends StandardRecord { +public final class ObjectLinkRecord extends StandardRecord implements Cloneable { public final static short sid = 0x1027; private short field_1_anchorId; public final static short ANCHOR_ID_CHART_TITLE = 1; @@ -89,7 +89,8 @@ public final class ObjectLinkRecord extends StandardRecord { return sid; } - public Object clone() { + @Override + public ObjectLinkRecord clone() { ObjectLinkRecord rec = new ObjectLinkRecord(); rec.field_1_anchorId = field_1_anchorId; diff --git a/src/java/org/apache/poi/hssf/record/common/ExtendedColor.java b/src/java/org/apache/poi/hssf/record/common/ExtendedColor.java index b0719e19a..97136da9e 100644 --- a/src/java/org/apache/poi/hssf/record/common/ExtendedColor.java +++ b/src/java/org/apache/poi/hssf/record/common/ExtendedColor.java @@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianOutput; * Formatting, Sheet Extensions), this XSSF-style color record * can be used. */ -public final class ExtendedColor { +public final class ExtendedColor implements Cloneable { public static final int TYPE_AUTO = 0; public static final int TYPE_INDEXED = 1; public static final int TYPE_RGB = 2; @@ -147,7 +147,8 @@ public final class ExtendedColor { return buffer.toString(); } - public Object clone() { + @Override + public ExtendedColor clone() { ExtendedColor exc = new ExtendedColor(); exc.type = type; exc.tint = tint; diff --git a/src/java/org/apache/poi/hssf/record/common/FtrHeader.java b/src/java/org/apache/poi/hssf/record/common/FtrHeader.java index dba24f084..eecc541ca 100644 --- a/src/java/org/apache/poi/hssf/record/common/FtrHeader.java +++ b/src/java/org/apache/poi/hssf/record/common/FtrHeader.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; * style record, which includes extra attributes above and * beyond those of a traditional record. */ -public final class FtrHeader { +public final class FtrHeader implements Cloneable { /** This MUST match the type on the containing record */ private short recordType; /** This is a FrtFlags */ diff --git a/src/java/org/apache/poi/poifs/filesystem/BATManaged.java b/src/java/org/apache/poi/poifs/filesystem/BATManaged.java index d3fb9e18e..fcd3bde64 100644 --- a/src/java/org/apache/poi/poifs/filesystem/BATManaged.java +++ b/src/java/org/apache/poi/poifs/filesystem/BATManaged.java @@ -35,7 +35,7 @@ public interface BATManaged * @return count of BigBlock instances */ - public int countBlocks(); + int countBlocks(); /** * Set the start block for this instance @@ -44,6 +44,6 @@ public interface BATManaged * up the the filesystem */ - public void setStartBlock(final int index); + void setStartBlock(final int index); } // end public interface BATManaged diff --git a/src/java/org/apache/poi/poifs/storage/BlockList.java b/src/java/org/apache/poi/poifs/storage/BlockList.java index d7e23cfb9..dfbd69c2a 100644 --- a/src/java/org/apache/poi/poifs/storage/BlockList.java +++ b/src/java/org/apache/poi/poifs/storage/BlockList.java @@ -38,7 +38,7 @@ public interface BlockList * out of range, that's ok */ - public void zap(final int index); + void zap(final int index); /** * remove and return the specified block from the list @@ -51,8 +51,7 @@ public interface BlockList * already been removed */ - public ListManagedBlock remove(final int index) - throws IOException; + ListManagedBlock remove(final int index) throws IOException; /** * get the blocks making up a particular stream in the list. The @@ -66,7 +65,7 @@ public interface BlockList * @exception IOException if blocks are missing */ - public ListManagedBlock [] fetchBlocks(final int startBlock, final int headerPropertiesStartBlock) + ListManagedBlock [] fetchBlocks(final int startBlock, final int headerPropertiesStartBlock) throws IOException; /** @@ -77,9 +76,8 @@ public interface BlockList * @exception IOException */ - public void setBAT(final BlockAllocationTableReader bat) - throws IOException; + void setBAT(final BlockAllocationTableReader bat) throws IOException; - public int blockCount(); + int blockCount(); } // end public interface BlockList diff --git a/src/java/org/apache/poi/poifs/storage/BlockWritable.java b/src/java/org/apache/poi/poifs/storage/BlockWritable.java index b6fe0ca3c..3bf833ec1 100644 --- a/src/java/org/apache/poi/poifs/storage/BlockWritable.java +++ b/src/java/org/apache/poi/poifs/storage/BlockWritable.java @@ -41,7 +41,6 @@ public interface BlockWritable * stream */ - public void writeBlocks(final OutputStream stream) - throws IOException; + void writeBlocks(final OutputStream stream) throws IOException; } // end public interface BlockWritable diff --git a/src/java/org/apache/poi/sl/usermodel/Insets2D.java b/src/java/org/apache/poi/sl/usermodel/Insets2D.java index 89f44502b..fedfbff7e 100644 --- a/src/java/org/apache/poi/sl/usermodel/Insets2D.java +++ b/src/java/org/apache/poi/sl/usermodel/Insets2D.java @@ -21,7 +21,7 @@ package org.apache.poi.sl.usermodel; * This is a replacement for {@link java.awt.Insets} which works on doubles * instead of ints */ -public class Insets2D { +public class Insets2D implements Cloneable { /** * The inset from the top. @@ -131,13 +131,9 @@ public class Insets2D { * Create a copy of this object. * @return a copy of this Insets2D object. */ - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - // this shouldn't happen, since we are Cloneable - throw new InternalError(); - } + @Override + public Insets2D clone() { + return new Insets2D(top, left, bottom, right); } diff --git a/src/java/org/apache/poi/ss/formula/ptg/AreaI.java b/src/java/org/apache/poi/ss/formula/ptg/AreaI.java index 96ffe7005..361012662 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/AreaI.java +++ b/src/java/org/apache/poi/ss/formula/ptg/AreaI.java @@ -24,22 +24,22 @@ public interface AreaI { /** * @return the first row in the area */ - public int getFirstRow(); + int getFirstRow(); /** * @return last row in the range (x2 in x1,y1-x2,y2) */ - public int getLastRow(); + int getLastRow(); /** * @return the first column number in the area. */ - public int getFirstColumn(); + int getFirstColumn(); /** * @return lastcolumn in the area */ - public int getLastColumn(); + int getLastColumn(); class OffsetArea implements AreaI { diff --git a/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java b/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java index 165cf0542..91a6f4179 100644 --- a/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java +++ b/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java @@ -25,33 +25,33 @@ package org.apache.poi.ss.usermodel; */ public interface BorderFormatting { /** No border */ - final static short BORDER_NONE = 0x0; + short BORDER_NONE = 0x0; /** Thin border */ - final static short BORDER_THIN = 0x1; + short BORDER_THIN = 0x1; /** Medium border */ - final static short BORDER_MEDIUM = 0x2; + short BORDER_MEDIUM = 0x2; /** dash border */ - final static short BORDER_DASHED = 0x3; + short BORDER_DASHED = 0x3; /** dot border */ - final static short BORDER_HAIR = 0x4; + short BORDER_HAIR = 0x4; /** Thick border */ - final static short BORDER_THICK = 0x5; + short BORDER_THICK = 0x5; /** double-line border */ - final static short BORDER_DOUBLE = 0x6; + short BORDER_DOUBLE = 0x6; /** hair-line border */ - final static short BORDER_DOTTED = 0x7; + short BORDER_DOTTED = 0x7; /** Medium dashed border */ - final static short BORDER_MEDIUM_DASHED = 0x8; + short BORDER_MEDIUM_DASHED = 0x8; /** dash-dot border */ - final static short BORDER_DASH_DOT = 0x9; + short BORDER_DASH_DOT = 0x9; /** medium dash-dot border */ - final static short BORDER_MEDIUM_DASH_DOT = 0xA; + short BORDER_MEDIUM_DASH_DOT = 0xA; /** dash-dot-dot border */ - final static short BORDER_DASH_DOT_DOT = 0xB; + short BORDER_DASH_DOT_DOT = 0xB; /** medium dash-dot-dot border */ - final static short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; + short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; /** slanted dash-dot border */ - final static short BORDER_SLANTED_DASH_DOT = 0xD; + short BORDER_SLANTED_DASH_DOT = 0xD; short getBorderBottom(); diff --git a/src/java/org/apache/poi/ss/usermodel/Cell.java b/src/java/org/apache/poi/ss/usermodel/Cell.java index daf289f48..e3dcae0bb 100644 --- a/src/java/org/apache/poi/ss/usermodel/Cell.java +++ b/src/java/org/apache/poi/ss/usermodel/Cell.java @@ -43,42 +43,42 @@ public interface Cell { * @see #setCellType(int) * @see #getCellType() */ - public final static int CELL_TYPE_NUMERIC = 0; + int CELL_TYPE_NUMERIC = 0; /** * String Cell type (1) * @see #setCellType(int) * @see #getCellType() */ - public final static int CELL_TYPE_STRING = 1; + int CELL_TYPE_STRING = 1; /** * Formula Cell type (2) * @see #setCellType(int) * @see #getCellType() */ - public final static int CELL_TYPE_FORMULA = 2; + int CELL_TYPE_FORMULA = 2; /** * Blank Cell type (3) * @see #setCellType(int) * @see #getCellType() */ - public final static int CELL_TYPE_BLANK = 3; + int CELL_TYPE_BLANK = 3; /** * Boolean Cell type (4) * @see #setCellType(int) * @see #getCellType() */ - public final static int CELL_TYPE_BOOLEAN = 4; + int CELL_TYPE_BOOLEAN = 4; /** * Error Cell type (5) * @see #setCellType(int) * @see #getCellType() */ - public final static int CELL_TYPE_ERROR = 5; + int CELL_TYPE_ERROR = 5; /** * Returns column index of this cell diff --git a/src/java/org/apache/poi/ss/usermodel/CellStyle.java b/src/java/org/apache/poi/ss/usermodel/CellStyle.java index 0cae65362..be5a43e93 100644 --- a/src/java/org/apache/poi/ss/usermodel/CellStyle.java +++ b/src/java/org/apache/poi/ss/usermodel/CellStyle.java @@ -23,208 +23,208 @@ public interface CellStyle { * general (normal) horizontal alignment */ - public final static short ALIGN_GENERAL = 0x0; + short ALIGN_GENERAL = 0x0; /** * left-justified horizontal alignment */ - public final static short ALIGN_LEFT = 0x1; + short ALIGN_LEFT = 0x1; /** * center horizontal alignment */ - public final static short ALIGN_CENTER = 0x2; + short ALIGN_CENTER = 0x2; /** * right-justified horizontal alignment */ - public final static short ALIGN_RIGHT = 0x3; + short ALIGN_RIGHT = 0x3; /** * fill? horizontal alignment */ - public final static short ALIGN_FILL = 0x4; + short ALIGN_FILL = 0x4; /** * justified horizontal alignment */ - public final static short ALIGN_JUSTIFY = 0x5; + short ALIGN_JUSTIFY = 0x5; /** * center-selection? horizontal alignment */ - public final static short ALIGN_CENTER_SELECTION = 0x6; + short ALIGN_CENTER_SELECTION = 0x6; /** * top-aligned vertical alignment */ - public final static short VERTICAL_TOP = 0x0; + short VERTICAL_TOP = 0x0; /** * center-aligned vertical alignment */ - public final static short VERTICAL_CENTER = 0x1; + short VERTICAL_CENTER = 0x1; /** * bottom-aligned vertical alignment */ - public final static short VERTICAL_BOTTOM = 0x2; + short VERTICAL_BOTTOM = 0x2; /** * vertically justified vertical alignment */ - public final static short VERTICAL_JUSTIFY = 0x3; + short VERTICAL_JUSTIFY = 0x3; /** * No border */ - public final static short BORDER_NONE = 0x0; + short BORDER_NONE = 0x0; /** * Thin border */ - public final static short BORDER_THIN = 0x1; + short BORDER_THIN = 0x1; /** * Medium border */ - public final static short BORDER_MEDIUM = 0x2; + short BORDER_MEDIUM = 0x2; /** * dash border */ - public final static short BORDER_DASHED = 0x3; + short BORDER_DASHED = 0x3; /** * dot border */ - public final static short BORDER_HAIR = 0x7; + short BORDER_HAIR = 0x7; /** * Thick border */ - public final static short BORDER_THICK = 0x5; + short BORDER_THICK = 0x5; /** * double-line border */ - public final static short BORDER_DOUBLE = 0x6; + short BORDER_DOUBLE = 0x6; /** * hair-line border */ - public final static short BORDER_DOTTED = 0x4; + short BORDER_DOTTED = 0x4; /** * Medium dashed border */ - public final static short BORDER_MEDIUM_DASHED = 0x8; + short BORDER_MEDIUM_DASHED = 0x8; /** * dash-dot border */ - public final static short BORDER_DASH_DOT = 0x9; + short BORDER_DASH_DOT = 0x9; /** * medium dash-dot border */ - public final static short BORDER_MEDIUM_DASH_DOT = 0xA; + short BORDER_MEDIUM_DASH_DOT = 0xA; /** * dash-dot-dot border */ - public final static short BORDER_DASH_DOT_DOT = 0xB; + short BORDER_DASH_DOT_DOT = 0xB; /** * medium dash-dot-dot border */ - public final static short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; + short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; /** * slanted dash-dot border */ - public final static short BORDER_SLANTED_DASH_DOT = 0xD; + short BORDER_SLANTED_DASH_DOT = 0xD; /** No background */ - public final static short NO_FILL = 0; + short NO_FILL = 0; /** Solidly filled */ - public final static short SOLID_FOREGROUND = 1; + short SOLID_FOREGROUND = 1; /** Small fine dots */ - public final static short FINE_DOTS = 2; + short FINE_DOTS = 2; /** Wide dots */ - public final static short ALT_BARS = 3; + short ALT_BARS = 3; /** Sparse dots */ - public final static short SPARSE_DOTS = 4; + short SPARSE_DOTS = 4; /** Thick horizontal bands */ - public final static short THICK_HORZ_BANDS = 5; + short THICK_HORZ_BANDS = 5; /** Thick vertical bands */ - public final static short THICK_VERT_BANDS = 6; + short THICK_VERT_BANDS = 6; /** Thick backward facing diagonals */ - public final static short THICK_BACKWARD_DIAG = 7; + short THICK_BACKWARD_DIAG = 7; /** Thick forward facing diagonals */ - public final static short THICK_FORWARD_DIAG = 8; + short THICK_FORWARD_DIAG = 8; /** Large spots */ - public final static short BIG_SPOTS = 9; + short BIG_SPOTS = 9; /** Brick-like layout */ - public final static short BRICKS = 10; + short BRICKS = 10; /** Thin horizontal bands */ - public final static short THIN_HORZ_BANDS = 11; + short THIN_HORZ_BANDS = 11; /** Thin vertical bands */ - public final static short THIN_VERT_BANDS = 12; + short THIN_VERT_BANDS = 12; /** Thin backward diagonal */ - public final static short THIN_BACKWARD_DIAG = 13; + short THIN_BACKWARD_DIAG = 13; /** Thin forward diagonal */ - public final static short THIN_FORWARD_DIAG = 14; + short THIN_FORWARD_DIAG = 14; /** Squares */ - public final static short SQUARES = 15; + short SQUARES = 15; /** Diamonds */ - public final static short DIAMONDS = 16; + short DIAMONDS = 16; /** Less Dots */ - public final static short LESS_DOTS = 17; + short LESS_DOTS = 17; /** Least Dots */ - public final static short LEAST_DOTS = 18; + short LEAST_DOTS = 18; /** * get the index within the Workbook (sequence within the collection of ExtnededFormat objects) diff --git a/src/java/org/apache/poi/wp/usermodel/CharacterRun.java b/src/java/org/apache/poi/wp/usermodel/CharacterRun.java index 34165463a..da2a3630b 100644 --- a/src/java/org/apache/poi/wp/usermodel/CharacterRun.java +++ b/src/java/org/apache/poi/wp/usermodel/CharacterRun.java @@ -21,79 +21,79 @@ package org.apache.poi.wp.usermodel; * This class represents a run of text that share common properties. */ public interface CharacterRun { - public boolean isBold(); - public void setBold(boolean bold); + boolean isBold(); + void setBold(boolean bold); - public boolean isItalic(); - public void setItalic(boolean italic); + boolean isItalic(); + void setItalic(boolean italic); - public boolean isSmallCaps(); - public void setSmallCaps(boolean smallCaps); + boolean isSmallCaps(); + void setSmallCaps(boolean smallCaps); - public boolean isCapitalized(); - public void setCapitalized(boolean caps); + boolean isCapitalized(); + void setCapitalized(boolean caps); - public boolean isStrikeThrough(); - public void setStrikeThrough(boolean strike); - public boolean isDoubleStrikeThrough(); - public void setDoubleStrikethrough(boolean dstrike); + boolean isStrikeThrough(); + void setStrikeThrough(boolean strike); + boolean isDoubleStrikeThrough(); + void setDoubleStrikethrough(boolean dstrike); - public boolean isShadowed(); - public void setShadow(boolean shadow); + boolean isShadowed(); + void setShadow(boolean shadow); - public boolean isEmbossed(); - public void setEmbossed(boolean emboss); + boolean isEmbossed(); + void setEmbossed(boolean emboss); - public boolean isImprinted(); - public void setImprinted(boolean imprint); + boolean isImprinted(); + void setImprinted(boolean imprint); - public int getFontSize(); - public void setFontSize(int halfPoints); + int getFontSize(); + void setFontSize(int halfPoints); - public int getCharacterSpacing(); - public void setCharacterSpacing(int twips); + int getCharacterSpacing(); + void setCharacterSpacing(int twips); - public int getKerning(); - public void setKerning(int kern); + int getKerning(); + void setKerning(int kern); - public String getFontName(); + String getFontName(); /** * @return The text of the run, including any tabs/spaces/etc */ - public String text(); + String text(); // HWPF uses indexes, XWPF special -// public int getUnderlineCode(); -// public void setUnderlineCode(int kul); +// int getUnderlineCode(); +// void setUnderlineCode(int kul); // HWPF uses indexes, XWPF special vertical alignments -// public short getSubSuperScriptIndex(); -// public void setSubSuperScriptIndex(short iss); +// short getSubSuperScriptIndex(); +// void setSubSuperScriptIndex(short iss); // HWPF uses indexes, XWPF special vertical alignments -// public int getVerticalOffset(); -// public void setVerticalOffset(int hpsPos); +// int getVerticalOffset(); +// void setVerticalOffset(int hpsPos); // HWPF has colour indexes, XWPF colour names -// public int getColor(); -// public void setColor(int color); +// int getColor(); +// void setColor(int color); // TODO Review these, and add to XWPFRun if possible /* - public boolean isFldVanished(); - public void setFldVanish(boolean fldVanish); + boolean isFldVanished(); + void setFldVanish(boolean fldVanish); - public boolean isOutlined(); - public void setOutline(boolean outlined); + boolean isOutlined(); + void setOutline(boolean outlined); - public boolean isVanished(); - public void setVanished(boolean vanish); + boolean isVanished(); + void setVanished(boolean vanish); - public boolean isMarkedDeleted(); - public void markDeleted(boolean mark); + boolean isMarkedDeleted(); + void markDeleted(boolean mark); - public boolean isMarkedInserted(); - public void markInserted(boolean mark); + boolean isMarkedInserted(); + void markInserted(boolean mark); */ } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java b/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java index b6e48e21d..29cd5d623 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java @@ -81,7 +81,7 @@ public interface CharIndexTranslator { * @param bytePos * @return first index greater or equal to bytePos that is in table */ - public int lookIndexForward(int bytePos); + int lookIndexForward(int bytePos); /** * Return last index <= bytePos that is in table @@ -89,6 +89,6 @@ public interface CharIndexTranslator { * @param bytePos * @return last index less of equal to bytePos that is in table */ - public int lookIndexBackward(int bytePos); + int lookIndexBackward(int bytePos); }