Author: fanningpj
Date: Mon Nov 8 20:49:45 2021
New Revision: 1894848
URL: http://svn.apache.org/viewvc?rev=1894848&view=rev
Log:
throw IOException if getInputStream fails
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java?rev=1894848&r1=1894847&r2=1894848&view=diff
==============================================================================
---
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java
(original)
+++
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java
Mon Nov 8 20:49:45 2021
@@ -71,27 +71,27 @@ import org.apache.poi.util.TempFile;
/**
* Returns zip entry.
* @return input stream
- * @throws RuntimeException since POI 5.1.0,
- * a RuntimeException can occur if the optional temp file has been removed
+ * @throws IOException since POI 5.2.0,
+ * an IOException can occur if the optional temp file has been removed
(was a RuntimeException in POI 5.1.0)
* @see ZipInputStreamZipEntrySource#setThresholdBytesForTempFiles(int)
*/
- public InputStream getInputStream() {
+ public InputStream getInputStream() throws IOException {
if (encryptedTempData != null) {
try {
return encryptedTempData.getInputStream();
} catch (IOException e) {
- throw new RuntimeException("failed to read from encrypted temp
data", e);
+ throw new IOException("failed to read from encrypted temp
data", e);
}
} else if (tempFile != null) {
try {
return new FileInputStream(tempFile);
} catch (FileNotFoundException e) {
- throw new RuntimeException("temp file " +
tempFile.getAbsolutePath() + " is missing");
+ throw new IOException("temp file " +
tempFile.getAbsolutePath() + " is missing");
}
} else if (data != null) {
return new UnsynchronizedByteArrayInputStream(data);
} else {
- throw new RuntimeException("Cannot retrieve data from Zip Entry,
probably because the Zip Entry was closed before the data was requested.");
+ throw new IOException("Cannot retrieve data from Zip Entry,
probably because the Zip Entry was closed before the data was requested.");
}
}
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java?rev=1894848&r1=1894847&r2=1894848&view=diff
==============================================================================
---
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
(original)
+++
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
Mon Nov 8 20:49:45 2021
@@ -107,7 +107,7 @@ public class ZipInputStreamZipEntrySourc
}
@Override
- public InputStream getInputStream(ZipArchiveEntry zipEntry) {
+ public InputStream getInputStream(ZipArchiveEntry zipEntry) throws
IOException {
assert (zipEntry instanceof ZipArchiveFakeEntry);
return ((ZipArchiveFakeEntry)zipEntry).getInputStream();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]