From f4bb4560edd288e6916d222b76caa8c9aa97baf7 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 18 Dec 2021 17:41:36 +0000 Subject: code tidy up git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896139 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/poi/hmef/HMEFMessage.java | 8 +++++++- .../apache/poi/hslf/usermodel/HSLFSlideShow.java | 9 +++++++++ .../main/java/org/apache/poi/hsmf/MAPIMessage.java | 22 ++++++++++++++++------ .../poi/hssf/converter/ExcelToHtmlConverter.java | 6 ++++++ .../org/apache/poi/hwmf/usermodel/HwmfPicture.java | 6 ++++++ .../java/org/apache/poi/hwpf/HWPFDocument.java | 6 ++++++ 6 files changed, 50 insertions(+), 7 deletions(-) (limited to 'poi-scratchpad/src') diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hmef/HMEFMessage.java b/poi-scratchpad/src/main/java/org/apache/poi/hmef/HMEFMessage.java index 6997cbf87b..f6e3b6c801 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hmef/HMEFMessage.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hmef/HMEFMessage.java @@ -47,7 +47,13 @@ public final class HMEFMessage { private final List messageAttributes = new ArrayList<>(); private final List mapiAttributes = new ArrayList<>(); private final List attachments = new ArrayList<>(); - + + /** + * @param inp input stream + * @throws IOException + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format + */ public HMEFMessage(InputStream inp) throws IOException { try { // Check the signature matches diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java index f7c7d4fa7e..736aae9d58 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java @@ -166,6 +166,9 @@ public final class HSLFSlideShow extends POIDocument implements SlideShowNote - this will buffer the whole message into memory * in order to process. For lower memory use, use {@link #MAPIMessage(File)} * - * @param in The InputStream to buffer then read from - * @exception IOException on errors reading, or invalid data + * @param in The InputStream to buffer and then read from + * @throws IOException on errors reading, or invalid data + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public MAPIMessage(InputStream in) throws IOException { this(new POIFSFileSystem(in)); @@ -134,7 +140,9 @@ public class MAPIMessage extends POIReadOnlyDocument { * Constructor for reading MSG Files from a POIFS filesystem * * @param fs Open POIFS FileSystem containing the message - * @exception IOException on errors reading, or invalid data + * @throws IOException on errors reading, or invalid data + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public MAPIMessage(POIFSFileSystem fs) throws IOException { this(fs.getRoot()); @@ -143,7 +151,9 @@ public class MAPIMessage extends POIReadOnlyDocument { * Constructor for reading MSG Files from a certain * point within a POIFS filesystem * @param poifsDir Directory containing the message - * @exception IOException on errors reading, or invalid data + * @throws IOException on errors reading, or invalid data + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public MAPIMessage(DirectoryNode poifsDir) throws IOException { super(poifsDir); diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java b/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java index 7c0fd29801..36e8b5983e 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java @@ -104,6 +104,8 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter { * @return DOM representation of result HTML * @throws IOException If an error occurs reading or writing files * @throws ParserConfigurationException If configuration is incorrect + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public static Document process(File xlsFile) throws IOException, ParserConfigurationException { try (HSSFWorkbook workbook = loadXls(xlsFile)) { @@ -118,6 +120,8 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter { * @return DOM representation of result HTML * @throws IOException If an error occurs reading or writing files * @throws ParserConfigurationException If configuration is incorrect + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public static Document process(InputStream xlsStream) throws IOException, ParserConfigurationException { try (HSSFWorkbook workbook = new HSSFWorkbook(xlsStream)) { @@ -132,6 +136,8 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter { * @return DOM representation of result HTML * @throws IOException If an error occurs reading or writing files * @throws ParserConfigurationException If configuration is incorrect + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public static Document process(HSSFWorkbook workbook) throws IOException, ParserConfigurationException { ExcelToHtmlConverter excelToHtmlConverter = new ExcelToHtmlConverter( 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 640212a382..ac57804945 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 @@ -80,6 +80,12 @@ public class HwmfPicture implements Iterable, GenericRecord { return MAX_RECORD_LENGTH; } + /** + * @param inputStream + * @throws IOException + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format + */ public HwmfPicture(InputStream inputStream) throws IOException { try (LittleEndianInputStream leis = new LittleEndianInputStream(inputStream)) { 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 f31df61f38..a058881977 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 @@ -215,6 +215,8 @@ public final class HWPFDocument extends HWPFDocumentCore { * @throws IOException If there is an unexpected IOException from the passed * in InputStream. * @throws org.apache.poi.EmptyFileException If the given stream is empty + * @throws RuntimeException a number of other runtime exceptions can be thrown, especially if there are problems with the + * input format */ public HWPFDocument(InputStream istream) throws IOException { //do Ole stuff @@ -227,6 +229,8 @@ public final class HWPFDocument extends HWPFDocumentCore { * @param pfilesystem The POIFSFileSystem that contains the Word document. * @throws IOException If there is an unexpected IOException from the passed * in POIFSFileSystem. + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public HWPFDocument(POIFSFileSystem pfilesystem) throws IOException { this(pfilesystem.getRoot()); @@ -240,6 +244,8 @@ public final class HWPFDocument extends HWPFDocumentCore { * @param directory The DirectoryNode that contains the Word document. * @throws IOException If there is an unexpected IOException from the passed * in POIFSFileSystem. + * @throws RuntimeException a number of runtime exceptions can be thrown, especially if there are problems with the + * input format */ public HWPFDocument(DirectoryNode directory) throws IOException { // Load the main stream and FIB -- cgit v1.2.3