[jboss-cvs] JBossAS SVN: r95439 - branches/JBPAPP_4_2_0_GA_CP01_JBPAPP-2872/console/src/main/org/jboss/console/twiddle.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 22 15:31:39 EDT 2009


Author: dereed
Date: 2009-10-22 15:31:39 -0400 (Thu, 22 Oct 2009)
New Revision: 95439

Modified:
   branches/JBPAPP_4_2_0_GA_CP01_JBPAPP-2872/console/src/main/org/jboss/console/twiddle/Twiddle.java
Log:
[JBPAPP-2949] Port JBPAPP-2872 to EAP 4.2 CP01


Modified: branches/JBPAPP_4_2_0_GA_CP01_JBPAPP-2872/console/src/main/org/jboss/console/twiddle/Twiddle.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP01_JBPAPP-2872/console/src/main/org/jboss/console/twiddle/Twiddle.java	2009-10-22 19:24:42 UTC (rev 95438)
+++ branches/JBPAPP_4_2_0_GA_CP01_JBPAPP-2872/console/src/main/org/jboss/console/twiddle/Twiddle.java	2009-10-22 19:31:39 UTC (rev 95439)
@@ -403,7 +403,8 @@
    {
       for(int a = 0; a < args.length; a ++)
       {
-         log.debug("args["+a+"]="+args[a]);
+         if (!logPassword(args, a))
+            log.debug("args["+a+"]="+args[a]);
       }
       String sopts = "-:hH:u:p:c:D:s:a:q";
       LongOpt[] lopts =
@@ -541,4 +542,35 @@
            }
         }
    }
+
+   private static boolean logPassword(final String args[], int a)
+   {
+      // check current argument
+      if (args[a].startsWith("-p") && args[a].length() > 2)
+      {
+         log.debug("args["+a+"]=-pxxxx");
+         return true;
+      }
+      else if (args[a].indexOf('=') != -1)
+      {
+         String[] split = args[a].split("=");
+         if ("--password".indexOf(split[0]) != -1)
+         {
+            log.debug("args["+a+"]="+split[0]+"=xxxx");
+            return true;
+         }
+      }
+      // check previous argument
+      try {
+         if (args[a-1].equals("-p") || (args[a-1].indexOf('=') == -1 && "--password".indexOf(args[a-1]) != -1))
+         {
+            log.debug("args["+a+"]=xxxx");
+            return true;
+         }
+      }
+      catch (IndexOutOfBoundsException ioobe)
+      {
+      }
+      return false;
+   }
 }




More information about the jboss-cvs-commits mailing list