bug 59170: Removed deprecated methods in POIFS, SS, HSSF, and XSSF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1748897 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
21e8ce5979
commit
59d1dc095b
@ -40,6 +40,7 @@ import org.apache.poi.util.POILogger;
|
||||
* for their rules.</p>
|
||||
*/
|
||||
public abstract class CFRuleBase extends StandardRecord implements Cloneable {
|
||||
// FIXME: Merge with org.apache.poi.ss.usermodel.ComparisonOperator and rewrite as an enum
|
||||
public static final class ComparisonOperator {
|
||||
public static final byte NO_COMPARISON = 0;
|
||||
public static final byte BETWEEN = 1;
|
||||
|
@ -37,6 +37,9 @@ public final class DrawingRecord extends StandardRecord implements Cloneable {
|
||||
recordData = in.readRemainder();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated POI 3.9
|
||||
*/
|
||||
@Deprecated
|
||||
public void processContinueRecord(byte[] record) {
|
||||
//don't merge continue record with the drawing record, it must be serialized separately
|
||||
@ -55,11 +58,6 @@ public final class DrawingRecord extends StandardRecord implements Cloneable {
|
||||
return sid;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public byte[] getData() {
|
||||
return recordData;
|
||||
}
|
||||
|
||||
public byte[] getRecordData(){
|
||||
return recordData;
|
||||
}
|
||||
|
@ -162,14 +162,6 @@ public class ExternSheetRecord extends StandardRecord {
|
||||
return _list.get(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Was prevously used for removing sheets, which we now do differently
|
||||
*/
|
||||
@Deprecated
|
||||
public void adjustIndex(int extRefIndex, int offset) {
|
||||
getRef(extRefIndex).adjustIndex(offset);
|
||||
}
|
||||
|
||||
public void removeSheet(int sheetIdx) {
|
||||
int nItems = _list.size();
|
||||
for (int i = 0; i < nItems; i++) {
|
||||
|
@ -251,54 +251,6 @@ public final class FilePassRecord extends StandardRecord implements Cloneable {
|
||||
}
|
||||
return rc4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getRc4KeyData().getSalt()
|
||||
* @return the rc4 salt
|
||||
*/
|
||||
public byte[] getDocId() {
|
||||
return checkRc4().getSalt();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getRc4KeyData().setSalt()
|
||||
* @param docId the new rc4 salt
|
||||
*/
|
||||
public void setDocId(byte[] docId) {
|
||||
checkRc4().setSalt(docId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getRc4KeyData().getEncryptedVerifier()
|
||||
* @return the rc4 encrypted verifier
|
||||
*/
|
||||
public byte[] getSaltData() {
|
||||
return checkRc4().getEncryptedVerifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getRc4KeyData().setEncryptedVerifier()
|
||||
* @param saltData the new rc4 encrypted verifier
|
||||
*/
|
||||
public void setSaltData(byte[] saltData) {
|
||||
getRc4KeyData().setEncryptedVerifier(saltData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getRc4KeyData().getEncryptedVerifierHash()
|
||||
* @return the rc4 encrypted verifier hash
|
||||
*/
|
||||
public byte[] getSaltHash() {
|
||||
return getRc4KeyData().getEncryptedVerifierHash();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getRc4KeyData().setEncryptedVerifierHash()
|
||||
* @param saltHash the new rc4 encrypted verifier
|
||||
*/
|
||||
public void setSaltHash(byte[] saltHash) {
|
||||
getRc4KeyData().setEncryptedVerifierHash(saltHash);
|
||||
}
|
||||
|
||||
public short getSid() {
|
||||
return sid;
|
||||
|
@ -34,9 +34,6 @@ public final class PaneRecord extends StandardRecord {
|
||||
public final static short ACTIVE_PANE_LOWER_RIGHT = 0;
|
||||
public final static short ACTIVE_PANE_UPPER_RIGHT = 1;
|
||||
public final static short ACTIVE_PANE_LOWER_LEFT = 2;
|
||||
// TODO - remove obsolete field (it was deprecated May-2008 v3.1)
|
||||
/** @deprecated use ACTIVE_PANE_UPPER_LEFT */
|
||||
public final static short ACTIVE_PANE_UPER_LEFT = 3;
|
||||
public final static short ACTIVE_PANE_UPPER_LEFT = 3;
|
||||
|
||||
|
||||
|
@ -38,15 +38,6 @@ public final class PasswordRecord extends StandardRecord {
|
||||
field_1_password = in.readShort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the password hash
|
||||
*
|
||||
* @deprecated use {@link CryptoFunctions#createXorVerifier1(String)}
|
||||
*/
|
||||
public static short hashPassword(String password) {
|
||||
return (short)CryptoFunctions.createXorVerifier1(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the password
|
||||
*
|
||||
|
@ -29,8 +29,6 @@ import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
|
||||
import org.apache.poi.hssf.record.crypto.Biff8RC4Key;
|
||||
import org.apache.poi.hssf.record.crypto.Biff8XORKey;
|
||||
import org.apache.poi.poifs.crypt.Decryptor;
|
||||
import org.apache.poi.util.POILogFactory;
|
||||
import org.apache.poi.util.POILogger;
|
||||
|
||||
/**
|
||||
* A stream based way to get at complete records, with
|
||||
|
@ -415,7 +415,7 @@ public final class RecordInputStream implements LittleEndianInput {
|
||||
/** Reads all byte data for the current record, including any
|
||||
* that overlaps into any following continue records.
|
||||
*
|
||||
* @deprecated Best to write a input stream that wraps this one where there is
|
||||
* @deprecated POI 2.0 Best to write a input stream that wraps this one where there is
|
||||
* special sub record that may overlap continue records.
|
||||
*/
|
||||
public byte[] readAllContinuedRemainder() {
|
||||
|
@ -1,35 +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.record;
|
||||
/**
|
||||
* @deprecated Use {@link org.apache.poi.hssf.record.common.UnicodeString} instead
|
||||
*/
|
||||
public final class UnicodeString extends org.apache.poi.hssf.record.common.UnicodeString {
|
||||
/**
|
||||
* @deprecated Use {@link org.apache.poi.hssf.record.common.UnicodeString} instead
|
||||
*/
|
||||
public UnicodeString(RecordInputStream in) {
|
||||
super(in);
|
||||
}
|
||||
/**
|
||||
* @deprecated Use {@link org.apache.poi.hssf.record.common.UnicodeString} instead
|
||||
*/
|
||||
public UnicodeString(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
@ -182,14 +182,6 @@ public final class WindowOneRecord extends StandardRecord {
|
||||
public void setActiveSheetIndex(int index) {
|
||||
field_6_active_sheet = index;
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated - Misleading name - use setActiveSheetIndex()
|
||||
*/
|
||||
public void setSelectedTab(short s)
|
||||
{
|
||||
setActiveSheetIndex(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the first visible sheet in the worksheet tab-bar. This method does <b>not</b>
|
||||
@ -200,14 +192,6 @@ public final class WindowOneRecord extends StandardRecord {
|
||||
field_7_first_visible_tab = t;
|
||||
}
|
||||
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated - Misleading name - use setFirstVisibleTab()
|
||||
*/
|
||||
public void setDisplayedTab(short t) {
|
||||
setFirstVisibleTab(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the number of selected tabs
|
||||
* @param n number of tabs
|
||||
@ -340,14 +324,6 @@ public final class WindowOneRecord extends StandardRecord {
|
||||
public int getActiveSheetIndex() {
|
||||
return field_6_active_sheet;
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated - Misleading name - use getActiveSheetIndex()
|
||||
*/
|
||||
public short getSelectedTab()
|
||||
{
|
||||
return (short) getActiveSheetIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the first visible sheet in the worksheet tab-bar.
|
||||
@ -356,14 +332,6 @@ public final class WindowOneRecord extends StandardRecord {
|
||||
public int getFirstVisibleTab() {
|
||||
return field_7_first_visible_tab;
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated - Misleading name - use getFirstVisibleTab()
|
||||
*/
|
||||
public short getDisplayedTab()
|
||||
{
|
||||
return (short) getFirstVisibleTab();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the number of selected tabs
|
||||
|
@ -198,13 +198,7 @@ public final class WindowTwoRecord extends StandardRecord {
|
||||
public void setActive(boolean p) {
|
||||
field_1_options = active.setShortBoolean(field_1_options, p);
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated use setActive()
|
||||
*/
|
||||
public void setPaged(boolean p) {
|
||||
setActive(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* was the sheet saved in page break view
|
||||
* @param p pagebreaksaved or not
|
||||
@ -396,13 +390,6 @@ public final class WindowTwoRecord extends StandardRecord {
|
||||
public boolean isActive() {
|
||||
return active.isSet(field_1_options);
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated use isActive()
|
||||
*/
|
||||
public boolean getPaged() {
|
||||
return isActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* was the sheet saved in page break view
|
||||
|
@ -442,14 +442,6 @@ public final class RowRecordsAggregate extends RecordAggregate {
|
||||
return _valuesAgg.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getCellValueIterator()} instead
|
||||
*/
|
||||
public CellValueRecordInterface[] getValueRecords() {
|
||||
//noinspection deprecation
|
||||
return _valuesAgg.getValueRecords();
|
||||
}
|
||||
|
||||
public IndexRecord createIndexRecord(int indexRecordOffset, int sizeOfInitialSheetRecords) {
|
||||
IndexRecord result = new IndexRecord();
|
||||
result.setFirstRow(_firstrow);
|
||||
|
@ -359,33 +359,6 @@ public final class ValueRecordsAggregate implements Iterable<CellValueRecordInte
|
||||
return new ValueIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the cell records contained in this aggregate.
|
||||
* Note {@link BlankRecord}s appear separate (not in {@link MulBlankRecord}s).
|
||||
* @deprecated use {@link #iterator()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public CellValueRecordInterface[] getValueRecords() {
|
||||
List<CellValueRecordInterface> temp = new ArrayList<CellValueRecordInterface>();
|
||||
|
||||
for (int rowIx = 0; rowIx < records.length; rowIx++) {
|
||||
CellValueRecordInterface[] rowCells = records[rowIx];
|
||||
if (rowCells == null) {
|
||||
continue;
|
||||
}
|
||||
for (int colIx = 0; colIx < rowCells.length; colIx++) {
|
||||
CellValueRecordInterface cell = rowCells[colIx];
|
||||
if (cell != null) {
|
||||
temp.add(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CellValueRecordInterface[] result = new CellValueRecordInterface[temp.size()];
|
||||
temp.toArray(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
throw new RuntimeException("clone() should not be called. ValueRecordsAggregate should be copied via Sheet.cloneSheet()");
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class HSSFCell implements Cell {
|
||||
* @param row - the row of this cell
|
||||
* @param col - the column for this cell
|
||||
*
|
||||
* @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short)
|
||||
* @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(int)
|
||||
*/
|
||||
protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col)
|
||||
{
|
||||
@ -145,7 +145,7 @@ public class HSSFCell implements Cell {
|
||||
* @param type - CELL_TYPE_NUMERIC, CELL_TYPE_STRING, CELL_TYPE_FORMULA, CELL_TYPE_BLANK,
|
||||
* CELL_TYPE_BOOLEAN, CELL_TYPE_ERROR
|
||||
* Type of cell
|
||||
* @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short,int)
|
||||
* @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(int,int)
|
||||
*/
|
||||
protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col,
|
||||
int type)
|
||||
|
@ -230,19 +230,16 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
|
||||
/**
|
||||
* @return - the conditiontype for the cfrule
|
||||
*/
|
||||
public byte getConditionType() {
|
||||
return cfRuleRecord.getConditionType();
|
||||
}
|
||||
/**
|
||||
* @return - the conditiontype for the cfrule
|
||||
*/
|
||||
public ConditionType getConditionTypeType() {
|
||||
return ConditionType.forId(getConditionType());
|
||||
@Override
|
||||
public ConditionType getConditionType() {
|
||||
byte code = cfRuleRecord.getConditionType();
|
||||
return ConditionType.forId(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return - the comparisionoperatation for the cfrule
|
||||
*/
|
||||
@Override
|
||||
public byte getComparisonOperation() {
|
||||
return cfRuleRecord.getComparisonOperation();
|
||||
}
|
||||
|
@ -48,17 +48,6 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator
|
||||
private WorkbookEvaluator _bookEvaluator;
|
||||
private HSSFWorkbook _book;
|
||||
|
||||
/**
|
||||
* @deprecated (Sep 2008) HSSFSheet parameter is ignored
|
||||
*/
|
||||
@Deprecated
|
||||
public HSSFFormulaEvaluator(HSSFSheet sheet, HSSFWorkbook workbook) {
|
||||
this(workbook);
|
||||
// if (false) {
|
||||
// sheet.toString(); // suppress unused parameter compiler warning
|
||||
// }
|
||||
this._book = workbook;
|
||||
}
|
||||
public HSSFFormulaEvaluator(HSSFWorkbook workbook) {
|
||||
this(workbook, null);
|
||||
this._book = workbook;
|
||||
|
@ -162,24 +162,6 @@ public final class HSSFName implements Name {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the formula that the name is defined to refer to.
|
||||
*
|
||||
* @deprecated (Nov 2008) Misleading name. Use {@link #getRefersToFormula()} instead.
|
||||
*/
|
||||
public String getReference() {
|
||||
return getRefersToFormula();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the formula that the name is defined to refer to.
|
||||
*
|
||||
* @deprecated (Nov 2008) Misleading name. Use {@link #setRefersToFormula(String)} instead.
|
||||
*/
|
||||
public void setReference(String ref){
|
||||
setRefersToFormula(ref);
|
||||
}
|
||||
|
||||
public void setRefersToFormula(String formulaText) {
|
||||
Ptg[] ptgs = HSSFFormulaParser.parse(formulaText, _book, FormulaType.NAMEDRANGE, getSheetIndex());
|
||||
_definedNameRec.setNameDefinition(ptgs);
|
||||
|
@ -95,18 +95,6 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
|
||||
// subsequent calls to createCellFromRecord() will update the colIx boundaries properly
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated (Aug 2008) use {@link HSSFRow#createCell(int) }
|
||||
*/
|
||||
public HSSFCell createCell(short columnIndex) {
|
||||
return createCell((int)columnIndex);
|
||||
}
|
||||
/**
|
||||
* @deprecated (Aug 2008) use {@link HSSFRow#createCell(int, int) }
|
||||
*/
|
||||
public HSSFCell createCell(short columnIndex, int type) {
|
||||
return createCell((int)columnIndex, type);
|
||||
}
|
||||
/**
|
||||
* Use this to create new cells within the row and return it.
|
||||
* <p>
|
||||
@ -342,14 +330,6 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
|
||||
return cells[cellIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated (Aug 2008) use {@link #getCell(int)}
|
||||
*/
|
||||
public HSSFCell getCell(short cellnum) {
|
||||
int ushortCellNum = cellnum & 0x0000FFFF; // avoid sign extension
|
||||
return getCell(ushortCellNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hssfcell representing a given column (logical cell)
|
||||
* 0-based. If you ask for a cell that is not defined then
|
||||
|
@ -31,6 +31,7 @@ import java.io.PrintWriter;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
@ -537,14 +538,13 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
}
|
||||
workbook.getWindowOne().setNumSelectedTabs((short)1);
|
||||
}
|
||||
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated use setSelectedTab(int)
|
||||
* Selects multiple sheets as a group. This is distinct from
|
||||
* the 'active' sheet (which is the sheet with focus).
|
||||
*
|
||||
* @param indexes
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSelectedTab(short index) {
|
||||
setSelectedTab((int)index);
|
||||
}
|
||||
public void setSelectedTabs(int[] indexes) {
|
||||
|
||||
for (int index : indexes) {
|
||||
@ -564,6 +564,24 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
}
|
||||
workbook.getWindowOne().setNumSelectedTabs((short)indexes.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected sheets (if more than one, Excel calls these a [Group]).
|
||||
*
|
||||
* @return indices of selected sheets
|
||||
*/
|
||||
public Collection<Integer> getSelectedTabs() {
|
||||
Collection<Integer> indexes = new ArrayList<Integer>();
|
||||
int nSheets = _sheets.size();
|
||||
for (int i=0; i<nSheets; i++) {
|
||||
HSSFSheet sheet = getSheetAt(i);
|
||||
if (sheet.isSelected()) {
|
||||
indexes.add(i);
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableCollection(indexes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to set the active sheet. The active sheet is is the sheet
|
||||
* which is currently displayed when the workbook is viewed in Excel.
|
||||
@ -591,14 +609,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
public int getActiveSheetIndex() {
|
||||
return workbook.getWindowOne().getActiveSheetIndex();
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated - Misleading name - use getActiveSheetIndex()
|
||||
*/
|
||||
@Deprecated
|
||||
public short getSelectedTab() {
|
||||
return (short) getActiveSheetIndex();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -612,14 +622,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
public void setFirstVisibleTab(int index) {
|
||||
workbook.getWindowOne().setFirstVisibleTab(index);
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated - Misleading name - use setFirstVisibleTab()
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDisplayedTab(short index) {
|
||||
setFirstVisibleTab(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the first tab that is displayed in the list of tabs in excel.
|
||||
@ -628,14 +630,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
public int getFirstVisibleTab() {
|
||||
return workbook.getWindowOne().getFirstVisibleTab();
|
||||
}
|
||||
/**
|
||||
* deprecated May 2008
|
||||
* @deprecated - Misleading name - use getFirstVisibleTab()
|
||||
*/
|
||||
@Deprecated
|
||||
public short getDisplayedTab() {
|
||||
return (short) getFirstVisibleTab();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sheet name.
|
||||
@ -727,42 +721,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the external sheet index of the sheet
|
||||
* with the given internal index, creating one
|
||||
* if needed.
|
||||
* Used by some of the more obscure formula and
|
||||
* named range things.
|
||||
* @deprecated for POI internal use only (formula parsing). This method is likely to
|
||||
* be removed in future versions of POI.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getExternalSheetIndex(int internalSheetIndex) {
|
||||
return workbook.checkExternSheet(internalSheetIndex);
|
||||
}
|
||||
/**
|
||||
* @deprecated for POI internal use only (formula rendering). This method is likely to
|
||||
* be removed in future versions of POI.
|
||||
*/
|
||||
@Deprecated
|
||||
public String findSheetNameFromExternSheet(int externSheetIndex){
|
||||
// TODO - don't expose internal ugliness like externSheet indexes to the user model API
|
||||
return workbook.findSheetFirstNameFromExternSheet(externSheetIndex);
|
||||
}
|
||||
/**
|
||||
* @deprecated for POI internal use only (formula rendering). This method is likely to
|
||||
* be removed in future versions of POI.
|
||||
*
|
||||
* @param refIndex Index to REF entry in EXTERNSHEET record in the Link Table
|
||||
* @param definedNameIndex zero-based to DEFINEDNAME or EXTERNALNAME record
|
||||
* @return the string representation of the defined or external name
|
||||
*/
|
||||
@Deprecated
|
||||
public String resolveNameXText(int refIndex, int definedNameIndex) {
|
||||
// TODO - make this less cryptic / move elsewhere
|
||||
return workbook.resolveNameXText(refIndex, definedNameIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
|
||||
* the high level representation. Use this to create new sheets.
|
||||
@ -967,16 +925,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
return _sheets.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated for POI internal use only (formula parsing). This method is likely to
|
||||
* be removed in future versions of POI.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getSheetIndexFromExternSheetIndex(int externSheetNumber) {
|
||||
// TODO - don't expose internal ugliness like externSheet indexes to the user model API
|
||||
return workbook.getFirstSheetIndexFromExternSheetIndex(externSheetNumber);
|
||||
}
|
||||
|
||||
private HSSFSheet[] getSheets() {
|
||||
HSSFSheet[] result = new HSSFSheet[_sheets.size()];
|
||||
_sheets.toArray(result);
|
||||
@ -1431,25 +1379,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
||||
return retval;
|
||||
}
|
||||
|
||||
/** @deprecated Do not call this method from your applications. Use the methods
|
||||
* available in the HSSFRow to add string HSSFCells
|
||||
*/
|
||||
@Deprecated
|
||||
public int addSSTString(String string)
|
||||
{
|
||||
return workbook.addSSTString(new UnicodeString(string));
|
||||
}
|
||||
|
||||
/** @deprecated Do not call this method from your applications. Use the methods
|
||||
* available in the HSSFRow to get string HSSFCells
|
||||
*/
|
||||
@Deprecated
|
||||
public String getSSTString(int index)
|
||||
{
|
||||
return workbook.getSSTString(index).getString();
|
||||
}
|
||||
|
||||
InternalWorkbook getWorkbook() {
|
||||
/*package*/ InternalWorkbook getWorkbook() {
|
||||
return workbook;
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,6 @@ public abstract class EncryptionHeader {
|
||||
|
||||
protected EncryptionHeader() {}
|
||||
|
||||
/**
|
||||
* @deprecated use getChainingMode().ecmaId
|
||||
*/
|
||||
public int getCipherMode() {
|
||||
return chainingMode.ecmaId;
|
||||
}
|
||||
|
||||
public ChainingMode getChainingMode() {
|
||||
return chainingMode;
|
||||
}
|
||||
@ -84,13 +77,6 @@ public abstract class EncryptionHeader {
|
||||
this.sizeExtra = sizeExtra;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCipherAlgorithm()
|
||||
*/
|
||||
public int getAlgorithm() {
|
||||
return cipherAlgorithm.ecmaId;
|
||||
}
|
||||
|
||||
public CipherAlgorithm getCipherAlgorithm() {
|
||||
return cipherAlgorithm;
|
||||
}
|
||||
@ -99,13 +85,6 @@ public abstract class EncryptionHeader {
|
||||
this.cipherAlgorithm = cipherAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getHashAlgorithmEx()
|
||||
*/
|
||||
public int getHashAlgorithm() {
|
||||
return hashAlgorithm.ecmaId;
|
||||
}
|
||||
|
||||
public HashAlgorithm getHashAlgorithmEx() {
|
||||
return hashAlgorithm;
|
||||
}
|
||||
@ -138,13 +117,6 @@ public abstract class EncryptionHeader {
|
||||
this.keySalt = (salt == null) ? null : salt.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCipherProvider()
|
||||
*/
|
||||
public int getProviderType() {
|
||||
return providerType.ecmaId;
|
||||
}
|
||||
|
||||
public CipherProvider getCipherProvider() {
|
||||
return providerType;
|
||||
}
|
||||
|
@ -144,78 +144,6 @@ public class EncryptionInfo {
|
||||
encryptor = eib.getEncryptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #EncryptionInfo(EncryptionMode)} (fs parameter no longer required)
|
||||
*/
|
||||
@Deprecated
|
||||
public EncryptionInfo(POIFSFileSystem fs, EncryptionMode encryptionMode) {
|
||||
this(encryptionMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #EncryptionInfo(EncryptionMode)} (fs parameter no longer required)
|
||||
*/
|
||||
@Deprecated
|
||||
public EncryptionInfo(NPOIFSFileSystem fs, EncryptionMode encryptionMode) {
|
||||
this(encryptionMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #EncryptionInfo(EncryptionMode)} (dir parameter no longer required)
|
||||
*/
|
||||
@Deprecated
|
||||
public EncryptionInfo(DirectoryNode dir, EncryptionMode encryptionMode) {
|
||||
this(encryptionMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #EncryptionInfo(EncryptionMode, CipherAlgorithm, HashAlgorithm, int, int, ChainingMode)}
|
||||
*/
|
||||
@Deprecated
|
||||
public EncryptionInfo(
|
||||
POIFSFileSystem fs
|
||||
, EncryptionMode encryptionMode
|
||||
, CipherAlgorithm cipherAlgorithm
|
||||
, HashAlgorithm hashAlgorithm
|
||||
, int keyBits
|
||||
, int blockSize
|
||||
, ChainingMode chainingMode
|
||||
) {
|
||||
this(encryptionMode, cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #EncryptionInfo(EncryptionMode, CipherAlgorithm, HashAlgorithm, int, int, ChainingMode)}
|
||||
*/
|
||||
@Deprecated
|
||||
public EncryptionInfo(
|
||||
NPOIFSFileSystem fs
|
||||
, EncryptionMode encryptionMode
|
||||
, CipherAlgorithm cipherAlgorithm
|
||||
, HashAlgorithm hashAlgorithm
|
||||
, int keyBits
|
||||
, int blockSize
|
||||
, ChainingMode chainingMode
|
||||
) {
|
||||
this(encryptionMode, cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #EncryptionInfo(EncryptionMode, CipherAlgorithm, HashAlgorithm, int, int, ChainingMode)}
|
||||
*/
|
||||
@Deprecated
|
||||
public EncryptionInfo(
|
||||
DirectoryNode dir
|
||||
, EncryptionMode encryptionMode
|
||||
, CipherAlgorithm cipherAlgorithm
|
||||
, HashAlgorithm hashAlgorithm
|
||||
, int keyBits
|
||||
, int blockSize
|
||||
, ChainingMode chainingMode
|
||||
) {
|
||||
this(encryptionMode, cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares for encryption, using the given Encryption Mode, and
|
||||
* all other parameters as default.
|
||||
|
@ -37,28 +37,10 @@ public abstract class EncryptionVerifier {
|
||||
return salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method name is misleading - you'll get the encrypted verifier, not the plain verifier
|
||||
* @deprecated use getEncryptedVerifier()
|
||||
*/
|
||||
@Deprecated
|
||||
public byte[] getVerifier() {
|
||||
return encryptedVerifier;
|
||||
}
|
||||
|
||||
public byte[] getEncryptedVerifier() {
|
||||
return encryptedVerifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method name is misleading - you'll get the encrypted verifier hash, not the plain verifier hash
|
||||
* @deprecated use getEnryptedVerifierHash
|
||||
*/
|
||||
@Deprecated
|
||||
public byte[] getVerifierHash() {
|
||||
return encryptedVerifierHash;
|
||||
}
|
||||
|
||||
public byte[] getEncryptedVerifierHash() {
|
||||
return encryptedVerifierHash;
|
||||
}
|
||||
@ -75,14 +57,6 @@ public abstract class EncryptionVerifier {
|
||||
return cipherAlgorithm.ecmaId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getCipherAlgorithm().jceId
|
||||
*/
|
||||
@Deprecated
|
||||
public String getAlgorithmName() {
|
||||
return cipherAlgorithm.jceId;
|
||||
}
|
||||
|
||||
public byte[] getEncryptedKey() {
|
||||
return encryptedKey;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class EntryUtils
|
||||
* is the target Directory to copy to
|
||||
* @param excepts
|
||||
* is a list of Strings specifying what nodes NOT to copy
|
||||
* @deprecated use {@link FilteringDirectoryNode} instead
|
||||
* @deprecated POI 3.8 beta 5. Use {@link FilteringDirectoryNode} instead
|
||||
*/
|
||||
public static void copyNodes( DirectoryEntry sourceRoot,
|
||||
DirectoryEntry targetRoot, List<String> excepts )
|
||||
|
@ -114,20 +114,6 @@ public class Ole10Native {
|
||||
setDataBuffer(data);
|
||||
mode = EncodingMode.parsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance and fills the fields based on the data in the given buffer.
|
||||
*
|
||||
* @param data The buffer containing the Ole10Native record
|
||||
* @param offset The start offset of the record in the buffer
|
||||
* @param plain as of POI 3.11 this parameter is ignored
|
||||
* @throws Ole10NativeException on invalid or unexcepted data format
|
||||
*
|
||||
* @deprecated parameter plain is ignored, use {@link #Ole10Native(byte[],int)}
|
||||
*/
|
||||
public Ole10Native(byte[] data, int offset, boolean plain) throws Ole10NativeException {
|
||||
this(data, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance and fills the fields based on the data in the given buffer.
|
||||
|
@ -35,10 +35,6 @@ final class LazyRefEval extends RefEvalBase {
|
||||
_evaluator = sre;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ValueEval getInnerValueEval() {
|
||||
return getInnerValueEval(_evaluator.getFirstSheetIndex());
|
||||
}
|
||||
public ValueEval getInnerValueEval(int sheetIndex) {
|
||||
return _evaluator.getEvalForCell(sheetIndex, getRow(), getColumn());
|
||||
}
|
||||
|
@ -24,10 +24,6 @@ package org.apache.poi.ss.formula.eval;
|
||||
public final class BlankEval implements ValueEval {
|
||||
|
||||
public static final BlankEval instance = new BlankEval();
|
||||
/**
|
||||
* @deprecated (Nov 2009) use {@link #instance}
|
||||
*/
|
||||
public static final BlankEval INSTANCE = instance;
|
||||
|
||||
private BlankEval() {
|
||||
// enforce singleton
|
||||
|
@ -19,26 +19,10 @@
|
||||
|
||||
package org.apache.poi.ss.usermodel;
|
||||
|
||||
import static org.apache.poi.ss.usermodel.ConditionType.*;
|
||||
|
||||
/**
|
||||
* Represents a description of a conditional formatting rule
|
||||
*/
|
||||
public interface ConditionalFormattingRule {
|
||||
/**
|
||||
* This conditional formatting rule compares a cell value
|
||||
* to a formula calculated result, using an operator
|
||||
* @deprecated Use {@link ConditionType#CELL_VALUE_IS}
|
||||
*/
|
||||
public static final byte CONDITION_TYPE_CELL_VALUE_IS = CELL_VALUE_IS.id;
|
||||
|
||||
/**
|
||||
* This conditional formatting rule contains a formula to evaluate.
|
||||
* When the formula result is true, the cell is highlighted.
|
||||
* @deprecated Use {@link ConditionType#FORMULA}
|
||||
*/
|
||||
public static final byte CONDITION_TYPE_FORMULA = FORMULA.id;
|
||||
|
||||
/**
|
||||
* Create a new border formatting structure if it does not exist,
|
||||
* otherwise just return existing object.
|
||||
@ -93,27 +77,16 @@ public interface ConditionalFormattingRule {
|
||||
*/
|
||||
ColorScaleFormatting getColorScaleFormatting();
|
||||
|
||||
/**
|
||||
* Type of conditional formatting rule.
|
||||
* <p>
|
||||
* MUST be one of the IDs of a {@link ConditionType}
|
||||
* </p>
|
||||
*
|
||||
* @return the type of condition
|
||||
* @deprecated Use {@link #getConditionTypeType()}
|
||||
*/
|
||||
byte getConditionType();
|
||||
|
||||
/**
|
||||
* Type of conditional formatting rule.
|
||||
*
|
||||
* @return the type of condition
|
||||
*/
|
||||
ConditionType getConditionTypeType();
|
||||
ConditionType getConditionType();
|
||||
|
||||
/**
|
||||
* The comparison function used when the type of conditional formatting is set to
|
||||
* {@link #CONDITION_TYPE_CELL_VALUE_IS}
|
||||
* {@link ConditionType#CELL_VALUE_IS}
|
||||
* <p>
|
||||
* MUST be a constant from {@link ComparisonOperator}
|
||||
* </p>
|
||||
@ -125,13 +98,13 @@ public interface ConditionalFormattingRule {
|
||||
/**
|
||||
* The formula used to evaluate the first operand for the conditional formatting rule.
|
||||
* <p>
|
||||
* If the condition type is {@link #CONDITION_TYPE_CELL_VALUE_IS},
|
||||
* If the condition type is {@link ConditionType#CELL_VALUE_IS},
|
||||
* this field is the first operand of the comparison.
|
||||
* If type is {@link #CONDITION_TYPE_FORMULA}, this formula is used
|
||||
* If type is {@link ConditionType#FORMULA}, this formula is used
|
||||
* to determine if the conditional formatting is applied.
|
||||
* </p>
|
||||
* <p>
|
||||
* If comparison type is {@link #CONDITION_TYPE_FORMULA} the formula MUST be a Boolean function
|
||||
* If comparison type is {@link ConditionType#FORMULA} the formula MUST be a Boolean function
|
||||
* </p>
|
||||
*
|
||||
* @return the first formula
|
||||
@ -140,7 +113,7 @@ public interface ConditionalFormattingRule {
|
||||
|
||||
/**
|
||||
* The formula used to evaluate the second operand of the comparison when
|
||||
* comparison type is {@link #CONDITION_TYPE_CELL_VALUE_IS} and operator
|
||||
* comparison type is {@link ConditionType#CELL_VALUE_IS} and operator
|
||||
* is either {@link ComparisonOperator#BETWEEN} or {@link ComparisonOperator#NOT_BETWEEN}
|
||||
*
|
||||
* @return the second formula
|
||||
|
@ -53,14 +53,6 @@ public class CellRangeAddress extends CellRangeAddressBase {
|
||||
throw new IllegalArgumentException("lastRow < firstRow || lastCol < firstCol");
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #serialize(LittleEndianOutput)}
|
||||
*/
|
||||
@Deprecated
|
||||
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());
|
||||
|
@ -297,34 +297,22 @@ public class XSSFConditionalFormattingRule implements ConditionalFormattingRule
|
||||
|
||||
/**
|
||||
* Type of conditional formatting rule.
|
||||
* <p>
|
||||
* MUST be one of the IDs of a {@link ConditionType}
|
||||
* </p>
|
||||
*
|
||||
* @return the type of condition
|
||||
*/
|
||||
public byte getConditionType(){
|
||||
ConditionType type = getConditionTypeType();
|
||||
if (type != null) return type.id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of conditional formatting rule.
|
||||
*/
|
||||
public ConditionType getConditionTypeType() {
|
||||
@Override
|
||||
public ConditionType getConditionType() {
|
||||
return typeLookup.get(_cfRule.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* The comparison function used when the type of conditional formatting is set to
|
||||
* {@link ConditionalFormattingRule#CONDITION_TYPE_CELL_VALUE_IS}
|
||||
* {@link ConditionType#CELL_VALUE_IS}
|
||||
* <p>
|
||||
* MUST be a constant from {@link org.apache.poi.ss.usermodel.ComparisonOperator}
|
||||
* </p>
|
||||
*
|
||||
* @return the conditional format operator
|
||||
*/
|
||||
@Override
|
||||
public byte getComparisonOperation(){
|
||||
STConditionalFormattingOperator.Enum op = _cfRule.getOperator();
|
||||
if(op == null) return ComparisonOperator.NO_COMPARISON;
|
||||
@ -345,13 +333,13 @@ public class XSSFConditionalFormattingRule implements ConditionalFormattingRule
|
||||
/**
|
||||
* The formula used to evaluate the first operand for the conditional formatting rule.
|
||||
* <p>
|
||||
* If the condition type is {@link ConditionalFormattingRule#CONDITION_TYPE_CELL_VALUE_IS},
|
||||
* If the condition type is {@link ConditionType#CELL_VALUE_IS},
|
||||
* this field is the first operand of the comparison.
|
||||
* If type is {@link ConditionalFormattingRule#CONDITION_TYPE_FORMULA}, this formula is used
|
||||
* If type is {@link ConditionType#FORMULA}, this formula is used
|
||||
* to determine if the conditional formatting is applied.
|
||||
* </p>
|
||||
* <p>
|
||||
* If comparison type is {@link ConditionalFormattingRule#CONDITION_TYPE_FORMULA} the formula MUST be a Boolean function
|
||||
* If comparison type is {@link ConditionType#FORMULA} the formula MUST be a Boolean function
|
||||
* </p>
|
||||
*
|
||||
* @return the first formula
|
||||
@ -362,7 +350,7 @@ public class XSSFConditionalFormattingRule implements ConditionalFormattingRule
|
||||
|
||||
/**
|
||||
* The formula used to evaluate the second operand of the comparison when
|
||||
* comparison type is {@link ConditionalFormattingRule#CONDITION_TYPE_CELL_VALUE_IS} and operator
|
||||
* comparison type is {@link ConditionType#CELL_VALUE_IS} and operator
|
||||
* is either {@link org.apache.poi.ss.usermodel.ComparisonOperator#BETWEEN} or {@link org.apache.poi.ss.usermodel.ComparisonOperator#NOT_BETWEEN}
|
||||
*
|
||||
* @return the second formula
|
||||
|
@ -161,7 +161,7 @@ public class TestCertificateEncryption {
|
||||
@Test
|
||||
public void testCertificateEncryption() throws Exception {
|
||||
POIFSFileSystem fs = new POIFSFileSystem();
|
||||
EncryptionInfo info = new EncryptionInfo(fs, EncryptionMode.agile, CipherAlgorithm.aes128, HashAlgorithm.sha1, -1, -1, ChainingMode.cbc);
|
||||
EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile, CipherAlgorithm.aes128, HashAlgorithm.sha1, -1, -1, ChainingMode.cbc);
|
||||
AgileEncryptionVerifier aev = (AgileEncryptionVerifier)info.getVerifier();
|
||||
CertData certData = loadKeystore();
|
||||
aev.addCertificate(certData.x509);
|
||||
|
@ -33,7 +33,6 @@ public final class TestDrawingRecord extends TestCase {
|
||||
* Check that RecordFactoryInputStream properly handles continued DrawingRecords
|
||||
* See Bugzilla #47548
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testReadContinued() throws IOException {
|
||||
|
||||
//simulate a continues drawing record
|
||||
@ -56,7 +55,7 @@ public final class TestDrawingRecord extends TestCase {
|
||||
assertTrue(rec.get(0) instanceof DrawingRecord);
|
||||
assertTrue(rec.get(1) instanceof ContinueRecord);
|
||||
|
||||
assertArrayEquals(data1, ((DrawingRecord)rec.get(0)).getData());
|
||||
assertArrayEquals(data1, ((DrawingRecord)rec.get(0)).getRecordData());
|
||||
assertArrayEquals(data2, ((ContinueRecord)rec.get(1)).getData());
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import static org.junit.Assert.*;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
@ -49,12 +50,19 @@ import junit.framework.AssertionFailedError;
|
||||
public final class TestValueRecordsAggregate {
|
||||
private static final String ABNORMAL_SHARED_FORMULA_FLAG_TEST_FILE = "AbnormalSharedFormulaFlag.xls";
|
||||
private final ValueRecordsAggregate valueRecord = new ValueRecordsAggregate();
|
||||
|
||||
private List<CellValueRecordInterface> getValueRecords() {
|
||||
List<CellValueRecordInterface> list = new ArrayList<CellValueRecordInterface>();
|
||||
for ( CellValueRecordInterface rec : valueRecord ) {
|
||||
list.add(rec);
|
||||
}
|
||||
return Collections.unmodifiableList(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()}
|
||||
@Test
|
||||
public void testSharedFormula() {
|
||||
List<Record> records = new ArrayList<Record>();
|
||||
@ -63,11 +71,11 @@ public final class TestValueRecordsAggregate {
|
||||
records.add(new WindowTwoRecord());
|
||||
|
||||
constructValueRecord(records);
|
||||
CellValueRecordInterface[] cvrs = valueRecord.getValueRecords();
|
||||
List<CellValueRecordInterface> cvrs = getValueRecords();
|
||||
//Ensure that the SharedFormulaRecord has been converted
|
||||
assertEquals(1, cvrs.length);
|
||||
assertEquals(1, cvrs.size());
|
||||
|
||||
CellValueRecordInterface record = cvrs[0];
|
||||
CellValueRecordInterface record = cvrs.get(0);
|
||||
assertNotNull( "Row contains a value", record );
|
||||
assertTrue( "First record is a FormulaRecordsAggregate", ( record instanceof FormulaRecordAggregate ) );
|
||||
}
|
||||
@ -96,27 +104,22 @@ public final class TestValueRecordsAggregate {
|
||||
return records;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // uses deprecated {@link ValueRecordsAggregate#getValueRecords()}
|
||||
@Test
|
||||
public void testInsertCell() {
|
||||
CellValueRecordInterface[] cvrs = valueRecord.getValueRecords();
|
||||
assertEquals(0, cvrs.length);
|
||||
assertEquals(0, getValueRecords().size());
|
||||
|
||||
BlankRecord blankRecord = newBlankRecord();
|
||||
valueRecord.insertCell( blankRecord );
|
||||
cvrs = valueRecord.getValueRecords();
|
||||
assertEquals(1, cvrs.length);
|
||||
assertEquals(1, getValueRecords().size());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // uses deprecated {@link ValueRecordsAggregate#getValueRecords()}
|
||||
@Test
|
||||
public void testRemoveCell() {
|
||||
BlankRecord blankRecord1 = newBlankRecord();
|
||||
valueRecord.insertCell( blankRecord1 );
|
||||
BlankRecord blankRecord2 = newBlankRecord();
|
||||
valueRecord.removeCell( blankRecord2 );
|
||||
CellValueRecordInterface[] cvrs = valueRecord.getValueRecords();
|
||||
assertEquals(0, cvrs.length);
|
||||
assertEquals(0, getValueRecords().size());
|
||||
|
||||
// removing an already empty cell just falls through
|
||||
valueRecord.removeCell( blankRecord2 );
|
||||
|
@ -182,7 +182,6 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
|
||||
b6.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void selectedSheet_bug44523() throws IOException {
|
||||
HSSFWorkbook wb=new HSSFWorkbook();
|
||||
@ -198,9 +197,6 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
|
||||
|
||||
wb.setSelectedTab(1);
|
||||
|
||||
// see Javadoc, in this case selected means "active"
|
||||
assertEquals(wb.getActiveSheetIndex(), wb.getSelectedTab());
|
||||
|
||||
// Demonstrate bug 44525:
|
||||
// Well... not quite, since isActive + isSelected were also added in the same bug fix
|
||||
assertFalse("Identified bug 44523 a", sheet1.isSelected());
|
||||
@ -833,7 +829,6 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void selectedSheetShort() throws IOException {
|
||||
HSSFWorkbook wb=new HSSFWorkbook();
|
||||
@ -850,9 +845,6 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
|
||||
|
||||
wb.setSelectedTab((short)1);
|
||||
|
||||
// see Javadoc, in this case selected means "active"
|
||||
assertEquals(wb.getActiveSheetIndex(), wb.getSelectedTab());
|
||||
|
||||
// Demonstrate bug 44525:
|
||||
// Well... not quite, since isActive + isSelected were also added in the same bug fix
|
||||
assertFalse("Identified bug 44523 a", sheet1.isSelected());
|
||||
@ -865,47 +857,12 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
|
||||
confirmActiveSelected(sheet4, false);
|
||||
|
||||
assertEquals(0, wb.getFirstVisibleTab());
|
||||
wb.setDisplayedTab((short)2);
|
||||
wb.setFirstVisibleTab((short)2);
|
||||
assertEquals(2, wb.getFirstVisibleTab());
|
||||
assertEquals(2, wb.getDisplayedTab());
|
||||
|
||||
wb.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void getExternSheetIndex() throws IOException {
|
||||
HSSFWorkbook wb=new HSSFWorkbook();
|
||||
wb.createSheet("Sheet1");
|
||||
wb.createSheet("Sheet2");
|
||||
|
||||
assertEquals(0, wb.getExternalSheetIndex(0));
|
||||
assertEquals(1, wb.getExternalSheetIndex(1));
|
||||
|
||||
assertEquals("Sheet1", wb.findSheetNameFromExternSheet(0));
|
||||
assertEquals("Sheet2", wb.findSheetNameFromExternSheet(1));
|
||||
//assertEquals(null, wb.findSheetNameFromExternSheet(2));
|
||||
|
||||
assertEquals(0, wb.getSheetIndexFromExternSheetIndex(0));
|
||||
assertEquals(1, wb.getSheetIndexFromExternSheetIndex(1));
|
||||
assertEquals(-1, wb.getSheetIndexFromExternSheetIndex(2));
|
||||
assertEquals(-1, wb.getSheetIndexFromExternSheetIndex(100));
|
||||
|
||||
wb.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void sstString() throws IOException {
|
||||
HSSFWorkbook wb=new HSSFWorkbook();
|
||||
|
||||
int sst = wb.addSSTString("somestring");
|
||||
assertEquals("somestring", wb.getSSTString(sst));
|
||||
//assertNull(wb.getSSTString(sst+1));
|
||||
|
||||
wb.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void names() throws IOException {
|
||||
HSSFWorkbook wb=new HSSFWorkbook();
|
||||
|
@ -112,15 +112,13 @@ public abstract class BaseTestConditionalFormatting {
|
||||
* Test format conditions based on a boolean formula
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testBooleanFormulaConditions() throws IOException {
|
||||
Workbook wb = _testDataProvider.createWorkbook();
|
||||
Sheet sh = wb.createSheet();
|
||||
SheetConditionalFormatting sheetCF = sh.getSheetConditionalFormatting();
|
||||
|
||||
ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule("SUM(A1:A5)>10");
|
||||
assertEquals(ConditionType.FORMULA.id, rule1.getConditionType());
|
||||
assertEquals(ConditionType.FORMULA, rule1.getConditionTypeType());
|
||||
assertEquals(ConditionType.FORMULA, rule1.getConditionType());
|
||||
assertEquals("SUM(A1:A5)>10", rule1.getFormula1());
|
||||
int formatIndex1 = sheetCF.addConditionalFormatting(
|
||||
new CellRangeAddress[]{
|
||||
@ -150,7 +148,6 @@ public abstract class BaseTestConditionalFormatting {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSingleFormulaConditions() throws IOException {
|
||||
Workbook wb = _testDataProvider.createWorkbook();
|
||||
Sheet sh = wb.createSheet();
|
||||
@ -158,65 +155,56 @@ public abstract class BaseTestConditionalFormatting {
|
||||
|
||||
ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.EQUAL, "SUM(A1:A5)+10");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule1.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule1.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule1.getConditionType());
|
||||
assertEquals("SUM(A1:A5)+10", rule1.getFormula1());
|
||||
assertEquals(ComparisonOperator.EQUAL, rule1.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.NOT_EQUAL, "15");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule2.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule2.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule2.getConditionType());
|
||||
assertEquals("15", rule2.getFormula1());
|
||||
assertEquals(ComparisonOperator.NOT_EQUAL, rule2.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule3 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.NOT_EQUAL, "15");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule3.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule3.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule3.getConditionType());
|
||||
assertEquals("15", rule3.getFormula1());
|
||||
assertEquals(ComparisonOperator.NOT_EQUAL, rule3.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule4 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.GT, "0");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule4.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule4.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule4.getConditionType());
|
||||
assertEquals("0", rule4.getFormula1());
|
||||
assertEquals(ComparisonOperator.GT, rule4.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule5 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.LT, "0");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule5.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule5.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule5.getConditionType());
|
||||
assertEquals("0", rule5.getFormula1());
|
||||
assertEquals(ComparisonOperator.LT, rule5.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule6 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.GE, "0");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule6.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule6.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule6.getConditionType());
|
||||
assertEquals("0", rule6.getFormula1());
|
||||
assertEquals(ComparisonOperator.GE, rule6.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule7 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.LE, "0");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule7.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule7.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule7.getConditionType());
|
||||
assertEquals("0", rule7.getFormula1());
|
||||
assertEquals(ComparisonOperator.LE, rule7.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule8 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.BETWEEN, "0", "5");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule8.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule8.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule8.getConditionType());
|
||||
assertEquals("0", rule8.getFormula1());
|
||||
assertEquals("5", rule8.getFormula2());
|
||||
assertEquals(ComparisonOperator.BETWEEN, rule8.getComparisonOperation());
|
||||
|
||||
ConditionalFormattingRule rule9 = sheetCF.createConditionalFormattingRule(
|
||||
ComparisonOperator.NOT_BETWEEN, "0", "5");
|
||||
assertEquals(ConditionType.CELL_VALUE_IS.id, rule9.getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule9.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule9.getConditionType());
|
||||
assertEquals("0", rule9.getFormula1());
|
||||
assertEquals("5", rule9.getFormula2());
|
||||
assertEquals(ComparisonOperator.NOT_BETWEEN, rule9.getComparisonOperation());
|
||||
@ -225,7 +213,6 @@ public abstract class BaseTestConditionalFormatting {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testCopy() throws IOException {
|
||||
Workbook wb = _testDataProvider.createWorkbook();
|
||||
Sheet sheet1 = wb.createSheet();
|
||||
@ -258,10 +245,10 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertEquals(2, sheet2cf.getNumberOfRules());
|
||||
assertEquals("SUM(A1:A5)+10", sheet2cf.getRule(0).getFormula1());
|
||||
assertEquals(ComparisonOperator.EQUAL, sheet2cf.getRule(0).getComparisonOperation());
|
||||
assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, sheet2cf.getRule(0).getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, sheet2cf.getRule(0).getConditionType());
|
||||
assertEquals("15", sheet2cf.getRule(1).getFormula1());
|
||||
assertEquals(ComparisonOperator.NOT_EQUAL, sheet2cf.getRule(1).getComparisonOperation());
|
||||
assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, sheet2cf.getRule(1).getConditionType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, sheet2cf.getRule(1).getConditionType());
|
||||
|
||||
wb.close();
|
||||
}
|
||||
@ -504,7 +491,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
|
||||
// CF1 has two rules: values less than -3 are bold-italic red, values greater than 3 are green
|
||||
ConditionalFormattingRule rule1 = cf1.getRule(0);
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule1.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule1.getConditionType());
|
||||
assertEquals(ComparisonOperator.GT, rule1.getComparisonOperation());
|
||||
assertEquals("3", rule1.getFormula1());
|
||||
assertNull(rule1.getFormula2());
|
||||
@ -518,7 +505,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertFalse(fmt1.isItalic());
|
||||
|
||||
ConditionalFormattingRule rule2 = cf1.getRule(1);
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule2.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule2.getConditionType());
|
||||
assertEquals(ComparisonOperator.LT, rule2.getComparisonOperation());
|
||||
assertEquals("-3", rule2.getFormula1());
|
||||
assertNull(rule2.getFormula2());
|
||||
@ -538,7 +525,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertEquals("B9", regions2[0].formatAsString());
|
||||
|
||||
ConditionalFormattingRule rule3 = cf2.getRule(0);
|
||||
assertEquals(ConditionType.FORMULA, rule3.getConditionTypeType());
|
||||
assertEquals(ConditionType.FORMULA, rule3.getConditionType());
|
||||
assertEquals(ComparisonOperator.NO_COMPARISON, rule3.getComparisonOperation());
|
||||
assertEquals("$A$8>5", rule3.getFormula1());
|
||||
assertNull(rule3.getFormula2());
|
||||
@ -562,13 +549,13 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertEquals(2, cf3.getNumberOfRules());
|
||||
|
||||
ConditionalFormattingRule rule4 = cf3.getRule(0);
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule4.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule4.getConditionType());
|
||||
assertEquals(ComparisonOperator.LE, rule4.getComparisonOperation());
|
||||
assertEquals("\"AAA\"", rule4.getFormula1());
|
||||
assertNull(rule4.getFormula2());
|
||||
|
||||
ConditionalFormattingRule rule5 = cf3.getRule(1);
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule5.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, rule5.getConditionType());
|
||||
assertEquals(ComparisonOperator.BETWEEN, rule5.getComparisonOperation());
|
||||
assertEquals("\"A\"", rule5.getFormula1());
|
||||
assertEquals("\"AAA\"", rule5.getFormula2());
|
||||
@ -603,7 +590,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
if (str.contains("[CF12]")) fCF12++;
|
||||
if (str.contains("[CFEX]")) fCFEX++;
|
||||
} else {
|
||||
ConditionType type = cf.getRule(cf.getNumberOfRules()-1).getConditionTypeType();
|
||||
ConditionType type = cf.getRule(cf.getNumberOfRules()-1).getConditionType();
|
||||
if (type == ConditionType.CELL_VALUE_IS ||
|
||||
type == ConditionType.FORMULA) {
|
||||
fCF++;
|
||||
@ -628,7 +615,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
|
||||
assertEquals(1, cf.getNumberOfRules());
|
||||
cr = cf.getRule(0);
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, cr.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, cr.getConditionType());
|
||||
assertEquals(ComparisonOperator.GT, cr.getComparisonOperation());
|
||||
assertEquals("0", cr.getFormula1());
|
||||
assertEquals(null, cr.getFormula2());
|
||||
@ -652,7 +639,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
|
||||
assertEquals(1, cf.getNumberOfRules());
|
||||
cr = cf.getRule(0);
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, cr.getConditionTypeType());
|
||||
assertEquals(ConditionType.CELL_VALUE_IS, cr.getConditionType());
|
||||
assertEquals(ComparisonOperator.BETWEEN, cr.getComparisonOperation());
|
||||
assertEquals("10", cr.getFormula1());
|
||||
assertEquals("30", cr.getFormula2());
|
||||
@ -787,7 +774,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
// cr = cf.getRule(0);
|
||||
// assertIconSetPercentages(cr, IconSet.GYR_3_TRAFFIC_LIGHTS_BOX, 0d, 33d, 67d);
|
||||
// cr = cf.getRule(1);
|
||||
// assertEquals(ConditionType.FORMULA, cr.getConditionTypeType());
|
||||
// assertEquals(ConditionType.FORMULA, cr.getConditionType());
|
||||
// assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
|
||||
// // TODO Why aren't these two the same between formats?
|
||||
// if (cr instanceof HSSFConditionalFormattingRule) {
|
||||
@ -810,7 +797,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertDataBar(cr, color);
|
||||
}
|
||||
private void assertDataBar(ConditionalFormattingRule cr, String color) {
|
||||
assertEquals(ConditionType.DATA_BAR, cr.getConditionTypeType());
|
||||
assertEquals(ConditionType.DATA_BAR, cr.getConditionType());
|
||||
assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
|
||||
assertEquals(null, cr.getFormula1());
|
||||
assertEquals(null, cr.getFormula2());
|
||||
@ -841,7 +828,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertIconSetPercentages(cr, iconset, vals);
|
||||
}
|
||||
private void assertIconSetPercentages(ConditionalFormattingRule cr, IconSet iconset, Double...vals) {
|
||||
assertEquals(ConditionType.ICON_SET, cr.getConditionTypeType());
|
||||
assertEquals(ConditionType.ICON_SET, cr.getConditionType());
|
||||
assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
|
||||
assertEquals(null, cr.getFormula1());
|
||||
assertEquals(null, cr.getFormula2());
|
||||
@ -869,7 +856,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertColorScale(cr, colors);
|
||||
}
|
||||
private void assertColorScale(ConditionalFormattingRule cr, String... colors) {
|
||||
assertEquals(ConditionType.COLOR_SCALE, cr.getConditionTypeType());
|
||||
assertEquals(ConditionType.COLOR_SCALE, cr.getConditionType());
|
||||
assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
|
||||
assertEquals(null, cr.getFormula1());
|
||||
assertEquals(null, cr.getFormula2());
|
||||
@ -1152,7 +1139,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
ConditionalFormatting cf = sheetCF.getConditionalFormattingAt(0);
|
||||
assertEquals(1, cf.getNumberOfRules());
|
||||
rule1 = cf.getRule(0);
|
||||
assertEquals(ConditionType.ICON_SET, rule1.getConditionTypeType());
|
||||
assertEquals(ConditionType.ICON_SET, rule1.getConditionType());
|
||||
iconFmt = rule1.getMultiStateFormatting();
|
||||
|
||||
assertEquals(IconSet.GYRB_4_TRAFFIC_LIGHTS, iconFmt.getIconSet());
|
||||
@ -1205,7 +1192,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertEquals(1, cf.getNumberOfRules());
|
||||
rule1 = cf.getRule(0);
|
||||
clrFmt = rule1.getColorScaleFormatting();
|
||||
assertEquals(ConditionType.COLOR_SCALE, rule1.getConditionTypeType());
|
||||
assertEquals(ConditionType.COLOR_SCALE, rule1.getConditionType());
|
||||
|
||||
assertEquals(3, clrFmt.getNumControlPoints());
|
||||
assertEquals(3, clrFmt.getColors().length);
|
||||
@ -1257,7 +1244,7 @@ public abstract class BaseTestConditionalFormatting {
|
||||
assertEquals(1, cf.getNumberOfRules());
|
||||
rule1 = cf.getRule(0);
|
||||
dbFmt = rule1.getDataBarFormatting();
|
||||
assertEquals(ConditionType.DATA_BAR, rule1.getConditionTypeType());
|
||||
assertEquals(ConditionType.DATA_BAR, rule1.getConditionType());
|
||||
|
||||
assertEquals(false, dbFmt.isIconOnly());
|
||||
assertEquals(true, dbFmt.isLeftToRight());
|
||||
|
@ -23,8 +23,10 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.hssf.record.TestcaseRecordInputStream;
|
||||
import org.apache.poi.util.LittleEndianByteArrayOutputStream;
|
||||
import org.apache.poi.util.LittleEndianOutputStream;
|
||||
|
||||
|
||||
//TODO: replace junit3 with junit4 code
|
||||
import junit.framework.TestCase; //junit3
|
||||
|
||||
@ -86,33 +88,6 @@ public final class TestCellRangeAddress extends TestCase {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testStoreDeprecated() throws IOException {
|
||||
CellRangeAddress ref = new CellRangeAddress(0, 0, 0, 0);
|
||||
|
||||
byte[] recordBytes = new byte[CellRangeAddress.ENCODED_SIZE];
|
||||
// With nothing set
|
||||
ref.serialize(0, recordBytes);
|
||||
assertEquals(recordBytes.length, data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
assertEquals("At offset " + i, 0, recordBytes[i]);
|
||||
}
|
||||
|
||||
// Now set the flags
|
||||
ref.setFirstRow((short) 2);
|
||||
ref.setLastRow((short) 4);
|
||||
ref.setFirstColumn((short) 0);
|
||||
ref.setLastColumn((short) 3);
|
||||
|
||||
// Re-test
|
||||
ref.serialize(0, recordBytes);
|
||||
|
||||
assertEquals(recordBytes.length, data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
assertEquals("At offset " + i, data[i], recordBytes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void testCreateIllegal() throws IOException {
|
||||
// for some combinations we expected exceptions
|
||||
|
Loading…
Reference in New Issue
Block a user