changeset 64:f44f0d94d282

Detect unpatched AppletViewerPanel so we fail early on plain OpenJDK. 2010-12-01 Andrew John Hughes <ahughes@redhat.com> * acinclude.m4: (IT_CHECK_FOR_APPLETVIEWERPANEL_HOLE): New check to ensure sun.applet.AppletViewerPanel is public (via the patch in IcedTea, applet_hole.patch). * configure.ac: Invoke the above macro. Don't call IT_CHECK_FOR_CLASS for the same class (the above macro handles this too). * README: Mention this limitation.
author Andrew John Hughes <ahughes@redhat.com>
date Wed, 01 Dec 2010 23:57:54 +0000
parents a3cb4fec78a9
children 6c8e9229bded
files ChangeLog README acinclude.m4 configure.ac
diffstat 4 files changed, 85 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 01 16:46:28 2010 -0500
+++ b/ChangeLog	Wed Dec 01 23:57:54 2010 +0000
@@ -1,3 +1,14 @@
+2010-12-01  Andrew John Hughes  <ahughes@redhat.com>
+
+	* acinclude.m4:
+	(IT_CHECK_FOR_APPLETVIEWERPANEL_HOLE):
+	New check to ensure sun.applet.AppletViewerPanel
+	is public (via the patch in IcedTea, applet_hole.patch).
+	* configure.ac: Invoke the above macro.  Don't call
+	IT_CHECK_FOR_CLASS for the same class (the above macro
+	handles this too).
+	* README: Mention this limitation.
+
 2010-12-01  Andrew Su  <asu@redhat.com>
 
 	* NEWS: Added controlpanel for modifying deployments.properties
--- a/README	Wed Dec 01 16:46:28 2010 -0500
+++ b/README	Wed Dec 01 23:57:54 2010 +0000
@@ -77,12 +77,17 @@
     * /usr/lib/jvm/java-gcj
     * /usr/lib/jvm/gcj-jdk
     * /usr/lib/jvm/cacao
-in the order given above.  Some currently fail.
+in the order given above.  
 
-Most targets in IcedTea create stamp files in the stamps directory to
-determine what and when dependencies were compiled.  Each target has a
-corresponding clean-x target which removes the output and the stamp
-file, allowing it to be rebuilt.
+At present, some of these options fail due to sun.* classes required
+by IcedTea-Web.  Upstream OpenJDK will only be able to compile
+IcedTea-Web if the patch applet_hole.patch from IcedTea has been
+applied.
+
+Most targets in IcedTea-Web create stamp files in the stamps directory
+to determine what and when dependencies were compiled.  Each target
+has a corresponding clean-x target which removes the output and the
+stamp file, allowing it to be rebuilt.
 
 Build Modification Options
 ==========================
--- a/acinclude.m4	Wed Dec 01 16:46:28 2010 -0500
+++ b/acinclude.m4	Wed Dec 01 23:57:54 2010 +0000
@@ -605,3 +605,65 @@
   AC_SUBST(JAVADOC_KNOWS_J_OPTIONS)
   AM_CONDITIONAL([JAVADOC_SUPPORTS_J_OPTIONS], test x"${JAVADOC_KNOWS_J_OPTIONS}" = "xyes")
 ])
