commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Egge (JIRA)" <j...@apache.org>
Subject [jira] Created: (CLI-133) NullPointerException in Util.stripLeadingHyphens when passed a null argument
Date Tue, 05 Jun 2007 23:53:25 GMT
NullPointerException in Util.stripLeadingHyphens when passed a null argument
----------------------------------------------------------------------------

                 Key: CLI-133
                 URL: https://issues.apache.org/jira/browse/CLI-133
             Project: Commons CLI
          Issue Type: Bug
          Components: CLI-1.x
    Affects Versions: 1.0, 1.1
            Reporter: Brian Egge
            Priority: Minor
             Fix For: 1.1


If you try to do a hasOption(null), you get a NPE:

java.lang.NullPointerException
	at org.apache.commons.cli.Util.stripLeadingHyphens(Util.java:39)
	at org.apache.commons.cli.CommandLine.resolveOption(CommandLine.java:166)
	at org.apache.commons.cli.CommandLine.hasOption(CommandLine.java:68)

Either hasOption should reject the null argument, or the function should simply return false.
 I think the latter makes more since, as this is how Java collections generally work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message