File apache-ant-1.7.0-decode_file_uri.patch of Package ant

--- src/main/org/apache/tools/ant/launch/Locator.java
+++ src/main/org/apache/tools/ant/launch/Locator.java
@@ -159,11 +159,14 @@
             try {
                 java.lang.reflect.Method createMethod
                     = uriClazz.getMethod("create", new Class[] {String.class});
-                Object uriObj = createMethod.invoke(null, new Object[] {uri});
+                // encode URI first - to handle [] characters used in a
+                // build-jar-repository in jpackage project
+                Object uriObj = createMethod.invoke(null, new Object[] {encodeURI(uri)});
                 java.lang.reflect.Constructor fileConst
                     = File.class.getConstructor(new Class[] {uriClazz});
                 File f = (File) fileConst.newInstance(new Object[] {uriObj});
-                return f.getAbsolutePath();
+                //bug #42227 (Apache bugzilla) forgot to decode before returning
+                return decodeUri(f.getAbsolutePath());
             } catch (java.lang.reflect.InvocationTargetException e) {
                 Throwable e2 = e.getTargetException();
                 if (e2 instanceof IllegalArgumentException) {