[Title] Fixed 'space' string handle logic, Fixed cmd error check logic
authorgyeongseok.seo <gyeongseok.seo@samsung.com>
Wed, 12 Sep 2012 11:36:00 +0000 (20:36 +0900)
committergyeongseok.seo <gyeongseok.seo@samsung.com>
Wed, 12 Sep 2012 11:56:52 +0000 (20:56 +0900)
[Type] Enhancement
[Module] cli
[Priority] Major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: I2dfada8d5993bd4468ff3eb89c7d724851001ca3

org.tizen.cli/doc/install/bin_/common.sh [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-debug
org.tizen.cli/doc/install/bin_/web-gen
org.tizen.cli/doc/install/bin_/web-install
org.tizen.cli/doc/install/bin_/web-list
org.tizen.cli/doc/install/bin_/web-packaging
org.tizen.cli/doc/install/bin_/web-run
org.tizen.cli/doc/install/bin_/web-signing
org.tizen.cli/doc/install/bin_/web-uninstall
org.tizen.cli/src/org/tizen/cli/exec/AbstractLauncher.java

diff --git a/org.tizen.cli/doc/install/bin_/common.sh b/org.tizen.cli/doc/install/bin_/common.sh
new file mode 100755 (executable)
index 0000000..7df6755
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+DIR_LIB=$DIR_HOME/lib
+DIR_CONFIG=$DIR_HOME/conf
+
+JARS=`find $DIR_LIB -name "*.jar"`
+
+JAR=""
+for JAR_FILE in $JARS; do
+       JAR=$JAR:$JAR_FILE
+done
+
+CLASSPATH=$DIR_CONFIG:$JAR
+
+OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
+OPT_PRG_NAME="-Dcli.name=$SCRIPT"
+
+READ_ARG="n"
+
+OPT_TRACE=
+
+for WORD in $@; do
+        if [ "y" = "$READ_ARG" ]
+        then
+                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
+                if [ "$WORD" = "trace" ]
+                then
+                        OPT_TRACE="-Dlog4j.debug=true"
+                fi
+                READ_ARG="n"
+        fi
+        case $WORD in
+        "--log" | "-l" )
+        READ_ARG="y"
+        ;;
+        esac
+done
+
+OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
+
+escapeSpace() {
+    printf "%s" "$1"|sed 's/ /\\ /g'
+}
+
index ebc2645..9f9c53e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.debug.Main
+export MAIN=org.tizen.cli.exec.debug.Main
 
 SCRIPT="$0"
 
@@ -15,51 +15,20 @@ while [ -h "$SCRIPT" ] ; do
     fi
 done
 
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-JARS=`find $DIR_LIB -name "*.jar"`
+. $DIR_BIN/common.sh
 
-JAR=""
-for JAR_FILE in $JARS; do
-    JAR=$JAR:$JAR_FILE
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-
-READ_ARG="n"
-
-OPT_TRACE=
-
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
-done
-
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
-
-EXEC="java -cp $CLASSPATH $OPT $MAIN $@"
+EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
 then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index b63a8a4..f1d9522 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.gen.Main
+export MAIN=org.tizen.cli.exec.gen.Main
 
 SCRIPT="$0"
 
@@ -15,51 +15,20 @@ while [ -h "$SCRIPT" ] ; do
     fi
 done
 
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-JARS=`find $DIR_LIB -name "*.jar"`
+. $DIR_BIN/common.sh
 
-JAR=""
-for JAR_FILE in $JARS; do
-    JAR=$JAR:$JAR_FILE
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-
-READ_ARG="n"
-
-OPT_TRACE=
-
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
-done
-
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
-
-EXEC="java -cp $CLASSPATH $OPT $MAIN $@"
+EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
 then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index 4939e32..dad82cd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.install.Main
+export MAIN=org.tizen.cli.exec.install.Main
 
 SCRIPT="$0"
 
@@ -15,51 +15,20 @@ while [ -h "$SCRIPT" ] ; do
     fi
 done
 
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-JARS=`find $DIR_LIB -name "*.jar"`
+. $DIR_BIN/common.sh
 
-JAR=""
-for JAR_FILE in $JARS; do
-    JAR=$JAR:$JAR_FILE
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-
-READ_ARG="n"
-
-OPT_TRACE=
-
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
-done
-
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
-
-EXEC="java -cp $CLASSPATH $OPT $MAIN $@"
+EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
 then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index 6f16928..e807385 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.query.Main
+export MAIN=org.tizen.cli.exec.query.Main
 
 SCRIPT="$0"
 
@@ -15,51 +15,20 @@ while [ -h "$SCRIPT" ] ; do
     fi
 done
 
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-JARS=`find $DIR_LIB -name "*.jar"`
+. $DIR_BIN/common.sh
 
-JAR=""
-for JAR_FILE in $JARS; do
-    JAR=$JAR:$JAR_FILE
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-
-READ_ARG="n"
-
-OPT_TRACE=
-
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
-done
-
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
-
-EXEC="java -cp $CLASSPATH $OPT $MAIN $@"
+EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
 then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index 93b141f..4b6d184 100755 (executable)
@@ -1,60 +1,29 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.wgt.Main
+export MAIN=org.tizen.cli.exec.wgt.Main
 
 SCRIPT="$0"
 
 while [ -h "$SCRIPT" ] ; do
