[xmlsectool] 03/04: Use symbolic values for all exit codes.
Ian Young
ian at iay.org.uk
Sat May 14 07:44:08 EDT 2016
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch master
in repository xmlsectool.
commit d44c52c6ec320c402d94b875bad5d622c97a90e1
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Sat May 14 12:36:46 2016 +0100
Use symbolic values for all exit codes.
These need to be replaced by exceptions long-term, but for now let's at
least not use literal values.
---
.../net/shibboleth/tool/xmlsectool/CredentialHelper.java | 4 ++--
.../java/net/shibboleth/tool/xmlsectool/XmlSecTool.java | 14 +++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/main/java/net/shibboleth/tool/xmlsectool/CredentialHelper.java b/src/main/java/net/shibboleth/tool/xmlsectool/CredentialHelper.java
index e70c7f0..d579b28 100644
--- a/src/main/java/net/shibboleth/tool/xmlsectool/CredentialHelper.java
+++ b/src/main/java/net/shibboleth/tool/xmlsectool/CredentialHelper.java
@@ -151,10 +151,10 @@ public class CredentialHelper {
} catch (ClassNotFoundException e) {
LOG.error((new StringBuilder("Unable to load keystore provider class: ")).append(keystoreProvider)
.toString());
- System.exit(1);
+ System.exit(XmlSecTool.RC_INIT);
} catch (NoSuchMethodException e) {
LOG.error("Keystore provider class does not provide a String-argument constructor");
- System.exit(1);
+ System.exit(XmlSecTool.RC_INIT);
} catch (Exception e) {
LOG.error("Unable to read PKCS11 keystore", e);
throw new IOException("Unable to read PKCS11 keystore", e);
diff --git a/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecTool.java b/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecTool.java
index c756b77..55c029e 100644
--- a/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecTool.java
+++ b/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecTool.java
@@ -172,7 +172,7 @@ public final class XmlSecTool {
InitializationService.initialize();
} catch (InitializationException e) {
log.error("Unable to initialize OpenSAML library", e);
- System.exit(1);
+ System.exit(RC_INIT);
}
try {
@@ -305,7 +305,7 @@ public final class XmlSecTool {
if (status != 200) {
log.error("Non-ok status code '" + Integer.valueOf(status) + "' returned by '"
+ cli.getInputUrl() + "'");
- System.exit(2);
+ System.exit(RC_IO);
}
InputStream ins = response.getEntity().getContent();
Header contentEncodingHeader = response.getFirstHeader("Content-Encoding");
@@ -330,7 +330,7 @@ public final class XmlSecTool {
} catch (Exception e) {
log.error("error building an HTTP client instance for " + cli.getInputUrl(), e);
}
- System.exit(2);
+ System.exit(RC_IO);
return null;
}
@@ -995,12 +995,12 @@ public final class XmlSecTool {
File file = new File(cli.getOutputFile());
if (file.exists() && file.isDirectory()) {
log.error("Output file " + cli.getOutputFile() + " is a directory");
- System.exit(2);
+ System.exit(RC_IO);
}
file.createNewFile();
if (!file.canWrite()) {
log.error("Unable to write to output file " + cli.getOutputFile());
- System.exit(2);
+ System.exit(RC_IO);
}
OutputStream out = new FileOutputStream(cli.getOutputFile());
@@ -1025,14 +1025,14 @@ public final class XmlSecTool {
serializer.transform(new DOMSource(xml), new StreamResult(out));
} catch (TransformerException e) {
log.error("Unable to write out XML", e);
- System.exit(2);
+ System.exit(RC_IO);
}
out.flush();
out.close();
log.info("XML document written to file {}", file.getAbsolutePath());
} catch (IOException e) {
log.error("Unable to write document to file " + cli.getOutputFile(), e);
- System.exit(2);
+ System.exit(RC_IO);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list