Remove execution block from the lookup block to not mix the exceptions
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java b/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java
index bacaf9f..2764d34 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java
@@ -69,8 +69,8 @@
// create the Options
final Options options = new Options();
- options.addOption(null, "version", false, "");
- options.addOption("h", "help", false, "");
+ options.addOption(null, "version", false, "Display version");
+ options.addOption("h", "help", false, "Display help");
options.addOption("e", "errors", false, "Produce execution error messages");
CommandLine line = null;
@@ -241,6 +241,7 @@
final String footer = "\n" +
"Try 'openejb <command> --help' for help on a specific command.\n" +
"For example 'openejb deploy --help'.\n" +
+ "Important: to display exceptions while running commands, add -e option.\n" +
"\n" +
"Apache OpenEJB -- EJB Container System and Server.\n" +
"For additional information, see http://tomee.apache.org\n" +
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java b/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java
index 41d4d18..7996077 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java
@@ -80,27 +80,29 @@
return;
}
+ final PasswordCipher cipher;
try {
- final PasswordCipher cipher = PasswordCipherFactory.getPasswordCipher(cipherName);
-
- if (line.hasOption("decrypt")) {
- final String pwdArg = (String) line.getArgList().get(0);
- final char[] encryptdPassword = pwdArg.toCharArray();
- System.out.println(cipher.decrypt(encryptdPassword));
-
- } else { // if option neither encrypt/decrypt is specified, we assume
- // it is encrypt.
- final String plainPassword = (String) line.getArgList().get(0);
- System.out.println(new String(cipher.encrypt(plainPassword)));
- }
+ cipher = PasswordCipherFactory.getPasswordCipher(cipherName);
} catch (final PasswordCipherException e) {
System.out.println("Could not load password cipher implementation class. Check your classpath.");
-
availableCiphers();
throw new SystemExitException(-1);
}
+
+ if (line.hasOption("decrypt")) {
+ final String pwdArg = (String) line.getArgList().get(0);
+ final char[] encryptdPassword = pwdArg.toCharArray();
+
+ System.out.println(cipher.decrypt(encryptdPassword));
+
+ } else { // if option neither encrypt/decrypt is specified, we assume
+ // it is encrypt.
+ final String plainPassword = (String) line.getArgList().get(0);
+
+ System.out.println(new String(cipher.encrypt(plainPassword)));
+ }
}
private static void availableCiphers() {
@@ -108,7 +110,8 @@
final ResourceFinder finder = new ResourceFinder("META-INF/");
final Map<String, Class<? extends PasswordCipher>> impls = finder.mapAllImplementations(PasswordCipher.class);
System.out.println("Available ciphers are: " + Join.join(", ", impls.keySet()));
- } catch (final Exception dontCare) {
+
+ } catch (final Exception ignore) {
// no-op
}
}