From d8c58eb036ca3d212d60b125fd60dd3e5f0972f3 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Mon, 5 Mar 2012 09:44:20 +0000 Subject: [PATCH] optimized unused imports and removed deprecation warnings in poi-main git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1296979 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/ddf/EscherOptRecord.java | 4 +- .../org/apache/poi/ddf/EscherPictBlip.java | 2 +- src/java/org/apache/poi/ddf/EscherRecord.java | 16 +++++--- src/java/org/apache/poi/hpsf/PropertySet.java | 4 +- src/java/org/apache/poi/hpsf/Vector.java | 1 - .../extractor/HPSFPropertiesExtractor.java | 1 - .../extractor/EventBasedExcelExtractor.java | 2 + .../poi/hssf/model/InternalWorkbook.java | 1 - .../apache/poi/hssf/record/DConRefRecord.java | 6 +-- .../poi/hssf/record/HeaderFooterRecord.java | 1 - .../poi/hssf/record/UserSViewBegin.java | 2 - .../apache/poi/hssf/record/UserSViewEnd.java | 3 -- .../record/aggregates/PageSettingsBlock.java | 1 - .../poi/hssf/record/common/UnicodeString.java | 1 - .../usermodel/HSSFConditionalFormatting.java | 5 +-- .../poi/hssf/usermodel/HSSFDataFormat.java | 1 - .../poi/hssf/usermodel/HSSFPicture.java | 2 - .../apache/poi/hssf/usermodel/HSSFSheet.java | 5 +-- .../HSSFSheetConditionalFormatting.java | 5 +-- .../poi/hssf/usermodel/HSSFWorkbook.java | 2 - .../apache/poi/hssf/util/HSSFRegionUtil.java | 8 ++-- src/java/org/apache/poi/hssf/util/Region.java | 1 + .../poi/poifs/filesystem/Ole10Native.java | 2 +- .../poi/poifs/storage/SmallDocumentBlock.java | 1 - .../apache/poi/ss/formula/LazyAreaEval.java | 3 -- .../poi/ss/formula/atp/AnalysisToolPak.java | 2 - .../apache/poi/ss/formula/atp/YearFrac.java | 2 - .../apache/poi/ss/formula/functions/Npv.java | 3 -- .../org/apache/poi/ss/usermodel/Chart.java | 1 - .../ss/usermodel/ConditionalFormatting.java | 1 - .../ss/usermodel/charts/ChartAxisFactory.java | 1 - src/java/org/apache/poi/util/ArrayUtil.java | 40 +++++++++++++++++++ .../apache/poi/ddf/TestEscherProperty.java | 5 --- .../apache/poi/hpsf/basic/TestHPSFBugs.java | 17 -------- .../apache/poi/hssf/model/TestLinkTable.java | 1 - .../apache/poi/hssf/model/TestWorkbook.java | 1 - .../hssf/record/TestAutoFilterInfoRecord.java | 10 ----- .../poi/hssf/record/TestDConRefRecord.java | 8 +--- .../poi/hssf/record/TestNameRecord.java | 1 - .../aggregates/TestValueRecordsAggregate.java | 3 ++ .../apache/poi/hssf/usermodel/TestBugs.java | 1 + .../hssf/usermodel/TestDataValidation.java | 3 -- .../TestHSSFConditionalFormatting.java | 5 --- .../hssf/usermodel/TestHSSFDataFormat.java | 1 - .../hssf/usermodel/TestHSSFDataFormatter.java | 2 - .../poi/hssf/usermodel/TestHSSFDateUtil.java | 1 - .../poi/hssf/usermodel/TestSheetHiding.java | 6 --- .../poi/hssf/usermodel/TestUnfixedBugs.java | 2 - .../poi/ss/formula/TestPlainCellCache.java | 10 ----- .../poi/ss/formula/atp/TestDateParser.java | 2 + .../apache/poi/ss/formula/atp/TestMRound.java | 1 - .../formula/atp/TestNetworkdaysFunction.java | 1 + .../ss/formula/atp/TestWorkdayCalculator.java | 1 + .../ss/formula/atp/TestWorkdayFunction.java | 3 +- .../poi/ss/formula/functions/TestAddress.java | 1 - .../ss/formula/functions/TestCountFuncs.java | 3 -- .../poi/ss/formula/functions/TestNpv.java | 2 - .../ss/formula/functions/TestSubtotal.java | 6 --- .../poi/ss/formula/functions/TestSumifs.java | 1 - .../BaseTestConditionalFormatting.java | 1 - .../poi/ss/usermodel/BaseTestWorkbook.java | 3 -- .../org/apache/poi/util/TestLittleEndian.java | 4 +- 62 files changed, 88 insertions(+), 148 deletions(-) diff --git a/src/java/org/apache/poi/ddf/EscherOptRecord.java b/src/java/org/apache/poi/ddf/EscherOptRecord.java index 33c894cab9..e83b324adf 100644 --- a/src/java/org/apache/poi/ddf/EscherOptRecord.java +++ b/src/java/org/apache/poi/ddf/EscherOptRecord.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.ddf; +import org.apache.poi.util.Internal; + /** * The opt record is used to store property values for a shape. It is the key to * determining the attributes of a shape. Properties can be of two types: simple @@ -39,7 +41,7 @@ public class EscherOptRecord extends AbstractEscherOptRecord /** * Automatically recalculate the correct option */ - @Deprecated + @Internal public short getOptions() { // update values diff --git a/src/java/org/apache/poi/ddf/EscherPictBlip.java b/src/java/org/apache/poi/ddf/EscherPictBlip.java index 978ff777e4..9b93b08b9d 100644 --- a/src/java/org/apache/poi/ddf/EscherPictBlip.java +++ b/src/java/org/apache/poi/ddf/EscherPictBlip.java @@ -95,7 +95,7 @@ public final class EscherPictBlip extends EscherBlipRecord { int pos = offset; LittleEndian.putShort( data, pos, getOptions() ); pos += 2; LittleEndian.putShort( data, pos, getRecordId() ); pos += 2; - LittleEndian.putInt( data, getRecordSize() - HEADER_SIZE ); pos += 4; + LittleEndian.putInt( data, 0, getRecordSize() - HEADER_SIZE ); pos += 4; System.arraycopy( field_1_UID, 0, data, pos, 16 ); pos += 16; LittleEndian.putInt( data, pos, field_2_cb ); pos += 4; diff --git a/src/java/org/apache/poi/ddf/EscherRecord.java b/src/java/org/apache/poi/ddf/EscherRecord.java index 1055875e9f..0eb5a31d49 100644 --- a/src/java/org/apache/poi/ddf/EscherRecord.java +++ b/src/java/org/apache/poi/ddf/EscherRecord.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; /** @@ -107,11 +108,13 @@ public abstract class EscherRecord { } /** + *

options is an internal field. Use {@link #setInstance(short)} ()} and + * {@link #setVersion(short)} ()} to set the actual fields. + *

* @return The options field for this record. All records have one. - * @deprecated Options is an internal field. Use {@link #getInstance()} and - * {@link #getVersion()} to access actual fields. */ - @Deprecated + @Internal public short getOptions() { return _options; @@ -120,10 +123,13 @@ public abstract class EscherRecord { /** * Set the options this this record. Container records should have the * last nibble set to 0xF. - * @deprecated Options is an internal field. Use {@link #getInstance()} and + * + *

options is an internal field. Use {@link #getInstance()} and * {@link #getVersion()} to access actual fields. + *

*/ - @Deprecated + @Internal public void setOptions( short options ) { // call to handle correct/incorrect values setVersion( fVersion.getShortValue( options ) ); diff --git a/src/java/org/apache/poi/hpsf/PropertySet.java b/src/java/org/apache/poi/hpsf/PropertySet.java index 7ba86555cd..a3ca1d0360 100644 --- a/src/java/org/apache/poi/hpsf/PropertySet.java +++ b/src/java/org/apache/poi/hpsf/PropertySet.java @@ -369,13 +369,13 @@ public class PropertySet final int byteOrder = LittleEndian.getUShort(src, o); o += LittleEndian.SHORT_SIZE; byte[] temp = new byte[LittleEndian.SHORT_SIZE]; - LittleEndian.putShort(temp, (short) byteOrder); + LittleEndian.putShort(temp, 0, (short) byteOrder); if (!Util.equal(temp, BYTE_ORDER_ASSERTION)) return false; final int format = LittleEndian.getUShort(src, o); o += LittleEndian.SHORT_SIZE; temp = new byte[LittleEndian.SHORT_SIZE]; - LittleEndian.putShort(temp, (short) format); + LittleEndian.putShort(temp, 0, (short) format); if (!Util.equal(temp, FORMAT_ASSERTION)) return false; // final long osVersion = LittleEndian.getUInt(src, offset); diff --git a/src/java/org/apache/poi/hpsf/Vector.java b/src/java/org/apache/poi/hpsf/Vector.java index 145a660cdb..a1ddb0812e 100644 --- a/src/java/org/apache/poi/hpsf/Vector.java +++ b/src/java/org/apache/poi/hpsf/Vector.java @@ -16,7 +16,6 @@ ==================================================================== */ package org.apache.poi.hpsf; -import org.apache.poi.util.HexDump; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; diff --git a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java index 32f9049639..2c9a062892 100644 --- a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java +++ b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java @@ -18,7 +18,6 @@ package org.apache.poi.hpsf.extractor; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; diff --git a/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java b/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java index a4ff616125..aef71dc548 100644 --- a/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java +++ b/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java @@ -87,6 +87,8 @@ public class EventBasedExcelExtractor extends POIOLE2TextExtractor { /** * Return the underlying POIFS FileSystem of * this document. + * + * @deprecated Use {@link #getRoot()} instead */ public POIFSFileSystem getFileSystem() { return _dir.getFileSystem(); diff --git a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java index c1ec938cf3..3f421d99b6 100644 --- a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java +++ b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java @@ -89,7 +89,6 @@ import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.formula.EvaluationWorkbook.ExternalName; import org.apache.poi.ss.formula.EvaluationWorkbook.ExternalSheet; import org.apache.poi.ss.usermodel.BuiltinFormats; -import org.apache.poi.ss.util.WorkbookUtil; import org.apache.poi.util.Internal; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; diff --git a/src/java/org/apache/poi/hssf/record/DConRefRecord.java b/src/java/org/apache/poi/hssf/record/DConRefRecord.java index 08ba314edb..ed35816353 100755 --- a/src/java/org/apache/poi/hssf/record/DConRefRecord.java +++ b/src/java/org/apache/poi/hssf/record/DConRefRecord.java @@ -18,7 +18,7 @@ */ package org.apache.poi.hssf.record; -import java.util.Arrays; +import org.apache.poi.util.ArrayUtil; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianOutput; @@ -273,7 +273,7 @@ public class DConRefRecord extends StandardRecord */ public byte[] getPath() { - return Arrays.copyOf(path, path.length); + return ArrayUtil.copyOf(path, path.length); } /** @@ -291,7 +291,7 @@ public class DConRefRecord extends StandardRecord { offset++; } - String out = new String(Arrays.copyOfRange(path, offset, path.length)); + String out = new String(ArrayUtil.copyOfRange(path, offset, path.length)); //UNC paths have \u0003 chars as path separators. out = out.replaceAll("\u0003", "/"); return out; diff --git a/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java b/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java index 96457b99cd..3eb602463f 100644 --- a/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java +++ b/src/java/org/apache/poi/hssf/record/HeaderFooterRecord.java @@ -17,7 +17,6 @@ package org.apache.poi.hssf.record; -import org.apache.poi.hssf.record.aggregates.PageSettingsBlock; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; diff --git a/src/java/org/apache/poi/hssf/record/UserSViewBegin.java b/src/java/org/apache/poi/hssf/record/UserSViewBegin.java index 7b632a02e5..92aaf8a131 100644 --- a/src/java/org/apache/poi/hssf/record/UserSViewBegin.java +++ b/src/java/org/apache/poi/hssf/record/UserSViewBegin.java @@ -17,11 +17,9 @@ package org.apache.poi.hssf.record; -import org.apache.poi.hssf.record.aggregates.PageSettingsBlock; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; -import java.util.Arrays; /** * The UserSViewBegin record specifies settings for a custom view associated with the sheet. diff --git a/src/java/org/apache/poi/hssf/record/UserSViewEnd.java b/src/java/org/apache/poi/hssf/record/UserSViewEnd.java index 02f72acf18..2427729e32 100644 --- a/src/java/org/apache/poi/hssf/record/UserSViewEnd.java +++ b/src/java/org/apache/poi/hssf/record/UserSViewEnd.java @@ -17,12 +17,9 @@ package org.apache.poi.hssf.record; -import org.apache.poi.hssf.record.aggregates.PageSettingsBlock; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndianOutput; -import java.util.Arrays; - /** * The UserSViewEnd record marks the end of the settings for a custom view associated with the sheet * diff --git a/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java b/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java index 17cb84d55d..676a8f9831 100644 --- a/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java +++ b/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java @@ -18,7 +18,6 @@ package org.apache.poi.hssf.record.aggregates; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Arrays; diff --git a/src/java/org/apache/poi/hssf/record/common/UnicodeString.java b/src/java/org/apache/poi/hssf/record/common/UnicodeString.java index bd9ecbac7b..3ee5e4e66c 100644 --- a/src/java/org/apache/poi/hssf/record/common/UnicodeString.java +++ b/src/java/org/apache/poi/hssf/record/common/UnicodeString.java @@ -25,7 +25,6 @@ import java.util.List; import org.apache.poi.hssf.record.cont.ContinuableRecordInput; import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.hssf.record.cont.ContinuableRecordOutput; -import org.apache.poi.poifs.dev.POIFSLister; import org.apache.poi.util.*; /** diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java b/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java index 80fb4ef99f..46403fc369 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormatting.java @@ -21,7 +21,6 @@ import org.apache.poi.hssf.record.aggregates.CFRecordsAggregate; import org.apache.poi.ss.usermodel.ConditionalFormatting; import org.apache.poi.ss.usermodel.ConditionalFormattingRule; import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.ss.util.Region; /** * HSSFConditionalFormatting class encapsulates all settings of Conditional Formatting. @@ -99,10 +98,10 @@ public final class HSSFConditionalFormatting implements ConditionalFormatting /** * @deprecated (Aug-2008) use {@link HSSFConditionalFormatting#getFormattingRanges()} */ - public Region[] getFormattingRegions() + public org.apache.poi.ss.util.Region[] getFormattingRegions() { CellRangeAddress[] cellRanges = getFormattingRanges(); - return Region.convertCellRangesToRegions(cellRanges); + return org.apache.poi.ss.util.Region.convertCellRangesToRegions(cellRanges); } /** * @return array of CellRangeAddresss. never null diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java b/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java index e2a87a4639..26800d6d3e 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java @@ -26,7 +26,6 @@ package org.apache.poi.hssf.usermodel; import java.util.Arrays; import java.util.Iterator; import java.util.List; -import java.util.ListIterator; import java.util.Vector; import org.apache.poi.hssf.model.InternalWorkbook; diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java index e89579fdbd..d4a7205c73 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java @@ -24,8 +24,6 @@ import org.apache.poi.ddf.EscherBSERecord; import org.apache.poi.ddf.EscherBlipRecord; import org.apache.poi.ss.usermodel.Picture; import org.apache.poi.ss.util.ImageUtils; -import org.apache.poi.util.POILogFactory; -import org.apache.poi.util.POILogger; import org.apache.poi.hssf.model.InternalWorkbook; /** diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index 48e87b85a8..fe332eb83e 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -35,7 +35,6 @@ import org.apache.poi.ss.formula.FormulaShifter; import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.ss.formula.ptg.Area3DPtg; import org.apache.poi.hssf.util.PaneInformation; -import org.apache.poi.hssf.util.Region; import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.formula.FormulaType; import org.apache.poi.ss.usermodel.Cell; @@ -765,10 +764,10 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet { /** * @deprecated (Aug-2008) use {@link HSSFSheet#getMergedRegion(int)} */ - public Region getMergedRegionAt(int index) { + public org.apache.poi.hssf.util.Region getMergedRegionAt(int index) { CellRangeAddress cra = getMergedRegion(index); - return new Region(cra.getFirstRow(), (short)cra.getFirstColumn(), + return new org.apache.poi.hssf.util.Region(cra.getFirstRow(), (short)cra.getFirstColumn(), cra.getLastRow(), (short)cra.getLastColumn()); } /** diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java index b75f0a620f..0101eef7b3 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.java @@ -23,7 +23,6 @@ import org.apache.poi.hssf.record.aggregates.ConditionalFormattingTable; import org.apache.poi.ss.usermodel.ConditionalFormatting; import org.apache.poi.ss.usermodel.ConditionalFormattingRule; import org.apache.poi.ss.usermodel.SheetConditionalFormatting; -import org.apache.poi.ss.util.Region; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.SpreadsheetVersion; @@ -122,8 +121,8 @@ public final class HSSFSheetConditionalFormatting implements SheetConditionalFor /** * @deprecated use CellRangeAddress instead of Region */ - public int addConditionalFormatting(Region[] regions, HSSFConditionalFormattingRule[] cfRules) { - return addConditionalFormatting(Region.convertRegionsToCellRanges(regions), cfRules); + public int addConditionalFormatting(org.apache.poi.ss.util.Region[] regions, HSSFConditionalFormattingRule[] cfRules) { + return addConditionalFormatting(org.apache.poi.ss.util.Region.convertRegionsToCellRanges(regions), cfRules); } /** * Allows to add a new Conditional Formatting set to the sheet. diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index e52fecc279..afd0bce10f 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -51,9 +51,7 @@ import org.apache.poi.ss.formula.FormulaType; import org.apache.poi.ss.formula.SheetNameFormatter; import org.apache.poi.ss.formula.ptg.Area3DPtg; import org.apache.poi.ss.formula.ptg.MemFuncPtg; -import org.apache.poi.ss.formula.ptg.OperandPtg; import org.apache.poi.ss.formula.ptg.Ptg; -import org.apache.poi.ss.formula.ptg.Ref3DPtg; import org.apache.poi.ss.formula.ptg.UnionPtg; import org.apache.poi.ss.formula.udf.AggregatingUDFFinder; import org.apache.poi.ss.formula.udf.UDFFinder; diff --git a/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java b/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java index f3ce0689b4..3e491e7e8e 100644 --- a/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java +++ b/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java @@ -21,7 +21,6 @@ import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.util.RegionUtil; import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.ss.util.Region; /** * Various utility functions that make working with a region of cells easier. @@ -34,8 +33,11 @@ public final class HSSFRegionUtil { // no instances of this class } - private static CellRangeAddress toCRA(Region region) { - return Region.convertToCellRangeAddress(region); + /** + * @deprecated (Aug 2008) use {@link CellRangeAddress} instead of {@link Region} + */ + private static CellRangeAddress toCRA(org.apache.poi.ss.util.Region region) { + return org.apache.poi.ss.util.Region.convertToCellRangeAddress(region); } /** diff --git a/src/java/org/apache/poi/hssf/util/Region.java b/src/java/org/apache/poi/hssf/util/Region.java index 25a67db211..4e417b5672 100644 --- a/src/java/org/apache/poi/hssf/util/Region.java +++ b/src/java/org/apache/poi/hssf/util/Region.java @@ -24,6 +24,7 @@ package org.apache.poi.hssf.util; * to represent a string of characters. Its really only useful for HSSF though. * * @author Andrew C. Oliver acoliver at apache dot org + * @deprecated (Aug-2008) use {@link org.apache.poi.ss.util.CellRangeAddress} */ public class Region extends org.apache.poi.ss.util.Region diff --git a/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java b/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java index 1ef66d5e7c..fbc58ab0c4 100644 --- a/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java +++ b/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java @@ -138,7 +138,7 @@ public class Ole10Native { ofs += len; flags2 = LittleEndian.getShort(data, ofs); ofs += LittleEndianConsts.SHORT_SIZE; - len = LittleEndian.getUnsignedByte(data, ofs); + len = LittleEndian.getUByte(data, ofs); unknown1 = new byte[len]; ofs += len; len = 3; diff --git a/src/java/org/apache/poi/poifs/storage/SmallDocumentBlock.java b/src/java/org/apache/poi/poifs/storage/SmallDocumentBlock.java index e7762ffbf6..8c726caa0a 100644 --- a/src/java/org/apache/poi/poifs/storage/SmallDocumentBlock.java +++ b/src/java/org/apache/poi/poifs/storage/SmallDocumentBlock.java @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.List; import org.apache.poi.poifs.common.POIFSBigBlockSize; -import org.apache.poi.poifs.common.POIFSConstants; /** * Storage for documents that are too small to use regular diff --git a/src/java/org/apache/poi/ss/formula/LazyAreaEval.java b/src/java/org/apache/poi/ss/formula/LazyAreaEval.java index 1ba1e1a3f2..76f926879f 100644 --- a/src/java/org/apache/poi/ss/formula/LazyAreaEval.java +++ b/src/java/org/apache/poi/ss/formula/LazyAreaEval.java @@ -22,9 +22,6 @@ import org.apache.poi.ss.formula.ptg.AreaI.OffsetArea; import org.apache.poi.ss.formula.eval.AreaEval; import org.apache.poi.ss.formula.eval.AreaEvalBase; import org.apache.poi.ss.formula.eval.ValueEval; -import org.apache.poi.ss.formula.ptg.FuncVarPtg; -import org.apache.poi.ss.formula.ptg.Ptg; -import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.util.CellReference; /** diff --git a/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java b/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java index 32ac417128..51fda2648b 100644 --- a/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java +++ b/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java @@ -16,8 +16,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.function.FunctionMetadata; import org.apache.poi.ss.formula.function.FunctionMetadataRegistry; import org.apache.poi.ss.formula.functions.FreeRefFunction; -import org.apache.poi.ss.formula.functions.Function; -import org.apache.poi.ss.formula.functions.NotImplementedFunction; import org.apache.poi.ss.formula.functions.Sumifs; import org.apache.poi.ss.formula.udf.UDFFinder; diff --git a/src/java/org/apache/poi/ss/formula/atp/YearFrac.java b/src/java/org/apache/poi/ss/formula/atp/YearFrac.java index 611ace9574..1f0ca6d8a3 100644 --- a/src/java/org/apache/poi/ss/formula/atp/YearFrac.java +++ b/src/java/org/apache/poi/ss/formula/atp/YearFrac.java @@ -18,8 +18,6 @@ package org.apache.poi.ss.formula.atp; import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.regex.Pattern; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException; diff --git a/src/java/org/apache/poi/ss/formula/functions/Npv.java b/src/java/org/apache/poi/ss/formula/functions/Npv.java index 4609094ffe..760120f49b 100644 --- a/src/java/org/apache/poi/ss/formula/functions/Npv.java +++ b/src/java/org/apache/poi/ss/formula/functions/Npv.java @@ -17,14 +17,11 @@ package org.apache.poi.ss.formula.functions; -import org.apache.poi.ss.formula.TwoDEval; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.ValueEval; -import java.util.Arrays; - /** * Calculates the net present value of an investment by using a discount rate * and a series of future payments (negative values) and income (positive diff --git a/src/java/org/apache/poi/ss/usermodel/Chart.java b/src/java/org/apache/poi/ss/usermodel/Chart.java index b14d95d10f..f8a55a28e3 100644 --- a/src/java/org/apache/poi/ss/usermodel/Chart.java +++ b/src/java/org/apache/poi/ss/usermodel/Chart.java @@ -22,7 +22,6 @@ import java.util.List; import org.apache.poi.ss.usermodel.charts.ChartData; import org.apache.poi.ss.usermodel.charts.ChartAxis; import org.apache.poi.ss.usermodel.charts.ChartLegend; -import org.apache.poi.ss.usermodel.charts.ManualLayout; import org.apache.poi.ss.usermodel.charts.ManuallyPositionable; import org.apache.poi.ss.usermodel.charts.ChartDataFactory; import org.apache.poi.ss.usermodel.charts.ChartAxisFactory; diff --git a/src/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java b/src/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java index 674c0470be..3344963bb6 100644 --- a/src/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java +++ b/src/java/org/apache/poi/ss/usermodel/ConditionalFormatting.java @@ -19,7 +19,6 @@ package org.apache.poi.ss.usermodel; -import org.apache.poi.hssf.usermodel.HSSFConditionalFormattingRule; import org.apache.poi.ss.util.CellRangeAddress; /** diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ChartAxisFactory.java b/src/java/org/apache/poi/ss/usermodel/charts/ChartAxisFactory.java index bd037f500f..8bf32b2b8c 100644 --- a/src/java/org/apache/poi/ss/usermodel/charts/ChartAxisFactory.java +++ b/src/java/org/apache/poi/ss/usermodel/charts/ChartAxisFactory.java @@ -17,7 +17,6 @@ package org.apache.poi.ss.usermodel.charts; -import org.apache.poi.ss.usermodel.Chart; import org.apache.poi.util.Beta; /** diff --git a/src/java/org/apache/poi/util/ArrayUtil.java b/src/java/org/apache/poi/util/ArrayUtil.java index e5c6744764..3461ee7152 100644 --- a/src/java/org/apache/poi/util/ArrayUtil.java +++ b/src/java/org/apache/poi/util/ArrayUtil.java @@ -128,4 +128,44 @@ public class ArrayUtil Math.min( source.length, newLength ) ); return result; } + + /** + * Copies the specified range of the specified array into a new array. + * The initial index of the range (from) must lie between zero + * and original.length, inclusive. The value at + * original[from] is placed into the initial element of the copy + * (unless from == original.length or from == to). + * Values from subsequent elements in the original array are placed into + * subsequent elements in the copy. The final index of the range + * (to), which must be greater than or equal to from, + * may be greater than original.length, in which case + * (byte)0 is placed in all elements of the copy whose index is + * greater than or equal to original.length - from. The length + * of the returned array will be to - from. + * + * This method is temporary + * replace for Arrays.copyOfRange() until we start to require JDK 1.6. + * + * @param original the array from which a range is to be copied + * @param from the initial index of the range to be copied, inclusive + * @param to the final index of the range to be copied, exclusive. + * (This index may lie outside the array.) + * @return a new array containing the specified range from the original array, + * truncated or padded with zeros to obtain the required length + * @throws ArrayIndexOutOfBoundsException if from < 0 + * or from > original.length() + * @throws IllegalArgumentException if from > to + * @throws NullPointerException if original is null + * @since 1.6 + */ + public static byte[] copyOfRange(byte[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) + throw new IllegalArgumentException(from + " > " + to); + byte[] copy = new byte[newLength]; + System.arraycopy(original, from, copy, 0, + Math.min(original.length - from, newLength)); + return copy; + } + } diff --git a/src/testcases/org/apache/poi/ddf/TestEscherProperty.java b/src/testcases/org/apache/poi/ddf/TestEscherProperty.java index faa7604c3e..c7d704ff14 100644 --- a/src/testcases/org/apache/poi/ddf/TestEscherProperty.java +++ b/src/testcases/org/apache/poi/ddf/TestEscherProperty.java @@ -19,11 +19,6 @@ package org.apache.poi.ddf; import junit.framework.TestCase; -import java.util.List; -import java.lang.reflect.Field; - -import org.apache.poi.util.HexRead; -import org.apache.poi.util.HexDump; /** * @author Yegor Kozlov diff --git a/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java b/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java index 5c15497299..5652f45e14 100644 --- a/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java +++ b/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java @@ -19,28 +19,11 @@ package org.apache.poi.hpsf.basic; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.util.Date; -import java.util.List; -import junit.framework.Assert; import junit.framework.TestCase; -import org.apache.poi.hpsf.DocumentSummaryInformation; -import org.apache.poi.hpsf.HPSFException; -import org.apache.poi.hpsf.MarkUnsupportedException; -import org.apache.poi.hpsf.NoPropertySetStreamException; -import org.apache.poi.hpsf.PropertySet; -import org.apache.poi.hpsf.PropertySetFactory; -import org.apache.poi.hpsf.Section; -import org.apache.poi.hpsf.SummaryInformation; -import org.apache.poi.hpsf.wellknown.SectionIDMap; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.POIDataSamples; /** * Tests various bugs have been fixed diff --git a/src/testcases/org/apache/poi/hssf/model/TestLinkTable.java b/src/testcases/org/apache/poi/hssf/model/TestLinkTable.java index f053ba14b6..d62a80d72b 100644 --- a/src/testcases/org/apache/poi/hssf/model/TestLinkTable.java +++ b/src/testcases/org/apache/poi/hssf/model/TestLinkTable.java @@ -30,7 +30,6 @@ import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.record.*; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.hssf.usermodel.TestHSSFWorkbook; import org.apache.poi.ss.formula.ptg.NameXPtg; /** diff --git a/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java b/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java index d8aa165f5c..14b4fbfc1d 100644 --- a/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java @@ -29,7 +29,6 @@ import org.apache.poi.ss.formula.udf.DefaultUDFFinder; import org.apache.poi.ss.formula.udf.AggregatingUDFFinder; import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.eval.ValueEval; -import org.apache.poi.ss.formula.eval.NotImplementedException; import org.apache.poi.ss.formula.OperationEvaluationContext; /** diff --git a/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java index e4354082c9..13f854dbda 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java @@ -18,16 +18,6 @@ package org.apache.poi.hssf.record; import junit.framework.TestCase; -import org.apache.poi.ddf.EscherClientDataRecord; -import org.apache.poi.ddf.EscherContainerRecord; -import org.apache.poi.ddf.EscherDggRecord; -import org.apache.poi.ddf.EscherSpRecord; -import org.apache.poi.hssf.model.DrawingManager2; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.HexRead; - -import java.util.ArrayList; -import java.util.List; import java.util.Arrays; /** diff --git a/src/testcases/org/apache/poi/hssf/record/TestDConRefRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDConRefRecord.java index 82074549ec..9518f3fff2 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestDConRefRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestDConRefRecord.java @@ -23,12 +23,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; import junit.framework.TestCase; -import org.apache.poi.hssf.record.RecordInputStream; -import org.apache.poi.hssf.record.TestcaseRecordInputStream; +import org.apache.poi.util.ArrayUtil; import org.apache.poi.util.LittleEndianOutputStream; -//import static org.junit.Assert.assertArrayEquals; -//import org.junit.Test; -import junit.framework.Assert; /** * Unit tests for DConRefRecord class. @@ -292,7 +288,7 @@ public class TestDConRefRecord extends TestCase public void testGetPath() { DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1)); - byte[] expResult = Arrays.copyOfRange(data1, 9, data1.length); + byte[] expResult = ArrayUtil.copyOfRange(data1, 9, data1.length); byte[] result = instance.getPath(); assertTrue("get path", Arrays.equals(expResult, result)); } diff --git a/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java index 0ca4fddf70..28bfb35099 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java @@ -21,7 +21,6 @@ import org.apache.poi.hssf.usermodel.HSSFName; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.formula.ptg.ArrayPtg; import org.apache.poi.ss.formula.ptg.Ptg; -import org.apache.poi.util.HexDump; import org.apache.poi.util.HexRead; import junit.framework.AssertionFailedError; diff --git a/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java b/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java index a8240995ea..5fd20be332 100644 --- a/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java +++ b/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java @@ -54,6 +54,7 @@ public final class TestValueRecordsAggregate extends TestCase { * Make sure the shared formula DOESNT makes it to the FormulaRecordAggregate when being parsed * as part of the value records */ + @SuppressWarnings("deprecation") // uses deprecated {@link ValueRecordsAggregate#getValueRecords()} public void testSharedFormula() { List records = new ArrayList(); records.add(new FormulaRecord()); @@ -94,6 +95,7 @@ public final class TestValueRecordsAggregate extends TestCase { return records; } + @SuppressWarnings("deprecation") // uses deprecated {@link ValueRecordsAggregate#getValueRecords()} public void testInsertCell() { CellValueRecordInterface[] cvrs = valueRecord.getValueRecords(); assertEquals(0, cvrs.length); @@ -104,6 +106,7 @@ public final class TestValueRecordsAggregate extends TestCase { assertEquals(1, cvrs.length); } + @SuppressWarnings("deprecation") // uses deprecated {@link ValueRecordsAggregate#getValueRecords()} public void testRemoveCell() { BlankRecord blankRecord1 = newBlankRecord(); valueRecord.insertCell( blankRecord1 ); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 6f1fdcde2e..111130e29d 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -1037,6 +1037,7 @@ public final class TestBugs extends BaseTestBugzillaIssues { confirmCachedValue("70164", nc2); confirmCachedValue("90210", nc3); + @SuppressWarnings("deprecation") CellValueRecordInterface[] cvrs = ns.getSheet().getValueRecords(); for (int i = 0; i < cvrs.length; i++) { CellValueRecordInterface cvr = cvrs[i]; diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java b/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java index a24013f849..b0e03cb71d 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java @@ -26,7 +26,6 @@ import java.io.InputStream; import java.io.PrintStream; import junit.framework.AssertionFailedError; -import junit.framework.TestCase; import org.apache.poi.hssf.HSSFITestDataProvider; import org.apache.poi.hssf.HSSFTestDataSamples; @@ -34,10 +33,8 @@ import org.apache.poi.hssf.eventmodel.ERFListener; import org.apache.poi.hssf.eventmodel.EventRecordFactory; import org.apache.poi.hssf.record.DVRecord; import org.apache.poi.hssf.record.RecordFormatException; -import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.*; -import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddressList; /** diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFConditionalFormatting.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFConditionalFormatting.java index 5495199770..943ebd004e 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFConditionalFormatting.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFConditionalFormatting.java @@ -17,14 +17,9 @@ package org.apache.poi.hssf.usermodel; -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; import org.apache.poi.hssf.HSSFITestDataProvider; -import org.apache.poi.hssf.record.CFRuleRecord.ComparisonOperator; -import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.BaseTestConditionalFormatting; -import org.apache.poi.ss.util.CellRangeAddress; /** * diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java index c96316744f..8761ecf104 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormat.java @@ -20,7 +20,6 @@ package org.apache.poi.hssf.usermodel; import org.apache.poi.hssf.HSSFITestDataProvider; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.ss.usermodel.*; -import org.apache.poi.ss.util.CellReference; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java index 4759a6c04b..8ef9a41be5 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java @@ -17,14 +17,12 @@ package org.apache.poi.hssf.usermodel; -import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.Format; import java.text.SimpleDateFormat; import java.util.GregorianCalendar; import java.util.Iterator; -import java.util.Locale; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.ss.usermodel.Cell; diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java index 926572b1a8..bc87fe76a5 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java @@ -26,7 +26,6 @@ import junit.framework.TestCase; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.model.InternalWorkbook; -import org.apache.poi.ss.usermodel.DateUtil; /** * Class TestHSSFDateUtil diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java b/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java index 4e64d97dcd..4a65b86bc9 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java @@ -17,12 +17,6 @@ package org.apache.poi.hssf.usermodel; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; - -import junit.framework.TestCase; - -import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.HSSFITestDataProvider; import org.apache.poi.ss.usermodel.BaseTestSheetHiding; diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java index f794cd2b5d..9a2dc5dfbd 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java @@ -24,8 +24,6 @@ import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.record.RecordFormatException; import java.io.IOException; -import java.io.FileInputStream; -import java.io.File; /** * @author aviks diff --git a/src/testcases/org/apache/poi/ss/formula/TestPlainCellCache.java b/src/testcases/org/apache/poi/ss/formula/TestPlainCellCache.java index 4ad351cbea..e40100d5b9 100644 --- a/src/testcases/org/apache/poi/ss/formula/TestPlainCellCache.java +++ b/src/testcases/org/apache/poi/ss/formula/TestPlainCellCache.java @@ -19,19 +19,9 @@ package org.apache.poi.ss.formula; -import junit.framework.AssertionFailedError; import junit.framework.TestCase; -import org.apache.poi.hssf.model.HSSFFormulaParser; -import org.apache.poi.hssf.usermodel.*; -import org.apache.poi.hssf.util.CellReference; -import org.apache.poi.ss.formula.IEvaluationListener.ICacheEntry; import org.apache.poi.ss.formula.PlainCellCache.Loc; import org.apache.poi.ss.formula.eval.*; -import org.apache.poi.ss.formula.ptg.Ptg; -import org.apache.poi.ss.usermodel.CellValue; - -import java.io.PrintStream; -import java.util.*; /** * @author Yegor Kozlov diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestDateParser.java b/src/testcases/org/apache/poi/ss/formula/atp/TestDateParser.java index ad3c35441c..9dcbf16ac3 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestDateParser.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestDateParser.java @@ -59,12 +59,14 @@ public class TestDateParser extends TestCase { } } + @SuppressWarnings("deprecation") public void testShouldParseValidDate() throws EvaluationException { Calendar aDate = Calendar.getInstance(); aDate.setTime(new Date(84, OCTOBER, 20)); assertEquals(aDate, DateParser.parseDate("1984/10/20")); } + @SuppressWarnings("deprecation") public void testShouldIgnoreTimestamp() throws EvaluationException { Calendar aDate = Calendar.getInstance(); aDate.setTime(new Date(84, OCTOBER, 20)); diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestMRound.java b/src/testcases/org/apache/poi/ss/formula/atp/TestMRound.java index 5f9acff9f4..2338fbbe6d 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestMRound.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestMRound.java @@ -17,7 +17,6 @@ package org.apache.poi.ss.formula.atp; import junit.framework.TestCase; -import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.usermodel.*; diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java b/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java index 6f178e1aec..8e9e7366c5 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java @@ -43,6 +43,7 @@ import org.apache.poi.ss.formula.eval.ValueEval; /** * @author jfaenomoto@gmail.com */ +@SuppressWarnings("deprecation") // YK: uses deprecated {@link java.util.Date(int year, int month, int date)} public class TestNetworkdaysFunction extends TestCase { private static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayCalculator.java b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayCalculator.java index ff632a0b8b..18d2a6262f 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayCalculator.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayCalculator.java @@ -29,6 +29,7 @@ import org.apache.poi.ss.usermodel.DateUtil; /** * @author jfaenomoto@gmail.com */ +@SuppressWarnings("deprecation") // YK: heavily uses deprecated {@link java.util.Date(int year, int month, int date)} public class TestWorkdayCalculator extends TestCase { public void testCalculateWorkdaysShouldReturnJustWeekdaysWhenNoWeekend() { diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java index 811ec18204..6540de028a 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java @@ -25,12 +25,10 @@ import static java.util.Calendar.MAY; import static java.util.Calendar.NOVEMBER; import static java.util.Calendar.OCTOBER; import static java.util.Calendar.SEPTEMBER; -import static org.apache.poi.ss.formula.eval.ErrorEval.NUM_ERROR; import static org.apache.poi.ss.formula.eval.ErrorEval.VALUE_INVALID; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Calendar; import java.util.Date; import java.util.List; @@ -48,6 +46,7 @@ import org.apache.poi.ss.usermodel.DateUtil; /** * @author jfaenomoto@gmail.com */ +@SuppressWarnings("deprecation") // YK: heavily uses deprecated {@link java.util.Date(int year, int month, int date)} public class TestWorkdayFunction extends TestCase { private static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java b/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java index ba25c4d7d1..07fb6aa895 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestAddress.java @@ -22,7 +22,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.CellValue; import junit.framework.TestCase; -import org.apache.poi.ss.util.CellReference; public final class TestAddress extends TestCase { diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java b/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java index 40525480f5..2d340ad8f1 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java @@ -17,9 +17,6 @@ package org.apache.poi.ss.formula.functions; -import java.util.Arrays; -import java.util.List; - import junit.framework.AssertionFailedError; import junit.framework.TestCase; diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java b/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java index 247138a4b6..b0078f71d5 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestNpv.java @@ -21,8 +21,6 @@ import junit.framework.TestCase; import junit.framework.AssertionFailedError; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.HSSFTestDataSamples; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.CellValue; /** diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java index bd16d6a533..14cb2d8283 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java @@ -18,20 +18,14 @@ package org.apache.poi.ss.formula.functions; import org.apache.poi.hssf.HSSFTestDataSamples; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.eval.AreaEval; import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.ValueEval; import junit.framework.TestCase; import org.apache.poi.ss.usermodel.*; -import org.apache.poi.ss.util.SheetBuilder; - -import java.util.Date; /** * Tests for {@link Subtotal} diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestSumifs.java b/src/testcases/org/apache/poi/ss/formula/functions/TestSumifs.java index 7ecc330f5e..386b521f21 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestSumifs.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestSumifs.java @@ -25,7 +25,6 @@ import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.eval.*; -import org.apache.poi.ss.usermodel.CellValue; /** * Test cases for SUMIFS() diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java index 7ddb3f02ce..550dd03c13 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java @@ -21,7 +21,6 @@ package org.apache.poi.ss.usermodel; import junit.framework.TestCase; import org.apache.poi.ss.ITestDataProvider; -import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; /** diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java index b0bd1910ad..347eded973 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java @@ -23,9 +23,6 @@ import junit.framework.TestCase; import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.util.CellRangeAddress; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; - /** * @author Yegor Kozlov */ diff --git a/src/testcases/org/apache/poi/util/TestLittleEndian.java b/src/testcases/org/apache/poi/util/TestLittleEndian.java index 4313e34991..f398ff40a3 100644 --- a/src/testcases/org/apache/poi/util/TestLittleEndian.java +++ b/src/testcases/org/apache/poi/util/TestLittleEndian.java @@ -160,7 +160,7 @@ public final class TestLittleEndian extends TestCase { testdata[0] = ( short ) 0xFF01; testdata[1] = 0x02FF; - LittleEndian.putShort(received, testdata[0]); + LittleEndian.putShort(received, 0, testdata[0]); assertTrue(compareByteArrays(received, expected, 0, LittleEndian.SHORT_SIZE)); LittleEndian.putShort(received, 1, testdata[1]); assertTrue(compareByteArrays(received, expected, 1, LittleEndian.SHORT_SIZE)); @@ -180,7 +180,7 @@ public final class TestLittleEndian extends TestCase { }; byte[] received = new byte[ LittleEndian.INT_SIZE + 1 ]; - LittleEndian.putInt(received, 0xFFFFFF01); + LittleEndian.putInt(received, 0, 0xFFFFFF01); assertTrue(compareByteArrays(received, expected, 0, LittleEndian.INT_SIZE)); LittleEndian.putInt(received, 1, 0x02FFFFFF); assertTrue(compareByteArrays(received, expected, 1, LittleEndian.INT_SIZE)); -- 2.39.5