Skip to content

NullPointer if URI begins "jar:file:/" in URIUtils #51

@liuyx11241

Description

@liuyx11241

URIUtils propose a SCHEMAURI_CHECKER.
But if the URI begins with "jar:file:", the argument.getPath() will return a null value then we will get a null pointer exception.

    private static final ArgumentChecker<URI> SCHEMAURI_CHECKER
        = new ArgumentChecker<URI>()
    {
        @Override
        public void check(final URI argument)
        {
            BUNDLE.checkArgumentPrintf(argument.isAbsolute(),
                "uriChecks.notAbsolute", argument);
            final JsonRef ref = JsonRef.fromURI(argument);
            BUNDLE.checkArgumentPrintf(ref.isAbsolute(),
                "uriChecks.notAbsoluteRef", argument);
            BUNDLE.checkArgumentPrintf(!argument.getPath().endsWith("/"),
                "uriChecks.endingSlash", argument);
        }
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions