diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-09-14 09:54:24 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-09-14 09:54:24 +0000 |
commit | 6e7f6dad21f8b618abb7c3af331c83629a785150 (patch) | |
tree | 1f77419bba8910953ac1a14ed81e0f482234f955 /poi | |
parent | 1e50886b5424de56d6fae60f3b64ccba4003eeaf (diff) | |
download | poi-6e7f6dad21f8b618abb7c3af331c83629a785150.tar.gz poi-6e7f6dad21f8b618abb7c3af331c83629a785150.zip |
try to use IllegalStateException instead of RuntimeException
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1904065 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
11 files changed, 26 insertions, 26 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java index d11372079b..7e5f7f5fb7 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java @@ -1002,7 +1002,7 @@ public class HSSFCell extends CellBase { } /** - * @throws RuntimeException if the bounds are exceeded. + * @throws IllegalStateException if the bounds are exceeded. */ private static void checkBounds(int cellIndex) { if (cellIndex < 0 || cellIndex > LAST_COLUMN_NUMBER) { diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java index d2fa999d4f..4089ebcd8a 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPalette.java @@ -159,7 +159,7 @@ public final class HSSFPalette { * * @return The new custom color. * - * @throws RuntimeException if there are more more free color indexes. + * @throws IllegalStateException if there are more more free color indexes. */ public HSSFColor addColor( byte red, byte green, byte blue ) { diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index cef0edaa37..12a4ff008a 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -256,7 +256,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * preserve nodes set to true. * * @throws IOException if the stream cannot be read - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format * @see #HSSFWorkbook(POIFSFileSystem, boolean) * @see POIFSFileSystem @@ -275,7 +275,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * need to. If set, will store all of the POIFSFileSystem * in memory * @throws IOException if the stream cannot be read - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format * @see POIFSFileSystem */ @@ -324,7 +324,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * need to. If set, will store all of the POIFSFileSystem * in memory * @throws IOException if the stream cannot be read - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format * @see POIFSFileSystem */ @@ -344,7 +344,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * need to. If set, will store all of the POIFSFileSystem * in memory * @throws IOException if the stream cannot be read - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format * @see POIFSFileSystem */ @@ -401,7 +401,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * preserve nodes set to true. * * @throws IOException if the stream cannot be read - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format * @see #HSSFWorkbook(InputStream, boolean) * @see #HSSFWorkbook(POIFSFileSystem) @@ -420,7 +420,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { * macros. This takes more memory, so only say yes if you * need to. * @throws IOException if the stream cannot be read - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format * @see POIFSFileSystem * @see #HSSFWorkbook(POIFSFileSystem) diff --git a/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java b/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java index 41f1d07fea..29404f6d9f 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java +++ b/poi/src/main/java/org/apache/poi/ss/format/SimpleFraction.java @@ -43,7 +43,7 @@ public class SimpleFraction { * @param value the double value to convert to a fraction. * @param maxDenominator maximum denominator value allowed. * - * @throws RuntimeException if the continued fraction failed to + * @throws IllegalStateException if the continued fraction failed to * converge. * @throws IllegalArgumentException if value > Integer.MAX_VALUE */ @@ -68,7 +68,7 @@ public class SimpleFraction { * {@code epsilon} of {@code value}, in absolute terms. * @param maxDenominator maximum denominator value allowed. * @param maxIterations maximum number of convergents - * @throws RuntimeException if the continued fraction failed to + * @throws IllegalStateException if the continued fraction failed to * converge. * @throws IllegalArgumentException if value > Integer.MAX_VALUE */ diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java index 878a6bc740..42ed732f1f 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParseException.java @@ -25,7 +25,7 @@ package org.apache.poi.ss.formula; */ public final class FormulaParseException extends RuntimeException { - FormulaParseException(String msg) { + public FormulaParseException(String msg) { super(msg); } } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java b/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java index b22e18e55f..37db5d6e04 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/OperationEvaluationContext.java @@ -208,7 +208,7 @@ public final class OperationEvaluationContext { * @param isA1Style specifies the format for {@code refStrPart1} and {@code refStrPart2}. * Pass {@code true} for 'A1' style and {@code false} for 'R1C1' style. * @return a {@link RefEval} or {@link AreaEval} - * @throws RuntimeException If invalid parameters are provided + * @throws IllegalStateException If invalid parameters are provided */ public ValueEval getDynamicReference(String workbookName, String sheetName, String refStrPart1, String refStrPart2, boolean isA1Style) { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java index c4dd9eed84..f831149760 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/ErrorEval.java @@ -52,7 +52,7 @@ public final class ErrorEval implements ValueEval { /** * Translates an Excel internal error code into the corresponding POI ErrorEval instance * @param errorCode An error code listed in {@link FormulaError} - * @throws RuntimeException If an unknown errorCode is specified + * @throws IllegalStateException If an unknown errorCode is specified */ public static ErrorEval valueOf(int errorCode) { FormulaError error = FormulaError.forInt(errorCode); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java b/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java index 5619b70fbe..710c9f7713 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/eval/OperandResolver.java @@ -246,7 +246,7 @@ public final class OperandResolver { * @return actual, parsed or interpreted double value (respectively). * @throws EvaluationException if a StringEval is supplied and cannot be parsed * as a double (See {@code parseDouble()} for allowable formats). - * @throws RuntimeException if the supplied parameter is not {@link NumberEval}, + * @throws IllegalStateException if the supplied parameter is not {@link NumberEval}, * {@link StringEval}, {@link BoolEval} or {@link BlankEval} */ public static double coerceValueToDouble(ValueEval ev) throws EvaluationException { diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java b/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java index 82b9c900d0..707c045bab 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java @@ -67,7 +67,7 @@ public final class WorkbookFactory { * @return The created workbook * * @throws IOException if an error occurs while creating the objects - * @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of other runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(boolean xssf) throws IOException { @@ -85,7 +85,7 @@ public final class WorkbookFactory { * @return The created workbook * * @throws IOException if an error occurs while reading the data - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(POIFSFileSystem fs) throws IOException { @@ -105,7 +105,7 @@ public final class WorkbookFactory { * @return The created Workbook * * @throws IOException if an error occurs while reading the data - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format */ private static Workbook create(final POIFSFileSystem fs, String password) throws IOException { @@ -124,7 +124,7 @@ public final class WorkbookFactory { * @return The created Workbook * * @throws IOException if an error occurs while reading the data - * @throws RuntimeException a number of other exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of other exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(final DirectoryNode root) throws IOException { @@ -145,7 +145,7 @@ public final class WorkbookFactory { * @return The created Workbook * * @throws IOException if an error occurs while reading the data - * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(final DirectoryNode root, String password) throws IOException { @@ -178,7 +178,7 @@ public final class WorkbookFactory { * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the Workbook given is password protected * @throws EmptyFileException If the given data is empty - * @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of other runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(InputStream inp) throws IOException, EncryptedDocumentException { @@ -207,7 +207,7 @@ public final class WorkbookFactory { * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the wrong password is given for a protected file * @throws EmptyFileException If the given data is empty - * @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of other runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(InputStream inp, String password) throws IOException, EncryptedDocumentException { @@ -248,7 +248,7 @@ public final class WorkbookFactory { * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the Workbook given is password protected * @throws EmptyFileException If the given data is empty - * @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of other runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(File file) throws IOException, EncryptedDocumentException { @@ -270,7 +270,7 @@ public final class WorkbookFactory { * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the wrong password is given for a protected file * @throws EmptyFileException If the given data is empty - * @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of other runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(File file, String password) throws IOException, EncryptedDocumentException { @@ -294,7 +294,7 @@ public final class WorkbookFactory { * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the wrong password is given for a protected file * @throws EmptyFileException If the given data is empty - * @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the + * @throws IllegalStateException a number of other runtime exceptions can be thrown, especially if there are problems with the * input format */ public static Workbook create(File file, String password, boolean readOnly) throws IOException, EncryptedDocumentException { diff --git a/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java b/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java index e6d1a84cb7..cc2c3b927f 100644 --- a/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java +++ b/poi/src/main/java/org/apache/poi/util/LittleEndianInputStream.java @@ -97,7 +97,7 @@ public class LittleEndianInputStream extends FilterInputStream implements Little * get an unsigned int value from an InputStream * * @return the unsigned int (32-bit) value - * @throws RuntimeException + * @throws IllegalStateException * wraps any IOException thrown from reading the stream. */ //@Override diff --git a/poi/src/test/java/org/apache/poi/POIDataSamples.java b/poi/src/test/java/org/apache/poi/POIDataSamples.java index 41421a3fe2..82e06bd57d 100644 --- a/poi/src/test/java/org/apache/poi/POIDataSamples.java +++ b/poi/src/test/java/org/apache/poi/POIDataSamples.java @@ -160,7 +160,7 @@ public final class POIDataSamples { * * @param sampleFileName the name of the test file * @return Verifies that the file with the given name exists in the test-data directory - * @throws RuntimeException if the file was not found + * @throws IllegalStateException if the file was not found */ public File getFile(String sampleFileName) { File f = new File(_resolvedDataDir, sampleFileName); |