Mercurial > hg > release > icedtea7-forest-2.4 > jdk
changeset 4772:b97711a21785 jdk7u4-b02
Merge
author | lana |
---|---|
date | Tue, 22 Nov 2011 15:08:54 -0800 |
parents | 12fd550b96d0 (current diff) 0890350cf539 (diff) |
children | 4b73f1011557 7e5dcaa19010 ac81c77a109e 5cca2f1a37da |
files | |
diffstat | 19 files changed, 278 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/make/sun/xawt/mapfile-vers Wed Nov 16 16:10:01 2011 -0800 +++ b/make/sun/xawt/mapfile-vers Tue Nov 22 15:08:54 2011 -0800 @@ -322,6 +322,8 @@ Java_sun_awt_X11_XlibWrapper_XSynchronize; Java_java_awt_FileDialog_initIDs; Java_sun_awt_X11_XWindow_initIDs; + Java_sun_awt_X11_XWindowPeer_getLocalHostname; + Java_sun_awt_X11_XWindowPeer_getJvmPID; Java_sun_java2d_opengl_OGLContext_getOGLIdString; Java_sun_java2d_opengl_OGLMaskFill_maskFill;
--- a/src/share/classes/com/sun/beans/finder/AbstractFinder.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/com/sun/beans/finder/AbstractFinder.java Tue Nov 22 15:08:54 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,7 +54,7 @@ /** * Returns an array of {@code Class} objects - * that represent the formal parameter types of the method + * that represent the formal parameter types of the method. * Returns an empty array if the method takes no parameters. * * @param method the object that represents method
--- a/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Tue Nov 22 15:08:54 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ /** * Returns an array of {@code Class} objects - * that represent the formal parameter types of the constructor + * that represent the formal parameter types of the constructor. * Returns an empty array if the constructor takes no parameters. * * @param constructor the object that represents constructor
--- a/src/share/classes/com/sun/beans/finder/MethodFinder.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/com/sun/beans/finder/MethodFinder.java Tue Nov 22 15:08:54 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -190,7 +190,7 @@ /** * Returns an array of {@code Class} objects - * that represent the formal parameter types of the method + * that represent the formal parameter types of the method. * Returns an empty array if the method takes no parameters. * * @param method the object that represents method @@ -226,6 +226,6 @@ */ @Override protected boolean isValid(Method method) { - return Modifier.isPublic(method.getModifiers()) && method.getName().equals(this.name); + return !method.isBridge() && Modifier.isPublic(method.getModifiers()) && method.getName().equals(this.name); } }
--- a/src/share/classes/java/util/XMLUtils.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/java/util/XMLUtils.java Tue Nov 22 15:08:54 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,7 @@ } catch (SAXException saxe) { throw new InvalidPropertiesFormatException(saxe); } - Element propertiesElement = (Element)doc.getChildNodes().item(1); + Element propertiesElement = doc.getDocumentElement(); String xmlVersion = propertiesElement.getAttribute("version"); if (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new InvalidPropertiesFormatException(
--- a/src/share/classes/javax/swing/JTree.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/javax/swing/JTree.java Tue Nov 22 15:08:54 2011 -0800 @@ -1838,7 +1838,9 @@ * nodes, or <code>null</code> if nothing is currently selected */ public TreePath[] getSelectionPaths() { - return getSelectionModel().getSelectionPaths(); + TreePath[] selectionPaths = getSelectionModel().getSelectionPaths(); + + return (selectionPaths != null && selectionPaths.length > 0) ? selectionPaths : null; } /**
--- a/src/share/classes/sun/security/ssl/MAC.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/sun/security/ssl/MAC.java Tue Nov 22 15:08:54 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -172,10 +172,10 @@ * when there are only 2^8 sequence numbers left. */ return (block != null && mac != null && - block[0] == 0xFF && block[1] == 0xFF && - block[2] == 0xFF && block[3] == 0xFF && - block[4] == 0xFF && block[5] == 0xFF && - block[6] == 0xFF); + block[0] == (byte)0xFF && block[1] == (byte)0xFF && + block[2] == (byte)0xFF && block[3] == (byte)0xFF && + block[4] == (byte)0xFF && block[5] == (byte)0xFF && + block[6] == (byte)0xFF); } /* @@ -192,7 +192,7 @@ * only 2^48 sequence numbers left. */ return (block != null && mac != null && - block[0] == 0xFF && block[1] == 0xFF); + block[0] == (byte)0xFF && block[1] == (byte)0xFF); } // increment the sequence number in the block array
--- a/src/share/classes/sun/text/bidi/BidiBase.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/sun/text/bidi/BidiBase.java Tue Nov 22 15:08:54 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3411,18 +3411,21 @@ * Display the bidi internal state, used in debugging. */ public String toString() { - StringBuffer buf = new StringBuffer(super.toString()); + StringBuilder buf = new StringBuilder(getClass().getName()); - buf.append("[dir: " + direction); - buf.append(" baselevel: " + paraLevel); - buf.append(" length: " + length); + buf.append("[dir: "); + buf.append(direction); + buf.append(" baselevel: "); + buf.append(paraLevel); + buf.append(" length: "); + buf.append(length); buf.append(" runs: "); if (levels == null) { - buf.append("null"); + buf.append("none"); } else { buf.append('['); buf.append(levels[0]); - for (int i = 0; i < levels.length; i++) { + for (int i = 1; i < levels.length; i++) { buf.append(' '); buf.append(levels[i]); } @@ -3430,12 +3433,11 @@ } buf.append(" text: [0x"); buf.append(Integer.toHexString(text[0])); - for (int i = 0; i < text.length; i++) { + for (int i = 1; i < text.length; i++) { buf.append(" 0x"); buf.append(Integer.toHexString(text[i])); } - buf.append(']'); - buf.append(']'); + buf.append("]]"); return buf.toString(); }
--- a/src/share/classes/sun/util/locale/LocaleObjectCache.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/share/classes/sun/util/locale/LocaleObjectCache.java Tue Nov 22 15:08:54 2011 -0800 @@ -66,14 +66,14 @@ CacheEntry<K, V> newEntry = new CacheEntry<>(key, newVal, queue); - while (value == null) { - cleanStaleEntries(); - entry = map.putIfAbsent(key, newEntry); - if (entry == null) { + entry = map.putIfAbsent(key, newEntry); + if (entry == null) { + value = newVal; + } else { + value = entry.get(); + if (value == null) { + map.put(key, newEntry); value = newVal; - break; - } else { - value = entry.get(); } } }
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed Nov 16 16:10:01 2011 -0800 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Tue Nov 22 15:08:54 2011 -0800 @@ -208,12 +208,19 @@ return name; } + private static native String getLocalHostname(); + private static native int getJvmPID(); + void postInit(XCreateWindowParams params) { super.postInit(params); // Init WM_PROTOCOLS atom initWMProtocols(); + // Set _NET_WM_PID and WM_CLIENT_MACHINE using this JVM + XAtom.get("WM_CLIENT_MACHINE").setProperty(getWindow(), getLocalHostname()); + XAtom.get("_NET_WM_PID").setCard32Property(getWindow(), getJvmPID()); + // Set WM_TRANSIENT_FOR and group_leader Window t_window = (Window)target; Window owner = t_window.getOwner();
--- a/src/solaris/native/java/net/NetworkInterface.c Wed Nov 16 16:10:01 2011 -0800 +++ b/src/solaris/native/java/net/NetworkInterface.c Tue Nov 22 15:08:54 2011 -0800 @@ -139,8 +139,12 @@ #ifdef __solaris__ static netif *enumIPvXInterfaces(JNIEnv *env, int sock, netif *ifs, int family); static int getMacFromDevice(JNIEnv *env, const char* ifname, unsigned char* retbuf); + +#ifndef SIOCGLIFHWADDR +#define SIOCGLIFHWADDR _IOWR('i', 192, struct lifreq) #endif +#endif /******************* Java entry points *****************************/ @@ -1567,6 +1571,20 @@ struct sockaddr_in* sin; struct sockaddr_in ipAddr; int len, i; + struct lifreq lif; + + /* First, try the new (S11) SIOCGLIFHWADDR ioctl(). If that fails + * try the old way. + */ + memset(&lif, 0, sizeof(lif)); + strlcpy(lif.lifr_name, ifname, sizeof(lif.lifr_name)); + + if (ioctl(sock, SIOCGLIFHWADDR, &lif) != -1) { + struct sockaddr_dl *sp; + sp = (struct sockaddr_dl *)&lif.lifr_addr; + memcpy(buf, &sp->sdl_data[0], sp->sdl_alen); + return sp->sdl_alen; + } /** * On Solaris we have to use DLPI, but it will only work if we have @@ -1576,34 +1594,29 @@ if ((len = getMacFromDevice(env, ifname, buf)) == 0) { /*DLPI failed - trying to do arp lookup*/ - if (addr == NULL) { - /** - * No IPv4 address for that interface, so can't do an ARP lookup. - */ - return -1; - } + if (addr == NULL) { + /** + * No IPv4 address for that interface, so can't do an ARP lookup. + */ + return -1; + } - len = 6; //??? + len = 6; //??? - sin = (struct sockaddr_in *) &arpreq.arp_pa; - memset((char *) &arpreq, 0, sizeof(struct arpreq)); - ipAddr.sin_port = 0; - ipAddr.sin_family = AF_INET; - memcpy(&ipAddr.sin_addr, addr, sizeof(struct in_addr)); - memcpy(&arpreq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); - arpreq.arp_flags= ATF_PUBL; + sin = (struct sockaddr_in *) &arpreq.arp_pa; + memset((char *) &arpreq, 0, sizeof(struct arpreq)); + ipAddr.sin_port = 0; + ipAddr.sin_family = AF_INET; + memcpy(&ipAddr.sin_addr, addr, sizeof(struct in_addr)); + memcpy(&arpreq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); + arpreq.arp_flags= ATF_PUBL; - if (ioctl(sock, SIOCGARP, &arpreq) < 0) { - if (errno != ENXIO) { - // "No such device or address" means no hardware address, so it's - // normal don't throw an exception - NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "IOCTL failed"); - return -1; - } - } + if (ioctl(sock, SIOCGARP, &arpreq) < 0) { + return -1; + } - memcpy(buf, &arpreq.arp_ha.sa_data[0], len ); - } + memcpy(buf, &arpreq.arp_ha.sa_data[0], len ); + } /* * All bytes to 0 means no hardware address.
--- a/src/solaris/native/sun/xawt/XToolkit.c Wed Nov 16 16:10:01 2011 -0800 +++ b/src/solaris/native/sun/xawt/XToolkit.c Tue Nov 22 15:08:54 2011 -0800 @@ -47,6 +47,8 @@ #include "java_awt_TrayIcon.h" #include <X11/extensions/XTest.h> +#include <unistd.h> + uint32_t awt_NumLockMask = 0; Boolean awt_ModLockIsShiftLock = False; @@ -1087,3 +1089,38 @@ return local_num_buttons; } + +/* + * Class: sun_awt_X11_XWindowPeer + * Method: getJvmPID + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_sun_awt_X11_XWindowPeer_getJvmPID +(JNIEnv *env, jclass cls) +{ + /* Return the JVM's PID. */ + return getpid(); +} + +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 1024 /* Overestimated */ +#endif + +/* + * Class: sun_awt_X11_XWindowPeer + * Method: getLocalHostname + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_sun_awt_X11_XWindowPeer_getLocalHostname +(JNIEnv *env, jclass cls) +{ + /* Return the machine's FQDN. */ + char hostname[HOST_NAME_MAX + 1]; + if (gethostname(hostname, HOST_NAME_MAX + 1) == 0) { + hostname[HOST_NAME_MAX] = '\0'; + jstring res = (*env)->NewStringUTF(env, hostname); + return res; + } + + return (jstring)NULL; +}
--- a/src/windows/native/java/lang/java_props_md.c Wed Nov 16 16:10:01 2011 -0800 +++ b/src/windows/native/java/lang/java_props_md.c Tue Nov 22 15:08:54 2011 -0800 @@ -563,6 +563,18 @@ { char * display_encoding; + // Windows UI Language selection list only cares "language" + // information of the UI Language. For example, the list + // just lists "English" but it actually means "en_US", and + // the user cannot select "en_GB" (if exists) in the list. + // So, this hack is to use the user LCID region information + // for the UI Language, if the "language" portion of those + // two locales are the same. + if (PRIMARYLANGID(LANGIDFROMLCID(userDefaultLCID)) == + PRIMARYLANGID(LANGIDFROMLCID(userDefaultUILang))) { + userDefaultUILang = userDefaultLCID; + } + SetupI18nProps(userDefaultUILang, &sprops.language, &sprops.script,
--- a/test/Makefile Wed Nov 16 16:10:01 2011 -0800 +++ b/test/Makefile Tue Nov 22 15:08:54 2011 -0800 @@ -510,13 +510,17 @@ # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_nio3 -jdk_nio3: $(call TestDirs, com/sun/nio sun/nio) +jdk_nio3: $(call TestDirs, sun/nio) $(call RunSamevmBatch) # All nio tests jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3 @$(SummaryInfo) +# Stable samevm testruns (minus items from PROBLEM_LIST) +jdk_sctp: $(call TestDirs, com/sun/nio/sctp) + $(call RunSamevmBatch) + # Stable othervm testruns (minus items from PROBLEM_LIST) # Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_rmi
--- a/test/ProblemList.txt Wed Nov 16 16:10:01 2011 -0800 +++ b/test/ProblemList.txt Tue Nov 22 15:08:54 2011 -0800 @@ -380,30 +380,6 @@ # 6963118 java/nio/channels/Selector/Wakeup.java windows-all -# 6959891 -com/sun/nio/sctp/SctpChannel/SocketOptionTests.java - -# Fails with -ea -esa, Assertion error, but only on Solaris 10 machines? -com/sun/nio/sctp/SctpChannel/Send.java generic-all -com/sun/nio/sctp/SctpChannel/Shutdown.java generic-all - -# Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses -# from a channel that is bound to the wildcard address -com/sun/nio/sctp/SctpChannel/Bind.java generic-all - -# Failed on OpenSolaris, java.lang.AssertionError: Unknown event type -com/sun/nio/sctp/SctpChannel/Receive.java generic-all - -# Solaris 11 gave assert error and "connection refused", samevm issues? -com/sun/nio/sctp/SctpServerChannel/NonBlockingAccept.java generic-all - -# Fails with othervm on solaris 11 i586 -com/sun/nio/sctp/SctpChannel/CommUp.java generic-all -com/sun/nio/sctp/SctpChannel/Connect.java generic-all -com/sun/nio/sctp/SctpMultiChannel/Branch.java generic-all -com/sun/nio/sctp/SctpMultiChannel/Send.java generic-all -com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java generic-all - ############################################################################ # jdk_rmi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/beans/XMLEncoder/Test7092744.java Tue Nov 22 15:08:54 2011 -0800 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7092744 + * @summary Tests for ambiguous methods + * @author Sergey Malenkov + */ + +public class Test7092744 extends AbstractTest { + + public static void main(String[] args) { + new Test7092744().test(true); + } + + protected Object getObject() { + return new Bean(); + } + + protected Object getAnotherObject() { + Bean bean = new Bean(); + bean.setValue(99); + return bean; + } + + public static interface I<T extends Number> { + + T getValue(); + + void setValue(T value); + } + + public static class Bean implements I<Integer> { + + private Integer value; + + public Integer getValue() { + return this.value; + } + + public void setValue(Integer value) { + this.value = value; + } + } +}
--- a/test/java/net/NetworkInterface/NetParamsTest.java Wed Nov 16 16:10:01 2011 -0800 +++ b/test/java/net/NetworkInterface/NetParamsTest.java Tue Nov 22 15:08:54 2011 -0800 @@ -45,7 +45,9 @@ System.out.println("\tPoint to Point: " + netif.isPointToPoint()); System.out.println("\tVirtual: " + netif.isVirtual()); if (netif.isVirtual()) { - System.out.println("\tParent Interface: " + netif.getParent().getName()); + NetworkInterface parent = netif.getParent(); + String parentName = parent == null ? "null" : parent.getName(); + System.out.println("\tParent Interface: " + parentName); } System.out.println("\tMulticast: " + netif.supportsMulticast());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/text/Bidi/Bug7051769.java Tue Nov 22 15:08:54 2011 -0800 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7051769 + * @summary verify that Bidi.toString() returns the corect result. + */ +import java.awt.font.*; +import java.text.*; +import java.util.*; + +public class Bug7051769 { + + private static boolean err = false; + + public static void main(String[] args) { + testNumericShaping(); + + if (err) { + throw new RuntimeException("Failed"); + } else { + System.out.println("Passed."); + } + } + + private static void testNumericShaping() { + Map attrNS = new HashMap(); + attrNS.put(TextAttribute.NUMERIC_SHAPING, + NumericShaper.getContextualShaper(NumericShaper.ARABIC)); + attrNS.put(TextAttribute.RUN_DIRECTION, + TextAttribute.RUN_DIRECTION_RTL); + + String text = "\u0623\u0643\u062a\u0648\u0628\u0631 10"; + String expected = "sun.text.bidi.BidiBase[dir: 2 baselevel: 1 length: 9 runs: [1 1 1 1 1 1 1 2 2] text: [0x623 0x643 0x62a 0x648 0x628 0x631 0x20 0x661 0x660]]"; + + AttributedString as = new AttributedString(text, attrNS); + AttributedCharacterIterator itr = as.getIterator(); + itr.last(); + itr.next(); + Bidi bidi = new Bidi(itr); + String got = bidi.toString(); + + if (!got.equals(expected)) { + err = true; + System.err.println("Wrong toString() output: " + + "\n\tExpected=" + expected + + "\n\tGot=" + got); + } + } + +}