tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject tomee git commit: Remove execution block from the lookup block to not mix the exceptions
Date Tue, 26 Jul 2016 10:29:47 GMT
Repository: tomee
Updated Branches:
  refs/heads/master f54517fb3 -> 6d4a0308a


Remove execution block from the lookup block to not mix the exceptions


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/6d4a0308
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/6d4a0308
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/6d4a0308

Branch: refs/heads/master
Commit: 6d4a0308af2c451497553bcfc81e550095fa412c
Parents: f54517f
Author: Jean-Louis Monteiro <jeanouii@gmail.com>
Authored: Tue Jul 26 12:11:33 2016 +0200
Committer: Jean-Louis Monteiro <jeanouii@gmail.com>
Committed: Tue Jul 26 12:29:32 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/openejb/cli/MainImpl.java   |  5 ++--
 .../java/org/apache/openejb/config/Cipher.java  | 31 +++++++++++---------
 2 files changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/6d4a0308/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java
----------------------------------------------------------------------
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 @@ public class MainImpl implements Main {
 
         // 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 @@ public class MainImpl implements Main {
             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" +

http://git-wip-us.apache.org/repos/asf/tomee/blob/6d4a0308/container/openejb-core/src/main/java/org/apache/openejb/config/Cipher.java
----------------------------------------------------------------------
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 @@ public class Cipher {
             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 @@ public class Cipher {
             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
         }
     }


Mime
View raw message