Author: fanningpj
Date: Wed Sep 14 01:12:38 2022
New Revision: 1904050
URL: http://svn.apache.org/viewvc?rev=1904050&view=rev
Log:
try to use IllegalStateException instead of RuntimeException
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java
poi/trunk/poi/src/main/java/org/apache/poi/common/usermodel/fonts/FontHeader.java
poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherMetafileBlip.java
poi/trunk/poi/src/main/java/org/apache/poi/hpsf/VariantSupport.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/ExcelExtractor.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/LinkTable.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SubRecord.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/FontDetails.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java
poi/trunk/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryUtils.java
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSStream.java
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/SLGraphics.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFracCalculator.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunctionUtils.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Lookup.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/MultiOperandNumericFunction.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Area3DPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ErrPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExpPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/FuncPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NamePtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ref3DPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/TblPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeUtil.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java
poi/trunk/poi/src/main/java/org/apache/poi/util/HexRead.java
poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java
poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java
poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java
poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianOutputStream.java
poi/trunk/poi/src/main/java/org/apache/poi/util/XMLHelper.java
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java
Wed Sep 14 01:12:38 2022
@@ -447,6 +447,11 @@ public class HemfPlusImage {
return new Rectangle2D.Double(1,1,1,1);
}
+ /**
+ * @param continuedObjectData list of object data
+ * @return byte array
+ * @throws IllegalStateException if the data cannot be read
+ */
public byte[] getRawData(List<? extends EmfPlusObjectData>
continuedObjectData) {
try (UnsynchronizedByteArrayOutputStream bos = new
UnsynchronizedByteArrayOutputStream()) {
bos.write(getImageData());
@@ -457,7 +462,7 @@ public class HemfPlusImage {
}
return bos.toByteArray();
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -491,7 +496,7 @@ public class HemfPlusImage {
private HemfPlusGDIImageRenderer getGDIRenderer() {
if (getImageDataType() != EmfPlusImageDataType.BITMAP ||
getBitmapType() != EmfPlusBitmapDataType.PIXEL) {
- throw new RuntimeException("image data is not a GDI image");
+ throw new IllegalStateException("image data is not a GDI
image");
}
HemfPlusGDIImageRenderer renderer = new HemfPlusGDIImageRenderer();
renderer.setWidth(getBitmapWidth());
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java
(original)
+++
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java
Wed Sep 14 01:12:38 2022
@@ -474,7 +474,7 @@ public class HemfPlusPen {
// A 32-bit unsigned integer that specifies the number of
elements in the DashedLineData field.
int dashesSize = leis.readInt();
if (dashesSize < 0 || dashesSize > 1000) {
- throw new RuntimeException("Invalid dash data size");
+ throw new IllegalStateException("Invalid dash data size");
}
// An array of DashedLineDataSize floating-point values that
specify the lengths of the dashes and spaces in a dashed line.
@@ -499,7 +499,7 @@ public class HemfPlusPen {
// A 32-bit unsigned integer that specifies the number of
elements in the CompoundLineData field.
int compoundSize = leis.readInt();
if (compoundSize < 0 || compoundSize > 1000) {
- throw new RuntimeException("Invalid compound line data
size");
+ throw new IllegalStateException("Invalid compound line
data size");
}
// An array of CompoundLineDataSize floating-point values that
specify the compound line of a pen.
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/common/usermodel/fonts/FontHeader.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/common/usermodel/fonts/FontHeader.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/common/usermodel/fonts/FontHeader.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/common/usermodel/fonts/FontHeader.java
Wed Sep 14 01:12:38 2022
@@ -149,7 +149,7 @@ public class FontHeader implements FontI
fontDataSize = leis.readInt();
version = leis.readInt();
if (version != 0x00010000 && version != 0x00020001 && version !=
0x00020002) {
- throw new RuntimeException("not a EOT font data stream");
+ throw new IllegalStateException("not a EOT font data stream");
}
flags = leis.readInt();
leis.readFully(panose);
@@ -159,7 +159,7 @@ public class FontHeader implements FontI
fsType = leis.readUShort();
magic = leis.readUShort();
if (magic != 0x504C) {
- throw new RuntimeException("not a EOT font data stream");
+ throw new IllegalStateException("not a EOT font data stream");
}
unicodeRange1 = leis.readInt();
unicodeRange2 = leis.readInt();
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherChildAnchorRecord.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherChildAnchorRecord.java
Wed Sep 14 01:12:38 2022
@@ -69,7 +69,7 @@ public class EscherChildAnchorRecord ext
field_4_dy2 = LittleEndian.getShort( data, pos + size );size+=2;
break;
default:
- throw new RuntimeException("Invalid EscherChildAnchorRecord -
neither 8 nor 16 bytes.");
+ throw new IllegalStateException("Invalid EscherChildAnchorRecord -
neither 8 nor 16 bytes.");
}
return 8 + size;
Modified: poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherMetafileBlip.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherMetafileBlip.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherMetafileBlip.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherMetafileBlip.java Wed
Sep 14 01:12:38 2022
@@ -416,7 +416,7 @@ public final class EscherMetafileBlip ex
}
raw_pictureData = bos.toByteArray();
} catch (IOException e) {
- throw new RuntimeException("Can't compress metafile picture data",
e);
+ throw new IllegalStateException("Can't compress metafile picture
data", e);
}
setCompressedSize(raw_pictureData.length);
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hpsf/VariantSupport.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hpsf/VariantSupport.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hpsf/VariantSupport.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hpsf/VariantSupport.java Wed Sep
14 01:12:38 2022
@@ -177,7 +177,7 @@ public class VariantSupport extends Vari
final byte[] v = IOUtils.toByteArray(lei, length,
CodePageString.getMaxRecordLength());
throw new ReadingNotSupportedException( type, v );
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java
Wed Sep 14 01:12:38 2022
@@ -140,7 +140,7 @@ public class EventBasedExcelExtractor im
text = text + "\n";
}
} catch(IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
return text;
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/ExcelExtractor.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/ExcelExtractor.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/ExcelExtractor.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/extractor/ExcelExtractor.java
Wed Sep 14 01:12:38 2022
@@ -360,7 +360,7 @@ public class ExcelExtractor implements P
}
break;
default:
- throw new RuntimeException("Unexpected cell
type (" + cell.getCellType() + ")");
+ throw new IllegalStateException("Unexpected
cell type (" + cell.getCellType() + ")");
}
// Output the comment, if requested and exists
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
Wed Sep 14 01:12:38 2022
@@ -723,7 +723,7 @@ public final class InternalWorkbook {
private void checkSheets(int sheetnum) {
if ((boundsheets.size()) <= sheetnum) { // if we're short one add
another..
if ((boundsheets.size() + 1) <= sheetnum) {
- throw new RuntimeException("Sheet number out of bounds!");
+ throw new IllegalStateException("Sheet number out of bounds!");
}
BoundSheetRecord bsr = createBoundSheet(sheetnum);
@@ -1640,7 +1640,7 @@ public final class InternalWorkbook {
NameRecord name = new NameRecord(builtInName, sheetNumber);
if(linkTable.nameAlreadyExists(name)) {
- throw new RuntimeException("Builtin (" + builtInName
+ throw new IllegalStateException("Builtin (" + builtInName
+ ") already exists for sheet (" + sheetNumber + ")");
}
addName(name);
@@ -1813,7 +1813,7 @@ public final class InternalWorkbook {
if (rec instanceof PaletteRecord) {
palette = (PaletteRecord) rec;
} else {
- throw new RuntimeException("InternalError: Expected
PaletteRecord but got a '"+rec+"'");
+ throw new IllegalStateException("InternalError: Expected
PaletteRecord but got a '"+rec+"'");
}
} else {
palette = createPalette();
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/LinkTable.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/LinkTable.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/LinkTable.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/model/LinkTable.java Wed
Sep 14 01:12:38 2022
@@ -243,7 +243,7 @@ final class LinkTable {
int nItems = temp.size();
if (nItems < 1) {
- throw new RuntimeException("Expected an EXTERNSHEET record but got
("
+ throw new IllegalStateException("Expected an EXTERNSHEET record
but got ("
+ rs.peekNextClass().getName() + ")");
}
if (nItems == 1) {
@@ -274,7 +274,7 @@ final class LinkTable {
if (idx < 0) {
idx = findFirstRecordLocBySid(SSTRecord.sid) - 1;
if (idx < 0) {
- throw new RuntimeException("CountryRecord or SSTRecord not
found");
+ throw new IllegalStateException("CountryRecord or SSTRecord
not found");
}
}
_workbookRecordList.add(idx + 1, _externSheetRecord);
@@ -443,7 +443,7 @@ final class LinkTable {
public int getExternalSheetIndex(String workbookName, String
firstSheetName, String lastSheetName) {
int externalBookIndex = getExternalWorkbookIndex(workbookName);
if (externalBookIndex == -1) {
- throw new RuntimeException("No external workbook with name '" +
workbookName + "'");
+ throw new IllegalStateException("No external workbook with name '"
+ workbookName + "'");
}
SupBookRecord ebrTarget =
_externalBookBlocks[externalBookIndex].getExternalBookRecord();
@@ -465,7 +465,7 @@ final class LinkTable {
}
}
- throw new RuntimeException("External workbook does not contain sheet
'" + sheetName + "'");
+ throw new IllegalStateException("External workbook does not contain
sheet '" + sheetName + "'");
}
/**
@@ -508,10 +508,10 @@ final class LinkTable {
}
}
if (thisWbIndex < 0) {
- throw new RuntimeException("Could not find 'internal references'
EXTERNALBOOK");
+ throw new IllegalStateException("Could not find 'internal
references' EXTERNALBOOK");
}
if (_externSheetRecord == null) {
- throw new RuntimeException("Did not have an external sheet record,
having blocks: " +
+ throw new IllegalStateException("Did not have an external sheet
record, having blocks: " +
_externalBookBlocks.length);
}
@@ -543,7 +543,7 @@ final class LinkTable {
int firstTabIndex =
_externSheetRecord.getFirstSheetIndexFromRefIndex(refIndex);
if (firstTabIndex == -1) {
// The referenced sheet could not be found
- throw new RuntimeException("Referenced sheet could not be found");
+ throw new IllegalStateException("Referenced sheet could not be
found");
}
// Does it exist via the external book block?
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EmbeddedObjectRefSubRecord.java
Wed Sep 14 01:12:38 2022
@@ -190,7 +190,7 @@ public final class EmbeddedObjectRefSubR
}
return null;
} catch (IOException e) {
- throw new RuntimeException("Unexpected exception in readRefPtg",
e);
+ throw new IllegalStateException("Unexpected exception in
readRefPtg", e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java
Wed Sep 14 01:12:38 2022
@@ -1040,7 +1040,7 @@ public final class EscherAggregate exten
try {
buffer.write(data);
} catch (IOException e) {
- throw new RuntimeException("Couldn't get data from
drawing/continue records", e);
+ throw new IllegalStateException("Couldn't get data from
drawing/continue records", e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SharedFormulaRecord.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
Wed Sep 14 01:12:38 2022
@@ -95,7 +95,7 @@ public final class SharedFormulaRecord e
int formulaColumn = formula.getColumn();
//Sanity checks
if (!isInRange(formulaRow, formulaColumn)) {
- throw new RuntimeException("Shared Formula Conversion: Coding
Error");
+ throw new IllegalStateException("Shared Formula Conversion: Coding
Error");
}
SharedFormula sf = new SharedFormula(SpreadsheetVersion.EXCEL97);
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SubRecord.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SubRecord.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SubRecord.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/SubRecord.java Wed
Sep 14 01:12:38 2022
@@ -139,7 +139,7 @@ public abstract class SubRecord implemen
UnsynchronizedByteArrayOutputStream baos = new
UnsynchronizedByteArrayOutputStream(size);
serialize(new LittleEndianOutputStream(baos));
if (baos.size() != size) {
- throw new RuntimeException("write size mismatch");
+ throw new IllegalStateException("write size mismatch");
}
return baos.toByteArray();
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
Wed Sep 14 01:12:38 2022
@@ -53,7 +53,7 @@ public final class ColumnInfoRecordsAggr
cirPrev = cir;
}
if (records.size() < 1) {
- throw new RuntimeException("No column info records found");
+ throw new IllegalStateException("No column info records found");
}
if (!isInOrder) {
records.sort(ColumnInfoRecordsAggregate::compareColInfos);
@@ -97,7 +97,7 @@ public final class ColumnInfoRecordsAggr
if (cirPrev != null && compareColInfos(cirPrev, cir) > 0) {
// Excel probably wouldn't mind, but there is much logic in
this class
// that assumes the column info records are kept in order
- throw new RuntimeException("Column info records are out of
order");
+ throw new IllegalStateException("Column info records are out
of order");
}
cirPrev = cir;
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
Wed Sep 14 01:12:38 2022
@@ -101,15 +101,15 @@ public final class ValueRecordsAggregate
}
int row = cell.getRow();
if (row >= records.length) {
- throw new RuntimeException("cell row is out of range");
+ throw new IllegalStateException("cell row is out of range");
}
CellValueRecordInterface[] rowCells = records[row];
if (rowCells == null) {
- throw new RuntimeException("cell row is already empty");
+ throw new IllegalStateException("cell row is already empty");
}
short column = cell.getColumn();
if (column >= rowCells.length) {
- throw new RuntimeException("cell column is out of range");
+ throw new IllegalStateException("cell column is out of range");
}
rowCells[column] = null;
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java
Wed Sep 14 01:12:38 2022
@@ -99,7 +99,7 @@ public final class Biff8DecryptingStream
double result = Double.longBitsToDouble(valueLongBits);
if (Double.isNaN(result)) {
// (Because Excel typically doesn't write NaN
- throw new RuntimeException("Did not expect to read NaN");
+ throw new IllegalStateException("Did not expect to read NaN");
}
return result;
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/DVConstraint.java
Wed Sep 14 01:12:38 2022
@@ -231,7 +231,7 @@ public class DVConstraint implements Dat
try {
return Double.valueOf(numberStr);
} catch (NumberFormatException e) {
- throw new RuntimeException("The supplied text '" + numberStr
+ throw new IllegalStateException("The supplied text '" + numberStr
+ "' could not be parsed as a number");
}
}
@@ -260,7 +260,7 @@ public class DVConstraint implements Dat
try {
dateVal = dateFormat.parse(dateStr);
} catch (ParseException e) {
- throw new RuntimeException("Failed to parse date '" + dateStr
+ throw new IllegalStateException("Failed to parse date '" +
dateStr
+ "' using specified format '" + dateFormat + "'", e);
}
}
@@ -323,7 +323,7 @@ public class DVConstraint implements Dat
@Override
public void setExplicitListValues(String[] explicitListValues) {
if (_validationType != ValidationType.LIST) {
- throw new RuntimeException("Cannot setExplicitListValues on
non-list constraint");
+ throw new IllegalStateException("Cannot setExplicitListValues on
non-list constraint");
}
_formula1 = null;
_explicitListValues = explicitListValues;
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/FontDetails.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/FontDetails.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/FontDetails.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/FontDetails.java
Wed Sep 14 01:12:38 2022
@@ -116,7 +116,7 @@ public class FontDetails
String[] charactersStrArray = split(charactersStr, ",", -1);
String[] widthsStrArray = split(widthsStr, ",", -1);
if (charactersStrArray.length != widthsStrArray.length)
- throw new RuntimeException("Number of characters does not number
of widths for font " + fontName);
+ throw new IllegalStateException("Number of characters does not
number of widths for font " + fontName);
for ( int i = 0; i < widthsStrArray.length; i++ )
{
if (charactersStrArray[i].length() != 0)
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java Wed
Sep 14 01:12:38 2022
@@ -219,7 +219,7 @@ public class HSSFCell extends CellBase {
? CellType.BOOLEAN
: CellType.ERROR;
}
- throw new RuntimeException("Bad cell value rec (" +
cval.getClass().getName() + ")");
+ throw new IllegalStateException("Bad cell value rec (" +
cval.getClass().getName() + ")");
}
/**
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
Wed Sep 14 01:12:38 2022
@@ -214,7 +214,7 @@ public class HSSFFormulaEvaluator extend
if (eval instanceof ErrorEval) {
return CellValue.getError(((ErrorEval)eval).getErrorCode());
}
- throw new RuntimeException("Unexpected eval class (" +
eval.getClass().getName() + ")");
+ throw new IllegalStateException("Unexpected eval class (" +
eval.getClass().getName() + ")");
}
@Override
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java
Wed Sep 14 01:12:38 2022
@@ -173,7 +173,7 @@ public final class HSSFPalette {
return getColor(i);
}
}
- throw new RuntimeException("Could not find free color index");
+ throw new IllegalStateException("Could not find free color index");
}
private static final class CustomColor extends HSSFColor {
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java Wed
Sep 14 01:12:38 2022
@@ -171,10 +171,10 @@ public final class HSSFRow implements Ro
int column=cell.getColumnIndex();
if(column < 0) {
- throw new RuntimeException("Negative cell indexes not allowed");
+ throw new IllegalStateException("Negative cell indexes not
allowed");
}
if(column >= cells.length || cell != cells[column]) {
- throw new RuntimeException("Specified cell is not from this row");
+ throw new IllegalStateException("Specified cell is not from this
row");
}
if(cell.isPartOfArrayFormulaGroup()){
cell.tryToDeleteArrayFormula(null);
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
Wed Sep 14 01:12:38 2022
@@ -227,7 +227,7 @@ public final class HSSFSheet implements
// Excel, OpenOffice.org and GoogleDocs are all OK with
this, so POI should be too.
if (rowRecordsAlreadyPresent) {
// if at least one row record is present, all should
be present.
- throw new RuntimeException("Unexpected missing row
when some rows already present");
+ throw new IllegalStateException("Unexpected missing
row when some rows already present");
}*/
// create the row record on the fly now.
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
Wed Sep 14 01:12:38 2022
@@ -1156,7 +1156,7 @@ public final class HSSFWorkbook extends
for (int defNameIndex = 0; defNameIndex < names.size();
defNameIndex++) {
NameRecord r = workbook.getNameRecord(defNameIndex);
if (r == null) {
- throw new RuntimeException("Unable to find all defined names
to iterate over");
+ throw new IllegalStateException("Unable to find all defined
names to iterate over");
}
if (!r.isBuiltInName() || r.getBuiltInName() != builtinCode) {
continue;
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java
Wed Sep 14 01:12:38 2022
@@ -59,7 +59,7 @@ final class StaticFontMetrics {
try {
fontMetricsProps = loadMetrics();
} catch (IOException e) {
- throw new RuntimeException("Could not load font metrics", e);
+ throw new IllegalStateException("Could not load font metrics",
e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
Wed Sep 14 01:12:38 2022
@@ -236,7 +236,7 @@ public abstract class ChunkedCipherInput
}
} catch (IOException e) {
// need to wrap checked exception, because of LittleEndianInput
interface :(
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryNode.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/DirectoryNode.java
Wed Sep 14 01:12:38 2022
@@ -232,7 +232,7 @@ public class DirectoryNode
_filesystem.remove(entry);
} catch (IOException e) {
// TODO Work out how to report this, given we can't change the
method signature...
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
return rval;
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryUtils.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryUtils.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryUtils.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/EntryUtils.java
Wed Sep 14 01:12:38 2022
@@ -238,7 +238,7 @@ public final class EntryUtils {
return isEqual(inpA, inpB);
}
} catch (NoPropertySetStreamException | IOException ex) {
- throw new RuntimeException(ex);
+ throw new IllegalStateException(ex);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
Wed Sep 14 01:12:38 2022
@@ -370,7 +370,7 @@ public class POIFSFileSystem extends Blo
stream.close();
} catch (IOException e) {
if (success) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
// else not success? Try block did not complete normally
// just print stack trace and leave original ex to be thrown
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSStream.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSStream.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSStream.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSStream.java
Wed Sep 14 01:12:38 2022
@@ -158,7 +158,7 @@ public class POIFSStream implements Iter
try {
this.loopDetector = blockStore.getChainLoopDetector();
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -194,7 +194,7 @@ public class POIFSStream implements Iter
try {
this.loopDetector = blockStore.getChainLoopDetector();
} catch(IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -213,7 +213,7 @@ public class POIFSStream implements Iter
nextBlock = blockStore.getNextBlock(nextBlock);
return data;
} catch(IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/TempFilePOIFSFileSystem.java
Wed Sep 14 01:12:38 2022
@@ -41,7 +41,7 @@ public class TempFilePOIFSFileSystem ext
tempFile = TempFile.createTempFile("poifs", ".tmp");
_data = new FileBackedDataSource(tempFile, false);
} catch (IOException e) {
- throw new RuntimeException("Failed to create data source", e);
+ throw new IllegalStateException("Failed to create data source", e);
}
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/SLGraphics.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/SLGraphics.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/SLGraphics.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/SLGraphics.java Wed Sep
14 01:12:38 2022
@@ -1659,7 +1659,7 @@ public class SLGraphics extends Graphics
try {
return (Graphics)clone();
} catch (CloneNotSupportedException e){
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/PresetGeometries.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
Wed Sep 14 01:12:38 2022
@@ -59,7 +59,7 @@ public final class PresetGeometries {
}
}
} catch (IOException | XMLStreamException e){
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java
Wed Sep 14 01:12:38 2022
@@ -110,7 +110,7 @@ public class SimpleFraction {
return new SimpleFraction((int)p1, (int)q1);
}
if ((p2 > overflow) || (q2 > overflow)) {
- throw new RuntimeException("Overflow trying to convert
"+value+" to fraction ("+p2+"/"+q2+")");
+ throw new IllegalStateException("Overflow trying to convert
"+value+" to fraction ("+p2+"/"+q2+")");
}
double convergent = (double)p2 / (double)q2;
@@ -127,7 +127,7 @@ public class SimpleFraction {
} while (!stop);
if (n >= maxIterations) {
- throw new RuntimeException("Unable to convert "+value+" to
fraction after "+maxIterations+" iterations");
+ throw new IllegalStateException("Unable to convert "+value+" to
fraction after "+maxIterations+" iterations");
}
if (q2 < maxDenominator) {
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java
Wed Sep 14 01:12:38 2022
@@ -130,7 +130,7 @@ public final class CollaboratingWorkbook
for (WorkbookEvaluator evaluator : evaluators) {
if (evalListener != evaluator.getEvaluationListener()) {
// This would be very complex to support
- throw new RuntimeException("Workbook evaluators must all have
the same evaluation listener");
+ throw new IllegalStateException("Workbook evaluators must all
have the same evaluation listener");
}
}
EvaluationCache cache = new EvaluationCache(evalListener);
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java
Wed Sep 14 01:12:38 2022
@@ -214,10 +214,10 @@ public final class FormulaParser {
}
/** Read New Character From Input Stream */
- private void GetChar() {
+ private void nextChar() {
// The intersection operator is a space. We track whether the run of
// whitespace preceding "look" counts as an intersection operator.
- if (IsWhite(look)) {
+ if (isWhite(look)) {
if (look == ' ') {
_inIntersection = true;
}
@@ -228,7 +228,7 @@ public final class FormulaParser {
// Check to see if we've walked off the end of the string.
if (_pointer > _formulaLength) {
- throw new RuntimeException("Parsed past the end of the formula,
pos: " + _pointer +
+ throw new IllegalStateException("Parsed past the end of the
formula, pos: " + _pointer +
", length: " + _formulaLength + ", formula: " +
_formulaString);
}
if (_pointer < _formulaLength) {
@@ -275,24 +275,24 @@ public final class FormulaParser {
}
/** Recognize an Alpha Character */
- private static boolean IsAlpha(int c) {
+ private static boolean isAlpha(int c) {
return Character.isLetter(c) || c == '$' || c=='_';
}
/** Recognize a Decimal Digit */
- private static boolean IsDigit(int c) {
+ private static boolean isDigit(int c) {
return Character.isDigit(c);
}
/** Recognize White Space */
- private static boolean IsWhite(int c) {
+ private static boolean isWhite(int c) {
return c ==' ' || c== TAB || c == CR || c == LF;
}
/** Skip Over Leading White Space */
- private void SkipWhite() {
- while (IsWhite(look)) {
- GetChar();
+ private void skipWhite() {
+ while (isWhite(look)) {
+ nextChar();
}
}
@@ -301,7 +301,7 @@ public final class FormulaParser {
* unchecked exception. This method does <b>not</b> consume whitespace
(before or after the
* matched character).
*/
- private void Match(int x) {
+ private void match(int x) {
if (look != x) {
throw expected(new StringBuilder()
.append("'")
@@ -309,16 +309,16 @@ public final class FormulaParser {
.append("'")
.toString());
}
- GetChar();
+ nextChar();
}
/** Get a Number */
- private String GetNum() {
+ private String nextNum() {
StringBuilder value = new StringBuilder();
- while (IsDigit(this.look)){
+ while (isDigit(this.look)){
value.appendCodePoint(this.look);
- GetChar();
+ nextChar();
}
return value.length() == 0 ? null : value.toString();
}
@@ -328,7 +328,7 @@ public final class FormulaParser {
boolean hasRange = false;
while (look == ':') {
int pos = _pointer;
- GetChar();
+ nextChar();
ParseNode nextPart = parseRangeable();
// Note - no range simplification here. An expr like
"A1:B2:C3:D4:E5" should be
// grouped into area ref pairs like: "(A1:B2):(C3:D4):E5"
@@ -464,14 +464,14 @@ public final class FormulaParser {
*
*/
private ParseNode parseRangeable() {
- SkipWhite();
+ skipWhite();
int savePointer = _pointer;
SheetIdentifier sheetIden = parseSheetName(false);
if (sheetIden == null) {
resetPointer(savePointer);
} else {
- SkipWhite();
+ skipWhite();
savePointer = _pointer;
}
@@ -497,15 +497,15 @@ public final class FormulaParser {
}
return parseNonRange(savePointer);
}
- boolean whiteAfterPart1 = IsWhite(look);
+ boolean whiteAfterPart1 = isWhite(look);
if (whiteAfterPart1) {
- SkipWhite();
+ skipWhite();
}
if (look == ':') {
int colonPos = _pointer;
- GetChar();
- SkipWhite();
+ nextChar();
+ skipWhite();
SimpleRangePart part2 = parseSimpleRangePart();
if (part2 != null && !part1.isCompatibleForArea(part2)) {
// second part is not compatible with an area ref e.g.
S!A1:S!B2
@@ -529,15 +529,15 @@ public final class FormulaParser {
}
if (look == '.') {
- GetChar();
+ nextChar();
int dotCount = 1;
while (look =='.') {
dotCount ++;
- GetChar();
+ nextChar();
}
- boolean whiteBeforePart2 = IsWhite(look);
+ boolean whiteBeforePart2 = isWhite(look);
- SkipWhite();
+ skipWhite();
SimpleRangePart part2 = parseSimpleRangePart();
String part1And2 = _formulaString.substring(savePointer-1,
_pointer-1);
if (part2 == null) {
@@ -635,7 +635,7 @@ public final class FormulaParser {
// Do NOT return before done reading all the structured reference
tokens from the input stream.
// Throwing exceptions is okay.
int savePtr0 = _pointer;
- GetChar();
+ nextChar();
boolean isTotalsSpec = false;
boolean isThisRowSpec = false;
@@ -671,16 +671,16 @@ public final class FormulaParser {
}
nSpecQuantifiers++;
if (look == ','){
- GetChar();
+ nextChar();
} else {
break;
}
}
boolean isThisRow = false;
- SkipWhite();
+ skipWhite();
if (look == '@') {
isThisRow = true;
- GetChar();
+ nextChar();
}
// parse column quantifier
String endColumnName = null;
@@ -694,7 +694,7 @@ public final class FormulaParser {
if (look == ','){
throw new FormulaParseException("The formula "+ _formulaString
+ " is illegal: you should not use ',' with column quantifiers");
} else if (look == ':') {
- GetChar();
+ nextChar();
endColumnName = parseAsColumnQuantifier();
nColQuantifiers++;
if (endColumnName == null) {
@@ -738,7 +738,7 @@ public final class FormulaParser {
}
}
} else {
- Match(']');
+ match(']');
}
// Done reading from input stream
// Ok to return now
@@ -836,19 +836,19 @@ public final class FormulaParser {
if ( look != '[') {
return null;
}
- GetChar();
+ nextChar();
if (look == '#') {
return null;
}
if (look == '@') {
- GetChar();
+ nextChar();
}
StringBuilder name = new StringBuilder();
while (look!=']') {
name.appendCodePoint(look);
- GetChar();
+ nextChar();
}
- Match(']');
+ match(']');
return name.toString();
}
/**
@@ -859,16 +859,16 @@ public final class FormulaParser {
if ( look != '[') {
return null;
}
- GetChar();
+ nextChar();
if( look != '#') {
return null;
}
- GetChar();
+ nextChar();
String name = parseAsName();
if ( name.equals("This")) {
name = name + ' ' + parseAsName();
}
- Match(']');
+ match(']');
return name;
}
@@ -934,9 +934,9 @@ public final class FormulaParser {
}
while (isValidDefinedNameChar(look)) {
sb.appendCodePoint(look);
- GetChar();
+ nextChar();
}
- SkipWhite();
+ skipWhite();
return sb.toString();
}
@@ -1142,12 +1142,12 @@ public final class FormulaParser {
private String getBookName() {
StringBuilder sb = new StringBuilder();
- GetChar();
+ nextChar();
while (look != ']') {
sb.appendCodePoint(look);
- GetChar();
+ nextChar();
}
- GetChar();
+ nextChar();
return sb.toString();
}
@@ -1165,7 +1165,7 @@ public final class FormulaParser {
if (look == '\'' || isSndPartOfQuotedRange) {
if (!isSndPartOfQuotedRange) {
- Match('\'');
+ match('\'');
}
if (look == '[')
@@ -1175,14 +1175,14 @@ public final class FormulaParser {
boolean done = look == '\'';
while(!done) {
sb.appendCodePoint(look);
- GetChar();
+ nextChar();
switch (look){
case '\'' : {
- GetChar();
+ nextChar();
if (look == '\''){
// Any single quotes which were already present in
the sheet name will be converted to double single quotes ('')
// so switch back to single quote
- GetChar();
+ nextChar();
break;
}
}
@@ -1193,9 +1193,9 @@ public final class FormulaParser {
NameIdentifier iden = new NameIdentifier(sb.toString(), true);
// quoted identifier - can't concatenate anything more
- SkipWhite();
+ skipWhite();
if (look == '!') {
- GetChar();
+ nextChar();
return new SheetIdentifier(bookName, iden);
}
// See if it's a multi-sheet range, eg Sheet1:Sheet3!A1
@@ -1211,15 +1211,15 @@ public final class FormulaParser {
// can concatenate idens with dots
while (isUnquotedSheetNameChar(look)) {
sb.appendCodePoint(look);
- GetChar();
+ nextChar();
}
if (look == '\'') {
- GetChar();
+ nextChar();
}
NameIdentifier iden = new NameIdentifier(sb.toString(), false);
- SkipWhite();
+ skipWhite();
if (look == '!') {
- GetChar();
+ nextChar();
return new SheetIdentifier(bookName, iden);
}
// See if it's a multi-sheet range, eg Sheet1:Sheet3!A1
@@ -1230,7 +1230,7 @@ public final class FormulaParser {
}
if (look == '!' && bookName != null) {
// Raw book reference, without a sheet
- GetChar();
+ nextChar();
return new SheetIdentifier(bookName, null);
}
return null;
@@ -1241,7 +1241,7 @@ public final class FormulaParser {
* Sheet1, see if it's actually a range eg Sheet1:Sheet2!
*/
private SheetIdentifier parseSheetRange(String bookname, NameIdentifier
sheet1Name, boolean isSndPartOfQuotedRange) {
- GetChar();
+ nextChar();
SheetIdentifier sheet2 = parseSheetName(isSndPartOfQuotedRange);
if (sheet2 != null) {
return new SheetRangeIdentifier(bookname, sheet1Name,
sheet2.getSheetIdentifier());
@@ -1290,7 +1290,7 @@ public final class FormulaParser {
if(isFunc){
int savePointer = _pointer;
resetPointer(_pointer + str.length());
- SkipWhite();
+ skipWhite();
// open bracket indicates that the argument is a function,
// the returning value should be false, i.e. "not a valid cell
reference"
result = look != '(';
@@ -1356,9 +1356,9 @@ public final class FormulaParser {
}
}
- Match('(');
+ match('(');
ParseNode[] args = Arguments();
- Match(')');
+ match(')');
return getFunction(name, nameToken, args);
}
@@ -1465,14 +1465,14 @@ public final class FormulaParser {
private ParseNode[] Arguments() {
//average 2 args per function
List<ParseNode> temp = new ArrayList<>(2);
- SkipWhite();
+ skipWhite();
if(look == ')') {
return ParseNode.EMPTY_ARRAY;
}
boolean missedPrevArg = true;
while (true) {
- SkipWhite();
+ skipWhite();
if (isArgumentDelimiter(look)) {
if (missedPrevArg) {
temp.add(new ParseNode(MissingArgPtg.instance));
@@ -1480,13 +1480,13 @@ public final class FormulaParser {
if (look == ')') {
break;
}
- Match(',');
+ match(',');
missedPrevArg = true;
continue;
}
temp.add(intersectionExpression());
missedPrevArg = false;
- SkipWhite();
+ skipWhite();
if (!isArgumentDelimiter(look)) {
throw expected("',' or ')'");
}
@@ -1500,11 +1500,11 @@ public final class FormulaParser {
private ParseNode powerFactor() {
ParseNode result = percentFactor();
while(true) {
- SkipWhite();
+ skipWhite();
if(look != '^') {
return result;
}
- Match('^');
+ match('^');
ParseNode other = percentFactor();
result = new ParseNode(PowerPtg.instance, result, other);
}
@@ -1513,11 +1513,11 @@ public final class FormulaParser {
private ParseNode percentFactor() {
ParseNode result = parseSimpleFactor();
while(true) {
- SkipWhite();
+ skipWhite();
if(look != '%') {
return result;
}
- Match('%');
+ match('%');
result = new ParseNode(PercentPtg.instance, result);
}
}
@@ -1527,32 +1527,32 @@ public final class FormulaParser {
* factors (without ^ or % )
*/
private ParseNode parseSimpleFactor() {
- SkipWhite();
+ skipWhite();
switch(look) {
case '#':
return new ParseNode(ErrPtg.valueOf(parseErrorLiteral()));
case '-':
- Match('-');
+ match('-');
return parseUnary(false);
case '+':
- Match('+');
+ match('+');
return parseUnary(true);
case '(':
- Match('(');
+ match('(');
ParseNode inside = unionExpression();
- Match(')');
+ match(')');
return new ParseNode(ParenthesisPtg.instance, inside);
case '"':
return new ParseNode(new StringPtg(parseStringLiteral()));
case '{':
- Match('{');
+ match('{');
ParseNode arrayNode = parseArray();
- Match('}');
+ match('}');
return arrayNode;
}
// named ranges and tables can start with underscore or backslash
// see
https://support.office.com/en-us/article/Define-and-use-names-in-formulas-4d0f13ac-53b7-422e-afd2-abd7ff379c64?ui=en-US&rs=en-US&ad=US#bmsyntax_rules_for_names
- if (IsAlpha(look) || Character.isDigit(look) || look == '\'' || look
== '[' || look == '_' || look == '\\' ) {
+ if (isAlpha(look) || Character.isDigit(look) || look == '\'' || look
== '[' || look == '_' || look == '\\' ) {
return parseRangeExpression();
}
if (look == '.') {
@@ -1564,7 +1564,7 @@ public final class FormulaParser {
private ParseNode parseUnary(boolean isPlus) {
- boolean numberFollows = IsDigit(look) || look=='.';
+ boolean numberFollows = isDigit(look) || look=='.';
ParseNode factor = powerFactor();
if (numberFollows) {
@@ -1602,7 +1602,7 @@ public final class FormulaParser {
if (look != ';') {
throw expected("'}' or ';'");
}
- Match(';');
+ match(';');
}
int nRows = rowsData.size();
Object[][] values2d = new Object[nRows][];
@@ -1626,13 +1626,13 @@ public final class FormulaParser {
List<Object> temp = new ArrayList<>();
while (true) {
temp.add(parseArrayItem());
- SkipWhite();
+ skipWhite();
switch(look) {
case '}':
case ';':
break;
case ',':
- Match(',');
+ match(',');
continue;
default:
throw expected("'}' or ','");
@@ -1647,7 +1647,7 @@ public final class FormulaParser {
}
private Object parseArrayItem() {
- SkipWhite();
+ skipWhite();
switch(look) {
case '"': return parseStringLiteral();
case '#': return ErrorConstant.valueOf(parseErrorLiteral());
@@ -1655,8 +1655,8 @@ public final class FormulaParser {
case 'T': case 't':
return parseBooleanLiteral();
case '-':
- Match('-');
- SkipWhite();
+ match('-');
+ skipWhite();
return convertArrayNumber(parseNumber(), false);
}
// else assume number
@@ -1681,7 +1681,7 @@ public final class FormulaParser {
} else if (ptg instanceof NumberPtg) {
value = ((NumberPtg)ptg).getValue();
} else {
- throw new RuntimeException("Unexpected ptg (" +
ptg.getClass().getName() + ")");
+ throw new IllegalStateException("Unexpected ptg (" +
ptg.getClass().getName() + ")");
}
if (!isPositive) {
value = -value;
@@ -1692,25 +1692,25 @@ public final class FormulaParser {
private Ptg parseNumber() {
String number2 = null;
String exponent = null;
- String number1 = GetNum();
+ String number1 = nextNum();
if (look == '.') {
- GetChar();
- number2 = GetNum();
+ nextChar();
+ number2 = nextNum();
}
if (look == 'E') {
- GetChar();
+ nextChar();
String sign = "";
if (look == '+') {
- GetChar();
+ nextChar();
} else if (look == '-') {
- GetChar();
+ nextChar();
sign = "-";
}
- String number = GetNum();
+ String number = nextNum();
if (number == null) {
throw expected("Integer");
}
@@ -1726,7 +1726,7 @@ public final class FormulaParser {
private int parseErrorLiteral() {
- Match('#');
+ match('#');
String part1 = parseUnquotedIdentifier();
if (part1 == null) {
throw expected("remainder of error constant literal");
@@ -1737,7 +1737,7 @@ public final class FormulaParser {
case 'V': {
FormulaError fe = FormulaError.VALUE;
if(part1.equals(fe.name())) {
- Match('!');
+ match('!');
return fe.getCode();
}
throw expected(fe.getString());
@@ -1745,7 +1745,7 @@ public final class FormulaParser {
case 'R': {
FormulaError fe = FormulaError.REF;
if(part1.equals(fe.name())) {
- Match('!');
+ match('!');
return fe.getCode();
}
throw expected(fe.getString());
@@ -1753,9 +1753,9 @@ public final class FormulaParser {
case 'D': {
FormulaError fe = FormulaError.DIV0;
if(part1.equals("DIV")) {
- Match('/');
- Match('0');
- Match('!');
+ match('/');
+ match('0');
+ match('!');
return fe.getCode();
}
throw expected(fe.getString());
@@ -1764,26 +1764,26 @@ public final class FormulaParser {
FormulaError fe = FormulaError.NAME;
if(part1.equals(fe.name())) {
// only one that ends in '?'
- Match('?');
+ match('?');
return fe.getCode();
}
fe = FormulaError.NUM;
if(part1.equals(fe.name())) {
- Match('!');
+ match('!');
return fe.getCode();
}
fe = FormulaError.NULL;
if(part1.equals(fe.name())) {
- Match('!');
+ match('!');
return fe.getCode();
}
fe = FormulaError.NA;
if(part1.equals("N")) {
- Match('/');
+ match('/');
if(look != 'A' && look != 'a') {
throw expected(fe.getString());
}
- Match(look);
+ match(look);
// Note - no '!' or '?' suffix
return fe.getCode();
}
@@ -1800,7 +1800,7 @@ public final class FormulaParser {
StringBuilder sb = new StringBuilder();
while (Character.isLetterOrDigit(look) || look == '.') {
sb.appendCodePoint(look);
- GetChar();
+ nextChar();
}
if (sb.length() < 1) {
return null;
@@ -1854,18 +1854,18 @@ public final class FormulaParser {
private String parseStringLiteral() {
- Match('"');
+ match('"');
StringBuilder token = new StringBuilder();
while (true) {
if (look == '"') {
- GetChar();
+ nextChar();
if (look != '"') {
break;
}
}
token.appendCodePoint(look);
- GetChar();
+ nextChar();
}
return token.toString();
}
@@ -1874,15 +1874,15 @@ public final class FormulaParser {
private ParseNode Term() {
ParseNode result = powerFactor();
while(true) {
- SkipWhite();
+ skipWhite();
Ptg operator;
switch(look) {
case '*':
- Match('*');
+ match('*');
operator = MultiplyPtg.instance;
break;
case '/':
- Match('/');
+ match('/');
operator = DividePtg.instance;
break;
default:
@@ -1897,9 +1897,9 @@ public final class FormulaParser {
ParseNode result = intersectionExpression();
boolean hasUnions = false;
while (true) {
- SkipWhite();
+ skipWhite();
if (look == ',') {
- GetChar();
+ nextChar();
hasUnions = true;
ParseNode other = intersectionExpression();
result = new ParseNode(UnionPtg.instance, result, other);
@@ -1916,7 +1916,7 @@ public final class FormulaParser {
ParseNode result = comparisonExpression();
boolean hasIntersections = false;
while (true) {
- SkipWhite();
+ skipWhite();
if (_inIntersection) {
int savePointer = _pointer;
@@ -1942,7 +1942,7 @@ public final class FormulaParser {
private ParseNode comparisonExpression() {
ParseNode result = concatExpression();
while (true) {
- SkipWhite();
+ skipWhite();
switch(look) {
case '=':
case '>':
@@ -1958,24 +1958,24 @@ public final class FormulaParser {
private Ptg getComparisonToken() {
if(look == '=') {
- Match(look);
+ match(look);
return EqualPtg.instance;
}
boolean isGreater = look == '>';
- Match(look);
+ match(look);
if(isGreater) {
if(look == '=') {
- Match('=');
+ match('=');
return GreaterEqualPtg.instance;
}
return GreaterThanPtg.instance;
}
switch(look) {
case '=':
- Match('=');
+ match('=');
return LessEqualPtg.instance;
case '>':
- Match('>');
+ match('>');
return NotEqualPtg.instance;
}
return LessThanPtg.instance;
@@ -1985,11 +1985,11 @@ public final class FormulaParser {
private ParseNode concatExpression() {
ParseNode result = additiveExpression();
while (true) {
- SkipWhite();
+ skipWhite();
if(look != '&') {
break; // finished with concat expression
}
- Match('&');
+ match('&');
ParseNode other = additiveExpression();
result = new ParseNode(ConcatPtg.instance, result, other);
}
@@ -2001,15 +2001,15 @@ public final class FormulaParser {
private ParseNode additiveExpression() {
ParseNode result = Term();
while (true) {
- SkipWhite();
+ skipWhite();
Ptg operator;
switch(look) {
case '+':
- Match('+');
+ match('+');
operator = AddPtg.instance;
break;
case '-':
- Match('-');
+ match('-');
operator = SubtractPtg.instance;
break;
default:
@@ -2040,7 +2040,7 @@ end;
*/
private void parse() {
_pointer=0;
- GetChar();
+ nextChar();
_rootNode = unionExpression();
if(_pointer <= _formulaLength) {
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/FormulaRenderer.java
Wed Sep 14 01:12:38 2022
@@ -81,7 +81,7 @@ public class FormulaRenderer {
stack.push(attrPtg.toFormulaString(operands));
continue;
}
- throw new RuntimeException("Unexpected tAttr: " + attrPtg);
+ throw new IllegalStateException("Unexpected tAttr: " +
attrPtg);
}
if (ptg instanceof WorkbookDependentFormula) {
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperandClassTransformer.java
Wed Sep 14 01:12:38 2022
@@ -79,7 +79,7 @@ final class OperandClassTransformer {
rootNodeOperandClass = Ptg.CLASS_REF;
break;
default:
- throw new RuntimeException("Incomplete code - formula type ("
+ throw new IllegalStateException("Incomplete code - formula
type ("
+ _formulaType + ") not supported yet");
}
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java
Wed Sep 14 01:12:38 2022
@@ -134,7 +134,7 @@ public final class OperationEvaluationCo
try {
targetEvaluator =
_bookEvaluator.getOtherWorkbookEvaluator(workbookName);
} catch (WorkbookNotFoundException e) {
- throw new RuntimeException(e.getMessage(), e);
+ throw new IllegalStateException(e.getMessage(), e);
}
otherFirstSheetIndex =
targetEvaluator.getSheetIndex(externalSheet.getSheetName());
@@ -144,7 +144,7 @@ public final class OperationEvaluationCo
}
if (otherFirstSheetIndex < 0) {
- throw new RuntimeException("Invalid sheet name '" +
externalSheet.getSheetName()
+ throw new IllegalStateException("Invalid sheet name '" +
externalSheet.getSheetName()
+ "' in bool '" + workbookName + "'.");
}
}
@@ -227,11 +227,11 @@ public final class OperationEvaluationCo
case NAMED_RANGE:
EvaluationName nm = _workbook.getName(refStrPart1,
_sheetIndex);
if (nm == null) {
- throw new RuntimeException("Specified name '" +
refStrPart1 +
+ throw new IllegalStateException("Specified name '" +
refStrPart1 +
"' is not found in the workbook (sheetIndex=" +
_sheetIndex + ").");
}
if (!nm.isRange()) {
- throw new RuntimeException("Specified name '" +
refStrPart1 + "' is not a range as expected.");
+ throw new IllegalStateException("Specified name '" +
refStrPart1 + "' is not a range as expected.");
}
return
_bookEvaluator.evaluateNameFormula(nm.getNameDefinition(), this);
}
@@ -298,7 +298,7 @@ public final class OperationEvaluationCo
case BAD_CELL_OR_NAMED_RANGE:
return ErrorEval.REF_INVALID;
case NAMED_RANGE:
- throw new RuntimeException("Cannot evaluate '" + refStrPart1
+ throw new IllegalStateException("Cannot evaluate '" +
refStrPart1
+ "'. Indirect evaluation of defined names not
supported yet");
}
@@ -417,7 +417,7 @@ public final class OperationEvaluationCo
private ValueEval convertObjectEval(Object token) {
if (token == null) {
- throw new RuntimeException("Array item cannot be null");
+ throw new IllegalStateException("Array item cannot be null");
}
if (token instanceof String) {
return new StringEval((String) token);
@@ -533,7 +533,7 @@ public final class OperationEvaluationCo
EvaluationName evaluationName =
refWorkbookEvaluator.getName(externName.getName(), externName.getIx() - 1);
if (evaluationName != null && evaluationName.hasFormula()) {
if (evaluationName.getNameDefinition().length > 1) {
- throw new RuntimeException("Complex name formulas not
supported yet");
+ throw new IllegalStateException("Complex name formulas not
supported yet");
}
// Need to evaluate the reference in the context of the other
book
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluatorFactory.java
Wed Sep 14 01:12:38 2022
@@ -135,7 +135,7 @@ final class OperationEvaluatorFactory {
return udfFunc.evaluate(args, ec);
}
- throw new RuntimeException("Unexpected operation ptg class (" +
ptg.getClass().getName() + ")");
+ throw new IllegalStateException("Unexpected operation ptg class (" +
ptg.getClass().getName() + ")");
}
static ValueEval evaluateArrayFunction(ArrayFunction func, ValueEval[]
args,
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/SheetNameFormatter.java
Wed Sep 14 01:12:38 2022
@@ -68,7 +68,7 @@ public final class SheetNameFormatter {
appendAndEscape(out, rawSheetName);
}
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -96,7 +96,7 @@ public final class SheetNameFormatter {
appendOrREF(out, rawSheetName);
}
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -125,7 +125,7 @@ public final class SheetNameFormatter {
sb.append(ch);
}
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -196,7 +196,7 @@ public final class SheetNameFormatter {
case '\n':
case '\r':
case '\t':
- throw new RuntimeException("Illegal character (0x"
+ throw new IllegalStateException("Illegal character (0x"
+ Integer.toHexString(ch) + ") found in sheet name");
}
return true;
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java?rev=1904050&r1=1904049&r2=1904050&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/UserDefinedFunction.java
Wed Sep 14 01:12:38 2022
@@ -36,11 +36,20 @@ final class UserDefinedFunction implemen
// enforce singleton
}
+ /**
+ * @param args the pre-evaluated arguments for this function. args is
never {@code null},
+ * nor are any of its elements.
+ * @param ec primarily used to identify the source cell containing the
formula being evaluated.
+ * may also be used to dynamically create reference evals.
+ * @return value
+ * @throws IllegalStateException if first arg is not a {@link
FunctionNameEval}
+ * @throws NotImplementedFunctionException if function is not implemented
+ */
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec)
{
int nIncomingArgs = args.length;
- if(nIncomingArgs < 1) {
- throw new RuntimeException("function name argument missing");
+ if (nIncomingArgs < 1) {
+ throw new IllegalStateException("function name argument missing");
}
ValueEval nameArg = args[0];
@@ -48,7 +57,7 @@ final class UserDefinedFunction implemen
if (nameArg instanceof FunctionNameEval) {
functionName = ((FunctionNameEval) nameArg).getFunctionName();
} else {
- throw new RuntimeException("First argument should be a NameEval,
but got ("
+ throw new IllegalStateException("First argument should be a
NameEval, but got ("
+ nameArg.getClass().getName() + ")");
}
FreeRefFunction targetFunc = ec.findUserDefinedFunction(functionName);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]