Hi Boon,

The correct place for this dicussion is on commons-dev.  I will review
both of your emails and make code modifications where necessary. I
will post my results to commons-dev so you should subscribe there.

When sending mails on cli always start the subject line with [cli] so
people can set their mail filters appropriately.

Thanks,
-John K

On Monday, Nov 18, 2002, at 21:50 Europe/Dublin, Boon Hian Tek wrote:

Hi all again,

I forgot that I also changed CommandLine.java a bit. In the course of using it, I found that in
CommandLine.java if the option itself is not set, and I try to do getOptionObject, NullPointerException gets thrown.

So, I modified the code this way, please comments. Thanks for everyone's time.


Index: src/java/org/apache/commons/cli/CommandLine.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/cli/src/java/org/apache/commons/cli/ CommandLine.java,v
retrieving revision 1.14
diff -u -r1.14 CommandLine.java
--- src/java/org/apache/commons/cli/CommandLine.java 18 Nov 2002 08:41:26 -0000 1.14
+++ src/java/org/apache/commons/cli/CommandLine.java 18 Nov 2002 21:42:54 -0000
@@ -134,9 +134,13 @@
*/
public Object getOptionObject( String opt ) {
String res = getOptionValue( opt );
+ + if (res == null) {
+ return null;
+ }
Object type = ((Option)options.get(opt)).getType();
- return res == null ? null : TypeHandler.createValue(res, type);
+ return TypeHandler.createValue(res, type);
}
/**


Best regards,

Boon Hian Tek


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


- - - - - - - - - - - - - - - - - - - - - - -
Jakarta Commons CLI
http://jakarta.apache.org/commons/cli


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

Reply via email to