changeset 27066:d3f0b8d935e6

8037846: Ensure streaming of input cipher streams Reviewed-by: xuelei, valeriep
author ascarpino
date Mon, 14 Apr 2014 21:02:31 +0000
parents ae04a7cbf7de
children 0e748d185207
files jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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;