Index: java/lang/Class.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v retrieving revision 1.13 diff -u -b -B -r1.13 Class.java --- java/lang/Class.java 25 Jan 2004 14:49:00 -0000 1.13 +++ java/lang/Class.java 25 Jan 2004 15:03:14 -0000 @@ -462,7 +462,7 @@ * checkMemberAccess(this, Member.DECLARED) as well as * checkPackageAccess both having to succeed. * - * @param name the name of the method + * @param methodName the name of the method * @param types the type of each parameter * @return the method * @throws NoSuchMethodException if the method does not exist @@ -470,14 +470,14 @@ * @see #getDeclaredMethods() * @since 1.1 */ - public Method getDeclaredMethod(String name, Class[] args) + public Method getDeclaredMethod(String methodName, Class[] args) throws NoSuchMethodException { memberAccessCheck(Member.DECLARED); - Method match = matchMethod(getDeclaredMethods(false), name, args); - if (match != null) + Method match = matchMethod(getDeclaredMethods(false), methodName, args); + if (match == null) + throw new NoSuchMethodException(methodName); return match; - throw new NoSuchMethodException(); } /** @@ -527,20 +527,21 @@ * checkMemberAccess(this, Member.PUBLIC) as well as * checkPackageAccess both having to succeed. * - * @param name the name of the field + * @param fieldName the name of the field * @return the field * @throws NoSuchFieldException if the field does not exist * @throws SecurityException if the security check fails * @see #getFields() * @since 1.1 */ - public Field getField(String name) throws NoSuchFieldException + public Field getField(String fieldName) + throws NoSuchFieldException { memberAccessCheck(Member.PUBLIC); - Field field = internalGetField(name); - if(field != null) + Field field = internalGetField(fieldName); + if (field == null) + throw new NoSuchFieldException(fieldName); return field; - throw new NoSuchFieldException(); } /** @@ -873,20 +874,18 @@ *

The URL returned is system- and classloader-dependent, and could * change across implementations. * - * @param name the name of the resource, generally a path + * @param resourceName the name of the resource, generally a path * @return the URL to the resource * @throws NullPointerException if name is null * @since 1.1 */ - public URL getResource(String name) + public URL getResource(String resourceName) { - if(name.length() > 0 && name.charAt(0) != '/') - name = getPackagePortion(getName()).replace('.','/') - + "/" + name; - ClassLoader c = getClassLoader(); - if (c == null) + String name = resourcePath(resourceName); + ClassLoader loader = getClassLoader(); + if (loader == null) return ClassLoader.getSystemResource(name); - return c.getResource(name); + return loader.getResource(name); } /** @@ -903,20 +902,26 @@ *

The URL returned is system- and classloader-dependent, and could * change across implementations. * - * @param name the name of the resource, generally a path + * @param resourceName the name of the resource, generally a path * @return an InputStream with the contents of the resource in it, or null * @throws NullPointerException if name is null * @since 1.1 */ - public InputStream getResourceAsStream(String name) + public InputStream getResourceAsStream(String resourceName) { - if (name.length() > 0 && name.charAt(0) != '/') - name = getPackagePortion(getName()).replace('.','/') - + "/" + name; - ClassLoader c = getClassLoader(); - if (c == null) + String name = resourcePath(resourceName); + ClassLoader loader = getClassLoader(); + if (loader == null) return ClassLoader.getSystemResourceAsStream(name); - return c.getResourceAsStream(name); + return loader.getResourceAsStream(name); + } + + private String resourcePath(String resourceName) + { + if (resourceName.length() > 0 && resourceName.charAt(0) != '/') + resourceName = getPackagePortion(getName()).replace('.','/') + + "/" + resourceName; + return resourceName; } /**