Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java Wed Sep 14 01:12:38 2022 @@ -192,7 +192,7 @@ public final class WorkbookEvaluator { if (result == null) { int sheetIndex = _workbook.getSheetIndex(sheet); if (sheetIndex < 0) { - throw new RuntimeException("Specified sheet from a different book"); + throw new IllegalStateException("Specified sheet from a different book"); } result = sheetIndex; _sheetIndexesBySheet.put(sheet, result); @@ -292,7 +292,7 @@ public final class WorkbookEvaluator { break; case FORMULA: default: - throw new RuntimeException("Unexpected cell type '" + srcCell.getCellType() + "' found!"); + throw new IllegalStateException("Unexpected cell type '" + srcCell.getCellType() + "' found!"); } } else { throw re; @@ -362,7 +362,7 @@ public final class WorkbookEvaluator { case ERROR: return ErrorEval.valueOf(cell.getErrorCellValue()); default: - throw new RuntimeException("Unexpected cell type (" + cellType + ")"); + throw new IllegalStateException("Unexpected cell type (" + cellType + ")"); } } @@ -542,7 +542,7 @@ public final class WorkbookEvaluator { opResult = getEvalForPtg(ptg, ec); } if (opResult == null) { - throw new RuntimeException("Evaluation result must not be null"); + throw new IllegalStateException("Evaluation result must not be null"); } // logDebug("push " + opResult); stack.push(opResult); @@ -588,11 +588,11 @@ public final class WorkbookEvaluator { while (remBytes != 0) { index++; if (index >= ptgs.length) { - throw new RuntimeException("Skip distance too far (ran out of formula tokens)."); + throw new IllegalStateException("Skip distance too far (ran out of formula tokens)."); } remBytes -= ptgs[index].getSize(); if (remBytes < 0) { - throw new RuntimeException("Bad skip distance (wrong token size calculation)."); + throw new IllegalStateException("Bad skip distance (wrong token size calculation)."); } } return index - startIndex; @@ -738,15 +738,15 @@ public final class WorkbookEvaluator { // POI uses UnknownPtg when the encoded Ptg array seems to be corrupted. // This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790) // In any case, formulas are re-parsed before execution, so UnknownPtg should not get here - throw new RuntimeException("UnknownPtg not allowed"); + throw new IllegalStateException("UnknownPtg not allowed"); } if (ptg instanceof ExpPtg) { // ExpPtg is used for array formulas and shared formulas. // it is currently unsupported, and may not even get implemented here - throw new RuntimeException("ExpPtg currently not supported"); + throw new IllegalStateException("ExpPtg currently not supported"); } - throw new RuntimeException("Unexpected ptg class (" + ptg.getClass().getName() + ")"); + throw new IllegalStateException("Unexpected ptg class (" + ptg.getClass().getName() + ")"); } private ValueEval processNameEval(ValueEval eval, OperationEvaluationContext ec) { @@ -765,7 +765,7 @@ public final class WorkbookEvaluator { return evaluateNameFormula(nameRecord.getNameDefinition(), ec); } - throw new RuntimeException("Don't know how to evaluate name '" + nameRecord.getNameText() + "'"); + throw new IllegalStateException("Don't know how to evaluate name '" + nameRecord.getNameText() + "'"); } /**
Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFracCalculator.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFracCalculator.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFracCalculator.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/atp/YearFracCalculator.java Wed Sep 14 01:12:38 2022 @@ -258,7 +258,7 @@ final class YearFracCalculator { case 23: // transition from daylight savings adjusted to normal time // Unexpected since we are using UTC_TIME_ZONE default: - throw new RuntimeException("Unexpected date diff between " + startDateMS + " and " + endDateMS); + throw new IllegalStateException("Unexpected date diff between " + startDateMS + " and " + endDateMS); } return (int) (0.5 + ((double)msDiff / MS_PER_DAY)); Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java Wed Sep 14 01:12:38 2022 @@ -60,7 +60,7 @@ public final class ErrorEval implements if (eval != null) { return eval; } else { - throw new RuntimeException("Unhandled error type for code " + errorCode); + throw new IllegalStateException("Unhandled error type for code " + errorCode); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java Wed Sep 14 01:12:38 2022 @@ -267,7 +267,7 @@ public final class OperandResolver { } return dd; } - throw new RuntimeException("Unexpected arg eval type (" + ev.getClass().getName() + ")"); + throw new IllegalStateException("Unexpected arg eval type (" + ev.getClass().getName() + ")"); } /** @@ -368,6 +368,6 @@ public final class OperandResolver { if (ve instanceof ErrorEval) { throw new EvaluationException((ErrorEval) ve); } - throw new RuntimeException("Unexpected eval (" + ve.getClass().getName() + ")"); + throw new IllegalStateException("Unexpected eval (" + ve.getClass().getName() + ")"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java Wed Sep 14 01:12:38 2022 @@ -98,7 +98,7 @@ final class ForkedEvaluationCell impleme private void checkCellType(CellType expectedCellType) { if (_cellType != expectedCellType) { - throw new RuntimeException("Wrong data type (" + _cellType + ")"); + throw new IllegalStateException("Wrong data type (" + _cellType + ")"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationWorkbook.java Wed Sep 14 01:12:38 2022 @@ -98,7 +98,7 @@ final class ForkedEvaluationWorkbook imp public Ptg[] getFormulaTokens(EvaluationCell cell) { if (cell instanceof ForkedEvaluationCell) { // doesn't happen yet because formulas cannot be modified from the master workbook - throw new RuntimeException("Updated formulas not supported yet"); + throw new IllegalStateException("Updated formulas not supported yet"); } return _masterBook.getFormulaTokens(cell); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionDataBuilder.java Wed Sep 14 01:12:38 2022 @@ -56,14 +56,14 @@ final class FunctionDataBuilder { prevFM = _functionDataByName.get(functionName); if(prevFM != null) { if(!hasFootnote || !_mutatingFunctionIndexes.contains(indexKey)) { - throw new RuntimeException("Multiple entries for function name '" + functionName + "'"); + throw new IllegalStateException("Multiple entries for function name '" + functionName + "'"); } _functionDataByIndex.remove(prevFM.getIndex()); } prevFM = _functionDataByIndex.get(indexKey); if(prevFM != null) { if(!hasFootnote || !_mutatingFunctionIndexes.contains(indexKey)) { - throw new RuntimeException("Multiple entries for function index (" + functionIndex + ")"); + throw new IllegalStateException("Multiple entries for function index (" + functionIndex + ")"); } _functionDataByName.remove(prevFM.getName()); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java Wed Sep 14 01:12:38 2022 @@ -85,7 +85,7 @@ final class FunctionMetadataReader { private static void readResourceFile(FunctionDataBuilder fdb, String resourceFile) { try (InputStream is = FunctionMetadataReader.class.getResourceAsStream(resourceFile)) { if (is == null) { - throw new RuntimeException("resource '" + resourceFile + "' not found"); + throw new IllegalStateException("resource '" + resourceFile + "' not found"); } try(BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { @@ -106,7 +106,7 @@ final class FunctionMetadataReader { } } } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -114,7 +114,7 @@ final class FunctionMetadataReader { String[] parts = TAB_DELIM_PATTERN.split(line, -2); if(parts.length != 8) { - throw new RuntimeException("Bad line format '" + line + "' - expected 8 data fields delimited by tab, " + + throw new IllegalStateException("Bad line format '" + line + "' - expected 8 data fields delimited by tab, " + "but had " + parts.length + ": " + Arrays.toString(parts)); } int functionIndex = parseInt(parts[0]); @@ -168,7 +168,7 @@ final class FunctionMetadataReader { private static byte parseOperandTypeCode(String code) { if(code.length() != 1) { - throw new RuntimeException("Bad operand type code format '" + code + "' expected single char"); + throw new IllegalStateException("Bad operand type code format '" + code + "' expected single char"); } switch(code.charAt(0)) { case 'V': return Ptg.CLASS_VALUE; @@ -197,7 +197,7 @@ final class FunctionMetadataReader { if(DIGIT_ENDING_FUNCTION_NAMES_SET.contains(functionName)) { return; } - throw new RuntimeException("Invalid function name '" + functionName + throw new IllegalStateException("Invalid function name '" + functionName + "' (is footnote number incorrectly appended)"); } @@ -205,7 +205,7 @@ final class FunctionMetadataReader { try { return Integer.parseInt(valStr); } catch (NumberFormatException e) { - throw new RuntimeException("Value '" + valStr + "' could not be parsed as an integer"); + throw new IllegalStateException("Value '" + valStr + "' could not be parsed as an integer"); } } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunctionUtils.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunctionUtils.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunctionUtils.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/ArrayFunctionUtils.java Wed Sep 14 01:12:38 2022 @@ -129,7 +129,7 @@ final class ArrayFunctionUtils { if (ve == BlankEval.instance) { return null; } - throw new RuntimeException("Invalid ValueEval type passed for conversion: (" + throw new IllegalStateException("Invalid ValueEval type passed for conversion: (" + ve.getClass() + ")"); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Countif.java Wed Sep 14 01:12:38 2022 @@ -119,7 +119,7 @@ public final class Countif extends Fixed case NE: return !cmpResult; } - throw new RuntimeException("Cannot call boolean evaluate on non-equality operator '" + throw new IllegalStateException("Cannot call boolean evaluate on non-equality operator '" + _representation + "'"); } public boolean evaluate(int cmpResult) { @@ -133,7 +133,7 @@ public final class Countif extends Fixed case GT: return cmpResult > 0; case GE: return cmpResult >= 0; } - throw new RuntimeException("Cannot call boolean evaluate on non-equality operator '" + throw new IllegalStateException("Cannot call boolean evaluate on non-equality operator '" + _representation + "'"); } @Override @@ -477,7 +477,7 @@ public final class Countif extends Fixed if(evaluatedCriteriaArg == BlankEval.instance) { return null; } - throw new RuntimeException("Unexpected type for criteria (" + throw new IllegalStateException("Unexpected type for criteria (" + evaluatedCriteriaArg.getClass().getName() + ")"); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Index.java Wed Sep 14 01:12:38 2022 @@ -85,7 +85,7 @@ public final class Index implements Func @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2, ValueEval arg3) { - throw new RuntimeException("Incomplete code" + throw new IllegalStateException("Incomplete code" + " - don't know how to support the 'area_num' parameter yet)"); // Excel expression might look like this "INDEX( (A1:B4, C3:D6, D2:E5 ), 1, 2, 3) // In this example, the 3rd area would be used i.e. D2:E5, and the overall result would be E2 @@ -103,7 +103,7 @@ public final class Index implements Func } // else the other variation of this function takes an array as the first argument // it seems like interface 'ArrayEval' does not even exist yet - throw new RuntimeException("Incomplete code - cannot handle first arg of type (" + throw new IllegalStateException("Incomplete code - cannot handle first arg of type (" + arg0.getClass().getName() + ")"); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Lookup.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Lookup.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Lookup.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Lookup.java Wed Sep 14 01:12:38 2022 @@ -84,7 +84,7 @@ public final class Lookup extends Var2or ValueVector resultVector = createVector(aeResultVector); if(lookupVector.getSize() > resultVector.getSize()) { // Excel seems to handle this by accessing past the end of the result vector. - throw new RuntimeException("Lookup vector and result vector of differing sizes not supported yet"); + throw new IllegalStateException("Lookup vector and result vector of differing sizes not supported yet"); } int index = LookupUtils.lookupFirstIndexOfValue(lookupValue, lookupVector, true); @@ -100,6 +100,6 @@ public final class Lookup extends Var2or return result; } // extra complexity required to emulate the way LOOKUP can handles these abnormal cases. - throw new RuntimeException("non-vector lookup or result areas not supported yet"); + throw new IllegalStateException("non-vector lookup or result areas not supported yet"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java Wed Sep 14 01:12:38 2022 @@ -358,14 +358,14 @@ public final class LookupUtils { private final Class<? extends ValueEval> _targetClass; protected LookupValueComparerBase(ValueEval targetValue) { if(targetValue == null) { - throw new RuntimeException("targetValue cannot be null"); + throw new IllegalStateException("targetValue cannot be null"); } _targetClass = targetValue.getClass(); } @Override public final CompareResult compareTo(ValueEval other) { if (other == null) { - throw new RuntimeException("compare to value cannot be null"); + throw new IllegalStateException("compare to value cannot be null"); } if (_targetClass != other.getClass()) { return CompareResult.TYPE_MISMATCH; @@ -611,7 +611,7 @@ public final class LookupUtils { // zero is FALSE, everything else is TRUE return 0.0 != nve.getNumberValue(); } - throw new RuntimeException("Unexpected eval type (" + valEval + ")"); + throw new IllegalStateException("Unexpected eval type (" + valEval + ")"); } public static int lookupFirstIndexOfValue(ValueEval lookupValue, ValueVector vector, boolean isRangeLookup) throws EvaluationException { Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Match.java Wed Sep 14 01:12:38 2022 @@ -117,7 +117,7 @@ public final class Match extends Var2or3 @Override public ValueEval getItem(int index) { if (index != 0) { - throw new RuntimeException("Invalid index (" + throw new IllegalStateException("Invalid index (" + index + ") only zero is allowed"); } return _value; @@ -160,7 +160,7 @@ public final class Match extends Var2or3 // else looks like a number throw new EvaluationException(ErrorEval.NA); } - throw new RuntimeException("Unexpected eval type (" + eval + ")"); + throw new IllegalStateException("Unexpected eval type (" + eval + ")"); } @@ -191,7 +191,7 @@ public final class Match extends Var2or3 // uses the default-value instead return 1; } - throw new RuntimeException("Unexpected match_type type (" + match_type.getClass().getName() + ")"); + throw new IllegalStateException("Unexpected match_type type (" + match_type.getClass().getName() + ")"); } /** Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Mode.java Wed Sep 14 01:12:38 2022 @@ -128,6 +128,6 @@ public final class Mode implements Funct temp.add(Double.valueOf(((NumberEval) arg).getNumberValue())); return; } - throw new RuntimeException("Unexpected value type (" + arg.getClass().getName() + ")"); + throw new IllegalStateException("Unexpected value type (" + arg.getClass().getName() + ")"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/MultiOperandNumericFunction.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/MultiOperandNumericFunction.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/MultiOperandNumericFunction.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/MultiOperandNumericFunction.java Wed Sep 14 01:12:38 2022 @@ -225,7 +225,7 @@ public abstract class MultiOperandNumeri missingArgConsumer.accept((MissingArgEval) ve, temp); return; } - throw new RuntimeException("Invalid ValueEval type passed for conversion: (" + throw new IllegalStateException("Invalid ValueEval type passed for conversion: (" + ve.getClass() + ")"); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java Wed Sep 14 01:12:38 2022 @@ -56,7 +56,7 @@ public final class Offset implements Fun public LinearOffsetRange(int offset, int length) { if(length == 0) { // handled that condition much earlier - throw new RuntimeException("length may not be zero"); + throw new IllegalStateException("length may not be zero"); } _offset = offset; _length = length; Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Sumproduct.java Wed Sep 14 01:12:38 2022 @@ -87,7 +87,7 @@ public final class Sumproduct implements } catch (EvaluationException e) { return e.getErrorEval(); } - throw new RuntimeException("Invalid arg type for SUMPRODUCT: (" + throw new IllegalStateException("Invalid arg type for SUMPRODUCT: (" + firstArg.getClass().getName() + ")"); } @@ -116,7 +116,7 @@ public final class Sumproduct implements } if (eval == null) { - throw new RuntimeException("parameter may not be null"); + throw new IllegalStateException("parameter may not be null"); } if (eval instanceof AreaEval) { AreaEval ae = (AreaEval) eval; @@ -235,7 +235,7 @@ public final class Sumproduct implements NumericValueEval nve = (NumericValueEval) ve; return nve.getNumberValue(); } - throw new RuntimeException("Unexpected value eval class (" + throw new IllegalStateException("Unexpected value eval class (" + ve.getClass().getName() + ")"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/Trend.java Wed Sep 14 01:12:38 2022 @@ -108,7 +108,7 @@ public final class Trend implements Func eval = arg; } if (eval == null) { - throw new RuntimeException("Parameter may not be null."); + throw new IllegalStateException("Parameter may not be null."); } if (eval instanceof AreaEval) { Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/AbstractFunctionPtg.java Wed Sep 14 01:12:38 2022 @@ -48,10 +48,10 @@ public abstract class AbstractFunctionPt protected AbstractFunctionPtg(int functionIndex, int pReturnClass, byte[] paramTypes, int nParams) { _numberOfArgs = nParams; if (functionIndex < Short.MIN_VALUE || functionIndex > Short.MAX_VALUE) - throw new RuntimeException("functionIndex " + functionIndex + " cannot be cast to short"); + throw new IllegalStateException("functionIndex " + functionIndex + " cannot be cast to short"); _functionIndex = (short) functionIndex; if (pReturnClass < Byte.MIN_VALUE || pReturnClass > Byte.MAX_VALUE) - throw new RuntimeException("pReturnClass " + pReturnClass + " cannot be cast to byte"); + throw new IllegalStateException("pReturnClass " + pReturnClass + " cannot be cast to byte"); returnClass = (byte) pReturnClass; paramClass = paramTypes; } @@ -140,7 +140,7 @@ public abstract class AbstractFunctionPt fm = FunctionMetadataRegistry.getFunctionByIndex(index); } if(fm == null) { - throw new RuntimeException("bad function index (" + index + ", " + isCetab + ")"); + throw new IllegalStateException("bad function index (" + index + ", " + isCetab + ")"); } return fm.getName(); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Area3DPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Area3DPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Area3DPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Area3DPtg.java Wed Sep 14 01:12:38 2022 @@ -107,7 +107,7 @@ public final class Area3DPtg extends Are @Override public String toFormulaString() { - throw new RuntimeException("3D references need a workbook to determine formula text"); + throw new IllegalStateException("3D references need a workbook to determine formula text"); } @Override Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ArrayPtg.java Wed Sep 14 01:12:38 2022 @@ -192,7 +192,7 @@ public final class ArrayPtg extends Ptg private static String getConstantText(Object o) { if (o == null) { - throw new RuntimeException("Array item cannot be null"); + throw new IllegalStateException("Array item cannot be null"); } if (o instanceof String) { return "\"" + o + "\""; Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedArea3DPtg.java Wed Sep 14 01:12:38 2022 @@ -54,7 +54,7 @@ public final class DeletedArea3DPtg exte return ExternSheetNameResolver.prependSheetName(book, field_1_index_extern_sheet, FormulaError.REF.getString()); } public String toFormulaString() { - throw new RuntimeException("3D references need a workbook to determine formula text"); + throw new IllegalStateException("3D references need a workbook to determine formula text"); } @Override public byte getDefaultOperandClass() { Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/DeletedRef3DPtg.java Wed Sep 14 01:12:38 2022 @@ -54,7 +54,7 @@ public final class DeletedRef3DPtg exten return ExternSheetNameResolver.prependSheetName(book, field_1_index_extern_sheet, FormulaError.REF.getString()); } public String toFormulaString() { - throw new RuntimeException("3D references need a workbook to determine formula text"); + throw new IllegalStateException("3D references need a workbook to determine formula text"); } @Override public byte getDefaultOperandClass() { Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ErrPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ErrPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ErrPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ErrPtg.java Wed Sep 14 01:12:38 2022 @@ -92,7 +92,7 @@ public final class ErrPtg extends Scalar case REF: return REF_INVALID; case VALUE: return VALUE_INVALID; default: - throw new RuntimeException("Unexpected error code (" + code + ")"); + throw new IllegalStateException("Unexpected error code (" + code + ")"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExpPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExpPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExpPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ExpPtg.java Wed Sep 14 01:12:38 2022 @@ -68,7 +68,7 @@ public final class ExpPtg extends Contro @Override public String toFormulaString() { - throw new RuntimeException("Coding Error: Expected ExpPtg to be converted from Shared to Non-Shared Formula by ValueRecordsAggregate, but it wasn't"); + throw new IllegalStateException("Coding Error: Expected ExpPtg to be converted from Shared to Non-Shared Formula by ValueRecordsAggregate, but it wasn't"); } @Override Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/FuncPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/FuncPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/FuncPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/FuncPtg.java Wed Sep 14 01:12:38 2022 @@ -38,7 +38,7 @@ public final class FuncPtg extends Abstr public static FuncPtg create(int functionIndex) { FunctionMetadata fm = FunctionMetadataRegistry.getFunctionByIndex(functionIndex); if(fm == null) { - throw new RuntimeException("Invalid built-in function index (" + functionIndex + ")"); + throw new IllegalStateException("Invalid built-in function index (" + functionIndex + ")"); } return new FuncPtg(functionIndex, fm); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NamePtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NamePtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NamePtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NamePtg.java Wed Sep 14 01:12:38 2022 @@ -87,7 +87,7 @@ public final class NamePtg extends Opera @Override public String toFormulaString() { - throw new RuntimeException("3D references need a workbook to determine formula text"); + throw new IllegalStateException("3D references need a workbook to determine formula text"); } @Override Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/NameXPtg.java Wed Sep 14 01:12:38 2022 @@ -84,7 +84,7 @@ public final class NameXPtg extends Oper return book.resolveNameXText(this); } public String toFormulaString() { - throw new RuntimeException("3D references need a workbook to determine formula text"); + throw new IllegalStateException("3D references need a workbook to determine formula text"); } @Override Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ref3DPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ref3DPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ref3DPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/Ref3DPtg.java Wed Sep 14 01:12:38 2022 @@ -94,7 +94,7 @@ public final class Ref3DPtg extends RefP return ExternSheetNameResolver.prependSheetName(book, field_1_index_extern_sheet, formatReferenceAsString()); } public String toFormulaString() { - throw new RuntimeException("3D references need a workbook to determine formula text"); + throw new IllegalStateException("3D references need a workbook to determine formula text"); } @Override Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/TblPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/TblPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/TblPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/TblPtg.java Wed Sep 14 01:12:38 2022 @@ -78,7 +78,7 @@ public final class TblPtg extends Contro public String toFormulaString() { // table(....)[][] - throw new RuntimeException("Table and Arrays are not yet supported"); + throw new IllegalStateException("Table and Arrays are not yet supported"); } @Override Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/ptg/ValueOperatorPtg.java Wed Sep 14 01:12:38 2022 @@ -54,6 +54,6 @@ public abstract class ValueOperatorPtg e @Override public final String toFormulaString() { // TODO - prune this method out of the hierarchy - throw new RuntimeException("toFormulaString(String[] operands) should be used for subclasses of OperationPtgs"); + throw new IllegalStateException("toFormulaString(String[] operands) should be used for subclasses of OperationPtgs"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java Wed Sep 14 01:12:38 2022 @@ -1138,7 +1138,7 @@ public class DataFormatter { case ERROR: return FormulaError.forInt(cell.getErrorCellValue()).getString(); default: - throw new RuntimeException("Unexpected celltype (" + cellType + ")"); + throw new IllegalStateException("Unexpected celltype (" + cellType + ")"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/util/AreaReference.java Wed Sep 14 01:12:38 2022 @@ -70,7 +70,7 @@ public class AreaReference { String part1 = parts[1]; if (isPlainColumn(part0)) { if (!isPlainColumn(part1)) { - throw new RuntimeException("Bad area ref '" + reference + "'"); + throw new IllegalStateException("Bad area ref '" + reference + "'"); } // Special handling for whole-column references // Represented internally as x$1 to x$65536 @@ -301,7 +301,7 @@ public class AreaReference { // TODO - are references like "Sheet1!A1:Sheet1:B2" ever valid? // FormulaParser has code to handle that. - throw new RuntimeException("Unexpected " + SHEET_NAME_DELIMITER + throw new IllegalStateException("Unexpected " + SHEET_NAME_DELIMITER + " in second cell reference of '" + reference + "'"); } Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeAddressList.java Wed Sep 14 01:12:38 2022 @@ -93,10 +93,10 @@ public class CellRangeAddressList implem } public CellRangeAddress remove(int rangeIndex) { if (_list.isEmpty()) { - throw new RuntimeException("List is empty"); + throw new IllegalStateException("List is empty"); } if (rangeIndex < 0 || rangeIndex >= _list.size()) { - throw new RuntimeException("Range index (" + rangeIndex + throw new IllegalStateException("Range index (" + rangeIndex + ") is outside allowable range (0.." + (_list.size()-1) + ")"); } return _list.remove(rangeIndex); Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeUtil.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeUtil.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeUtil.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellRangeUtil.java Wed Sep 14 01:12:38 2022 @@ -164,7 +164,7 @@ public final class CellRangeUtil { // range2 encloses range1, so replace it with the enclosing one return new CellRangeAddress[] { range2 }; } - throw new RuntimeException("unexpected intersection result (" + x + ")"); + throw new IllegalStateException("unexpected intersection result (" + x + ")"); } private static CellRangeAddress[] toArray(List<CellRangeAddress> temp) { Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/ss/util/NumberToTextConverter.java Wed Sep 14 01:12:38 2022 @@ -167,7 +167,7 @@ public final class NumberToTextConverter NormalisedDecimal rnd = pnd.roundUnits(); int decExponent = rnd.getDecimalExponent(); String decimalDigits; - if (Math.abs(decExponent)>98) { + if (Math.abs(decExponent) > 98) { decimalDigits = rnd.getSignificantDecimalDigitsLastDigitRounded(); if (decimalDigits.length() == 16) { // rounding caused carry @@ -176,7 +176,7 @@ public final class NumberToTextConverter } else { decimalDigits = rnd.getSignificantDecimalDigits(); } - int countSigDigits = countSignifantDigits(decimalDigits); + int countSigDigits = countSignificantDigits(decimalDigits); if (decExponent < 0) { formatLessThanOne(sb, decimalDigits, decExponent, countSigDigits); } else { @@ -236,12 +236,12 @@ public final class NumberToTextConverter return nDigits > MAX_TEXT_LEN; } - private static int countSignifantDigits(String sb) { - int result=sb.length()-1; + private static int countSignificantDigits(String sb) { + int result = sb.length()-1; while(sb.charAt(result) == '0') { result--; - if(result < 0) { - throw new RuntimeException("No non-zero digits found"); + if (result < 0) { + throw new IllegalStateException("No non-zero digits found"); } } return result + 1; Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/HexRead.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/HexRead.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/util/HexRead.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/util/HexRead.java Wed Sep 14 01:12:38 2022 @@ -134,7 +134,7 @@ public class HexRead { try { return readData(new ByteArrayInputStream( data.getBytes(StringUtil.UTF8) ), -1); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java Wed Sep 14 01:12:38 2022 @@ -429,7 +429,7 @@ public final class IOUtils { public static long copy(InputStream srcStream, File destFile) throws IOException { File destDirectory = destFile.getParentFile(); if (!(destDirectory.exists() || destDirectory.mkdirs())) { - throw new RuntimeException("Can't create destination directory: "+destDirectory); + throw new IllegalStateException("Can't create destination directory: "+destDirectory); } try (OutputStream destStream = new FileOutputStream(destFile)) { return IOUtils.copy(srcStream, destStream); Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianByteArrayOutputStream.java Wed Sep 14 01:12:38 2022 @@ -46,7 +46,7 @@ public final class LittleEndianByteArray private void checkPosition(int i) { if (i > _endIndex - _writeIndex) { - throw new RuntimeException("Buffer overrun"); + throw new IllegalStateException("Buffer overrun"); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java Wed Sep 14 01:12:38 2022 @@ -46,7 +46,7 @@ public class LittleEndianInputStream ext try { return super.available(); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -61,7 +61,7 @@ public class LittleEndianInputStream ext try { checkEOF(read(buf), 1); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } return LittleEndian.getUByte(buf); } @@ -88,7 +88,7 @@ public class LittleEndianInputStream ext try { checkEOF(read(buf), buf.length); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } return LittleEndian.getInt(buf); } @@ -112,7 +112,7 @@ public class LittleEndianInputStream ext try { checkEOF(read(buf), LittleEndianConsts.LONG_SIZE); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } return LittleEndian.getLong(buf); } @@ -128,14 +128,14 @@ public class LittleEndianInputStream ext try { checkEOF(read(buf), LittleEndianConsts.SHORT_SIZE); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } return LittleEndian.getUShort(buf); } private static void checkEOF(int actualBytes, int expectedBytes) { if (expectedBytes != 0 && (actualBytes == -1 || actualBytes != expectedBytes)) { - throw new RuntimeException("Unexpected end-of-file"); + throw new IllegalStateException("Unexpected end-of-file"); } } @@ -149,7 +149,7 @@ public class LittleEndianInputStream ext try { checkEOF(_read(buf, off, len), len); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianOutputStream.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianOutputStream.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianOutputStream.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/util/LittleEndianOutputStream.java Wed Sep 14 01:12:38 2022 @@ -31,7 +31,7 @@ public final class LittleEndianOutputStr try { out.write(v); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -52,7 +52,7 @@ public final class LittleEndianOutputStr out.write(b2); out.write(b3); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -70,7 +70,7 @@ public final class LittleEndianOutputStr out.write(b0); out.write(b1); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @Override @@ -79,7 +79,7 @@ public final class LittleEndianOutputStr try { super.write(b); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @Override @@ -88,7 +88,7 @@ public final class LittleEndianOutputStr try { super.write(b, off, len); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -106,7 +106,7 @@ public final class LittleEndianOutputStr out.write( (byte) ( ( value >>> 16 ) & 0xFF ) ); out.write( (byte) ( ( value >>> 24 ) & 0xFF ) ); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } @@ -121,7 +121,7 @@ public final class LittleEndianOutputStr out.write( (byte) ( ( value ) & 0xFF ) ); out.write( (byte) ( ( value >>> 8 ) & 0xFF ) ); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } } Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/XMLHelper.java URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/XMLHelper.java?rev=1904050&r1=1904049&r2=1904050&view=diff ============================================================================== --- poi/trunk/poi/src/main/java/org/apache/poi/util/XMLHelper.java (original) +++ poi/trunk/poi/src/main/java/org/apache/poi/util/XMLHelper.java Wed Sep 14 01:12:38 2022 @@ -166,7 +166,7 @@ public final class XMLHelper { throw re; } catch (Exception e) { logThrowable(e, "Failed to create SAXParserFactory", "-"); - throw new RuntimeException("Failed to create SAXParserFactory", e); + throw new IllegalStateException("Failed to create SAXParserFactory", e); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
