diff --git a/jdk/make/Setup.gmk b/jdk/make/Setup.gmk index 4fb3ad21b05..aab0adec464 100644 --- a/jdk/make/Setup.gmk +++ b/jdk/make/Setup.gmk @@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,- # To build with all warnings enabled, do the following: # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" -JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,overloads,static,try,varargs -Werror +JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,overloads,serial,static,try,varargs -Werror # Any java code executed during a JDK build to build other parts of the JDK must be # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION index 8ab96a77e71..1c96650f231 100644 --- a/jdk/make/data/tzdata/VERSION +++ b/jdk/make/data/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2014a +tzdata2014b diff --git a/jdk/make/data/tzdata/africa b/jdk/make/data/tzdata/africa index 82d14a4a14d..3198e1cc209 100644 --- a/jdk/make/data/tzdata/africa +++ b/jdk/make/data/tzdata/africa @@ -891,7 +891,10 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou # Another source (specifying the time for start and end in the decree): # http://www.lemag.ma/Heure-d-ete-au-Maroc-jusqu-au-27-octobre_a75620.html -# From Paul Eggert (2013-10-03): +# From Sebastien Willemijns (2014-03-18): +# http://www.afriquinfos.com/articles/2014/3/18/maroc-heure-dete-avancez-tous-horloges-247891.asp + +# From Paul Eggert (2014-03-19): # To estimate what the Moroccan government will do in future years, # transition dates for 2014 through 2038 were determined by running # the following program under GNU Emacs 24.3: diff --git a/jdk/make/data/tzdata/antarctica b/jdk/make/data/tzdata/antarctica index f30cf747f10..e31bada94fb 100644 --- a/jdk/make/data/tzdata/antarctica +++ b/jdk/make/data/tzdata/antarctica @@ -253,24 +253,41 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 29 # year-round base # Scott Base, Ross Island, since 1957-01. # See Pacific/Auckland. -# -# These rules for New Zealand are stolen from the 'australasia' file. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NZAQ 1974 only - Nov 3 2:00s 1:00 D -Rule NZAQ 1975 1988 - Oct lastSun 2:00s 1:00 D -Rule NZAQ 1989 only - Oct 8 2:00s 1:00 D -Rule NZAQ 1990 2006 - Oct Sun>=1 2:00s 1:00 D -Rule NZAQ 1975 only - Feb 23 2:00s 0 S -Rule NZAQ 1976 1989 - Mar Sun>=1 2:00s 0 S -Rule NZAQ 1990 2007 - Mar Sun>=15 2:00s 0 S -Rule NZAQ 2007 max - Sep lastSun 2:00s 1:00 D -Rule NZAQ 2008 max - Apr Sun>=1 2:00s 0 S # Norway - territories # Bouvet (never inhabited) # # claims # Peter I Island (never inhabited) +# +# year-round base +# Troll, Queen Maud Land, -720041+0023206, since 2005-02-12 +# +# From Paul-Inge Flakstad (2014-03-10): +# I recently had a long dialog about this with the developer of timegenie.com. +# In the absence of specific dates, he decided to choose some likely ones: +# GMT +1 - From March 1 to the last Sunday in March +# GMT +2 - From the last Sunday in March until the last Sunday in October +# GMT +1 - From the last Sunday in October until November 7 +# GMT +0 - From November 7 until March 1 +# The dates for switching to and from UTC+0 will probably not be absolutely +# correct, but they should be quite close to the actual dates. +# +# From Paul Eggert (2014-03-21): +# The CET-switching Troll rules require zic from tzcode 2014b or later, so as +# suggested by Bengt-Inge Larsson comment them out for now, and approximate +# with only UTC and CEST. Uncomment them when 2014b is more prevalent. +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Troll 2005 max - Mar 1 1:00u 1:00 CET +Rule Troll 2005 max - Mar lastSun 1:00u 2:00 CEST +#Rule Troll 2005 max - Oct lastSun 1:00u 1:00 CET +#Rule Troll 2004 max - Nov 7 1:00u 0:00 UTC +# Remove the following line when uncommenting the above '#Rule' lines. +Rule Troll 2004 max - Oct lastSun 1:00u 0:00 UTC +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Antarctica/Troll 0 - zzz 2005 Feb 12 + 0:00 Troll %s # Poland - year-round base # Arctowski, King George Island, -620945-0582745, since 1977 diff --git a/jdk/make/data/tzdata/australasia b/jdk/make/data/tzdata/australasia index a0e8b5a2ce9..94c9adb912c 100644 --- a/jdk/make/data/tzdata/australasia +++ b/jdk/make/data/tzdata/australasia @@ -786,14 +786,29 @@ Zone Pacific/Funafuti 11:56:52 - LMT 1901 # Johnston # -# From Paul Eggert (2013-09-03): +# From Paul Eggert (2014-03-11): +# Sometimes Johnston kept Hawaii time, and sometimes it was an hour behind. +# Details are uncertain. We have no data for Johnston after 1970, so +# treat it like Hawaii for now. +# # In his memoirs of June 6th to October 4, 1945 # (2005), Herbert C. Bach writes, # "We started our letdown to Kwajalein Atoll and landed there at 5:00 AM # Johnston time, 1:30 AM Kwajalein time." This was in June 1945, and # confirms that Johnston kept the same time as Honolulu in summer 1945. -# We have no better information, so for now, assume this has been true -# indefinitely into the past. +# +# From Lyle McElhaney (2014-03-11): +# [W]hen JI was being used for that [atomic bomb] testing, the time being used +# was not Hawaiian time but rather the same time being used on the ships, +# which had a GMT offset of -11 hours. This apparently applied to at least the +# time from Operation Newsreel (Hardtack I/Teak shot, 1958-08-01) to the last +# Operation Fishbowl shot (Tightrope, 1962-11-04).... [See] Herman Hoerlin, +# "The United States High-Altitude Test Experience: A Review Emphasizing the +# Impact on the Environment", Los Alamos LA-6405, Oct 1976 +# . +# See the table on page 4 where he lists GMT and local times for the tests; a +# footnote for the JI tests reads that local time is "JI time = Hawaii Time +# Minus One Hour". # # See 'northamerica' for Pacific/Johnston. diff --git a/jdk/make/data/tzdata/europe b/jdk/make/data/tzdata/europe index 585e64d14fa..2b0c5613e60 100644 --- a/jdk/make/data/tzdata/europe +++ b/jdk/make/data/tzdata/europe @@ -2986,7 +2986,11 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 # Assume it happened in March by not changing the clocks. 3:00 Russia MSK/MSD 1997 3:00 - MSK 1997 Mar lastSun 1:00u - 2:00 EU EE%sT +# From Alexander Krivenyshev (2014-03-17): +# time change at 2:00 (2am) on March 30, 2014 +# http://vz.ru/news/2014/3/17/677464.html + 2:00 EU EE%sT 2014 Mar 30 2:00 + 4:00 - MSK # Vatican City # See Europe/Rome. diff --git a/jdk/make/data/tzdata/leapseconds b/jdk/make/data/tzdata/leapseconds index faf5319d408..b423135b942 100644 --- a/jdk/make/data/tzdata/leapseconds +++ b/jdk/make/data/tzdata/leapseconds @@ -20,7 +20,7 @@ # 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. - +# # Allowance for leapseconds added to each timezone file. # This file is in the public domain. diff --git a/jdk/make/data/tzdata/zone.tab b/jdk/make/data/tzdata/zone.tab index b34cdb0dc7d..7cec627fd95 100644 --- a/jdk/make/data/tzdata/zone.tab +++ b/jdk/make/data/tzdata/zone.tab @@ -74,6 +74,7 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula AQ -7824+10654 Antarctica/Vostok Vostok Station, Lake Vostok AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I +AQ -720041+0023206 Antarctica/Troll Troll Station, Queen Maud Land AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF) AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF) AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN) @@ -366,6 +367,7 @@ RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad RU +5545+03735 Europe/Moscow Moscow+00 - west Russia RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea RU +5312+05009 Europe/Samara Moscow+00 - Samara, Udmurtia +RU +4457+03406 Europe/Simferopol Moscow+00 - Crimea RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk @@ -421,7 +423,6 @@ TZ -0648+03917 Africa/Dar_es_Salaam UA +5026+03031 Europe/Kiev most locations UA +4837+02218 Europe/Uzhgorod Ruthenia UA +4750+03510 Europe/Zaporozhye Zaporozh'ye, E Lugansk / Zaporizhia, E Luhansk -UA +4457+03406 Europe/Simferopol central Crimea UG +0019+03225 Africa/Kampala UM +1645-16931 Pacific/Johnston Johnston Atoll UM +2813-17722 Pacific/Midway Midway Islands diff --git a/jdk/src/share/classes/com/oracle/net/Sdp.java b/jdk/src/share/classes/com/oracle/net/Sdp.java deleted file mode 100644 index d22a95ed120..00000000000 --- a/jdk/src/share/classes/com/oracle/net/Sdp.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2010, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -package com.oracle.net; - -import java.net.Socket; -import java.net.ServerSocket; -import java.net.SocketImpl; -import java.net.SocketImplFactory; -import java.net.SocketException; -import java.nio.channels.SocketChannel; -import java.nio.channels.ServerSocketChannel; -import java.io.IOException; -import java.io.FileDescriptor; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.lang.reflect.Constructor; -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.InvocationTargetException; - -import sun.net.sdp.SdpSupport; - -/** - * This class consists exclusively of static methods that Sockets or Channels to - * sockets that support the InfiniBand Sockets Direct Protocol (SDP). - */ - -public final class Sdp { - private Sdp() { } - - /** - * The package-privage ServerSocket(SocketImpl) constructor - */ - private static final Constructor serverSocketCtor; - static { - try { - serverSocketCtor = - ServerSocket.class.getDeclaredConstructor(SocketImpl.class); - setAccessible(serverSocketCtor); - } catch (NoSuchMethodException e) { - throw new AssertionError(e); - } - } - - /** - * The package-private SdpSocketImpl() constructor - */ - private static final Constructor socketImplCtor; - static { - try { - Class cl = Class.forName("java.net.SdpSocketImpl", true, null); - socketImplCtor = (Constructor)cl.getDeclaredConstructor(); - setAccessible(socketImplCtor); - } catch (ClassNotFoundException e) { - throw new AssertionError(e); - } catch (NoSuchMethodException e) { - throw new AssertionError(e); - } - } - - private static void setAccessible(final AccessibleObject o) { - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - o.setAccessible(true); - return null; - } - }); - } - - /** - * SDP enabled Socket. - */ - private static class SdpSocket extends Socket { - SdpSocket(SocketImpl impl) throws SocketException { - super(impl); - } - } - - /** - * Creates a SDP enabled SocketImpl - */ - private static SocketImpl createSocketImpl() { - try { - return socketImplCtor.newInstance(); - } catch (InstantiationException x) { - throw new AssertionError(x); - } catch (IllegalAccessException x) { - throw new AssertionError(x); - } catch (InvocationTargetException x) { - throw new AssertionError(x); - } - } - - /** - * Creates an unconnected and unbound SDP socket. The {@code Socket} is - * associated with a {@link java.net.SocketImpl} of the system-default type. - * - * @return a new Socket - * - * @throws UnsupportedOperationException - * If SDP is not supported - * @throws IOException - * If an I/O error occurs - */ - public static Socket openSocket() throws IOException { - SocketImpl impl = createSocketImpl(); - return new SdpSocket(impl); - } - - /** - * Creates an unbound SDP server socket. The {@code ServerSocket} is - * associated with a {@link java.net.SocketImpl} of the system-default type. - * - * @return a new ServerSocket - * - * @throws UnsupportedOperationException - * If SDP is not supported - * @throws IOException - * If an I/O error occurs - */ - public static ServerSocket openServerSocket() throws IOException { - // create ServerSocket via package-private constructor - SocketImpl impl = createSocketImpl(); - try { - return serverSocketCtor.newInstance(impl); - } catch (IllegalAccessException x) { - throw new AssertionError(x); - } catch (InstantiationException x) { - throw new AssertionError(x); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - if (cause instanceof IOException) - throw (IOException)cause; - if (cause instanceof RuntimeException) - throw (RuntimeException)cause; - throw new RuntimeException(x); - } - } - - /** - * Opens a socket channel to a SDP socket. - * - *

The channel will be associated with the system-wide default - * {@link java.nio.channels.spi.SelectorProvider SelectorProvider}. - * - * @return a new SocketChannel - * - * @throws UnsupportedOperationException - * If SDP is not supported or not supported by the default selector - * provider - * @throws IOException - * If an I/O error occurs. - */ - public static SocketChannel openSocketChannel() throws IOException { - FileDescriptor fd = SdpSupport.createSocket(); - return sun.nio.ch.Secrets.newSocketChannel(fd); - } - - /** - * Opens a socket channel to a SDP socket. - * - *

The channel will be associated with the system-wide default - * {@link java.nio.channels.spi.SelectorProvider SelectorProvider}. - * - * @return a new ServerSocketChannel - * - * @throws UnsupportedOperationException - * If SDP is not supported or not supported by the default selector - * provider - * @throws IOException - * If an I/O error occurs - */ - public static ServerSocketChannel openServerSocketChannel() - throws IOException - { - FileDescriptor fd = SdpSupport.createSocket(); - return sun.nio.ch.Secrets.newServerSocketChannel(fd); - } -} diff --git a/jdk/src/share/classes/com/sun/crypto/provider/RSACipher.java b/jdk/src/share/classes/com/sun/crypto/provider/RSACipher.java index 6902d4b8b31..d1d8cf3ef23 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/RSACipher.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/RSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -39,6 +39,8 @@ import javax.crypto.spec.OAEPParameterSpec; import sun.security.rsa.*; import sun.security.jca.Providers; +import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; +import sun.security.util.KeyUtil; /** * RSA cipher implementation. Supports RSA en/decryption and signing/verifying @@ -91,8 +93,8 @@ public final class RSACipher extends CipherSpi { // padding object private RSAPadding padding; - // cipher parameter for OAEP padding - private OAEPParameterSpec spec = null; + // cipher parameter for OAEP padding and TLS RSA premaster secret + private AlgorithmParameterSpec spec = null; // buffer for the data private byte[] buffer; @@ -110,6 +112,9 @@ public final class RSACipher extends CipherSpi { // hash algorithm for OAEP private String oaepHashAlgorithm = "SHA-1"; + // the source of randomness + private SecureRandom random; + public RSACipher() { paddingType = PAD_PKCS1; } @@ -175,7 +180,7 @@ public final class RSACipher extends CipherSpi { // see JCE spec protected AlgorithmParameters engineGetParameters() { - if (spec != null) { + if (spec != null && spec instanceof OAEPParameterSpec) { try { AlgorithmParameters params = AlgorithmParameters.getInstance("OAEP", @@ -276,8 +281,13 @@ public final class RSACipher extends CipherSpi { buffer = new byte[n]; } else if (paddingType == PAD_PKCS1) { if (params != null) { - throw new InvalidAlgorithmParameterException - ("Parameters not supported"); + if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new InvalidAlgorithmParameterException( + "Parameters not supported"); + } + + spec = params; + this.random = random; // for TLS RSA premaster secret } int blockType = (mode <= MODE_DECRYPT) ? RSAPadding.PAD_BLOCKTYPE_2 : RSAPadding.PAD_BLOCKTYPE_1; @@ -293,19 +303,18 @@ public final class RSACipher extends CipherSpi { throw new InvalidKeyException ("OAEP cannot be used to sign or verify signatures"); } - OAEPParameterSpec myParams; if (params != null) { if (!(params instanceof OAEPParameterSpec)) { throw new InvalidAlgorithmParameterException ("Wrong Parameters for OAEP Padding"); } - myParams = (OAEPParameterSpec) params; + spec = params; } else { - myParams = new OAEPParameterSpec(oaepHashAlgorithm, "MGF1", + spec = new OAEPParameterSpec(oaepHashAlgorithm, "MGF1", MGF1ParameterSpec.SHA1, PSource.PSpecified.DEFAULT); } padding = RSAPadding.getInstance(RSAPadding.PAD_OAEP_MGF1, n, - random, myParams); + random, (OAEPParameterSpec)spec); if (encrypt) { int k = padding.getMaxDataSize(); buffer = new byte[k]; @@ -420,17 +429,40 @@ public final class RSACipher extends CipherSpi { if (wrappedKey.length > buffer.length) { throw new InvalidKeyException("Key is too long for unwrapping"); } + + boolean isTlsRsaPremasterSecret = + algorithm.equals("TlsRsaPremasterSecret"); + Exception failover = null; + byte[] encoded = null; + update(wrappedKey, 0, wrappedKey.length); try { - byte[] encoded = doFinal(); - return ConstructKeys.constructKey(encoded, algorithm, type); + encoded = doFinal(); } catch (BadPaddingException e) { - // should not occur - throw new InvalidKeyException("Unwrapping failed", e); + if (isTlsRsaPremasterSecret) { + failover = e; + } else { + throw new InvalidKeyException("Unwrapping failed", e); + } } catch (IllegalBlockSizeException e) { // should not occur, handled with length check above throw new InvalidKeyException("Unwrapping failed", e); } + + if (isTlsRsaPremasterSecret) { + if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new IllegalStateException( + "No TlsRsaPremasterSecretParameterSpec specified"); + } + + // polish the TLS premaster secret + encoded = KeyUtil.checkTlsPreMasterSecretKey( + ((TlsRsaPremasterSecretParameterSpec)spec).getClientVersion(), + ((TlsRsaPremasterSecretParameterSpec)spec).getServerVersion(), + random, encoded, (failover != null)); + } + + return ConstructKeys.constructKey(encoded, algorithm, type); } // see JCE spec @@ -438,5 +470,4 @@ public final class RSACipher extends CipherSpi { RSAKey rsaKey = RSAKeyFactory.toRSAKey(key); return rsaKey.getModulus().bitLength(); } - } diff --git a/jdk/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java b/jdk/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java index ef9098f24f7..2a25cb64d5c 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -56,7 +56,7 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { - if (params instanceof TlsRsaPremasterSecretParameterSpec == false) { + if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsRsaPremasterSecretParameterSpec)params; @@ -67,21 +67,20 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { throw new InvalidParameterException(MSG); } + // Only can be used in client side to generate TLS RSA premaster secret. protected SecretKey engineGenerateKey() { if (spec == null) { throw new IllegalStateException( "TlsRsaPremasterSecretGenerator must be initialized"); } - byte[] b = spec.getEncodedSecret(); - if (b == null) { - if (random == null) { - random = new SecureRandom(); - } - b = new byte[48]; - random.nextBytes(b); - b[0] = (byte)spec.getMajorVersion(); - b[1] = (byte)spec.getMinorVersion(); + + if (random == null) { + random = new SecureRandom(); } + byte[] b = new byte[48]; + random.nextBytes(b); + b[0] = (byte)spec.getMajorVersion(); + b[1] = (byte)spec.getMinorVersion(); return new SecretKeySpec(b, "TlsRsaPremasterSecret"); } diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/Enumerated.java b/jdk/src/share/classes/com/sun/jmx/snmp/Enumerated.java index bc39e6f2141..cc3d29bbb1a 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/Enumerated.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/Enumerated.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, 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 @@ -45,7 +45,7 @@ import java.util.*; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ - +@SuppressWarnings("serial") // JDK implementation class abstract public class Enumerated implements Serializable { /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/Host.java b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/Host.java index 8a92692ac87..b502f79509a 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/Host.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/Host.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -44,6 +44,7 @@ import static com.sun.jmx.defaults.JmxProperties.SNMP_LOGGER; * The class defines an abstract representation of a host. * */ +@SuppressWarnings("serial") // JDK implementation class abstract class Host extends SimpleNode implements Serializable { public Host(int id) { diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPdu.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPdu.java index 512fb4eeb68..77a4ed35a70 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPdu.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPdu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -45,6 +45,7 @@ import java.net.InetAddress; * * @since 1.5 */ +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpPdu implements SnmpDefinitions, Serializable { /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpScopedPduPacket.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpScopedPduPacket.java index 8917745e225..934980ffce4 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpScopedPduPacket.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpScopedPduPacket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -47,6 +47,7 @@ import com.sun.jmx.snmp.SnmpDefinitions; * * @since 1.5 */ +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpScopedPduPacket extends SnmpPdu implements Serializable { /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpUnsignedInt.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpUnsignedInt.java index f681742c6ad..58002102823 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpUnsignedInt.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpUnsignedInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -34,7 +34,7 @@ package com.sun.jmx.snmp; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ - +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpUnsignedInt extends SnmpInt { /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpValue.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpValue.java index 9afac04617e..93745190800 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpValue.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -38,7 +38,7 @@ import java.io.Serializable; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ - +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpValue implements Cloneable, Serializable, SnmpDataTypeEnums { /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java index 4e54f68d381..bc993761297 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -59,6 +59,7 @@ import com.sun.jmx.snmp.SnmpStatusException; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpMib extends SnmpMibAgent implements Serializable { /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java index 16b26785af8..74e4369f98c 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -59,7 +59,7 @@ import com.sun.jmx.snmp.SnmpEngine; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ - +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpMibAgent implements SnmpMibAgentMBean, MBeanRegistration, Serializable { diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java index 018ce2f089f..1988cf0a149 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -41,7 +41,7 @@ import com.sun.jmx.snmp.SnmpStatusException; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ - +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpMibEntry extends SnmpMibNode implements Serializable { diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java index 896b612eb12..b689ef287e7 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -49,7 +49,7 @@ import com.sun.jmx.snmp.SnmpStatusException; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ - +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpMibGroup extends SnmpMibOid implements Serializable { diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java index 3af24a9cd4f..f7cc326aa96 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -53,7 +53,7 @@ import com.sun.jmx.snmp.SnmpStatusException; *

This API is a Sun Microsystems internal API and is subject * to change without notice.

