8037846: Ensure streaming of input cipher streams
authorascarpino
Mon, 14 Apr 2014 21:02:31 +0000
changeset 27066 d3f0b8d935e6
parent 27064 ae04a7cbf7de
child 27067 0e748d185207
8037846: Ensure streaming of input cipher streams Reviewed-by: xuelei, valeriep
jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
--- a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java	Tue Oct 14 10:47:45 2014 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java	Mon Apr 14 21:02:31 2014 +0000
@@ -107,9 +107,10 @@
             done = true;
             try {
                 obuffer = cipher.doFinal();
+            } catch (IllegalBlockSizeException | BadPaddingException e) {
+                obuffer = null;
+                throw new IOException(e);
             }
-            catch (IllegalBlockSizeException e) {obuffer = null;}
-            catch (BadPaddingException e) {obuffer = null;}
             if (obuffer == null)
                 return -1;
             else {
@@ -120,7 +121,10 @@
         }
         try {
             obuffer = cipher.update(ibuffer, 0, readin);
-        } catch (IllegalStateException e) {obuffer = null;};
+        } catch (IllegalStateException e) {
+            obuffer = null;
+            throw e;
+        }
         ostart = 0;
         if (obuffer == null)
             ofinish = 0;
@@ -302,6 +306,7 @@
             }
         }
         catch (BadPaddingException | IllegalBlockSizeException ex) {
+            throw new IOException(ex);
         }
         ostart = 0;
         ofinish = 0;