bug 59170: remove deprecated methods

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1748483 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-06-15 03:26:58 +00:00
parent ea30ed25b4
commit e355d20cfa
29 changed files with 33 additions and 236 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ApachePOI</name>
<name>ApachePOI-bug57840</name>
<comment></comment>
<projects>
</projects>

View File

@ -65,15 +65,6 @@ public class EventBasedExcelExtractor extends POIOLE2TextExtractor implements or
boolean _includeSheetNames = true;
boolean _formulasNotResults = false;
/**
* @deprecated Use {@link #EventBasedExcelExtractor(DirectoryNode)} instead
*/
@Deprecated
public EventBasedExcelExtractor( DirectoryNode dir, POIFSFileSystem fs )
{
this( dir );
}
public EventBasedExcelExtractor( DirectoryNode dir )
{
super( (POIDocument)null );

View File

@ -69,14 +69,7 @@ public class ExcelExtractor extends POIOLE2TextExtractor implements org.apache.p
public ExcelExtractor(POIFSFileSystem fs) throws IOException {
this(fs.getRoot());
}
/**
* @deprecated Use {@link #ExcelExtractor(DirectoryNode)} instead
*/
@Deprecated
public ExcelExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
this( dir );
}
public ExcelExtractor(DirectoryNode dir) throws IOException {
public ExcelExtractor(DirectoryNode dir) throws IOException {
this(new HSSFWorkbook(dir, true));
}

View File

@ -779,25 +779,6 @@ public final class InternalSheet {
return _rowsAggregate.getCellValueIterator();
}
/**
* Get all the value records (from LOC). Records will be returned from the first
* record (starting at LOC) which is a value record.
*
* <P>
* This method is "loc" sensitive. Meaning you need to set LOC to where you
* want it to start searching. If you don't know do this: setLoc(getDimsLoc).
* When adding several rows you can just start at the last one by leaving loc
* at what this sets it to. For this method, set loc to dimsloc to start with,
* subsequent calls will return values in (physical) sequence or NULL when you get to the end.
*
* @return Array of CellValueRecordInterface representing the remaining value records
* @deprecated use {@link #getCellValueIterator()} instead
*/
@Deprecated
public CellValueRecordInterface[] getValueRecords() {
return _rowsAggregate.getValueRecords();
}
/**
* get the NEXT RowRecord (from LOC). The first record that is a Row record
* (starting at LOC) will be returned.

View File

@ -488,14 +488,6 @@ final class LinkTable {
return _externSheetRecord.getLastSheetIndexFromRefIndex(extRefIndex);
}
/**
* @deprecated Was prevously used for removing sheets, which we now do differently
*/
@Deprecated
public void updateIndexToInternalSheet(int extRefIndex, int offset) {
_externSheetRecord.adjustIndex(extRefIndex, offset);
}
public void removeSheet(int sheetIdx) {
_externSheetRecord.removeSheet(sheetIdx);
}

View File

@ -1,37 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.util;
import org.apache.poi.hssf.record.RecordInputStream;
import org.apache.poi.hssf.record.SelectionRecord;
/**
* See OOO documentation: excelfileformat.pdf sec 2.5.14 - 'Cell Range Address'<p/>
*
* Note - {@link SelectionRecord} uses the BIFF5 version of this structure
* @deprecated use {@link org.apache.poi.ss.util.CellRangeAddress}
*/
public class CellRangeAddress extends org.apache.poi.ss.util.CellRangeAddress {
public CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol) {
super(firstRow, lastRow, firstCol, lastCol);
}
public CellRangeAddress(RecordInputStream in) {
super(in);
}
}

View File

@ -47,13 +47,6 @@ public final class CellRangeAddress8Bit extends CellRangeAddressBase {
return in.readUShort();
}
/**
* @deprecated use {@link #serialize(LittleEndianOutput)}
*/
public int serialize(int offset, byte[] data) {
serialize(new LittleEndianByteArrayOutputStream(data, offset, ENCODED_SIZE));
return ENCODED_SIZE;
}
public void serialize(LittleEndianOutput out) {
out.writeShort(getFirstRow());
out.writeShort(getLastRow());

View File

@ -1,54 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.util;
import org.apache.poi.hssf.record.RecordInputStream;
/**
* Implementation of the cell range address lists,like is described
* in OpenOffice.org's Excel Documentation: excelfileformat.pdf sec 2.5.14 -
* 'Cell Range Address List'
*
* In BIFF8 there is a common way to store absolute cell range address lists in
* several records (not formulas). A cell range address list consists of a field
* with the number of ranges and the list of the range addresses. Each cell
* range address (called an ADDR structure) contains 4 16-bit-values.
* </p>
*
* @deprecated use {@link org.apache.poi.ss.util.CellRangeAddressList}
*/
public class CellRangeAddressList extends org.apache.poi.ss.util.CellRangeAddressList {
public CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol) {
super(firstRow,lastRow,firstCol,lastCol);
}
public CellRangeAddressList() {
super();
}
/**
* @param in the RecordInputstream to read the record from
*/
public CellRangeAddressList(RecordInputStream in) {
super();
int nItems = in.readUShort();
for (int k = 0; k < nItems; k++) {
_list.add(new CellRangeAddress(in));
}
}
}

View File

@ -301,22 +301,6 @@ public class LittleEndian implements LittleEndianConsts
return retNum & 0x00FFFFFFFFl;
}
/**
* get the unsigned value of a byte.
*
* @param data
* the byte array.
* @param offset
* a starting offset into the byte array.
* @return the unsigned value of the byte as a 32 bit integer
* @deprecated Use {@link #getUByte(byte[], int)} instead
*/
@Deprecated
public static int getUnsignedByte( byte[] data, int offset )
{
return data[offset] & 0xFF;
}
/**
* get an unsigned short value from the beginning of a byte array
*
@ -421,21 +405,6 @@ public class LittleEndian implements LittleEndianConsts
putInt( Float.floatToIntBits( value ), outputStream );
}
/**
* put an int value into beginning of a byte array
*
* @param data
* the byte array
* @param value
* the int (32-bit) value
* @deprecated Use {@link #putInt(byte[], int, int)} instead
*/
@Deprecated
public static void putInt( byte[] data, int value )
{
putInt( data, 0, value );
}
/**
* put an int value into a byte array
*
@ -536,21 +505,6 @@ public class LittleEndian implements LittleEndianConsts
data[i++] = (byte) ( ( value >>> 8 ) & 0xFF );
}
/**
* put a short value into beginning of a byte array
*
* @param data
* the byte array
* @param value
* the short (16-bit) value
* @deprecated Use {@link #putShort(byte[], int, short)} instead
*/
@Deprecated
public static void putShort( byte[] data, short value )
{
putShort( data, 0, value );
}
/**
* Put signed short into output stream
*
@ -629,21 +583,6 @@ public class LittleEndian implements LittleEndianConsts
data[i++] = (byte) ( ( value >>> 24 ) & 0xFF );
}
/**
* put an unsigned int value into beginning of a byte array
*
* @param data
* the byte array
* @param value
* the int (32-bit) value
* @deprecated Use {@link #putUInt(byte[], int, long)} instead
*/
@Deprecated
public static void putUInt( byte[] data, long value )
{
putUInt( data, 0, value );
}
/**
* Put unsigned int into output stream
*

View File

@ -47,7 +47,7 @@ public abstract class ChunkHeader {
ch.unknown1 = (int)LittleEndian.getUInt(data, offset + 8);
ch.length = (int)LittleEndian.getUInt(data, offset + 12);
ch.unknown2 = LittleEndian.getShort(data, offset + 16);
ch.unknown3 = (short)LittleEndian.getUnsignedByte(data, offset + 18);
ch.unknown3 = LittleEndian.getUByte(data, offset + 18);
return ch;
} else if(documentVersion == 5 || documentVersion == 4) {
@ -55,8 +55,8 @@ public abstract class ChunkHeader {
ch.type = LittleEndian.getShort(data, offset + 0);
ch.id = LittleEndian.getShort(data, offset + 2);
ch.unknown2 = (short)LittleEndian.getUnsignedByte(data, offset + 4);
ch.unknown3 = (short)LittleEndian.getUnsignedByte(data, offset + 5);
ch.unknown2 = LittleEndian.getUByte(data, offset + 4);
ch.unknown3 = LittleEndian.getUByte(data, offset + 5);
ch.unknown1 = LittleEndian.getShort(data, offset + 6);
ch.length = (int)LittleEndian.getUInt(data, offset + 8);

View File

@ -66,7 +66,7 @@ public final class CString extends RecordAtom {
* The meaning of the count is specific to the type of the parent record
*/
public void setOptions(int count) {
LittleEndian.putShort(_header, (short)count);
LittleEndian.putShort(_header, 0, (short)count);
}
/* *************** record code follows ********************** */

