aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2016-02-15 10:08:26 +0000
committerDominik Stadler <centic@apache.org>2016-02-15 10:08:26 +0000
commitd1d31485a1dafd410da4cebe7a032f728a51cf1d (patch)
tree2771e67fa38e3394c82351f0efcc113d75372112 /src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
parent16b90ce3423263d0bfc89a14cbdd9820b3e7db6d (diff)
downloadpoi-d1d31485a1dafd410da4cebe7a032f728a51cf1d.tar.gz
poi-d1d31485a1dafd410da4cebe7a032f728a51cf1d.zip
No need to wrap OpenXML4JRuntimeException in another instance of itself and fix some compilation/javadoc warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1730482 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java')
-rw-r--r--src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
index ade8c806c3..6fa83e9398 100644
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
@@ -69,7 +69,9 @@ public final class ZipPackage extends Package {
try {
this.contentTypeManager = new ZipContentTypeManager(null, this);
- } catch (InvalidFormatException e) {}
+ } catch (InvalidFormatException e) {
+ logger.log(POILogger.WARN,"Could not parse ZipPackage", e);
+ }
}
/**
@@ -98,13 +100,11 @@ public final class ZipPackage extends Package {
* The path of the file to open or create.
* @param access
* The package access mode.
- * @throws InvalidFormatException
- * If the content type part parsing encounters an error.
*/
ZipPackage(String path, PackageAccess access) {
super(access);
- ZipFile zipFile = null;
+ final ZipFile zipFile;
try {
zipFile = ZipHelper.openZipFile(path);
@@ -123,13 +123,11 @@ public final class ZipPackage extends Package {
* The file to open or create.
* @param access
* The package access mode.
- * @throws InvalidFormatException
- * If the content type part parsing encounters an error.
*/
ZipPackage(File file, PackageAccess access) {
super(access);
- ZipFile zipFile = null;
+ final ZipFile zipFile;
try {
zipFile = ZipHelper.openZipFile(file);
@@ -150,8 +148,6 @@ public final class ZipPackage extends Package {
* Zip data to load.
* @param access
* The package access mode.
- * @throws InvalidFormatException
- * If the content type part parsing encounters an error.
*/
ZipPackage(ZipEntrySource zipEntry, PackageAccess access) {
super(access);
@@ -428,8 +424,8 @@ public final class ZipPackage extends Package {
public void saveImpl(OutputStream outputStream) {
// Check that the document was open in write mode
throwExceptionIfReadOnly();
- ZipOutputStream zos = null;
+ final ZipOutputStream zos;
try {
if (!(outputStream instanceof ZipOutputStream))
zos = new ZipOutputStream(outputStream);
@@ -499,6 +495,9 @@ public final class ZipPackage extends Package {
}
}
zos.close();
+ } catch (OpenXML4JRuntimeException e) {
+ // no need to wrap this type of Exception
+ throw e;
} catch (Exception e) {
throw new OpenXML4JRuntimeException(
"Fail to save: an error occurs while saving the package : "