[rfc][icedtea-web] Reproducer for PR920

Jiri Vanek jvanek at redhat.com
Tue Aug 28 10:45:52 PDT 2012


On 08/28/2012 05:56 PM, Adam Domurad wrote:
....
>> >
>> >  I must say I do not like this concept. Unless I'm wrong it is creating jars and classes in sources
>> >  dirs. Then during clean it can cause accidentally loses of sources :(. My advice here will be to do
>> >  the build in temp, then mv to deployditr or werever and then just delete in deploy dir.  And then in
>> >  clean .. with some luck probably nothing?
>> >
>> >  Or at least to work wiht absolute paths so it will be clear where the work is happening.
>> >
>> >  What do you think?
>> >
>> >  If you want, push it as it is, but if you agree with me at least a bit, by push later you can fix
>> >  this one and your last one perhaps??
>> >
>> >  J.
>
> I have updated the reproducer accordingly.
>
> Thanks!
> - Adam
>
>
> reproducer-extendsoutside3.patch
>
>
> diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/README b/tests/reproducers/custom/AppletExtendsFromOutsideJar/README
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/custom/AppletExtendsFromOutsideJar/README
> @@ -0,0 +1,2 @@
> +This reproducer encapsulates 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.
> diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/resources/AppletExtendsFromOutsideJar.html b/tests/reproducers/custom/AppletExtendsFromOutsideJar/resources/AppletExtendsFromOutsideJar.html
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/custom/AppletExtendsFromOutsideJar/resources/AppletExtendsFromOutsideJar.html
> @@ -0,0 +1,45 @@
> +<!--
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 2, or (at your option)
> +any later version.
> +
> +IcedTea is distributed in the hope that it will be useful, but
> +WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to the
> +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +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>
> 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,43 @@
> +/*
> +Copyright (C) 2012 Red Hat, Inc.
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or
> +modify it under the terms of the GNU General Public License as published by
> +the Free Software Foundation, version 2.
> +
> +IcedTea is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to
> +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> + */
> +
> +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,47 @@
> +/*
> +Copyright (C) 2012 Red Hat, Inc.
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or
> +modify it under the terms of the GNU General Public License as published by
> +the Free Software Foundation, version 2.
> +
> +IcedTea is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to
> +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> + */
> +
> +import javax.swing.JApplet;
> +
> +public class AppletReferenceOutOfJar extends AppletReferenceInSameJar {
> +
> +	Referenced outOfJarReference = new Referenced();
> +
> +	public void init() {
> +		System.out.println("My simple applet is running.");
> +	}
> +}
> diff --git a/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Makefile b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Makefile
> new file mode 100644
> --- /dev/null
> +++ b/tests/reproducers/custom/AppletExtendsFromOutsideJar/srcs/Makefile
> @@ -0,0 +1,27 @@
> +TESTNAME=AppletExtendsFromOutsideJar
> +
> +SRC_FILES=AppletReferenceInSameJar.java AppletReferenceOutOfJar.java Referenced.java
> +JAR_FILES=AppletReferenceInSameJar.class Referenced.class
> +OUTER_FILE=AppletReferenceOutOfJar.class
> +
> +JAVAC_CLASSPATH=$(JNLP_TESTS_ENGINE_DIR):$(NETX_DIR)/lib/classes.jar
> +JAVAC=$(BOOT_DIR)/bin/javac
> +JAR=$(BOOT_DIR)/bin/jar
> +
> +TMPDIR:=$(shell mktemp -d)
> +
> +prepare-reproducer:
> +	echo PREPARING REPRODUCER $(TESTNAME) in $(TMPDIR)
> +	
> +	$(JAVAC) -d $(TMPDIR) -classpath $(JAVAC_CLASSPATH) $(SRC_FILES)
> +	
> +	cd $(TMPDIR); \
> +	$(JAR) cvf $(TESTNAME).jar $(JAR_FILES); \
> +	mv $(OUTER_FILE) $(JNLP_TESTS_SERVER_DEPLOYDIR); \
> +	mv $(TESTNAME).jar $(JNLP_TESTS_SERVER_DEPLOYDIR);
> +	
> +	echo PREPARED REPRODUCER $(TESTNAME), removing $(TMPDIR)
> +	rm -rf $(TMPDIR)
> +
> +clean-reproducer:
> +	echo NOTHING TO CLEAN FOR $(TESTNAME)
> \ No newline at end of file
> 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,40 @@
> +/*
> +Copyright (C) 2012 Red Hat, Inc.
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or
> +modify it under the terms of the GNU General Public License as published by
> +the Free Software Foundation, version 2.
> +
> +IcedTea is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to
> +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> + */
> +
> +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
> +++ b/tests/reproducers/custom/AppletExtendsFromOutsideJar/testcases/AppletExtendsFromOutsideJarTests.java
> @@ -0,0 +1,63 @@
> +/* AppletExtendsFromOutsideJarTests.java
> +Copyright (C) 2011 Red Hat, Inc.
> +
> +This file is part of IcedTea.
> +
> +IcedTea is free software; you can redistribute it and/or
> +modify it under the terms of the GNU General Public License as published by
> +the Free Software Foundation, version 2.
> +
> +IcedTea is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with IcedTea; see the file COPYING.  If not, write to
> +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +02110-1301 USA.
> +
> +Linking this library statically or dynamically with other modules is
> +making a combined work based on this library.  Thus, the terms and
> +conditions of the GNU General Public License cover the whole
> +combination.
> +
> +As a special exception, the copyright holders of this library give you
> +permission to link this library with independent modules to produce an
> +executable, regardless of the license terms of these independent
> +modules, and to copy and distribute the resulting executable under
> +terms of your choice, provided that you also meet, for each linked
> +independent module, the terms and conditions of the license of that
> +module.  An independent module is a module which is not derived from
> +or based on this library.  If you modify this library, you may extend
> +this exception to your version of the library, but you are not
> +obligated to do so.  If you do not wish to do so, delete this
> +exception statement from your version.
> + */
> +
> +import net.sourceforge.jnlp.ProcessResult;
> +import net.sourceforge.jnlp.annotations.Bug;
> +import net.sourceforge.jnlp.annotations.NeedsDisplay;
> +import net.sourceforge.jnlp.annotations.TestInBrowsers;
> +import net.sourceforge.jnlp.browsertesting.BrowserTest;
> +import net.sourceforge.jnlp.browsertesting.Browsers;
> +
> +import org.junit.Assert;
> +import org.junit.Test;
> +
> +public class AppletExtendsFromOutsideJarTests extends BrowserTest {
> +
> +    private static final String LINKAGE_ERROR_OCCURRENCE = "java.lang.LinkageError: ";
> +    private static final String APPLET_RUNNING = "My simple applet is running.";
> +
> +    @NeedsDisplay
> +    @Test
> +    @TestInBrowsers(testIn = { Browsers.one })
> +    @Bug(id = "PR920")
> +    public void testClassInAppletFolder() throws Exception {
> +        ProcessResult pr = server.executeBrowser("/AppletExtendsFromOutsideJar.html");
> +
> +        Assert.assertFalse("Linkage error should not occur but did!", pr.stderr.contains(LINKAGE_ERROR_OCCURRENCE));
> +        Assert.assertTrue("Expected '" + APPLET_RUNNING + "', stdout was: " + pr.stdout, pr.stdout.contains(APPLET_RUNNING));
> +    }
> +}

yp, goon. Thanx!



More information about the distro-pkg-dev mailing list