I think Osvaldo Pinali Doederlein wrote:
> 
> Hi,
> 
> There is a bug in jess.Main.initialize():
> 
>     int argIdx = 0;
>     boolean doLogo = true;
>     if (argv.length > 0)
>       while(argv[argIdx].startsWith("-"))
>       {
>         if (argv[argIdx].equals("-nologo"))
>           doLogo = false;
>         argIdx++;
>       }
> 
> this code will throw an ArrayIndexOutOfBoundsException if I pass any
> argument, as the while doesn't test for argIdx being under argv.length.
> Example:
> 
> java jess.Main -nologo
> 
> I suspect the bug has been hidden because you usually use no arguments, or
> run batch files which end by shutting down Jess??
> 


Actually, since the third line guards against argv.length being 0,
this bug (and it is a bug, surprised no-one's ever mentioned it
before!) is only triggered if you supply -only- dashed arguments to the
command-line program; supplying no arguments, or dashed + non-dashed,
works fine. 

The only reason nologo is in there, by the way, is because I have an
automated test suite that runs Jess on dozens of trivial problems and
compare the output against standards; without -nologo, I'd have to
edit all the standard files every time Jess's version number bumped
(or make the test suite more complex by sed-ing out lines that look
like Jess version info.) 



> BTW, it would be nice for me (even desirable) to sho Jess's startup logo,
> but not when I create the Main object, only when I call execute().  

I could certainly move the logo-printing into a public showLogo()
method and have initialize() call  it, or not.
 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to