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]>

Reply via email to