Skip to content

LoadVIDPIDSpecificPreferences fails when connected board returns no string text #3738

Closed
@logan893

Description

@logan893

I'm receiving the following error with the newly downloaded Arduino IDE 1.6.5-r4, when compiling any sketch.

java.lang.NullPointerException
at cc.arduino.LoadVIDPIDSpecificPreferences.load(LoadVIDPIDSpecificPreferences.java:48)
at processing.app.debug.Compiler.createBuildPreferences(Compiler.java:592)
at processing.app.debug.Compiler.(Compiler.java:193)
at processing.app.debug.Compiler.build(Compiler.java:96)
at processing.app.Sketch.build(Sketch.java:1109)
at processing.app.Sketch.build(Sketch.java:1084)
at processing.app.Editor$BuildHandler.run(Editor.java:1955)
at java.lang.Thread.run(Thread.java:745)

I need to have my Arduino Pro Mini board (most likely a Chinese knock-off) connected via USB and have that COM port selected for this error to show up. The port shows up as e.g. COM4, with no additional parenthesis like my Arduino Uno which shows up as COM7 (Arduino Uno).

Disconnecting this device (i.e. selecting none), or connecting and selecting my Arduino Uno, allows me to compile.

Source file at fault:
https://github.com/arduino/Arduino/blob/1.6.5-r4/arduino-core/src/cc/arduino/LoadVIDPIDSpecificPreferences.java

This file is new as of 1.6.5-r4

Line 48:
int VIDPIDIndex = findVIDPIDIndex(prefs, boardPort.getPrefs().get("vid").toUpperCase(), boardPort.getPrefs().get("pid").toUpperCase());

One, or likely both, of the boardPort.getPrefs().get(String) functions returns null, which throws this exception when calling .toUpperCase() on a null value (default return value from java.util.LinkedHashMap.get() when no match is found).

Possible suggestion to fix this (you likely know better if this has any other side effects); use a default option for the get() function of PreferencesMap data structure.
int VIDPIDIndex = findVIDPIDIndex(prefs, boardPort.getPrefs().get("vid","").toUpperCase(), boardPort.getPrefs().get("pid","").toUpperCase());

Activity

cmaglie

cmaglie commented on Aug 27, 2015

@cmaglie
Member

Thanks for the quick and detailed report!
We'll check this out ASAP.

haaland1

haaland1 commented on Aug 27, 2015

@haaland1

I am having the same issue. I downloaded version 1.6.5 of Arduino IDE this morning and receive the same error when compiling code with my Arduino Pro Mini connected via USB.

java.lang.NullPointerException
at cc.arduino.LoadVIDPIDSpecificPreferences.load(LoadVIDPIDSpecificPreferences.java:48)
at processing.app.debug.Compiler.createBuildPreferences(Compiler.java:592)
at processing.app.debug.Compiler.(Compiler.java:193)
at processing.app.debug.Compiler.build(Compiler.java:96)
at processing.app.Sketch.build(Sketch.java:1109)
at processing.app.Sketch.exportApplet(Sketch.java:1127)
at processing.app.Sketch.exportApplet(Sketch.java:1113)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)
at java.lang.Thread.run(Thread.java:745)

The sketch compiles fine when the board is disconnected.

mojtabacazi

mojtabacazi commented on Aug 27, 2015

@mojtabacazi

same here
Arduino Mega 2560

java.lang.NullPointerException
    at cc.arduino.LoadVIDPIDSpecificPreferences.load(LoadVIDPIDSpecificPreferences.java:48)
    at processing.app.debug.Compiler.createBuildPreferences(Compiler.java:657)
    at processing.app.debug.Compiler.<init>(Compiler.java:214)
    at processing.app.debug.Compiler.build(Compiler.java:99)
    at processing.app.Sketch.build(Sketch.java:1117)
    at processing.app.Sketch.exportApplet(Sketch.java:1135)
    at processing.app.Sketch.exportApplet(Sketch.java:1121)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2421)
    at java.lang.Thread.run(Thread.java:745)
Juanah

Juanah commented on Aug 27, 2015

@Juanah

downgrade to 1.6.4 ;)

objectiveSee

objectiveSee commented on Aug 27, 2015

@objectiveSee

Oh geez I guess I'll downgrade too!

netstv

netstv commented on Aug 27, 2015

@netstv

I get it on the nano as well.. downgrading...

PaulStoffregen

PaulStoffregen commented on Aug 27, 2015

@PaulStoffregen
SponsorContributor

I'm also seeing the bug here. :(

downgrade to 1.6.4 ;)

If you're going to downgrade, you'll probably want to skip 1.6.4 and go back to 1.6.3, so you don't get hit with issue #3115.

netstv

netstv commented on Aug 27, 2015

@netstv

I don't seem to have that problem. (Yet)

dmjlambert

dmjlambert commented on Aug 28, 2015

@dmjlambert

Perhaps 1.6.5-r2 could be posted on the website download section again, since there have been several issues brought up in the forum about this. New users are having trouble.

added this to the Release 1.6.6 milestone on Aug 28, 2015
cmaglie

cmaglie commented on Aug 28, 2015

@cmaglie
Member

The fix is available for download as 1.6.5-r5:

https://www.arduino.cc/en/Main/Software

11 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @manjunath-m@cmaglie@ffissore@mojtabacazi@PaulStoffregen

      Issue actions

        LoadVIDPIDSpecificPreferences fails when connected board returns no string text · Issue #3738 · arduino/Arduino