changeset 1078:6790b974078e

2008-10-09 Matthias Klose <doko@ubuntu.com> * patches/icedtea-6open-6616825.patch: New. * patches/icedtea-6open-6651382.patch: New. * patches/icedtea-6open-6756202.patch: New. * Makefile.am: Apply patches.
author doko@ubuntu.com
date Thu, 09 Oct 2008 13:35:37 +0200
parents 86fbcf148d1f
children fa94fa7ac782
files ChangeLog Makefile.am patches/icedtea-6open-6616825.patch patches/icedtea-6open-6651382.patch patches/icedtea-6open-6756202.patch
diffstat 5 files changed, 440 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Oct 08 17:00:19 2008 -0400
+++ b/ChangeLog	Thu Oct 09 13:35:37 2008 +0200
@@ -1,3 +1,10 @@
+2008-10-09  Matthias Klose  <doko@ubuntu.com>
+
+	* patches/icedtea-6open-6616825.patch: New.
+	* patches/icedtea-6open-6651382.patch: New.
+	* patches/icedtea-6open-6756202.patch: New.
+	* Makefile.am: Apply patches.
+
 2008-10-08  Deepak Bhole <dbhole@redhat.com>
 	* IcedTeaPlugin.cc: Implemented JS->Java security.
 	* plugin/icedtea/sun/applet/AppletSecurityContextManager.java: Same.
--- a/Makefile.am	Wed Oct 08 17:00:19 2008 -0400
+++ b/Makefile.am	Thu Oct 09 13:35:37 2008 +0200
@@ -504,6 +504,9 @@
 	patches/icedtea-arch.patch \
 	patches/icedtea-lc_ctype.patch \
 	patches/icedtea-messageutils.patch \
+	patches/icedtea-6open-6616825.patch \
+	patches/icedtea-6open-6651382.patch \
+	patches/icedtea-6open-6756202.patch \
 	$(VISUALVM_PATCH)
 
 if WITH_RHINO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-6open-6616825.patch	Thu Oct 09 13:35:37 2008 +0200