-       ls=`ls -ld "$SCRIPT"`
-
-       link=`expr "$ls" : '.*-> \(.*\)$'`
-       if expr "$link" : '/.*' > /dev/null; then
-               SCRIPT="$link"
-       else
-               SCRIPT=`dirname "$SCRIPT"`/"$link"
-       fi
+    ls=`ls -ld "$SCRIPT"`
+
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        SCRIPT="$link"
+    else
+        SCRIPT=`dirname "$SCRIPT"`/"$link"
+    fi
 done
 
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
-
-JARS=`find $DIR_LIB -name "*.jar"`
-
-JAR=""
-for JAR_FILE in $JARS; do
-       JAR=$JAR:$JAR_FILE
-done
-
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-
-READ_ARG="n"
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-OPT_TRACE=
+. $DIR_BIN/common.sh
 
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
-ARGS=`echo "$@"`
 EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
@@ -62,4 +31,4 @@ then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index a76202a..8a9b57b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.run.Main
+export MAIN=org.tizen.cli.exec.run.Main
 
 SCRIPT="$0"
 
@@ -15,51 +15,20 @@ while [ -h "$SCRIPT" ] ; do
     fi
 done
 
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-JARS=`find $DIR_LIB -name "*.jar"`
+. $DIR_BIN/common.sh
 
-JAR=""
-for JAR_FILE in $JARS; do
-    JAR=$JAR:$JAR_FILE
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-
-READ_ARG="n"
-
-OPT_TRACE=
-
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
-done
-
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
-
-EXEC="java -cp $CLASSPATH $OPT $MAIN $@"
+EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
 then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index 2259bb4..895c836 100755 (executable)
@@ -1,66 +1,34 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.sign.Main
+export MAIN=org.tizen.cli.exec.sign.Main
 
 SCRIPT="$0"
 
 while [ -h "$SCRIPT" ] ; do
-       ls=`ls -ld "$SCRIPT"`
-
-       link=`expr "$ls" : '.*-> \(.*\)$'`
-       if expr "$link" : '/.*' > /dev/null; then
-               SCRIPT="$link"
-       else
-               SCRIPT=`dirname "$SCRIPT"`/"$link"
-       fi
-done
-
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
-
-JARS=`find $DIR_LIB -name "*.jar"`
-
-JAR=""
-for JAR_FILE in $JARS; do
-       JAR=$JAR:$JAR_FILE
+    ls=`ls -ld "$SCRIPT"`
+
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        SCRIPT="$link"
+    else
+        SCRIPT=`dirname "$SCRIPT"`/"$link"
+    fi
 done
 
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-OPT_CLI_HOME="-Dcli.home=$DIR_HOME"
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-READ_ARG="n"
+. $DIR_BIN/common.sh
 
-OPT_TRACE=
-
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME $OPT_CLI_HOME"
-
-EXEC="java -cp $CLASSPATH $OPT $MAIN $@"
+EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
 then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index 9644f74..c2e6aa8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-MAIN=org.tizen.cli.exec.uninstall.Main
+export MAIN=org.tizen.cli.exec.uninstall.Main
 
 SCRIPT="$0"
 
@@ -15,51 +15,20 @@ while [ -h "$SCRIPT" ] ; do
     fi
 done
 
-DIR_BIN=`dirname $SCRIPT`
-DIR_HOME=$DIR_BIN/..
-DIR_LIB=$DIR_HOME/lib
-DIR_CONFIG=$DIR_HOME/conf
+export DIR_BIN=`dirname $SCRIPT`
+export DIR_HOME=$DIR_BIN/..
 
-JARS=`find $DIR_LIB -name "*.jar"`
+. $DIR_BIN/common.sh
 
-JAR=""
-for JAR_FILE in $JARS; do
-    JAR=$JAR:$JAR_FILE
+for ARG in "$@" ; do
+    ARGS="$ARGS $(escapeSpace $ARG)"
 done
 
-CLASSPATH=$DIR_CONFIG:$JAR
-
-OPT_LOGGING="-Dlog4j.configuration=log4j.xml"
-OPT_PRG_NAME="-Dcli.name=$SCRIPT"
-
-READ_ARG="n"
-
-OPT_TRACE=
-
-for WORD in $@; do
-        if [ "y" = "$READ_ARG" ]
-        then
-                OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml"
-                if [ "$WORD" = "trace" ]
-                then
-                        OPT_TRACE="-Dlog4j.debug=true"
-                fi
-                READ_ARG="n"
-        fi
-        case $WORD in
-        "--log" | "-l" )
-        READ_ARG="y"
-        ;;
-        esac
-done
-
-OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME"
-
-EXEC="java -cp $CLASSPATH $OPT $MAIN $@"
+EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS"
 
 if [ -n "$OPT_TRACE" ]
 then
         echo "Command :$EXEC"
 fi
 
-$EXEC
+eval "$EXEC"
\ No newline at end of file
index 8562c6d..e48e8ee 100755 (executable)
@@ -345,15 +345,20 @@ AbstractLauncher
                }
                catch ( final ParseException e )
                {
-                   logger.trace( "Invalid usage" );
-                       printHelp();
                        
-                       logger.debug( "Help argument :{}", cmd.getArgList() );
+                       logger.error( "Parsing Error :", e );
+                       logger.trace( "Invalid usage" );
+                       printHelp();
                        
-            for ( String keyword : cmd.getArgs() )
-            {
-                printHelpDetail( keyword );
-            }
+                       if ( null != cmd ) {
+                               logger.debug( "Help argument :{}", cmd.getArgList() );
+                               
+                               for ( String keyword : cmd.getArgs() )
+                               {
+                                       printHelpDetail( keyword );
+                               }
+                               
+                       }
                }
                catch ( final Exception e )
                {