[rfc][icedtea-web] Reproducer for PR920

Adam Domurad adomurad at redhat.com
Tue Aug 14 08:30:25 PDT 2012


On Tue, 2012-08-14 at 15:16 +0200, Jiri Vanek wrote:
> On 07/06/2012 08:19 PM, Adam Domurad wrote:
> > This reproducer encapsulates the problem behind PR920.
> > A LinkageError occurs, complaining of duplicate class definition, when
> > an extended class outside of a jar references a common class with its
> > parent class. The common class attempts to load twice.
> Thank you for this test, two nitpicks  below.
> >
> >
> > 2012-07-06  Adam Domurad<adomurad at redhat.com>
> >
> > 	Reproduces problem behind PR920, class is in a jar is loaded twice when
> > 	used by both a class within the jar, and also used by a class outside
> > 	the jar extending that class.
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/README:
> > 	Describes test
> > 	*
> > tests/reproducers/custom/AppletExtendsFromOutsideJar/resources/AppletExtendsFromOutsideJar.html:
> > 	Runs applet with main class outside jar
> > 	* A
> > tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceInSameJar.java:
> > 	References class Referenced inside same jar
> > 	*
> > tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceOutOfJar.java:
> > 	References class Referenced outside the jar
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Makefile:
> > 	Packages Reference, AppletReferenceInSameJar into a jar,
> > 	AppletReferenceOutOfJar outside it
> > 	*
> > tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Referenced.java:
> > 	Class that is referenced twice, loaded twice in failing behaviour
> > 	*
> > tests/reproducers/custom/AppletExtendsFromOutsideJar/testcases/AppletExtendsFromOutsideJarTests.java:
> > 	Drives AppletExtendsFromOutsideJar.html
> >
> >
> ...
> > +obligated to do so.  If you do not wish to do so, delete this
> > +exception statement from your version.
> > +
> > + -->
> > +<!-- Runs a jar located in a .class file from the same folder, that uses a class in a .jar file -->
> > +<html><head></head><body bgcolor="red">
> > +<p>
> > +<applet code="AppletReferenceOutOfJar.class" archive="AppletExtendsFromOutsideJar.jar" codebase="." width="100" height="100">
> > +</applet>
> > +</p>
> > +</body>
> > +</html>
> 
> Just clarification for me. How does $(OUTER_FILE) got to runtime classpath. It is searched in codebase, does it?
It exists as a class in the same folder (the deployment folder), and is
thus part of the codebase and the classpath. 
> > diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceInSameJar.java b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceInSameJar.java
> > new file mode 100644
> > --- /dev/null
> > +++ b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceInSameJar.java
> > @@ -0,0 +1,5 @@
> > +import javax.swing.JApplet;
> > +
> > +public class AppletReferenceInSameJar extends JApplet {
> > +	Referenced sameJarReference = new Referenced();
> > +}
> > diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceOutOfJar.java b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceOutOfJar.java
> > new file mode 100644
> > --- /dev/null
> > +++ b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceOutOfJar.java
> > @@ -0,0 +1,13 @@
> > +import javax.swing.JApplet;
> > +
> > +public class AppletReferenceOutOfJar extends AppletReferenceInSameJar {
> > +
> > +	Referenced outOfJarReference = new Referenced();
> > +
> > +	public void init() {
> > +		System.out.println("My simple applet is running.");
> > +	}
> > +
> > +	public AppletReferenceOutOfJar() {
> > +	}
> > +}
> > diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Makefile b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Makefile
> > new file mode 100644
> > --- /dev/null
> ...
> > +	rm -f $(JAR_FILES)
> > +	rm -f $(TESTNAME).jar
> > +	echo CLEANED REPRODUCER $(TESTNAME)
> > +
> > diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Referenced.java b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Referenced.java
> > new file mode 100644
> > --- /dev/null
> > +++ b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Referenced.java
> > @@ -0,0 +1,3 @@
> > +public class Referenced {
> > +
> > +}
> > diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/testcases/AppletExtendsFromOutsideJarTests.java b/tests/reproducers/custom/AppletExtendsFromOutsideJar/testcases/AppletExtendsFromOutsideJarTests.java
> > new file mode 100644
> > --- /dev/null
> ...
> > +
> > +    @NeedsDisplay
> > +    @Test
> > +    @TestInBrowsers(testIn={Browsers.one})
> > +    @Bug(id="PR920")
> > +    public void testClassInAppletFolder() throws Exception {
> > +        ProcessResult pr = server.executeBrowser("/AppletExtendsFromOutsideJar.html");
> > +
> > +        String s0 = "My simple applet is running.";
> > +        Assert.assertTrue("Expected '"+s0+"', stdout was: " + pr.stdout, pr.stdout.contains(s0));
> 
> I would like to test also for not-occurence of java.lang.LinkageError.
Added
> 
> Nice reproducer anyway, it took me a while to find what is from where :)
> 
> J.
> 
> > +    }
> > +}
> >
> >
> > ChangeLog
> >
> >
> > 2012-07-06  Adam Domurad<adomurad at redhat.com>
> >
> > 	Reproduces problem behind PR920, class is in a jar is loaded twice when
> > 	used by both a class within the jar, and also used by a class outside
> > 	the jar extending that class.
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/README:
> > 	Describes test
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/resources/AppletExtendsFromOutsideJar.html:
> > 	Runs applet with main class outside jar
> > 	* A tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceInSameJar.java:
> > 	References class Referenced inside same jar
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/AppletReferenceOutOfJar.java:
> > 	References class Referenced outside the jar
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Makefile:
> > 	Packages Reference, AppletReferenceInSameJar into a jar,
> > 	AppletReferenceOutOfJar outside it
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Referenced.java:
> > 	Class that is referenced twice, loaded twice in failing behaviour
> > 	* tests/reproducers/custom/AppletExtendsFromOutsideJar/testcases/AppletExtendsFromOutsideJarTests.java:
> > 	Drives AppletExtendsFromOutsideJar.html
> >
> 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: reproducer-extendsoutside2.patch
Type: text/x-patch
Size: 8601 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120814/ca1a8334/reproducer-extendsoutside2.patch 


More information about the distro-pkg-dev mailing list