| @@ -1204,11 +1204,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||||
| * | * | ||||
| * @return the entry's certificates or null is the container is | * @return the entry's certificates or null is the container is | ||||
| * not a jar or it has no certificates. | * not a jar or it has no certificates. | ||||
| * | |||||
| * @exception IOException if the manifest cannot be read. | |||||
| */ | */ | ||||
| private Certificate[] getCertificates(final File container, final String entry) | |||||
| throws IOException { | |||||
| private Certificate[] getCertificates(final File container, final String entry) { | |||||
| if (container.isDirectory()) { | if (container.isDirectory()) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -23,6 +23,7 @@ import java.io.FilenameFilter; | |||||
| import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||
| import java.net.MalformedURLException; | import java.net.MalformedURLException; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.nio.charset.StandardCharsets; | |||||
| import java.text.CharacterIterator; | import java.text.CharacterIterator; | ||||
| import java.text.StringCharacterIterator; | import java.text.StringCharacterIterator; | ||||
| import java.util.Locale; | import java.util.Locale; | ||||
| @@ -59,10 +60,6 @@ public final class Locator { | |||||
| private static final int SPACE = 0x20; | private static final int SPACE = 0x20; | ||||
| private static final int DEL = 0x7F; | private static final int DEL = 0x7F; | ||||
| /** | |||||
| * encoding used to represent URIs | |||||
| */ | |||||
| public static final String URI_ENCODING = "UTF-8"; | |||||
| // stolen from org.apache.xerces.impl.XMLEntityManager#getUserDir() | // stolen from org.apache.xerces.impl.XMLEntityManager#getUserDir() | ||||
| // of the Xerces-J team | // of the Xerces-J team | ||||
| // which ASCII characters need to be escaped | // which ASCII characters need to be escaped | ||||
| @@ -315,11 +312,11 @@ public final class Locator { | |||||
| } else if (c >= 0x0000 && c < 0x0080) { | } else if (c >= 0x0000 && c < 0x0080) { | ||||
| sb.write(c); | sb.write(c); | ||||
| } else { // #50543 | } else { // #50543 | ||||
| byte[] bytes = String.valueOf(c).getBytes(URI_ENCODING); | |||||
| byte[] bytes = String.valueOf(c).getBytes(StandardCharsets.UTF_8); | |||||
| sb.write(bytes, 0, bytes.length); | sb.write(bytes, 0, bytes.length); | ||||
| } | } | ||||
| } | } | ||||
| return sb.toString(URI_ENCODING); | |||||
| return sb.toString(StandardCharsets.UTF_8.name()); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -327,10 +324,9 @@ public final class Locator { | |||||
| * The URI is escaped | * The URI is escaped | ||||
| * @param path String to encode. | * @param path String to encode. | ||||
| * @return The encoded string, according to URI norms | * @return The encoded string, according to URI norms | ||||
| * @throws UnsupportedEncodingException if UTF-8 is not available | |||||
| * @since Ant 1.7 | * @since Ant 1.7 | ||||
| */ | */ | ||||
| public static String encodeURI(String path) throws UnsupportedEncodingException { | |||||
| public static String encodeURI(String path) { | |||||
| int i = 0; | int i = 0; | ||||
| int len = path.length(); | int len = path.length(); | ||||
| int ch = 0; | int ch = 0; | ||||
| @@ -362,7 +358,7 @@ public final class Locator { | |||||
| // get UTF-8 bytes for the remaining sub-string | // get UTF-8 bytes for the remaining sub-string | ||||
| byte[] bytes = null; | byte[] bytes = null; | ||||
| byte b; | byte b; | ||||
| bytes = path.substring(i).getBytes(URI_ENCODING); | |||||
| bytes = path.substring(i).getBytes(StandardCharsets.UTF_8); | |||||
| len = bytes.length; | len = bytes.length; | ||||
| // for each byte | // for each byte | ||||
| @@ -383,7 +383,7 @@ public class Concat extends Task implements ResourceCollection { | |||||
| private ConcatResource(ResourceCollection c) { | private ConcatResource(ResourceCollection c) { | ||||
| this.c = c; | this.c = c; | ||||
| } | } | ||||
| public InputStream getInputStream() throws IOException { | |||||
| public InputStream getInputStream() { | |||||
| if (binary) { | if (binary) { | ||||
| ConcatResourceInputStream result = new ConcatResourceInputStream(c); | ConcatResourceInputStream result = new ConcatResourceInputStream(c); | ||||
| result.setManagingComponent(this); | result.setManagingComponent(this); | ||||
| @@ -1024,8 +1024,7 @@ public class Jar extends Zip { | |||||
| * @since Ant 1.6.2 | * @since Ant 1.6.2 | ||||
| */ | */ | ||||
| protected final void writeIndexLikeList(List<String> dirs, List<String> files, | protected final void writeIndexLikeList(List<String> dirs, List<String> files, | ||||
| PrintWriter writer) | |||||
| throws IOException { | |||||
| PrintWriter writer) { | |||||
| // JarIndex is sorting the directories by ascending order. | // JarIndex is sorting the directories by ascending order. | ||||
| // it has no value but cosmetic since it will be read into a | // it has no value but cosmetic since it will be read into a | ||||
| // hashtable by the classloader, but we'll do so anyway. | // hashtable by the classloader, but we'll do so anyway. | ||||
| @@ -115,11 +115,8 @@ public class ManifestClassPath extends Task { | |||||
| if (pathEntry.isDirectory() && !relPath.endsWith("/")) { | if (pathEntry.isDirectory() && !relPath.endsWith("/")) { | ||||
| relPath = relPath + '/'; | relPath = relPath + '/'; | ||||
| } | } | ||||
| try { | |||||
| relPath = Locator.encodeURI(relPath); | |||||
| } catch (UnsupportedEncodingException exc) { | |||||
| throw new BuildException(exc); | |||||
| } | |||||
| relPath = Locator.encodeURI(relPath); | |||||
| // Manifest's ClassPath: attribute always uses forward | // Manifest's ClassPath: attribute always uses forward | ||||
| // slashes '/', and is space-separated. Ant will properly | // slashes '/', and is space-separated. Ant will properly | ||||
| // format it on 72 columns with proper line continuation | // format it on 72 columns with proper line continuation | ||||
| @@ -1026,8 +1026,7 @@ public class Zip extends MatchingTask { | |||||
| * Determine a Resource's Unix mode or return the given default | * Determine a Resource's Unix mode or return the given default | ||||
| * value if not available. | * value if not available. | ||||
| */ | */ | ||||
| private int getUnixMode(final Resource r, final ZipFile zf, final int defaultMode) | |||||
| throws IOException { | |||||
| private int getUnixMode(final Resource r, final ZipFile zf, final int defaultMode) { | |||||
| int unixMode = defaultMode; | int unixMode = defaultMode; | ||||
| if (zf != null) { | if (zf != null) { | ||||
| @@ -378,8 +378,6 @@ public class Symlink extends DispatchTask { | |||||
| * | * | ||||
| * @param path A string containing the path of the symlink to delete. | * @param path A string containing the path of the symlink to delete. | ||||
| * | * | ||||
| * @throws FileNotFoundException When the path results in a | |||||
| * <code>File</code> that doesn't exist. | |||||
| * @throws IOException If calls to <code>File.rename</code> | * @throws IOException If calls to <code>File.rename</code> | ||||
| * or <code>File.delete</code> fail. | * or <code>File.delete</code> fail. | ||||
| * @deprecated use | * @deprecated use | ||||
| @@ -388,7 +386,7 @@ public class Symlink extends DispatchTask { | |||||
| */ | */ | ||||
| @Deprecated | @Deprecated | ||||
| public static void deleteSymlink(String path) | public static void deleteSymlink(String path) | ||||
| throws IOException, FileNotFoundException { | |||||
| throws IOException { | |||||
| SYMLINK_UTILS.deleteSymbolicLink(new File(path), null); | SYMLINK_UTILS.deleteSymbolicLink(new File(path), null); | ||||
| } | } | ||||
| @@ -81,7 +81,7 @@ public class UUEncoder { | |||||
| /** | /** | ||||
| * Encode a string to the output. | * Encode a string to the output. | ||||
| */ | */ | ||||
| private void encodeString(String n) throws IOException { | |||||
| private void encodeString(String n) { | |||||
| PrintStream writer = new PrintStream(out); | PrintStream writer = new PrintStream(out); | ||||
| writer.print(n); | writer.print(n); | ||||
| writer.flush(); | writer.flush(); | ||||