Skip to content

Commit

Permalink
reduce redundant call to get mvn/gradle settnigs and tweak logging me…
Browse files Browse the repository at this point in the history
…ssages

Signed-off-by: Kathryn Kodama <[email protected]>
  • Loading branch information
kathrynkodama committed Nov 25, 2022
1 parent a865ced commit d0c1f41
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ protected void executeLibertyAction() {
String startCmd = null;
int debugPort = -1;
DebugModeHandler debugHandler = new DebugModeHandler();
String start = projectType.equals(Constants.LIBERTY_MAVEN_PROJECT) ? LibertyMavenUtil.getMavenSettingsCmd(project) + Constants.LIBERTY_MAVEN_START_CMD : LibertyGradleUtil.getGradleSettingsCmd(project) + Constants.LIBERTY_GRADLE_START_CMD;
String startInContainer = projectType.equals(Constants.LIBERTY_MAVEN_PROJECT) ? LibertyMavenUtil.getMavenSettingsCmd(project) + Constants.LIBERTY_MAVEN_START_CONTAINER_CMD : LibertyGradleUtil.getGradleSettingsCmd(project) + Constants.LIBERTY_GRADLE_START_CONTAINER_CMD;
String buildSettingsCmd = projectType.equals(Constants.LIBERTY_MAVEN_PROJECT) ? LibertyMavenUtil.getMavenSettingsCmd(project) : LibertyGradleUtil.getGradleSettingsCmd(project);
String start = projectType.equals(Constants.LIBERTY_MAVEN_PROJECT) ? buildSettingsCmd + Constants.LIBERTY_MAVEN_START_CMD : buildSettingsCmd + Constants.LIBERTY_GRADLE_START_CMD;
String startInContainer = projectType.equals(Constants.LIBERTY_MAVEN_PROJECT) ? buildSettingsCmd + Constants.LIBERTY_MAVEN_START_CONTAINER_CMD : buildSettingsCmd + Constants.LIBERTY_GRADLE_START_CONTAINER_CMD;
startCmd = libertyModule.runInContainer() ? startInContainer : start;
startCmd += libertyModule.getCustomStartParams();
if (libertyModule.isDebugMode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEn
// FIXME implement runInContainer checkbox from run config see https://github.com/OpenLiberty/liberty-tools-intellij/issues/160
// libertyModule.setRunInContainer(runInContainer());

if (executor.getId() == DefaultDebugExecutor.EXECUTOR_ID) {
if (executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
libertyModule.setDebugMode(true);
}
action.actionPerformed(new AnActionEvent(null, DataManager.getInstance().getDataContext(null), ActionPlaces.UNKNOWN, new Presentation(), ActionManager.getInstance(), 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void runConfigurationRemoved(@NotNull RunnerAndConfigurationSettings sett
libertyModule.clearCustomStartParams();
}
} catch (MalformedURLException e) {
LOGGER.warn(String.format("Unable to clear custom start parameters for Liberty project associated with Liberty run configuration associated with: %s. Could not resolve build file.", runConfig.getBuildFile()), e);
LOGGER.warn(String.format("Unable to clear custom start parameters for Liberty run configuration associated with: %s. Could not resolve build file.", runConfig.getBuildFile()), e);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ private void createDebugConfiguration(ProgressIndicator indicator, LibertyModule
RemoteConfiguration remoteConfiguration = (RemoteConfiguration) settings.getConfiguration();
remoteConfiguration.PORT = debugPortStr;
long groupId = ExecutionEnvironment.getNextUnusedExecutionId();
LOGGER.debug(String.format("%s: attempting to attach debugger to port %s"), libertyModule.getName(), debugPortStr);
LOGGER.debug(String.format("%s: attempting to attach debugger to port %s", libertyModule.getName(), debugPortStr));
ExecutionUtil.runConfiguration(settings, DefaultDebugExecutor.getDebugExecutorInstance(), DefaultExecutionTarget.INSTANCE, groupId);
} catch (Exception e) {
// do not show error if debug attachment was cancelled by user
if (!(e instanceof ProcessCanceledException)) {
LOGGER.error(String.format("Cannot connect debugger to port %s", debugPort), e);
LOGGER.error(String.format("Cannot connect debugger to port %d", debugPort), e);
ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(LocalizedResourceUtil.getMessage("cannot.connect.debug.port", debugPort), "Liberty"));
}
}
Expand Down

0 comments on commit d0c1f41

Please sign in to comment.