Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when a classpath folder does not exist #4987

Closed
AaronAsAChimp opened this issue Dec 15, 2021 · 1 comment · Fixed by #4991
Closed

NullPointerException when a classpath folder does not exist #4987

AaronAsAChimp opened this issue Dec 15, 2021 · 1 comment · Fixed by #4991
Assignees
Labels
Milestone

Comments

@AaronAsAChimp
Copy link

When running the checker with a classpath folder doesn't exist a NullPointerException is thrown. This is likely because calling File.list() (in CheckerMain.java:540) returns null if the directory does not exist.

Commands
The '*' is important.

javacheck -cp .\does-not-exists\*

Inputs
The exact input file doesn't matter, the checker doesn't progress far enough to check the source file (as seen above).

Outputs

Exception in thread "main" java.lang.NullPointerException
        at java.util.Objects.requireNonNull(Objects.java:203)
        at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
        at java.util.Arrays.asList(Arrays.java:3800)
        at org.checkerframework.framework.util.CheckerMain.jarFiles(CheckerMain.java:540)
        at org.checkerframework.framework.util.CheckerMain.expandWildcards(CheckerMain.java:524)
        at org.checkerframework.framework.util.CheckerMain.concatenatePaths(CheckerMain.java:507)
        at org.checkerframework.framework.util.CheckerMain.getExecArguments(CheckerMain.java:475)
        at org.checkerframework.framework.util.CheckerMain.invokeCompiler(CheckerMain.java:545)
        at org.checkerframework.framework.util.CheckerMain.main(CheckerMain.java:62)

Expectation
A NullPointerException does not occur and runs the checker. The javac compiler ignores classpath folders that do not exist.

@mernst mernst added the crash label Dec 15, 2021
@mernst mernst added this to the Critical milestone Dec 15, 2021
@smillst smillst self-assigned this Dec 16, 2021
@smillst
Copy link
Member

smillst commented Dec 16, 2021

Thanks for reporting. I can reproduced this and will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants