From e355d20cfab226f2dcc1f512760bb60220149dc2 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Wed, 15 Jun 2016 03:26:58 +0000 Subject: [PATCH] bug 59170: remove deprecated methods git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1748483 13f79535-47bb-0310-9956-ffa450edef68 --- .project | 2 +- .../extractor/EventBasedExcelExtractor.java | 9 --- .../poi/hssf/extractor/ExcelExtractor.java | 9 +-- .../apache/poi/hssf/model/InternalSheet.java | 19 ------ .../org/apache/poi/hssf/model/LinkTable.java | 8 --- .../poi/hssf/util/CellRangeAddress.java | 37 ----------- .../poi/hssf/util/CellRangeAddress8Bit.java | 7 --- .../poi/hssf/util/CellRangeAddressList.java | 54 ---------------- .../org/apache/poi/util/LittleEndian.java | 61 ------------------- .../apache/poi/hdgf/chunks/ChunkHeader.java | 6 +- .../org/apache/poi/hslf/record/CString.java | 2 +- .../apache/poi/hslf/record/ExControlAtom.java | 2 +- .../apache/poi/hwpf/model/CHPBinTable.java | 2 +- .../poi/hwpf/model/CHPFormattedDiskPage.java | 4 +- .../poi/hwpf/model/ComplexFileTable.java | 2 +- .../src/org/apache/poi/hwpf/model/Ffn.java | 2 +- .../org/apache/poi/hwpf/model/FontTable.java | 4 +- .../poi/hwpf/model/FormattedDiskPage.java | 2 +- .../apache/poi/hwpf/model/Hyphenation.java | 2 +- .../apache/poi/hwpf/model/PAPBinTable.java | 2 +- .../poi/hwpf/model/PAPFormattedDiskPage.java | 6 +- .../src/org/apache/poi/hwpf/model/PAPX.java | 2 +- .../apache/poi/hwpf/model/SectionTable.java | 2 +- .../hwpf/sprm/ParagraphSprmCompressor.java | 2 +- .../poi/hwpf/sprm/SectionSprmCompressor.java | 2 +- .../org/apache/poi/hwpf/sprm/SprmUtils.java | 4 +- .../org/apache/poi/hwpf/usermodel/Range.java | 4 +- .../apache/poi/hwpf/model/TestPlexOfCps.java | 2 +- .../apache/poi/hssf/usermodel/TestBugs.java | 9 ++- 29 files changed, 33 insertions(+), 236 deletions(-) delete mode 100644 src/java/org/apache/poi/hssf/util/CellRangeAddress.java delete mode 100644 src/java/org/apache/poi/hssf/util/CellRangeAddressList.java diff --git a/.project b/.project index 274051f30a..5617510959 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - ApachePOI + ApachePOI-bug57840 diff --git a/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java b/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java index 859309fc0c..115d9b1d87 100644 --- a/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java +++ b/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java @@ -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 ); diff --git a/src/java/org/apache/poi/hssf/extractor/ExcelExtractor.java b/src/java/org/apache/poi/hssf/extractor/ExcelExtractor.java index cbe1e4d443..d6046845bc 100644 --- a/src/java/org/apache/poi/hssf/extractor/ExcelExtractor.java +++ b/src/java/org/apache/poi/hssf/extractor/ExcelExtractor.java @@ -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)); } diff --git a/src/java/org/apache/poi/hssf/model/InternalSheet.java b/src/java/org/apache/poi/hssf/model/InternalSheet.java index 1cbc004c81..76de951362 100644 --- a/src/java/org/apache/poi/hssf/model/InternalSheet.java +++ b/src/java/org/apache/poi/hssf/model/InternalSheet.java @@ -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. - * - *

