diff options
author | PJ Fanning <fanningpj@apache.org> | 2023-02-14 15:03:26 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2023-02-14 15:03:26 +0000 |
commit | d07d8e42b9d961a86a9adc09226bfb86e5b2b211 (patch) | |
tree | bf9e7b584c96804e9ae9d587c97a4ab0e0754f68 /poi-scratchpad | |
parent | f6cec39ba2f2abab5c668b8109f01d5be79125e2 (diff) | |
download | poi-d07d8e42b9d961a86a9adc09226bfb86e5b2b211.tar.gz poi-d07d8e42b9d961a86a9adc09226bfb86e5b2b211.zip |
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
Diffstat (limited to 'poi-scratchpad')
14 files changed, 8 insertions, 78 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java b/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java index b2a6b3925c..b85592f112 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java @@ -22,7 +22,6 @@ import java.util.ArrayList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.poi.hdgf.chunks.ChunkFactory.CommandDefinition; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.LittleEndian; import static org.apache.logging.log4j.util.Unbox.box; @@ -246,9 +245,6 @@ public final class Chunk { } } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } LOG.atError().withThrowable(e).log("Unexpected error processing command, ignoring and continuing. Command: {}", command); } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java b/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java index 9d807d7ed0..b1c10ae3e7 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java @@ -25,7 +25,6 @@ import org.apache.poi.hdgf.chunks.Chunk; import org.apache.poi.hdgf.chunks.ChunkFactory; import org.apache.poi.hdgf.chunks.ChunkHeader; import org.apache.poi.hdgf.pointers.Pointer; -import org.apache.poi.util.ExceptionUtil; import static org.apache.logging.log4j.util.Unbox.box; @@ -73,10 +72,9 @@ public final class ChunkStream extends Stream { pos = contents.length; } } - } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } + } + catch (Exception e) + { LOG.atError().withThrowable(e).log("Failed to create chunk at {}, ignoring rest of data.", box(pos)); } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hemf/draw/HemfGraphics.java b/poi-scratchpad/src/main/java/org/apache/poi/hemf/draw/HemfGraphics.java index ac3e5772db..113f8ede25 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hemf/draw/HemfGraphics.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hemf/draw/HemfGraphics.java @@ -51,7 +51,6 @@ import org.apache.poi.hwmf.record.HwmfColorRef; import org.apache.poi.hwmf.record.HwmfMisc; import org.apache.poi.hwmf.record.HwmfObjectTableEntry; import org.apache.poi.hwmf.record.HwmfPenStyle; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.Internal; public class HemfGraphics extends HwmfGraphics { @@ -146,9 +145,6 @@ public class HemfGraphics extends HwmfGraphics { try { pathConsumer.accept(path); } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } // workaround if a path has been started and no MoveTo command // has been specified before the first lineTo/splineTo final Point2D loc = prop.getLocation(); diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java index c50a3fec34..6afb53cdd3 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java @@ -45,7 +45,6 @@ import org.apache.poi.sl.draw.ImageRenderer; import org.apache.poi.sl.usermodel.PictureData.PictureType; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.GenericRecordJsonWriter; import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.IOUtils; @@ -443,10 +442,7 @@ public class HemfPlusImage { default: break; } - } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } + } catch (Exception ignored) { } return new Rectangle2D.Double(1,1,1,1); } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java index 172468a03f..3e5042af46 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java @@ -35,7 +35,6 @@ import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.hslf.exceptions.HSLFException; import org.apache.poi.hslf.usermodel.HSLFSlideShow; import org.apache.poi.sl.image.ImageHeaderPICT; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.IOUtils; import org.apache.poi.util.Internal; import org.apache.poi.util.Removal; @@ -105,9 +104,6 @@ public final class PICT extends Metafile { Arrays.fill(chunk, (byte) 0); } } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } int lastLen = chunk.length - 1; while (lastLen >= 0 && chunk[lastLen] == 0) { lastLen--; diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/MasterTextPropAtom.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/MasterTextPropAtom.java index ff5305cce6..a6065e3e24 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/MasterTextPropAtom.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/MasterTextPropAtom.java @@ -27,7 +27,6 @@ import java.util.Map; import java.util.function.Supplier; 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.IOUtils; import org.apache.poi.util.LittleEndian; @@ -98,10 +97,7 @@ public final class MasterTextPropAtom extends RecordAtom { try { read(); - } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } + } catch (Exception e){ LOG.atError().withThrowable(e).log("Failed to parse MasterTextPropAtom"); } } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/TxMasterStyleAtom.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/TxMasterStyleAtom.java index af307cc102..ca94a6acfd 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/TxMasterStyleAtom.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/TxMasterStyleAtom.java @@ -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.TextPropType; 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.IOUtils; import org.apache.poi.util.LittleEndian; @@ -77,10 +76,7 @@ public final class TxMasterStyleAtom extends RecordAtom { //read available styles try { init(); - } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } + } catch (Exception e){ LOG.atWarn().withThrowable(e).log("Exception when reading available styles"); } } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowEncrypted.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowEncrypted.java index 04ea654546..8c7effc7f3 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowEncrypted.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowEncrypted.java @@ -42,7 +42,6 @@ import org.apache.poi.poifs.crypt.Decryptor; import org.apache.poi.poifs.crypt.EncryptionInfo; import org.apache.poi.poifs.crypt.Encryptor; import org.apache.poi.util.BitField; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.IOUtils; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -171,9 +170,6 @@ public class HSLFSlideShowEncrypted implements Closeable { } cyos.initCipherForBlock(persistId, false); } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } throw new EncryptedPowerPointFileException(e); } return cyos; @@ -203,9 +199,6 @@ public class HSLFSlideShowEncrypted implements Closeable { readFully(ccis, docstream, offset+8, rlen); } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } throw new EncryptedPowerPointFileException(e); } } @@ -290,9 +283,6 @@ public class HSLFSlideShowEncrypted implements Closeable { int blipLen = endOffset - offset; decryptPicBytes(pictstream, offset, blipLen); } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } throw new CorruptPowerPointFileException(e); } } @@ -372,9 +362,6 @@ public class HSLFSlideShowEncrypted implements Closeable { ccos.write(pictstream, offset, blipLen); ccos.flush(); } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } throw new EncryptedPowerPointFileException(e); } finally { IOUtils.closeQuietly(ccos); diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/usermodel/HwmfPicture.java b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/usermodel/HwmfPicture.java index bbe782cd36..da220c941e 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/usermodel/HwmfPicture.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/usermodel/HwmfPicture.java @@ -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.WmfSetWindowOrg; import org.apache.poi.util.Dimension2DDouble; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndianInputStream; import org.apache.poi.util.LocaleUtil; @@ -107,9 +106,6 @@ public class HwmfPicture implements Iterable<HwmfRecord>, GenericRecord { recordSize = (int)recordSizeLong; recordFunction = leis.readShort(); } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } LOG.atError().log("unexpected eof - wmf file was truncated"); break; } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java index 8dbd2e2fe9..5a4296f8e1 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocument.java @@ -71,7 +71,6 @@ import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.Entry; import org.apache.poi.poifs.filesystem.EntryUtils; import org.apache.poi.poifs.filesystem.POIFSFileSystem; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.IOUtils; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndianByteArrayOutputStream; @@ -299,9 +298,7 @@ public final class HWPFDocument extends HWPFDocumentCore { try { preserveBinTables = Boolean.parseBoolean(System.getProperty(PROPERTY_PRESERVE_BIN_TABLES)); } catch (Exception exc) { - if (ExceptionUtil.isFatal(exc)) { - ExceptionUtil.rethrow(exc); - } + // ignore; } if (!preserveBinTables) { @@ -317,9 +314,7 @@ public final class HWPFDocument extends HWPFDocumentCore { try { preserveTextTable = Boolean.parseBoolean(System.getProperty(PROPERTY_PRESERVE_TEXT_TABLE)); } catch (Exception exc) { - if (ExceptionUtil.isFatal(exc)) { - ExceptionUtil.rethrow(exc); - } + // ignore; } if (!preserveTextTable) { _cft = new ComplexFileTable(); diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/converter/AbstractWordConverter.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/converter/AbstractWordConverter.java index 0a25404bcf..d6f410d286 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/converter/AbstractWordConverter.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/converter/AbstractWordConverter.java @@ -51,7 +51,6 @@ import org.apache.poi.hwpf.usermodel.TableCell; import org.apache.poi.hwpf.usermodel.TableRow; import org.apache.poi.poifs.filesystem.Entry; import org.apache.poi.util.Beta; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.Internal; import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.StringUtil; @@ -628,9 +627,6 @@ public abstract class AbstractWordConverter { processDocumentInformation(summaryInformation); } } catch (Exception exc) { - if (ExceptionUtil.isFatal(exc)) { - ExceptionUtil.rethrow(exc); - } LOG.atWarn().withThrowable(exc).log("Unable to process document summary information"); } @@ -896,9 +892,6 @@ public abstract class AbstractWordConverter { try { return processOle2(doc, block, entry); } catch (Exception exc) { - if (ExceptionUtil.isFatal(exc)) { - ExceptionUtil.rethrow(exc); - } LOG.atWarn().withThrowable(exc).log("Unable to convert internal OLE2 object '{}'", box(characterRun.getPicOffset())); return false; } @@ -954,9 +947,6 @@ public abstract class AbstractWordConverter { processParagraph(wordDocument, flow, currentTableLevel, paragraph, label); processed = true; } 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"); } } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/extractor/Word6Extractor.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/extractor/Word6Extractor.java index 19e538e511..6334855763 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/extractor/Word6Extractor.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/extractor/Word6Extractor.java @@ -26,7 +26,6 @@ import org.apache.poi.hwpf.converter.WordToTextConverter; import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.poifs.filesystem.DirectoryNode; 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. @@ -91,9 +90,6 @@ public final class Word6Extractor implements POIOLE2TextExtractor { ret = WordExtractor.getParagraphText(r); } catch (Exception e) { - if (ExceptionUtil.isFatal(e)) { - ExceptionUtil.rethrow(e); - } // Something's up with turning the text pieces into paragraphs // Fall back to ripping out the text pieces ret = new String[doc.getTextTable().getTextPieces().size()]; diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PicturesTable.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PicturesTable.java index a52def67b3..45e726e564 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PicturesTable.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PicturesTable.java @@ -35,7 +35,6 @@ import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.usermodel.CharacterRun; import org.apache.poi.hwpf.usermodel.Picture; import org.apache.poi.hwpf.usermodel.Range; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -180,9 +179,6 @@ public final class PicturesTable { pictures.add(new Picture(blip)); } } 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())); } } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/sprm/SprmBuffer.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/sprm/SprmBuffer.java index a77df8792a..38a0efaa02 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/sprm/SprmBuffer.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/sprm/SprmBuffer.java @@ -20,7 +20,6 @@ package org.apache.poi.hwpf.sprm; import java.util.Arrays; import org.apache.poi.common.Duplicatable; -import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.IOUtils; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -209,9 +208,6 @@ public final class SprmBuffer implements Duplicatable { try { stringBuilder.append(iterator.next()); } catch (Exception exc) { - if (ExceptionUtil.isFatal(exc)) { - ExceptionUtil.rethrow(exc); - } stringBuilder.append("error"); } stringBuilder.append("; "); |