changeset 7366:8da26940090e

Merge
author asaha
date Tue, 08 Jul 2014 12:31:57 -0700
parents 8e6bcbd88360 6e9a8611fafd
children dc15796f1edb
files
diffstat 12 files changed, 275 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jul 02 21:08:29 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Jul 08 12:31:57 2014 -0700
@@ -118,6 +118,7 @@
     static final int NONACTIVATING = 1 << 24;
     static final int IS_DIALOG = 1 << 25;
     static final int IS_MODAL = 1 << 26;
+    static final int IS_POPUP = 1 << 27;
 
     static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
 
@@ -308,6 +309,7 @@
             styleBits = SET(styleBits, TEXTURED, false);
             // Popups in applets don't activate applet's process
             styleBits = SET(styleBits, NONACTIVATING, true);
+            styleBits = SET(styleBits, IS_POPUP, true);
         }
 
         if (Window.Type.UTILITY.equals(target.getType())) {
--- a/src/macosx/native/sun/awt/AWTWindow.m	Wed Jul 02 21:08:29 2014 -0700
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Tue Jul 08 12:31:57 2014 -0700
@@ -307,6 +307,10 @@
         [self adjustGrowBoxWindow];
     } else growBoxWindow = nil;
 
+    if (IS(self.styleBits, IS_POPUP)) {
+        [self.nsWindow setCollectionBehavior:(1 << 8) /*NSWindowCollectionBehaviorFullScreenAuxiliary*/]; 
+    }
+
     return self;
 }
 
--- a/src/share/classes/java/net/InetAddress.java	Wed Jul 02 21:08:29 2014 -0700
+++ b/src/share/classes/java/net/InetAddress.java	Tue Jul 08 12:31:57 2014 -0700
@@ -1128,7 +1128,7 @@
             // see if it is IPv4 address
             addr = IPAddressUtil.textToNumericFormatV4(host);
             if (addr == null) {
-                // see if it is IPv6 address
+                // This is supposed to be an IPv6 literal
                 // Check if a numeric or string zone id is present
                 int pos;
                 if ((pos=host.indexOf ("%")) != -1) {
@@ -1137,7 +1137,9 @@
                         ifname = host.substring (pos+1);
                     }
                 }
-                addr = IPAddressUtil.textToNumericFormatV6(host);
+                if ((addr = IPAddressUtil.textToNumericFormatV6(host)) == null && host.contains(":")) {
+                    throw new UnknownHostException(host + ": invalid IPv6 address");
+                }
             } else if (ipv6Expected) {
                 // Means an IPv4 litteral between brackets!
                 throw new UnknownHostException("["+host+"]");
@@ -1155,10 +1157,10 @@
                 }
                 return ret;
             }
-            } else if (ipv6Expected) {
-                // We were expecting an IPv6 Litteral, but got something else
-                throw new UnknownHostException("["+host+"]");
-            }
+        } else if (ipv6Expected) {
+            // We were expecting an IPv6 Litteral, but got something else
+            throw new UnknownHostException("["+host+"]");
+        }
         return getAllByName0(host, reqAddr, true);
     }
 
--- a/src/share/classes/javax/swing/PopupFactory.java	Wed Jul 02 21:08:29 2014 -0700
+++ b/src/share/classes/javax/swing/PopupFactory.java	Tue Jul 08 12:31:57 2014 -0700
@@ -25,10 +25,14 @@
 
 package javax.swing;
 
+import sun.awt.EmbeddedFrame;
+import sun.awt.OSInfo;
+
 import java.applet.Applet;
 import java.awt.*;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -226,7 +230,13 @@
         case MEDIUM_WEIGHT_POPUP:
             return getMediumWeightPopup(owner, contents, ownerX, ownerY);
         case HEAVY_WEIGHT_POPUP:
-            return getHeavyWeightPopup(owner, contents, ownerX, ownerY);
+            Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
+            if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
+                OSInfo.OSType.MACOSX) && (owner != null) &&
+                (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
+                ((HeavyWeightPopup)popup).setCacheEnabled(false);
+            }
+            return popup;
         }
         return null;
     }
@@ -294,6 +304,8 @@
         private static final Object heavyWeightPopupCacheKey =
                  new StringBuffer("PopupFactory.heavyWeightPopupCache");
 
+        private volatile boolean isCacheEnabled = true;
+
         /**
          * Returns either a new or recycled <code>Popup</code> containing
          * the specified children.
@@ -448,12 +460,23 @@
             }
         }
 
+        /**
+         * Enables or disables cache for current object.
+         */
+        void setCacheEnabled(boolean enable) {
+            isCacheEnabled = enable;
+        }
+
         //
         // Popup methods
         //
         public void hide() {
             super.hide();
-            recycleHeavyWeightPopup(this);
+            if (isCacheEnabled) {
+                recycleHeavyWeightPopup(this);
+            } else {
+                this._dispose();
+            }
         }
 
         /**
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Wed Jul 02 21:08:29 2014 -0700
+++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Tue Jul 08 12:31:57 2014 -0700
@@ -75,6 +75,13 @@
 }
 SCARD_READERSTATE_A;
 
+typedef struct _SCARD_IO_REQUEST
+{
+        unsigned long dwProtocol;       /* Protocol identifier */
+        unsigned long cbPciLength;      /* Protocol Control Inf Length */
+}
+SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
+
 #else // __APPLE__
 
 #pragma pack(1)
@@ -88,6 +95,13 @@
         unsigned char rgbAtr[MAX_ATR_SIZE];
 }
 SCARD_READERSTATE_A;
+
+typedef struct _SCARD_IO_REQUEST
+{
+        uint32_t dwProtocol;            /* Protocol identifier */
+        uint32_t cbPciLength;           /* Protocol Control Inf Length */
+}
+SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
 #pragma pack()
 
 #endif // __APPLE__
@@ -95,13 +109,6 @@
 typedef SCARD_READERSTATE_A SCARD_READERSTATE, *PSCARD_READERSTATE_A,
         *LPSCARD_READERSTATE_A;
 
-typedef struct _SCARD_IO_REQUEST
-{
-        unsigned long dwProtocol;       /* Protocol identifier */
-        unsigned long cbPciLength;      /* Protocol Control Inf Length */
-}
-SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
-
 typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
 
 extern SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci,
--- a/src/windows/transport/shmem/shmem_md.c	Wed Jul 02 21:08:29 2014 -0700
+++ b/src/windows/transport/shmem/shmem_md.c	Tue Jul 08 12:31:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -30,6 +30,11 @@
 #include "sysShmem.h"
 #include "shmemBase.h"  /* for exitTransportWithError */
 
+/* Use THIS_FILE when it is available. */
+#ifndef THIS_FILE
+    #define THIS_FILE __FILE__
+#endif
+
 /*
  * These functions are not completely universal. For now, they are used
  * exclusively for Jbug's shared memory transport mechanism. They have
--- a/test/demo/zipfs/basic.sh	Wed Jul 02 21:08:29 2014 -0700
+++ b/test/demo/zipfs/basic.sh	Tue Jul 08 12:31:57 2014 -0700
@@ -40,7 +40,7 @@
 
 OS=`uname -s`
 case "$OS" in
-    Windows_* )
+    Windows_* | CYGWIN* )
         CLASSPATH="${TESTCLASSES};${ZIPFS}"
         ;;
     * )
--- a/test/java/net/ipv6tests/BadIPv6Addresses.java	Wed Jul 02 21:08:29 2014 -0700
+++ b/test/java/net/ipv6tests/BadIPv6Addresses.java	Tue Jul 08 12:31:57 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4742177
+ * @bug 4742177 8019834
  * @summary Re-test IPv6 (and specifically MulticastSocket) with latest Linux & USAGI code
  */
 import java.net.*;
--- a/test/java/nio/charset/coders/CheckSJISMappingProp.sh	Wed Jul 02 21:08:29 2014 -0700
+++ b/test/java/nio/charset/coders/CheckSJISMappingProp.sh	Tue Jul 08 12:31:57 2014 -0700
@@ -36,7 +36,7 @@
 case "$OS" in
   SunOS | Linux | Darwin ) ;;
   # Skip locale test for Windows
-  Windows* )
+  Windows* | CYGWIN* )
     echo "Passed"; exit 0 ;;
   * ) echo "Unrecognized system!" ;  exit 1 ;;
 esac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/PopupFactory/8048506/bug8048506.java	Tue Jul 08 12:31:57 2014 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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 8048506
