changeset 1952:2eb60c97dd3c

Patch the JAXWS source if getDTDType() has the wrong return type (gcj 4.3 and earlier) 2010-03-01 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: (stamps/extract.stamp): Add meta extract target to pull in both extract-openjdk and extract-jaxws. (stamps/extract-openjdk.stamp): Rename stamp file to extract-openjdk.stamp. (clean-extract-jaxws): Remove jaxws sources. 2009-11-17 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: Make use of JAXWS dependent on absence of getDTDType() bug. Add new JAXWS patch. (extract-jaxws.stamp): Apply getDTDType() patch if bug found. * acinclude.m4: (IT_GETDTDTYPE_CHECK): Check for old versions of gcj/Classpath which have javax.xml.stream.events.Attribute.getDTDType() with a return type of QName not String. * configure.ac: Invoke new IT_GETDTDTYPE_CHECK macro. * patches/icedtea-jaxws-getdtdtype.patch: New patch to work around the getDTDType() bug.
author Andrew John Hughes <ahughes@redhat.com>
date Mon, 01 Mar 2010 14:31:42 +0000
parents 917e99004afb
children 3f0dcd8de43f
files ChangeLog Makefile.am acinclude.m4 configure.ac patches/ecj/icedtea-jaxws-getdtdtype.patch
diffstat 5 files changed, 180 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 01 13:51:34 2010 +0000
+++ b/ChangeLog	Mon Mar 01 14:31:42 2010 +0000
@@ -1,3 +1,29 @@
+2010-03-01  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am:
+	(stamps/extract.stamp): Add meta extract target
+	to pull in both extract-openjdk and extract-jaxws.
+	(stamps/extract-openjdk.stamp): Rename stamp file
+	to extract-openjdk.stamp.
+	(clean-extract-jaxws): Remove jaxws sources.
+
+2009-11-17  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am:
+	Make use of JAXWS dependent on absence of
+	getDTDType() bug.  Add new JAXWS patch.
+	(extract-jaxws.stamp): Apply getDTDType() patch
+	if bug found.
+	* acinclude.m4:
+	(IT_GETDTDTYPE_CHECK): Check for old versions of
+	gcj/Classpath which have
+	javax.xml.stream.events.Attribute.getDTDType()
+	with a return type of QName not String.
+	* configure.ac:
+	Invoke new IT_GETDTDTYPE_CHECK macro.
+	* patches/icedtea-jaxws-getdtdtype.patch:
+	New patch to work around the getDTDType() bug.
+
 2010-03-01  Andrew John Hughes  <ahughes@redhat.com>
 
 	* patches/ecj/icedtea.patch: Don't add tools.jar
--- a/Makefile.am	Mon Mar 01 13:51:34 2010 +0000
+++ b/Makefile.am	Mon Mar 01 14:31:42 2010 +0000
@@ -61,10 +61,13 @@
 LANGTOOLS = openjdk/langtools/src/share/classes
 JAXP = openjdk/jaxp/src/share/classes
 CORBA = openjdk/corba/src/share/classes
-JAXWS = openjdk/jaxws/src/share/classes
 
 # FIXME (netx): NetX source directories go here
 
+if DTDTYPE_QNAME
+NEED_JAXWS_SRC = true
+endif
+
 OPENJDK_SOURCEPATH_DIRS = \
         $(SHARE):$(SOLARIS):$(LANGTOOLS):$(CORBA)
 
@@ -383,6 +386,10 @@
 	patches/ecj/icedtea-jaxp-dependency.patch \
 	patches/ecj/bootver.patch
 
+# Patches for JAXWS
+
+JAXWS_PATCHES = patches/ecj/icedtea-jaxws-getdtdtype.patch
+
 # OpenJDK build environment.
 if ZERO_BUILD
   ICEDTEA_ZERO_BUILD = true
@@ -894,7 +901,15 @@
 endif
 
 #FIXME (meta): Split into multiple targets
