commons-math icon indicating copy to clipboard operation
commons-math copied to clipboard

The TreeBuilder constructor does not check the validity of the input String s

Open emopers opened this issue 7 years ago • 1 comments

The TreeBuilder constructor does not check whether the input string s is null before constructing a StringTokenizer. This will cause a NullPointerException to be thrown according to the docs. It also does not check whether s is empty. This will cause a NoSuchElementException to be thrown when nextToken() is called according to the docs.

This pull request adds a check to the String s and throws a ParseException if s is null or empty. It also adds two tests.

emopers avatar Jan 28 '19 08:01 emopers

Coverage Status

Coverage increased (+0.007%) to 90.177% when pulling 21f419d5a077bff745e064d34795a32c98d995ff on emopers:StringTokenizer_bugfix into d7d4e4df72cc14998ff82a936e8a8de10931e5af on apache:master.

coveralls avatar Jan 28 '19 08:01 coveralls