Make CorruptedOmemoKeyException not swallow exceptions

This commit is contained in:
Florian Schmaus 2018-06-20 11:51:46 +02:00
parent ac347fc598
commit 6e9fb17f8f
3 changed files with 9 additions and 5 deletions

View File

@ -70,7 +70,7 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
try {
return KeyHelper.generateSignedPreKey(identityKeyPair, currentPreKeyId);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}
@ -102,7 +102,7 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
try {
return new IdentityKeyPair(data);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}
@ -112,7 +112,7 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
try {
return new IdentityKey(data, 0);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}
@ -122,7 +122,7 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
try {
return Curve.decodePoint(data, 0);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}

View File

@ -104,7 +104,7 @@ public final class SignalOmemoService
builder.process(contactsBundle);
LOGGER.log(Level.FINE, "Session built with " + contactsDevice);
} catch (org.whispersystems.libsignal.InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
} catch (UntrustedIdentityException e) {
// This should never happen.
throw new AssertionError(e);

View File

@ -27,4 +27,8 @@ public class CorruptedOmemoKeyException extends Exception {
public CorruptedOmemoKeyException(String message) {
super(message);
}
public CorruptedOmemoKeyException(Exception exception) {
super(exception);
}
}