-stamps/extract.stamp: stamps/download.stamp
+stamps/extract.stamp: stamps/extract-openjdk.stamp \
+ stamps/extract-jaxws.stamp
+	mkdir -p stamps
+	touch $@
+
+clean-extract: clean-extract-jaxws
+	rm -f stamps/extract.stamp
+
+stamps/extract-openjdk.stamp: stamps/download.stamp
 if OPENJDK_SRC_DIR_FOUND
 	cp -a $(OPENJDK_SRC_DIR) openjdk
 else
@@ -949,10 +964,58 @@
 	    -o -type d -exec chmod 750 '{}' ';'; \
 	fi
 	mkdir -p stamps
-	touch stamps/extract.stamp
+	touch stamps/extract-openjdk.stamp
+
 
-clean-extract:
-	rm -f stamps/extract.stamp
+stamps/extract-jaxws.stamp: stamps/extract-openjdk.stamp \
+  stamps/download-jaxws-drop.stamp stamps/download-jaf-drop.stamp
+	if test "x$(NEED_JAXWS_SRC)" = "xtrue"; then \
+	  (cd openjdk/jaxws ; \
+	   $(ANT) -Ddrops.dir=$(abs_top_builddir)/drops \
+	   -Doutput.dir=$(BUILD_OUTPUT_DIR)/jaxws \
+	   source ; \
+	   cd $(abs_top_builddir)) ; \
+	fi
+if DTDTYPE_QNAME
+	(cd $(BUILD_OUTPUT_DIR)/jaxws; \
+	 all_patches_ok=yes; \
+	 for p in $(JAXWS_PATCHES) ; \
+	 do \
+	   if test x$${all_patches_ok} = "xyes" \
+	     && echo Checking $$p \
+	     && $(PATCH) -l -p0 --dry-run -s -t -f \
+	       -F 0 < $(abs_top_srcdir)/$$p ; \
+	   then \
+	    echo Applying $$p ; \
+	    $(PATCH) -l -p0 < $(abs_top_srcdir)/$$p ; \
+	    if ! grep "^\* $$(basename $$p)" $(abs_top_srcdir)/HACKING \
+	      >> stamps/extract-jaxws.stamp.tmp ; \
+	    then \
+	      echo "* $$(basename $$p): UNDOCUMENTED" \
+	        >> stamps/extract-jaxws.stamp.tmp ; \
+	    fi ; \
+	   else \
+	     test x$${all_patches_ok} = "xyes" && all_patches_ok=$$p ; \
+	   fi ; \
+	 done ; \
+	 if ! test x$${all_patches_ok} = "xyes"; then \
+	   echo ERROR patch $${all_patches_ok} FAILED! ; \
+	   echo WARNING make clean-extract-jaxws before retrying a fix ; \
+	   exit 2; \
+	 fi ; \
+	 cd $(abs_top_builddir)) ;
+endif
+	mkdir -p stamps
+	touch $@
+
+clean-extract-jaxws:
+	if [ -d $(BUILD_OUTPUT_DIR)/jaxws ] ; then \
+	  (cd openjdk/jaxws ; \
+	   $(ANT) -Doutput.dir=$(BUILD_OUTPUT_DIR)/jaxws clobber ; \
+	   cd ../../); \
+        fi
+	mkdir -p stamps
+	rm -f stamps/extract-jaxws.stamp
 
 stamps/replace-hotspot.stamp: stamps/extract.stamp
 if WITH_ALT_HSBUILD
--- a/acinclude.m4	Mon Mar 01 13:51:34 2010 +0000
+++ b/acinclude.m4	Mon Mar 01 14:31:42 2010 +0000
@@ -1244,6 +1244,80 @@
   AC_PROVIDE([$0])dnl
 ])
 
