changeset 10084:a132f7c497f8

8037846: Ensure streaming of input cipher streams Reviewed-by: xuelei, valeriep
author ascarpino
date Mon, 14 Apr 2014 21:04:33 +0000
parents af8da6fc2176
children 97da06a92e47
files src/share/classes/javax/crypto/CipherInputStream.java
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/crypto/CipherInputStream.java	Wed Apr 16 09:52:46 2014 -0700
+++ b/src/share/classes/javax/crypto/CipherInputStream.java	Mon Apr 14 21:04:33 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;
@@ -308,6 +312,7 @@
             }
         }
         catch (BadPaddingException | IllegalBlockSizeException ex) {
+            throw new IOException(ex);
         }
         ostart = 0;
         ofinish = 0;