+ * @summary Tests that popup with null-owner does not throw NPE
+ * @author Dmitry Markov
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+public class bug8048506 {
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+        System.out.println("The test passed");
+    }
+
+    private static void createAndShowGUI() {
+        JFrame frame = new JFrame("bug8048506");
+        frame.setSize(400, 400);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setVisible(true);
+
+        PopupFactory factory = PopupFactory.getSharedInstance();
+
+        // Create and show popup with owner
+        Popup popup1 = factory.getPopup(frame, new JLabel("Popup with owner"), 100, 100);
+        popup1.show();
+
+        //Create and show popup without owner
+        Popup popup2 = factory.getPopup(null, new JLabel("Popup without owner"), 200, 200);
+        popup2.show();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/ws/8043129/MailTest.java	Tue Jul 08 12:31:57 2014 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014, 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 8043129
+ * @summary JAF initialisation in SAAJ clashing with the one in javax.mail
+ * @author mkos
+ * @library javax.mail.jar
+ * @build MailTest
+ * @run main MailTest
+ */
+
+import javax.activation.CommandMap;
+import javax.activation.MailcapCommandMap;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Session;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+public class MailTest {
+
+    String host = null;
+    String user = "";
+    String password = null;
+    String from = null;
+    String to = null;
+
+    public static void main(String[] args) {
+        MailTest t = new MailTest();
+
+        t.user = "somebody@somewhere.com";
+        t.from = "somebody@somewhere.com";
+        t.to = "somebody@somewhere.com";
+
+        t.user = "somebody@somewhere.com";
+        t.password = "somepassword";
+        t.host = "somehost";
+
+        t.sendMail();    //this works
+
+        t.addSoapAttachement();
+        t.sendMail();    //after addAttachmentPart to soapmessage it do not work
+
+        // workaroundJAFSetup();
+        // t.sendMail();    //after workaround works again
+    }
+
+    void addSoapAttachement() {
+        try {
+            MessageFactory messageFactory = MessageFactory.newInstance();
+            SOAPMessage message = messageFactory.createMessage();
+            AttachmentPart a = message.createAttachmentPart();
+            a.setContentType("binary/octet-stream");
+            message.addAttachmentPart(a);
+        } catch (SOAPException e) {
+            e.printStackTrace();
+        }
+    }
+
+    void sendMail() {
+
+        try {
+            Properties props = new Properties();
+            props.put("mail.smtp.host", host);
+            props.put("mail.smtp.auth", "true");
+
+            Session session = Session.getInstance(props);
+            session.setDebug(true);
+
+            // Define message
+            MimeMessage message = new MimeMessage(session);
+            message.setFrom(new InternetAddress(from));
+            message.addRecipients(Message.RecipientType.TO, to);
+            message.setSubject("this is a multipart test");
+
+            Multipart multipart = new MimeMultipart();
+
+            BodyPart messageBodyPart1 = new MimeBodyPart();
+            messageBodyPart1.setText("please send also this Content\n ciao!");
+            multipart.addBodyPart(messageBodyPart1);
+
+            BodyPart messageBodyPart2 = new MimeBodyPart();
+            messageBodyPart2.setContent("<b>please</b> send also this Content <br>ciao!", "text/html; charset=UTF-8");
+            multipart.addBodyPart(messageBodyPart2);
+
+            message.setContent(multipart);
+
+            /*
+                Transport tr = session.getTransport("smtp");
+                tr.connect(host,user, password);
+                tr.sendMessage(message,InternetAddress.parse(to));
+                tr.close();
+            */
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            message.writeTo(baos);
+            String output = baos.toString();
+            System.out.println("output = " + output);
+            if (output.contains("also this Content")) {
+                System.out.println("Test PASSED.");
+            } else {
+                System.out.println("Test FAILED, missing content.");
+                throw new IllegalStateException("Test FAILED, missing content.");
+            }
+        } catch (MessagingException ignored) {
+        } catch (IOException ignored) {
+        }
+    }
+
+    // this is how the error can be worked around ...
+    static void workaroundJAFSetup() {
+        MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
+        mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
+    }
+}
Binary file test/javax/xml/ws/8043129/javax.mail.jar has changed