@@ -0,0 +1,294 @@
+--- openjdk/jdk/src/share/classes/javax/management/ObjectName.java	Wed Oct  8 06:07:09 2008
++++ openjdk/jdk/src/share/classes/javax/management/ObjectName.java	Wed Oct  8 06:07:09 2008
+@@ -37,9 +37,6 @@
+ import java.util.HashMap;
+ import java.util.Hashtable;
+ import java.util.Map;
+-import javax.management.MBeanServer;
+-import javax.management.MalformedObjectNameException;
+-import javax.management.QueryExp;
+ 
+ /**
+  * <p>Represents the object name of an MBean, or a pattern that can
+@@ -1159,9 +1156,19 @@
+             //
+             //in.defaultReadObject();
+             final ObjectInputStream.GetField fields = in.readFields();
++            String propListString =
++                    (String)fields.get("propertyListString", "");
++
++            // 6616825: take care of property patterns
++            final boolean propPattern =
++                    fields.get("propertyPattern" , false);
++            if (propPattern) {
++                propListString =
++                        (propListString.length()==0?"*":(propListString+",*"));
++            }
++
+             cn = (String)fields.get("domain", "default")+
+-                ":"+
+-                (String)fields.get("propertyListString", "");
++                ":"+ propListString;
+         } else {
+             // Read an object serialized in the new serial form
+             //
+@@ -1795,6 +1802,7 @@
+      * @return True if <code>object</code> is an ObjectName whose
+      * canonical form is equal to that of this ObjectName.
+      */
++    @Override
+     public boolean equals(Object object)  {
+ 
+         // same object case
+@@ -1818,6 +1826,7 @@
+      * Returns a hash code for this object name.
+      *
+      */
++    @Override
+     public int hashCode() {
+         return _canonicalName.hashCode();
+     }
+--- openjdk/jdk/test/javax/management/ObjectName/SerialCompatTest.java	Wed Oct  8 06:07:12 2008
++++ openjdk/jdk/test/javax/management/ObjectName/SerialCompatTest.java	Wed Oct  8 06:07:12 2008
+@@ -23,9 +23,9 @@
+ 
+ /*
+  * @test
+- * @bug 6211220
++ * @bug 6211220 6616825
+  * @summary Test that jmx.serial.form=1.0 works for ObjectName
+- * @author Eamonn McManus
++ * @author Eamonn McManus, Daniel Fuchs
+  * @run clean SerialCompatTest
+  * @run build SerialCompatTest
+  * @run main/othervm SerialCompatTest
+@@ -36,20 +36,8 @@
+ import javax.management.ObjectName;
+ 
+ public class SerialCompatTest {
+-    public static void main(String[] args) throws Exception {
+-        System.setProperty("jmx.serial.form", "1.0");
++    public static void check6211220() throws Exception {
+ 
+-        /* Check that we really are in jmx.serial.form=1.0 mode.
+-           The property is frozen the first time the ObjectName class
+-           is referenced so checking that it is set to the correct
+-           value now is not enough.  */
+-        ObjectStreamClass osc = ObjectStreamClass.lookup(ObjectName.class);
+-        if (osc.getFields().length != 6) {
+-            throw new Exception("Not using old serial form: fields: " +
+-                                Arrays.asList(osc.getFields()));
+-            // new serial form has no fields, uses writeObject
+-        }
+-
+         ObjectName on = new ObjectName("a:b=c");
+         ByteArrayOutputStream bos = new ByteArrayOutputStream();
+         ObjectOutputStream oos = new ObjectOutputStream(bos);
+@@ -62,53 +50,192 @@
+ 
+         // if the bug is present, these will get NullPointerException
+         for (int i = 0; i <= 11; i++) {
++            String msg = "6211220 case("+i+")";
+             try {
+                 switch (i) {
+                 case 0:
+-                    check(on1.getDomain().equals("a")); break;
++                    check(msg, on1.getDomain().equals("a")); break;
+                 case 1:
+-                    check(on1.getCanonicalName().equals("a:b=c")); break;
++                    check(msg, on1.getCanonicalName().equals("a:b=c")); break;
+                 case 2:
+-                    check(on1.getKeyPropertyListString().equals("b=c")); break;
++                    check(msg, on1.getKeyPropertyListString().equals("b=c"));
++                    break;
+                 case 3:
+-                    check(on1.getCanonicalKeyPropertyListString().equals("b=c"));
++                    check(msg, on1.getCanonicalKeyPropertyListString()
++                            .equals("b=c"));
+                     break;
+                 case 4:
+-                    check(on1.getKeyProperty("b").equals("c")); break;
++                    check(msg, on1.getKeyProperty("b").equals("c")); break;
+                 case 5:
+-                    check(on1.getKeyPropertyList()
++                    check(msg, on1.getKeyPropertyList()
+                           .equals(Collections.singletonMap("b", "c"))); break;
+                 case 6:
+-                    check(!on1.isDomainPattern()); break;
++                    check(msg, !on1.isDomainPattern()); break;
+                 case 7:
+-                    check(!on1.isPattern()); break;
++                    check(msg, !on1.isPattern()); break;
+                 case 8:
+-                    check(!on1.isPropertyPattern()); break;
++                    check(msg, !on1.isPropertyPattern()); break;
+                 case 9:
+-                    check(on1.equals(on)); break;
++                    check(msg, on1.equals(on)); break;
+                 case 10:
+-                    check(on.equals(on1)); break;
++                    check(msg, on.equals(on1)); break;
+                 case 11:
+-                    check(on1.apply(on)); break;
++                    check(msg, on1.apply(on)); break;
+                 default:
++                    throw new Exception(msg+": Test incorrect");
++                }
++            } catch (Exception e) {
++                System.out.println(msg+": Test failed with exception:");
++                e.printStackTrace(System.out);
++                failed = true;
++            }
++        }
++
++        if (failed)
++            throw new Exception("Some tests for 6211220 failed");
++        else
++            System.out.println("All tests for 6211220 passed");
++    }
++
++    static void checkName(String testname, ObjectName on)
++        throws Exception {
++        ByteArrayOutputStream bos = new ByteArrayOutputStream();
++        ObjectOutputStream oos = new ObjectOutputStream(bos);
++        oos.writeObject(on);
++        oos.close();
++        byte[] bytes = bos.toByteArray();
++        ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
++        ObjectInputStream ois = new ObjectInputStream(bis);
++        ObjectName on1 = (ObjectName) ois.readObject();
++        // if the bug is present, these will get NullPointerException
++        for (int i = 0; i <= 11; i++) {
++            String msg = testname + " case("+i+")";
++            try {
++                switch (i) {
++                case 0:
++                    check(msg,on1.getDomain().equals(on.getDomain()));
++                    break;
++                case 1:
++                    check(msg,on1.getCanonicalName().
++                         equals(on.getCanonicalName()));
++                    break;
++                case 2:
++                    check(msg,on1.getKeyPropertyListString().
++                            equals(on.getKeyPropertyListString())); break;
++                case 3:
++                    check(msg,on1.getCanonicalKeyPropertyListString().
++                            equals(on.getCanonicalKeyPropertyListString()));
++                    break;
++                case 4:
++                    for (Object ko : on1.getKeyPropertyList().keySet()) {
++			final String key = (String) ko;
++                            check(msg,on1.getKeyProperty(key).
++                                    equals(on.getKeyProperty(key)));
++                    }
++                    for (Object ko : on.getKeyPropertyList().keySet()) {
++			final String key = (String) ko;
++                            check(msg,on1.getKeyProperty(key).
++                                    equals(on.getKeyProperty(key)));
++                    }
++                case 5:
++                    check(msg,on1.getKeyPropertyList()
++                          .equals(on.getKeyPropertyList())); break;
++                case 6:
++                    check(msg,on1.isDomainPattern()==on.isDomainPattern());
++                    break;
++                case 7:
++                    check(msg,on1.isPattern()==on.isPattern()); break;
++                case 8:
++                    check(msg,
++                       on1.isPropertyPattern()==on.isPropertyPattern()); break;
++                case 9:
++                    check(msg,on1.equals(on)); break;
++                case 10:
++                    check(msg,on.equals(on1)); break;
++                case 11:
++                    if (!on.isPattern())
++                            check(msg,on1.apply(on)); break;
++                default:
+                     throw new Exception("Test incorrect: case: " + i);
+                 }
+             } catch (Exception e) {
+-                System.out.println("Test failed with exception:");
++                System.out.println("Test ("+i+") failed with exception:");
+                 e.printStackTrace(System.out);
+                 failed = true;
+             }
+         }
+ 
++    }
++
++    private static String[] names6616825 = {
++        "a:b=c","a:b=c,*","*:*",":*",":b=c",":b=c,*",
++        "a:*,b=c",":*",":*,b=c","*x?:k=\"x\\*z\"","*x?:k=\"x\\*z\",*",
++        "*x?:*,k=\"x\\*z\"","*x?:k=\"x\\*z\",*,b=c"
++    };
++
++    static void check6616825() throws Exception {
++        System.out.println("Testing 616825");
++        for (String n : names6616825) {
++            final ObjectName on;
++            try {
++                on = new ObjectName(n);
++            } catch (Exception x) {
++                failed = true;
++                System.out.println("Unexpected failure for 6616825 ["+n
++                   +"]: "+x);
++                x.printStackTrace(System.out);
++                continue;
++            }
++            try {
++                checkName("616825 "+n,on);
++            } catch (Exception x) {
++                failed = true;
++                System.out.println("6616825 failed for ["+n+"]: "+x);
++                x.printStackTrace(System.out);
++            }
++        }
++
+         if (failed)
++            throw new Exception("Some tests for 6616825 failed");
++        else
++            System.out.println("All tests for 6616825 passed");
++    }
++
++    public static void main(String[] args) throws Exception {
++        System.setProperty("jmx.serial.form", "1.0");
++
++        /* Check that we really are in jmx.serial.form=1.0 mode.
++           The property is frozen the first time the ObjectName class
++           is referenced so checking that it is set to the correct
++           value now is not enough.  */
++        ObjectStreamClass osc = ObjectStreamClass.lookup(ObjectName.class);
++        if (osc.getFields().length != 6) {
++            throw new Exception("Not using old serial form: fields: " +
++                                Arrays.asList(osc.getFields()));
++            // new serial form has no fields, uses writeObject
++        }
++
++        try {
++            check6211220();
++        } catch (Exception x) {
++            System.err.println(x.getMessage());
++        }
++        try {
++            check6616825();
++        } catch (Exception x) {
++            System.err.println(x.getMessage());
++        }
++
++        if (failed)
+             throw new Exception("Some tests failed");
+         else
+             System.out.println("All tests passed");
++
+     }
+ 
+-    private static void check(boolean condition) {
++    private static void check(String msg, boolean condition) {
+         if (!condition) {
+-            new Throwable("Test failed").printStackTrace(System.out);
++            new Throwable("Test failed "+msg).printStackTrace(System.out);
+             failed = true;
+         }
+     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-6open-6651382.patch	Thu Oct 09 13:35:37 2008 +0200
@@ -0,0 +1,116 @@
+--- openjdk/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java	Tue Oct  7 08:43:32 2008
++++ openjdk/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java	Tue Oct  7 08:43:32 2008
+@@ -26,7 +26,6 @@
+ 
+ // java imports
+ //
+-import java.io.Serializable;
+ import java.util.Map;
+ 
+ // jmx imports
+@@ -36,9 +35,7 @@
+ 
+ // jdmk imports
+ //
+-import com.sun.jmx.snmp.agent.SnmpMib;
+ 
+-import java.lang.management.ManagementFactory;
+ import java.lang.management.MemoryUsage;
+ import java.lang.management.MemoryType;
+ import java.lang.management.MemoryPoolMXBean;
+@@ -73,8 +70,10 @@
+         "jvmMemPoolEntry.getCollectionUsage";
+     final static MemoryUsage ZEROS = new MemoryUsage(0,0,0,0);
+ 
+-
+-
++    final String entryMemoryTag;
++    final String entryPeakMemoryTag;
++    final String entryCollectMemoryTag;
++    
+     MemoryUsage getMemoryUsage() {
+         try {
+             final Map<Object, Object> m = JvmContextFactory.getUserData();
+@@ -81,10 +80,10 @@
+ 
+             if (m != null) {
+                 final MemoryUsage cached = (MemoryUsage)
+-                    m.get(memoryTag);
++                    m.get(entryMemoryTag);
+                 if (cached != null) {
+-                    log.debug("getMemoryUsage",
+-                          "jvmMemPoolEntry.getUsage found in cache.");
++                    log.debug("getMemoryUsage",entryMemoryTag+
++                          " found in cache.");
+                     return cached;
+                 }
+ 
+@@ -91,7 +90,7 @@
+                 MemoryUsage u = pool.getUsage();
+                 if (u == null) u = ZEROS;
+ 
+-                m.put(memoryTag,u);
++                m.put(entryMemoryTag,u);
+                 return u;
+             }
+             // Should never come here.
+@@ -113,11 +112,11 @@
+ 
+             if (m != null) {
+                 final MemoryUsage cached = (MemoryUsage)
+-                    m.get(peakMemoryTag);
++                    m.get(entryPeakMemoryTag);
+                 if (cached != null) {
+                     if (log.isDebugOn())
+                         log.debug("getPeakMemoryUsage",
+-                              peakMemoryTag + " found in cache.");
++                              entryPeakMemoryTag + " found in cache.");
+                     return cached;
+                 }
+ 
+@@ -124,7 +123,7 @@
+                 MemoryUsage u = pool.getPeakUsage();
+                 if (u == null) u = ZEROS;
+ 
+-                m.put(peakMemoryTag,u);
++                m.put(entryPeakMemoryTag,u);
+                 return u;
+             }
+             // Should never come here.
+@@ -146,11 +145,11 @@
+ 
+             if (m != null) {
+                 final MemoryUsage cached = (MemoryUsage)
+-                    m.get(collectMemoryTag);
++                    m.get(entryCollectMemoryTag);
+                 if (cached != null) {
+                     if (log.isDebugOn())
+                         log.debug("getCollectMemoryUsage",
+-                                  collectMemoryTag + " found in cache.");
++                                  entryCollectMemoryTag + " found in cache.");
+                     return cached;
+                 }
+ 
+@@ -157,7 +156,7 @@
+                 MemoryUsage u = pool.getCollectionUsage();
+                 if (u == null) u = ZEROS;
+ 
+-                m.put(collectMemoryTag,u);
++                m.put(entryCollectMemoryTag,u);
+                 return u;
+             }
+             // Should never come here.
+@@ -179,9 +178,12 @@
+     /**
+      * Constructor for the "JvmMemPoolEntry" group.
+      */
+-    public JvmMemPoolEntryImpl(MemoryPoolMXBean mp, int index) {
++    public JvmMemPoolEntryImpl(MemoryPoolMXBean mp, final int index) {
+         this.pool=mp;
+         this.jvmMemPoolIndex = index;
++        this.entryMemoryTag = memoryTag + "." + index;
++        this.entryPeakMemoryTag = peakMemoryTag + "." + index;
++        this.entryCollectMemoryTag = collectMemoryTag + "." + index;
+     }
+ 
+     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-6open-6756202.patch	Thu Oct 09 13:35:37 2008 +0200
@@ -0,0 +1,20 @@
+--- openjdk/jdk/make/netbeans/jmx/build.properties	Wed Oct  8 09:13:27 2008
++++ openjdk/jdk/make/netbeans/jmx/build.properties	Wed Oct  8 09:13:27 2008
+@@ -42,14 +42,14 @@
+     java/lang/management/ \
+     javax/management/
+ 
+-project.spec.version			= JMX API 2.0
++project.spec.version			= JMX API 1.4
+ 
+ jar.jmx.name				= jmx.jar
+ jar.jmx.sealed				= true
+-jar.jmx.spec.title			= JSR 003, 160, 255 - JMX API
++jar.jmx.spec.title			= JSR 003, 160 - JMX API
+ jar.jmx.spec.version			= ${project.spec.version}
+ jar.jmx.spec.vendor			= Sun Microsystems, Inc.
+-jar.jmx.impl.title			= JSR 003, 160, 255 - OpenJDK 7 JMX API 
++jar.jmx.impl.title			= JSR 003, 160 - OpenJDK 6 JMX API 
+ jar.jmx.impl.vendor			= Project OpenJDK
+ 
+ javadoc.options=-J-Xmx256m