Menu

Passing initial running parameter problem

Help
Nonsun
2008-01-15
2012-09-04
  • Nonsun

    Nonsun - 2008-01-15

    Hi,

    I met some problems in passing some initial running parameters. It seems that only lower-cased characters are allowed in parameter's name if the parameter is to be passed from command line.

    For the following testing config (named as CONFIG#1):
    <config>
    <exit condition='${!sys.isVariableDefined("foo")}' message="Variable is not provided!" />
    <file action="write" path="C:\TEMP\test.txt">
    <template>${foo}</template>
    </file>
    </config>

    Then the following command line (named as CMDLINE#1) from a batch file (in Windows command prompt) works:
    @"C:\Program Files\Java\jre1.6.0_03\bin\java.exe" -jar webharvest_all_1.jar config=test2.xml #foo=zed

    Still, this command line (named as CMDLINE#2) works to with CONFIG#1:
    @"C:\Program Files\Java\jre1.6.0_03\bin\java.exe" -jar webharvest_all_1.jar config=test2.xml #FOO=zed

    However, if we change the parameter's name into "FOO" in config (named as CONFIG#2):
    <config>
    <exit condition='${!sys.isVariableDefined("FOO")}' message="Variable is not provided!" />
    <file action="write" path="C:\TEMP\test.txt">
    <template>${FOO}</template>
    </file>
    </config>

    It reports variable not provided even launching by CMDLINE#2.

    In further test, testing results can be concluded as:

    Name in Name in Test result
    config command line
    (XML file) (batch file)


    foo foo OK (of course)
    foo FOO OK (strange but acceptable)
    foo Foo/fOO OK (as above)
    Foo foo/FOO/Foo/fOO NOK (exits and reports variable not provided)
    FOO foo/FOO/Foo/fOO NOK (exits and reports variable not provided)

    Testing environment (reported by "dxdiag" and "java -version")
    - Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 2 (2600.xpsp_sp2_qfe.070227-2300)
    - Language: Chinese (Regional Setting: Chinese)
    - Java version:
    java version "1.6.0_03"
    Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
    Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

    Conclusion:
    It seems that the initial running parameter's name is converted into lowercase (at least in my environment). Fortunately, the underscore works in naming a parameter. I can use "linux_naming_style" instead of "windowsNameingStyle". ;-)

    Anyway, Web Harest is right the web data extraction tool I am looking for and I am looking forward to the further release.

     
    • Vladimir Nikic

      Vladimir Nikic - 2008-01-15

      Thanks for the report.
      This was a small bug in CommandLine class.
      It is fixed and pushed to Subversion at SourceForge.

      Fix will be included in the next relases.

      Best, Vladimir.

       

Log in to post a comment.