diff --git a/jdk/src/share/classes/com/sun/servicetag/SunConnection.java b/jdk/src/share/classes/com/sun/servicetag/SunConnection.java index 3a8983f9b6c..cc78ef16f8b 100644 --- a/jdk/src/share/classes/com/sun/servicetag/SunConnection.java +++ b/jdk/src/share/classes/com/sun/servicetag/SunConnection.java @@ -51,8 +51,8 @@ import javax.net.ssl.HttpsURLConnection; */ class SunConnection { - private static String JDK_REGISTRATION_URL = "https://inventory.sun.com/"; - private static String SANDBOX_TESTING_URL = "https://inventory-beta.sun.com/"; + private static String JDK_REGISTRATION_URL = "https://hs-ws1.oracle.com/"; + private static String SANDBOX_TESTING_URL = "https://hs-ws1-tst.oracle.com/"; private static String REGISTRATION_WEB_PATH = "RegistrationWeb/register"; // System properties for testing diff --git a/jdk/src/share/classes/com/sun/servicetag/resources/register.html b/jdk/src/share/classes/com/sun/servicetag/resources/register.html index cc1dee262ec..42cfa4b0906 100644 --- a/jdk/src/share/classes/com/sun/servicetag/resources/register.html +++ b/jdk/src/share/classes/com/sun/servicetag/resources/register.html @@ -64,7 +64,7 @@ a:visited,a:visited code{color:#917E9C}

Product registration is FREE, quick and easy!

-

All you need is a Sun Developer Network or other Sun Online account. If you don't already have one, you will be prompted to create one.

+

All you need is an Oracle.com account. If you don't already have one, you will be prompted to create one.

@@ -83,9 +83,9 @@ a:visited,a:visited code{color:#917E9C}

Oracle Corporation respects your privacy. We will use your personal information for communications - and management of your Sun Online Account, the services - and applications you access using your Sun Online Account, - and the products and systems you register with your Sun Online Account.

+ and management of your Oracle.com account, the services + and applications you access using your Oracle.com account, + and the products and systems you register with your Oracle.com account.

For more information on the data that will be collected as part of the registration process and how it will be managed
see http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html.
diff --git a/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html b/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html index 3da70723ef8..7c36d0ec982 100644 --- a/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html +++ b/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html @@ -59,7 +59,7 @@ a:visited,a:visited code{color:#917E9C}

製品登録は無料であり、迅速で簡単です。

-

必要になるのは、Sun 開発者向けネットワークアカウントまたはその他の Sun オンラインアカウントだけです。 まだアカウントがない場合は、アカウントの作成が求められます。

+

必要になるのは、Oracle.com アカウントだけです。 まだアカウントがない場合は、アカウントの作成が求められます。

diff --git a/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html b/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html index f5bad110b4f..86a289141d1 100644 --- a/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html +++ b/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html @@ -60,7 +60,7 @@ a:visited,a:visited code{color:#917E9C}

产品注册是免费的,即快速又轻松!

-

您需要具有 Sun 开发者网络或其他 Sun 联机帐户。如果您没有,系统将提示您创建一个。

+

您需要具有 Oracle.com 帐户。如果您没有,系统将提示您创建一个。

@@ -75,7 +75,7 @@ a:visited,a:visited code{color:#917E9C}
  -

Oracle Corporation は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Sun オンラインアカウント、お客様が Sun オンラインアカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Sun オンラインアカウントで登録する製品とシステムの通信と管理に使用します。

+

Oracle Corporation は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Oracle.com アカウント、お客様が Oracle.com アカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Oracle.com アカウントで登録する製品とシステムの通信と管理に使用します。

登録の際に収集されるデータや、それらがどのように管理されるかについての詳細は、
http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html を参照してください。

Oracle のプライバシーポリシーについての詳細は、http://www.oracle.com/html/privacy.html を参照するか、お問い合わせフォームからお問い合わせください。

diff --git a/jdk/src/share/classes/java/io/ByteArrayInputStream.java b/jdk/src/share/classes/java/io/ByteArrayInputStream.java index 5cef38ddd6c..11207aad9c5 100644 --- a/jdk/src/share/classes/java/io/ByteArrayInputStream.java +++ b/jdk/src/share/classes/java/io/ByteArrayInputStream.java @@ -179,11 +179,14 @@ class ByteArrayInputStream extends InputStream { } else if (off < 0 || len < 0 || len > b.length - off) { throw new IndexOutOfBoundsException(); } + if (pos >= count) { return -1; } - if (pos + len > count) { - len = count - pos; + + int avail = count - pos; + if (len > avail) { + len = avail; } if (len <= 0) { return 0; @@ -206,14 +209,13 @@ class ByteArrayInputStream extends InputStream { * @return the actual number of bytes skipped. */ public synchronized long skip(long n) { - if (pos + n > count) { - n = count - pos; + long k = count - pos; + if (n < k) { + k = n < 0 ? 0 : n; } - if (n < 0) { - return 0; - } - pos += n; - return n; + + pos += k; + return k; } /** diff --git a/jdk/src/share/classes/java/lang/Thread.java b/jdk/src/share/classes/java/lang/Thread.java index c3592cf5cf3..52b57dde4bb 100644 --- a/jdk/src/share/classes/java/lang/Thread.java +++ b/jdk/src/share/classes/java/lang/Thread.java @@ -229,7 +229,7 @@ class Thread implements Runnable { * after setting this thread's interrupt status. */ private volatile Interruptible blocker; - private Object blockerLock = new Object(); + private final Object blockerLock = new Object(); /* Set the blocker field; invoked via sun.misc.SharedSecrets from java.nio code */ @@ -688,16 +688,19 @@ class Thread implements Runnable { throw new IllegalThreadStateException(); /* Notify the group that this thread is about to be started - * so that it can be added to the group's list of threads. */ + * so that it can be added to the group's list of threads + * and the group's unstarted count can be decremented. */ group.threadStarting(this); - boolean failed = true; + boolean started = false; try { start0(); - failed = false; + started = true; } finally { try { - group.threadStarted(this, failed); + if (!started) { + group.threadStartFailed(this); + } } catch (Throwable ignore) { /* do nothing. If start0 threw a Throwable then it will be passed up the call stack */ diff --git a/jdk/src/share/classes/java/lang/ThreadGroup.java b/jdk/src/share/classes/java/lang/ThreadGroup.java index 1b14570cee3..8bfc3bc4832 100644 --- a/jdk/src/share/classes/java/lang/ThreadGroup.java +++ b/jdk/src/share/classes/java/lang/ThreadGroup.java @@ -870,9 +870,16 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { /** * Notifies the group that the thread {@code t} is about to be * started and adds the thread to this thread group. + * + * The thread is now a fully fledged member of the group, even though + * it hasn't been started yet. It will prevent the group from being + * destroyed so the unstarted Threads count is decremented. */ void threadStarting(Thread t) { - add(t); + synchronized (this) { + add(t); + nUnstartedThreads--; + } } /** @@ -907,12 +914,10 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { } /** - * Notifies the group that the thread {@code t} has completed + * Notifies the group that the thread {@code t} has failed * an attempt to start. * - *

If the thread has been started successfully - * then the group has its unstarted Threads count decremented. - * Otherwise the state of this thread group is rolled back as if the + *

The state of this thread group is rolled back as if the * attempt to start the thread has never occurred. The thread is again * considered an unstarted member of the thread group, and a subsequent * attempt to start the thread is permitted. @@ -923,16 +928,10 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { * @param failed * true if the thread could not be started successfully */ - void threadStarted(Thread t, boolean failed) { + void threadStartFailed(Thread t) { synchronized(this) { - if (failed) { - remove(t); - } else { - if (destroyed) { - return; - } - nUnstartedThreads--; - } + remove(t); + nUnstartedThreads++; } } diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java index afc319edf26..f5359f9b12c 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2010, 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 @@ -291,7 +291,24 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable if (tracing) logger.trace("connect",idstr + " getting connection..."); Object credentials = usemap.get(CREDENTIALS); - connection = getConnection(stub, credentials, checkStub); + + try { + connection = getConnection(stub, credentials, checkStub); + } catch (java.rmi.RemoteException re) { + if (jmxServiceURL != null) { + final String pro = jmxServiceURL.getProtocol(); + final String path = jmxServiceURL.getURLPath(); + + if ("rmi".equals(pro) && + path.startsWith("/jndi/iiop:")) { + MalformedURLException mfe = new MalformedURLException( + "Protocol is rmi but JNDI scheme is iiop: " + jmxServiceURL); + mfe.initCause(re); + throw mfe; + } + } + throw re; + } // Always use one of: // ClassLoader provided in Map at connect time, diff --git a/jdk/test/java/io/ByteArrayInputStream/Skip.java b/jdk/test/java/io/ByteArrayInputStream/Skip.java new file mode 100644 index 00000000000..9364bd7eaac --- /dev/null +++ b/jdk/test/java/io/ByteArrayInputStream/Skip.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2010, 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 6720170 + * @summary check for ByteArrayInputStream.skip + */ + +import java.io.*; + +public class Skip { + private static void dotest(InputStream in, int curpos, long total, + long toskip, long expected) + throws Exception + { + System.err.println("\nCurrently at pos = " + curpos + + "\nTotal bytes in the stream = " + total + + "\nNumber of bytes to skip = " + toskip + + "\nNumber of bytes that should be skipped = " + + expected); + + // position to curpos; EOF if negative + in.reset(); + int avail = curpos >= 0 ? curpos : in.available(); + long n = in.skip(avail); + if (n != avail) { + throw new RuntimeException("Unexpected number of bytes skipped = " + n); + } + + long skipped = in.skip(toskip); + System.err.println("actual number skipped: "+ skipped); + + if (skipped != expected) { + throw new RuntimeException("Unexpected number of bytes skipped = " + skipped); + } + } + + public static void main(String argv[]) throws Exception { + int total = 1024; + ByteArrayInputStream in = new ByteArrayInputStream(new byte[total]); + + /* test for skip */ + dotest(in, 0, total, 23, 23); + dotest(in, 10, total, 23, 23); + + /* test for negative skip */ + dotest(in, 0, total, -23, 0); + + /* check for skip after EOF */ + dotest(in, -1, total, 20, 0); + + /* check for skip beyond EOF starting from before EOF */ + dotest(in, 0, total, total+20, total); + + /* check for skip if the pos + toskip causes integer overflow */ + dotest(in, 10, total, Long.MAX_VALUE, total-10); + } +} diff --git a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java new file mode 100644 index 00000000000..91ec8fa7c46 --- /dev/null +++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010, 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 + * @summary NPE IN RMIConnector.connect + * @bug 6984520 + * @run clean RMIConnector_NPETest + * @run build RMIConnector_NPETest + * @run main RMIConnector_NPETest + */ + +import java.io.*; +import java.lang.management.*; +import java.rmi.registry.*; +import javax.management.*; +import javax.management.remote.*; +import javax.management.remote.rmi.*; + +public class RMIConnector_NPETest { + + public static void main(String argv[]) throws Exception { + boolean testFailed = false; + String rmidCmd = System.getProperty("java.home") + File.separator + + "bin" + File.separator + "rmid -port 3333"; + String stopRmidCmd = System.getProperty("java.home") + File.separator + + "bin" + File.separator + "rmid -stop -port 3333"; + try { + //start an rmid daemon and give it some time + System.out.println("Starting rmid"); + Runtime.getRuntime().exec(rmidCmd); + Thread.sleep(5000); + + MBeanServer mbs = MBeanServerFactory.createMBeanServer(); + RMIJRMPServerImpl rmiserver = new RMIJRMPServerImpl(3333, null, null, null); + rmiserver.setMBeanServer(mbs); + RMIConnector agent = new RMIConnector(rmiserver, null); + agent.connect(); + } catch(NullPointerException npe) { + npe.printStackTrace(); + testFailed = true; + } catch (Exception e) { + // OK + } finally { + System.out.println("Stopping rmid"); + Runtime.getRuntime().exec(stopRmidCmd); + } + + if(testFailed) + throw new Exception("Test failed"); + + } +}

@@ -76,7 +76,7 @@ a:visited,a:visited code{color:#917E9C}
  -

Oracle 尊重您的隐私。我们会将您的个人信息用于通信和 Sun 联机帐户的管理、Sun 联机帐户访问的服务和应用程序以及用于使用 Sun 联机帐户注册的产品和系统。

+

Oracle 尊重您的隐私。我们会将您的个人信息用于通信和 Oracle.com 帐户的管理、Oracle.com 帐户访问的服务和应用程序以及用于使用 Oracle.com 帐户注册的产品和系统。

有关注册过程中收集的数据以及这些数据的管理方式的更多信息,
请访问 http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

有关 Oracle 隐私政策的更多信息,请访问 http://www.oracle.com/html/privacy.html 或与 privacy_ww@oracle.com 联系。