java2wsdl.sh in axis2-1.2 may fail if some parameters aren't passed
-------------------------------------------------------------------

                 Key: AXIS2-2866
                 URL: https://issues.apache.org/jira/browse/AXIS2-2866
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: Tools
         Environment: uname -a:
Linux comander 2.6.21.1 #1 Sat May 5 20:48:39 CDT 2007 i686 pentium4 i386 
GNU/Linux

bash -version
GNU bash, version 3.2.15(2)-release (i686-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

            Reporter: Leonardo Silveira Nascimento Filho
             Fix For: 1.2


well, when i tried to run java2wsdl.sh (im following 
http://ws.apache.org/axis2/1_2/quickstartguide.html) it failed because my path 
has whitespace. but there's more: running the above script with a new path (w/o 
whitespace) i got this error message:

[EMAIL PROTECTED]:~/variados/webservicesExperiments$ 
/home/ftp/java/apache_axis2/axis2-1.2/bin/java2wsdl.sh -cp . -cn teste.Fortune 
-of Fortune.wsdl
 Using AXIS2_HOME:   /home/ftp/java/apache_axis2/axis2-1.2
 Using JAVA_HOME:       /usr/lib/java
/home/ftp/java/apache_axis2/axis2-1.2/bin/axis2.sh: line 38: [: !=: unary 
operator expected
Unrecognized option: -cn
Could not create the Java virtual machine.
[EMAIL PROTECTED]:~/variados/webservicesExperiments$ 

well, i've looked the shellscript code and there have some single braces; 
example: 

for arg in "$@"
do
   if [ $arg != -classpath ] && [ $arg != -cp ] && [ $prearg != -classpath ] && 
[ $prearg != -cp  ]
   then
      USER_COMMANDS="$USER_COMMANDS ""$arg"
   fi
(...)

if $arg get an attribute like "-classpath", it will work properly, but if no 
-classpath are passed as argument we have a small problem. I've wrote a small 
test to show what can happen:

#!/bin/sh
# Minitest, by Sombriks

if [[ $1 != "galinha" ]] 2>/dev/null
        then
                echo "diferente!";
        else 
                echo "igual!";
fi

so, using double braces the result will be sane, even if "$1" (the first 
command line argument later the script itself) are not passed.

my modifications on java2wsdl.sh are quite small:
# (...)
# Get the context and from that find the location of setenv.sh
. $(dirname $0)/setenv.sh

#add any user given classpath's
USER_COMMANDS=""
prearg=""
for arg in "$@"
do
   if [[ $arg != -classpath ]] && [[ $arg != -cp ]] && [[ $prearg != -classpath 
]] && [[ $prearg != -cp  ]]
   then
      USER_COMMANDS="$USER_COMMANDS ""$arg"
   fi

   if [[ $prearg=-classpath ]] || [[ $prearg=-cp ]]
   then
      AXIS2_CLASSPATH="$arg":"$AXIS2_CLASSPATH"
   fi
   prearg=$arg
done 


$JAVA_HOME/bin/java -classpath "$AXIS2_CLASSPATH" \
-Daxis2.xml="$AXIS2_HOME/conf/axis2.xml" -Daxis2.repo="$AXIS2_HOME/repository"  
$USER_COMMANDS
# (...)

maybe it's a bash issue, but even in older shells this one will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to