mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-12-26 14:37:56 +01:00
Dearmor: transform IOExceptions into BadData properly
This commit is contained in:
parent
0e777de14f
commit
519fb891a1
1 changed files with 13 additions and 0 deletions
|
@ -28,6 +28,19 @@ public class DearmorCmd extends AbstractSopCmd {
|
|||
String errorMsg = getMsg("sop.error.input.stdin_not_openpgp_data");
|
||||
throw new SOPGPException.BadData(errorMsg, e);
|
||||
} catch (IOException e) {
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
String errorMsg = getMsg("sop.error.input.stdin_not_openpgp_data");
|
||||
if (msg.equals("invalid armor") ||
|
||||
msg.equals("invalid armor header") ||
|
||||
msg.equals("inconsistent line endings in headers") ||
|
||||
msg.startsWith("unable to decode base64 data")) {
|
||||
throw new SOPGPException.BadData(errorMsg, e);
|
||||
}
|
||||
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue