Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ public boolean isPassFile(final String passFileName) {
// files under "org/apache/harmony/pack200/")
pass += "/";
}
return passFileName.startsWith(pass);
if (passFileName.startsWith(pass)) {
return true;
}
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,20 @@ private void unpackJar(final File sourceFile, final File destFile) throws Pack20
}
}


/**
* Tests that a directory pass rule that does not match the file does not hide later rules.
*/
@Test
void testIsPassFileChecksAllRules() {
final PackingOptions options = new PackingOptions();
options.addPassFile("org/apache/other");
options.addPassFile("org/apache/Foo.class");
options.addPassFile("org/apache/pass");
assertTrue(options.isPassFile("org/apache/Foo.class"));
assertTrue(options.isPassFile("org/apache/pass/Bar.class"));
assertTrue(options.isPassFile("org/apache/other/Baz.class"));
assertFalse(options.isPassFile("org/apache/Qux.class"));
assertFalse(options.isPassFile("org/apache/passing/Bar.class"));
}
}