Skip to content

NSNumber parser fails for "+infinity" and "-infinity" #83

@pfn-shi

Description

@pfn-shi

Using version 1.26, downloaded from Maven Central.

The NSNumber parser throws an exception when it encounters the values "+infinity" or "-infinity". This can be verified with the following code snippet:

public static void main(String[] args) {
    var a = new NSNumber("3");
    try {
        var b = new NSNumber("+infinity");
    } catch (Exception e) {
        System.out.println(e);
    }
    try {
        var c = new NSNumber("-infinity");
    } catch (Exception e) {
        System.out.println(e);
    }
}

Output:

java.lang.IllegalArgumentException: The given string neither represents a double, an int nor a boolean value.
java.lang.IllegalArgumentException: The given string neither represents a double, an int nor a boolean value.

This causes XMLPropertyListParser.parse(...) to fail when the input contains either <real>+infinity</real> or <real>-infinity</real> but I believe both of these are valid values.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions