Skip to content

Invalid folder gives java.lang.NullPointerException instead of IOException #8389

@jxu

Description

@jxu

When calling arduino with a sketch in a non-existent folder I get java.lang.MullPointerException:

$ arduino --verify --board arduino:avr:mega bad/nonexist.ino 
Picked up JAVA_TOOL_OPTIONS: 
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
java.lang.NullPointerException
	at processing.app.helpers.FileUtils.listFiles(FileUtils.java:348)
	at processing.app.Sketch.listSketchFiles(Sketch.java:108)
	at processing.app.Sketch.<init>(Sketch.java:54)
	at processing.app.Base.<init>(Base.java:410)
	at processing.app.Base.main(Base.java:151)

For comparison, when the folder exists but the file doesn't, I get a more informative error message:

$ arduino --verify --board arduino:avr:mega test/nonexist.ino 
Picked up JAVA_TOOL_OPTIONS: 
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
java.io.IOException: No valid code files found
	at processing.app.Sketch.listSketchFiles(Sketch.java:117)
	at processing.app.Sketch.<init>(Sketch.java:54)
	at processing.app.Base.<init>(Base.java:410)
	at processing.app.Base.main(Base.java:151)

I think the error message should be consistent with IOException.

Using Arduino 1.8.8 on Ubuntu 18.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CLIThe Arduino IDE's command line interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions