summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Moore <sethmo@google.com>2021-05-07 03:37:24 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-07 03:37:24 +0000
commit7ac158fda828553e168c7358becb95a2c238545a (patch)
treebe7c9823ce8b8189c01d1d432200f7ac5fb722c9
parent5e024acb23d75d0d739d5345f82f6796b65b5659 (diff)
parent85d779c4a47f85bebef0d9d80eda06d860242d93 (diff)
Merge "Don't re-wrap DeviceIdAttestationExceptions" am: 27bc799e7e am: 02359c00d6 am: 85d779c4a4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1698089 Change-Id: I9aefcc9b3b93a37437885d7e6fb1a8d9734b3dd1
-rw-r--r--keystore/java/android/security/keystore/AttestationUtils.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/keystore/java/android/security/keystore/AttestationUtils.java b/keystore/java/android/security/keystore/AttestationUtils.java
index 66d842ec5614..4da2a28fffc3 100644
--- a/keystore/java/android/security/keystore/AttestationUtils.java
+++ b/keystore/java/android/security/keystore/AttestationUtils.java
@@ -260,6 +260,11 @@ public abstract class AttestationUtils {
} catch (SecurityException e) {
throw e;
} catch (Exception e) {
+ // If a DeviceIdAttestationException was previously wrapped with some other type,
+ // let's throw the original exception instead of wrapping it yet again.
+ if (e.getCause() instanceof DeviceIdAttestationException) {
+ throw (DeviceIdAttestationException) e.getCause();
+ }
throw new DeviceIdAttestationException("Unable to perform attestation", e);
}
}