Skip to content

Commit c5f641b

Browse files
committed
code cleanup
1 parent dd72603 commit c5f641b

19 files changed

+309
-872
lines changed

core/pom.xml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,40 +49,6 @@
4949
<artifactId>js</artifactId>
5050
<version>1.7R1</version>
5151
</dependency>
52-
<!-- DeploymentRule set dependencies added begin -->
53-
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
54-
<dependency>
55-
<groupId>org.glassfish.jaxb</groupId>
56-
<artifactId>jaxb-runtime</artifactId>
57-
<version>2.3.1</version>
58-
</dependency>
59-
<!-- https://mvnrepository.com/artifact/javax.activation/activation -->
60-
<dependency>
61-
<groupId>javax.activation</groupId>
62-
<artifactId>activation</artifactId>
63-
<version>1.1</version>
64-
</dependency>
65-
<dependency>
66-
<groupId>javax.xml.bind</groupId>
67-
<artifactId>jaxb-api</artifactId>
68-
<version>2.3.1</version>
69-
</dependency>
70-
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
71-
<dependency>
72-
<groupId>commons-io</groupId>
73-
<artifactId>commons-io</artifactId>
74-
<version>2.5</version>
75-
</dependency>
76-
77-
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink -->
78-
79-
<dependency>
80-
<groupId>org.eclipse.persistence</groupId>
81-
<artifactId>eclipselink</artifactId>
82-
<version>2.5.0</version>
83-
</dependency>
84-
<!-- DeploymentRule set dependencies added End -->
85-
8652

8753
<dependency>
8854
<groupId>${project.groupId}</groupId>

core/src/main/java/net/adoptopenjdk/icedteaweb/resources/ResourceHandler.java

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
import static net.adoptopenjdk.icedteaweb.resources.Resource.Status.ERROR;
2525
import static net.sourceforge.jnlp.util.UrlUtils.FILE_PROTOCOL;
2626
import static net.sourceforge.jnlp.util.UrlUtils.decodeUrlQuietly;
27-
/*
28-
* Modified class to add DeploymentRuleSet
29-
* DJ -03-02-2021
30-
*/
27+
3128
class ResourceHandler {
3229

3330
private static final Logger LOG = LoggerFactory.getLogger(ResourceHandler.class);
@@ -46,7 +43,7 @@ Future<Resource> putIntoCache(final Executor downloadExecutor) {
4643
// threads will return this future and ensure a resource is only processed by a single thread
4744
synchronized (resource) {
4845
final Future<Resource> future = resource.getFutureForDownloaded();
49-
if(future == null) {
46+
if (future == null) {
5047
LOG.debug("Download for {} has not been started until now", resource.getSimpleName());
5148
final Future<Resource> futureResource = getDownloadStateAndStartUnstartedDownload(downloadExecutor);
5249
resource.startProcessing(futureResource);
@@ -121,54 +118,23 @@ private Resource downloadResource() {
121118
return resource;
122119
}
123120

124-
/** Original method
125121
private void validateWithWhitelist() {
126122
final URL url = resource.getLocation();
127123
Assert.requireNonNull(url, "url");
128124

129125
// Validate with whitelist specified in deployment.properties. localhost is considered valid.
130-
final boolean found = UrlWhiteListUtils.isUrlInApplicationUrlWhitelist(url);
131-
if (!found) {
132-
BasicExceptionDialog.show(new SecurityException(Translator.R("SWPInvalidURL") + ": " + url));
133-
LOG.error("Resource URL not In Whitelist: {}", resource.getLocation());
134-
JNLPRuntime.exit(-1);
135-
}
136-
}
137-
*/
138-
private void validateWithWhitelist() {
139-
final URL url = resource.getLocation();
140-
Assert.requireNonNull(url, "url");
141-
142-
// Validate with whitelist specified in deployment.properties. localhost is considered valid.
143-
//commented out by DJ -final key word so that URL can be checked against whitelist as well as deploymentRuleset.
144-
/*final*/ boolean found = UrlWhiteListUtils.isUrlInApplicationUrlWhitelist(url);
145-
//If not found in the serverWhitelisting , check in DeploymentRuleSet.jar file.
146-
LOG.debug("Resource URL not In Whitelist: {} found before calling Deployment rule set", found);
147-
if (!found) {
148-
LOG.debug("----------------------BEGIN DEPLOYMENT RULESET CALL------------------------------------------", found);
149-
LOG.debug("Resource URL call inside (!found) before calling found=validateWithDeploymentRuleSet()", found);
150-
found=validateWithDeploymentRuleSet() ;
151-
LOG.debug("Resource URL call inside (!found) after calling found=validateWithDeploymentRuleSet()", found);
126+
if (UrlWhiteListUtils.isUrlInApplicationUrlWhitelist(url)) {
127+
return;
152128
}
153-
LOG.debug("Resource URL not In Whitelist: {} found after calling Deployment rule set", found);
154-
if (!found) {
155-
BasicExceptionDialog.show(new SecurityException(Translator.R("SWPInvalidURL") + ": " + url));
156-
LOG.error("Resource URL not In Whitelist: {}", resource.getLocation());
157-
JNLPRuntime.exit(-1);
158-
}
159-
}
160-
161-
/**
162-
* @author DJ 03-02-2021
163-
* Validates the resource URL with the deploymentRuleSet jar file
164-
*/
165-
private boolean validateWithDeploymentRuleSet() {
166-
final URL url = resource.getLocation();
167-
Assert.requireNonNull(url, "url");
168129

169130
// Validate with whitelist specified in DeploymentRuleSet.jar localhost is considered valid.
170-
final boolean found = UrlDeploymentRulesSetUtils.isUrlInDeploymentRuleSetlist(url);
171-
return found;
131+
if (UrlDeploymentRulesSetUtils.isUrlInDeploymentRuleSet(url)) {
132+
return;
133+
}
134+
135+
BasicExceptionDialog.show(new SecurityException(Translator.R("SWPInvalidURL") + ": " + url));
136+
LOG.error("Resource URL not In Whitelist: {}", resource.getLocation());
137+
JNLPRuntime.exit(-1);
172138
}
173139

174140
}

core/src/main/java/net/sourceforge/jnlp/config/ConfigurationConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public interface ConfigurationConstants {
300300
String KEY_HTTPCONNECTION_CONNECT_TIMEOUT = "deployment.connection.connectTimeout";
301301
String KEY_HTTPCONNECTION_READ_TIMEOUT = "deployment.connection.readTimeout";
302302

303-
/*DJ -adding deloymentruleset properties*/
303+
/* deployment ruleset properties*/
304304
String KEY_DEPLOYMENT_RULE_SET = "deployment.deploymentruleset.jar";
305305

306306
}

core/src/main/java/net/sourceforge/jnlp/deploymentrules/Action.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

core/src/main/java/net/sourceforge/jnlp/deploymentrules/Certificate.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

core/src/main/java/net/sourceforge/jnlp/deploymentrules/DeploymentJarLoader.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

core/src/main/java/net/sourceforge/jnlp/deploymentrules/DeploymentRule.java

Lines changed: 0 additions & 71 deletions
This file was deleted.

core/src/main/java/net/sourceforge/jnlp/deploymentrules/DeploymentRuleSetJarVerifier.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)