Skip to content

Commit

Permalink
Merge upstream/master into Task_#3709
Browse files Browse the repository at this point in the history
  • Loading branch information
lherschi committed Apr 8, 2019
2 parents 8d2dd5a + 14cb721 commit 8573b63
Show file tree
Hide file tree
Showing 51 changed files with 373 additions and 479 deletions.
46 changes: 0 additions & 46 deletions CODE_OF_CONDUCT.md

This file was deleted.

20 changes: 0 additions & 20 deletions CONTRIBUTING.md

This file was deleted.

109 changes: 0 additions & 109 deletions JAVA_STYLE_GUIDE.md

This file was deleted.

11 changes: 6 additions & 5 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@
<artifactId>icedtea-web-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>icedtea-web-xml-parser</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.github.vatbub</groupId>
<artifactId>mslinks</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>org.ccil.cowan.tagsoup</groupId>
<artifactId>tagsoup</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
Expand Down
39 changes: 21 additions & 18 deletions core/src/main/java/net/sourceforge/jnlp/AppletDesc.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@

package net.sourceforge.jnlp;

import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import net.sourceforge.jnlp.config.DeploymentConfiguration;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.util.logging.OutputController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;

/**
* The applet-desc element.
*
Expand Down Expand Up @@ -64,8 +63,8 @@ public class AppletDesc implements LaunchDesc {
* @param height the height
* @param parameters the parameters
*/
public AppletDesc(String name, String mainClass, URL documentBase, int width, int height,
Map<String, String> parameters) {
public AppletDesc(final String name, final String mainClass, final URL documentBase, final int width, final int height,
final Map<String, String> parameters) {
this.name = name;
this.mainClass = mainClass;
this.documentBase = documentBase;
Expand Down Expand Up @@ -96,12 +95,16 @@ public URL getDocumentBase() {
return documentBase;
}

private Integer getConfigurationPropertyAsInt(final String name) {
return Integer.valueOf(JNLPRuntime.getConfiguration().getProperty(name));
}

/**
* @return the width
*/
public int getWidth() {
if (width < Integer.valueOf(JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_SMALL_SIZE_OVERRIDE_TRESHOLD))) {
Integer nww = fixWidth();
if (width < getConfigurationPropertyAsInt(DeploymentConfiguration.KEY_SMALL_SIZE_OVERRIDE_TRESHOLD)) {
final Integer nww = fixWidth();
if (nww != null) {
return nww;
}
Expand All @@ -113,8 +116,8 @@ public int getWidth() {
* @return the height
*/
public int getHeight() {
if (height < Integer.valueOf(JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_SMALL_SIZE_OVERRIDE_TRESHOLD))) {
Integer nwh = fixHeight();
if (height < getConfigurationPropertyAsInt(DeploymentConfiguration.KEY_SMALL_SIZE_OVERRIDE_TRESHOLD)) {
final Integer nwh = fixHeight();
if (nwh != null) {
return nwh;
}
Expand All @@ -126,7 +129,7 @@ public int getHeight() {
* @return the applet parameters
*/
public Map<String, String> getParameters() {
return new HashMap<>(parameters);
return Collections.unmodifiableMap(parameters);
}

/**
Expand All @@ -137,7 +140,7 @@ public Map<String, String> getParameters() {
* @param name key of value
* @param value value to be added
*/
public void addParameter(String name, String value) {
public void addParameter(final String name, final String value) {
parameters.put(name, value);
}

Expand All @@ -148,10 +151,10 @@ private Integer fixWidth() {
return fixSize(DeploymentConfiguration.KEY_SMALL_SIZE_OVERRIDE_WIDTH, "Width", "width", "WIDTH");
}

private Integer fixSize(String depKey, String... keys) {
private Integer fixSize(final String depKey, final String... keys) {
LOG.info("Found to small applet!");
try {
Integer depVal = Integer.valueOf(JNLPRuntime.getConfiguration().getProperty(depKey));
final Integer depVal = getConfigurationPropertyAsInt(depKey);
if (depVal == 0) {
LOG.info("using its size");
return null;
Expand All @@ -161,13 +164,13 @@ private Integer fixSize(String depKey, String... keys) {
return Math.abs(depVal);
}
for (final String key : keys) {
String sizeFromParam = parameters.get(key);
final String sizeFromParam = parameters.get(key);
if (sizeFromParam != null) {
try {
LOG.info("using its {}={}", key, sizeFromParam);
return Integer.valueOf(sizeFromParam);
} catch (NumberFormatException ex) {
OutputController.getLogger().log(ex);
} catch (final NumberFormatException ex) {
LOG.error("ERROR", ex);
}
}
}
Expand Down
15 changes: 6 additions & 9 deletions core/src/main/java/net/sourceforge/jnlp/ApplicationDesc.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ApplicationDesc implements LaunchDesc {
private final String mainClass;

/** the arguments */
private String arguments[];
private final List<String> arguments;
private final boolean fx;

/**
Expand All @@ -41,9 +41,9 @@ public class ApplicationDesc implements LaunchDesc {
* @param mainClass the main class name and package
* @param arguments the arguments
*/
public ApplicationDesc(String mainClass, String[] arguments, boolean isFX) {
public ApplicationDesc(final String mainClass, final String[] arguments, final boolean isFX) {
this.mainClass = mainClass;
this.arguments = arguments;
this.arguments = Arrays.asList(arguments);
this.fx = isFX;
}

Expand All @@ -59,18 +59,15 @@ public String getMainClass() {
* @return the arguments
*/
public String[] getArguments() {
return arguments.clone();
return arguments.toArray(new String[0]);
}

/**
* Add an argument to the end of the arguments.
* @param arg argument of command
*/
public void addArgument(String arg) {
List<String> l = new ArrayList<>(Arrays.asList(arguments));
l.add(arg);

arguments = l.toArray(arguments);
public void addArgument(final String arg) {
arguments.add(arg);
}

}
4 changes: 3 additions & 1 deletion core/src/main/java/net/sourceforge/jnlp/AssociationDesc.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package net.sourceforge.jnlp;

import net.adoptopenjdk.icedteaweb.xmlparser.ParseException;

public final class AssociationDesc {

/** the extensions this application wants to register with */
Expand All @@ -24,7 +26,7 @@ public final class AssociationDesc {
/** the mime type for the association */
private final String mimeType;

public AssociationDesc(String mimeType, String[] extensions) throws ParseException {
public AssociationDesc(final String mimeType, final String[] extensions) throws ParseException {
checkMimeType(mimeType);
this.mimeType = mimeType;
this.extensions = extensions;
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/net/sourceforge/jnlp/ExtensionDesc.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package net.sourceforge.jnlp;

import net.adoptopenjdk.icedteaweb.xmlparser.ParseException;
import net.sourceforge.jnlp.util.logging.OutputController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/net/sourceforge/jnlp/IconDesc.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class IconDesc {
* @param depth the depth, or -1 if unknown
* @param size the size, or -1 if unknown
*/
IconDesc(URL location, Object kind, int width, int height, int depth, int size) {
IconDesc(final URL location, final Object kind, final int width, final int height, final int depth, final int size) {
this.location = location;
this.kind = kind;
this.width = width;
Expand Down
Loading

0 comments on commit 8573b63

Please sign in to comment.