diff --git a/src/java/org/apache/poi/hssf/record/CFRuleBase.java b/src/java/org/apache/poi/hssf/record/CFRuleBase.java index e3a91e9f5..3554039af 100644 --- a/src/java/org/apache/poi/hssf/record/CFRuleBase.java +++ b/src/java/org/apache/poi/hssf/record/CFRuleBase.java @@ -40,6 +40,7 @@ import org.apache.poi.util.POILogger; * for their rules.

*/ 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; diff --git a/src/java/org/apache/poi/hssf/record/DrawingRecord.java b/src/java/org/apache/poi/hssf/record/DrawingRecord.java index 453a7bc75..c55cafa44 100644 --- a/src/java/org/apache/poi/hssf/record/DrawingRecord.java +++ b/src/java/org/apache/poi/hssf/record/DrawingRecord.java @@ -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; } diff --git a/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java b/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java index 18aacc5cf..beee8bca6 100644 --- a/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java +++ b/src/java/org/apache/poi/hssf/record/ExternSheetRecord.java @@ -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++) { diff --git a/src/java/org/apache/poi/hssf/record/FilePassRecord.java b/src/java/org/apache/poi/hssf/record/FilePassRecord.java index 413b86504..7c8ae948f 100644 --- a/src/java/org/apache/poi/hssf/record/FilePassRecord.java +++ b/src/java/org/apache/poi/hssf/record/FilePassRecord.java @@ -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; diff --git a/src/java/org/apache/poi/hssf/record/PaneRecord.java b/src/java/org/apache/poi/hssf/record/PaneRecord.java index ea7d967ad..5bff223b2 100644 --- a/src/java/org/apache/poi/hssf/record/PaneRecord.java +++ b/src/java/org/apache/poi/hssf/record/PaneRecord.java @@ -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; diff --git a/src/java/org/apache/poi/hssf/record/PasswordRecord.java b/src/java/org/apache/poi/hssf/record/PasswordRecord.java index dc7a4c395..3277cdcb8 100644 --- a/src/java/org/apache/poi/hssf/record/PasswordRecord.java +++ b/src/java/org/apache/poi/hssf/record/PasswordRecord.java @@ -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 * diff --git a/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java b/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java index 263bdeeee..3f6a9c469 100644 --- a/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java +++ b/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java @@ -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 diff --git a/src/java/org/apache/poi/hssf/record/RecordInputStream.java b/src/java/org/apache/poi/hssf/record/RecordInputStream.java index 126092bd4..2b66bd80a 100644 --- a/src/java/org/apache/poi/hssf/record/RecordInputStream.java +++ b/src/java/org/apache/poi/hssf/record/RecordInputStream.java @@ -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() { diff --git a/src/java/org/apache/poi/hssf/record/UnicodeString.java b/src/java/org/apache/poi/hssf/record/UnicodeString.java deleted file mode 100644 index a8c23dfd9..000000000 --- a/src/java/org/apache/poi/hssf/record/UnicodeString.java +++ /dev/null @@ -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); - } -} diff --git a/src/java/org/apache/poi/hssf/record/WindowOneRecord.java b/src/java/org/apache/poi/hssf/record/WindowOneRecord.java index ffed2164e..e2b9e2c4d 100644 --- a/src/java/org/apache/poi/hssf/record/WindowOneRecord.java +++ b/src/java/org/apache/poi/hssf/record/WindowOneRecord.java @@ -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 not @@ -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 diff --git a/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java b/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java index a56f9bd52..d7f0ec477 100644 --- a/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java +++ b/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java @@ -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 diff --git a/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java b/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java index 68b3e9e48..0319af64e 100644 --- a/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java +++ b/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java @@ -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); diff --git a/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java b/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java index 14415ae9b..5713d75e5 100644 --- a/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java +++ b/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java @@ -359,33 +359,6 @@ public final class ValueRecordsAggregate implements Iterable temp = new ArrayList(); - - 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()"); } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java index bf317b01d..08825ce35 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java @@ -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) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java b/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java index f27675f71..b52ea9102 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java @@ -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(); } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java index 52b10f899..06afe8296 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java @@ -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; diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFName.java b/src/java/org/apache/poi/hssf/usermodel/HSSFName.java index dc20afd1f..13818f5b2 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFName.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFName.java @@ -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); diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java index 7bf6721b1..c3354d6aa 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java @@ -95,18 +95,6 @@ public final class HSSFRow implements Row, Comparable { // 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. *

