Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Jul 21, 2024
1 parent 839a96a commit 6db9c3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2005, 2018 IBM Corporation and others.
* Copyright (c) 2005, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
Expand All @@ -23,7 +23,7 @@
* <p>
* Clients may implement this interface.
* </p>
*
*
* @since 1.0
*/
public interface IApplication {
Expand All @@ -38,7 +38,7 @@ public interface IApplication {
*
* <p>
* Note: The handling of this special exit code may be disabled by launcher
* argument '-norestart'.
* argument {@code --launcher.noRestart}.
* </p>
*/
public static final Integer EXIT_RESTART = Integer.valueOf(23);
Expand All @@ -52,7 +52,7 @@ public interface IApplication {
*
* <p>
* Note: The handling of this special exit code may be disabled by launcher
* argument '-norestart'.
* argument {@code --launcher.noRestart}.
* </p>
*/
public static final Integer EXIT_RELAUNCH = Integer.valueOf(24);
Expand All @@ -74,7 +74,7 @@ public interface IApplication {
* Note: This method is called by the platform; it is not intended to be called
* directly by clients.
* </p>
*
*
* @return the return value of the application
* @see #EXIT_OK
* @see #EXIT_RESTART
Expand All @@ -90,7 +90,7 @@ public interface IApplication {
* running application is ready to exit. The {@link #start(IApplicationContext)}
* should already have exited or should exit very soon after this method exits
* <p>
*
*
* This method is only called to force an application to exit. This method will
* not be called if an application exits normally from the
* {@link #start(IApplicationContext)} method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ void test_appTerminatesWithoutNoRestartWithEXIT_OK() throws IOException, Interru
void test_appTerminatesWithNoRestartAndEXIT_OK() throws IOException, InterruptedException {
test_norestart(EXIT_OK, true);
}

@Test
void test_appTerminatesWithNoRestartAndEXIT_RESTART() throws IOException, InterruptedException {
test_norestart(EXIT_RESTART, true);
}

@Test
void test_appTerminatesWithNoRestartAndEXIT_RELAUNCH() throws IOException, InterruptedException {
test_norestart(EXIT_RELAUNCH, true);
Expand All @@ -239,7 +239,7 @@ void test_appTerminatesWithNoRestartAndExitCode100() throws IOException, Interru
private void test_norestart(int exitCode, boolean addNoRestartArg) throws IOException, InterruptedException {
writeEclipseIni(DEFAULT_ECLIPSE_INI_CONTENT);

List<String> launcherArgs = addNoRestartArg ? List.of("-norestart", "--launcher.suppressErrors")
List<String> launcherArgs = addNoRestartArg ? List.of("--launcher.noRestart", "--launcher.suppressErrors")
: List.of("--launcher.suppressErrors");
Process launcherProcess = startEclipseLauncher(launcherArgs);

Expand All @@ -248,15 +248,15 @@ private void test_norestart(int exitCode, boolean addNoRestartArg) throws IOExce
List<String> appArgs = new ArrayList<>();
analyzeLaunchedTestApp(socket, appArgs, null, exitCode);

// Make sure -norestart arg is picked
// Make sure --launcher.noRestart arg is picked
assertEquals(addNoRestartArg, appArgs.contains("--launcher.noRestart"));
// Make sure launcher exited with expected exit value
launcherProcess.waitFor(5, TimeUnit.SECONDS);
assertEquals(exitCode, launcherProcess.exitValue());
try {
server.accept();
if (addNoRestartArg) {
fail("New eclipse started even with -norestart arg and exit code " + exitCode);
fail("New eclipse started even with --launcher.noRestart arg and exit code " + exitCode);
} else {
fail("New eclipse started even with exit code " + exitCode);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -71,7 +71,7 @@
* -nosplash do not display the splash screen. The java application will
* not receive the -showsplash command.
* -showsplash <bitmap> show the given bitmap in the splash screen.
* -norestart disables the restart behavior of exit codes 23 and 24.
* --launcher.norestart disables the restart behavior of exit codes 23 and 24.
* -name <name> application name displayed in error message dialogs and
* splash screen window. Default value is computed from the
* name of the executable - with the first letter capitalized
Expand Down Expand Up @@ -1168,7 +1168,7 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA

/* 'No restart' argument, if applicable. */
if (noRestart) {
(*progArgv)[ dst++ ] = LAUNCHER_NORESTART;
(*progArgv)[ dst++ ] = NORESTART;
}

/* Append the exit data command. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2009 IBM Corporation and others.
* Copyright (c) 2006, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -25,7 +25,6 @@
#define OS _T_ECLIPSE("-os")
#define OSARCH _T_ECLIPSE("-arch")
#define NOSPLASH _T_ECLIPSE("-nosplash")
#define NORESTART _T_ECLIPSE("-norestart")
#define LAUNCHER _T_ECLIPSE("-launcher")
#define SHOWSPLASH _T_ECLIPSE("-showsplash")
#define EXITDATA _T_ECLIPSE("-exitdata")
Expand All @@ -48,7 +47,7 @@
#define INI _T_ECLIPSE("--launcher.ini")
#define APPEND_VMARGS _T_ECLIPSE("--launcher.appendVmargs")
#define OVERRIDE_VMARGS _T_ECLIPSE("--launcher.overrideVmargs")
#define LAUNCHER_NORESTART _T_ECLIPSE("--launcher.noRestart")
#define NORESTART _T_ECLIPSE("--launcher.noRestart")
#define SECOND_THREAD _T_ECLIPSE("--launcher.secondThread")
#define PERM_GEN _T_ECLIPSE("--launcher.XXMaxPermSize")
#define OLD_ARGS_START _T_ECLIPSE("--launcher.oldUserArgsStart")
Expand Down

0 comments on commit 6db9c3c

Please sign in to comment.