diff options
author | Seth Moore <sethmo@google.com> | 2021-05-05 17:34:15 -0700 |
---|---|---|
committer | Seth Moore <sethmo@google.com> | 2021-05-05 17:41:38 -0700 |
commit | c73fe01f1607fb4b1f9afb98fc46960623fef483 (patch) | |
tree | 78b533958f763949395fba826285a8352ba47d9a /keystore/java | |
parent | 7a622ea7ebc8396faf6e4b629f9467a34fb66fb3 (diff) |
Don't re-wrap DeviceIdAttestationExceptions
Instead of always wrapping errors in a DeviceIdAttestationException,
check to see if the underlying cause was originally a
DeviceIdAttestationException. If so, unwrap the cause and just re-throw
that, preserving the original error.
Bug: 183827468
Test: GtsGmsCoreSecurityTestApp
Change-Id: Iab78ccaff91dd1de615e1d2b18f709027aecd59e
Diffstat (limited to 'keystore/java')
-rw-r--r-- | keystore/java/android/security/keystore/AttestationUtils.java | 5 |
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 be865a02a945..3980d3a0203b 100644 --- a/keystore/java/android/security/keystore/AttestationUtils.java +++ b/keystore/java/android/security/keystore/AttestationUtils.java @@ -293,6 +293,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); } } |