-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
A class in the default package causes a StringIndexOutOfBoundsException in the following code:
yGuard/src/main/java/com/yworks/yguard/ant/PackageSection.java
Lines 68 to 79 in 06fc747
| DirectoryScanner scanner = zf.getDirectoryScanner(project); | |
| scanner.setIncludes(ObfuscatorTask.toNativePattern(ps.getIncludePatterns(project))); | |
| scanner.setExcludes(ObfuscatorTask.toNativePattern(ps.getExcludePatterns(project))); | |
| String[] matches = ZipScannerTool.getMatches(zf, scanner); | |
| for (int i = 0; i < matches.length; i++) { | |
| String match = matches[i]; | |
| int slashIndex = match.lastIndexOf('/'); | |
| if (match.endsWith(".class") || match.endsWith("/") && slashIndex > 0) { | |
| match = match.substring(0, slashIndex); | |
| packages.add(match); | |
| } | |
| } |
match.substring(0, slashIndex) gets a slashIndex of -1 from match.lastIndexOf('/')
Obfuscating any JAR with a class in the default package should be enough to reproduce the issue.
Ideally such classes would be handled like other classes. But if they are considered unsupported a clear exception would be appreciated.
Metadata
Metadata
Assignees
Labels
No labels