*/ - +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpMibNode implements Serializable { // --------------------------------------------------------------------- diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java index 9b8f43d9a5a..525500d26c8 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -84,7 +84,7 @@ import com.sun.jmx.snmp.SnmpVarBind; * @see com.sun.jmx.snmp.agent.SnmpTableSupport * */ - +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpMibTable extends SnmpMibNode implements NotificationBroadcaster, Serializable { diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java index bc0214c4eb3..9759f9b6d8f 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -80,6 +80,7 @@ import com.sun.jmx.snmp.SnmpStatusException; * @see com.sun.jmx.snmp.agent.SnmpMibTable * */ +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpTableSupport implements SnmpTableEntryFactory, // NPCTE fix for bugId 4499265, esc 0, MR 04 sept 2001 // SnmpTableCallbackHandler { diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java index a3359bdc675..137a5d4ae25 100644 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java @@ -108,6 +108,7 @@ public class ResolverDirectHTTP extends ResourceResolverSpi { @Override public XMLSignatureInput engineResolveURI(ResourceResolverContext context) throws ResourceResolverException { + InputStream inputStream = null; try { // calculate new URI @@ -139,7 +140,7 @@ public class ResolverDirectHTTP extends ResourceResolverSpi { } String mimeType = urlConnection.getHeaderField("Content-Type"); - InputStream inputStream = urlConnection.getInputStream(); + inputStream = urlConnection.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte buf[] = new byte[4096]; int read = 0; @@ -168,6 +169,16 @@ public class ResolverDirectHTTP extends ResourceResolverSpi { throw new ResourceResolverException("generic.EmptyMessage", ex, context.attr, context.baseUri); } catch (IllegalArgumentException e) { throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + if (log.isLoggable(java.util.logging.Level.FINE)) { + log.log(java.util.logging.Level.FINE, e.getMessage(), e); + } + } + } } } diff --git a/jdk/src/share/classes/java/awt/BorderLayout.java b/jdk/src/share/classes/java/awt/BorderLayout.java index 807531034fb..c86fd512134 100644 --- a/jdk/src/share/classes/java/awt/BorderLayout.java +++ b/jdk/src/share/classes/java/awt/BorderLayout.java @@ -115,7 +115,7 @@ import java.util.Hashtable; * } * } *
- *

+ * * @author Arthur van Hoff * @see java.awt.Container#add(String, Component) * @see java.awt.ComponentOrientation @@ -414,8 +414,7 @@ public class BorderLayout implements LayoutManager2, * the component is added to the layout. * @see java.awt.Container#add(java.awt.Component, java.lang.Object) * @exception IllegalArgumentException if the constraint object is not - * a string, or if it not one of the five specified - * constants. + * a string, or if it not one of the five specified constants. * @since JDK1.1 */ public void addLayoutComponent(Component comp, Object constraints) { diff --git a/jdk/src/share/classes/java/awt/CheckboxGroup.java b/jdk/src/share/classes/java/awt/CheckboxGroup.java index 7037e685337..53a8bb5fd7a 100644 --- a/jdk/src/share/classes/java/awt/CheckboxGroup.java +++ b/jdk/src/share/classes/java/awt/CheckboxGroup.java @@ -49,7 +49,7 @@ package java.awt; * Shows three checkboxes, arranged vertically, labeled one, two, and three. Checkbox one is in the on state. - *

+ * * @author Sami Shaio * @see java.awt.Checkbox * @since JDK1.0 diff --git a/jdk/src/share/classes/java/awt/Choice.java b/jdk/src/share/classes/java/awt/Choice.java index 1a75f903c3d..8cd6bdbdc1d 100644 --- a/jdk/src/share/classes/java/awt/Choice.java +++ b/jdk/src/share/classes/java/awt/Choice.java @@ -65,7 +65,7 @@ import javax.accessibility.*; * Native GUI Choice components' size are often bound by such * attributes as font size and length of items contained within * the Choice. - *

+ * * @author Sami Shaio * @author Arthur van Hoff * @since JDK1.0 diff --git a/jdk/src/share/classes/java/awt/EventQueue.java b/jdk/src/share/classes/java/awt/EventQueue.java index 0c009a17f67..ee553ecba3e 100644 --- a/jdk/src/share/classes/java/awt/EventQueue.java +++ b/jdk/src/share/classes/java/awt/EventQueue.java @@ -680,7 +680,7 @@ public class EventQueue { * No action (ignored) * * - *

+ * * @param event an instance of java.awt.AWTEvent, * or a subclass of it * @throws NullPointerException if event is null @@ -1015,7 +1015,6 @@ public class EventQueue { * methods to execute a task in * {@link Toolkit#getSystemEventQueue the current AWT EventQueue}'s * dispatch thread. - *

* * @return true if running in * {@link Toolkit#getSystemEventQueue the current AWT EventQueue}'s diff --git a/jdk/src/share/classes/java/awt/GridBagLayoutInfo.java b/jdk/src/share/classes/java/awt/GridBagLayoutInfo.java index a7d259c77ff..f92cc7098b0 100644 --- a/jdk/src/share/classes/java/awt/GridBagLayoutInfo.java +++ b/jdk/src/share/classes/java/awt/GridBagLayoutInfo.java @@ -29,7 +29,7 @@ package java.awt; * The {@code GridBagLayoutInfo} is an utility class for * {@code GridBagLayout} layout manager. * It stores align, size and baseline parameters for every component within a container. - *

+ * * @see java.awt.GridBagLayout * @see java.awt.GridBagConstraints * @since 1.6 diff --git a/jdk/src/share/classes/java/awt/Robot.java b/jdk/src/share/classes/java/awt/Robot.java index 39534898521..cc734dd45a2 100644 --- a/jdk/src/share/classes/java/awt/Robot.java +++ b/jdk/src/share/classes/java/awt/Robot.java @@ -76,7 +76,6 @@ public class Robot { /** * Constructs a Robot object in the coordinate system of the primary screen. - *

* * @throws AWTException if the platform configuration does not allow * low-level input control. This exception is always thrown when diff --git a/jdk/src/share/classes/java/awt/TextArea.java b/jdk/src/share/classes/java/awt/TextArea.java index 34b21379901..f86de9a9c49 100644 --- a/jdk/src/share/classes/java/awt/TextArea.java +++ b/jdk/src/share/classes/java/awt/TextArea.java @@ -49,7 +49,7 @@ import javax.accessibility.*; *


  * new TextArea("Hello", 5, 40);
  * 

- *

+ * * @author Sami Shaio * @since JDK1.0 */ diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index f13005d97d4..90f9f24d147 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -2590,7 +2590,7 @@ public abstract class Toolkit { * If not set by the time of the {@code Toolkit} class initialization, this property will be * initialized with {@code true}. * Changing this value after the {@code Toolkit} class initialization will have no effect. - *

+ * * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true * @return {@code true} if events from extra mouse buttons are allowed to be processed and posted; * {@code false} otherwise diff --git a/jdk/src/share/classes/java/awt/TrayIcon.java b/jdk/src/share/classes/java/awt/TrayIcon.java index 22f02cf6c87..5199b0cc064 100644 --- a/jdk/src/share/classes/java/awt/TrayIcon.java +++ b/jdk/src/share/classes/java/awt/TrayIcon.java @@ -231,7 +231,7 @@ public class TrayIcon { /** * Sets the image for this TrayIcon. The previous * tray icon image is discarded without calling the {@link - * java.awt.Image#flush} method — you will need to call it + * java.awt.Image#flush} method — you will need to call it * manually. * *

If the image represents an animated image, it will be @@ -368,7 +368,7 @@ public class TrayIcon { * *

If auto-size is false, and the image size * doesn't match the tray icon space, the image is painted as-is - * inside that space — if larger than the allocated space, it will + * inside that space — if larger than the allocated space, it will * be cropped. * *

If auto-size is true, the image is stretched or shrunk to diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index 6b8cb17233a..801b643a15e 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -2550,7 +2550,7 @@ public class Window extends Container implements Accessible { * a non-focusable Window. * * Setting the focusability state on a visible {@code Window} - * can have a delayed effect on some platforms — the actual + * can have a delayed effect on some platforms — the actual * change may happen only when the {@code Window} becomes * hidden and then visible again. To ensure consistent behavior * across platforms, set the {@code Window}'s focusable state diff --git a/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java b/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java index 45517c37b23..747b3d21deb 100644 --- a/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java +++ b/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java @@ -85,7 +85,7 @@ public interface InputMethodContext extends InputMethodRequests { *

* Input methods must call {@link java.awt.Window#dispose() Window.dispose} on the * returned input method window when it is no longer needed. - *

+ * * @param title the title to be displayed in the window's title bar, * if there is such a title bar. * A null value is treated as an empty string, "". @@ -117,7 +117,7 @@ public interface InputMethodContext extends InputMethodRequests { *

* Input methods must call {@link java.awt.Window#dispose() Window.dispose} on the * returned input method window when it is no longer needed. - *

+ * * @param title the title to be displayed in the window's title bar, * if there is such a title bar. * A null value is treated as an empty string, "". diff --git a/jdk/src/share/classes/java/net/DatagramSocket.java b/jdk/src/share/classes/java/net/DatagramSocket.java index 1e095dec731..31344b4391c 100644 --- a/jdk/src/share/classes/java/net/DatagramSocket.java +++ b/jdk/src/share/classes/java/net/DatagramSocket.java @@ -104,7 +104,7 @@ class DatagramSocket implements java.io.Closeable { /** * Connects this socket to a remote socket address (IP address + port number). * Binds socket if not already bound. - *

+ * * @param address The remote address. * @param port The remote port * @throws SocketException if binding the socket fails. @@ -338,7 +338,7 @@ class DatagramSocket implements java.io.Closeable { *

* If the address is {@code null}, then the system will pick up * an ephemeral port and a valid local address to bind the socket. - *

+ * * @param addr The address and port to bind to. * @throws SocketException if any error happens during the bind, or if the * socket is already bound. @@ -1240,10 +1240,8 @@ class DatagramSocket implements java.io.Closeable { * datagram socket factory. * @exception SocketException if the factory is already defined. * @exception SecurityException if a security manager exists and its - * {@code checkSetFactory} method doesn't allow the - operation. - * @see - java.net.DatagramSocketImplFactory#createDatagramSocketImpl() + * {@code checkSetFactory} method doesn't allow the operation. + * @see java.net.DatagramSocketImplFactory#createDatagramSocketImpl() * @see SecurityManager#checkSetFactory * @since 1.3 */ diff --git a/jdk/src/share/classes/java/net/InetSocketAddress.java b/jdk/src/share/classes/java/net/InetSocketAddress.java index e8a804fa601..87fce160fb2 100644 --- a/jdk/src/share/classes/java/net/InetSocketAddress.java +++ b/jdk/src/share/classes/java/net/InetSocketAddress.java @@ -157,7 +157,7 @@ public class InetSocketAddress * A valid port value is between 0 and 65535. * A port number of {@code zero} will let the system pick up an * ephemeral port in a {@code bind} operation. - *

+ * * @param port The port number * @throws IllegalArgumentException if the port parameter is outside the specified * range of valid port values. @@ -175,7 +175,7 @@ public class InetSocketAddress * ephemeral port in a {@code bind} operation. *

* A {@code null} address will assign the wildcard address. - *

+ * * @param addr The IP address * @param port The port number * @throws IllegalArgumentException if the port parameter is outside the specified @@ -202,7 +202,7 @@ public class InetSocketAddress * A valid port value is between 0 and 65535. * A port number of {@code zero} will let the system pick up an * ephemeral port in a {@code bind} operation. - *

+ * * @param hostname the Host name * @param port The port number * @throws IllegalArgumentException if the port parameter is outside the range @@ -239,7 +239,7 @@ public class InetSocketAddress * A valid port value is between 0 and 65535. * A port number of {@code zero} will let the system pick up an * ephemeral port in a {@code bind} operation. - *

+ * * @param host the Host name * @param port The port number * @throws IllegalArgumentException if the port parameter is outside diff --git a/jdk/src/share/classes/java/net/SdpSocketImpl.java b/jdk/src/share/classes/java/net/SdpSocketImpl.java deleted file mode 100644 index b5b023e2433..00000000000 --- a/jdk/src/share/classes/java/net/SdpSocketImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -package java.net; - -import java.io.IOException; -import java.io.FileDescriptor; - -import sun.net.sdp.SdpSupport; - -/** - * SocketImpl that supports the SDP protocol - */ -class SdpSocketImpl extends PlainSocketImpl { - SdpSocketImpl() { } - - @Override - protected void create(boolean stream) throws IOException { - if (!stream) - throw new UnsupportedOperationException("Must be a stream socket"); - fd = SdpSupport.createSocket(); - if (socket != null) - socket.setCreated(); - if (serverSocket != null) - serverSocket.setCreated(); - } -} diff --git a/jdk/src/share/classes/java/net/ServerSocket.java b/jdk/src/share/classes/java/net/ServerSocket.java index 2ee3420d548..e94790dd620 100644 --- a/jdk/src/share/classes/java/net/ServerSocket.java +++ b/jdk/src/share/classes/java/net/ServerSocket.java @@ -157,7 +157,6 @@ class ServerSocket implements java.io.Closeable { * or may choose to ignore the parameter altogther. The value provided * should be greater than {@code 0}. If it is less than or equal to * {@code 0}, then an implementation specific default will be used. - *

* * @param port the port number, or {@code 0} to use a port * number that is automatically allocated. @@ -206,7 +205,7 @@ class ServerSocket implements java.io.Closeable { * or may choose to ignore the parameter altogther. The value provided * should be greater than {@code 0}. If it is less than or equal to * {@code 0}, then an implementation specific default will be used. - *

+ * * @param port the port number, or {@code 0} to use a port * number that is automatically allocated. * @param backlog requested maximum length of the queue of incoming @@ -315,7 +314,7 @@ class ServerSocket implements java.io.Closeable { *

* If the address is {@code null}, then the system will pick up * an ephemeral port and a valid local address to bind the socket. - *

+ * * @param endpoint The IP address and port number to bind to. * @throws IOException if the bind operation fails, or if the socket * is already bound. diff --git a/jdk/src/share/classes/java/net/Socket.java b/jdk/src/share/classes/java/net/Socket.java index dedc8ca1b85..b6df988d14b 100644 --- a/jdk/src/share/classes/java/net/Socket.java +++ b/jdk/src/share/classes/java/net/Socket.java @@ -153,7 +153,7 @@ class Socket implements java.io.Closeable { /** * Creates an unconnected Socket with a user-specified * SocketImpl. - *

+ * * @param impl an instance of a SocketImpl * the subclass wishes to use on the Socket. * @@ -1245,7 +1245,7 @@ class Socket implements java.io.Closeable { *

    *
  1. For sockets accepted from a ServerSocket, this must be done by calling * {@link ServerSocket#setReceiveBufferSize(int)} before the ServerSocket - * is bound to a local address.

  2. + * is bound to a local address. *
  3. For client sockets, setReceiveBufferSize() must be called before * connecting the socket to its remote peer.
* @param size the size to which to set the receive buffer diff --git a/jdk/src/share/classes/java/net/SocketOptions.java b/jdk/src/share/classes/java/net/SocketOptions.java index 7e1b0fc85b6..cd1539c3530 100644 --- a/jdk/src/share/classes/java/net/SocketOptions.java +++ b/jdk/src/share/classes/java/net/SocketOptions.java @@ -38,7 +38,7 @@ import java.lang.annotation.Native; * DatagramSocketImpl, you won't use these directly. There are * type-safe methods to get/set each of these options in Socket, ServerSocket, * DatagramSocket and MulticastSocket. - *

+ * * @author David Brown */ diff --git a/jdk/src/share/classes/java/net/SocketPermission.java b/jdk/src/share/classes/java/net/SocketPermission.java index 0f720c52283..51777d90385 100644 --- a/jdk/src/share/classes/java/net/SocketPermission.java +++ b/jdk/src/share/classes/java/net/SocketPermission.java @@ -1001,7 +1001,7 @@ public final class SocketPermission extends Permission /** * Checks two SocketPermission objects for equality. - *

+ * * @param obj the object to test for equality with this object. * * @return true if obj is a SocketPermission, and has the diff --git a/jdk/src/share/classes/java/net/URI.java b/jdk/src/share/classes/java/net/URI.java index 813de5cf453..0a05793b9a9 100644 --- a/jdk/src/share/classes/java/net/URI.java +++ b/jdk/src/share/classes/java/net/URI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -1337,7 +1337,7 @@ public final class URI */ public String getQuery() { if ((decodedQuery == null) && (query != null)) - decodedQuery = decode(query); + decodedQuery = decode(query, false); return decodedQuery; } @@ -1366,7 +1366,7 @@ public final class URI */ public String getFragment() { if ((decodedFragment == null) && (fragment != null)) - decodedFragment = decode(fragment); + decodedFragment = decode(fragment, false); return decodedFragment; } @@ -2764,6 +2764,12 @@ public final class URI // with a scope_id // private static String decode(String s) { + return decode(s, true); + } + + // This method was introduced as a generalization of URI.decode method + // to provide a fix for JDK-8037396 + private static String decode(String s, boolean ignorePercentInBrackets) { if (s == null) return s; int n = s.length(); @@ -2776,8 +2782,8 @@ public final class URI ByteBuffer bb = ByteBuffer.allocate(n); CharBuffer cb = CharBuffer.allocate(n); CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8") - .onMalformedInput(CodingErrorAction.REPLACE) - .onUnmappableCharacter(CodingErrorAction.REPLACE); + .onMalformedInput(CodingErrorAction.REPLACE) + .onUnmappableCharacter(CodingErrorAction.REPLACE); // This is not horribly efficient, but it will do for now char c = s.charAt(0); @@ -2790,7 +2796,7 @@ public final class URI } else if (betweenBrackets && c == ']') { betweenBrackets = false; } - if (c != '%' || betweenBrackets) { + if (c != '%' || (betweenBrackets && ignorePercentInBrackets)) { sb.append(c); if (++i >= n) break; diff --git a/jdk/src/share/classes/java/net/URL.java b/jdk/src/share/classes/java/net/URL.java index 86d0bf78794..d2042094bc6 100644 --- a/jdk/src/share/classes/java/net/URL.java +++ b/jdk/src/share/classes/java/net/URL.java @@ -867,7 +867,7 @@ public final class URL implements java.io.Serializable { * Creates an integer suitable for hash table indexing.

* * The hash code is based upon all the URL components relevant for URL - * comparison. As such, this operation is a blocking operation.

+ * comparison. As such, this operation is a blocking operation. * * @return a hash code for this {@code URL}. */ diff --git a/jdk/src/share/classes/java/net/URLClassLoader.java b/jdk/src/share/classes/java/net/URLClassLoader.java index f272346ce2f..e448a120bdc 100644 --- a/jdk/src/share/classes/java/net/URLClassLoader.java +++ b/jdk/src/share/classes/java/net/URLClassLoader.java @@ -271,7 +271,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * by catching {@link IOException}s internally. Unchecked exceptions * and errors are not caught. Calling close on an already closed * loader has no effect. - *

+ * * @exception IOException if closing any file opened by this class loader * resulted in an IOException. Any such exceptions are caught internally. * If only one is caught, then it is re-thrown. If more than one exception diff --git a/jdk/src/share/classes/java/net/doc-files/net-properties.html b/jdk/src/share/classes/java/net/doc-files/net-properties.html index 5aac0c8e3bd..d8e8949fc32 100644 --- a/jdk/src/share/classes/java/net/doc-files/net-properties.html +++ b/jdk/src/share/classes/java/net/doc-files/net-properties.html @@ -35,7 +35,8 @@ alter the mechanisms and behavior of the various classes of the java.net package. Some are checked only once at startup of the VM, and therefore are best set using the -D option of the java command, while others have a more dynamic nature and can also be changed using -the System.setProperty() API. The purpose of this document is to list +the System.setProperty() API. +The purpose of this document is to list and detail all of these properties.

If there is no special note, a property value is checked every time it is used.

diff --git a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java index aa636a7724d..86736549153 100644 --- a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java +++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java @@ -172,7 +172,7 @@ public abstract class ActivationGroup * *

This method simply informs the group's monitor that the object * is inactive. It is up to the concrete subclass of ActivationGroup - * to fulfill the additional requirement of unexporting the object.

+ * to fulfill the additional requirement of unexporting the object. * * @param id the object's activation identifier * @return true if the object was successfully deactivated; otherwise diff --git a/jdk/src/share/classes/java/rmi/activation/ActivationGroupDesc.java b/jdk/src/share/classes/java/rmi/activation/ActivationGroupDesc.java index ca088c63f77..af9df9ef7da 100644 --- a/jdk/src/share/classes/java/rmi/activation/ActivationGroupDesc.java +++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroupDesc.java @@ -49,7 +49,7 @@ import java.util.Properties; * *

  • the group's ActivationGroupID, and *
  • the group's initialization data (in a - * java.rmi.MarshalledObject)

    + * java.rmi.MarshalledObject) * * @author Ann Wollrath * @since 1.2 diff --git a/jdk/src/share/classes/java/rmi/activation/ActivationMonitor.java b/jdk/src/share/classes/java/rmi/activation/ActivationMonitor.java index 116aaf4e559..81fdec02c5e 100644 --- a/jdk/src/share/classes/java/rmi/activation/ActivationMonitor.java +++ b/jdk/src/share/classes/java/rmi/activation/ActivationMonitor.java @@ -63,7 +63,7 @@ public interface ActivationMonitor extends Remote { * reference associated with id as a stale reference. * Since the reference is considered stale, a subsequent * activate call for the same activation identifier - * results in re-activating the remote object.

    + * results in re-activating the remote object. * * @param id the object's activation identifier * @exception UnknownObjectException if object is unknown diff --git a/jdk/src/share/classes/java/rmi/activation/ActivationSystem.java b/jdk/src/share/classes/java/rmi/activation/ActivationSystem.java index 25b218804c5..ddcb4da1d5d 100644 --- a/jdk/src/share/classes/java/rmi/activation/ActivationSystem.java +++ b/jdk/src/share/classes/java/rmi/activation/ActivationSystem.java @@ -61,7 +61,7 @@ public interface ActivationSystem extends Remote { * receives an activate request for a specific identifier, it * looks up the activation descriptor (registered previously) for * the specified identifier and uses that information to activate - * the object.

    + * the object. * * @param desc the object's activation descriptor * @return the activation id that can be used to activate the object diff --git a/jdk/src/share/classes/java/rmi/activation/Activator.java b/jdk/src/share/classes/java/rmi/activation/Activator.java index 9dae603a1bb..18fd82ca3a1 100644 --- a/jdk/src/share/classes/java/rmi/activation/Activator.java +++ b/jdk/src/share/classes/java/rmi/activation/Activator.java @@ -53,7 +53,7 @@ import java.rmi.activation.UnknownObjectException; * * The activator is responsible for monitoring and detecting when * activation groups fail so that it can remove stale remote references - * to groups and active object's within those groups.

    + * to groups and active object's within those groups. * * @author Ann Wollrath * @see ActivationInstantiator @@ -95,7 +95,7 @@ public interface Activator extends Remote { * collection for that object. If the activator kept a strong * reference to the remote object, the activator would then * prevent the object from being garbage collected under the - * normal distributed garbage collection mechanism.

    + * normal distributed garbage collection mechanism. * * @param id the activation identifier for the object being activated * @param force if true, the activator contacts the group to obtain diff --git a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java index e92f3e9a122..3e1a2bdd2c9 100644 --- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java +++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java @@ -1644,12 +1644,13 @@ public final class DateTimeFormatter { * @return a formatter based on this formatter with the requested resolver style, not null */ public DateTimeFormatter withResolverFields(TemporalField... resolverFields) { - Objects.requireNonNull(resolverFields, "resolverFields"); - Set fields = new HashSet<>(Arrays.asList(resolverFields)); + Set fields = null; + if (resolverFields != null) { + fields = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(resolverFields))); + } if (Objects.equals(this.resolverFields, fields)) { return this; } - fields = Collections.unmodifiableSet(fields); return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, fields, chrono, zone); } @@ -1693,11 +1694,12 @@ public final class DateTimeFormatter { * @return a formatter based on this formatter with the requested resolver style, not null */ public DateTimeFormatter withResolverFields(Set resolverFields) { - Objects.requireNonNull(resolverFields, "resolverFields"); if (Objects.equals(this.resolverFields, resolverFields)) { return this; } - resolverFields = Collections.unmodifiableSet(new HashSet<>(resolverFields)); + if (resolverFields != null) { + resolverFields = Collections.unmodifiableSet(new HashSet<>(resolverFields)); + } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); } diff --git a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java index f04d59b2303..0a167e45c26 100644 --- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java +++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java @@ -939,7 +939,7 @@ public final class DateTimeFormatterBuilder { * During parsing, the offset is parsed using the format defined above. * If the offset cannot be parsed then an exception is thrown unless the * section of the formatter is optional. - *

    + * * @param style the format style to use, not null * @return this, for chaining, not null * @throws IllegalArgumentException if style is neither {@link TextStyle#FULL diff --git a/jdk/src/share/classes/java/util/regex/Matcher.java b/jdk/src/share/classes/java/util/regex/Matcher.java index ebab02e3b82..e841294ed8e 100644 --- a/jdk/src/share/classes/java/util/regex/Matcher.java +++ b/jdk/src/share/classes/java/util/regex/Matcher.java @@ -65,9 +65,10 @@ import java.util.Objects; * new strings whose contents can, if desired, be computed from the match * result. The {@link #appendReplacement appendReplacement} and {@link * #appendTail appendTail} methods can be used in tandem in order to collect - * the result into an existing string buffer, or the more convenient {@link - * #replaceAll replaceAll} method can be used to create a string in which every - * matching subsequence in the input sequence is replaced. + * the result into an existing string buffer or string builder. Alternatively, + * the more convenient {@link #replaceAll replaceAll} method can be used to + * create a string in which every matching subsequence in the input sequence + * is replaced. * *

    The explicit state of a matcher includes the start and end indices of * the most recent successful match. It also includes the start and end @@ -792,15 +793,115 @@ public final class Matcher implements MatchResult { * that does not exist in the pattern */ public Matcher appendReplacement(StringBuffer sb, String replacement) { - // If no match, return error if (first < 0) throw new IllegalStateException("No match available"); - - // Process substitution string to replace group references with groups - int cursor = 0; StringBuilder result = new StringBuilder(); + appendExpandedReplacement(replacement, result); + // Append the intervening text + sb.append(text, lastAppendPosition, first); + // Append the match substitution + sb.append(result); + lastAppendPosition = last; + return this; + } + /** + * Implements a non-terminal append-and-replace step. + * + *

    This method performs the following actions:

    + * + *
      + * + *
    1. It reads characters from the input sequence, starting at the + * append position, and appends them to the given string builder. It + * stops after reading the last character preceding the previous match, + * that is, the character at index {@link + * #start()} - 1.

    2. + * + *
    3. It appends the given replacement string to the string builder. + *

    4. + * + *
    5. It sets the append position of this matcher to the index of + * the last character matched, plus one, that is, to {@link #end()}. + *

    6. + * + *
    + * + *

    The replacement string may contain references to subsequences + * captured during the previous match: Each occurrence of + * $g will be replaced by the result of + * evaluating {@link #group(int) group}(g). + * The first number after the $ is always treated as part of + * the group reference. Subsequent numbers are incorporated into g if + * they would form a legal group reference. Only the numerals '0' + * through '9' are considered as potential components of the group + * reference. If the second group matched the string "foo", for + * example, then passing the replacement string "$2bar" would + * cause "foobar" to be appended to the string builder. A dollar + * sign ($) may be included as a literal in the replacement + * string by preceding it with a backslash (\$). + * + *

    Note that backslashes (\) and dollar signs ($) in + * the replacement string may cause the results to be different than if it + * were being treated as a literal replacement string. Dollar signs may be + * treated as references to captured subsequences as described above, and + * backslashes are used to escape literal characters in the replacement + * string. + * + *

    This method is intended to be used in a loop together with the + * {@link #appendTail appendTail} and {@link #find find} methods. The + * following code, for example, writes one dog two dogs in the + * yard to the standard-output stream:

    + * + *
    +     * Pattern p = Pattern.compile("cat");
    +     * Matcher m = p.matcher("one cat two cats in the yard");
    +     * StringBuilder sb = new StringBuilder();
    +     * while (m.find()) {
    +     *     m.appendReplacement(sb, "dog");
    +     * }
    +     * m.appendTail(sb);
    +     * System.out.println(sb.toString());
    + * + * @param sb + * The target string builder + * @param replacement + * The replacement string + * @return This matcher + * + * @throws IllegalStateException + * If no match has yet been attempted, + * or if the previous match operation failed + * @throws IllegalArgumentException + * If the replacement string refers to a named-capturing + * group that does not exist in the pattern + * @throws IndexOutOfBoundsException + * If the replacement string refers to a capturing group + * that does not exist in the pattern + * @since 1.9 + */ + public Matcher appendReplacement(StringBuilder sb, String replacement) { + // If no match, return error + if (first < 0) + throw new IllegalStateException("No match available"); + StringBuilder result = new StringBuilder(); + appendExpandedReplacement(replacement, result); + // Append the intervening text + sb.append(text, lastAppendPosition, first); + // Append the match substitution + sb.append(result); + lastAppendPosition = last; + return this; + } + + /** + * Processes replacement string to replace group references with + * groups. + */ + private StringBuilder appendExpandedReplacement( + String replacement, StringBuilder result) { + int cursor = 0; while (cursor < replacement.length()) { char nextChar = replacement.charAt(cursor); if (nextChar == '\\') { @@ -852,8 +953,8 @@ public final class Matcher implements MatchResult { cursor++; } else { // The first number is always a group - refNum = (int)nextChar - '0'; - if ((refNum < 0)||(refNum > 9)) + refNum = nextChar - '0'; + if ((refNum < 0) || (refNum > 9)) throw new IllegalArgumentException( "Illegal group reference"); cursor++; @@ -864,7 +965,7 @@ public final class Matcher implements MatchResult { break; } int nextDigit = replacement.charAt(cursor) - '0'; - if ((nextDigit < 0)||(nextDigit > 9)) { // not a number + if ((nextDigit < 0) || (nextDigit > 9)) { // not a number break; } int newRefNum = (refNum * 10) + nextDigit; @@ -884,13 +985,7 @@ public final class Matcher implements MatchResult { cursor++; } } - // Append the intervening text - sb.append(text, lastAppendPosition, first); - // Append the match substitution - sb.append(result); - - lastAppendPosition = last; - return this; + return result; } /** @@ -912,6 +1007,27 @@ public final class Matcher implements MatchResult { return sb; } + /** + * Implements a terminal append-and-replace step. + * + *

    This method reads characters from the input sequence, starting at + * the append position, and appends them to the given string builder. It is + * intended to be invoked after one or more invocations of the {@link + * #appendReplacement appendReplacement} method in order to copy the + * remainder of the input sequence.

    + * + * @param sb + * The target string builder + * + * @return The target string builder + * + * @since 1.9 + */ + public StringBuilder appendTail(StringBuilder sb) { + sb.append(text, lastAppendPosition, getTextLength()); + return sb; + } + /** * Replaces every subsequence of the input sequence that matches the * pattern with the given replacement string. @@ -950,7 +1066,7 @@ public final class Matcher implements MatchResult { reset(); boolean result = find(); if (result) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); do { appendReplacement(sb, replacement); result = find(); @@ -1000,7 +1116,7 @@ public final class Matcher implements MatchResult { reset(); if (!find()) return text.toString(); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); appendReplacement(sb, replacement); appendTail(sb); return sb.toString(); diff --git a/jdk/src/share/classes/javax/naming/event/package.html b/jdk/src/share/classes/javax/naming/event/package.html index f23dbe887cd..3affa9cbdf9 100644 --- a/jdk/src/share/classes/javax/naming/event/package.html +++ b/jdk/src/share/classes/javax/naming/event/package.html @@ -112,7 +112,6 @@ fired to notify the listener. The listener's namingExceptionThrown() method is invoked, as shown in the sample code above, and the listener is automatically deregistered. -

    Package Specification

    diff --git a/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java b/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java index 4ab5a347f66..8d754d02b85 100644 --- a/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java +++ b/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java @@ -114,7 +114,7 @@ public abstract class ControlFactory { *

    * Note that a control factory * must be public and must have a public constructor that accepts no arguments. - *

    + * * @param ctl The non-null control object containing the OID and BER data. * @param ctx The possibly null context in which the control is being created. * If null, no such information is available. diff --git a/jdk/src/share/classes/javax/naming/ldap/LdapContext.java b/jdk/src/share/classes/javax/naming/ldap/LdapContext.java index ef92b1c49ba..05db4a8648b 100644 --- a/jdk/src/share/classes/javax/naming/ldap/LdapContext.java +++ b/jdk/src/share/classes/javax/naming/ldap/LdapContext.java @@ -319,7 +319,7 @@ public interface LdapContext extends DirContext { * clear the response controls. You can call it many times (and get * back the same controls) until the next context method that may return * controls is invoked. - *

    + * * @return A possibly null array of controls. If null, the previous * method invoked on this context did not produce any controls. * @exception NamingException If an error occurred while getting the response diff --git a/jdk/src/share/classes/javax/naming/ldap/Rdn.java b/jdk/src/share/classes/javax/naming/ldap/Rdn.java index a78fda3af4e..d688e11baf8 100644 --- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java +++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java @@ -352,7 +352,7 @@ public class Rdn implements Serializable, Comparable { * *

    * If obj is null or not an instance of Rdn, false is returned. - *

    + * * @param obj object to be compared for equality with this Rdn. * @return true if the specified object is equal to this Rdn. * @see #hashCode() diff --git a/jdk/src/share/classes/javax/naming/ldap/package.html b/jdk/src/share/classes/javax/naming/ldap/package.html index 79e550628e1..bce9469b6db 100644 --- a/jdk/src/share/classes/javax/naming/ldap/package.html +++ b/jdk/src/share/classes/javax/naming/ldap/package.html @@ -255,8 +255,6 @@ public class VendorXControlFactory extends ControlFactory { } -

    -

    Package Specification

    The JNDI API Specification and related documents can be found in the diff --git a/jdk/src/share/classes/javax/naming/package.html b/jdk/src/share/classes/javax/naming/package.html index 8011d089f10..6946ec40166 100644 --- a/jdk/src/share/classes/javax/naming/package.html +++ b/jdk/src/share/classes/javax/naming/package.html @@ -81,7 +81,6 @@ them, comparing components, and so on. The overloads that accept string names are likely to be more useful for simple applications, such as those that simply read in a name and look up the corresponding object. -

    Bindings

    diff --git a/jdk/src/share/classes/javax/naming/spi/DirectoryManager.java b/jdk/src/share/classes/javax/naming/spi/DirectoryManager.java index 523175c862a..a0b979e385b 100644 --- a/jdk/src/share/classes/javax/naming/spi/DirectoryManager.java +++ b/jdk/src/share/classes/javax/naming/spi/DirectoryManager.java @@ -120,7 +120,6 @@ public class DirectoryManager extends NamingManager { * * Service providers that implement the DirContext interface * should use this method, not NamingManager.getObjectInstance(). - *

    * * @param refInfo The possibly null object for which to create an object. * @param name The name of this object relative to nameCtx. diff --git a/jdk/src/share/classes/javax/naming/spi/NamingManager.java b/jdk/src/share/classes/javax/naming/spi/NamingManager.java index 19b8bb50443..c6a99ec4c3e 100644 --- a/jdk/src/share/classes/javax/naming/spi/NamingManager.java +++ b/jdk/src/share/classes/javax/naming/spi/NamingManager.java @@ -92,7 +92,7 @@ public class NamingManager { * The builder can only be installed if the executing thread is allowed * (by the security manager's checkSetFactory() method) to do so. * Once installed, the builder cannot be replaced. - *

    + * * @param builder The factory builder to install. If null, no builder * is installed. * @exception SecurityException builder cannot be installed diff --git a/jdk/src/share/classes/javax/naming/spi/ObjectFactory.java b/jdk/src/share/classes/javax/naming/spi/ObjectFactory.java index 9f598c9bfe8..a02528cec9f 100644 --- a/jdk/src/share/classes/javax/naming/spi/ObjectFactory.java +++ b/jdk/src/share/classes/javax/naming/spi/ObjectFactory.java @@ -149,7 +149,6 @@ public interface ObjectFactory { * If a factory uses nameCtx it should synchronize its use * against concurrent access, since context implementations are not * guaranteed to be thread-safe. - *

    * * @param obj The possibly null object containing location or reference * information that can be used in creating an object. diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java index 5c8b65f2703..a8d12131aaf 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java @@ -52,7 +52,20 @@ import javax.security.auth.DestroyFailedException; * application depends on the default JGSS Kerberos mechanism to access the * KerberosKey. In that case, however, the application will need an * appropriate - * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}. + * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.

    + * + * When creating a {@code KerberosKey} using the + * {@link #KerberosKey(KerberosPrincipal, char[], String)} constructor, + * an implementation may accept non-IANA algorithm names (For example, + * "ArcFourMac" for "rc4-hmac"), but the {@link #getAlgorithm} method + * must always return the IANA algorithm name.

    + * + * @implNote Old algorithm names used before JDK 9 are supported in the + * {@link #KerberosKey(KerberosPrincipal, char[], String)} constructor in this + * implementation for compatibility reasons, which are "DES" (and null) for + * "des-cbc-md5", "DESede" for "des3-cbc-sha1-kd", "ArcFourHmac" for "rc4-hmac", + * "AES128" for "aes128-cts-hmac-sha1-96", and "AES256" for + * "aes256-cts-hmac-sha1-96". * * @author Mayank Upadhyay * @since 1.4 @@ -73,7 +86,7 @@ public class KerberosKey implements SecretKey, Destroyable { * * @serial */ - private int versionNum; + private final int versionNum; /** * {@code KeyImpl} is serialized by writing out the ASN1 Encoded bytes @@ -113,13 +126,16 @@ public class KerberosKey implements SecretKey, Destroyable { } /** - * Constructs a KerberosKey from a principal's password. + * Constructs a KerberosKey from a principal's password using the specified + * algorithm name. The algorithm name (case insensitive) should be provided + * as the encryption type string defined on the IANA + * Kerberos Encryption Type Numbers + * page. The version number of the key generated will be 0. * * @param principal the principal that this password belongs to * @param password the password that should be used to compute the key * @param algorithm the name for the algorithm that this key will be - * used for. This parameter may be null in which case the default - * algorithm "DES" will be assumed. + * used for * @throws IllegalArgumentException if the name of the * algorithm passed is unsupported. */ @@ -128,6 +144,7 @@ public class KerberosKey implements SecretKey, Destroyable { String algorithm) { this.principal = principal; + this.versionNum = 0; // Pass principal in for salt key = new KeyImpl(principal, password, algorithm); } @@ -170,13 +187,18 @@ public class KerberosKey implements SecretKey, Destroyable { */ /** - * Returns the standard algorithm name for this key. For - * example, "DES" would indicate that this key is a DES key. - * See Appendix A in the - * Java Cryptography Architecture API Specification & Reference - * - * for information about standard algorithm names. + * Returns the standard algorithm name for this key. The algorithm names + * are the encryption type string defined on the IANA + * Kerberos Encryption Type Numbers + * page. + *

    + * This method can return the following value not defined on the IANA page: + *

      + *
    1. none: for etype equal to 0
    2. + *
    3. unknown: for etype greater than 0 but unsupported by + * the implementation
    4. + *
    5. private: for etype smaller than 0
    6. + *
    * * @return the name of the algorithm associated with this key. */ diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java b/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java index f4ee947212b..9d36d1e9ee1 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java @@ -36,7 +36,6 @@ import sun.security.krb5.PrincipalName; import sun.security.krb5.EncryptionKey; import sun.security.krb5.EncryptedData; import sun.security.krb5.KrbException; -import sun.security.krb5.KrbCryptoException; import sun.security.util.DerValue; /** @@ -86,8 +85,12 @@ class KeyImpl implements SecretKey, Destroyable, Serializable { try { PrincipalName princ = new PrincipalName(principal.getName()); - EncryptionKey key = - new EncryptionKey(password, princ.getSalt(), algorithm); + EncryptionKey key; + if ("none".equalsIgnoreCase(algorithm)) { + key = EncryptionKey.NULL_KEY; + } else { + key = new EncryptionKey(password, princ.getSalt(), algorithm); + } this.keyBytes = key.getBytes(); this.keyType = key.getEType(); } catch (KrbException e) { @@ -118,27 +121,28 @@ class KeyImpl implements SecretKey, Destroyable, Serializable { switch (eType) { case EncryptedData.ETYPE_DES_CBC_CRC: + return "des-cbc-crc"; + case EncryptedData.ETYPE_DES_CBC_MD5: - return "DES"; + return "des-cbc-md5"; case EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD: - return "DESede"; + return "des3-cbc-sha1-kd"; case EncryptedData.ETYPE_ARCFOUR_HMAC: - return "ArcFourHmac"; + return "rc4-hmac"; case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96: - return "AES128"; + return "aes128-cts-hmac-sha1-96"; case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: - return "AES256"; + return "aes256-cts-hmac-sha1-96"; case EncryptedData.ETYPE_NULL: - return "NULL"; + return "none"; default: - throw new IllegalArgumentException( - "Unsupported encryption type: " + eType); + return eType > 0 ? "unknown" : "private"; } } diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/package-info.java b/jdk/src/share/classes/javax/security/auth/kerberos/package-info.java index 293745479d8..0853663a1f2 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/package-info.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/package-info.java @@ -48,6 +48,12 @@ * {@code /lib/security} and failing that, in an OS-specific * location.

    * + * The {@code krb5.conf} file is formatted in the Windows INI file style, + * which contains a series of relations grouped into different sections. + * Each relation contains a key and a value, the value can be an arbitrary + * string or a boolean value. A boolean value can be one of "true", "false", + * "yes", or "no", case-insensitive.

    + * * @since JDK1.4 */ package javax.security.auth.kerberos; diff --git a/jdk/src/share/classes/javax/swing/JComboBox.java b/jdk/src/share/classes/javax/swing/JComboBox.java index 937c13376cc..ceec992b31d 100644 --- a/jdk/src/share/classes/javax/swing/JComboBox.java +++ b/jdk/src/share/classes/javax/swing/JComboBox.java @@ -65,7 +65,7 @@ import javax.accessibility.*; * See How to Use Combo Boxes * in The Java Tutorial * for further information. - *

    + * * @see ComboBoxModel * @see DefaultComboBoxModel * diff --git a/jdk/src/share/classes/javax/swing/JFrame.java b/jdk/src/share/classes/javax/swing/JFrame.java index 2077eb76249..c773a3b66a8 100644 --- a/jdk/src/share/classes/javax/swing/JFrame.java +++ b/jdk/src/share/classes/javax/swing/JFrame.java @@ -123,7 +123,7 @@ public class JFrame extends Frame implements WindowConstants, * has this set as the close operation and is closed in an applet, * a SecurityException may be thrown. * It is recommended you only use this in an application. - *

    + * * @since 1.3 */ public static final int EXIT_ON_CLOSE = 3; diff --git a/jdk/src/share/classes/javax/swing/JList.java b/jdk/src/share/classes/javax/swing/JList.java index 6503887247e..8088396fcc3 100644 --- a/jdk/src/share/classes/javax/swing/JList.java +++ b/jdk/src/share/classes/javax/swing/JList.java @@ -260,7 +260,7 @@ import static sun.swing.SwingUtilities2.Section.*; * See How to Use Lists * in The Java Tutorial * for further documentation. - *

    + * * @see ListModel * @see AbstractListModel * @see DefaultListModel diff --git a/jdk/src/share/classes/javax/swing/JOptionPane.java b/jdk/src/share/classes/javax/swing/JOptionPane.java index 58d38669e9c..e3458d037c0 100644 --- a/jdk/src/share/classes/javax/swing/JOptionPane.java +++ b/jdk/src/share/classes/javax/swing/JOptionPane.java @@ -259,7 +259,7 @@ import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP * "Choose one", "Input", * JOptionPane.INFORMATION_MESSAGE, null, * possibleValues, possibleValues[0]); - *

    + * * * Direct Use:
    * To create and use an JOptionPane directly, the diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java index e811fa80d5a..089da6c4e30 100644 --- a/jdk/src/share/classes/javax/swing/JTable.java +++ b/jdk/src/share/classes/javax/swing/JTable.java @@ -661,7 +661,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * with the following code: * *

    ((Vector)rowData.elementAt(1)).elementAt(5);
    - *

    + * * @param rowData the data for the new table * @param columnNames names of each column */ @@ -678,7 +678,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable *

     rowData[1][5]; 
    *

    * All rows must be of the same length as columnNames. - *

    + * * @param rowData the data for the new table * @param columnNames names of each column */ diff --git a/jdk/src/share/classes/javax/swing/RowSorter.java b/jdk/src/share/classes/javax/swing/RowSorter.java index bd375a779f6..5ca809e82a1 100644 --- a/jdk/src/share/classes/javax/swing/RowSorter.java +++ b/jdk/src/share/classes/javax/swing/RowSorter.java @@ -42,10 +42,10 @@ import java.util.*; *

    * The view invokes the following methods on the RowSorter: *

      - *
    • toggleSortOrder — The view invokes this when the + *
    • toggleSortOrder — The view invokes this when the * appropriate user gesture has occurred to trigger a sort. For example, * the user clicked a column header in a table. - *
    • One of the model change methods — The view invokes a model + *
    • One of the model change methods — The view invokes a model * change method when the underlying model * has changed. There may be order dependencies in how the events are * delivered, so a RowSorter should not update its mapping @@ -59,10 +59,10 @@ import java.util.*; * RowSorter provides notification of changes by way of * RowSorterListener. Two types of notification are sent: *
        - *
      • RowSorterEvent.Type.SORT_ORDER_CHANGED — notifies + *
      • RowSorterEvent.Type.SORT_ORDER_CHANGED — notifies * listeners that the sort order has changed. This is typically followed * by a notification that the sort has changed. - *
      • RowSorterEvent.Type.SORTED — notifies listeners that + *
      • RowSorterEvent.Type.SORTED — notifies listeners that * the mapping maintained by the RowSorter has changed in * some way. *
      diff --git a/jdk/src/share/classes/javax/swing/SpringLayout.java b/jdk/src/share/classes/javax/swing/SpringLayout.java index fdaa55cf339..c03090242c4 100644 --- a/jdk/src/share/classes/javax/swing/SpringLayout.java +++ b/jdk/src/share/classes/javax/swing/SpringLayout.java @@ -991,7 +991,7 @@ public class SpringLayout implements LayoutManager2 { * If constraints is an instance of * SpringLayout.Constraints, * associates the constraints with the specified component. - *

      + * * @param component the component being added * @param constraints the component's constraints * @@ -1029,7 +1029,7 @@ public class SpringLayout implements LayoutManager2 { *

            *     value(e1, c1) = value(e2, c2) + pad
      * to take place during all subsequent layout operations. - *

      + * * @param e1 the edge of the dependent * @param c1 the component of the dependent * @param pad the fixed distance between dependent and anchor @@ -1056,7 +1056,7 @@ public class SpringLayout implements LayoutManager2 { * SpringLayout.VERTICAL_CENTER, * SpringLayout.HORIZONTAL_CENTER or * SpringLayout.BASELINE. - *

      + * * @param e1 the edge of the dependent * @param c1 the component of the dependent * @param s the spring linking dependent and anchor diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java index 252ef03a13a..34595149b95 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java @@ -325,7 +325,7 @@ public class BasicButtonUI extends ButtonUI{ /** * Method which renders the text of the current button. - *

      + * * @param g Graphics context * @param b Current button to render * @param textRect Bounding rectangle to render the text. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java index 1a876fc6ce5..42b9a0b6c8b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java @@ -39,7 +39,7 @@ import sun.swing.DefaultLookup; /** * Provides the basic look and feel for a JColorChooser. - *

      + * * @author Tom Santos * @author Steve Wilson */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java index 1c6f496ba44..9562a2089d6 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -664,7 +664,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Renders the text of the current menu item. - *

      + * * @param g graphics context * @param menuItem menu item to render * @param textRect bounding rectangle for rendering the text diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java index ddeba1db653..163a5cd2b46 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java @@ -39,7 +39,6 @@ import javax.swing.text.View; /** * BasicToggleButton implementation - *

      * * @author Jeff Dinkins */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java index f0a88e000ba..1f2aac7e597 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java @@ -39,7 +39,6 @@ import javax.swing.plaf.basic.BasicSeparatorUI; /** * A Basic L&F implementation of ToolBarSeparatorUI. This implementation * is a "combined" view/controller. - *

      * * @author Jeff Shapiro */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java index 506a8a63b38..b301f200bc9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java @@ -44,7 +44,6 @@ import sun.swing.UIAction; /** * A Basic L&F implementation of ToolBarUI. This implementation * is a "combined" view/controller. - *

      * * @author Georges Saab * @author Jeff Shapiro diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java index d54d470db88..95a951cc6f9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java @@ -41,7 +41,6 @@ import javax.swing.text.View; /** * Standard tool tip L&F. - *

      * * @author Dave Moore */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java index 66097d8a1e9..208bd8aaab4 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java @@ -50,7 +50,6 @@ import sun.swing.UIAction; /** * The basic L&F for a hierarchical data structure. - *

      * * @author Scott Violet * @author Shannon Hickey (drag and drop) diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java index 3c0979dc38a..c8b75e88ac8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java @@ -37,7 +37,6 @@ import javax.swing.plaf.*; /** * Metal implementation of JInternalFrame. - *

      * * @author Steve Wilson */ diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java index 0bc74bd5c03..882fad9c63e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java @@ -56,7 +56,6 @@ import javax.swing.plaf.basic.BasicScrollBarUI; /** * Implementation of ScrollBarUI for the Metal Look and Feel - *

      * * @author Tom Santos * @author Steve Wilson diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java index 5f5ea59e54b..6fe5250cc18 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java @@ -50,7 +50,6 @@ import javax.swing.plaf.basic.*; /** * A Metal Look and Feel implementation of ToolBarUI. This implementation * is a "combined" view/controller. - *

      * * @author Jeff Shapiro */ diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html b/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html index 67048cf1087..22efa38b5eb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html @@ -5,7 +5,7 @@

      Primary Colors

      - +
      @@ -86,7 +86,7 @@
      KeyValuePreview
      control

      Secondary Colors

      - +
      diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html index e4ab4e24030..224e543a1ba 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html +++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html @@ -49,7 +49,7 @@ In addition to the Button properties, ArrowButton supports the following properties:

      ArrowButton Specific Properties
      -
      KeyValuePreview
      activeCaption
      +
      @@ -71,7 +71,7 @@ the following properties:

      to the Button properties, JButton supports the following property:

      JButton Specific Properties
      -
      Property Expected Type
      +
      @@ -94,7 +94,7 @@ button that is receiving focus. addition to the Button properties, JCheckBox supports the following property:

      JCheckBox Specific Properties
      -
      Property Expected Type
      +
      @@ -114,7 +114,7 @@ JCheckBox supports the following property:

      JComboBox

      JComboBox is a composite component that consists of the following child Components:

      -
      Property Expected Type
      +
      @@ -159,9 +159,9 @@ the renderer is a UIResource.
      Name Type
      -

      +
      JComboBox Specific Properties
      - +
      @@ -181,7 +181,7 @@ with the keyboard.

      JFileChooser

      JFileChooser Specific Properties
      -
      Property Expected Type
      @@ -341,7 +341,7 @@ of the file chooser.

      JInternalFrame

      JInternalFrame Specific Properties
      -
      @@ -374,7 +374,7 @@ the system menu will be shown.
      internal frame similar to that found in a frame.

      JInternalFrameTitlePane Specific Properties
      -
      @@ -473,7 +473,7 @@ abililty to close the internal frame.

      JList's sets the name of the renderer to List.renderer. JList supports the following properties:

      JList Specific Properties
      -
      +
      @@ -516,7 +516,7 @@ specific to the component and Region.MENU_ITEM_ACCELERATOR. MENU_ITEM_ACCELERATOR is used for painting the accelerator. Both Regions paint text using the TEXT_FOREGROUND ColorType. The following set of properties are supported:

      -
      Property Expected Type
      +
      @@ -570,7 +570,7 @@ this is used.

      Prefix is one of: CheckBoxMenuItem, Menu, MenuItem, or RadioButtonMenuItem.

      JMenu also supports the following properties:

      -
      Property Expected Type
      +
      @@ -599,7 +599,7 @@ components, they are: OptionPane.button, OptionPane.label, OptionPane.comboBox, OptionPane.scrollPane, OptionPane.list, OptionPane.textField, OptionPane.iconLabel.

      JOptionPane Specific Properties
      -
      Property Expected Type
      +
      @@ -713,7 +713,7 @@ it follows the other buttons.
      JProgressBar Specific Properties
      -
      Property Expected Type
      @@ -754,7 +754,7 @@ the bouncing box per frame when the progress bar is indeterminate.
      addition to the Button properties, JRadioButton supports the following property:

      JRadioButton Specific Properties
      -
      +
      @@ -774,7 +774,7 @@ JRadioButton supports the following property:

      JScrollBar

      JScrollBar is a composite component that consists of the following child Components:

      -
      Property Expected Type
      +
      @@ -788,9 +788,9 @@ child Components:

      Name Type
      -

      +
      JScrollBar Specific Properties
      - +
      @@ -844,7 +844,7 @@ will be made equal.

      Separators

      All of the separator classes, JSeparator, JPopupMenu.Separator and JToolBar.Separator use the same property:

      -
      Property Expected Type
      +
      @@ -863,7 +863,7 @@ preferred size will include the Insets.
      Property Expected Type

      JToolBar.Separator also supports the following property:

      - +
      @@ -896,7 +896,7 @@ invoked. Viewports border.

      JScrollPane Specific Properties
      -
      Property Expected Type
      +
      @@ -920,7 +920,7 @@ invoked. The two buttons will be named: SplitPaneDivider.leftOneTouchButton and SplitPaneDivider.rightOneTouchButton.

      JSplitPane Specific Properties
      -
      Property Expected Type
      +
      @@ -964,7 +964,7 @@ setOneTouchExpandable.

      JSlider

      JSlider Specific Properties
      -
      Property Expected Type
      @@ -1024,7 +1024,7 @@ of the slider.

      JTabbedPane

      JTabbedPane Specific Properties
      -
      @@ -1088,7 +1088,7 @@ selected tab.

      JTable sets the name of the renderer to Table.cellRenderer. JTable supports the following properties:

      JTable Specific Properties
      -
      +
      @@ -1133,7 +1133,7 @@ renderer will only succeed if it is a Synth Border.

      JTree sets the name of the renderer to Tree.renderer, the name of the editor is Tree.cellEditor.

      JTree Specific Properties
      -
      Property Expected Type
      +
      @@ -1217,7 +1217,7 @@ and binding it to the tree.Button properties, JToggleButton supports the following property:

      JToggleButton Specific Properties
      -
      Property Expected Type
      +
      @@ -1238,7 +1238,7 @@ JToggleButton supports the following property:

      Each of the Button classes (JButton, JCheckBox, JRadioButton, JToggleButton and SynthArrowButton) support a similar set of properties. These properties are:

      -
      Property Expected Type
      +
      @@ -1283,7 +1283,7 @@ JToggleButton.

      Text Properties

      -
      Property Expected Type
      diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html index ad84defba08..a428be92563 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html +++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html @@ -739,12 +739,12 @@ div.example { </state> </style> - +

      The following outlines which painter will be used for what - SynthPainter method: + SynthPainter method:

      -
      +
      StateMethodPainter
      SELECTEDpaintButtonBackgroundstateButtonBackgroundPainter
      SELECTEDAnything but paintButtonBackgroundstateFallbackPainter diff --git a/jdk/src/share/classes/javax/swing/text/GlyphView.java b/jdk/src/share/classes/javax/swing/text/GlyphView.java index 2ab6cbc3618..e848f2af63c 100644 --- a/jdk/src/share/classes/javax/swing/text/GlyphView.java +++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java @@ -56,7 +56,6 @@ import static sun.swing.SwingUtilities2.IMPLIED_CR; * expanded if this view is embedded in a container that does * tab expansion. ParagraphView is an example of a container * that does tab expansion. - *

      * * @since 1.3 * diff --git a/jdk/src/share/classes/javax/swing/text/StyleConstants.java b/jdk/src/share/classes/javax/swing/text/StyleConstants.java index 01f94088ef2..583b4dffd72 100644 --- a/jdk/src/share/classes/javax/swing/text/StyleConstants.java +++ b/jdk/src/share/classes/javax/swing/text/StyleConstants.java @@ -42,7 +42,6 @@ import javax.swing.Icon; *

      Diagram shows SpaceAbove, FirstLineIndent, LeftIndent, RightIndent,
  *      and SpaceBelow a paragraph.

      - *

      * * @author Timothy Prinzing */ diff --git a/jdk/src/share/classes/javax/swing/text/View.java b/jdk/src/share/classes/javax/swing/text/View.java index 2b49055ab59..cb8306ac12e 100644 --- a/jdk/src/share/classes/javax/swing/text/View.java +++ b/jdk/src/share/classes/javax/swing/text/View.java @@ -183,7 +183,6 @@ A view has the following responsibilities:

    • {@link #removeUpdate removeUpdate}
    • {@link #changedUpdate changedUpdate} -

      * * @author Timothy Prinzing diff --git a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java index 409560ba902..de0f2b91fe5 100644 --- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java +++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java @@ -116,7 +116,7 @@ import javax.swing.text.*; * concepts we do not currently * support are pseudo selectors, such as A:link { color: red }, * and the important modifier. - *

      + * * @implNote This implementation is currently * incomplete. It can be replaced with alternative implementations * that are complete. Future versions of this class will provide diff --git a/jdk/src/share/classes/javax/swing/undo/UndoableEdit.java b/jdk/src/share/classes/javax/swing/undo/UndoableEdit.java index 30a4b53fce1..88fa7e92232 100644 --- a/jdk/src/share/classes/javax/swing/undo/UndoableEdit.java +++ b/jdk/src/share/classes/javax/swing/undo/UndoableEdit.java @@ -47,7 +47,7 @@ import javax.swing.event.*; * be incorporated into a larger edit and treated as a single edit. *

    • If addEdit returns false replaceEdit * is called on the new edit with the current edit passed in as the - * argument. This is the inverse of addEdit — + * argument. This is the inverse of addEdit — * if the new edit returns true from replaceEdit, the new * edit replaces the current edit. * diff --git a/jdk/src/share/classes/sun/management/snmp/util/SnmpListTableCache.java b/jdk/src/share/classes/sun/management/snmp/util/SnmpListTableCache.java index b9627d37f41..43a7563a25c 100644 --- a/jdk/src/share/classes/sun/management/snmp/util/SnmpListTableCache.java +++ b/jdk/src/share/classes/sun/management/snmp/util/SnmpListTableCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -43,6 +43,7 @@ import java.lang.ref.WeakReference; *

      NOTE: This class is not synchronized, subclasses must implement * the appropriate synchronization whwn needed.

      **/ +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpListTableCache extends SnmpTableCache { diff --git a/jdk/src/share/classes/sun/management/snmp/util/SnmpNamedListTableCache.java b/jdk/src/share/classes/sun/management/snmp/util/SnmpNamedListTableCache.java index cc24c3d483e..d24641d45d8 100644 --- a/jdk/src/share/classes/sun/management/snmp/util/SnmpNamedListTableCache.java +++ b/jdk/src/share/classes/sun/management/snmp/util/SnmpNamedListTableCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -49,6 +49,7 @@ import java.lang.ref.WeakReference; *

      NOTE: This class is not synchronized, subclasses must implement * the appropriate synchronization whwn needed.

      **/ +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpNamedListTableCache extends SnmpListTableCache { /** diff --git a/jdk/src/share/classes/sun/management/snmp/util/SnmpTableCache.java b/jdk/src/share/classes/sun/management/snmp/util/SnmpTableCache.java index 8244c3c1eae..4ef960c6430 100644 --- a/jdk/src/share/classes/sun/management/snmp/util/SnmpTableCache.java +++ b/jdk/src/share/classes/sun/management/snmp/util/SnmpTableCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -45,6 +45,7 @@ import java.lang.ref.WeakReference; *

      NOTE: This class is not synchronized, subclasses must implement * the appropriate synchronization when needed.

      **/ +@SuppressWarnings("serial") // JDK implementation class public abstract class SnmpTableCache implements Serializable { /** diff --git a/jdk/src/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java b/jdk/src/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java index a38a7faecf2..0741499b9a7 100644 --- a/jdk/src/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java +++ b/jdk/src/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java @@ -26,11 +26,11 @@ package sun.security.internal.spec; import java.security.spec.AlgorithmParameterSpec; +import java.security.AccessController; +import java.security.PrivilegedAction; /** - * Parameters for SSL/TLS RSA Premaster secret generation. - * This class is used by SSL/TLS client to initialize KeyGenerators of the - * type "TlsRsaPremasterSecret". + * Parameters for SSL/TLS RSA premaster secret. * *

      Instances of this class are immutable. * @@ -43,90 +43,108 @@ import java.security.spec.AlgorithmParameterSpec; public class TlsRsaPremasterSecretParameterSpec implements AlgorithmParameterSpec { - private final int majorVersion; - private final int minorVersion; - private final byte[] encodedSecret; + /* + * The TLS spec says that the version in the RSA premaster secret must + * be the maximum version supported by the client (i.e. the version it + * requested in its client hello version). However, we (and other + * implementations) used to send the active negotiated version. The + * system property below allows to toggle the behavior. + */ + private final static String PROP_NAME = + "com.sun.net.ssl.rsaPreMasterSecretFix"; + + /* + * Default is "false" (old behavior) for compatibility reasons in + * SSLv3/TLSv1. Later protocols (TLSv1.1+) do not use this property. + */ + private final static boolean rsaPreMasterSecretFix = + AccessController.doPrivileged(new PrivilegedAction() { + public Boolean run() { + String value = System.getProperty(PROP_NAME); + if (value != null && value.equalsIgnoreCase("true")) { + return Boolean.TRUE; + } + + return Boolean.FALSE; + } + }); + + private final int clientVersion; + private final int serverVersion; /** * Constructs a new TlsRsaPremasterSecretParameterSpec. - *

      - * The version numbers will be placed inside the premaster secret to - * detect version rollbacks attacks as described in the TLS specification. - * Note that they do not indicate the protocol version negotiated for - * the handshake. * - * @param majorVersion the major number of the protocol version - * @param minorVersion the minor number of the protocol version + * @param clientVersion the version of the TLS protocol by which the + * client wishes to communicate during this session + * @param serverVersion the negotiated version of the TLS protocol which + * contains the lower of that suggested by the client in the client + * hello and the highest supported by the server. * - * @throws IllegalArgumentException if minorVersion or majorVersion are - * negative or larger than 255 + * @throws IllegalArgumentException if clientVersion or serverVersion are + * negative or larger than (2^16 - 1) */ - public TlsRsaPremasterSecretParameterSpec(int majorVersion, - int minorVersion) { - this.majorVersion = - TlsMasterSecretParameterSpec.checkVersion(majorVersion); - this.minorVersion = - TlsMasterSecretParameterSpec.checkVersion(minorVersion); - this.encodedSecret = null; + public TlsRsaPremasterSecretParameterSpec( + int clientVersion, int serverVersion) { + + this.clientVersion = checkVersion(clientVersion); + this.serverVersion = checkVersion(serverVersion); } /** - * Constructs a new TlsRsaPremasterSecretParameterSpec. - *

      - * The version numbers will be placed inside the premaster secret to - * detect version rollbacks attacks as described in the TLS specification. - * Note that they do not indicate the protocol version negotiated for - * the handshake. - *

      - * Usually, the encoded secret key is a random number that acts as - * dummy pre_master_secret to avoid vulnerabilities described by - * section 7.4.7.1, RFC 5246. + * Returns the version of the TLS protocol by which the client wishes to + * communicate during this session. * - * @param majorVersion the major number of the protocol version - * @param minorVersion the minor number of the protocol version - * @param encodedSecret the encoded secret key - * - * @throws IllegalArgumentException if minorVersion or majorVersion are - * negative or larger than 255, or encodedSecret is not exactly 48 bytes. + * @return the version of the TLS protocol in ClientHello message */ - public TlsRsaPremasterSecretParameterSpec(int majorVersion, - int minorVersion, byte[] encodedSecret) { - this.majorVersion = - TlsMasterSecretParameterSpec.checkVersion(majorVersion); - this.minorVersion = - TlsMasterSecretParameterSpec.checkVersion(minorVersion); - - if (encodedSecret == null || encodedSecret.length != 48) { - throw new IllegalArgumentException( - "Encoded secret is not exactly 48 bytes"); - } - this.encodedSecret = encodedSecret.clone(); + public int getClientVersion() { + return clientVersion; } /** - * Returns the major version. + * Returns the negotiated version of the TLS protocol which contains the + * lower of that suggested by the client in the client hello and the + * highest supported by the server. * - * @return the major version. + * @return the negotiated version of the TLS protocol in ServerHello message + */ + public int getServerVersion() { + return serverVersion; + } + + /** + * Returns the major version used in RSA premaster secret. + * + * @return the major version used in RSA premaster secret. */ public int getMajorVersion() { - return majorVersion; + if (rsaPreMasterSecretFix || clientVersion >= 0x0302) { + // 0x0302: TLSv1.1 + return (clientVersion >>> 8) & 0xFF; + } + + return (serverVersion >>> 8) & 0xFF; } /** - * Returns the minor version. + * Returns the minor version used in RSA premaster secret. * - * @return the minor version. + * @return the minor version used in RSA premaster secret. */ public int getMinorVersion() { - return minorVersion; + if (rsaPreMasterSecretFix || clientVersion >= 0x0302) { + // 0x0302: TLSv1.1 + return clientVersion & 0xFF; + } + + return serverVersion & 0xFF; } - /** - * Returns the encoded secret. - * - * @return the encoded secret, may be null if no encoded secret. - */ - public byte[] getEncodedSecret() { - return encodedSecret == null ? null : encodedSecret.clone(); + private int checkVersion(int version) { + if ((version < 0) || (version > 0xFFFF)) { + throw new IllegalArgumentException( + "Version must be between 0 and 65,535"); + } + return version; } } diff --git a/jdk/src/share/classes/sun/security/krb5/Config.java b/jdk/src/share/classes/sun/security/krb5/Config.java index 3b108622b07..f2f8754091c 100644 --- a/jdk/src/share/classes/sun/security/krb5/Config.java +++ b/jdk/src/share/classes/sun/security/krb5/Config.java @@ -32,20 +32,15 @@ package sun.security.krb5; import java.io.File; import java.io.FileInputStream; -import java.util.Hashtable; -import java.util.Vector; -import java.util.ArrayList; +import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; -import java.util.StringTokenizer; import java.net.InetAddress; import java.net.UnknownHostException; import java.security.AccessController; import java.security.PrivilegedExceptionAction; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; + import sun.net.dns.ResolverConfiguration; import sun.security.krb5.internal.crypto.EType; import sun.security.krb5.internal.Krb5; @@ -231,6 +226,31 @@ public class Config { return v.lastElement(); } + /** + * Gets the boolean value for the specified keys. Returns TRUE if the + * string value is "yes", or "true", FALSE if "no", or "false", or null + * if otherwise or not defined. The comparision is case-insensitive. + * + * @param keys the keys, see {@link #get(String...)} + * @return the boolean value, or null if there is no value defined or the + * value does not look like a boolean value. + * @throws IllegalArgumentException see {@link #get(String...)} + */ + public Boolean getBooleanObject(String... keys) { + String s = get(keys); + if (s == null) { + return null; + } + switch (s.toLowerCase(Locale.US)) { + case "yes": case "true": + return Boolean.TRUE; + case "no": case "false": + return Boolean.FALSE; + default: + return null; + } + } + /** * Gets all values for the specified keys. * @throws IllegalArgumentException if any of the keys is illegal @@ -316,23 +336,6 @@ public class Config { return value; } - /** - * Gets the boolean value for the specified keys. - * @param keys the keys - * @return the boolean value, false is returned if it cannot be - * found or the value is not "true" (case insensitive). - * @throw IllegalArgumentException if any of the keys is illegal - * @see #get(java.lang.String[]) - */ - public boolean getBooleanValue(String... keys) { - String val = get(keys); - if (val != null && val.equalsIgnoreCase("true")) { - return true; - } else { - return false; - } - } - /** * Parses a string to an integer. The convertible strings include the * string representations of positive integers, negative integers, and @@ -341,7 +344,7 @@ public class Config { * * @param input the String to be converted to an Integer. * @return an numeric value represented by the string - * @exception NumberFormationException if the String does not contain a + * @exception NumberFormatException if the String does not contain a * parsable integer. */ private int parseIntValue(String input) throws NumberFormatException { @@ -927,32 +930,20 @@ public class Config { * use addresses if "no_addresses" or "noaddresses" is set to false */ public boolean useAddresses() { - boolean useAddr = false; - // use addresses if "no_addresses" is set to false - String value = get("libdefaults", "no_addresses"); - useAddr = (value != null && value.equalsIgnoreCase("false")); - if (useAddr == false) { - // use addresses if "noaddresses" is set to false - value = get("libdefaults", "noaddresses"); - useAddr = (value != null && value.equalsIgnoreCase("false")); - } - return useAddr; + return getBooleanObject("libdefaults", "no_addresses") == Boolean.FALSE || + getBooleanObject("libdefaults", "noaddresses") == Boolean.FALSE; } /** - * Check if need to use DNS to locate Kerberos services + * Check if need to use DNS to locate Kerberos services for name. If not + * defined, check dns_fallback, whose default value is true. */ private boolean useDNS(String name) { - String value = get("libdefaults", name); - if (value == null) { - value = get("libdefaults", "dns_fallback"); - if ("false".equalsIgnoreCase(value)) { - return false; - } else { - return true; - } + Boolean value = getBooleanObject("libdefaults", name); + if (value != null) { + return value.booleanValue(); } else { - return value.equalsIgnoreCase("true"); + return getBooleanObject("libdefaults", "dns_fallback") != Boolean.FALSE; } } diff --git a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java index b83fe8c8611..6887f85524c 100644 --- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java +++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java @@ -271,15 +271,22 @@ public class EncryptionKey String salt, String algorithm) throws KrbCryptoException { - if (algorithm == null || algorithm.equalsIgnoreCase("DES")) { + if (algorithm == null || algorithm.equalsIgnoreCase("DES") + || algorithm.equalsIgnoreCase("des-cbc-md5")) { keyType = EncryptedData.ETYPE_DES_CBC_MD5; - } else if (algorithm.equalsIgnoreCase("DESede")) { + } else if (algorithm.equalsIgnoreCase("des-cbc-crc")) { + keyType = EncryptedData.ETYPE_DES_CBC_CRC; + } else if (algorithm.equalsIgnoreCase("DESede") + || algorithm.equalsIgnoreCase("des3-cbc-sha1-kd")) { keyType = EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD; - } else if (algorithm.equalsIgnoreCase("AES128")) { + } else if (algorithm.equalsIgnoreCase("AES128") + || algorithm.equalsIgnoreCase("aes128-cts-hmac-sha1-96")) { keyType = EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96; - } else if (algorithm.equalsIgnoreCase("ArcFourHmac")) { + } else if (algorithm.equalsIgnoreCase("ArcFourHmac") + || algorithm.equalsIgnoreCase("rc4-hmac")) { keyType = EncryptedData.ETYPE_ARCFOUR_HMAC; - } else if (algorithm.equalsIgnoreCase("AES256")) { + } else if (algorithm.equalsIgnoreCase("AES256") + || algorithm.equalsIgnoreCase("aes256-cts-hmac-sha1-96")) { keyType = EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96; // validate if AES256 is enabled if (!EType.isSupported(keyType)) { diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java b/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java index a3d93021710..a07bb477095 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/KDCOptions.java @@ -299,14 +299,14 @@ public class KDCOptions extends KerberosFlags { if ((options & KDC_OPT_RENEWABLE_OK) == KDC_OPT_RENEWABLE_OK) { set(RENEWABLE_OK, true); } else { - if (config.getBooleanValue("libdefaults", "renewable")) { + if (config.getBooleanObject("libdefaults", "renewable") == Boolean.TRUE) { set(RENEWABLE_OK, true); } } if ((options & KDC_OPT_PROXIABLE) == KDC_OPT_PROXIABLE) { set(PROXIABLE, true); } else { - if (config.getBooleanValue("libdefaults", "proxiable")) { + if (config.getBooleanObject("libdefaults", "proxiable") == Boolean.TRUE) { set(PROXIABLE, true); } } @@ -314,7 +314,7 @@ public class KDCOptions extends KerberosFlags { if ((options & KDC_OPT_FORWARDABLE) == KDC_OPT_FORWARDABLE) { set(FORWARDABLE, true); } else { - if (config.getBooleanValue("libdefaults", "forwardable")) { + if (config.getBooleanObject("libdefaults", "forwardable") == Boolean.TRUE) { set(FORWARDABLE, true); } } diff --git a/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java b/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java index feed5d8b96a..d64b85486d4 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/EType.java @@ -58,8 +58,8 @@ public abstract class EType { boolean allowed = false; try { Config cfg = Config.getInstance(); - String temp = cfg.get("libdefaults", "allow_weak_crypto"); - if (temp != null && temp.equals("true")) allowed = true; + allowed = cfg.getBooleanObject("libdefaults", "allow_weak_crypto") + == Boolean.TRUE; } catch (Exception exc) { if (DEBUG) { System.out.println ("Exception in getting allow_weak_crypto, " + diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java b/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java index e2ff0fc73e4..253b8913a82 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java +++ b/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java @@ -37,6 +37,8 @@ import javax.crypto.spec.*; import static sun.security.pkcs11.TemplateManager.*; import sun.security.pkcs11.wrapper.*; import static sun.security.pkcs11.wrapper.PKCS11Constants.*; +import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; +import sun.security.util.KeyUtil; /** * RSA Cipher implementation class. We currently only support @@ -102,6 +104,12 @@ final class P11RSACipher extends CipherSpi { // maximum output size. this is the length of the key private int outputSize; + // cipher parameter for TLS RSA premaster secret + private AlgorithmParameterSpec spec = null; + + // the source of randomness + private SecureRandom random; + P11RSACipher(Token token, String algorithm, long mechanism) throws PKCS11Exception { super(); @@ -165,8 +173,12 @@ final class P11RSACipher extends CipherSpi { AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { if (params != null) { - throw new InvalidAlgorithmParameterException - ("Parameters not supported"); + if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new InvalidAlgorithmParameterException( + "Parameters not supported"); + } + spec = params; + this.random = random; // for TLS RSA premaster secret } implInit(opmode, key); } @@ -176,8 +188,8 @@ final class P11RSACipher extends CipherSpi { SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { if (params != null) { - throw new InvalidAlgorithmParameterException - ("Parameters not supported"); + throw new InvalidAlgorithmParameterException( + "Parameters not supported"); } implInit(opmode, key); } @@ -452,21 +464,101 @@ final class P11RSACipher extends CipherSpi { protected Key engineUnwrap(byte[] wrappedKey, String algorithm, int type) throws InvalidKeyException, NoSuchAlgorithmException { - // XXX implement unwrap using C_Unwrap() for all keys - implInit(Cipher.DECRYPT_MODE, p11Key); - if (wrappedKey.length > maxInputSize) { - throw new InvalidKeyException("Key is too long for unwrapping"); + boolean isTlsRsaPremasterSecret = + algorithm.equals("TlsRsaPremasterSecret"); + Exception failover = null; + + SecureRandom secureRandom = random; + if (secureRandom == null && isTlsRsaPremasterSecret) { + secureRandom = new SecureRandom(); } - implUpdate(wrappedKey, 0, wrappedKey.length); - try { - byte[] encoded = doFinal(); + + // Should C_Unwrap be preferred for non-TLS RSA premaster secret? + if (token.supportsRawSecretKeyImport()) { + // XXX implement unwrap using C_Unwrap() for all keys + implInit(Cipher.DECRYPT_MODE, p11Key); + if (wrappedKey.length > maxInputSize) { + throw new InvalidKeyException("Key is too long for unwrapping"); + } + + byte[] encoded = null; + implUpdate(wrappedKey, 0, wrappedKey.length); + try { + encoded = doFinal(); + } catch (BadPaddingException e) { + if (isTlsRsaPremasterSecret) { + failover = e; + } else { + throw new InvalidKeyException("Unwrapping failed", e); + } + } catch (IllegalBlockSizeException e) { + // should not occur, handled with length check above + throw new InvalidKeyException("Unwrapping failed", e); + } + + if (isTlsRsaPremasterSecret) { + if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new IllegalStateException( + "No TlsRsaPremasterSecretParameterSpec specified"); + } + + // polish the TLS premaster secret + TlsRsaPremasterSecretParameterSpec psps = + (TlsRsaPremasterSecretParameterSpec)spec; + encoded = KeyUtil.checkTlsPreMasterSecretKey( + psps.getClientVersion(), psps.getServerVersion(), + secureRandom, encoded, (failover != null)); + } + return ConstructKeys.constructKey(encoded, algorithm, type); - } catch (BadPaddingException e) { - // should not occur - throw new InvalidKeyException("Unwrapping failed", e); - } catch (IllegalBlockSizeException e) { - // should not occur, handled with length check above - throw new InvalidKeyException("Unwrapping failed", e); + } else { + Session s = null; + SecretKey secretKey = null; + try { + try { + s = token.getObjSession(); + long keyType = CKK_GENERIC_SECRET; + CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { + new CK_ATTRIBUTE(CKA_CLASS, CKO_SECRET_KEY), + new CK_ATTRIBUTE(CKA_KEY_TYPE, keyType), + }; + attributes = token.getAttributes( + O_IMPORT, CKO_SECRET_KEY, keyType, attributes); + long keyID = token.p11.C_UnwrapKey(s.id(), + new CK_MECHANISM(mechanism), p11Key.keyID, + wrappedKey, attributes); + secretKey = P11Key.secretKey(s, keyID, + algorithm, 48 << 3, attributes); + } catch (PKCS11Exception e) { + if (isTlsRsaPremasterSecret) { + failover = e; + } else { + throw new InvalidKeyException("unwrap() failed", e); + } + } + + if (isTlsRsaPremasterSecret) { + byte[] replacer = new byte[48]; + if (failover == null) { + // Does smart compiler dispose this operation? + secureRandom.nextBytes(replacer); + } + + TlsRsaPremasterSecretParameterSpec psps = + (TlsRsaPremasterSecretParameterSpec)spec; + + // Please use the tricky failover and replacer byte array + // as the parameters so that smart compiler won't dispose + // the unused variable . + secretKey = polishPreMasterSecretKey(token, s, + failover, replacer, secretKey, + psps.getClientVersion(), psps.getServerVersion()); + } + + return secretKey; + } finally { + token.releaseSession(s); + } } } @@ -475,6 +567,34 @@ final class P11RSACipher extends CipherSpi { int n = P11KeyFactory.convertKey(token, key, algorithm).length(); return n; } + + private static SecretKey polishPreMasterSecretKey( + Token token, Session session, + Exception failover, byte[] replacer, SecretKey secretKey, + int clientVersion, int serverVersion) { + + if (failover != null) { + CK_VERSION version = new CK_VERSION( + (clientVersion >>> 8) & 0xFF, clientVersion & 0xFF); + try { + CK_ATTRIBUTE[] attributes = token.getAttributes( + O_GENERATE, CKO_SECRET_KEY, + CKK_GENERIC_SECRET, new CK_ATTRIBUTE[0]); + long keyID = token.p11.C_GenerateKey(session.id(), + // new CK_MECHANISM(CKM_TLS_PRE_MASTER_KEY_GEN, version), + new CK_MECHANISM(CKM_SSL3_PRE_MASTER_KEY_GEN, version), + attributes); + return P11Key.secretKey(session, + keyID, "TlsRsaPremasterSecret", 48 << 3, attributes); + } catch (PKCS11Exception e) { + throw new ProviderException( + "Could not generate premaster secret", e); + } + } + + return secretKey; + } + } final class ConstructKeys { diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java b/jdk/src/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java index ff9b183ee26..21c853794bc 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java +++ b/jdk/src/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java @@ -73,7 +73,7 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { - if (params instanceof TlsRsaPremasterSecretParameterSpec == false) { + if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsRsaPremasterSecretParameterSpec)params; @@ -83,38 +83,32 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { throw new InvalidParameterException(MSG); } + // Only can be used in client side to generate TLS RSA premaster secret. protected SecretKey engineGenerateKey() { if (spec == null) { throw new IllegalStateException ("TlsRsaPremasterSecretGenerator must be initialized"); } - byte[] b = spec.getEncodedSecret(); - if (b == null) { - CK_VERSION version = new CK_VERSION( + CK_VERSION version = new CK_VERSION( spec.getMajorVersion(), spec.getMinorVersion()); - Session session = null; - try { - session = token.getObjSession(); - CK_ATTRIBUTE[] attributes = token.getAttributes( - O_GENERATE, CKO_SECRET_KEY, - CKK_GENERIC_SECRET, new CK_ATTRIBUTE[0]); - long keyID = token.p11.C_GenerateKey(session.id(), - new CK_MECHANISM(mechanism, version), attributes); - SecretKey key = P11Key.secretKey(session, - keyID, "TlsRsaPremasterSecret", 48 << 3, attributes); - return key; - } catch (PKCS11Exception e) { - throw new ProviderException( - "Could not generate premaster secret", e); - } finally { - token.releaseSession(session); - } + Session session = null; + try { + session = token.getObjSession(); + CK_ATTRIBUTE[] attributes = token.getAttributes( + O_GENERATE, CKO_SECRET_KEY, + CKK_GENERIC_SECRET, new CK_ATTRIBUTE[0]); + long keyID = token.p11.C_GenerateKey(session.id(), + new CK_MECHANISM(mechanism, version), attributes); + SecretKey key = P11Key.secretKey(session, + keyID, "TlsRsaPremasterSecret", 48 << 3, attributes); + return key; + } catch (PKCS11Exception e) { + throw new ProviderException( + "Could not generate premaster secret", e); + } finally { + token.releaseSession(session); } - - // Won't worry, the TlsRsaPremasterSecret will be soon converted to - // TlsMasterSecret. - return new SecretKeySpec(b, "TlsRsaPremasterSecret"); } } diff --git a/jdk/src/share/classes/sun/security/pkcs11/Token.java b/jdk/src/share/classes/sun/security/pkcs11/Token.java index b97ab0cc998..39d301ae7b8 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/Token.java +++ b/jdk/src/share/classes/sun/security/pkcs11/Token.java @@ -36,6 +36,7 @@ import javax.security.auth.login.LoginException; import sun.security.jca.JCAUtil; import sun.security.pkcs11.wrapper.*; +import static sun.security.pkcs11.TemplateManager.*; import static sun.security.pkcs11.wrapper.PKCS11Constants.*; /** @@ -122,6 +123,9 @@ class Token implements Serializable { private final static CK_MECHANISM_INFO INVALID_MECH = new CK_MECHANISM_INFO(0, 0, 0); + // flag indicating whether the token supports raw secret key material import + private Boolean supportsRawSecretKeyImport; + Token(SunPKCS11 provider) throws PKCS11Exception { this.provider = provider; this.removable = provider.removable; @@ -160,6 +164,36 @@ class Token implements Serializable { return writeProtected; } + // return whether the token supports raw secret key material import + boolean supportsRawSecretKeyImport() { + if (supportsRawSecretKeyImport == null) { + SecureRandom random = JCAUtil.getSecureRandom(); + byte[] encoded = new byte[48]; + random.nextBytes(encoded); + + CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[3]; + attributes[0] = new CK_ATTRIBUTE(CKA_CLASS, CKO_SECRET_KEY); + attributes[1] = new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_GENERIC_SECRET); + attributes[2] = new CK_ATTRIBUTE(CKA_VALUE, encoded); + + Session session = null; + try { + attributes = getAttributes(O_IMPORT, + CKO_SECRET_KEY, CKK_GENERIC_SECRET, attributes); + session = getObjSession(); + long keyID = p11.C_CreateObject(session.id(), attributes); + + supportsRawSecretKeyImport = Boolean.TRUE; + } catch (PKCS11Exception e) { + supportsRawSecretKeyImport = Boolean.FALSE; + } finally { + releaseSession(session); + } + } + + return supportsRawSecretKeyImport; + } + // return whether we are logged in // uses cached result if current. session is optional and may be null boolean isLoggedIn(Session session) throws PKCS11Exception { diff --git a/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java b/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java index 36e4310fef1..11da51e56d7 100644 --- a/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java +++ b/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java @@ -48,23 +48,6 @@ import sun.security.util.KeyUtil; */ final class RSAClientKeyExchange extends HandshakeMessage { - /** - * The TLS spec says that the version in the RSA premaster secret must - * be the maximum version supported by the client (i.e. the version it - * requested in its client hello version). However, we (and other - * implementations) used to send the active negotiated version. The - * system property below allows to toggle the behavior. - */ - private final static String PROP_NAME = - "com.sun.net.ssl.rsaPreMasterSecretFix"; - - /* - * Default is "false" (old behavior) for compatibility reasons in - * SSLv3/TLSv1. Later protocols (TLSv1.1+) do not use this property. - */ - private final static boolean rsaPreMasterSecretFix = - Debug.getBooleanProperty(PROP_NAME, false); - /* * The following field values were encrypted with the server's public * key (or temp key from server key exchange msg) and are presented @@ -88,22 +71,12 @@ final class RSAClientKeyExchange extends HandshakeMessage { } this.protocolVersion = protocolVersion; - int major, minor; - - if (rsaPreMasterSecretFix || maxVersion.v >= ProtocolVersion.TLS11.v) { - major = maxVersion.major; - minor = maxVersion.minor; - } else { - major = protocolVersion.major; - minor = protocolVersion.minor; - } - try { String s = ((protocolVersion.v >= ProtocolVersion.TLS12.v) ? "SunTls12RsaPremasterSecret" : "SunTlsRsaPremasterSecret"); KeyGenerator kg = JsseJce.getKeyGenerator(s); - kg.init(new TlsRsaPremasterSecretParameterSpec(major, minor), - generator); + kg.init(new TlsRsaPremasterSecretParameterSpec( + maxVersion.v, protocolVersion.v), generator); preMaster = kg.generateKey(); Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1); @@ -138,18 +111,17 @@ final class RSAClientKeyExchange extends HandshakeMessage { } } - Exception failover = null; - byte[] encoded = null; try { Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1); // Cannot generate key here, please don't use Cipher.UNWRAP_MODE! - cipher.init(Cipher.DECRYPT_MODE, privateKey); - encoded = cipher.doFinal(encrypted); - } catch (BadPaddingException bpe) { - failover = bpe; - encoded = null; - } catch (IllegalBlockSizeException ibse) { - // the message it too big to process with RSA + cipher.init(Cipher.UNWRAP_MODE, privateKey, + new TlsRsaPremasterSecretParameterSpec( + maxVersion.v, currentVersion.v), + generator); + preMaster = (SecretKey)cipher.unwrap(encrypted, + "TlsRsaPremasterSecret", Cipher.SECRET_KEY); + } catch (InvalidKeyException ibk) { + // the message is too big to process with RSA throw new SSLProtocolException( "Unable to process PreMasterSecret, may be too big"); } catch (Exception e) { @@ -160,124 +132,6 @@ final class RSAClientKeyExchange extends HandshakeMessage { } throw new RuntimeException("Could not generate dummy secret", e); } - - // polish the premaster secret - preMaster = polishPreMasterSecretKey( - currentVersion, maxVersion, generator, encoded, failover); - } - - /** - * To avoid vulnerabilities described by section 7.4.7.1, RFC 5246, - * treating incorrectly formatted message blocks and/or mismatched - * version numbers in a manner indistinguishable from correctly - * formatted RSA blocks. - * - * RFC 5246 describes the approach as : - * - * 1. Generate a string R of 48 random bytes - * - * 2. Decrypt the message to recover the plaintext M - * - * 3. If the PKCS#1 padding is not correct, or the length of message - * M is not exactly 48 bytes: - * pre_master_secret = R - * else If ClientHello.client_version <= TLS 1.0, and version - * number check is explicitly disabled: - * premaster secret = M - * else If M[0..1] != ClientHello.client_version: - * premaster secret = R - * else: - * premaster secret = M - * - * Note that #2 has completed before the call of this method. - */ - private SecretKey polishPreMasterSecretKey(ProtocolVersion currentVersion, - ProtocolVersion clientHelloVersion, SecureRandom generator, - byte[] encoded, Exception failoverException) { - - this.protocolVersion = clientHelloVersion; - if (generator == null) { - generator = new SecureRandom(); - } - byte[] random = new byte[48]; - generator.nextBytes(random); - - if (failoverException == null && encoded != null) { - // check the length - if (encoded.length != 48) { - if (debug != null && Debug.isOn("handshake")) { - System.out.println( - "incorrect length of premaster secret: " + - encoded.length); - } - - return generatePreMasterSecret( - clientHelloVersion, random, generator); - } - - if (clientHelloVersion.major != encoded[0] || - clientHelloVersion.minor != encoded[1]) { - - if (clientHelloVersion.v <= ProtocolVersion.TLS10.v && - currentVersion.major == encoded[0] && - currentVersion.minor == encoded[1]) { - /* - * For compatibility, we maintain the behavior that the - * version in pre_master_secret can be the negotiated - * version for TLS v1.0 and SSL v3.0. - */ - this.protocolVersion = currentVersion; - } else { - if (debug != null && Debug.isOn("handshake")) { - System.out.println("Mismatching Protocol Versions, " + - "ClientHello.client_version is " + - clientHelloVersion + - ", while PreMasterSecret.client_version is " + - ProtocolVersion.valueOf(encoded[0], encoded[1])); - } - - encoded = random; - } - } - - return generatePreMasterSecret( - clientHelloVersion, encoded, generator); - } - - if (debug != null && Debug.isOn("handshake") && - failoverException != null) { - System.out.println("Error decrypting premaster secret:"); - failoverException.printStackTrace(System.out); - } - - return generatePreMasterSecret(clientHelloVersion, random, generator); - } - - // generate a premaster secret with the specified version number - private static SecretKey generatePreMasterSecret( - ProtocolVersion version, byte[] encodedSecret, - SecureRandom generator) { - - if (debug != null && Debug.isOn("handshake")) { - System.out.println("Generating a random fake premaster secret"); - } - - try { - String s = ((version.v >= ProtocolVersion.TLS12.v) ? - "SunTls12RsaPremasterSecret" : "SunTlsRsaPremasterSecret"); - KeyGenerator kg = JsseJce.getKeyGenerator(s); - kg.init(new TlsRsaPremasterSecretParameterSpec( - version.major, version.minor, encodedSecret), generator); - return kg.generateKey(); - } catch (InvalidAlgorithmParameterException | - NoSuchAlgorithmException iae) { - // unlikely to happen, otherwise, must be a provider exception - if (debug != null && Debug.isOn("handshake")) { - System.out.println("RSA premaster secret generation error:"); - iae.printStackTrace(System.out); - } - throw new RuntimeException("Could not generate dummy secret", iae); - } } @Override diff --git a/jdk/src/share/classes/sun/security/util/KeyUtil.java b/jdk/src/share/classes/sun/security/util/KeyUtil.java index cbaa8a5e23a..9c881b8031c 100644 --- a/jdk/src/share/classes/sun/security/util/KeyUtil.java +++ b/jdk/src/share/classes/sun/security/util/KeyUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -32,6 +32,7 @@ import java.security.InvalidKeyException; import java.security.interfaces.ECKey; import java.security.interfaces.RSAKey; import java.security.interfaces.DSAKey; +import java.security.SecureRandom; import java.security.spec.KeySpec; import javax.crypto.SecretKey; import javax.crypto.interfaces.DHKey; @@ -156,6 +157,79 @@ public final class KeyUtil { providerName.startsWith("SunPKCS11")); } + /** + * Check the format of TLS PreMasterSecret. + *

      + * To avoid vulnerabilities described by section 7.4.7.1, RFC 5246, + * treating incorrectly formatted message blocks and/or mismatched + * version numbers in a manner indistinguishable from correctly + * formatted RSA blocks. + * + * RFC 5246 describes the approach as : + * + * 1. Generate a string R of 48 random bytes + * + * 2. Decrypt the message to recover the plaintext M + * + * 3. If the PKCS#1 padding is not correct, or the length of message + * M is not exactly 48 bytes: + * pre_master_secret = R + * else If ClientHello.client_version <= TLS 1.0, and version + * number check is explicitly disabled: + * premaster secret = M + * else If M[0..1] != ClientHello.client_version: + * premaster secret = R + * else: + * premaster secret = M + * + * Note that #2 should have completed before the call to this method. + * + * @param clientVersion the version of the TLS protocol by which the + * client wishes to communicate during this session + * @param serverVersion the negotiated version of the TLS protocol which + * contains the lower of that suggested by the client in the client + * hello and the highest supported by the server. + * @param encoded the encoded key in its "RAW" encoding format + * @param isFailover whether or not the previous decryption of the + * encrypted PreMasterSecret message run into problem + * @return the polished PreMasterSecret key in its "RAW" encoding format + */ + public static byte[] checkTlsPreMasterSecretKey( + int clientVersion, int serverVersion, SecureRandom random, + byte[] encoded, boolean isFailOver) { + + if (random == null) { + random = new SecureRandom(); + } + byte[] replacer = new byte[48]; + random.nextBytes(replacer); + + if (!isFailOver && (encoded != null)) { + // check the length + if (encoded.length != 48) { + // private, don't need to clone the byte array. + return replacer; + } + + int encodedVersion = + ((encoded[0] & 0xFF) << 8) | (encoded[1] & 0xFF); + if (clientVersion != encodedVersion) { + if (clientVersion > 0x0301 || // 0x0301: TLSv1 + serverVersion != encodedVersion) { + encoded = replacer; + } // Otherwise, For compatibility, we maintain the behavior + // that the version in pre_master_secret can be the + // negotiated version for TLS v1.0 and SSL v3.0. + } + + // private, don't need to clone the byte array. + return encoded; + } + + // private, don't need to clone the byte array. + return replacer; + } + /** * Returns whether the Diffie-Hellman public key is valid or not. * diff --git a/jdk/src/share/classes/sun/tools/java/AmbiguousClass.java b/jdk/src/share/classes/sun/tools/java/AmbiguousClass.java index c58da0bb630..e8814d05284 100644 --- a/jdk/src/share/classes/sun/tools/java/AmbiguousClass.java +++ b/jdk/src/share/classes/sun/tools/java/AmbiguousClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -34,6 +34,7 @@ package sun.tools.java; * they are subject to change or removal without notice. */ +@SuppressWarnings("serial") // JDK implementation class public class AmbiguousClass extends ClassNotFound { /** diff --git a/jdk/src/share/classes/sun/tools/java/AmbiguousMember.java b/jdk/src/share/classes/sun/tools/java/AmbiguousMember.java index 8d8d3be4a5e..cad2bd6f9c5 100644 --- a/jdk/src/share/classes/sun/tools/java/AmbiguousMember.java +++ b/jdk/src/share/classes/sun/tools/java/AmbiguousMember.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -35,6 +35,7 @@ import java.util.Enumeration; * supported API. Code that depends on them does so at its own risk: * they are subject to change or removal without notice. */ +@SuppressWarnings("serial") // JDK implementation class public class AmbiguousMember extends Exception { /** diff --git a/jdk/src/share/classes/sun/tools/java/ClassNotFound.java b/jdk/src/share/classes/sun/tools/java/ClassNotFound.java index 2bdc2712d56..5d58bfbae13 100644 --- a/jdk/src/share/classes/sun/tools/java/ClassNotFound.java +++ b/jdk/src/share/classes/sun/tools/java/ClassNotFound.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -33,6 +33,7 @@ package sun.tools.java; * supported API. Code that depends on them does so at its own risk: * they are subject to change or removal without notice. */ +@SuppressWarnings("serial") // JDK implementation class public class ClassNotFound extends Exception { /** diff --git a/jdk/src/share/classes/sun/tools/java/CompilerError.java b/jdk/src/share/classes/sun/tools/java/CompilerError.java index d8ffc59afaa..1a25fbe6690 100644 --- a/jdk/src/share/classes/sun/tools/java/CompilerError.java +++ b/jdk/src/share/classes/sun/tools/java/CompilerError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -32,7 +32,7 @@ package sun.tools.java; * supported API. Code that depends on them does so at its own risk: * they are subject to change or removal without notice. */ - +@SuppressWarnings("serial") // JDK implementation class public class CompilerError extends Error { Throwable e; diff --git a/jdk/src/share/classes/sun/tools/java/SyntaxError.java b/jdk/src/share/classes/sun/tools/java/SyntaxError.java index deae9d68985..ab07100c430 100644 --- a/jdk/src/share/classes/sun/tools/java/SyntaxError.java +++ b/jdk/src/share/classes/sun/tools/java/SyntaxError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -33,7 +33,7 @@ package sun.tools.java; * supported API. Code that depends on them does so at its own risk: * they are subject to change or removal without notice. */ - +@SuppressWarnings("serial") // JDK implementation class public class SyntaxError extends Exception { } diff --git a/jdk/src/share/classes/sun/tools/jconsole/Tab.java b/jdk/src/share/classes/sun/tools/jconsole/Tab.java index 0ca2c7faae7..9af0c5e4f50 100644 --- a/jdk/src/share/classes/sun/tools/jconsole/Tab.java +++ b/jdk/src/share/classes/sun/tools/jconsole/Tab.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -28,6 +28,7 @@ package sun.tools.jconsole; import java.awt.*; import javax.swing.*; +@SuppressWarnings("serial") // JDK implementation class public abstract class Tab extends JPanel { private String name; private Worker worker; diff --git a/jdk/src/share/classes/sun/tools/jconsole/inspector/XOperations.java b/jdk/src/share/classes/sun/tools/jconsole/inspector/XOperations.java index 855a76aa8db..c29be4b9f0e 100644 --- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XOperations.java +++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XOperations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -39,6 +39,7 @@ import sun.tools.jconsole.MBeansTab; import sun.tools.jconsole.JConsole; import sun.tools.jconsole.Messages; +@SuppressWarnings("serial") // JDK implementation class public abstract class XOperations extends JPanel implements ActionListener { public final static String OPERATION_INVOCATION_EVENT = diff --git a/jdk/src/share/classes/sun/tools/jconsole/inspector/XTable.java b/jdk/src/share/classes/sun/tools/jconsole/inspector/XTable.java index 4f9b24a9555..a18e84f3ca3 100644 --- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XTable.java +++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -33,6 +33,7 @@ import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; +@SuppressWarnings("serial") // JDK implementation class public abstract class XTable extends JTable { static final int NAME_COLUMN = 0; static final int VALUE_COLUMN = 1; diff --git a/jdk/src/share/classes/sun/tools/jstat/Jstat.java b/jdk/src/share/classes/sun/tools/jstat/Jstat.java index c101db0f92c..ad1e069c9a8 100644 --- a/jdk/src/share/classes/sun/tools/jstat/Jstat.java +++ b/jdk/src/share/classes/sun/tools/jstat/Jstat.java @@ -70,16 +70,7 @@ public class Jstat { logSamples(); } } catch (MonitorException e) { - if (e.getMessage() != null) { - System.err.println(e.getMessage()); - } else { - Throwable cause = e.getCause(); - if ((cause != null) && (cause.getMessage() != null)) { - System.err.println(cause.getMessage()); - } else { - e.printStackTrace(); - } - } + e.printStackTrace(); System.exit(1); } System.exit(0); diff --git a/jdk/src/share/classes/sun/tools/jstat/ParserException.java b/jdk/src/share/classes/sun/tools/jstat/ParserException.java index d20c8783d71..3cbb99284f8 100644 --- a/jdk/src/share/classes/sun/tools/jstat/ParserException.java +++ b/jdk/src/share/classes/sun/tools/jstat/ParserException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -31,6 +31,7 @@ package sun.tools.jstat; * @author Brian Doherty * @since 1.5 */ +@SuppressWarnings("serial") // JDK implementation class public class ParserException extends Exception { public ParserException() { diff --git a/jdk/src/share/classes/sun/tools/jstat/SyntaxException.java b/jdk/src/share/classes/sun/tools/jstat/SyntaxException.java index 85d774e6b51..65a058c3931 100644 --- a/jdk/src/share/classes/sun/tools/jstat/SyntaxException.java +++ b/jdk/src/share/classes/sun/tools/jstat/SyntaxException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -36,6 +36,7 @@ import java.util.Iterator; * @author Brian Doherty * @since 1.5 */ +@SuppressWarnings("serial") // JDK implementation class public class SyntaxException extends ParserException { private String message; diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java index 2aaa1e76dc4..298a233d850 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java @@ -570,6 +570,9 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Syowa Time", "SYOT", "Syowa Summer Time", "SYOST", "Syowa Time", "SYOT"}}, + {"Antarctica/Troll", new String[] {"Coordinated Universal Time", "UTC", + "Central European Summer Time", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Vostok Time", "VOST", "Vostok Summer Time", "VOSST", "Vostok Time", "VOST"}}, @@ -839,7 +842,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { "Samara Time", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/de/TimeZoneNames_de.java b/jdk/src/share/classes/sun/util/resources/de/TimeZoneNames_de.java index 4d25bce3586..ea7ab573a71 100644 --- a/jdk/src/share/classes/sun/util/resources/de/TimeZoneNames_de.java +++ b/jdk/src/share/classes/sun/util/resources/de/TimeZoneNames_de.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Syowa Zeit", "SYOT", "Syowa Sommerzeit", "SYOST", "Syowa Zeit", "SYOT"}}, + {"Antarctica/Troll", new String[] {"Koordinierte Universalzeit", "UTC", + "Mitteleurop\u00e4ische Sommerzeit", "MESZ", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Vostok Zeit", "VOST", "Vostok Sommerzeit", "VOSST", "Vostok Zeit", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { "Samarische Zeit", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/es/TimeZoneNames_es.java b/jdk/src/share/classes/sun/util/resources/es/TimeZoneNames_es.java index 07d77325a47..c35c80963be 100644 --- a/jdk/src/share/classes/sun/util/resources/es/TimeZoneNames_es.java +++ b/jdk/src/share/classes/sun/util/resources/es/TimeZoneNames_es.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Hora de Syowa", "SYOT", "Hora de verano de Syowa", "SYOST", "Hora de Syowa", "SYOT"}}, + {"Antarctica/Troll", new String[] {"Hora Universal Coordinada", "UTC", + "Hora de verano de Europa Central", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Hora de Vostok", "VOST", "Hora de verano de Vostok", "VOSST", "Hora de Vostok", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { "Hora de Samara", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java b/jdk/src/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java index d15b9056057..393e45d4549 100644 --- a/jdk/src/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java +++ b/jdk/src/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Heure de Syowa", "SYOT", "Heure d'\u00e9t\u00e9 de Syowa", "SYOST", "Heure de Syowa", "SYOT"}}, + {"Antarctica/Troll", new String[] {"Temps universel coordonn\u00e9", "UTC", + "Heure d'\u00e9t\u00e9 d'Europe centrale", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Heure de Vostok", "VOST", "Heure d'\u00e9t\u00e9 de Vostok", "VOSST", "Heure de Vostok", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { "Heure de Samara", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/it/TimeZoneNames_it.java b/jdk/src/share/classes/sun/util/resources/it/TimeZoneNames_it.java index a07be9af4a6..309a7715c7d 100644 --- a/jdk/src/share/classes/sun/util/resources/it/TimeZoneNames_it.java +++ b/jdk/src/share/classes/sun/util/resources/it/TimeZoneNames_it.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Ora di Syowa", "SYOT", "Ora estiva di Syowa", "SYOST", "Ora di Syowa", "SYOT"}}, + {"Antarctica/Troll", new String[] {"Tempo universale coordinato", "UTC", + "Ora estiva dell'Europa centrale", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Ora di Vostok", "VOST", "Ora estiva di Vostok", "VOSST", "Ora di Vostok", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { "Ora di Samara", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java b/jdk/src/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java index 5a0f5e7012a..23bbcd6c8e0 100644 --- a/jdk/src/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java +++ b/jdk/src/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"\u662d\u548c\u57fa\u5730\u6642\u9593", "SYOT", "\u662d\u548c\u57fa\u5730\u590f\u6642\u9593", "SYOST", "\u662D\u548C\u57FA\u5730\u6642\u9593", "SYOT"}}, + {"Antarctica/Troll", new String[] {"\u5354\u5b9a\u4e16\u754c\u6642", "UTC", + "\u4e2d\u90e8\u30e8\u30fc\u30ed\u30c3\u30d1\u590f\u6642\u9593", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"\u30dc\u30b9\u30c8\u30fc\u30af\u57fa\u5730\u6642\u9593", "VOST", "\u30dc\u30b9\u30c8\u30fc\u30af\u57fa\u5730\u590f\u6642\u9593", "VOSST", "\u30DC\u30B9\u30C8\u30FC\u30AF\u6642\u9593", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { "\u30B5\u30DE\u30E9\u6642\u9593", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java b/jdk/src/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java index 4d9f395fd55..d1e106e2cd8 100644 --- a/jdk/src/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java +++ b/jdk/src/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Syowa \uc2dc\uac04", "SYOT", "Syowa \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "SYOST", "\uC1FC\uC640 \uD45C\uC900\uC2DC", "SYOT"}}, + {"Antarctica/Troll", new String[] {"\uc138\uacc4 \ud45c\uc900\uc2dc", "UTC", + "\uc911\uc559 \uc720\ub7fd \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Vostok \uc2dc\uac04", "VOST", "Vostok \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "VOSST", "\uBCF4\uC2A4\uD1A1 \uD45C\uC900\uC2DC", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { "\uC0AC\uB9C8\uB77C \uD45C\uC900\uC2DC", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java b/jdk/src/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java index 07b13ae48ec..21852adbb67 100644 --- a/jdk/src/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java +++ b/jdk/src/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT", "Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST", "Hor\u00E1rio de Syowa", "SYOT"}}, + {"Antarctica/Troll", new String[] {"Tempo universal coordenado", "UTC", + "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST", "Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST", "Hor\u00E1rio de Vostok", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { "Hor\u00E1rio de Samara", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java b/jdk/src/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java index 5dfb716c627..dd509e15142 100644 --- a/jdk/src/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java +++ b/jdk/src/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Syowa, normaltid", "SYOT", "Syowa, sommartid", "SYOST", "Syowa-tid", "SYOT"}}, + {"Antarctica/Troll", new String[] {"Koordinerad universell tid", "UTC", + "Centraleuropeisk sommartid", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"Vostok, normaltid", "VOST", "Vostok, sommartid", "VOSST", "Vostok-tid", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { "Samara-tid", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java b/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java index 62a946ba437..e4fca385baa 100644 --- a/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java +++ b/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"Syowa \u65f6\u95f4", "SYOT", "Syowa \u590f\u4ee4\u65f6", "SYOST", "Syowa \u65F6\u95F4", "SYOT"}}, + {"Antarctica/Troll", new String[] {"\u534f\u8c03\u4e16\u754c\u65f6\u95f4", "UTC", + "\u4e2d\u6b27\u590f\u4ee4\u65f6", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"\u83ab\u65af\u6258\u514b\u65f6\u95f4", "VOST", "\u83ab\u65af\u6258\u514b\u590f\u4ee4\u65f6", "VOSST", "\u83AB\u65AF\u6258\u514B\u65F6\u95F4", "VOST"}}, @@ -838,7 +841,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { "\u6C99\u9A6C\u62C9\u65F6\u95F4", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java b/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java index f91da7afb3d..20cfa231737 100644 --- a/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java +++ b/jdk/src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java @@ -570,6 +570,9 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { {"Antarctica/Syowa", new String[] {"\u5915\u6b50\u74e6 (Syowa) \u6642\u9593", "SYOT", "\u5915\u6b50\u74e6 (Syowa) \u590f\u4ee4\u6642\u9593", "SYOST", "\u5915\u6B50\u74E6 (Syowa) \u6642\u9593", "SYOT"}}, + {"Antarctica/Troll", new String[] {"\u5354\u8abf\u4e16\u754c\u6642\u9593", "UTC", + "\u4e2d\u6b50\u590f\u4ee4\u6642\u9593", "CEST", + "Troll Time", "ATT"}}, {"Antarctica/Vostok", new String[] {"\u4f5b\u65af\u6258 (Vostok) \u6642\u9593", "VOST", "\u4f5b\u65af\u6258 (Vostok) \u590f\u4ee4\u6642\u9593", "VOSST", "\u4F5B\u65AF\u6258 (Vostok) \u6642\u9593", "VOST"}}, @@ -840,7 +843,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { "\u6C99\u99AC\u62C9\u6642\u9593", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, + {"Europe/Simferopol", MSK}, {"Europe/Skopje", CET}, {"Europe/Sofia", EET}, {"Europe/Stockholm", CET}, diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java index 7ab29629a18..023725b6205 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java @@ -35,6 +35,8 @@ import javax.crypto.*; import javax.crypto.spec.*; import sun.security.rsa.RSAKeyFactory; +import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; +import sun.security.util.KeyUtil; /** * RSA cipher implementation using the Microsoft Crypto API. @@ -92,9 +94,16 @@ public final class RSACipher extends CipherSpi { // the public key, if we were initialized using a public key private sun.security.mscapi.Key publicKey; + // the private key, if we were initialized using a private key private sun.security.mscapi.Key privateKey; + // cipher parameter for TLS RSA premaster secret + private AlgorithmParameterSpec spec = null; + + // the source of randomness + private SecureRandom random; + public RSACipher() { paddingType = PAD_PKCS1; } @@ -155,8 +164,12 @@ public final class RSACipher extends CipherSpi { throws InvalidKeyException, InvalidAlgorithmParameterException { if (params != null) { - throw new InvalidAlgorithmParameterException - ("Parameters not supported"); + if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new InvalidAlgorithmParameterException( + "Parameters not supported"); + } + spec = params; + this.random = random; // for TLS RSA premaster secret } init(opmode, key); } @@ -356,39 +369,47 @@ public final class RSACipher extends CipherSpi { } // see JCE spec - protected java.security.Key engineUnwrap(byte[] wrappedKey, String algorithm, + protected java.security.Key engineUnwrap(byte[] wrappedKey, + String algorithm, int type) throws InvalidKeyException, NoSuchAlgorithmException { if (wrappedKey.length > buffer.length) { throw new InvalidKeyException("Key is too long for unwrapping"); } + + boolean isTlsRsaPremasterSecret = + algorithm.equals("TlsRsaPremasterSecret"); + Exception failover = null; + byte[] encoded = null; + update(wrappedKey, 0, wrappedKey.length); - try { - byte[] encoding = doFinal(); - - switch (type) { - case Cipher.PUBLIC_KEY: - return constructPublicKey(encoding, algorithm); - - case Cipher.PRIVATE_KEY: - return constructPrivateKey(encoding, algorithm); - - case Cipher.SECRET_KEY: - return constructSecretKey(encoding, algorithm); - - default: - throw new InvalidKeyException("Unknown key type " + type); - } - + encoded = doFinal(); } catch (BadPaddingException e) { - // should not occur - throw new InvalidKeyException("Unwrapping failed", e); - + if (isTlsRsaPremasterSecret) { + failover = e; + } else { + throw new InvalidKeyException("Unwrapping failed", e); + } } catch (IllegalBlockSizeException e) { // should not occur, handled with length check above throw new InvalidKeyException("Unwrapping failed", e); } + + if (isTlsRsaPremasterSecret) { + if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new IllegalStateException( + "No TlsRsaPremasterSecretParameterSpec specified"); + } + + // polish the TLS premaster secret + encoded = KeyUtil.checkTlsPreMasterSecretKey( + ((TlsRsaPremasterSecretParameterSpec)spec).getClientVersion(), + ((TlsRsaPremasterSecretParameterSpec)spec).getServerVersion(), + random, encoded, (failover != null)); + } + + return constructKey(encoded, algorithm, type); } // see JCE spec @@ -452,6 +473,22 @@ public final class RSACipher extends CipherSpi { return new SecretKeySpec(encodedKey, encodedKeyAlgorithm); } + private static Key constructKey(byte[] encodedKey, + String encodedKeyAlgorithm, + int keyType) throws InvalidKeyException, NoSuchAlgorithmException { + + switch (keyType) { + case Cipher.PUBLIC_KEY: + return constructPublicKey(encodedKey, encodedKeyAlgorithm); + case Cipher.PRIVATE_KEY: + return constructPrivateKey(encodedKey, encodedKeyAlgorithm); + case Cipher.SECRET_KEY: + return constructSecretKey(encodedKey, encodedKeyAlgorithm); + default: + throw new InvalidKeyException("Unknown key type " + keyType); + } + } + /* * Encrypt/decrypt a data buffer using Microsoft Crypto API with HCRYPTKEY. * It expects and returns ciphertext data in big-endian form. diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 729a0d852dd..2b18741c05b 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -273,4 +273,7 @@ java/lang/instrument/NativeMethodPrefixAgent.java generic-all # 8031482 sun/tools/jcmd/TestJcmdSanity.java windows-all +# 8033104 +sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all + ############################################################################ diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups index 8e45f1998f7..12b1ba79322 100644 --- a/jdk/test/TEST.groups +++ b/jdk/test/TEST.groups @@ -102,7 +102,6 @@ jdk_nio = \ jdk_net = \ java/net \ com/sun/net/httpserver \ - com/oracle/net \ sun/net jdk_time = \ diff --git a/jdk/test/com/oracle/net/Sanity.java b/jdk/test/com/oracle/net/Sanity.java deleted file mode 100644 index c4c97152779..00000000000 --- a/jdk/test/com/oracle/net/Sanity.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -import com.oracle.net.Sdp; - -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.*; - -/** - * Exercise com.oracle.net.Sdp with each IP address plumbed to InfiniBand - * interfaces listed in a given file. - */ - -public class Sanity { - public static void main(String[] args) throws Exception { - // The file is a list of interfaces to test. - Scanner s = new Scanner(new File(args[0])); - try { - while (s.hasNextLine()) { - String link = s.nextLine(); - NetworkInterface ni = NetworkInterface.getByName(link); - if (ni != null) { - Enumeration addrs = ni.getInetAddresses(); - while (addrs.hasMoreElements()) { - InetAddress addr = addrs.nextElement(); - System.out.format("Testing %s: %s\n", link, addr.getHostAddress()); - test(addr); - } - } - } - } finally { - s.close(); - } - } - - static void test(InetAddress addr) throws Exception { - // Test SocketChannel and ServerSocketChannel - ServerSocketChannel ssc = Sdp.openServerSocketChannel(); - try { - ssc.socket().bind(new InetSocketAddress(addr, 0)); - int port = ssc.socket().getLocalPort(); - - // SocketChannel.connect (implicit bind) - SocketChannel client = Sdp.openSocketChannel(); - try { - client.connect(new InetSocketAddress(addr, port)); - SocketChannel peer = ssc.accept(); - try { - testConnection(Channels.newOutputStream(client), - Channels.newInputStream(peer)); - } finally { - peer.close(); - } - } finally { - client.close(); - } - - // SocketChannel.connect (explicit bind) - client = Sdp.openSocketChannel(); - try { - client.socket().bind(new InetSocketAddress(addr, 0)); - client.connect(new InetSocketAddress(addr, port)); - ssc.accept().close(); - } finally { - client.close(); - } - } finally { - ssc.close(); - } - - // Test Socket and ServerSocket - ServerSocket ss = Sdp.openServerSocket(); - try { - ss.bind(new InetSocketAddress(addr, 0)); - int port = ss.getLocalPort(); - - // Socket.connect (implicit bind) - Socket s = Sdp.openSocket(); - try { - s.connect(new InetSocketAddress(addr, port)); - Socket peer = ss.accept(); - try { - testConnection(s.getOutputStream(), peer.getInputStream()); - } finally { - peer.close(); - } - } finally { - s.close(); - } - - // Socket.connect (explicit bind) - s = Sdp.openSocket(); - try { - s.bind(new InetSocketAddress(addr, 0)); - s.connect(new InetSocketAddress(addr, port)); - ss.accept().close(); - } finally { - s.close(); - } - } finally { - ss.close(); - } - } - - static void testConnection(OutputStream out, InputStream in) - throws IOException - { - byte[] msg = "hello".getBytes(); - out.write(msg); - - byte[] ba = new byte[100]; - int nread = 0; - while (nread < msg.length) { - int n = in.read(ba); - if (n < 0) - throw new IOException("EOF not expected!"); - nread += n; - } - } -} diff --git a/jdk/test/com/oracle/net/sanity.sh b/jdk/test/com/oracle/net/sanity.sh deleted file mode 100644 index b4c26acce02..00000000000 --- a/jdk/test/com/oracle/net/sanity.sh +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright (c) 2010, 2012, 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 6965072 -# @summary Unit test for SDP support -# @build Sanity -# @run shell sanity.sh - -IB_LINKS=ib.links - -OS=`uname -s` -case "$OS" in - SunOS ) - /usr/sbin/dladm show-part -o LINK -p > ${IB_LINKS} - if [ $? != 0 ]; then - echo "Unable to get InfiniBand parition link information" - exit 0 - fi - ;; - Linux ) - if [ ! -f /proc/net/sdp ]; then - echo "InfiniBand SDP module not installed" - exit 0 - fi - egrep "^[ \t]+ib" /proc/net/dev|cut -d':' -f1|tr -d '\t ' > ${IB_LINKS} - ;; - * ) - echo "This test only runs on Solaris or Linux" - exit 0 - ;; -esac - -if [ -z "$TESTJAVA" ]; then - JAVA=java - TESTCLASSES=. - TESTSRC=. -else - JAVA="${TESTJAVA}/bin/java" -fi - -CLASSPATH=${TESTCLASSES}:${TESTSRC} -export CLASSPATH - -# Run sanity test (IPv4-only for now) -$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true Sanity ${IB_LINKS} diff --git a/jdk/test/com/sun/crypto/provider/TLS/TestPremaster.java b/jdk/test/com/sun/crypto/provider/TLS/TestPremaster.java index bbbfbb6bdb3..f19e7546ddd 100644 --- a/jdk/test/com/sun/crypto/provider/TLS/TestPremaster.java +++ b/jdk/test/com/sun/crypto/provider/TLS/TestPremaster.java @@ -33,6 +33,7 @@ import java.security.Provider; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; +import java.util.Formatter; import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; @@ -52,27 +53,51 @@ public class TestPremaster { System.out.println("OK: " + e); } - test(kg, 3, 0); - test(kg, 3, 1); - test(kg, 3, 2); - test(kg, 4, 0); + int[] protocolVersions = {0x0300, 0x0301, 0x0302, 0x0400}; + for (int clientVersion : protocolVersions) { + for (int serverVersion : protocolVersions) { + test(kg, clientVersion, serverVersion); + if (serverVersion >= clientVersion) { + break; + } + } + } System.out.println("Done."); } - private static void test(KeyGenerator kg, int major, int minor) - throws Exception { + private static void test(KeyGenerator kg, + int clientVersion, int serverVersion) throws Exception { + + System.out.printf( + "Testing RSA pre-master secret key generation between " + + "client (0x%04X) and server(0x%04X)%n", + clientVersion, serverVersion); + kg.init(new TlsRsaPremasterSecretParameterSpec( + clientVersion, serverVersion)); - kg.init(new TlsRsaPremasterSecretParameterSpec(major, minor)); SecretKey key = kg.generateKey(); byte[] encoded = key.getEncoded(); - if (encoded.length != 48) { - throw new Exception("length: " + encoded.length); - } - if ((encoded[0] != major) || (encoded[1] != minor)) { - throw new Exception("version mismatch: " + encoded[0] + - "." + encoded[1]); - } - System.out.println("OK: " + major + "." + minor); + if (encoded != null) { // raw key material may be not extractable + if (encoded.length != 48) { + throw new Exception("length: " + encoded.length); + } + int v = versionOf(encoded[0], encoded[1]); + if (clientVersion != v) { + if (serverVersion != v || clientVersion >= 0x0302) { + throw new Exception(String.format( + "version mismatch: (0x%04X) rather than (0x%04X) " + + "is used in pre-master secret", v, clientVersion)); + } + System.out.printf("Use compatible version (0x%04X)%n", v); + } + System.out.println("Passed, version matches!"); + } else { + System.out.println("Raw key material is not extractable"); + } + } + + private static int versionOf(int major, int minor) { + return ((major & 0xFF) << 8) | (minor & 0xFF); } } diff --git a/jdk/test/com/sun/jdi/SimulResumerTest.java b/jdk/test/com/sun/jdi/SimulResumerTest.java index f652494be45..83e74cb7cb4 100644 --- a/jdk/test/com/sun/jdi/SimulResumerTest.java +++ b/jdk/test/com/sun/jdi/SimulResumerTest.java @@ -177,12 +177,18 @@ public class SimulResumerTest extends TestScaffold { List frames = thr.frames(); // no failure return value here; could cause an NPE - int nframes = frames.size(); - if (nframes > 0) { - // hmm, how could it ever be 0? - kind = "frames(0, size - 1)"; + kind = "frames(0, size - 1)"; System.out.println("kind = " + kind); - thr.frames(0, frames.size() - 1); + int nframes = frames.size(); + while (nframes > 0) { + try { + thr.frames(0, nframes - 1); + break; + } catch (IndexOutOfBoundsException iobe) { + // 6815126. let's try to get less frames + iobe.printStackTrace(); + nframes--; + } } kind = "frameCount()"; diff --git a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java index 638b053f086..01a8a3b47c4 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java +++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java @@ -64,6 +64,11 @@ public class LowMemoryTest2 { // low memory notification static class BoundlessLoaderThread extends ClassLoader implements Runnable { + private final List pools; + + public BoundlessLoaderThread(List pools) { + this.pools = pools; + } static int count = 100000; @@ -139,26 +144,29 @@ public class LowMemoryTest2 { * Then wait for the memory threshold notification to be received. */ public void run() { - List pools = ManagementFactory.getMemoryPoolMXBeans(); - boolean thresholdExceeded = false; - // Load classes until MemoryPoolMXBean.getUsageThresholdCount() > 0 - while (!thresholdExceeded) { - // the classes are small so we load 10 at a time - for (int i=0; i<10; i++) { - loadNext(); - } - - // check if the threshold has been exceeded - for (MemoryPoolMXBean p : pools) { - if (p.getType() == MemoryType.NON_HEAP && - p.isUsageThresholdSupported() && - p.getUsageThresholdCount() > 0) - { - thresholdExceeded = true; - break; + boolean isThresholdCountSet = false; + try { + while (!isThresholdCountSet) { + // the classes are small so we load 10 at a time + for (int i=0; i<10; i++) { + loadNext(); } + + if (isAnyUsageAboveThreshold(pools)) { + // UsageThresholdCount is only updated during GC. + // Force GC to update counters. + // If we don't force a GC we may get an + // OutOfMemoryException before the counters are updated. + System.out.println("Force GC"); + System.gc(); + } + isThresholdCountSet = isAnyThresholdCountSet(pools); } + } catch (OutOfMemoryError e) { + e.printStackTrace(); + MemoryUtil.printMemoryPools(pools); + throw e; } System.out.println("thresholdExceeded. Waiting for notification"); @@ -168,16 +176,39 @@ public class LowMemoryTest2 { } catch (InterruptedException x) {} } } + + private boolean isAnyUsageAboveThreshold(List pools) { + for (MemoryPoolMXBean p : pools) { + if (p.isUsageThresholdExceeded()) { + System.out.println("isAnyUsageAboveThreshold is true for " + p.getName()); + MemoryUtil.printMemoryPool(p); + return true; + } + } + return false; + } + + private boolean isAnyThresholdCountSet(List pools) { + for (MemoryPoolMXBean p : pools) { + if (p.getUsageThresholdCount() > 0) { + System.out.println("isAnyThresholdCountSet is true for " + p.getName()); + MemoryUtil.printMemoryPool(p); + return true; + } + } + return false; + } } public static void main(String args[]) { - List pools = ManagementFactory.getMemoryPoolMXBeans(); + // The pools list will only contain the pools that we are interested in. + List pools = new ArrayList(); // Set threshold of 80% of all NON_HEAP memory pools // In the Hotspot implementation this means we should get a notification // if the CodeCache or metaspace fills up. - for (MemoryPoolMXBean p : pools) { + for (MemoryPoolMXBean p : ManagementFactory.getMemoryPoolMXBeans()) { if (p.getType() == MemoryType.NON_HEAP && p.isUsageThresholdSupported()) { // set threshold @@ -190,6 +221,7 @@ public class LowMemoryTest2 { long threshold = (max * 80) / 100; p.setUsageThreshold(threshold); + pools.add(p); System.out.println("Selected memory pool for low memory " + "detection."); @@ -209,7 +241,7 @@ public class LowMemoryTest2 { // Start the thread loading classes - Thread thr = new Thread(new BoundlessLoaderThread()); + Thread thr = new Thread(new BoundlessLoaderThread(pools)); thr.start(); // Wait for the thread to terminate diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryUtil.java b/jdk/test/java/lang/management/MemoryMXBean/MemoryUtil.java index f6b88ab59e1..55605c6c1c4 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/MemoryUtil.java +++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryUtil.java @@ -54,6 +54,8 @@ public class MemoryUtil { pool.getUsage()); System.out.println(INDENT + "Threshold: " + (pool.isUsageThresholdSupported() ? pool.getUsageThreshold() : -1)); + System.out.println(INDENT + "ThresholdCount: " + + (pool.isUsageThresholdSupported() ? pool.getUsageThresholdCount() : -1)); System.out.print(INDENT + "Manager = ["); String[] mgrs = pool.getMemoryManagerNames(); for (int i = 0; i < mgrs.length; i++) { diff --git a/jdk/test/java/net/URI/Test.java b/jdk/test/java/net/URI/Test.java index 05d4cdbbfac..8e0e9247acd 100644 --- a/jdk/test/java/net/URI/Test.java +++ b/jdk/test/java/net/URI/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -1367,6 +1367,17 @@ public class Test { cmp0(u, v, true); } + static void eq(String expected, String actual) { + if (expected == null && actual == null) { + return; + } + if (expected != null && expected.equals(actual)) { + return; + } + throw new AssertionError(String.format( + "Strings are not equal: '%s', '%s'", expected, actual)); + } + static void eqeq(URI u, URI v) { testCount++; if (u != v) @@ -1588,7 +1599,12 @@ public class Test { // miscellaneous bugs/rfes that don't fit in with the test framework static void bugs() { - // 6339649 - include detail message from nested exception + b6339649(); + b8037396(); + } + + // 6339649 - include detail message from nested exception + private static void b6339649() { try { URI uri = URI.create("http://nowhere.net/should not be permitted"); } catch (IllegalArgumentException e) { @@ -1598,6 +1614,39 @@ public class Test { } } + private static void b8037396() { + + // primary checks: + + URI u; + try { + u = new URI("http", "example.org", "/[a b]", "[a b]", "[a b]"); + } catch (URISyntaxException e) { + throw new AssertionError("shouldn't ever happen", e); + } + eq("/[a b]", u.getPath()); + eq("[a b]", u.getQuery()); + eq("[a b]", u.getFragment()); + + // additional checks: + // * '%' symbols are still decoded outside square brackets + // * the getRawXXX() functionality left intact + + try { + u = new URI("http", "example.org", "/a b[c d]", "a b[c d]", "a b[c d]"); + } catch (URISyntaxException e) { + throw new AssertionError("shouldn't ever happen", e); + } + + eq("/a b[c d]", u.getPath()); + eq("a b[c d]", u.getQuery()); + eq("a b[c d]", u.getFragment()); + + eq("/a%20b%5Bc%20d%5D", u.getRawPath()); + eq("a%20b[c%20d]", u.getRawQuery()); + eq("a%20b[c%20d]", u.getRawFragment()); + } + public static void main(String[] args) throws Exception { switch (args.length) { diff --git a/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatter.java b/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatter.java index 8e2091e9888..9c0a783ec53 100644 --- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatter.java +++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatter.java @@ -254,14 +254,20 @@ public class TCKDateTimeFormatter { assertEquals(parsed.isSupported(YEAR), false); // not in the list of resolverFields } - @Test(expectedExceptions = NullPointerException.class) + @Test public void test_resolverFields_Array_null() throws Exception { - DateTimeFormatter.ISO_DATE.withResolverFields((TemporalField[]) null); + DateTimeFormatter f = DateTimeFormatter.ISO_DATE.withResolverFields(MONTH_OF_YEAR); + assertEquals(f.getResolverFields().size(), 1); + f = f.withResolverFields((TemporalField[]) null); + assertEquals(f.getResolverFields(), null); } - @Test(expectedExceptions = NullPointerException.class) + @Test public void test_resolverFields_Set_null() throws Exception { - DateTimeFormatter.ISO_DATE.withResolverFields((Set) null); + DateTimeFormatter f = DateTimeFormatter.ISO_DATE.withResolverFields(MONTH_OF_YEAR); + assertEquals(f.getResolverFields().size(), 1); + f = f.withResolverFields((Set) null); + assertEquals(f.getResolverFields(), null); } //----------------------------------------------------------------------- diff --git a/jdk/test/java/util/regex/RegExTest.java b/jdk/test/java/util/regex/RegExTest.java index cd6abd9be07..7cc7c784cf2 100644 --- a/jdk/test/java/util/regex/RegExTest.java +++ b/jdk/test/java/util/regex/RegExTest.java @@ -32,7 +32,7 @@ * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133 * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066 * 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590 - * 8027645 8035076 + * 8027645 8035076 8039124 */ import java.util.regex.*; @@ -75,7 +75,10 @@ public class RegExTest { // Substitition tests on randomly generated sequences globalSubstitute(); stringbufferSubstitute(); + stringbuilderSubstitute(); + substitutionBasher(); + substitutionBasher2(); // Canonical Equivalence ceTest(); @@ -296,10 +299,12 @@ public class RegExTest { final Matcher m = Pattern.compile("xyz").matcher("xyz"); m.matches(); - check(new Runnable() { public void run() { m.appendTail(null);}}); + check(new Runnable() { public void run() { m.appendTail((StringBuffer)null);}}); + check(new Runnable() { public void run() { m.appendTail((StringBuilder)null);}}); check(new Runnable() { public void run() { m.replaceAll(null);}}); check(new Runnable() { public void run() { m.replaceFirst(null);}}); - check(new Runnable() { public void run() { m.appendReplacement(null, null);}}); + check(new Runnable() { public void run() { m.appendReplacement((StringBuffer)null, null);}}); + check(new Runnable() { public void run() { m.appendReplacement((StringBuilder)null, null);}}); check(new Runnable() { public void run() { m.reset(null);}}); check(new Runnable() { public void run() { Matcher.quoteReplacement(null);}}); //check(new Runnable() { public void run() { m.usePattern(null);}}); @@ -2973,6 +2978,286 @@ public class RegExTest { report("SB Substitution"); } + /** + * Tests the usage of Matcher.appendReplacement() with literal + * and group substitutions. + */ + private static void stringbuilderSubstitute() throws Exception { + // SB substitution with literal + String blah = "zzzblahzzz"; + Pattern p = Pattern.compile("blah"); + Matcher m = p.matcher(blah); + StringBuilder result = new StringBuilder(); + try { + m.appendReplacement(result, "blech"); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, "blech"); + if (!result.toString().equals("zzzblech")) + failCount++; + + m.appendTail(result); + if (!result.toString().equals("zzzblechzzz")) + failCount++; + + // SB substitution with groups + blah = "zzzabcdzzz"; + p = Pattern.compile("(ab)(cd)*"); + m = p.matcher(blah); + result = new StringBuilder(); + try { + m.appendReplacement(result, "$1"); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, "$1"); + if (!result.toString().equals("zzzab")) + failCount++; + + m.appendTail(result); + if (!result.toString().equals("zzzabzzz")) + failCount++; + + // SB substitution with 3 groups + blah = "zzzabcdcdefzzz"; + p = Pattern.compile("(ab)(cd)*(ef)"); + m = p.matcher(blah); + result = new StringBuilder(); + try { + m.appendReplacement(result, "$1w$2w$3"); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, "$1w$2w$3"); + if (!result.toString().equals("zzzabwcdwef")) + failCount++; + + m.appendTail(result); + if (!result.toString().equals("zzzabwcdwefzzz")) + failCount++; + + // SB substitution with groups and three matches + // skipping middle match + blah = "zzzabcdzzzabcddzzzabcdzzz"; + p = Pattern.compile("(ab)(cd*)"); + m = p.matcher(blah); + result = new StringBuilder(); + try { + m.appendReplacement(result, "$1"); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, "$1"); + if (!result.toString().equals("zzzab")) + failCount++; + + m.find(); + m.find(); + m.appendReplacement(result, "$2"); + if (!result.toString().equals("zzzabzzzabcddzzzcd")) + failCount++; + + m.appendTail(result); + if (!result.toString().equals("zzzabzzzabcddzzzcdzzz")) + failCount++; + + // Check to make sure escaped $ is ignored + blah = "zzzabcdcdefzzz"; + p = Pattern.compile("(ab)(cd)*(ef)"); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + m.appendReplacement(result, "$1w\\$2w$3"); + if (!result.toString().equals("zzzabw$2wef")) + failCount++; + + m.appendTail(result); + if (!result.toString().equals("zzzabw$2wefzzz")) + failCount++; + + // Check to make sure a reference to nonexistent group causes error + blah = "zzzabcdcdefzzz"; + p = Pattern.compile("(ab)(cd)*(ef)"); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + try { + m.appendReplacement(result, "$1w$5w$3"); + failCount++; + } catch (IndexOutOfBoundsException ioobe) { + // Correct result + } + + // Check double digit group references + blah = "zzz123456789101112zzz"; + p = Pattern.compile("(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)"); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + m.appendReplacement(result, "$1w$11w$3"); + if (!result.toString().equals("zzz1w11w3")) + failCount++; + + // Check to make sure it backs off $15 to $1 if only three groups + blah = "zzzabcdcdefzzz"; + p = Pattern.compile("(ab)(cd)*(ef)"); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + m.appendReplacement(result, "$1w$15w$3"); + if (!result.toString().equals("zzzabwab5wef")) + failCount++; + + + // Supplementary character test + // SB substitution with literal + blah = toSupplementaries("zzzblahzzz"); + p = Pattern.compile(toSupplementaries("blah")); + m = p.matcher(blah); + result = new StringBuilder(); + try { + m.appendReplacement(result, toSupplementaries("blech")); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, toSupplementaries("blech")); + if (!result.toString().equals(toSupplementaries("zzzblech"))) + failCount++; + m.appendTail(result); + if (!result.toString().equals(toSupplementaries("zzzblechzzz"))) + failCount++; + + // SB substitution with groups + blah = toSupplementaries("zzzabcdzzz"); + p = Pattern.compile(toSupplementaries("(ab)(cd)*")); + m = p.matcher(blah); + result = new StringBuilder(); + try { + m.appendReplacement(result, "$1"); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, "$1"); + if (!result.toString().equals(toSupplementaries("zzzab"))) + failCount++; + + m.appendTail(result); + if (!result.toString().equals(toSupplementaries("zzzabzzz"))) + failCount++; + + // SB substitution with 3 groups + blah = toSupplementaries("zzzabcdcdefzzz"); + p = Pattern.compile(toSupplementaries("(ab)(cd)*(ef)")); + m = p.matcher(blah); + result = new StringBuilder(); + try { + m.appendReplacement(result, toSupplementaries("$1w$2w$3")); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, toSupplementaries("$1w$2w$3")); + if (!result.toString().equals(toSupplementaries("zzzabwcdwef"))) + failCount++; + + m.appendTail(result); + if (!result.toString().equals(toSupplementaries("zzzabwcdwefzzz"))) + failCount++; + + // SB substitution with groups and three matches + // skipping middle match + blah = toSupplementaries("zzzabcdzzzabcddzzzabcdzzz"); + p = Pattern.compile(toSupplementaries("(ab)(cd*)")); + m = p.matcher(blah); + result = new StringBuilder(); + try { + m.appendReplacement(result, "$1"); + failCount++; + } catch (IllegalStateException e) { + } + m.find(); + m.appendReplacement(result, "$1"); + if (!result.toString().equals(toSupplementaries("zzzab"))) + failCount++; + + m.find(); + m.find(); + m.appendReplacement(result, "$2"); + if (!result.toString().equals(toSupplementaries("zzzabzzzabcddzzzcd"))) + failCount++; + + m.appendTail(result); + if (!result.toString().equals(toSupplementaries("zzzabzzzabcddzzzcdzzz"))) + failCount++; + + // Check to make sure escaped $ is ignored + blah = toSupplementaries("zzzabcdcdefzzz"); + p = Pattern.compile(toSupplementaries("(ab)(cd)*(ef)")); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + m.appendReplacement(result, toSupplementaries("$1w\\$2w$3")); + if (!result.toString().equals(toSupplementaries("zzzabw$2wef"))) + failCount++; + + m.appendTail(result); + if (!result.toString().equals(toSupplementaries("zzzabw$2wefzzz"))) + failCount++; + + // Check to make sure a reference to nonexistent group causes error + blah = toSupplementaries("zzzabcdcdefzzz"); + p = Pattern.compile(toSupplementaries("(ab)(cd)*(ef)")); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + try { + m.appendReplacement(result, toSupplementaries("$1w$5w$3")); + failCount++; + } catch (IndexOutOfBoundsException ioobe) { + // Correct result + } + // Check double digit group references + blah = toSupplementaries("zzz123456789101112zzz"); + p = Pattern.compile("(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)"); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + m.appendReplacement(result, toSupplementaries("$1w$11w$3")); + if (!result.toString().equals(toSupplementaries("zzz1w11w3"))) + failCount++; + + // Check to make sure it backs off $15 to $1 if only three groups + blah = toSupplementaries("zzzabcdcdefzzz"); + p = Pattern.compile(toSupplementaries("(ab)(cd)*(ef)")); + m = p.matcher(blah); + result = new StringBuilder(); + m.find(); + m.appendReplacement(result, toSupplementaries("$1w$15w$3")); + if (!result.toString().equals(toSupplementaries("zzzabwab5wef"))) + failCount++; + // Check nothing has been appended into the output buffer if + // the replacement string triggers IllegalArgumentException. + p = Pattern.compile("(abc)"); + m = p.matcher("abcd"); + result = new StringBuilder(); + m.find(); + try { + m.appendReplacement(result, ("xyz$g")); + failCount++; + } catch (IllegalArgumentException iae) { + if (result.length() != 0) + failCount++; + } + report("SB Substitution 2"); + } + /* * 5 groups of characters are created to make a substitution string. * A base string will be created including random lead chars, the @@ -3059,6 +3344,93 @@ public class RegExTest { report("Substitution Basher"); } + /* + * 5 groups of characters are created to make a substitution string. + * A base string will be created including random lead chars, the + * substitution string, and random trailing chars. + * A pattern containing the 5 groups is searched for and replaced with: + * random group + random string + random group. + * The results are checked for correctness. + */ + private static void substitutionBasher2() { + for (int runs = 0; runs<1000; runs++) { + // Create a base string to work in + int leadingChars = generator.nextInt(10); + StringBuilder baseBuffer = new StringBuilder(100); + String leadingString = getRandomAlphaString(leadingChars); + baseBuffer.append(leadingString); + + // Create 5 groups of random number of random chars + // Create the string to substitute + // Create the pattern string to search for + StringBuilder bufferToSub = new StringBuilder(25); + StringBuilder bufferToPat = new StringBuilder(50); + String[] groups = new String[5]; + for(int i=0; i<5; i++) { + int aGroupSize = generator.nextInt(5)+1; + groups[i] = getRandomAlphaString(aGroupSize); + bufferToSub.append(groups[i]); + bufferToPat.append('('); + bufferToPat.append(groups[i]); + bufferToPat.append(')'); + } + String stringToSub = bufferToSub.toString(); + String pattern = bufferToPat.toString(); + + // Place sub string into working string at random index + baseBuffer.append(stringToSub); + + // Append random chars to end + int trailingChars = generator.nextInt(10); + String trailingString = getRandomAlphaString(trailingChars); + baseBuffer.append(trailingString); + String baseString = baseBuffer.toString(); + + // Create test pattern and matcher + Pattern p = Pattern.compile(pattern); + Matcher m = p.matcher(baseString); + + // Reject candidate if pattern happens to start early + m.find(); + if (m.start() < leadingChars) + continue; + + // Reject candidate if more than one match + if (m.find()) + continue; + + // Construct a replacement string with : + // random group + random string + random group + StringBuilder bufferToRep = new StringBuilder(); + int groupIndex1 = generator.nextInt(5); + bufferToRep.append("$" + (groupIndex1 + 1)); + String randomMidString = getRandomAlphaString(5); + bufferToRep.append(randomMidString); + int groupIndex2 = generator.nextInt(5); + bufferToRep.append("$" + (groupIndex2 + 1)); + String replacement = bufferToRep.toString(); + + // Do the replacement + String result = m.replaceAll(replacement); + + // Construct expected result + StringBuilder bufferToRes = new StringBuilder(); + bufferToRes.append(leadingString); + bufferToRes.append(groups[groupIndex1]); + bufferToRes.append(randomMidString); + bufferToRes.append(groups[groupIndex2]); + bufferToRes.append(trailingString); + String expectedResult = bufferToRes.toString(); + + // Check results + if (!result.equals(expectedResult)) { + failCount++; + } + } + + report("Substitution Basher 2"); + } + /** * Checks the handling of some escape sequences that the Pattern * class should process instead of the java compiler. These are diff --git a/jdk/test/javax/security/auth/kerberos/StandardNames.java b/jdk/test/javax/security/auth/kerberos/StandardNames.java new file mode 100644 index 00000000000..40590f6d080 --- /dev/null +++ b/jdk/test/javax/security/auth/kerberos/StandardNames.java @@ -0,0 +1,108 @@ +/* + * 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 8035986 + * @summary KerberosKey algorithm names are not specified + */ + +import sun.security.krb5.EncryptedData; + +import javax.crypto.Cipher; +import javax.security.auth.kerberos.KerberosKey; +import javax.security.auth.kerberos.KerberosPrincipal; +import java.util.Locale; + +public class StandardNames { + static KerberosPrincipal kp = new KerberosPrincipal("user@REALM"); + static char[] pass = "secret".toCharArray(); + static byte[] keyBytes = new byte[1]; + + public static void main(String[] args) throws Exception { + for (EncType e: EncType.values()) { + if (e == EncType.e18) { + if (Cipher.getMaxAllowedKeyLength("AES") < 256) { + System.out.println("Skipping aes256-cts-hmac-sha1-96"); + continue; + } + } + checkByName(e.name, e); + checkByName(e.name.toUpperCase(Locale.US), e); + for (String n: e.oldnames) { + checkByName(n, e); + if (n != null) { + checkByName(n.toLowerCase(Locale.US), e); + } + } + checkByEType(e.etype, e.name); + } + checkByEType(100, "unknown"); + checkByEType(-1, "private"); + + try { + System.out.println("unsupported"); + new KerberosKey(kp, pass, "unsupported"); + throw new Exception("unsupported"); + } catch (IllegalArgumentException iae) { + // Expected + } + } + + private static void checkByName(String n, EncType e) throws Exception { + System.out.println("CheckByName " + n); + KerberosKey k = new KerberosKey(kp, pass, n); + if (!k.getAlgorithm().equals(e.name)) throw new Exception(n); + if (k.getKeyType() != e.etype) throw new Exception(n); + if (k.getVersionNumber() != 0) throw new Exception(n); + } + + private static void checkByEType(int i, String n) throws Exception { + System.out.println("CheckByInt " + i); + KerberosKey k = new KerberosKey(kp, keyBytes, i, 13); + if (!k.getAlgorithm().equals(n)) throw new Exception("" + i); + if (k.getKeyType() != i) throw new Exception("" + i); + if (k.getVersionNumber() != 13) throw new Exception("" + i); + } +} + +enum EncType { + e0("none", EncryptedData.ETYPE_NULL), + e1("des-cbc-crc", EncryptedData.ETYPE_DES_CBC_CRC), + e3("des-cbc-md5", EncryptedData.ETYPE_DES_CBC_MD5, "DES", null), + e16("des3-cbc-sha1-kd", EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD, "DESede"), + e17("aes128-cts-hmac-sha1-96", EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, "AES128"), + e18("aes256-cts-hmac-sha1-96", EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96, "AES256"), + e23("rc4-hmac", EncryptedData.ETYPE_ARCFOUR_HMAC, "ArcFourHmac"), + ; + + final String name; + final int etype; + final String[] oldnames; + + EncType(String name, int etype, String... oldnames) { + this.name = name; + this.etype = etype; + this.oldnames = oldnames; + } +} diff --git a/jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java b/jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java new file mode 100644 index 00000000000..1fb8e868634 --- /dev/null +++ b/jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java @@ -0,0 +1,68 @@ +/* + * 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 8032884 + * @summary Globalbindings optionalProperty="primitive" does not work when minOccurs=0 + * @run shell compile-schema.sh + * @run main/othervm XjcOptionalPropertyTest + */ + +import java.io.IOException; +import java.lang.reflect.Method; + +public class XjcOptionalPropertyTest { + + public static void main(String[] args) throws IOException { + + generated.Foo foo = new generated.Foo(); + log("foo = " + foo); + Method[] methods = foo.getClass().getMethods(); + log("Found [" + methods.length + "] methods"); + for (int i = 0; i < methods.length; i++) { + Method method = methods[i]; + if (method.getName().equals("setFoo")) { + log("Checking method [" + method.getName() + "]"); + Class[] parameterTypes = method.getParameterTypes(); + if (parameterTypes.length != 1) + fail("more than 1 parameter"); + if (!parameterTypes[0].isPrimitive()) { + fail("Found [" + parameterTypes[0].getName() + "], but expected primitive!"); + } + break; + } + } + log("TEST PASSED."); + + } + + private static void fail(String message) { + throw new RuntimeException(message); + } + + private static void log(String msg) { + System.out.println(msg); + } + +} diff --git a/jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh b/jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh new file mode 100644 index 00000000000..8051abf438a --- /dev/null +++ b/jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh @@ -0,0 +1,39 @@ +#! /bin/sh + +# +# 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. +# + +# + +if [ "x$TESTJAVA" = x ]; then + TESTJAVA=$1; shift + TESTCLASSES=. +fi + +echo "cleaning generated files ..." +rm -rfv ${TESTSRC}/generated + +echo "compiling [optional-property-schema.xsd] schema ..." +$TESTJAVA/bin/xjc -p generated -d ${TESTSRC} ${TESTSRC}/optional-property-schema.xsd + +echo "Schema compiled. Verification of generated files can be done now." diff --git a/jdk/test/javax/xml/bind/xjc/8032884/optional-property-schema.xsd b/jdk/test/javax/xml/bind/xjc/8032884/optional-property-schema.xsd new file mode 100644 index 00000000000..2e7585de586 --- /dev/null +++ b/jdk/test/javax/xml/bind/xjc/8032884/optional-property-schema.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/jdk/test/javax/xml/ws/8033113/Organization_List.wsdl b/jdk/test/javax/xml/ws/8033113/Organization_List.wsdl new file mode 100644 index 00000000000..ae19b565b72 --- /dev/null +++ b/jdk/test/javax/xml/ws/8033113/Organization_List.wsdl @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdk/test/javax/xml/ws/8033113/WsImportTest.java b/jdk/test/javax/xml/ws/8033113/WsImportTest.java new file mode 100644 index 00000000000..aa1cf860ab4 --- /dev/null +++ b/jdk/test/javax/xml/ws/8033113/WsImportTest.java @@ -0,0 +1,152 @@ +/* + * 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 8033113 + * @summary wsimport fails on WSDL:header parameter name customization + * @run main/othervm WsImportTest + */ + +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.BufferedReader; +import java.io.File; +import java.nio.file.Files; +import java.nio.file.FileVisitResult; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; + +import static java.nio.file.FileVisitResult.*; + +public class WsImportTest { + + public static void main(String[] args) throws IOException { + + String wsimport = getWsImport(); + String customization = getWSDLFilePath("customization.xml"); + String wsdl = getWSDLFilePath("Organization_List.wsdl"); + + try { + log("Importing wsdl: " + wsdl); + String[] wsargs = { + wsimport, + "-keep", + "-verbose", + "-extension", + "-XadditionalHeaders", + "-Xdebug", + "-b", + customization, + wsdl + }; + + ProcessBuilder pb = new ProcessBuilder(wsargs); + pb.redirectErrorStream(true); + Process p = pb.start(); + logOutput(p); + int result = p.waitFor(); + p.destroy(); + + if (result != 0) { + fail("WsImport failed. TEST FAILED."); + } else { + log("Test PASSED."); + } + + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } finally { + deleteGeneratedFiles(); + } + } + + private static void fail(String message) { + throw new RuntimeException(message); + } + + private static void log(String msg) { + System.out.println(msg); + } + + private static void logOutput(Process p) throws IOException { + BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream())); + String s = r.readLine(); + while (s != null) { + log(s.trim()); + s = r.readLine(); + } + } + + private static void deleteGeneratedFiles() { + Path p = Paths.get("generated"); + if (Files.exists(p)) { + try { + Files.walkFileTree(p, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, + BasicFileAttributes attrs) throws IOException { + + Files.delete(file); + return CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, + IOException exc) throws IOException { + + if (exc == null) { + Files.delete(dir); + return CONTINUE; + } else { + throw exc; + } + } + }); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + } + + private static String getWSDLFilePath(String filename) { + String testSrc = System.getProperty("test.src"); + if (testSrc == null) testSrc = "."; + return Paths.get(testSrc).resolve(filename).toString(); + } + + private static String getWsImport() { + String javaHome = System.getProperty("java.home"); + if (javaHome.endsWith("jre")) { + javaHome = new File(javaHome).getParent(); + } + String wsimport = javaHome + File.separator + "bin" + File.separator + "wsimport"; + if (System.getProperty("os.name").startsWith("Windows")) { + wsimport = wsimport.concat(".exe"); + } + return wsimport; + } +} diff --git a/jdk/test/javax/xml/ws/8033113/customization.xml b/jdk/test/javax/xml/ws/8033113/customization.xml new file mode 100644 index 00000000000..e754c4275c0 --- /dev/null +++ b/jdk/test/javax/xml/ws/8033113/customization.xml @@ -0,0 +1,23 @@ + + false + + + + + + + + diff --git a/jdk/test/sun/security/krb5/auto/AddressesAndNameType.java b/jdk/test/sun/security/krb5/auto/AddressesAndNameType.java new file mode 100644 index 00000000000..de0dc89491c --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/AddressesAndNameType.java @@ -0,0 +1,85 @@ +/* + * 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 4501327 4868379 8039132 + * @run main/othervm AddressesAndNameType 1 + * @run main/othervm AddressesAndNameType 2 + * @run main/othervm AddressesAndNameType 3 + * @summary noaddresses settings and server name type + */ + +import java.net.InetAddress; +import java.util.Set; +import sun.security.krb5.Config; + +import javax.security.auth.kerberos.KerberosPrincipal; +import javax.security.auth.kerberos.KerberosTicket; + +public class AddressesAndNameType { + + public static void main(String[] args) + throws Exception { + + OneKDC kdc = new OneKDC(null); + kdc.writeJAASConf(); + + String extraLine; + switch (args[0]) { + case "1": extraLine = "noaddresses = false"; break; + case "2": extraLine = "noaddresses = true"; break; + default: extraLine = ""; break; + } + + KDC.saveConfig(OneKDC.KRB5_CONF, kdc, + extraLine); + Config.refresh(); + + Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + Set tickets = + c.s().getPrivateCredentials(KerberosTicket.class); + + if (tickets.isEmpty()) throw new Exception(); + KerberosTicket ticket = tickets.iterator().next(); + InetAddress[] addresses = ticket.getClientAddresses(); + + switch (args[0]) { + case "1": + if (addresses == null || addresses.length == 0) { + throw new Exception("No addresses"); + } + if (ticket.getServer().getNameType() + != KerberosPrincipal.KRB_NT_SRV_INST) { + throw new Exception( + "Wrong type: " + ticket.getServer().getNameType()); + } + break; + default: + if (addresses != null && addresses.length != 0) { + throw new Exception("See addresses"); + } + break; + } + } +} diff --git a/jdk/test/sun/security/krb5/auto/UdpTcp.java b/jdk/test/sun/security/krb5/auto/UdpTcp.java new file mode 100644 index 00000000000..e66f5d459fb --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/UdpTcp.java @@ -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 4966382 8039132 + * @run main/othervm UdpTcp UDP + * @run main/othervm UdpTcp TCP + * @summary udp or tcp + */ + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import sun.security.krb5.Config; + +public class UdpTcp { + + public static void main(String[] args) + throws Exception { + + System.setProperty("sun.security.krb5.debug", "true"); + + OneKDC kdc = new OneKDC(null); + kdc.writeJAASConf(); + + KDC.saveConfig(OneKDC.KRB5_CONF, kdc, + "udp_preference_limit = " + + (args[0].equals("UDP") ? "1000" : "100")); + Config.refresh(); + + ByteArrayOutputStream bo = new ByteArrayOutputStream(); + PrintStream oldout = System.out; + System.setOut(new PrintStream(bo)); + Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + System.setOut(oldout); + + for (String line: new String(bo.toByteArray()).split("\n")) { + if (line.contains(">>> KDCCommunication")) { + if (!line.contains(args[0])) { + throw new Exception("No " + args[0] + " in: " + line); + } + } + } + } +} diff --git a/jdk/test/sun/security/krb5/config/YesNo.java b/jdk/test/sun/security/krb5/config/YesNo.java new file mode 100644 index 00000000000..c25c8279663 --- /dev/null +++ b/jdk/test/sun/security/krb5/config/YesNo.java @@ -0,0 +1,61 @@ +/* + * 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 8029995 + * @summary accept yes/no for boolean krb5.conf settings + * @compile -XDignore.symbol.file YesNo.java + * @run main/othervm YesNo + */ +import sun.security.krb5.Config; +import sun.security.krb5.internal.crypto.EType; + +import java.util.Arrays; + +public class YesNo { + static Config config = null; + public static void main(String[] args) throws Exception { + System.setProperty("java.security.krb5.conf", + System.getProperty("test.src", ".") +"/yesno.conf"); + config = Config.getInstance(); + check("a", Boolean.TRUE); + check("b", Boolean.FALSE); + check("c", Boolean.TRUE); + check("d", Boolean.FALSE); + check("e", null); + check("f", null); + + if (!Arrays.stream(EType.getBuiltInDefaults()) + .anyMatch(n -> n < 4)) { + throw new Exception(); + } + } + + static void check(String k, Boolean expected) throws Exception { + Boolean result = config.getBooleanObject("libdefaults", k); + if (expected != result) { + throw new Exception("value for " + k + " is " + result); + } + } +} diff --git a/jdk/test/sun/security/krb5/config/yesno.conf b/jdk/test/sun/security/krb5/config/yesno.conf new file mode 100644 index 00000000000..681c19daf51 --- /dev/null +++ b/jdk/test/sun/security/krb5/config/yesno.conf @@ -0,0 +1,7 @@ +[libdefaults] +a = true +b = FALSE +c = YES +d = no +e = nothing +allow_weak_crypto = yes diff --git a/jdk/test/sun/security/krb5/etype/UnsupportedKeyType.java b/jdk/test/sun/security/krb5/etype/UnsupportedKeyType.java new file mode 100644 index 00000000000..c54a73d9536 --- /dev/null +++ b/jdk/test/sun/security/krb5/etype/UnsupportedKeyType.java @@ -0,0 +1,77 @@ +/* + * 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 5006629 + * @summary Kerberos library should only select keys of types that it supports + */ + +import javax.security.auth.kerberos.KerberosPrincipal; +import javax.security.auth.kerberos.KeyTab; +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class UnsupportedKeyType { + + // Homemade keytab files: + // + // String KVNO Timestamp Principal (etype) + // -------- ---- -------------- ----------------------- + // camellia 4 4/3/14 9:58 AM u1@K1 (25:camellia128-cts-cmac) + // aes 5 4/3/14 9:58 AM u1@K1 (17:aes128-cts-hmac-sha1-96) + + static String aes = + "050200000027000100024b310002753100000001533cc04f0500110010e0eab6" + + "7f31608df2b2f8fffc6b21cc91"; + static String camellia = + "050200000027000100024b310002753100000001533cc03e0400190010d88678" + + "14e478b6b7d2d97375163b971e"; + + public static void main(String[] args) throws Exception { + + byte[] data = new byte[aes.length()/2]; + KerberosPrincipal kp = new KerberosPrincipal("u1@K1"); + + // aes128 + for (int i=0; i= clientVersion) { + break; + } + } + } System.out.println("Done."); } - private static void test(KeyGenerator kg, int major, int minor) - throws Exception { + private static void test(KeyGenerator kg, + int clientVersion, int serverVersion) throws Exception { - kg.init(new TlsRsaPremasterSecretParameterSpec(major, minor)); + System.out.printf( + "Testing RSA pre-master secret key generation between " + + "client (0x%04X) and server(0x%04X)%n", + clientVersion, serverVersion); + kg.init(new TlsRsaPremasterSecretParameterSpec( + clientVersion, serverVersion)); SecretKey key = kg.generateKey(); byte[] encoded = key.getEncoded(); - if (encoded.length != 48) { - throw new Exception("length: " + encoded.length); - } - if ((encoded[0] != major) || (encoded[1] != minor)) { - throw new Exception("version mismatch: " + encoded[0] + - "." + encoded[1]); - } - System.out.println("OK: " + major + "." + minor); + if (encoded != null) { // raw key material may be not extractable + if (encoded.length != 48) { + throw new Exception("length: " + encoded.length); + } + int v = versionOf(encoded[0], encoded[1]); + if (clientVersion != v) { + if (serverVersion != v || clientVersion >= 0x0302) { + throw new Exception(String.format( + "version mismatch: (0x%04X) rather than (0x%04X) " + + "is used in pre-master secret", v, clientVersion)); + } + System.out.printf("Use compatible version (0x%04X)%n", v); + } + System.out.println("Passed, version matches!"); + } else { + System.out.println("Raw key material is not extractable"); + } } + + private static int versionOf(int major, int minor) { + return ((major & 0xFF) << 8) | (minor & 0xFF); + } + } diff --git a/jdk/test/sun/tools/jstatd/JstatdTest.java b/jdk/test/sun/tools/jstatd/JstatdTest.java index f07ce6b1742..0c003cfcb5e 100644 --- a/jdk/test/sun/tools/jstatd/JstatdTest.java +++ b/jdk/test/sun/tools/jstatd/JstatdTest.java @@ -27,6 +27,7 @@ import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.util.Arrays; +import java.util.regex.Pattern; import static jdk.testlibrary.Asserts.*; import jdk.testlibrary.JDKToolLauncher; @@ -34,6 +35,7 @@ import jdk.testlibrary.OutputAnalyzer; import jdk.testlibrary.ProcessThread; import jdk.testlibrary.TestThread; import jdk.testlibrary.Utils; +import jdk.testlibrary.ProcessTools; /** * The base class for tests of jstatd. @@ -93,8 +95,11 @@ public final class JstatdTest { if (tool == "rmiregistry") { processName = "registryimpl"; } + + Pattern toolInJpsPattern = + Pattern.compile("^\\d+\\s{1}" + processName + "\\s{1}.*-dparent\\.pid\\." + ProcessTools.getProcessId() + ".*"); for (String line : lines) { - if (line.toLowerCase().matches("^\\d+\\s{1}" + processName + "$")) { + if (toolInJpsPattern.matcher(line.toLowerCase()).matches()) { pid = line.split(" ")[0]; count++; } @@ -167,6 +172,8 @@ public final class JstatdTest { private OutputAnalyzer runJps() throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps"); launcher.addVMArg("-XX:+UsePerfData"); + // Run jps with -v flag to obtain -Dparent.pid. + launcher.addToolArg("-v"); launcher.addToolArg(getDestination()); String[] cmd = launcher.getCommand(); @@ -286,7 +293,7 @@ public final class JstatdTest { * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName */ - private String[] getJstatdCmd() throws UnknownHostException { + private String[] getJstatdCmd() throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd"); launcher.addVMArg("-XX:+UsePerfData"); String testSrc = System.getProperty("test.src"); @@ -294,6 +301,8 @@ public final class JstatdTest { assertTrue(policy.exists() && policy.isFile(), "Security policy " + policy.getAbsolutePath() + " does not exist or not a file"); launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath()); + // -Dparent.pid. will help to identify jstad process started by this test + launcher.addVMArg("-Dparent.pid." + ProcessTools.getProcessId()); if (port != null) { launcher.addToolArg("-p"); launcher.addToolArg(port); diff --git a/jdk/test/sun/util/calendar/zi/tzdata/VERSION b/jdk/test/sun/util/calendar/zi/tzdata/VERSION index 8ab96a77e71..1c96650f231 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION +++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2014a +tzdata2014b diff --git a/jdk/test/sun/util/calendar/zi/tzdata/africa b/jdk/test/sun/util/calendar/zi/tzdata/africa index 82d14a4a14d..3198e1cc209 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/africa +++ b/jdk/test/sun/util/calendar/zi/tzdata/africa @@ -891,7 +891,10 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou # Another source (specifying the time for start and end in the decree): # http://www.lemag.ma/Heure-d-ete-au-Maroc-jusqu-au-27-octobre_a75620.html -# From Paul Eggert (2013-10-03): +# From Sebastien Willemijns (2014-03-18): +# http://www.afriquinfos.com/articles/2014/3/18/maroc-heure-dete-avancez-tous-horloges-247891.asp + +# From Paul Eggert (2014-03-19): # To estimate what the Moroccan government will do in future years, # transition dates for 2014 through 2038 were determined by running # the following program under GNU Emacs 24.3: diff --git a/jdk/test/sun/util/calendar/zi/tzdata/antarctica b/jdk/test/sun/util/calendar/zi/tzdata/antarctica index f30cf747f10..e31bada94fb 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/antarctica +++ b/jdk/test/sun/util/calendar/zi/tzdata/antarctica @@ -253,24 +253,41 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 29 # year-round base # Scott Base, Ross Island, since 1957-01. # See Pacific/Auckland. -# -# These rules for New Zealand are stolen from the 'australasia' file. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule NZAQ 1974 only - Nov 3 2:00s 1:00 D -Rule NZAQ 1975 1988 - Oct lastSun 2:00s 1:00 D -Rule NZAQ 1989 only - Oct 8 2:00s 1:00 D -Rule NZAQ 1990 2006 - Oct Sun>=1 2:00s 1:00 D -Rule NZAQ 1975 only - Feb 23 2:00s 0 S -Rule NZAQ 1976 1989 - Mar Sun>=1 2:00s 0 S -Rule NZAQ 1990 2007 - Mar Sun>=15 2:00s 0 S -Rule NZAQ 2007 max - Sep lastSun 2:00s 1:00 D -Rule NZAQ 2008 max - Apr Sun>=1 2:00s 0 S # Norway - territories # Bouvet (never inhabited) # # claims # Peter I Island (never inhabited) +# +# year-round base +# Troll, Queen Maud Land, -720041+0023206, since 2005-02-12 +# +# From Paul-Inge Flakstad (2014-03-10): +# I recently had a long dialog about this with the developer of timegenie.com. +# In the absence of specific dates, he decided to choose some likely ones: +# GMT +1 - From March 1 to the last Sunday in March +# GMT +2 - From the last Sunday in March until the last Sunday in October +# GMT +1 - From the last Sunday in October until November 7 +# GMT +0 - From November 7 until March 1 +# The dates for switching to and from UTC+0 will probably not be absolutely +# correct, but they should be quite close to the actual dates. +# +# From Paul Eggert (2014-03-21): +# The CET-switching Troll rules require zic from tzcode 2014b or later, so as +# suggested by Bengt-Inge Larsson comment them out for now, and approximate +# with only UTC and CEST. Uncomment them when 2014b is more prevalent. +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Troll 2005 max - Mar 1 1:00u 1:00 CET +Rule Troll 2005 max - Mar lastSun 1:00u 2:00 CEST +#Rule Troll 2005 max - Oct lastSun 1:00u 1:00 CET +#Rule Troll 2004 max - Nov 7 1:00u 0:00 UTC +# Remove the following line when uncommenting the above '#Rule' lines. +Rule Troll 2004 max - Oct lastSun 1:00u 0:00 UTC +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Antarctica/Troll 0 - zzz 2005 Feb 12 + 0:00 Troll %s # Poland - year-round base # Arctowski, King George Island, -620945-0582745, since 1977 diff --git a/jdk/test/sun/util/calendar/zi/tzdata/australasia b/jdk/test/sun/util/calendar/zi/tzdata/australasia index a0e8b5a2ce9..94c9adb912c 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/australasia +++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia @@ -786,14 +786,29 @@ Zone Pacific/Funafuti 11:56:52 - LMT 1901 # Johnston # -# From Paul Eggert (2013-09-03): +# From Paul Eggert (2014-03-11): +# Sometimes Johnston kept Hawaii time, and sometimes it was an hour behind. +# Details are uncertain. We have no data for Johnston after 1970, so +# treat it like Hawaii for now. +# # In his memoirs of June 6th to October 4, 1945 # (2005), Herbert C. Bach writes, # "We started our letdown to Kwajalein Atoll and landed there at 5:00 AM # Johnston time, 1:30 AM Kwajalein time." This was in June 1945, and # confirms that Johnston kept the same time as Honolulu in summer 1945. -# We have no better information, so for now, assume this has been true -# indefinitely into the past. +# +# From Lyle McElhaney (2014-03-11): +# [W]hen JI was being used for that [atomic bomb] testing, the time being used +# was not Hawaiian time but rather the same time being used on the ships, +# which had a GMT offset of -11 hours. This apparently applied to at least the +# time from Operation Newsreel (Hardtack I/Teak shot, 1958-08-01) to the last +# Operation Fishbowl shot (Tightrope, 1962-11-04).... [See] Herman Hoerlin, +# "The United States High-Altitude Test Experience: A Review Emphasizing the +# Impact on the Environment", Los Alamos LA-6405, Oct 1976 +# . +# See the table on page 4 where he lists GMT and local times for the tests; a +# footnote for the JI tests reads that local time is "JI time = Hawaii Time +# Minus One Hour". # # See 'northamerica' for Pacific/Johnston. diff --git a/jdk/test/sun/util/calendar/zi/tzdata/europe b/jdk/test/sun/util/calendar/zi/tzdata/europe index 585e64d14fa..2b0c5613e60 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/europe +++ b/jdk/test/sun/util/calendar/zi/tzdata/europe @@ -2986,7 +2986,11 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 # Assume it happened in March by not changing the clocks. 3:00 Russia MSK/MSD 1997 3:00 - MSK 1997 Mar lastSun 1:00u - 2:00 EU EE%sT +# From Alexander Krivenyshev (2014-03-17): +# time change at 2:00 (2am) on March 30, 2014 +# http://vz.ru/news/2014/3/17/677464.html + 2:00 EU EE%sT 2014 Mar 30 2:00 + 4:00 - MSK # Vatican City # See Europe/Rome. diff --git a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds index faf5319d408..b423135b942 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds +++ b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds @@ -20,7 +20,7 @@ # 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. - +# # Allowance for leapseconds added to each timezone file. # This file is in the public domain. diff --git a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab index b34cdb0dc7d..7cec627fd95 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab +++ b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab @@ -74,6 +74,7 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula AQ -7824+10654 Antarctica/Vostok Vostok Station, Lake Vostok AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I +AQ -720041+0023206 Antarctica/Troll Troll Station, Queen Maud Land AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF) AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF) AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN) @@ -366,6 +367,7 @@ RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad RU +5545+03735 Europe/Moscow Moscow+00 - west Russia RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea RU +5312+05009 Europe/Samara Moscow+00 - Samara, Udmurtia +RU +4457+03406 Europe/Simferopol Moscow+00 - Crimea RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk @@ -421,7 +423,6 @@ TZ -0648+03917 Africa/Dar_es_Salaam UA +5026+03031 Europe/Kiev most locations UA +4837+02218 Europe/Uzhgorod Ruthenia UA +4750+03510 Europe/Zaporozhye Zaporozh'ye, E Lugansk / Zaporizhia, E Luhansk -UA +4457+03406 Europe/Simferopol central Crimea UG +0019+03225 Africa/Kampala UM +1645-16931 Pacific/Johnston Johnston Atoll UM +2813-17722 Pacific/Midway Midway Islands