From bed556a3983cd57914ea99e97e68195d30c0eca5 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 2 Jul 1999 18:54:44 +0000 Subject: [PATCH] some bug fixes git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@990 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/obfuscator/WildCard.java | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/jode/jode/obfuscator/WildCard.java b/jode/jode/obfuscator/WildCard.java index ce3b41e..ecbe921 100644 --- a/jode/jode/obfuscator/WildCard.java +++ b/jode/jode/obfuscator/WildCard.java @@ -31,25 +31,21 @@ public class WildCard { public String getNextComponent(String prefix) { int lastDot = prefix.length(); - if (lastDot < wildcard.length() - || !wildcard.startsWith(prefix) - || (lastDot > 0 && wildcard.charAt(lastDot) != '.')) + if (!wildcard.startsWith(prefix)) return null; - if (lastDot > 0) - lastDot++; - int nextDot = wildcard.indexOf('.', lastDot); - if (firstStar == -1) { - if (nextDot == -1) - return wildcard.substring(lastDot); - else - return wildcard.substring(lastDot, nextDot); - } else { - if (nextDot == -1 || nextDot > firstStar) { + if (lastDot > 0) { + if (wildcard.charAt(lastDot++) != '.') return null; - } else { - return wildcard.substring(lastDot, nextDot); - } } + + int nextDot = wildcard.indexOf('.', lastDot); + if (nextDot > 0 + && (nextDot <= firstStar || firstStar == -1)) + return wildcard.substring(lastDot, nextDot); + else if (firstStar == -1) + return wildcard.substring(lastDot); + else + return null; } public boolean startsWith(String test) {