diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index bd68df0dc..216a3bcf6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -145,16 +145,8 @@ public class PathConvert extends Task { // If the element starts with the configured prefix, then // convert the prefix to the configured 'to' value. - if (cmpElem.startsWith(cmpFrom)) { - int len = from.length(); - - if (len >= elem.length()) { - elem = to; - } else { - elem = to + elem.substring(len); - } - } - return elem; + return cmpElem.startsWith(cmpFrom) + ? to + elem.substring(from.length()) : elem; } }