JDK-8041128 : DRS ruleset path matching problem
  • Type: Bug
  • Component: deploy
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-04-18
  • Updated: 2014-07-29
  • Resolved: 2014-04-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20 b12Fixed 9Fixed
Description
If a DRS rule uses a location based rule for a directory such as:
http://foo.com/dir1/dir2
it will match an artifact in a different directory such as:
http://foo.com/dir1/dir20/app.jnlp
due to the code in at end of RuleId.pathIncludes():
        if (rulePath == null || rulePath.length() == 0 ||
                artifactPath.startsWith(rulePath)) {
            pathMatch = true;
        } else {
           Trace.println("Path mistach, actualPath: " + artifactPath,
                   TraceLevel.RULESET);
        }
        return pathMatch;
This is not the case if the location in the DRS includes the trailing slash:
http://foo.com/dir1/dir2/


Comments
webrev: http://oklahoma.us.oracle.com/www/webrevs/aherrick/1.9.0/8041128/deploy/webrev/
18-04-2014

should we replace the above with: if (rulePath == null || rulePath.length() == 0 || artifactPath.equals(rulePath)) { pathMatch = true; } else { String tmpRulePath = ((rulePath.endsWith("/")) ? rulePath : rulePath + "/"); if (artifactPath.startsWith(tmpRulePath)) { pathMatch = true; } else { Trace.println("Path mistach, actualPath: " + artifactPath, TraceLevel.RULESET); } } return pathMatch;
18-04-2014