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
This commit is contained in:
Yegor Kozlov 2012-03-05 09:44:20 +00:00
parent cfbd879755
commit af696ae5fd
62 changed files with 88 additions and 148 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 {
}
/**
* <p
* Note that <code>options</code> is an internal field. Use {@link #setInstance(short)} ()} and
* {@link #setVersion(short)} ()} to set the actual fields.
* </p>
* @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
*
* <p
* Note that <code>options</code> is an internal field. Use {@link #getInstance()} and
* {@link #getVersion()} to access actual fields.
* </p>
*/
@Deprecated
@Internal
public void setOptions( short options ) {
// call to handle correct/incorrect values
setVersion( fVersion.getShortValue( options ) );

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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
*

View File

@ -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;

View File

@ -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.*;
/**

View File

@ -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 <tt>CellRangeAddress</tt>s. never <code>null</code>

View File

@ -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;

View File

@ -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;
/**

View File

@ -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());
}
/**

View File

@ -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 <tt>CellRangeAddress</tt> instead of <tt>Region</tt>
*/
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.

View File

@ -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;

View File

@ -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);
}
/**

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;
/**

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -19,7 +19,6 @@
package org.apache.poi.ss.usermodel;
import org.apache.poi.hssf.usermodel.HSSFConditionalFormattingRule;
import org.apache.poi.ss.util.CellRangeAddress;
/**

View File

@ -17,7 +17,6 @@
package org.apache.poi.ss.usermodel.charts;
import org.apache.poi.ss.usermodel.Chart;
import org.apache.poi.util.Beta;
/**

View File

@ -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 (<tt>from</tt>) must lie between zero
* and <tt>original.length</tt>, inclusive. The value at
* <tt>original[from]</tt> is placed into the initial element of the copy
* (unless <tt>from == original.length</tt> or <tt>from == to</tt>).
* Values from subsequent elements in the original array are placed into
* subsequent elements in the copy. The final index of the range
* (<tt>to</tt>), which must be greater than or equal to <tt>from</tt>,
* may be greater than <tt>original.length</tt>, in which case
* <tt>(byte)0</tt> is placed in all elements of the copy whose index is
* greater than or equal to <tt>original.length - from</tt>. The length
* of the returned array will be <tt>to - from</tt>.
*
* 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 <tt>from &lt; 0</tt>
* or <tt>from &gt; original.length()</tt>
* @throws IllegalArgumentException if <tt>from &gt; to</tt>
* @throws NullPointerException if <tt>original</tt> 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;
}
}

View File

@ -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

View File

@ -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

View File

@ -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;
/**

View File

@ -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;
/**

View File

@ -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;
/**

View File

@ -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));
}

View File

@ -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;

View File

@ -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<Record> records = new ArrayList<Record>();
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 );

View File

@ -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];

View File

@ -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;
/**

View File

@ -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;
/**
*

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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.*;

View File

@ -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");

View File

@ -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() {

View File

@ -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");

View File

@ -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 {

View File

@ -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;

View File

@ -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;
/**

View File

@ -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}

View File

@ -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()

View File

@ -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;
/**

View File

@ -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
*/

View File

@ -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));