Skip to content

Commit

Permalink
Make CorruptedOmemoKeyException not swallow exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Jun 20, 2018
1 parent ac347fc commit 6e9fb17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public SignedPreKeyRecord generateOmemoSignedPreKey(IdentityKeyPair identityKeyP
try {
return KeyHelper.generateSignedPreKey(identityKeyPair, currentPreKeyId);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}

Expand Down Expand Up @@ -102,7 +102,7 @@ public IdentityKeyPair identityKeyPairFromBytes(byte[] data) throws CorruptedOme
try {
return new IdentityKeyPair(data);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}

Expand All @@ -112,7 +112,7 @@ public IdentityKey identityKeyFromBytes(byte[] data) throws CorruptedOmemoKeyExc
try {
return new IdentityKey(data, 0);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}

Expand All @@ -122,7 +122,7 @@ public ECPublicKey ellipticCurvePublicKeyFromBytes(byte[] data) throws Corrupted
try {
return Curve.decodePoint(data, 0);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e.getMessage());
throw new CorruptedOmemoKeyException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected void processBundle(OmemoManager omemoManager,
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ public class CorruptedOmemoKeyException extends Exception {
public CorruptedOmemoKeyException(String message) {
super(message);
}

public CorruptedOmemoKeyException(Exception exception) {
super(exception);
}
}

0 comments on commit 6e9fb17

Please sign in to comment.