@@ -342,14 +330,6 @@ public final class HSSFRow implements Row, Comparable { 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 diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index cfae1e92c..20a31e907 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -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 getSelectedTabs() { + Collection indexes = new ArrayList(); + int nSheets = _sheets.size(); + for (int i=0; i excepts ) diff --git a/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java b/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java index 99b7ab393..11f18a40a 100644 --- a/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java +++ b/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java @@ -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. diff --git a/src/java/org/apache/poi/ss/formula/LazyRefEval.java b/src/java/org/apache/poi/ss/formula/LazyRefEval.java index a483992f9..e0b5e19f9 100644 --- a/src/java/org/apache/poi/ss/formula/LazyRefEval.java +++ b/src/java/org/apache/poi/ss/formula/LazyRefEval.java @@ -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()); } diff --git a/src/java/org/apache/poi/ss/formula/eval/BlankEval.java b/src/java/org/apache/poi/ss/formula/eval/BlankEval.java index b49b2992a..845e7deaa 100644 --- a/src/java/org/apache/poi/ss/formula/eval/BlankEval.java +++ b/src/java/org/apache/poi/ss/formula/eval/BlankEval.java @@ -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 diff --git a/src/java/org/apache/poi/ss/usermodel/ConditionalFormattingRule.java b/src/java/org/apache/poi/ss/usermodel/ConditionalFormattingRule.java index 199e45e35..28f5d2258 100644 --- a/src/java/org/apache/poi/ss/usermodel/ConditionalFormattingRule.java +++ b/src/java/org/apache/poi/ss/usermodel/ConditionalFormattingRule.java @@ -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. - *

- * MUST be one of the IDs of a {@link ConditionType} - *

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

* MUST be a constant from {@link ComparisonOperator} *

@@ -125,13 +98,13 @@ public interface ConditionalFormattingRule { /** * The formula used to evaluate the first operand for the conditional formatting rule. *

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

*

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

* * @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 diff --git a/src/java/org/apache/poi/ss/util/CellRangeAddress.java b/src/java/org/apache/poi/ss/util/CellRangeAddress.java index 1f40cf693..df8533f31 100644 --- a/src/java/org/apache/poi/ss/util/CellRangeAddress.java +++ b/src/java/org/apache/poi/ss/util/CellRangeAddress.java @@ -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()); diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingRule.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingRule.java index dc2e6f629..a639f2c27 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingRule.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingRule.java @@ -297,34 +297,22 @@ public class XSSFConditionalFormattingRule implements ConditionalFormattingRule /** * Type of conditional formatting rule. - *

- * MUST be one of the IDs of a {@link ConditionType} - *

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

* MUST be a constant from {@link org.apache.poi.ss.usermodel.ComparisonOperator} *

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

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

*

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

* * @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 diff --git a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java index 589821ea0..d48fb0da3 100644 --- a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java +++ b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java @@ -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); diff --git a/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java index 0cde3e47d..e6a316791 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java @@ -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()); } diff --git a/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java b/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java index 2bdc7f051..7403c0c1b 100644 --- a/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java +++ b/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java @@ -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 getValueRecords() { + List list = new ArrayList(); + 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 records = new ArrayList(); @@ -63,11 +71,11 @@ public final class TestValueRecordsAggregate { records.add(new WindowTwoRecord()); constructValueRecord(records); - CellValueRecordInterface[] cvrs = valueRecord.getValueRecords(); + List 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 ); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index 65a6422cf..d8fcf6bcc 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -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(); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java index 72691ff69..5509cbf71 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java @@ -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()); diff --git a/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java b/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java index 431c80c78..8198f56b4 100644 --- a/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java +++ b/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java @@ -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