harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhouke...@apache.org
Subject svn commit: r796991 - in /harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security: DigestInputStream2Test.java MessageDigest2Test.java
Date Thu, 23 Jul 2009 09:48:17 GMT
Author: zhoukevin
Date: Thu Jul 23 09:48:16 2009
New Revision: 796991

URL: http://svn.apache.org/viewvc?rev=796991&view=rev
Log:
Fix encoding bugs in DigestInputStream2Test and MessageDigest2Test for z/OS

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

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.java?rev=796991&r1=796990&r2=796991&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.java
Thu Jul 23 09:48:16 2009
@@ -19,6 +19,7 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.security.DigestInputStream;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -149,13 +150,14 @@
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method
 	 * is called before a test is executed.
+	 * @throws UnsupportedEncodingException 
 	 */
-	protected void setUp() {
+	protected void setUp() throws UnsupportedEncodingException {
 		// create a ByteArrayInputStream to perform digesting on
 		inStream = new ByteArrayInputStream(
-				"This is a test string for digesting".getBytes());
+				"This is a test string for digesting".getBytes("UTF-8"));
 		inStream1 = new ByteArrayInputStream(
-				"This is a test string for digesting".getBytes());
+				"This is a test string for digesting".getBytes("UTF-8"));
 		try {
 			digest = MessageDigest.getInstance("SHA-1");
 		} catch (NoSuchAlgorithmException e) {

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest2Test.java?rev=796991&r1=796990&r2=796991&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest2Test.java
Thu Jul 23 09:48:16 2009
@@ -20,6 +20,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.security.DigestException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -207,9 +208,10 @@
 	}
 
 	/**
+	 * @throws UnsupportedEncodingException 
 	 * @tests java.security.MessageDigest#digest()
 	 */
-	public void test_digest() {
+	public void test_digest() throws UnsupportedEncodingException {
 		MessageDigest sha = null;
 		try {
 			sha = MessageDigest.getInstance("SHA");
@@ -217,7 +219,7 @@
 		} catch (NoSuchAlgorithmException e) {
 			fail("getInstance did not find algorithm");
 		}
-		sha.update(MESSAGE.getBytes());
+		sha.update(MESSAGE.getBytes("UTF-8"));
 		byte[] digest = sha.digest();
 		assertTrue("bug in SHA", MessageDigest.isEqual(digest, MESSAGE_DIGEST));
 



Mime
View raw message