< prev index next >

src/com/sun/javatest/finder/ChameleonTestFinder.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 261                 continue;
 262 
 263             foundFile(new File(dir, name));
 264         }
 265     }
 266 
 267     private void scanFile(File file) {
 268         // see if the file matches a registered test finder, and if so
 269         // delegate to that
 270         for (int i = 0; i < entries.length; i++) {
 271             if (entries[i].matches(file)) {
 272                 currEntry = entries[i];
 273                 currEntry.scanFile(file);
 274                 return;
 275             }
 276         }
 277         // no match found
 278         currEntry = null;
 279     }
 280 
 281     private Object newInstance(Class c) throws Fault {
 282         try {
 283             return c.newInstance();
 284         }
 285         catch (InstantiationException e) {
 286             throw new Fault(i18n, "cham.cantCreateClass",
 287                             new Object[] {c.getName(), e});
 288         }
 289         catch (IllegalAccessException e) {
 290             throw new Fault(i18n, "cham.cantAccessClass",
 291                             new Object[] {c.getName(), e});
 292         }
 293     }
 294 
 295     private Class loadClass(String className) throws Fault {
 296         try {
 297             if (loader == null)
 298                 return Class.forName(className);
 299             else
 300                 return loader.loadClass(className);
 301         }
 302         catch (ClassNotFoundException e) {
 303             throw new Fault(i18n, "cham.cantFindClass",
 304                             new Object[] {className, e});
 305         }
 306         catch (IllegalArgumentException e) {
 307             throw new Fault(i18n, "cham.badClassName", className);
 308         }
 309 
 310     }
 311 
 312     private TestEnvironment getEnv() {
 313         return env;
 314     }
 315 




 261                 continue;
 262 
 263             foundFile(new File(dir, name));
 264         }
 265     }
 266 
 267     private void scanFile(File file) {
 268         // see if the file matches a registered test finder, and if so
 269         // delegate to that
 270         for (int i = 0; i < entries.length; i++) {
 271             if (entries[i].matches(file)) {
 272                 currEntry = entries[i];
 273                 currEntry.scanFile(file);
 274                 return;
 275             }
 276         }
 277         // no match found
 278         currEntry = null;
 279     }
 280 
 281     private Object newInstance(Class<?> c) throws Fault {
 282         try {
 283             return c.newInstance();
 284         }
 285         catch (InstantiationException e) {
 286             throw new Fault(i18n, "cham.cantCreateClass",
 287                             new Object[] {c.getName(), e});
 288         }
 289         catch (IllegalAccessException e) {
 290             throw new Fault(i18n, "cham.cantAccessClass",
 291                             new Object[] {c.getName(), e});
 292         }
 293     }
 294 
 295     private Class<?> loadClass(String className) throws Fault {
 296         try {
 297             if (loader == null)
 298                 return Class.forName(className);
 299             else
 300                 return loader.loadClass(className);
 301         }
 302         catch (ClassNotFoundException e) {
 303             throw new Fault(i18n, "cham.cantFindClass",
 304                             new Object[] {className, e});
 305         }
 306         catch (IllegalArgumentException e) {
 307             throw new Fault(i18n, "cham.badClassName", className);
 308         }
 309 
 310     }
 311 
 312     private TestEnvironment getEnv() {
 313         return env;
 314     }
 315 


< prev index next >