From 46703b099516c383a6882815bcf9cd4df0ec538d Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Wed, 6 Apr 2011 15:41:29 -0700 Subject: Tolerate missing AccountManager resource, not just missing resource name In addition to the primary change in the subject, also some minor cleanup of javadoc, typos, CloseGuard warning, etc found while working on a new AbstractAccountAuthenticator. Change-Id: I73f3408773a43a0021a15f8d051fd3dbbdf898a5 --- keystore/java/android/security/KeyStore.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'keystore/java/android') diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java index 4614b53..7183688 100644 --- a/keystore/java/android/security/KeyStore.java +++ b/keystore/java/android/security/KeyStore.java @@ -23,10 +23,13 @@ import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.nio.charset.Charsets; import java.util.ArrayList; /** - * {@hide} + * @hide This should not be made public in its present form because it + * assumes that private and secret key bytes are available and would + * preclude the use of hardware crypto. */ public class KeyStore { public static final int NO_ERROR = 1; @@ -211,20 +214,10 @@ public class KeyStore { } private static byte[] getBytes(String string) { - try { - return string.getBytes("UTF-8"); - } catch (UnsupportedEncodingException e) { - // will never happen - throw new RuntimeException(e); - } + return string.getBytes(Charsets.UTF_8); } private static String toString(byte[] bytes) { - try { - return new String(bytes, "UTF-8"); - } catch (UnsupportedEncodingException e) { - // will never happen - throw new RuntimeException(e); - } + return new String(bytes, Charsets.UTF_8); } } -- cgit v1.1