- * 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. diff --git a/src/java/org/apache/poi/hssf/model/LinkTable.java b/src/java/org/apache/poi/hssf/model/LinkTable.java index cc228b3dfd..f6f75692ce 100644 --- a/src/java/org/apache/poi/hssf/model/LinkTable.java +++ b/src/java/org/apache/poi/hssf/model/LinkTable.java @@ -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); } diff --git a/src/java/org/apache/poi/hssf/util/CellRangeAddress.java b/src/java/org/apache/poi/hssf/util/CellRangeAddress.java deleted file mode 100644 index a59fa5e606..0000000000 --- a/src/java/org/apache/poi/hssf/util/CellRangeAddress.java +++ /dev/null @@ -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'

- * - * 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); - } -} diff --git a/src/java/org/apache/poi/hssf/util/CellRangeAddress8Bit.java b/src/java/org/apache/poi/hssf/util/CellRangeAddress8Bit.java index 83f79b996a..8ec6733aaf 100644 --- a/src/java/org/apache/poi/hssf/util/CellRangeAddress8Bit.java +++ b/src/java/org/apache/poi/hssf/util/CellRangeAddress8Bit.java @@ -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()); diff --git a/src/java/org/apache/poi/hssf/util/CellRangeAddressList.java b/src/java/org/apache/poi/hssf/util/CellRangeAddressList.java deleted file mode 100644 index d715eee432..0000000000 --- a/src/java/org/apache/poi/hssf/util/CellRangeAddressList.java +++ /dev/null @@ -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. - *

- * - * @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)); - } - } -} diff --git a/src/java/org/apache/poi/util/LittleEndian.java b/src/java/org/apache/poi/util/LittleEndian.java index 6ceb12a4a1..45fc0eb30a 100644 --- a/src/java/org/apache/poi/util/LittleEndian.java +++ b/src/java/org/apache/poi/util/LittleEndian.java @@ -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 * diff --git a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java index fc8c0a30eb..4b38366f7b 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkHeader.java @@ -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); diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/CString.java b/src/scratchpad/src/org/apache/poi/hslf/record/CString.java index 0f088d3887..0115438d2b 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/CString.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/CString.java @@ -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 ********************** */ diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java index 951b5759eb..b5540cee5a 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java @@ -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); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java index 7a3f19121b..ee4a377270 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java @@ -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)); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPFormattedDiskPage.java b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPFormattedDiskPage.java index ee50fb55ff..8c63dce6c3 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPFormattedDiskPage.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPFormattedDiskPage.java @@ -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]; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java index 687b67e0bd..f980251cb6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java @@ -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 ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Ffn.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Ffn.java index 4f469dad09..935d408a8e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/Ffn.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Ffn.java @@ -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; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java index bedf1e59fe..8776cb3dd0 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java @@ -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++) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FormattedDiskPage.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FormattedDiskPage.java index 4be886aa24..0d06383a6c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FormattedDiskPage.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FormattedDiskPage.java @@ -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; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java index 4ef53f56b0..0860a38f76 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java @@ -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 ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java index a139ee0f4f..a88b42ae07 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java @@ -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)); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java index adf35d0d25..d314d95b4e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java @@ -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 { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java index 837b83b97f..689e3451f6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java @@ -130,7 +130,7 @@ public final class PAPX extends BytePropertyNode { } if (buf.length == 1) { - return (short)LittleEndian.getUnsignedByte(buf, 0); + return LittleEndian.getUByte(buf, 0); } return LittleEndian.getShort(buf); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java index 956b1b962b..ea2bef98a1 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java @@ -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); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java index 4ae6434d0c..2f60b536fe 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java @@ -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 ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java index 273124fe61..723ab994e6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java @@ -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); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java index 81ff0c91f6..c155be566a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java @@ -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); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java index 52ba548e5b..98abbd1873 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java @@ -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); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPlexOfCps.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPlexOfCps.java index 2f4ba063ed..f5f3162363 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPlexOfCps.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPlexOfCps.java @@ -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; } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index e55680538f..7ccae676bd 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -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 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(); } -- 2.39.5