You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/06/29 03:45:28 UTC
svn commit: r417919 -
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java
Author: ndbeyer
Date: Wed Jun 28 18:45:28 2006
New Revision: 417919
URL: http://svn.apache.org/viewvc?rev=417919&view=rev
Log:
Add override, suppress warnings annotations and misc code cleanup.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java?rev=417919&r1=417918&r2=417919&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLClassLoader.java Wed Jun 28 18:45:28 2006
@@ -54,6 +54,11 @@
public class URLClassLoader extends SecureClassLoader {
private static URL[] NO_PATH = new URL[0];
+
+ @SuppressWarnings("unchecked")
+ private static <K, V> Hashtable<K, V>[] newHashtableArray(int size) {
+ return new Hashtable[size];
+ }
URL[] urls, orgUrls;
@@ -93,6 +98,7 @@
* @exception ClassNotFoundException
* If the class could not be found.
*/
+ @Override
protected synchronized Class<?> loadClass(String className,
boolean resolveClass) throws ClassNotFoundException {
SecurityManager sm = System.getSecurityManager();
@@ -177,7 +183,7 @@
URL[] newPath = new URL[urlArray.length + 1];
System.arraycopy(urlArray, 0, newPath, 0, urlArray.length);
newPath[urlArray.length] = url;
- Hashtable<String, URL[]>[] newIndexes = new Hashtable[indexes.length + 1];
+ Hashtable<String, URL[]>[] newIndexes = newHashtableArray(indexes.length + 1);
System.arraycopy(indexes, 0, newIndexes, 0, indexes.length);
indexes = newIndexes;
return newPath;
@@ -194,6 +200,7 @@
* thrown if an IO Exception occurs while attempting to
* connect
*/
+ @Override
public Enumeration<URL> findResources(final String name) throws IOException {
if (name == null) {
return null;
@@ -332,7 +339,7 @@
* @param newExtensions
* URL[] the URLs to look in for.
* @param name
- * String the ressource to look for : either a resource or a
+ * String the resource to look for : either a resource or a
* class.
* @param i
* int the index of 'indexes' array to use.
@@ -397,8 +404,7 @@
* Converts an input stream into a byte array.
*
* @return byte[] the byte array
- * @param is
- * java.io.InputStream the input stream
+ * @param is the input stream
*/
private static byte[] getBytes(InputStream is, boolean readAvailable)
throws IOException {
@@ -433,6 +439,7 @@
* @param codesource
* CodeSource
*/
+ @Override
protected PermissionCollection getPermissions(final CodeSource codesource) {
PermissionCollection pc = super.getPermissions(codesource);
URL u = codesource.getLocation();
@@ -586,7 +593,7 @@
orgUrls[i] = searchUrls[i];
}
// Search each jar for META-INF/INDEX.LIST
- indexes = new Hashtable[nbUrls];
+ indexes = newHashtableArray(nbUrls);
}
/**
@@ -601,6 +608,7 @@
* @exception java.lang.ClassNotFoundException
* if the class cannot be loaded
*/
+ @Override
protected Class<?> findClass(final String clsName)
throws ClassNotFoundException {
Class<?> cls = AccessController.doPrivileged(
@@ -647,6 +655,7 @@
* @param name
* java.lang.String the name of the requested resource
*/
+ @Override
public URL findResource(final String name) {
if (name == null) {
return null;