Skip to content

Commit 6597352

Browse files
authored
Merge pull request #52 from arduino/scerza/missing-lib-fix
Message is now shown to the user when libraries are not installed
2 parents 5f19f46 + 7b2dea8 commit 6597352

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ addons:
1111
- ant
1212

1313
jdk:
14-
- oraclejdk8
14+
- openjdk8
1515

1616
script:
1717
- export SRC=$PWD
@@ -23,4 +23,3 @@ script:
2323
- popd
2424
- export IDE_FOLDER=Arduino-$TAG/build/linux/work
2525
- ./build.sh
26-

src/cc/arduino/plugins/wifi101/UpdaterImpl.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,13 @@ protected void openFirmwareUpdaterSketch() {
194194
Flasher fw = (Flasher) getFirmwareSelector().getSelectedItem();
195195
try {
196196
fw.openFirmwareUpdaterSketch(getSelectedPort());
197-
}
198-
catch (Exception e) {
199-
e.printStackTrace();
197+
} catch (NullPointerException e) {
198+
JOptionPane.showMessageDialog(UpdaterImpl.this, "Please select a board from the connected ones.", "No board selected",
199+
JOptionPane.INFORMATION_MESSAGE);
200+
201+
} catch (Exception e) {
202+
JOptionPane.showMessageDialog(UpdaterImpl.this, e.getMessage(), "Missing library",
203+
JOptionPane.ERROR_MESSAGE);
200204
}
201205
}
202206

src/cc/arduino/plugins/wifi101/flashers/Flasher.java

+9
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ public void openFirmwareUpdaterSketch(BoardPort port) throws Exception {
129129
firmwareUpdaterExamplePath = lib.getInstalledFolder().getAbsolutePath() + "/" + pathToSketch;
130130
}
131131
}
132+
if (firmwareUpdaterExamplePath == "") {
133+
String errorMessage = nameToSearchFor + "library";
134+
if (port.getBoardName() != "") {
135+
errorMessage += " for " + port.getBoardName();
136+
}
137+
errorMessage += " is not installed.\nUse the library manager to install it.";
138+
throw new Exception(errorMessage);
139+
}
140+
132141
if (firmwareUpdaterExamplePath != "" && port != null) {
133142
BaseNoGui.selectSerialPort(port.getAddress());
134143
Base.INSTANCE.onBoardOrPortChange();

0 commit comments

Comments
 (0)