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

CLI using --port gives NullPointerException at DiscoveryManager in beta1.9 #8400

Closed
jerdna-regeiz opened this issue Jan 17, 2019 · 1 comment
Assignees
Labels
Component: CLI The Arduino IDE's command line interface IDE 1.9.x Beta Related to the Arduino IDE Beta Build

Comments

@jerdna-regeiz
Copy link

(First thinks first: Thank you for arduino ide!)
Using the CLI of Arduino IDE with the --port parameter throws a NullPointerException on initialization of the DiscoveryManager.

Tested with arduino-PR-beta1.9-BUILD-96

With --port it does not even try to compile (or do anything):

>>> arduino --verify --board esp8266:esp8266:nodemcu --port /dev/ttyACM0 sketch.ino
Picked up JAVA_TOOL_OPTIONS:
java.lang.NullPointerException
        at cc.arduino.packages.DiscoveryManager.<init>(DiscoveryManager.java:64)
        at processing.app.BaseNoGui.getDiscoveryManager(BaseNoGui.java:260)
        at processing.app.BaseNoGui.selectSerialPort(BaseNoGui.java:983)
        at processing.app.helpers.CommandlineParser.parseArgumentsPhase1(CommandlineParser.java:144)
        at processing.app.Base.<init>(Base.java:218)
        at processing.app.Base.main(Base.java:153)

Without --port everything works as expected (IOException does not influence the build or upload...):

>>> arduino --verify --board esp8266:esp8266:nodemcu sketch.ino
Picked up JAVA_TOOL_OPTIONS:
Loading configuration...
Initializing packages...
found discovery: serial -> {runtime.ide.path}/tools/serial-discovery
with preferencess -> {
  pattern = {runtime.ide.path}/tools/serial-discovery
}

found discovery: mdns -> {runtime.ide.path}/tools/mdns-discovery
with preferencess -> {
  pattern = {runtime.ide.path}/tools/mdns-discovery
}

Preparing boards...
Verifying...
Sketch uses 287520 bytes (27%) of program storage space. Maximum is 1044464 bytes.
Global variables use 26976 bytes (32%) of dynamic memory, leaving 54944 bytes for local variables. Maximum is 81920 bytes.
java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:336)
        at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.ensureLoaded(ByteSourceJsonBootstrapper.java:522)
        at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.detectEncoding(ByteSourceJsonBootstrapper.java:150)
        at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.constructParser(ByteSourceJsonBootstrapper.java:246)
        at com.fasterxml.jackson.core.JsonFactory._createParser(JsonFactory.java:1315)
        at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:820)
        at cc.arduino.packages.discoverers.PluggableDiscovery.run(PluggableDiscovery.java:79)
        at java.lang.Thread.run(Thread.java:748)

It dosn't matter what argument you pass to --port or if the given device exists. It seems to die before accessing anything. In fact NO argument matters, it will crash as long as --port is given (as is provided an argument):

>>> arduino --port /dev/abc   
Picked up JAVA_TOOL_OPTIONS:
java.lang.NullPointerException
        at cc.arduino.packages.DiscoveryManager.<init>(DiscoveryManager.java:64)
        at processing.app.BaseNoGui.getDiscoveryManager(BaseNoGui.java:260)
        at processing.app.BaseNoGui.selectSerialPort(BaseNoGui.java:983)
        at processing.app.helpers.CommandlineParser.parseArgumentsPhase1(CommandlineParser.java:144)
        at processing.app.Base.<init>(Base.java:218)
        at processing.app.Base.main(Base.java:153)
@per1234 per1234 added the Component: CLI The Arduino IDE's command line interface label Jan 17, 2019
@facchinm facchinm added the IDE 1.9.x Beta Related to the Arduino IDE Beta Build label Jan 18, 2019
@facchinm
Copy link
Member

Hi @jerdna-regeiz ,
thanks a lot for testing the beta! We recently merged #8038 in beta to spot exactly these kind of problems before they get into the hourly 🙂
I'll take a look later today and I'll keep you posted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CLI The Arduino IDE's command line interface IDE 1.9.x Beta Related to the Arduino IDE Beta Build
Projects
None yet
Development

No branches or pull requests

4 participants