commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schley Andrew Kutz <ak...@lostcreations.com>
Subject [cli] C# port passes 80/81 unit tests / Bug found in Parser.java::ProcessProperties
Date Sun, 27 Apr 2008 21:15:57 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The C# is almost 100% compatible with real deal, except for 1  
remaining unit test. The reason the port cannot pass this test is  
because there is a bug in Parser.java - ProcessProperties. The  
relevant code bits are:

		if (opt.hasArg())
                 {
                     if ((opt.getValues() == null)
                         || (opt.getValues().length == 0))
                     {
                         try
                         {
                             opt.addValueForProcessing(value);
                         }
                         catch (RuntimeException exp)
                         {
                             // if we cannot add the value don't worry  
about it
                         }
                     }
                 }
                 else if (!("yes".equalsIgnoreCase(value)
                            || "true".equalsIgnoreCase(value)
                            || "1".equalsIgnoreCase(value)))
                 {
                     // if the value is not yes, true or 1 then don't  
add the
                     // option to the CommandLine
                     break;
                 }

                 cmd.addOption(opt);

Okay. Here is the problem. The 'break' precludes any property from  
being reached that is AFTER a property that is not set to yes|true|1.  
I changed the break to a continue, but that breaks another assertion  
in the same unit test. If a continue is used then when a property is  
set to false|0|no, but has arguments, such as 'e' in  
ValueTest::testPropertyOptionFlags(), it skips the 'else if' clause  
and gets added as an option, thus breaking the assertion that 'e'  
should not exist as an option. I fiddled with the bits some more,  
duplicating the yes|true|1 test inside the opt.hasArg() scope, but  
that breaks properties that have arguments which are not a boolean,  
such as the "hide" "seek" bit in testPropertyOptionSingularValue().

I really want this to work as when it does the C# will have passed ALL  
of the unit tests.

Thank you for your help!

- --
- -a

"condensing fact from the vapor of nuance"

gpg pubkey:         http://www.lostcreations.com/~akutz/akutz.gpg
lostcreations ca:  http://www.lostcreations.com/lostcreations.com-ca.crt

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFIFO0NTg8lceyAqqQRAgm4AJ40Y6A7N+WVOR3sOHeXxO0i0+3nhgCgpfU6
hi+r7uHeWYR3Qp+jDlxS1BE=
=EhQV
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message