diff options
author | Narayan Kamath <narayan@google.com> | 2014-12-29 16:08:32 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-12-29 16:08:34 +0000 |
commit | 5106dd44f9e5877aee8e70711c026e9e23783d4c (patch) | |
tree | 703a0092b2f3cc0c5e46584754ab8d1246cb7a28 | |
parent | 5ae63a258b78c4982a6c4ae984b86bb7b2db1dd4 (diff) | |
parent | 1653b1dd69a3af0d8acc4121e5b8e743a2e491b7 (diff) | |
download | frameworks_base-5106dd44f9e5877aee8e70711c026e9e23783d4c.zip frameworks_base-5106dd44f9e5877aee8e70711c026e9e23783d4c.tar.gz frameworks_base-5106dd44f9e5877aee8e70711c026e9e23783d4c.tar.bz2 |
Merge "Throw IllegalArgumentException on invalid hex-strings."
-rw-r--r-- | services/core/java/com/android/server/MountService.java | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index 743db16..59570bf 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -2155,7 +2155,7 @@ class MountService extends IMountService.Stub } } - private String toHex(String password) { + private static String toHex(String password) { if (password == null) { return ""; } @@ -2163,18 +2163,12 @@ class MountService extends IMountService.Stub return new String(HexEncoding.encode(bytes)); } - private String fromHex(String hexPassword) { + private static String fromHex(String hexPassword) throws IllegalArgumentException { if (hexPassword == null) { return null; } - final byte[] bytes; - try { - bytes = HexEncoding.decode(hexPassword.toCharArray(), false); - } catch (IllegalArgumentException e) { - return null; - } - + final byte[] bytes = HexEncoding.decode(hexPassword.toCharArray(), false); return new String(bytes, StandardCharsets.UTF_8); } |