https://issues.apache.org/bugzilla/show_bug.cgi?id=57113
Bug ID: 57113 Summary: ImportHandler not returning class properly from resolveClass() Product: Tomcat 8 Version: trunk Hardware: PC Status: NEW Severity: normal Priority: P2 Component: EL Assignee: dev@tomcat.apache.org Reporter: artfied...@gmail.com Typically the importHandler.resolveClass(String) function is used something like... result = ctx.getImportHandler().resolveClass("MyClass"); if (result != null) return result; However the current functionality will fail (before classes are cached) if MyClass is in package "com.test" and "org.apache" is imported after com.test is... eg. ctx.getImportHandler().importPackage("com.test"); ctx.getImportHandler().importPackage("org.apache"); Object result = ctx.getImportHandler().resolveClass("MyClass"); At this point result is null the first time ran through, because resolveClass loops through all packages finding the className in each package before it returns the temp variable its been using... which when it comes to org.apache.MyClass it will be null, when com.test.MyClass was actually found... but method returns null. I would think the expected result should be to return the first matching class. To continue its current logic for multi match detection, it can be modified to save the first match and return that variable... Like so. public java.lang.Class<?> resolveClass(String name) { Class<?> result = clazzes.get(name); if (result == null) { // Search the package imports - note there may be multiple matches // (which correctly triggers an error) for (String p : packages) { String className = p + '.' + name; Class<?> tmpClass = findClass(className, true); if (result == null && tmpClass != null) { result = tmpClass; } } } return result; } -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org