View File

@ -110,7 +110,7 @@ public final class ExControlAtom extends RecordAtom {
public void writeOut(OutputStream out) throws IOException {
out.write(_header);
byte[] data = new byte[4];
LittleEndian.putInt(data, _id);
LittleEndian.putInt(data, 0, _id);
out.write(data);
}

View File

@ -511,7 +511,7 @@ public class CHPBinTable
}
byte[] intHolder = new byte[4];
LittleEndian.putInt(intHolder, pageNum++);
LittleEndian.putInt(intHolder, 0, pageNum++);
bte.addProperty(new GenericPropertyNode(start, end, intHolder));
}

View File

@ -124,7 +124,7 @@ public final class CHPFormattedDiskPage extends FormattedDiskPage
*/
protected byte[] getGrpprl(int index)
{
int chpxOffset = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + (((_crun + 1) * 4) + index));
int chpxOffset = 2 * LittleEndian.getUByte(_fkp, _offset + (((_crun + 1) * 4) + index));
//optimization if offset == 0 use "Normal" style
if(chpxOffset == 0)
@ -132,7 +132,7 @@ public final class CHPFormattedDiskPage extends FormattedDiskPage
return new byte[0];
}
int size = LittleEndian.getUnsignedByte(_fkp, _offset + chpxOffset);
int size = LittleEndian.getUByte(_fkp, _offset + chpxOffset);
byte[] chpx = new byte[size];

View File

@ -97,7 +97,7 @@ public final class ComplexFileTable
byte[] table = _tpt.writeTo( wordDocumentStream );
byte[] numHolder = new byte[LittleEndian.INT_SIZE];
LittleEndian.putInt( numHolder, table.length );
LittleEndian.putInt( numHolder, 0, table.length );
tableStream.write( numHolder );
tableStream.write( table );
}

View File

@ -57,7 +57,7 @@ public final class Ffn
{
int offsetTmp = offset;
_cbFfnM1 = LittleEndian.getUnsignedByte(buf,offset);
_cbFfnM1 = LittleEndian.getUByte(buf,offset);
offset += LittleEndian.BYTE_SIZE;
_info = buf[offset];
offset += LittleEndian.BYTE_SIZE;

View File

@ -125,9 +125,9 @@ public final class FontTable
public void writeTo( HWPFOutputStream tableStream ) throws IOException
{
byte[] buf = new byte[LittleEndian.SHORT_SIZE];
LittleEndian.putShort(buf, _stringCount);
LittleEndian.putShort(buf, 0, _stringCount);
tableStream.write(buf);
LittleEndian.putShort(buf, _extraDataSz);
LittleEndian.putShort(buf, 0, _extraDataSz);
tableStream.write(buf);
for(int i = 0; i < _fontNames.length; i++)

View File

@ -58,7 +58,7 @@ public abstract class FormattedDiskPage
*/
public FormattedDiskPage(byte[] documentStream, int offset)
{
_crun = LittleEndian.getUnsignedByte(documentStream, offset + 511);
_crun = LittleEndian.getUByte(documentStream, offset + 511);
_fkp = documentStream;
_offset = offset;
}

View File

@ -38,7 +38,7 @@ public final class Hyphenation extends HRESIAbstractType implements Cloneable
public Hyphenation( short hres )
{
byte[] data = new byte[2];
LittleEndian.putShort( data, hres );
LittleEndian.putShort( data, 0, hres );
fillFields( data, 0 );
}

View File

@ -459,7 +459,7 @@ public class PAPBinTable
}
byte[] intHolder = new byte[4];
LittleEndian.putInt(intHolder, pageNum++);
LittleEndian.putInt(intHolder, 0, pageNum++);
binTable.addProperty(new GenericPropertyNode(start, end, intHolder));
}

View File

