Index: java/javax/el/ImportHandler.java =================================================================== --- java/javax/el/ImportHandler.java (revision 1633722) +++ java/javax/el/ImportHandler.java (working copy) @@ -180,6 +180,10 @@ Class conflict = clazzes.get(simpleName); if (conflict != null) { + // Adding the line below + // fixes TestImportHandler.testResolveClass03() + // but breaks TestImportHandler.testImportClass03() + // clazzes.remove(simpleName); throw new ELException(Util.message(null, "importHandler.ambiguousImport", name, conflict.getName())); } Index: test/javax/el/TestImportHandler.java =================================================================== --- test/javax/el/TestImportHandler.java (revision 1633722) +++ test/javax/el/TestImportHandler.java (working copy) @@ -54,7 +54,7 @@ /** * Conflict on resolution. */ - @Test(expected=ELException.class) + @Test public void testResolveClass03() { ImportHandler handler = new ImportHandler(); @@ -61,7 +61,15 @@ handler.importPackage("org.apache.tomcat.util"); handler.importPackage("org.apache.jasper.util"); - handler.resolveClass("ExceptionUtils"); + for (int i = 1; i <= 3; i++) { + try { + Class clazz = handler.resolveClass("ExceptionUtils"); + Assert.fail("Expected ELException but got [" + clazz.getName() + + "] on iteration " + i); + } catch (ELException ex) { + // Expected + } + } } @@ -111,12 +119,20 @@ /** * Import conflicting classes */ - @Test(expected=ELException.class) + @Test public void testImportClass03() { ImportHandler handler = new ImportHandler(); handler.importClass("org.apache.tomcat.util.ExceptionUtils"); - handler.importClass("org.apache.jasper.util.ExceptionUtils"); + for (int i = 1; i <= 3; i++) { + try { + handler.importClass("org.apache.jasper.util.ExceptionUtils"); + Assert.fail("Expected ELException but got none on iteration " + + i); + } catch (ELException ex) { + // Expected + } + } } @@ -175,11 +191,19 @@ /** * Import an invalid static field - conflict. */ - @Test(expected=ELException.class) + @Test public void testImportStatic04() { ImportHandler handler = new ImportHandler(); handler.importStatic("org.apache.tomcat.util.buf.Constants.Package"); - handler.importStatic("org.apache.tomcat.util.scan.Constants.Package"); + for (int i = 1; i <= 3; i++) { + try { + handler.importStatic("org.apache.tomcat.util.scan.Constants.Package"); + Assert.fail("Expected ELException but got none on iteration " + + i); + } catch (ELException ex) { + // Expected + } + } } }