revert use of ExceptionUtil on caught exceptions (not useful)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2023-02-14 15:03:26 +00:00
parent f6cec39ba2
commit d07d8e42b9
48 changed files with 13 additions and 245 deletions

View File

@ -29,6 +29,7 @@ import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.Section; import org.apache.poi.hpsf.Section;
import org.apache.poi.poifs.eventfilesystem.POIFSReader; import org.apache.poi.poifs.eventfilesystem.POIFSReader;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
import org.apache.poi.util.ExceptionUtil;
/** /**
* <p>Sample application showing how to read a document's custom property set. * <p>Sample application showing how to read a document's custom property set.
@ -66,6 +67,9 @@ public final class ReadCustomPropertySets {
out("No property set stream: \"" + streamName + "\""); out("No property set stream: \"" + streamName + "\"");
return; return;
} catch (Exception ex) { } catch (Exception ex) {
if (ExceptionUtil.isFatal(ex)) {
ExceptionUtil.rethrow(ex);
}
throw new HPSFRuntimeException("Property set stream \"" + streamName + "\": " + ex); throw new HPSFRuntimeException("Property set stream \"" + streamName + "\": " + ex);
} }

View File

@ -24,7 +24,6 @@ import java.util.Locale;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil; import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory; import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory;
import org.apache.poi.util.ExceptionUtil;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
@ -105,9 +104,6 @@ public class ExcelAntTask extends Task {
try { try {
workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName()); workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName());
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new BuildException(e.getMessage(), e); throw new BuildException(e.getMessage(), e);
} }
} }
@ -148,9 +144,6 @@ public class ExcelAntTask extends Task {
Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook"); Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook");
Class.forName("org.apache.poi.ss.usermodel.WorkbookFactory"); Class.forName("org.apache.poi.ss.usermodel.WorkbookFactory");
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new BuildException( throw new BuildException(
"The <classpath> for <excelant> must include poi.jar and poi-ooxml.jar " + "The <classpath> for <excelant> must include poi.jar and poi-ooxml.jar " +
"if not in Ant's own classpath. Processing .xlsx spreadsheets requires " + "if not in Ant's own classpath. Processing .xlsx spreadsheets requires " +

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.poi.hdgf.chunks.ChunkFactory.CommandDefinition; import org.apache.poi.hdgf.chunks.ChunkFactory.CommandDefinition;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import static org.apache.logging.log4j.util.Unbox.box; import static org.apache.logging.log4j.util.Unbox.box;
@ -246,9 +245,6 @@ public final class Chunk {
} }
} }
catch (Exception e) { catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atError().withThrowable(e).log("Unexpected error processing command, ignoring and continuing. Command: {}", command); LOG.atError().withThrowable(e).log("Unexpected error processing command, ignoring and continuing. Command: {}", command);
} }

View File

@ -25,7 +25,6 @@ import org.apache.poi.hdgf.chunks.Chunk;
import org.apache.poi.hdgf.chunks.ChunkFactory; import org.apache.poi.hdgf.chunks.ChunkFactory;
import org.apache.poi.hdgf.chunks.ChunkHeader; import org.apache.poi.hdgf.chunks.ChunkHeader;
import org.apache.poi.hdgf.pointers.Pointer; import org.apache.poi.hdgf.pointers.Pointer;
import org.apache.poi.util.ExceptionUtil;
import static org.apache.logging.log4j.util.Unbox.box; import static org.apache.logging.log4j.util.Unbox.box;
@ -73,10 +72,9 @@ public final class ChunkStream extends Stream {
pos = contents.length; pos = contents.length;
} }
} }
} catch (Exception e) { }
if (ExceptionUtil.isFatal(e)) { catch (Exception e)
ExceptionUtil.rethrow(e); {
}
LOG.atError().withThrowable(e).log("Failed to create chunk at {}, ignoring rest of data.", box(pos)); LOG.atError().withThrowable(e).log("Failed to create chunk at {}, ignoring rest of data.", box(pos));
} }

View File

@ -51,7 +51,6 @@ import org.apache.poi.hwmf.record.HwmfColorRef;
import org.apache.poi.hwmf.record.HwmfMisc; import org.apache.poi.hwmf.record.HwmfMisc;
import org.apache.poi.hwmf.record.HwmfObjectTableEntry; import org.apache.poi.hwmf.record.HwmfObjectTableEntry;
import org.apache.poi.hwmf.record.HwmfPenStyle; import org.apache.poi.hwmf.record.HwmfPenStyle;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
public class HemfGraphics extends HwmfGraphics { public class HemfGraphics extends HwmfGraphics {
@ -146,9 +145,6 @@ public class HemfGraphics extends HwmfGraphics {
try { try {
pathConsumer.accept(path); pathConsumer.accept(path);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
// workaround if a path has been started and no MoveTo command // workaround if a path has been started and no MoveTo command
// has been specified before the first lineTo/splineTo // has been specified before the first lineTo/splineTo
final Point2D loc = prop.getLocation(); final Point2D loc = prop.getLocation();

View File

@ -45,7 +45,6 @@ import org.apache.poi.sl.draw.ImageRenderer;
import org.apache.poi.sl.usermodel.PictureData.PictureType; import org.apache.poi.sl.usermodel.PictureData.PictureType;
import org.apache.poi.util.BitField; import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.GenericRecordJsonWriter; import org.apache.poi.util.GenericRecordJsonWriter;
import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
@ -443,10 +442,7 @@ public class HemfPlusImage {
default: default:
break; break;
} }
} catch (Exception e) { } catch (Exception ignored) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
} }
return new Rectangle2D.Double(1,1,1,1); return new Rectangle2D.Double(1,1,1,1);
} }

View File

@ -35,7 +35,6 @@ import org.apache.poi.ddf.EscherContainerRecord;
import org.apache.poi.hslf.exceptions.HSLFException; import org.apache.poi.hslf.exceptions.HSLFException;
import org.apache.poi.hslf.usermodel.HSLFSlideShow; import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.sl.image.ImageHeaderPICT; import org.apache.poi.sl.image.ImageHeaderPICT;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal; import org.apache.poi.util.Removal;
@ -105,9 +104,6 @@ public final class PICT extends Metafile {
Arrays.fill(chunk, (byte) 0); Arrays.fill(chunk, (byte) 0);
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
int lastLen = chunk.length - 1; int lastLen = chunk.length - 1;
while (lastLen >= 0 && chunk[lastLen] == 0) { while (lastLen >= 0 && chunk[lastLen] == 0) {
lastLen--; lastLen--;

View File

@ -27,7 +27,6 @@ import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.apache.poi.hslf.model.textproperties.IndentProp; import org.apache.poi.hslf.model.textproperties.IndentProp;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
@ -98,10 +97,7 @@ public final class MasterTextPropAtom extends RecordAtom {
try { try {
read(); read();
} catch (Exception e) { } catch (Exception e){
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atError().withThrowable(e).log("Failed to parse MasterTextPropAtom"); LOG.atError().withThrowable(e).log("Failed to parse MasterTextPropAtom");
} }
} }

View File

@ -32,7 +32,6 @@ import org.apache.poi.hslf.exceptions.HSLFException;
import org.apache.poi.hslf.model.textproperties.TextPropCollection; import org.apache.poi.hslf.model.textproperties.TextPropCollection;
import org.apache.poi.hslf.model.textproperties.TextPropCollection.TextPropType; import org.apache.poi.hslf.model.textproperties.TextPropCollection.TextPropType;
import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder; import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
@ -77,10 +76,7 @@ public final class TxMasterStyleAtom extends RecordAtom {
//read available styles //read available styles
try { try {
init(); init();
} catch (Exception e) { } catch (Exception e){
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atWarn().withThrowable(e).log("Exception when reading available styles"); LOG.atWarn().withThrowable(e).log("Exception when reading available styles");
} }
} }

View File

@ -42,7 +42,6 @@ import org.apache.poi.poifs.crypt.Decryptor;
import org.apache.poi.poifs.crypt.EncryptionInfo; import org.apache.poi.poifs.crypt.EncryptionInfo;
import org.apache.poi.poifs.crypt.Encryptor; import org.apache.poi.poifs.crypt.Encryptor;
import org.apache.poi.util.BitField; import org.apache.poi.util.BitField;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
@ -171,9 +170,6 @@ public class HSLFSlideShowEncrypted implements Closeable {
} }
cyos.initCipherForBlock(persistId, false); cyos.initCipherForBlock(persistId, false);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedPowerPointFileException(e); throw new EncryptedPowerPointFileException(e);
} }
return cyos; return cyos;
@ -203,9 +199,6 @@ public class HSLFSlideShowEncrypted implements Closeable {
readFully(ccis, docstream, offset+8, rlen); readFully(ccis, docstream, offset+8, rlen);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedPowerPointFileException(e); throw new EncryptedPowerPointFileException(e);
} }
} }
@ -290,9 +283,6 @@ public class HSLFSlideShowEncrypted implements Closeable {
int blipLen = endOffset - offset; int blipLen = endOffset - offset;
decryptPicBytes(pictstream, offset, blipLen); decryptPicBytes(pictstream, offset, blipLen);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new CorruptPowerPointFileException(e); throw new CorruptPowerPointFileException(e);
} }
} }
@ -372,9 +362,6 @@ public class HSLFSlideShowEncrypted implements Closeable {
ccos.write(pictstream, offset, blipLen); ccos.write(pictstream, offset, blipLen);
ccos.flush(); ccos.flush();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedPowerPointFileException(e); throw new EncryptedPowerPointFileException(e);
} finally { } finally {
IOUtils.closeQuietly(ccos); IOUtils.closeQuietly(ccos);

View File

@ -47,7 +47,6 @@ import org.apache.poi.hwmf.record.HwmfRecordType;
import org.apache.poi.hwmf.record.HwmfWindowing.WmfSetWindowExt; import org.apache.poi.hwmf.record.HwmfWindowing.WmfSetWindowExt;
import org.apache.poi.hwmf.record.HwmfWindowing.WmfSetWindowOrg; import org.apache.poi.hwmf.record.HwmfWindowing.WmfSetWindowOrg;
import org.apache.poi.util.Dimension2DDouble; import org.apache.poi.util.Dimension2DDouble;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndianInputStream; import org.apache.poi.util.LittleEndianInputStream;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
@ -107,9 +106,6 @@ public class HwmfPicture implements Iterable<HwmfRecord>, GenericRecord {
recordSize = (int)recordSizeLong; recordSize = (int)recordSizeLong;
recordFunction = leis.readShort(); recordFunction = leis.readShort();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atError().log("unexpected eof - wmf file was truncated"); LOG.atError().log("unexpected eof - wmf file was truncated");
break; break;
} }

View File

@ -71,7 +71,6 @@ import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.Entry; import org.apache.poi.poifs.filesystem.Entry;
import org.apache.poi.poifs.filesystem.EntryUtils; import org.apache.poi.poifs.filesystem.EntryUtils;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndianByteArrayOutputStream; import org.apache.poi.util.LittleEndianByteArrayOutputStream;
@ -299,9 +298,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
try { try {
preserveBinTables = Boolean.parseBoolean(System.getProperty(PROPERTY_PRESERVE_BIN_TABLES)); preserveBinTables = Boolean.parseBoolean(System.getProperty(PROPERTY_PRESERVE_BIN_TABLES));
} catch (Exception exc) { } catch (Exception exc) {
if (ExceptionUtil.isFatal(exc)) { // ignore;
ExceptionUtil.rethrow(exc);
}
} }
if (!preserveBinTables) { if (!preserveBinTables) {
@ -317,9 +314,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
try { try {
preserveTextTable = Boolean.parseBoolean(System.getProperty(PROPERTY_PRESERVE_TEXT_TABLE)); preserveTextTable = Boolean.parseBoolean(System.getProperty(PROPERTY_PRESERVE_TEXT_TABLE));
} catch (Exception exc) { } catch (Exception exc) {
if (ExceptionUtil.isFatal(exc)) { // ignore;
ExceptionUtil.rethrow(exc);
}
} }
if (!preserveTextTable) { if (!preserveTextTable) {
_cft = new ComplexFileTable(); _cft = new ComplexFileTable();

View File

@ -51,7 +51,6 @@ import org.apache.poi.hwpf.usermodel.TableCell;
import org.apache.poi.hwpf.usermodel.TableRow; import org.apache.poi.hwpf.usermodel.TableRow;
import org.apache.poi.poifs.filesystem.Entry; import org.apache.poi.poifs.filesystem.Entry;
import org.apache.poi.util.Beta; import org.apache.poi.util.Beta;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
@ -628,9 +627,6 @@ public abstract class AbstractWordConverter {
processDocumentInformation(summaryInformation); processDocumentInformation(summaryInformation);
} }
} catch (Exception exc) { } catch (Exception exc) {
if (ExceptionUtil.isFatal(exc)) {
ExceptionUtil.rethrow(exc);
}
LOG.atWarn().withThrowable(exc).log("Unable to process document summary information"); LOG.atWarn().withThrowable(exc).log("Unable to process document summary information");
} }
@ -896,9 +892,6 @@ public abstract class AbstractWordConverter {
try { try {
return processOle2(doc, block, entry); return processOle2(doc, block, entry);
} catch (Exception exc) { } catch (Exception exc) {
if (ExceptionUtil.isFatal(exc)) {
ExceptionUtil.rethrow(exc);
}
LOG.atWarn().withThrowable(exc).log("Unable to convert internal OLE2 object '{}'", box(characterRun.getPicOffset())); LOG.atWarn().withThrowable(exc).log("Unable to convert internal OLE2 object '{}'", box(characterRun.getPicOffset()));
return false; return false;
} }
@ -954,9 +947,6 @@ public abstract class AbstractWordConverter {
processParagraph(wordDocument, flow, currentTableLevel, paragraph, label); processParagraph(wordDocument, flow, currentTableLevel, paragraph, label);
processed = true; processed = true;
} catch (Exception exc) { } catch (Exception exc) {
if (ExceptionUtil.isFatal(exc)) {
ExceptionUtil.rethrow(exc);
}
LOG.atWarn().withThrowable(exc).log("Can't process paragraph as list entry, will be processed without list information"); LOG.atWarn().withThrowable(exc).log("Can't process paragraph as list entry, will be processed without list information");
} }
} }

View File

@ -26,7 +26,6 @@ import org.apache.poi.hwpf.converter.WordToTextConverter;
import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.ExceptionUtil;
/** /**
* Class to extract the text from old (Word 6 / Word 95) Word Documents. * Class to extract the text from old (Word 6 / Word 95) Word Documents.
@ -91,9 +90,6 @@ public final class Word6Extractor implements POIOLE2TextExtractor {
ret = WordExtractor.getParagraphText(r); ret = WordExtractor.getParagraphText(r);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
// Something's up with turning the text pieces into paragraphs // Something's up with turning the text pieces into paragraphs
// Fall back to ripping out the text pieces // Fall back to ripping out the text pieces
ret = new String[doc.getTextTable().getTextPieces().size()]; ret = new String[doc.getTextTable().getTextPieces().size()];

View File

@ -35,7 +35,6 @@ import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.CharacterRun; import org.apache.poi.hwpf.usermodel.CharacterRun;
import org.apache.poi.hwpf.usermodel.Picture; import org.apache.poi.hwpf.usermodel.Picture;
import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
@ -180,9 +179,6 @@ public final class PicturesTable {
pictures.add(new Picture(blip)); pictures.add(new Picture(blip));
} }
} catch (Exception exc) { } catch (Exception exc) {
if (ExceptionUtil.isFatal(exc)) {
ExceptionUtil.rethrow(exc);
}
LOG.atWarn().withThrowable(exc).log("Unable to load picture from BLIP record at offset #{}", box(bse.getOffset())); LOG.atWarn().withThrowable(exc).log("Unable to load picture from BLIP record at offset #{}", box(bse.getOffset()));
} }
} }

View File

@ -20,7 +20,6 @@ package org.apache.poi.hwpf.sprm;
import java.util.Arrays; import java.util.Arrays;
import org.apache.poi.common.Duplicatable; import org.apache.poi.common.Duplicatable;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
@ -209,9 +208,6 @@ public final class SprmBuffer implements Duplicatable {
try { try {
stringBuilder.append(iterator.next()); stringBuilder.append(iterator.next());
} catch (Exception exc) { } catch (Exception exc) {
if (ExceptionUtil.isFatal(exc)) {
ExceptionUtil.rethrow(exc);
}
stringBuilder.append("error"); stringBuilder.append("error");
} }
stringBuilder.append("; "); stringBuilder.append("; ");

View File

@ -45,7 +45,6 @@ import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIEncryptor;
import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentInputStream; import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
@ -246,9 +245,6 @@ public abstract class POIDocument implements Closeable {
} catch (IOException e) { } catch (IOException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new IOException("Error "+step+" property set with name " + setName, e); throw new IOException("Error "+step+" property set with name " + setName, e);
} finally { } finally {
IOUtils.closeQuietly(encPoifs); IOUtils.closeQuietly(encPoifs);

View File

@ -35,7 +35,6 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.poi.hpsf.wellknown.PropertyIDMap; import org.apache.poi.hpsf.wellknown.PropertyIDMap;
import org.apache.poi.util.CodePageUtil; import org.apache.poi.util.CodePageUtil;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianByteArrayInputStream; import org.apache.poi.util.LittleEndianByteArrayInputStream;
@ -404,9 +403,6 @@ public class Property {
try { try {
write(bos, codepage); write(bos, codepage);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atWarn().withThrowable(e).log("can't serialize string"); LOG.atWarn().withThrowable(e).log("can't serialize string");
} }
@ -479,9 +475,6 @@ public class Property {
return LocaleUtil.getLocaleFromLCID(((Number)value).intValue()); return LocaleUtil.getLocaleFromLCID(((Number)value).intValue());
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atWarn().log("Can't decode id {}", box(getID())); LOG.atWarn().log("Can't decode id {}", box(getID()));
} }
return null; return null;

View File

@ -35,7 +35,6 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.poi.hpsf.wellknown.PropertyIDMap; import org.apache.poi.hpsf.wellknown.PropertyIDMap;
import org.apache.poi.util.CodePageUtil; import org.apache.poi.util.CodePageUtil;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianByteArrayInputStream; import org.apache.poi.util.LittleEndianByteArrayInputStream;
@ -548,9 +547,6 @@ public class Section {
} catch (HPSFRuntimeException ex) { } catch (HPSFRuntimeException ex) {
throw ex; throw ex;
} catch (Exception ex) { } catch (Exception ex) {
if (ExceptionUtil.isFatal(ex)) {
ExceptionUtil.rethrow(ex);
}
throw new HPSFRuntimeException(ex); throw new HPSFRuntimeException(ex);
} }
} }

View File

@ -25,7 +25,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.crypt.ChunkedCipherInputStream; import org.apache.poi.poifs.crypt.ChunkedCipherInputStream;
import org.apache.poi.poifs.crypt.Decryptor; import org.apache.poi.poifs.crypt.Decryptor;
import org.apache.poi.poifs.crypt.EncryptionInfo; import org.apache.poi.poifs.crypt.EncryptionInfo;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
@ -62,9 +61,6 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia
ccis.readFully(initialBuf); ccis.readFully(initialBuf);
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new RecordFormatException(e); throw new RecordFormatException(e);
} }
} }

View File

@ -105,7 +105,6 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.ss.util.WorkbookUtil; import org.apache.poi.ss.util.WorkbookUtil;
import org.apache.poi.util.Configurator; import org.apache.poi.util.Configurator;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
@ -1585,9 +1584,6 @@ public final class HSSFWorkbook extends POIDocument implements Workbook {
} }
os.close(); os.close();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedDocumentException(e); throw new EncryptedDocumentException(e);
} }
} }

View File

@ -34,7 +34,6 @@ import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.RC2ParameterSpec; import javax.crypto.spec.RC2ParameterSpec;
import org.apache.poi.EncryptedDocumentException; import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
@ -347,9 +346,6 @@ public final class CryptoFunctions {
Class<Provider> clazz = (Class<Provider>)cl.loadClass(bcProviderName); Class<Provider> clazz = (Class<Provider>)cl.loadClass(bcProviderName);
Security.addProvider(clazz.getDeclaredConstructor().newInstance()); Security.addProvider(clazz.getDeclaredConstructor().newInstance());
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedDocumentException("Only the BouncyCastle provider supports your encryption settings - please add it to the classpath.", e); throw new EncryptedDocumentException("Only the BouncyCastle provider supports your encryption settings - please add it to the classpath.", e);
} }
} }

View File

@ -35,7 +35,6 @@ import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.BitField; import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.LittleEndianInput; import org.apache.poi.util.LittleEndianInput;
/** /**
@ -142,9 +141,6 @@ public class EncryptionInfo implements GenericRecord {
try { try {
eib = getBuilder(encryptionMode); eib = getBuilder(encryptionMode);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new IOException(e); throw new IOException(e);
} }
@ -191,9 +187,6 @@ public class EncryptionInfo implements GenericRecord {
try { try {
eib = getBuilder(encryptionMode); eib = getBuilder(encryptionMode);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedDocumentException(e); throw new EncryptedDocumentException(e);
} }

View File

@ -24,7 +24,6 @@ import org.apache.poi.poifs.crypt.ChainingMode;
import org.apache.poi.poifs.crypt.CipherAlgorithm; import org.apache.poi.poifs.crypt.CipherAlgorithm;
import org.apache.poi.poifs.crypt.EncryptionHeader; import org.apache.poi.poifs.crypt.EncryptionHeader;
import org.apache.poi.poifs.crypt.HashAlgorithm; import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.GenericRecordUtil;
public class AgileEncryptionHeader extends EncryptionHeader { public class AgileEncryptionHeader extends EncryptionHeader {
@ -49,9 +48,6 @@ public class AgileEncryptionHeader extends EncryptionHeader {
throw new NullPointerException("keyData not set"); throw new NullPointerException("keyData not set");
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedDocumentException("Unable to parse keyData"); throw new EncryptedDocumentException("Unable to parse keyData");
} }

View File

@ -42,7 +42,6 @@ import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.BitField; import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianInputStream; import org.apache.poi.util.LittleEndianInputStream;
@ -213,8 +212,6 @@ public class CryptoAPIDecryptor extends Decryptor {
throw (GeneralSecurityException)e; throw (GeneralSecurityException)e;
} else if (e instanceof IOException) { } else if (e instanceof IOException) {
throw (IOException)e; throw (IOException)e;
} else if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
} else { } else {
throw new IOException("summary entries can't be read", e); throw new IOException("summary entries can't be read", e);
} }

View File

@ -24,7 +24,6 @@ import javax.crypto.Cipher;
import org.apache.commons.io.input.BoundedInputStream; import org.apache.commons.io.input.BoundedInputStream;
import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.poi.EncryptedDocumentException; import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
/** /**
@ -60,9 +59,6 @@ import org.apache.poi.util.Internal;
cipher.update(oneByte, 0, 1, oneByte, 0); cipher.update(oneByte, 0, 1, oneByte, 0);
super.write(oneByte); super.write(oneByte);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedDocumentException(e); throw new EncryptedDocumentException(e);
} }
} }
@ -73,9 +69,6 @@ import org.apache.poi.util.Internal;
cipher.update(b, off, len, b, off); cipher.update(b, off, len, b, off);
super.write(b, off, len); super.write(b, off, len);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new EncryptedDocumentException(e); throw new EncryptedDocumentException(e);
} }
} }

View File

@ -35,7 +35,6 @@ import org.apache.poi.poifs.filesystem.FileMagic;
import org.apache.poi.sl.usermodel.PictureData; import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.sl.usermodel.PictureShape; import org.apache.poi.sl.usermodel.PictureShape;
import org.apache.poi.sl.usermodel.RectAlign; import org.apache.poi.sl.usermodel.RectAlign;
import org.apache.poi.util.ExceptionUtil;
public class DrawPictureShape extends DrawSimpleShape { public class DrawPictureShape extends DrawSimpleShape {
@ -104,10 +103,7 @@ public class DrawPictureShape extends DrawSimpleShape {
} }
} catch (NoSuchElementException ignored) { } catch (NoSuchElementException ignored) {
break; break;
} catch (Exception | ServiceConfigurationError e) { } catch (Exception | ServiceConfigurationError ignored) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
} }
} }

View File

@ -47,7 +47,6 @@ import org.apache.poi.ss.usermodel.ShapeContainer;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.Beta; import org.apache.poi.util.Beta;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
@ -133,9 +132,6 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
data = new EmbeddedData(od.getFileName(), od.getObjectData(), od.getContentType()); data = new EmbeddedData(od.getFileName(), od.getObjectData(), od.getContentType());
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atWarn().withThrowable(e).log("Entry not found / readable - ignoring OLE embedding"); LOG.atWarn().withThrowable(e).log("Entry not found / readable - ignoring OLE embedding");
} }
} else if (shape instanceof Picture) { } else if (shape instanceof Picture) {

View File

@ -51,7 +51,6 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
@ -510,9 +509,6 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
// see TextFunction.TRIM for implementation // see TextFunction.TRIM for implementation
return StringUtil.isBlank(v); return StringUtil.isBlank(v);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
// not a valid string value, and not a blank cell (that's checked earlier) // not a valid string value, and not a blank cell (that's checked earlier)
return false; return false;
} }
@ -522,9 +518,6 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
// see TextFunction.TRIM for implementation // see TextFunction.TRIM for implementation
return StringUtil.isNotBlank(v); return StringUtil.isNotBlank(v);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
// not a valid string value, but not blank // not a valid string value, but not blank
return true; return true;
} }

View File

@ -42,7 +42,6 @@ import org.apache.poi.ss.formula.ptg.Ref3DPtg;
import org.apache.poi.ss.formula.ptg.Ref3DPxg; import org.apache.poi.ss.formula.ptg.Ref3DPxg;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.ss.util.CellReference.NameType; import org.apache.poi.ss.util.CellReference.NameType;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
/** /**
@ -258,9 +257,6 @@ public final class OperationEvaluationContext {
} }
return new LazyAreaEval(0, absoluteC, ssVersion.getLastRowIndex(), absoluteC, sre); return new LazyAreaEval(0, absoluteC, ssVersion.getLastRowIndex(), absoluteC, sre);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.REF_INVALID; return ErrorEval.REF_INVALID;
} }
} }
@ -283,9 +279,6 @@ public final class OperationEvaluationContext {
} }
return new LazyAreaEval(absoluteR, 0, absoluteR, ssVersion.getLastColumnIndex(), sre); return new LazyAreaEval(absoluteR, 0, absoluteR, ssVersion.getLastColumnIndex(), sre);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.REF_INVALID; return ErrorEval.REF_INVALID;
} }
} }

View File

@ -23,7 +23,6 @@ import java.util.regex.Pattern;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.util.ExceptionUtil;
/** /**
* Formats sheet names for use in formula expressions. * Formats sheet names for use in formula expressions.
@ -69,9 +68,6 @@ public final class SheetNameFormatter {
appendAndEscape(out, rawSheetName); appendAndEscape(out, rawSheetName);
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
} }
@ -100,9 +96,6 @@ public final class SheetNameFormatter {
appendOrREF(out, rawSheetName); appendOrREF(out, rawSheetName);
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
} }
@ -132,9 +125,6 @@ public final class SheetNameFormatter {
sb.append(ch); sb.append(ch);
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
} }

View File

@ -40,7 +40,6 @@ import org.apache.poi.ss.formula.udf.UDFFinder;
import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.util.CellRangeAddressBase; import org.apache.poi.ss.util.CellRangeAddressBase;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import static org.apache.logging.log4j.util.Unbox.box; import static org.apache.logging.log4j.util.Unbox.box;
@ -333,9 +332,6 @@ public final class WorkbookEvaluator {
String msg = "Error evaluating cell " + cr.formatAsString(); String msg = "Error evaluating cell " + cr.formatAsString();
return new NotImplementedException(msg, inner); return new NotImplementedException(msg, inner);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
// avoid bombing out during exception handling // avoid bombing out during exception handling
LOG.atError().withThrowable(e).log("Can't add exception info"); LOG.atError().withThrowable(e).log("Can't add exception info");
return inner; // preserve original exception return inner; // preserve original exception

View File

@ -24,7 +24,6 @@ import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.apache.poi.util.ExceptionUtil;
import static org.apache.poi.ss.formula.eval.RelationalOperationEval.EqualEval; import static org.apache.poi.ss.formula.eval.RelationalOperationEval.EqualEval;
@ -54,9 +53,6 @@ public final class Switch implements FreeRefFunction {
try { try {
expression = OperandResolver.getSingleValue(args[0], ec.getRowIndex(), ec.getColumnIndex()); expression = OperandResolver.getSingleValue(args[0], ec.getRowIndex(), ec.getColumnIndex());
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.NA; return ErrorEval.NA;
} }

View File

@ -23,7 +23,6 @@ import org.apache.poi.ss.formula.eval.*;
import org.apache.poi.ss.formula.functions.ArrayFunction; import org.apache.poi.ss.formula.functions.ArrayFunction;
import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.apache.poi.ss.formula.functions.LookupUtils; import org.apache.poi.ss.formula.functions.LookupUtils;
import org.apache.poi.util.ExceptionUtil;
/** /**
* Implementation of Excel function XLOOKUP() * Implementation of Excel function XLOOKUP()
@ -82,9 +81,6 @@ final class XLookupFunction implements FreeRefFunction, ArrayFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }
} }
@ -97,9 +93,6 @@ final class XLookupFunction implements FreeRefFunction, ArrayFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }
} }

View File

@ -22,7 +22,6 @@ import org.apache.poi.ss.formula.TwoDEval;
import org.apache.poi.ss.formula.eval.*; import org.apache.poi.ss.formula.eval.*;
import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.apache.poi.ss.formula.functions.LookupUtils; import org.apache.poi.ss.formula.functions.LookupUtils;
import org.apache.poi.util.ExceptionUtil;
/** /**
* Implementation of Excel function XMATCH() * Implementation of Excel function XMATCH()
@ -65,9 +64,6 @@ final class XMatchFunction implements FreeRefFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }
} }
@ -80,9 +76,6 @@ final class XMatchFunction implements FreeRefFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }
} }

View File

@ -22,7 +22,6 @@ import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.RefListEval; import org.apache.poi.ss.formula.eval.RefListEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.ptg.NumberPtg; import org.apache.poi.ss.formula.ptg.NumberPtg;
import org.apache.poi.util.ExceptionUtil;
/** /**
* Returns the number of areas in a reference. An area is a range of contiguous cells or a single cell. * Returns the number of areas in a reference. An area is a range of contiguous cells or a single cell.
@ -43,9 +42,6 @@ public final class Areas implements Function {
} }
return new NumberEval(new NumberPtg(result)); return new NumberEval(new NumberPtg(result));
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

View File

@ -21,7 +21,6 @@ import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.util.ExceptionUtil;
import java.util.List; import java.util.List;
@ -58,9 +57,6 @@ public class Correl extends Fixed2ArgFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.NA; return ErrorEval.NA;
} }
} }

View File

@ -22,7 +22,6 @@ import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.util.ExceptionUtil;
import java.util.List; import java.util.List;
@ -58,9 +57,6 @@ public class Covar extends Fixed2ArgFunction implements FreeRefFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.NA; return ErrorEval.NA;
} }
} }

View File

@ -32,7 +32,6 @@ import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.StringValueEval; import org.apache.poi.ss.formula.eval.StringValueEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.util.NumberComparer; import org.apache.poi.ss.util.NumberComparer;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
@ -137,9 +136,6 @@ public final class DStarRunner implements Function3Arg {
return e.getErrorEval(); return e.getErrorEval();
} }
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
if (!algorithm.allowEmptyMatchField()) { if (!algorithm.allowEmptyMatchField()) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }

View File

@ -28,7 +28,6 @@ import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.util.DateParser; import org.apache.poi.ss.util.DateParser;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
/** /**
@ -83,9 +82,6 @@ public class Days implements FreeRefFunction {
double d0 = NumericFunction.singleOperandEvaluate(ve, srcRowIndex, srcColumnIndex); double d0 = NumericFunction.singleOperandEvaluate(ve, srcRowIndex, srcColumnIndex);
return getDate(d0); return getDate(d0);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
String strText1 = OperandResolver.coerceValueToString(ve); String strText1 = OperandResolver.coerceValueToString(ve);
return DateParser.parseLocalDate(strText1); return DateParser.parseLocalDate(strText1);
} }

View File

@ -22,7 +22,6 @@ import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.util.ExceptionUtil;
import java.util.List; import java.util.List;
@ -74,9 +73,6 @@ public class Forecast extends Fixed3ArgFunction implements FreeRefFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.NA; return ErrorEval.NA;
} }
} }

View File

@ -31,7 +31,6 @@ import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.ptg.Area3DPxg; import org.apache.poi.ss.formula.ptg.Area3DPxg;
import org.apache.poi.ss.usermodel.Table; import org.apache.poi.ss.usermodel.Table;
import org.apache.poi.util.ExceptionUtil;
/** /**
* Implementation for Excel function INDIRECT<p> * Implementation for Excel function INDIRECT<p>
@ -143,9 +142,6 @@ public final class Indirect implements FreeRefFunction {
try { try {
return ec.getDynamicReference(workbookName, sheetName, refStrPart1, refStrPart2, isA1style); return ec.getDynamicReference(workbookName, sheetName, refStrPart1, refStrPart2, isA1style);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOGGER.atWarn().log("Indirect function: failed to parse reference {}", text, e); LOGGER.atWarn().log("Indirect function: failed to parse reference {}", text, e);
return ErrorEval.REF_INVALID; return ErrorEval.REF_INVALID;
} }

View File

@ -25,7 +25,6 @@ import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
/** /**
@ -112,9 +111,6 @@ public final class NumberValueFunction implements FreeRefFunction {
} catch (EvaluationException e) { } catch (EvaluationException e) {
return e.getErrorEval(); return e.getErrorEval();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.VALUE_INVALID; //If any of the arguments are not valid, NUMBERVALUE returns the #VALUE! error value. return ErrorEval.VALUE_INVALID; //If any of the arguments are not valid, NUMBERVALUE returns the #VALUE! error value.
} }

View File

@ -22,7 +22,6 @@ import org.apache.logging.log4j.Logger;
import org.apache.poi.ss.formula.eval.*; import org.apache.poi.ss.formula.eval.*;
import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.util.DateParser; import org.apache.poi.ss.util.DateParser;
import org.apache.poi.util.ExceptionUtil;
import java.time.DateTimeException; import java.time.DateTimeException;
import java.time.LocalDate; import java.time.LocalDate;
@ -61,17 +60,11 @@ public class TimeValue extends Fixed1ArgFunction {
try { try {
return parseTimeFromDateTime(dateTimeText); return parseTimeFromDateTime(dateTimeText);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
try { try {
//this could be a time (with no date part) - prepend a dummy date because //this could be a time (with no date part) - prepend a dummy date because
//parseTimeFromDateTime needs it //parseTimeFromDateTime needs it
return parseTimeFromDateTime("1/01/2000 " + dateTimeText); return parseTimeFromDateTime("1/01/2000 " + dateTimeText);
} catch (Exception e2) { } catch (Exception e2) {
if (ExceptionUtil.isFatal(e2)) {
ExceptionUtil.rethrow(e2);
}
LocalDate ld = DateParser.parseLocalDate(dateTimeText); LocalDate ld = DateParser.parseLocalDate(dateTimeText);
//return 0 as this is a pure date with no time element //return 0 as this is a pure date with no time element
return new NumberEval(0); return new NumberEval(0);

View File

@ -33,7 +33,6 @@ import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.util.ExceptionUtil;
/** /**
* Implementation for Excel WeekNum() function. * Implementation for Excel WeekNum() function.
@ -70,9 +69,6 @@ public class WeekNum extends Fixed2ArgFunction implements FreeRefFunction {
.atZone(ZoneId.systemDefault()) .atZone(ZoneId.systemDefault())
.toLocalDate(); .toLocalDate();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return ErrorEval.NUM_ERROR; return ErrorEval.NUM_ERROR;
} }
int returnType; int returnType;

View File

@ -47,7 +47,6 @@ import org.apache.poi.ss.format.CellFormatResult;
import org.apache.poi.ss.formula.ConditionalFormattingEvaluator; import org.apache.poi.ss.formula.ConditionalFormattingEvaluator;
import org.apache.poi.ss.util.DateFormatConverter; import org.apache.poi.ss.util.DateFormatConverter;
import org.apache.poi.ss.util.NumberToTextConverter; import org.apache.poi.ss.util.NumberToTextConverter;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
@ -408,9 +407,6 @@ public class DataFormatter {
// Wrap and return (non-cacheable - CellFormat does that) // Wrap and return (non-cacheable - CellFormat does that)
return new CellFormatResultWrapper( cfmt.apply(cellValueO) ); return new CellFormatResultWrapper( cfmt.apply(cellValueO) );
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atWarn().withThrowable(e).log("Formatting failed for format {}, falling back", formatStr); LOG.atWarn().withThrowable(e).log("Formatting failed for format {}, falling back", formatStr);
} }
} }
@ -1123,9 +1119,6 @@ public class DataFormatter {
try { try {
cellType = cell.getCachedFormulaResultType(); cellType = cell.getCachedFormulaResultType();
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
return cell.getCellFormula(); return cell.getCellFormula();
} }
} else { } else {

View File

@ -38,7 +38,6 @@ import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.ExceptionUtil;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
@ -193,9 +192,6 @@ public class SheetUtil {
try { try {
sval = formatter.formatCellValue(cell, dummyEvaluator); sval = formatter.formatCellValue(cell, dummyEvaluator);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
sval = String.valueOf(cell.getNumericCellValue()); sval = String.valueOf(cell.getNumericCellValue());
} }
} else if (cellType == CellType.BOOLEAN) { } else if (cellType == CellType.BOOLEAN) {

View File

@ -34,9 +34,6 @@ public class Configurator {
try { try {
return Integer.parseInt(property); return Integer.parseInt(property);
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
LOG.atError().log("System property -D{} does not contains a valid integer: {}", systemProperty, property); LOG.atError().log("System property -D{} does not contains a valid integer: {}", systemProperty, property);
return defaultValue; return defaultValue;
} }