Author: sebb
Date: Mon May 13 17:06:08 2013
New Revision: 1481974

URL: http://svn.apache.org/r1481974
Log:
new IOException(String, Throwable) is Java 1.6+

Modified:
    
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java

Modified: 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
URL: 
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java?rev=1481974&r1=1481973&r2=1481974&view=diff
==============================================================================
--- 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
 (original)
+++ 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/Coders.java
 Mon May 13 17:06:08 2013
@@ -149,8 +149,12 @@ class Coders {
                 try {
                     digest = MessageDigest.getInstance("SHA-256");
                 } catch (NoSuchAlgorithmException noSuchAlgorithmException) {
-                    throw new IOException("SHA-256 is unsupported by your Java 
implementation",
-                            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);
                 }
                 final byte[] extra = new byte[8];
                 for (long j = 0; j < (1L << numCyclesPower); j++) {
@@ -173,9 +177,14 @@ class Coders {
                 cipher.init(Cipher.DECRYPT_MODE, aesKey, new 
IvParameterSpec(iv));
                 return new CipherInputStream(in, cipher);
             } catch (GeneralSecurityException generalSecurityException) {
-                throw new IOException("Decryption error " +
-                        "(do you have the JCE Unlimited Strength Jurisdiction 
Policy Files installed?)",
-                        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);
             }
         }
     }


Reply via email to