+AC_DEFUN([IT_GETDTDTYPE_CHECK],[
+  AC_CACHE_CHECK([if javax.xml.stream.events.Attribute.getDTDType() wrongly returns a QName], it_cv_dtdtype, [
+  CLASS=Test.java
+  BYTECODE=$(echo $CLASS|sed 's#\.java##')
+  mkdir tmp.$$
+  cd tmp.$$
+  cat << \EOF > $CLASS
+[/* [#]line __oline__ "configure" */
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+
+import java.lang.reflect.Method;
+
+public class Test
+    implements Attribute
+{
+    // This method will not qualify if using an
+    // old version of Classpath where it returns
+    // a QName.
+    public String getDTDType() { return "Boom"; }
+
+    // Other Attribute methods
+    public QName getName() { return null; }
+    public String getValue() { return "Bang"; }
+    public boolean isSpecified() { return false; }
+
+    // XMLEvent methods
+    public Characters asCharacters() { return null; }
+    public EndElement asEndElement() { return null; }
+    public StartElement asStartElement() { return null; }
+    public int getEventType() { return 42; }
+    public Location getLocation() { return null; }
+    public QName getSchemaType() { return null; }
+    public boolean isAttribute() { return true; }
+    public boolean isCharacters() { return false; }
+    public boolean isEndDocument() { return false; }
+    public boolean isEndElement() { return false; }
+    public boolean isEntityReference() { return false; }
+    public boolean isNamespace() { return false; }
+    public boolean isProcessingInstruction() { return false; }
+    public boolean isStartDocument() { return false; }
+    public boolean isStartElement() { return false; }
+    public void writeAsEncodedUnicode(java.io.Writer w) {}
+
+    public static void main(String[] args)
+    {
+        for (Method m : Attribute.class.getMethods())
+            if (m.getName().equals("getDTDType"))
+                if (m.getReturnType().equals(QName.class))
+                    System.exit(1);
+    }
+}]
+EOF
+  if $JAVAC -cp . $JAVACFLAGS -source 5 $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then
+    if $JAVA -classpath . $BYTECODE >&AS_MESSAGE_LOG_FD 2>&1; then
+      it_cv_dtdtype=no;
+    else
+      it_cv_dtdtype=yes;
+    fi
+  else
+    it_cv_dtdtype=yes;
+  fi
+  rm -f $CLASS *.class
+  cd ..
+  rmdir tmp.$$
+  ])
+AM_CONDITIONAL([DTDTYPE_QNAME], test x"${it_cv_dtdtype}" = "xyes")
+AC_PROVIDE([$0])dnl
+])
+
 # Provides the option --with-parallel-jobs
 #  * --with-parallel-jobs; use jobs=processors + 1
 #  * --with-parallel-jobs=x; use jobs=x
--- a/configure.ac	Mon Mar 01 13:51:34 2010 +0000
+++ b/configure.ac	Mon Mar 01 14:31:42 2010 +0000
@@ -204,6 +204,7 @@
 AC_CHECK_WITH_HG_REVISION
 AC_CHECK_WITH_TZDATA_DIR
 IT_CHECK_FOR_CLASS([SUN_AWT_TOOLKIT], [sun.awt.SunToolkit])
+IT_GETDTDTYPE_CHECK
 IT_CHECK_XULRUNNER_VERSION
 
 if test "x${enable_visualvm}" = "xyes"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/ecj/icedtea-jaxws-getdtdtype.patch	Mon Mar 01 14:31:42 2010 +0000
@@ -0,0 +1,11 @@
+--- openjdk-ecj.orig/build/linux-amd64/jaxws/drop/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXEventConnector.java	2009-11-17 16:37:06.000000000 +0000
++++ openjdk-ecj/build/linux-amd64/jaxws/drop/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXEventConnector.java	2009-11-17 16:38:00.000000000 +0000
+@@ -276,7 +276,7 @@
+                 qName = localName;
+             else
+                 qName = prefix + ':' + localName;
+-            String type = staxAttr.getDTDType();
++            String type = staxAttr.getDTDType().toString();
+             String value = staxAttr.getValue();
+ 
+             attrs.addAttribute(uri, localName, qName, type, value);