Skip to content

Commit

Permalink
add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasEhret committed Jul 12, 2019
1 parent 4619691 commit d04329e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
Expand Up @@ -12,6 +12,8 @@ public interface JvmPropertyConstants {

String JAVA_CLASS_VERSION = "java.class.version";

String JAVA_CLASS_PATH = "java.class.path";

String OS_NAME = "os.name";

String OS_VERSION = "os.version";
Expand Down Expand Up @@ -81,6 +83,4 @@ public interface JvmPropertyConstants {
String JAVA_HOME = "java.home";

String AWT_HEADLESS = "java.awt.headless";

String JAVA_CLASS_PATH = "java.class.path";
}
Expand Up @@ -21,14 +21,14 @@
import java.util.List;

/**
* An interface defining the contract on how to launch a new JVM with Webstart in it.
* An interface defining the contract on how to launch a new JVM including the web start application environment.
*
* The main reason for doing so is changing the JVM version or passing different/extra arguments.
*/
public interface JvmLauncher {

/**
* Launches Webstart with the given JNLP and arguments.
* Launches the web start application environment with the given JNLP file and arguments.
*
* @param jnlpFile the JNLP file to launch in the new JVM.
* @param args arguments to pass to the new JVM
Expand Down
Expand Up @@ -18,17 +18,26 @@

import static java.util.Objects.requireNonNull;

/**
* Holds the JVM Launcher in use by the web start application environment.
*/
public class JvmLauncherHolder {

private static JvmLauncher launcher;

public static JvmLauncher getLauncher() {
return requireNonNull(launcher, "JvmLauncher is not set");
return requireNonNull(launcher, "JvmLauncher is not set.");
}

/**
* Sets the JVM Launcher that should be used by the web start application environment.
*
* @param launcher the JVM Launcher
* @throws IllegalStateException if the JVM launcher is already set
*/
public static void setLauncher(JvmLauncher launcher) {
if (JvmLauncherHolder.launcher != null) {
throw new IllegalStateException("JvmLauncher already set");
throw new IllegalStateException("JvmLauncher already set.");
}
JvmLauncherHolder.launcher = launcher;
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/net/sourceforge/jnlp/ItwJvmLauncher.java
Expand Up @@ -30,15 +30,15 @@
public class ItwJvmLauncher implements JvmLauncher {

@Override
public void launchExternal(JNLPFile jnlpFile, List<String> args) throws Exception {
public void launchExternal(final JNLPFile jnlpFile, final List<String> args) throws Exception {
launchExternal(jnlpFile.getNewVMArgs(), args);
}

/**
* @param vmArgs the arguments to pass to the jvm
* @param javawsArgs the arguments to pass to javaws (aka IcedTea-Web)
*/
private void launchExternal(List<String> vmArgs, List<String> javawsArgs) throws Exception {
private void launchExternal(final List<String> vmArgs, final List<String> javawsArgs) throws Exception {
final List<String> commands = new LinkedList<>();

// this property is set by the javaws launcher to point to the javaws binary
Expand Down
20 changes: 10 additions & 10 deletions core/src/main/java/net/sourceforge/jnlp/Launcher.java
Expand Up @@ -318,7 +318,7 @@ private void addArguments(JNLPFile file, List<String> args) {
* @param javawsArgs the arguments to pass to javaws (aka Netx)
* @throws LaunchException if there was an exception
*/
private void launchExternal(JNLPFile file, List<String> javawsArgs) throws LaunchException {
private void launchExternal(final JNLPFile file, final List<String> javawsArgs) throws LaunchException {
try {
getLauncher().launchExternal(file, javawsArgs);
} catch (NullPointerException ex) {
Expand Down Expand Up @@ -402,7 +402,7 @@ private ApplicationInstance launchApplication(final JNLPFile file) throws Launch
sp.close();
}
}
List<String> javawsArgs = new LinkedList<>();
final List<String> javawsArgs = new LinkedList<>();
javawsArgs.add("-Xnofork");
javawsArgs.addAll(JNLPRuntime.getInitialArguments());
launchExternal(file, javawsArgs);
Expand Down Expand Up @@ -438,8 +438,8 @@ private ApplicationInstance launchApplication(final JNLPFile file) throws Launch

Class<?> mainClass = app.getClassLoader().loadClass(mainName);

Method main = mainClass.getMethod("main", String[].class);
String[] args = file.getApplication().getArguments();
final Method main = mainClass.getMethod("main", String[].class);
final String[] args = file.getApplication().getArguments();

// create EDT within application context:
// dummy method to force Event Dispatch Thread creation
Expand Down Expand Up @@ -511,7 +511,7 @@ private void setContextClassLoaderForAllThreads(ThreadGroup tg, ClassLoader clas
* @return application
* @throws net.sourceforge.jnlp.LaunchException if deploy unrecoverably die
*/
private ApplicationInstance launchApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
private ApplicationInstance launchApplet(final JNLPFile file, final boolean enableCodeBase, final Container cont) throws LaunchException {
if (!file.isApplet()) {
throw launchError(new LaunchException(file, null, "Fatal", "Application Error", "Not an applet file.", "An attempt was made to load a non-applet file as an applet."));
}
Expand Down Expand Up @@ -557,7 +557,7 @@ private ApplicationInstance launchApplet(JNLPFile file, boolean enableCodeBase,
* @return applet
* @throws net.sourceforge.jnlp.LaunchException if deploy unrecoverably die
*/
private ApplicationInstance getApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
private ApplicationInstance getApplet(final JNLPFile file, final boolean enableCodeBase, final Container cont) throws LaunchException {
if (!file.isApplet()) {
throw launchError(new LaunchException(file, null, "Fatal", "Application Error", "Not an applet file.", "An attempt was made to load a non-applet file as an applet."));
}
Expand Down Expand Up @@ -585,7 +585,7 @@ private ApplicationInstance getApplet(JNLPFile file, boolean enableCodeBase, Con
* @return application
* @throws net.sourceforge.jnlp.LaunchException if deploy unrecoverably die
*/
private ApplicationInstance launchInstaller(JNLPFile file) throws LaunchException {
private ApplicationInstance launchInstaller(final JNLPFile file) throws LaunchException {
// TODO Check for an existing single instance once implemented.
// ServiceUtil.checkExistingSingleInstance(file);
throw launchError(new LaunchException(file, null, "Fatal", "Unsupported Feature", "Installers not supported.", "JNLP installer files are not yet supported."));
Expand All @@ -604,7 +604,7 @@ private ApplicationInstance launchInstaller(JNLPFile file) throws LaunchExceptio
//and then applets creates in little bit strange manner. This issue is visible with
//randomly showing/notshowing splashscreens.
//See also PluginAppletViewer.framePanel
private AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
private AppletInstance createApplet(final JNLPFile file, final boolean enableCodeBase, final Container cont) throws LaunchException {
AppletInstance appletInstance = null;
try {
JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy, enableCodeBase);
Expand Down Expand Up @@ -659,7 +659,7 @@ private AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Conta
* @return application
* @throws net.sourceforge.jnlp.LaunchException if deploy unrecoverably die
*/
private ApplicationInstance createApplication(JNLPFile file) throws LaunchException {
private ApplicationInstance createApplication(final JNLPFile file) throws LaunchException {
try {
JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy, false);
ThreadGroup group = Thread.currentThread().getThreadGroup();
Expand All @@ -681,7 +681,7 @@ private ApplicationInstance createApplication(JNLPFile file) throws LaunchExcept
* ThreadGroup has to be created at an earlier point in the applet code.
* @return ThreadGroup for this app/applet
*/
private ThreadGroup createThreadGroup(JNLPFile file) {
private ThreadGroup createThreadGroup(final JNLPFile file) {
final ThreadGroup tg;

if (file instanceof PluginBridge) {
Expand Down

0 comments on commit d04329e

Please sign in to comment.