harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r502255 - /harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java
Date Thu, 01 Feb 2007 16:04:16 GMT
Author: smishura
Date: Thu Feb  1 08:04:15 2007
New Revision: 502255

URL: http://svn.apache.org/viewvc?view=rev&rev=502255
Log:
Apply modified patch with regression test for HARMONY-1091:
[classlib][security] compatibility: DigestOutputStream().write(byte[], -1, 0) throws IllegalArgumentException
on HARMONY and IndexOutOfBoundsException on RI

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java?view=diff&rev=502255&r1=502254&r2=502255
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java
Thu Feb  1 08:04:15 2007
@@ -426,6 +426,42 @@
     }
 
     /**
+     * @tests java.security.DigestOutputStream#write(byte[], int, int)
+     */
+    public void test_writeLB$LILI() throws Exception {
+
+        // Regression form HARMONY-1091.
+        MessageDigest md = new MyMessageDigest1();
+        byte[] bytes = new byte[] { 1, 2 };
+        DigestOutputStream dig = new DigestOutputStream(
+                new ByteArrayOutputStream(), md);
+        // buf == null
+        try {
+            dig.write(null, -1, 0);
+            fail("No expected IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+        }
+        // offset + len > buf.length
+        try {
+            dig.write(bytes, 0, bytes.length + 1);
+            fail("No expected IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+        }
+        // offset < 0
+        try {
+            dig.write(bytes, -1, 1);
+            fail("No expected IndexOutOfBoundsException");
+        } catch (IndexOutOfBoundsException e) {
+        }
+        // len < 0
+        try {
+            dig.write(bytes, 0, -1);
+            fail("No expected IndexOutOfBoundsException");
+        } catch (IndexOutOfBoundsException e) {
+        }
+    }
+
+    /**
      * Test for <code>on()</code> method<br>
      * Assertion: turns digest functionality on or off
      */



Mime
View raw message