harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r501701 - in /harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/java/security/Signature.java test/impl/java.injected/java/security/Signature_Impl2Test.java
Date Wed, 31 Jan 2007 03:01:36 GMT
Author: liangyx
Date: Tue Jan 30 19:01:35 2007
New Revision: 501701

URL: http://svn.apache.org/viewvc?view=rev&rev=501701
Log:
Apply patch for HARMONY-749([classlib][security] compatibility: different exceptions for java.security.Signature
getInstance(null, Provider) and sign([],int,int) methods)

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Signature_Impl2Test.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java?view=diff&rev=501701&r1=501700&r2=501701
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Signature.java
Tue Jan 30 19:01:35 2007
@@ -260,15 +260,15 @@
      *  
      */
     public final int sign(byte[] outbuf, int offset, int len)
-            throws SignatureException {
-        if (state != SIGN) {
-            throw new SignatureException(
-                    Messages.getString("security.27")); //$NON-NLS-1$
-        }
+            throws SignatureException {       
         if (outbuf == null || offset < 0 || len < 0 ||
                 offset + len > outbuf.length) {
             throw new IllegalArgumentException(
                     Messages.getString("security.05")); //$NON-NLS-1$
+        }
+        if (state != SIGN) {
+            throw new SignatureException(
+                    Messages.getString("security.27")); //$NON-NLS-1$
         }
         return engineSign(outbuf, offset, len);
     }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Signature_Impl2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Signature_Impl2Test.java?view=diff&rev=501701&r1=501700&r2=501701
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Signature_Impl2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Signature_Impl2Test.java
Tue Jan 30 19:01:35 2007
@@ -166,8 +166,8 @@
 
         try {
             s.sign(b, 0, 5);
-            fail("No expected SignatureException 1");
-        } catch (SignatureException e) {
+            fail("No expected IllegalArgumentException 1");
+        } catch (IllegalArgumentException e) {
         }
 
         s.initSign(new MyPrivateKey());



Mime
View raw message