@ -156,11 +156,11 @@ public final class PAPFormattedDiskPage extends FormattedDiskPage {
*/
protected byte[] getGrpprl(int index)
{
int papxOffset = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + (((_crun + 1) * FC_SIZE) + (index * BX_SIZE)));
int size = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + papxOffset);
int papxOffset = 2 * LittleEndian.getUByte(_fkp, _offset + (((_crun + 1) * FC_SIZE) + (index * BX_SIZE)));
int size = 2 * LittleEndian.getUByte(_fkp, _offset + papxOffset);
if(size == 0)
{
size = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + ++papxOffset);
size = 2 * LittleEndian.getUByte(_fkp, _offset + ++papxOffset);
}
else
{

View File

@ -130,7 +130,7 @@ public final class PAPX extends BytePropertyNode<PAPX> {
}
if (buf.length == 1)
{
return (short)LittleEndian.getUnsignedByte(buf, 0);
return LittleEndian.getUByte(buf, 0);
}
return LittleEndian.getShort(buf);
}

View File

@ -190,7 +190,7 @@ public class SectionTable
// write the sepx to the document stream. starts with a 2 byte size
// followed by the grpprl
byte[] shortBuf = new byte[2];
LittleEndian.putShort(shortBuf, (short)grpprl.length);
LittleEndian.putShort(shortBuf, 0, (short)grpprl.length);
wordDocumentStream.write(shortBuf);
wordDocumentStream.write(grpprl);

View File

@ -388,7 +388,7 @@ public final class ParagraphSprmCompressor
{
// sprmPRsid
byte[] value = new byte[4];
LittleEndian.putUInt( value, newPAP.getRsid() );
LittleEndian.putUInt( value, 0, newPAP.getRsid() );
size += SprmUtils.addSprm( (short) 0x6467, 0, value, sprmList );
}

View File

@ -188,7 +188,7 @@ public final class SectionSprmCompressor
byte[] buf = new byte[7];
buf[0] = (byte)(newSEP.getFPropMark() ? 1 : 0);
int offset = LittleEndian.BYTE_SIZE;
LittleEndian.putShort(buf, (short)newSEP.getIbstPropRMark());
LittleEndian.putShort(buf, 0, (short)newSEP.getIbstPropRMark());
offset += LittleEndian.SHORT_SIZE;
newSEP.getDttmPropRMark().serialize(buf, offset);
size += SprmUtils.addSprm((short)0xD227, -1, buf, sprmList);

View File

@ -46,7 +46,7 @@ public final class SprmUtils
{
byte[] sprm = new byte[varParam.length + 4];
System.arraycopy(varParam, 0, sprm, 4, varParam.length);
LittleEndian.putShort(sprm, instruction);
LittleEndian.putShort(sprm, 0, instruction);
LittleEndian.putShort(sprm, 2, (short)(varParam.length + 1));
list.add(sprm);
return sprm.length;
@ -124,7 +124,7 @@ public final class SprmUtils
public static int convertBrcToInt(short[] brc)
{
byte[] buf = new byte[4];
LittleEndian.putShort(buf, brc[0]);
LittleEndian.putShort(buf, 0, brc[0]);
LittleEndian.putShort(buf, LittleEndian.SHORT_SIZE, brc[1]);
return LittleEndian.getInt(buf);
}

View File

@ -476,7 +476,7 @@ public class Range { // TODO -instantiable superclass
byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
LittleEndian.putShort(withIndex, (short) styleIndex);
LittleEndian.putShort(withIndex, 0, (short) styleIndex);
System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
SprmBuffer buf = new SprmBuffer(withIndex, 2);
@ -527,7 +527,7 @@ public class Range { // TODO -instantiable superclass
byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
LittleEndian.putShort(withIndex, (short) styleIndex);
LittleEndian.putShort(withIndex, 0, (short) styleIndex);
System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
SprmBuffer buf = new SprmBuffer(withIndex, 2);

View File

@ -36,7 +36,7 @@ public final class TestPlexOfCps
{
byte[] intHolder = new byte[4];
int span = (int)(110.0f * Math.random());
LittleEndian.putInt(intHolder, span);
LittleEndian.putInt(intHolder, 0, span);
_plexOfCps.addProperty(new GenericPropertyNode(last, last + span, intHolder));
last += span;
}

View File

@ -1140,10 +1140,9 @@ 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];
int i = 0;
for (Iterator<CellValueRecordInterface> it = ns.getSheet().getCellValueIterator(); it.hasNext(); i++) {
CellValueRecordInterface cvr = it.next();
if(cvr instanceof FormulaRecordAggregate) {
FormulaRecordAggregate fr = (FormulaRecordAggregate)cvr;
@ -1161,7 +1160,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
}
}
assertEquals(3, cvrs.length);
assertEquals(3, i);
wb2.close();
}