harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r765636 - in /harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security: Identity2Test.java KeyStore3Test.java KeyStorePrivateKeyEntryTest.java cert/CertificateFactory4Test.java
Date Thu, 16 Apr 2009 13:48:33 GMT
Author: odeakin
Date: Thu Apr 16 13:48:32 2009
New Revision: 765636

URL: http://svn.apache.org/viewvc?rev=765636&view=rev
Log:
Make sure we use UTF-8 encoding when calling getBytes() for non-ASCII platforms.

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Identity2Test.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStorePrivateKeyEntryTest.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory4Test.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Identity2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Identity2Test.java?rev=765636&r1=765635&r2=765636&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Identity2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Identity2Test.java
Thu Apr 16 13:48:32 2009
@@ -20,6 +20,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.security.Identity;
 import java.security.IdentityScope;
 import java.security.KeyManagementException;
@@ -97,8 +98,7 @@
 			+ "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
 			+ "-----END CERTIFICATE-----\n";
 
-	ByteArrayInputStream certArray = new ByteArrayInputStream(certificate
-			.getBytes());
+	ByteArrayInputStream certArray;
 
 	String certificate2 = "-----BEGIN CERTIFICATE-----\n"
 			+ "MIICZzCCAdCgAwIBAgIBGzANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQGEwJVUzEY\n"
@@ -116,8 +116,18 @@
 			+ "VGQRYYlt+myhl2vy6yPzEVCjiKwMEb1Spu0irCf+lFW2hsdjvmSQMtZvOw==\n"
 			+ "-----END CERTIFICATE-----\n";
 
-	ByteArrayInputStream certArray2 = new ByteArrayInputStream(certificate2
-			.getBytes());
+	ByteArrayInputStream certArray2;
+
+        {
+            try {
+                certArray = new ByteArrayInputStream(certificate
+                            .getBytes("UTF-8"));
+                certArray2 = new ByteArrayInputStream(certificate2
+                            .getBytes("UTF-8"));
+            } catch (UnsupportedEncodingException e) {
+                throw new RuntimeException(e.getMessage());
+            }
+        }
 
 	public static class IdentitySubclass extends Identity {
 		public IdentitySubclass() {

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java?rev=765636&r1=765635&r2=765636&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
Thu Apr 16 13:48:32 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.security.Key;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
@@ -70,8 +71,14 @@
                 + "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
                 + "-----END CERTIFICATE-----\n";
 
-        ByteArrayInputStream certArray = new ByteArrayInputStream(
-                certificateData.getBytes());
+        ByteArrayInputStream certArray;
+        {
+            try {
+                certArray = new ByteArrayInputStream(certificateData.getBytes("UTF-8"));
+            } catch (UnsupportedEncodingException e) {
+                throw new RuntimeException(e.getMessage());
+            }
+        }
         CertificateFactory cf = CertificateFactory.getInstance("X.509");
         certificate = cf.generateCertificate(certArray);
     }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStorePrivateKeyEntryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStorePrivateKeyEntryTest.java?rev=765636&r1=765635&r2=765636&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStorePrivateKeyEntryTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStorePrivateKeyEntryTest.java
Thu Apr 16 13:48:32 2009
@@ -18,6 +18,7 @@
 package org.apache.harmony.security.tests.java.security;
 
 import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.KeyStore;
@@ -48,8 +49,15 @@
                 + "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
                 + "-----END CERTIFICATE-----\n";
 
-        ByteArrayInputStream certArray = new ByteArrayInputStream(
-                certificateData.getBytes());
+        ByteArrayInputStream certArray;
+        {
+            try{
+                 certArray = new ByteArrayInputStream(
+                    certificateData.getBytes("UTF-8"));
+            } catch (UnsupportedEncodingException e) {
+                throw new RuntimeException(e.getMessage());
+            }
+        }
         CertificateFactory cf = CertificateFactory.getInstance("X.509");
         Certificate certificate = cf.generateCertificate(certArray);
         assertTrue(certificate instanceof X509Certificate);

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory4Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory4Test.java?rev=765636&r1=765635&r2=765636&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory4Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory4Test.java
Thu Apr 16 13:48:32 2009
@@ -58,12 +58,12 @@
         CertificateFactory fact = CertificateFactory.getInstance("X.509");
         for (int i = 0; i < CERTIFICATES_ENCODED_X509.length; i++) {
             ByteArrayInputStream bais = new ByteArrayInputStream(
-                    CERTIFICATES_ENCODED_X509[i].getBytes());
+                    CERTIFICATES_ENCODED_X509[i].getBytes("UTF-8"));
             fact.generateCertificate(bais);
 
             // try again with generateCertificates()
             bais = new ByteArrayInputStream(CERTIFICATES_ENCODED_X509[i]
-                    .getBytes());
+                    .getBytes("UTF-8"));
             fact.generateCertificate(bais);
         }
 



Mime
View raw message