ASF Bugzilla – Attachment 32139 Details for
Bug 57132
ImportHandler.resolveClass() fails to report conflicting import when called repeatedly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
2014-10-22_tc8_57132_testcases.patch
2014-10-22_tc8_57132_testcases.patch (text/plain), 3.13 KB, created by
Konstantin Kolinko
on 2014-10-22 22:10:21 UTC
(
hide
)
Description:
2014-10-22_tc8_57132_testcases.patch
Filename:
MIME Type:
Creator:
Konstantin Kolinko
Created:
2014-10-22 22:10:21 UTC
Size:
3.13 KB
patch
obsolete
>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 >+ } >+ } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 57132
: 32139