Skip to content

Commit

Permalink
Merge pull request #16272 from geoand/ide-eclipse-npe
Browse files Browse the repository at this point in the history
Avoid nasty NPE when trying to open Eclipse IDE
  • Loading branch information
geoand authored Apr 6, 2021
2 parents 13d339a + 410c2fd commit 272514c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ public void setMachineSpecificCommand(String machineSpecificCommand) {
this.machineSpecificCommand = machineSpecificCommand;
}

@Override
public String toString() {
return "Ide{" +
"defaultCommand='" + defaultCommand + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ protected void launchInIDE(Ide ide, String arg, RoutingContext routingContext) {
new Thread(new Runnable() {
public void run() {
try {
new ProcessBuilder(Arrays.asList(ide.getEffectiveCommand(), arg)).inheritIO().start().waitFor(10,
String effectiveCommand = ide.getEffectiveCommand();
if (isNullOrEmpty(effectiveCommand)) {
log.debug("Unable to determine proper launch command for IDE: " + ide);
routingContext.response().setStatusCode(500).end();
return;
}
new ProcessBuilder(Arrays.asList(effectiveCommand, arg)).inheritIO().start().waitFor(10,
TimeUnit.SECONDS);
routingContext.response().setStatusCode(200).end();
} catch (Exception e) {
Expand Down

0 comments on commit 272514c

Please sign in to comment.