+
+dnl Checks that sun.applet.AppletViewerPanel is available
+dnl and public (via the patch in IcedTea6, applet_hole.patch)
+dnl Can be removed when that is upstream or unneeded
+AC_DEFUN([IT_CHECK_FOR_APPLETVIEWERPANEL_HOLE],[
+AC_REQUIRE([IT_FIND_JAVAC])
+AC_REQUIRE([IT_FIND_JAVA])
+AC_CACHE_CHECK([if sun.applet.AppletViewerPanel is available and public], it_cv_applet_hole, [
+CLASS=TestAppletViewer.java
+BYTECODE=$(echo $CLASS|sed 's#\.java##')
+mkdir -p tmp.$$
+cd tmp.$$
+cat << \EOF > $CLASS
+[/* [#]line __oline__ "configure" */
+import java.lang.reflect.Modifier;
+
+public class TestAppletViewer
+{
+  public static void main(String[] args)
+  {
+    try
+      {
+        Class<?> clazz = Class.forName("sun.applet.AppletViewerPanel");
+        if (Modifier.isPublic(clazz.getModifiers()))
+          {
+            System.err.println("Found public sun.applet.AppletViewerPanel");
+            System.exit(0);
+          }
+        System.err.println("Found non-public sun.applet.AppletViewerPanel");
+        System.exit(2);
+      }
+    catch (ClassNotFoundException e)
+      {
+        System.err.println("Could not find sun.applet.AppletViewerPanel");
+        System.exit(1);
+      }
+  }
+}
+]
+EOF
+if $JAVAC -cp . $JAVACFLAGS -nowarn $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then
+  if $JAVA -classpath . $BYTECODE >&AS_MESSAGE_LOG_FD 2>&1; then
+      it_cv_applet_hole=yes;
+  else
+      it_cv_applet_hole=$?;
+  fi
+else
+  it_cv_applet_hole=3;
+fi
+])
+rm -f $CLASS *.class
+cd ..
+rmdir tmp.$$
+if test x"${it_cv_applet_hole}" = "x1"; then
+   AC_MSG_ERROR([sun.applet.AppletViewerPanel is not available.])
+elif test x"${it_cv_applet_hole}" = "x2"; then
+   AC_MSG_ERROR([sun.applet.AppletViewerPanel is not public.])
+elif test x"${it_cv_applet_hole}" = "x3"; then
+   AC_MSG_ERROR([Compilation failed.  See config.log.])
+fi
+AC_PROVIDE([$0])dnl
+])
--- a/configure.ac	Wed Dec 01 16:46:28 2010 -0500
+++ b/configure.ac	Wed Dec 01 23:57:54 2010 +0000
@@ -59,7 +59,7 @@
 dnl IT574 - Plugin depends on sun.misc.Ref
 dnl IT575 - Plugin depends on com.sun/jndi.toolkit.url.UrlUtil
 dnl IT576 - Plugin depends on sun.applet.AppletImageRef
-
+dnl IT578 - Remove need for patching AppletPanel for Plugin/Webstart
 IT_CHECK_FOR_CLASS(JAVA_UTIL_JAR_PACK200, [java.util.jar.Pack200])
 IT_CHECK_FOR_CLASS(JAVA_NET_COOKIEMANAGER, [java.net.CookieManager])
 IT_CHECK_FOR_CLASS(JAVA_NET_HTTPCOOKIE, [java.net.HttpCookie])
@@ -69,7 +69,6 @@
 IT_CHECK_FOR_CLASS(SUN_SECURITY_UTIL_HOSTNAMECHECKER, [sun.security.util.HostnameChecker])
 IT_CHECK_FOR_CLASS(SUN_SECURITY_X509_X500NAME, [sun.security.x509.X500Name])
 IT_CHECK_FOR_CLASS(SUN_MISC_BASE64ENCODER, [sun.misc.BASE64Encoder])
-IT_CHECK_FOR_CLASS(SUN_APPLET_APPLETVIEWERPANEL, [sun.applet.AppletViewerPanel])
 IT_CHECK_FOR_CLASS(SUN_SECURITY_VALIDATOR_VALIDATOREXCEPTION, [sun.security.validator.ValidatorException])
 IT_CHECK_FOR_CLASS(COM_SUN_NET_SSL_INTERNAL_SSL_X509EXTENDEDTRUSTMANAGER,
 	[com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager])
@@ -77,5 +76,6 @@
 IT_CHECK_FOR_CLASS(SUN_MISC_REF, [sun.misc.Ref])
 IT_CHECK_FOR_CLASS(COM_SUN_JNDI_TOOLKIT_URL_URLUTIL, [com.sun.jndi.toolkit.url.UrlUtil])
 IT_CHECK_FOR_CLASS(SUN_APPLET_APPLETIMAGEREF, [sun.applet.AppletImageRef])
+IT_CHECK_FOR_APPLETVIEWERPANEL_HOLE
 
 AC_OUTPUT