Skip to content

Commit 65a4b40

Browse files
committed
Merge pull request #2126 from damellis/issue-1791
Proceed with upload even if port can't be found.
2 parents 7f9e9b1 + fcd6336 commit 65a4b40

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

app/src/cc/arduino/packages/UploaderAndMonitorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
public class UploaderAndMonitorFactory {
4141

4242
public Uploader newUploader(TargetBoard board, BoardPort port) {
43-
if ("true".equals(board.getPreferences().get("upload.via_ssh")) && "network".equals(port.getProtocol())) {
43+
if ("true".equals(board.getPreferences().get("upload.via_ssh")) && port != null && "network".equals(port.getProtocol())) {
4444
return new SSHUploader(port);
4545
}
4646

app/src/cc/arduino/packages/uploaders/SerialUploader.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
121121
String pattern = prefs.getOrExcept("upload.pattern");
122122
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
123123
uploadResult = executeUploadCommand(cmd);
124+
} catch (RunnerException e) {
125+
throw e;
124126
} catch (Exception e) {
125127
throw new RunnerException(e);
126128
}
@@ -228,6 +230,8 @@ public boolean uploadUsingProgrammer(String buildPath, String className) throws
228230
String pattern = prefs.getOrExcept("program.pattern");
229231
String[] cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
230232
return executeUploadCommand(cmd);
233+
} catch (RunnerException e) {
234+
throw e;
231235
} catch (Exception e) {
232236
throw new RunnerException(e);
233237
}
@@ -287,6 +291,8 @@ public boolean burnBootloader() throws Exception {
287291
pattern = prefs.getOrExcept("bootloader.pattern");
288292
cmd = StringReplacer.formatAndSplit(pattern, prefs, true);
289293
return executeUploadCommand(cmd);
294+
} catch (RunnerException e) {
295+
throw e;
290296
} catch (Exception e) {
291297
throw new RunnerException(e);
292298
}

app/src/processing/app/Sketch.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,11 +1692,6 @@ protected boolean upload(String buildPath, String suggestedClassName, boolean us
16921692

16931693
BoardPort boardPort = Base.getDiscoveryManager().find(Preferences.get("serial.port"));
16941694

1695-
if (boardPort == null) {
1696-
editor.statusError(I18n.format("Board at {0} is not available", Preferences.get("serial.port")));
1697-
return false;
1698-
}
1699-
17001695
Uploader uploader = new UploaderAndMonitorFactory().newUploader(target.getBoards().get(board), boardPort);
17011696

17021697
boolean success = false;

0 commit comments

Comments
 (0)