aboutsummaryrefslogtreecommitdiffstats
path: root/netx
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2013-11-27 14:20:25 +0100
committerJiri Vanek <[email protected]>2013-11-27 14:20:25 +0100
commit4e54b331710269c584f8c328fbb395789b4a5502 (patch)
tree25d5da3e9fb6208c54226da30f5620e7737cdf1c /netx
parentac7b8213a8d58eca5341b2eef8f328ea74126f0f (diff)
Reverted "fix to ManifestedJar1Test cases", better manifestedjar tests, added srtict test
* netx/net/sourceforge/jnlp/Parser.java: added indentation, fixes condition in strict base check * netx/net/sourceforge/jnlp/ResourcesDesc.java: revertedt recently added throw * tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java: (manifestedJar1main2mainNoAppDesc) adapted and (manifestedJar1main2mainNoAppDescStrict) added
Diffstat (limited to 'netx')
-rw-r--r--netx/net/sourceforge/jnlp/Parser.java21
-rw-r--r--netx/net/sourceforge/jnlp/ResourcesDesc.java13
2 files changed, 14 insertions, 20 deletions
diff --git a/netx/net/sourceforge/jnlp/Parser.java b/netx/net/sourceforge/jnlp/Parser.java
index 310b306..4043fa6 100644
--- a/netx/net/sourceforge/jnlp/Parser.java
+++ b/netx/net/sourceforge/jnlp/Parser.java
@@ -250,13 +250,13 @@ class Parser {
Node resources[] = getChildNodes(parent, "resources");
// ensure that there are at least one information section present
- if (resources.length == 0 && !j2se)
+ if (resources.length == 0 && !j2se) {
throw new ParseException(R("PNoResources"));
-
+ }
// create objects from the resources sections
- for (int i = 0; i < resources.length; i++)
+ for (int i = 0; i < resources.length; i++) {
result.add(getResourcesDesc(resources[i], j2se));
-
+ }
return result;
}
@@ -302,9 +302,11 @@ class Parser {
// check for duplicate main entries
if (jar.isMain()) {
- if (mainFlag == true)
- if (strict)
+ if (mainFlag == true) {
+ if (strict) {
throw new ParseException(R("PTwoMains"));
+ }
+ }
mainFlag = true;
}
@@ -1073,10 +1075,11 @@ class Parser {
URL result = new URL(base, href);
// check for going above the codebase
- if (!result.toString().startsWith(base.toString()))
- if (strict)
+ if (!result.toString().startsWith(base.toString()) && !base.toString().startsWith(result.toString())){
+ if (strict) {
throw new ParseException(R("PUrlNotInCodebase", node.getNodeName(), href, base));
-
+ }
+ }
return result;
}
diff --git a/netx/net/sourceforge/jnlp/ResourcesDesc.java b/netx/net/sourceforge/jnlp/ResourcesDesc.java
index a63c3b0..0726851 100644
--- a/netx/net/sourceforge/jnlp/ResourcesDesc.java
+++ b/netx/net/sourceforge/jnlp/ResourcesDesc.java
@@ -72,19 +72,10 @@ public class ResourcesDesc {
}
public static JARDesc getMainJAR(List<JARDesc> jars) {
- JARDesc markedMain = null;
for (JARDesc jar : jars) {
if (jar.isMain()) {
- if (markedMain == null){
- markedMain = jar;
- } else {
- //more then one main jar specified. It stinks. Return null to die later null;
- throw new RuntimeException("Multiple main JARs specified, refusing to continue.");
- }
- }
- }
- if (markedMain!=null){
- return markedMain;
+ return jar;
+ }
}
if (jars.size() > 0) {