commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject commons-compress git commit: take advantage of IOException accepting cause in constructor
Date Sat, 09 Apr 2016 16:40:55 GMT
Repository: commons-compress
Updated Branches:
  refs/heads/master e7c50ceff -> 6cc5a2f13


take advantage of IOException accepting cause in constructor


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/6cc5a2f1
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/6cc5a2f1
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/6cc5a2f1

Branch: refs/heads/master
Commit: 6cc5a2f13e5214a766a328648afc80dfefa5f9aa
Parents: e7c50ce
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sat Apr 9 18:40:21 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sat Apr 9 18:40:21 2016 +0200

----------------------------------------------------------------------
 .../archivers/sevenz/AES256SHA256Decoder.java    | 19 +++++--------------
 .../compress/archivers/sevenz/Coders.java        |  9 ++++-----
 .../archivers/tar/TarArchiveInputStream.java     |  4 +---
 .../commons/compress/AbstractTestCase.java       |  5 +----
 4 files changed, 11 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
index e2ed5c2..c90a720 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256SHA256Decoder.java
@@ -68,12 +68,8 @@ class AES256SHA256Decoder extends CoderBase {
                     try {
                         digest = MessageDigest.getInstance("SHA-256");
                     } catch (NoSuchAlgorithmException noSuchAlgorithmException) {
-                        IOException ioe = new IOException("SHA-256 is unsupported by your
Java implementation");
-                        ioe.initCause(noSuchAlgorithmException);
-                        throw ioe;
-                        // TODO: simplify when Compress requires Java 1.6               

-//                      throw new IOException("SHA-256 is unsupported by your Java implementation",
-//                              noSuchAlgorithmException);
+                        throw new IOException("SHA-256 is unsupported by your Java implementation",
+                            noSuchAlgorithmException);
                     }
                     final byte[] extra = new byte[8];
                     for (long j = 0; j < (1L << numCyclesPower); j++) {
@@ -98,14 +94,9 @@ class AES256SHA256Decoder extends CoderBase {
                     isInitialized = true;
                     return cipherInputStream;
                 } catch (GeneralSecurityException generalSecurityException) {
-                    IOException ioe = new IOException("Decryption error " +
-                                                      "(do you have the JCE Unlimited Strength
Jurisdiction Policy Files installed?)");
-                    ioe.initCause(generalSecurityException);
-                    throw ioe;
-                    // TODO: simplify when Compress requires Java 1.6                
-//                  throw new IOException("Decryption error " +
-//                          "(do you have the JCE Unlimited Strength Jurisdiction Policy
Files installed?)",
-//                          generalSecurityException);
+                    throw new IOException("Decryption error " +
+                        "(do you have the JCE Unlimited Strength Jurisdiction Policy Files
installed?)",
+                        generalSecurityException);
                     }
             }
                 

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
index 06802e4..0de5130 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
@@ -127,11 +127,10 @@ class Coders {
             try {
                 return opts.getInputStream(in);
             } catch (AssertionError e) {
-                IOException ex = new IOException("BCJ filter used in " + archiveName
-                                                 + " needs XZ for Java > 1.4 - see "
-                                                 + "http://commons.apache.org/proper/commons-compress/limitations.html#7Z");
-                ex.initCause(e);
-                throw ex;
+                throw new IOException("BCJ filter used in " + archiveName
+                                      + " needs XZ for Java > 1.4 - see "
+                                      + "http://commons.apache.org/proper/commons-compress/limitations.html#7Z",
+                                      e);
             }
         }
         @Override

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 8b47bba..8dc8f79 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -283,9 +283,7 @@ public class TarArchiveInputStream extends ArchiveInputStream {
         try {
             currEntry = new TarArchiveEntry(headerBuf, zipEncoding);
         } catch (IllegalArgumentException e) {
-            IOException ioe = new IOException("Error detected parsing the header");
-            ioe.initCause(e);
-            throw ioe;
+            throw new IOException("Error detected parsing the header", e);
         }
 
         entryOffset = 0;

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/6cc5a2f1/src/test/java/org/apache/commons/compress/AbstractTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/AbstractTestCase.java b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
index a17d03e..93db1f3 100644
--- a/src/test/java/org/apache/commons/compress/AbstractTestCase.java
+++ b/src/test/java/org/apache/commons/compress/AbstractTestCase.java
@@ -76,10 +76,7 @@ public abstract class AbstractTestCase {
         try {
             uri = url.toURI();
         } catch (java.net.URISyntaxException ex) {
-//          throw new IOException(ex); // JDK 1.6+
-            IOException ioe = new IOException();
-            ioe.initCause(ex);
-            throw ioe;
+            throw new IOException(ex);
         }
         return new File(uri);
     }


Mime
View raw message