# HG changeset patch
# User andrew
# Date 1503363832 -3600
# Node ID 85bcd2abf0a2180ffc981cc984c1cd65abdd558b
# Parent 350a10c3a425605bfd51ca5ec556ad1553affdf2# Parent ad08fea7cd1ae43c9f4d8cf0bc1ccbfbf9bb3455
Merge jdk7u151-b01
diff -r 350a10c3a425 -r 85bcd2abf0a2 .hgtags
--- a/.hgtags Wed Aug 16 16:15:10 2017 +0100
+++ b/.hgtags Tue Aug 22 02:03:52 2017 +0100
@@ -653,3 +653,6 @@
a319566e15f5611bae9cfda2696e8217020a9269 jdk7u141-b01
5af12d99fb1ea4642305058adb1f3f771d8b5eff icedtea-2.7.0pre12
0e380c5a1bff8694655fa262a110f347a77da044 icedtea-2.7.0pre13
+19a085e656145471455d7fbd648717f94281a729 jdk7u141-b02
+871e3350966f67b95768a94c1854f1515cfa56ca jdk7u151-b00
+da1c09ab9b742fa77c0e667c2218b8d626432656 jdk7u151-b01
diff -r 350a10c3a425 -r 85bcd2abf0a2 make/sun/javazic/tzdata/VERSION
--- a/make/sun/javazic/tzdata/VERSION Wed Aug 16 16:15:10 2017 +0100
+++ b/make/sun/javazic/tzdata/VERSION Tue Aug 22 02:03:52 2017 +0100
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2017a
+tzdata2017b
diff -r 350a10c3a425 -r 85bcd2abf0a2 make/sun/javazic/tzdata/africa
--- a/make/sun/javazic/tzdata/africa Wed Aug 16 16:15:10 2017 +0100
+++ b/make/sun/javazic/tzdata/africa Tue Aug 22 02:03:52 2017 +0100
@@ -443,18 +443,25 @@
# See Africa/Johannesburg.
# Liberia
-# From Paul Eggert (2006-03-22):
-# In 1972 Liberia was the last country to switch
-# from a UTC offset that was not a multiple of 15 or 20 minutes.
-# Howse reports that it was in honor of their president's birthday.
-# Shank & Pottenger report the date as May 1, whereas Howse reports Jan;
-# go with Shanks & Pottenger.
-# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and
-# Whitman each report -0:44:30; go with the more precise figure.
+#
+# From Paul Eggert (2017-03-02):
+#
+# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
+#
+# In 1972 Liberia was the last country to switch from a UTC offset
+# that was not a multiple of 15 or 20 minutes. The 1972 change was on
+# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
+# Presidential Papers: First year of the administration of
+# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972.
+# Monrovia: Executive Mansion.
+#
+# Use the abbreviation "MMT" before 1972, as the more-accurate numeric
+# abbreviation "-004430" would be one byte over the POSIX limit.
+#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Monrovia -0:43:08 - LMT 1882
-0:43:08 - MMT 1919 Mar # Monrovia Mean Time
- -0:44:30 - -004430 1972 May
+ -0:44:30 - MMT 1972 Jan 7 # approximately MMT
0:00 - GMT
###############################################################################
diff -r 350a10c3a425 -r 85bcd2abf0a2 make/sun/javazic/tzdata/iso3166.tab
--- a/make/sun/javazic/tzdata/iso3166.tab Wed Aug 16 16:15:10 2017 +0100
+++ b/make/sun/javazic/tzdata/iso3166.tab Tue Aug 22 02:03:52 2017 +0100
@@ -32,8 +32,8 @@
# All text uses UTF-8 encoding. The columns of the table are as follows:
#
# 1. ISO 3166-1 alpha-2 country code, current as of
-# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166
-# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
+# ISO 3166-1 N905 (2016-11-15). See: Updates on ISO 3166-1
+# http://isotc.iso.org/livelink/livelink/Open/16944257
# 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables.
diff -r 350a10c3a425 -r 85bcd2abf0a2 make/sun/javazic/tzdata/northamerica
--- a/make/sun/javazic/tzdata/northamerica Wed Aug 16 16:15:10 2017 +0100
+++ b/make/sun/javazic/tzdata/northamerica Tue Aug 22 02:03:52 2017 +0100
@@ -3162,6 +3162,12 @@
# http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
# http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
+# From Steffen Thorsen (2017-03-12):
+# We have received 4 mails from different people telling that Haiti
+# has started DST again today, and this source seems to confirm that,
+# I have not been able to find a more authoritative source:
+# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Haiti 1983 only - May 8 0:00 1:00 D
Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D
@@ -3174,6 +3180,8 @@
Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S
Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S
+Rule Haiti 2017 max - Mar Sun>=8 2:00 1:00 D
+Rule Haiti 2017 max - Nov Sun>=1 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Port-au-Prince -4:49:20 - LMT 1890
-4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT
diff -r 350a10c3a425 -r 85bcd2abf0a2 make/sun/rmi/rmi/Makefile
--- a/make/sun/rmi/rmi/Makefile Wed Aug 16 16:15:10 2017 +0100
+++ b/make/sun/rmi/rmi/Makefile Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2017, 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
@@ -52,16 +52,9 @@
include $(BUILDDIR)/common/Rules.gmk
#
-# Full package names of implementations requiring stubs
-#
-REMOTE_impls = \
- sun.rmi.registry.RegistryImpl \
- sun.rmi.transport.DGCImpl
-
-#
# The java-rmi.cgi script in bin/ only gets delivered in certain situations
#
-BUILD_TARGETS = stubs
+BUILD_TARGETS =
ifeq ($(PLATFORM), linux)
BUILD_TARGETS += bin
endif
@@ -75,29 +68,6 @@
clean clobber:: bin.clean
-
-#
-# Compile stubs and skeletons for remote implementations
-# (use -v1.1 for backward interoperability)
-#
-# gnumake 3.78.1 on windows attempts to build the target even
-# though it exists. Not sure why, but a check for file existence
-# has been added...
-#
-$(CLASSBINDIR)/%_Skel.class $(CLASSBINDIR)/%_Stub.class: $(CLASSBINDIR)/%.class
- if [ ! -s $@ ] ; \
- then $(RMIC) -v1.1 -classpath \
- "$(CLASSBINDIR)" \
- -d $(CLASSBINDIR) '$(subst /,.,$(<:$(CLASSBINDIR)/%.class=%))' ; \
- fi
- @$(java-vm-cleanup)
-
-REMOTE_files = $(subst .,/,$(REMOTE_impls))
-FILES_stubs = $(REMOTE_files:%=$(CLASSBINDIR)/%_Stub.class)
-FILES_skels = $(REMOTE_files:%=$(CLASSBINDIR)/%_Skel.class)
-
-stubs: $(FILES_stubs) $(FILES_skels)
-
bin: $(BINDIR)/java-rmi.cgi
$(BINDIR)/java-rmi.cgi: $(PLATFORM_SRC)/bin/java-rmi.cgi.sh
@@ -107,5 +77,5 @@
bin.clean:
$(RM) $(BINDIR)/java-rmi.cgi
-.PHONY: stubs bin bin.clean
+.PHONY: bin bin.clean
diff -r 350a10c3a425 -r 85bcd2abf0a2 make/sun/splashscreen/FILES_c.gmk
--- a/make/sun/splashscreen/FILES_c.gmk Wed Aug 16 16:15:10 2017 +0100
+++ b/make/sun/splashscreen/FILES_c.gmk Tue Aug 22 02:03:52 2017 +0100
@@ -111,11 +111,7 @@
pngrtran.c \
pngrutil.c \
pngset.c \
- pngtrans.c \
- pngwio.c \
- pngwrite.c \
- pngwtran.c \
- pngwutil.c
+ pngtrans.c
endif
ifneq ($(SYSTEM_GIF), true)
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Aug 22 02:03:52 2017 +0100
@@ -272,16 +272,21 @@
contentView.execute(new CFNativeAction() {
@Override
public void run(final long viewPtr) {
+ boolean hasOwnerPtr = false;
+
if (owner != null) {
- owner.execute(new CFNativeAction() {
+ hasOwnerPtr = 0L != owner.executeGet(new CFNativeActionGet() {
@Override
- public void run(long ownerPtr) {
+ public long run(long ownerPtr) {
ref.set(nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
- bounds.x, bounds.y,
- bounds.width, bounds.height));
+ bounds.x, bounds.y,
+ bounds.width, bounds.height));
+ return 1;
}
});
- } else {
+ }
+
+ if (!hasOwnerPtr) {
ref.set(nativeCreateNSWindow(viewPtr, 0,
styleBits, bounds.x, bounds.y,
bounds.width, bounds.height));
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties Tue Aug 22 02:03:52 2017 +0100
@@ -93,7 +93,7 @@
resizable=storleks\u00E4ndringsbar
selectable=valbar
selected=vald
-showing=visas
+showing=visar
singleline=en rad
transient=tillf\u00E4llig
visible=synlig
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java Tue Aug 22 02:03:52 2017 +0100
@@ -387,6 +387,17 @@
}
}
+ private void skipPastImage(int imageIndex) {
+ cbLock.lock();
+ try {
+ gotoImage(imageIndex);
+ skipImage();
+ } catch (IOException | IndexOutOfBoundsException e) {
+ } finally {
+ cbLock.unlock();
+ }
+ }
+
private int getNumImagesOnThread(boolean allowSearch)
throws IOException {
if (numImages != 0) {
@@ -1228,7 +1239,8 @@
// Note that getData disables acceleration on buffer, but it is
// just a 1-line intermediate data transfer buffer that will not
// affect the acceleration of the resulting image.
- aborted = readImage(structPointer,
+ aborted = readImage(imageIndex,
+ structPointer,
buffer.getData(),
numRasterBands,
srcBands,
@@ -1390,7 +1402,8 @@
/**
* Returns true
if the read was aborted.
*/
- private native boolean readImage(long structPointer,
+ private native boolean readImage(int imageIndex,
+ long structPointer,
byte [] buffer,
int numRasterBands,
int [] srcBands,
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java Tue Aug 22 02:03:52 2017 +0100
@@ -165,8 +165,11 @@
}
public boolean postProcessKeyEvent(KeyEvent ev) {
- if(ev.isConsumed()) {
- // do not manage consumed event
+ if(ev.isConsumed() && ev.getKeyCode() != KeyEvent.VK_ALT) {
+ // mnemonic combination, it's consumed, but we need
+ // set altKeyPressed to false, otherwise after selection
+ // component by mnemonic combination a menu will be open
+ altKeyPressed = false;
return false;
}
if (ev.getKeyCode() == KeyEvent.VK_ALT) {
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/com/sun/jndi/ldap/LdapClient.java
--- a/src/share/classes/com/sun/jndi/ldap/LdapClient.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/com/sun/jndi/ldap/LdapClient.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -1233,6 +1233,7 @@
static final int LDAP_REF_FOLLOW = 0x01; // follow referrals
static final int LDAP_REF_THROW = 0x02; // throw referral ex.
static final int LDAP_REF_IGNORE = 0x03; // ignore referrals
+ static final int LDAP_REF_FOLLOW_SCHEME = 0x04; // follow referrals of the same scheme
static final String LDAP_URL = "ldap://"; // LDAPv3
static final String LDAPS_URL = "ldaps://"; // LDAPv3
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/com/sun/jndi/ldap/LdapCtx.java
--- a/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -2413,6 +2413,9 @@
// First determine the referral mode
if (ref != null) {
switch (ref) {
+ case "follow-scheme":
+ handleReferrals = LdapClient.LDAP_REF_FOLLOW_SCHEME;
+ break;
case "follow":
handleReferrals = LdapClient.LDAP_REF_FOLLOW;
break;
@@ -2975,7 +2978,23 @@
r = new LdapReferralException(resolvedName, resolvedObj, remainName,
msg, envprops, fullDN, handleReferrals, reqCtls);
// only one set of URLs is present
- r.setReferralInfo(res.referrals.elementAt(0), false);
+ Vector refs;
+ if (res.referrals == null) {
+ refs = null;
+ } else if (handleReferrals == LdapClient.LDAP_REF_FOLLOW_SCHEME) {
+ refs = new Vector<>();
+ for (String s : res.referrals.elementAt(0)) {
+ if (s.startsWith("ldap:")) {
+ refs.add(s);
+ }
+ }
+ if (refs.isEmpty()) {
+ refs = null;
+ }
+ } else {
+ refs = res.referrals.elementAt(0);
+ }
+ r.setReferralInfo(refs, false);
if (hopCount > 1) {
r.setHopCount(hopCount);
@@ -3044,7 +3063,7 @@
* assume name resolution has not yet completed.
*/
if (((res.entries == null) || (res.entries.isEmpty())) &&
- (res.referrals.size() == 1)) {
+ ((res.referrals != null) && (res.referrals.size() == 1))) {
r.setReferralInfo(res.referrals, false);
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/com/sun/jndi/ldap/LdapReferralException.java
--- a/src/share/classes/com/sun/jndi/ldap/LdapReferralException.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/com/sun/jndi/ldap/LdapReferralException.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -117,7 +117,8 @@
// If following referral, request controls are passed to referral ctx
this.reqCtls =
- (handleReferrals == LdapClient.LDAP_REF_FOLLOW ? reqCtls : null);
+ (handleReferrals == LdapClient.LDAP_REF_FOLLOW ||
+ handleReferrals == LdapClient.LDAP_REF_FOLLOW_SCHEME ? reqCtls : null);
}
/**
@@ -217,13 +218,15 @@
System.out.println("LdapReferralException.setReferralInfo");
this.referrals = referrals;
- if (referrals != null) {
- referralCount = referrals.size();
- }
+ referralCount = (referrals == null) ? 0 : referrals.size();
if (debug) {
- for (int i = 0; i < referralCount; i++) {
- System.out.println(" [" + i + "] " + referrals.elementAt(i));
+ if (referrals != null) {
+ for (int i = 0; i < referralCount; i++) {
+ System.out.println(" [" + i + "] " + referrals.elementAt(i));
+ }
+ } else {
+ System.out.println("setReferralInfo : referrals == null");
}
}
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java
--- a/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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
@@ -62,9 +62,10 @@
* @param outputFile the system-dependent filename
* @param live if true dump only live objects
* i.e. objects that are reachable from others
- * @throws IOException if the outputFile
+ * @throws IOException if the outputFile already exists,
* cannot be created, opened, or written to.
* @throws UnsupportedOperationException if this operation is not supported.
+ * @throws IllegalArgumentException if outputFile does not end with ".hprof" suffix.
* @throws NullPointerException if outputFile is null .
* @throws SecurityException
* If a security manager exists and its {@link
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/lang/invoke/LambdaForm.java
--- a/src/share/classes/java/lang/invoke/LambdaForm.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/java/lang/invoke/LambdaForm.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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
@@ -918,10 +918,10 @@
System.arraycopy(names, skip+outArgs, names2, skip+inTypes, bodyLength);
int arity2 = names2.length - bodyLength;
int result2 = result;
- if (result2 >= 0) {
+ if (result2 >= skip) {
if (result2 < skip+outArgs) {
// return the corresponding inArg
- result2 = reorder[result2-skip];
+ result2 = reorder[result2 - skip] + skip;
} else {
result2 = result2 - outArgs + inTypes;
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/nio/Bits.java
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/rmi/activation/ActivationID.java
--- a/src/share/classes/java/rmi/activation/ActivationID.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/java/rmi/activation/ActivationID.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -40,6 +40,12 @@
import java.rmi.server.RemoteObjectInvocationHandler;
import java.rmi.server.RemoteRef;
import java.rmi.server.UID;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.Permissions;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
/**
* Activation makes use of special identifiers to denote remote
@@ -81,6 +87,14 @@
/** indicate compatibility with the Java 2 SDK v1.2 version of class */
private static final long serialVersionUID = -4608673054848209235L;
+ /** an AccessControlContext with no permissions */
+ private static final AccessControlContext NOPERMS_ACC;
+ static {
+ Permissions perms = new Permissions();
+ ProtectionDomain[] pd = { new ProtectionDomain(null, perms) };
+ NOPERMS_ACC = new AccessControlContext(pd);
+ }
+
/**
* The constructor for ActivationID
takes a single
* argument, activator, that specifies a remote reference to the
@@ -112,15 +126,21 @@
throws ActivationException, UnknownObjectException, RemoteException
{
try {
- MarshalledObject extends Remote> mobj =
+ final MarshalledObject extends Remote> mobj =
activator.activate(this, force);
- return mobj.get();
- } catch (RemoteException e) {
- throw e;
- } catch (IOException e) {
- throw new UnmarshalException("activation failed", e);
- } catch (ClassNotFoundException e) {
- throw new UnmarshalException("activation failed", e);
+ return AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Remote run() throws IOException, ClassNotFoundException {
+ return mobj.get();
+ }
+ }, NOPERMS_ACC);
+ } catch (PrivilegedActionException pae) {
+ Exception ex = pae.getException();
+ if (ex instanceof RemoteException) {
+ throw (RemoteException) ex;
+ } else {
+ throw new UnmarshalException("activation failed", ex);
+ }
}
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/security/CodeSource.java
--- a/src/share/classes/java/security/CodeSource.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/java/security/CodeSource.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -529,6 +529,7 @@
{
CertificateFactory cf;
Hashtable cfs = null;
+ List certList = null;
ois.defaultReadObject(); // location
@@ -538,7 +539,7 @@
// we know of 3 different cert types: X.509, PGP, SDSI, which
// could all be present in the stream at the same time
cfs = new Hashtable(3);
- this.certs = new java.security.cert.Certificate[size];
+ certList = new ArrayList<>(size > 20 ? 20 : size);
}
for (int i = 0; i < size; i++) {
@@ -569,13 +570,17 @@
ois.readFully(encoded);
ByteArrayInputStream bais = new ByteArrayInputStream(encoded);
try {
- this.certs[i] = cf.generateCertificate(bais);
+ certList.add(cf.generateCertificate(bais));
} catch (CertificateException ce) {
throw new IOException(ce.getMessage());
}
bais.close();
}
+ if (certList != null) {
+ this.certs = certList.toArray(
+ new java.security.cert.Certificate[size]);
+ }
// Deserialize array of code signers (if any)
try {
this.signers = ((CodeSigner[])ois.readObject()).clone();
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/util/concurrent/ThreadPoolExecutor.java
--- a/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Tue Aug 22 02:03:52 2017 +0100
@@ -34,6 +34,10 @@
*/
package java.util.concurrent;
+
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
@@ -567,6 +571,9 @@
private static final RuntimePermission shutdownPerm =
new RuntimePermission("modifyThread");
+ /* The context to be used when executing the finalizer, or null. */
+ private final AccessControlContext acc;
+
/**
* Class Worker mainly maintains interrupt control state for
* threads running tasks, along with other minor bookkeeping.
@@ -1310,6 +1317,9 @@
throw new IllegalArgumentException();
if (workQueue == null || threadFactory == null || handler == null)
throw new NullPointerException();
+ this.acc = System.getSecurityManager() == null ?
+ null :
+ AccessController.getContext();
this.corePoolSize = corePoolSize;
this.maximumPoolSize = maximumPoolSize;
this.workQueue = workQueue;
@@ -1477,7 +1487,19 @@
* referenced and it has no threads.
*/
protected void finalize() {
- shutdown();
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null || acc == null) {
+ shutdown();
+ } else {
+ PrivilegedAction pa = new PrivilegedAction() {
+ @Override
+ public Void run() {
+ shutdown();
+ return null;
+ }
+ };
+ AccessController.doPrivileged(pa, acc);
+ }
}
/**
@@ -2099,4 +2121,3 @@
}
}
}
-
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/util/jar/Attributes.java
--- a/src/share/classes/java/util/jar/Attributes.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/java/util/jar/Attributes.java Tue Aug 22 02:03:52 2017 +0100
@@ -71,7 +71,7 @@
* @param size the initial number of attributes
*/
public Attributes(int size) {
- map = new HashMap(size);
+ map = new HashMap<>(size);
}
/**
@@ -81,7 +81,7 @@
* @param attr the specified Attributes
*/
public Attributes(Attributes attr) {
- map = new HashMap(attr);
+ map = new HashMap<>(attr);
}
@@ -296,9 +296,9 @@
* XXX Need to handle UTF8 values and break up lines longer than 72 bytes
*/
void write(DataOutputStream os) throws IOException {
- Iterator it = entrySet().iterator();
+ Iterator> it = entrySet().iterator();
while (it.hasNext()) {
- Map.Entry e = (Map.Entry)it.next();
+ Map.Entry e = it.next();
StringBuffer buffer = new StringBuffer(
((Name)e.getKey()).toString());
buffer.append(": ");
@@ -340,9 +340,9 @@
// write out all attributes except for the version
// we wrote out earlier
- Iterator it = entrySet().iterator();
+ Iterator> it = entrySet().iterator();
while (it.hasNext()) {
- Map.Entry e = (Map.Entry)it.next();
+ Map.Entry e = it.next();
String name = ((Name)e.getKey()).toString();
if ((version != null) && ! (name.equalsIgnoreCase(vername))) {
@@ -499,7 +499,7 @@
*/
public boolean equals(Object o) {
if (o instanceof Name) {
- Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
+ Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
return c.compare(name, ((Name)o).name) == 0;
} else {
return false;
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/util/jar/JarVerifier.java
--- a/src/share/classes/java/util/jar/JarVerifier.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/java/util/jar/JarVerifier.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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,21 +49,21 @@
/* a table mapping names to code signers, for jar entries that have
had their actual hashes verified */
- private Hashtable verifiedSigners;
+ private Hashtable verifiedSigners;
/* a table mapping names to code signers, for jar entries that have
passed the .SF/.DSA/.EC -> MANIFEST check */
- private Hashtable sigFileSigners;
+ private Hashtable sigFileSigners;
/* a hash table to hold .SF bytes */
- private Hashtable sigFileData;
+ private Hashtable sigFileData;
/** "queue" of pending PKCS7 blocks that we couldn't parse
* until we parsed the .SF file */
- private ArrayList pendingBlocks;
+ private ArrayList pendingBlocks;
/* cache of CodeSigner objects */
- private ArrayList signerCache;
+ private ArrayList signerCache;
/* Are we parsing a block? */
private boolean parsingBlockOrSF = false;
@@ -95,10 +95,10 @@
public JarVerifier(byte rawBytes[]) {
manifestRawBytes = rawBytes;
- sigFileSigners = new Hashtable();
- verifiedSigners = new Hashtable();
- sigFileData = new Hashtable(11);
- pendingBlocks = new ArrayList();
+ sigFileSigners = new Hashtable<>();
+ verifiedSigners = new Hashtable<>();
+ sigFileData = new Hashtable<>(11);
+ pendingBlocks = new ArrayList<>();
baos = new ByteArrayOutputStream();
manifestDigests = new ArrayList();
}
@@ -180,10 +180,12 @@
// only set the jev object for entries that have a signature
// (either verified or not)
- if (sigFileSigners.get(name) != null ||
- verifiedSigners.get(name) != null) {
- mev.setEntry(name, je);
- return;
+ if (!name.equals(JarFile.MANIFEST_NAME)) {
+ if (sigFileSigners.get(name) != null ||
+ verifiedSigners.get(name) != null) {
+ mev.setEntry(name, je);
+ return;
+ }
}
// don't compute the digest for this entry
@@ -260,10 +262,9 @@
sigFileData.put(key, bytes);
// check pending blocks, we can now process
// anyone waiting for this .SF file
- Iterator it = pendingBlocks.iterator();
+ Iterator it = pendingBlocks.iterator();
while (it.hasNext()) {
- SignatureFileVerifier sfv =
- (SignatureFileVerifier) it.next();
+ SignatureFileVerifier sfv = it.next();
if (sfv.needSignatureFile(key)) {
if (debug != null) {
debug.println(
@@ -282,7 +283,7 @@
String key = uname.substring(0, uname.lastIndexOf("."));
if (signerCache == null)
- signerCache = new ArrayList();
+ signerCache = new ArrayList<>();
if (manDig == null) {
synchronized(manifestRawBytes) {
@@ -299,7 +300,7 @@
if (sfv.needSignatureFileBytes()) {
// see if we have already parsed an external .SF file
- byte[] bytes = (byte[]) sigFileData.get(key);
+ byte[] bytes = sigFileData.get(key);
if (bytes == null) {
// put this block on queue for later processing
@@ -355,7 +356,7 @@
*/
public CodeSigner[] getCodeSigners(String name)
{
- return (CodeSigner[])verifiedSigners.get(name);
+ return verifiedSigners.get(name);
}
public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry)
@@ -388,15 +389,14 @@
CodeSigner[] signers) {
if (signers != null) {
- ArrayList certChains = new ArrayList();
+ ArrayList certChains = new ArrayList<>();
for (int i = 0; i < signers.length; i++) {
certChains.addAll(
signers[i].getSignerCertPath().getCertificates());
}
// Convert into a Certificate[]
- return (java.security.cert.Certificate[])
- certChains.toArray(
+ return certChains.toArray(
new java.security.cert.Certificate[certChains.size()]);
}
return null;
@@ -430,8 +430,8 @@
// MANIFEST.MF is always treated as signed and verified,
// move its signers from sigFileSigners to verifiedSigners.
if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
- verifiedSigners.put(JarFile.MANIFEST_NAME,
- sigFileSigners.remove(JarFile.MANIFEST_NAME));
+ CodeSigner[] codeSigners = sigFileSigners.remove(JarFile.MANIFEST_NAME);
+ verifiedSigners.put(JarFile.MANIFEST_NAME, codeSigners);
}
}
@@ -505,10 +505,10 @@
// Extended JavaUtilJarAccess CodeSource API Support
- private Map urlToCodeSourceMap = new HashMap();
- private Map signerToCodeSource = new HashMap();
+ private Map> urlToCodeSourceMap = new HashMap<>();
+ private Map signerToCodeSource = new HashMap<>();
private URL lastURL;
- private Map lastURLMap;
+ private Map lastURLMap;
/*
* Create a unique mapping from codeSigner cache entries to CodeSource.
@@ -516,19 +516,19 @@
* and shared JAR file although in practice there will be a single URL in use.
*/
private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
- Map map;
+ Map map;
if (url == lastURL) {
map = lastURLMap;
} else {
- map = (Map) urlToCodeSourceMap.get(url);
+ map = urlToCodeSourceMap.get(url);
if (map == null) {
- map = new HashMap();
+ map = new HashMap<>();
urlToCodeSourceMap.put(url, map);
}
lastURLMap = map;
lastURL = url;
}
- CodeSource cs = (CodeSource) map.get(signers);
+ CodeSource cs = map.get(signers);
if (cs == null) {
cs = new VerifierCodeSource(csdomain, url, signers);
signerToCodeSource.put(signers, cs);
@@ -536,16 +536,16 @@
return cs;
}
- private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) {
- List sources = new ArrayList();
+ private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) {
+ List sources = new ArrayList<>();
for (int i = 0; i < signers.size(); i++) {
- sources.add(mapSignersToCodeSource(url, (CodeSigner[]) signers.get(i)));
+ sources.add(mapSignersToCodeSource(url, signers.get(i)));
}
if (unsigned) {
sources.add(mapSignersToCodeSource(url, null));
}
- return (CodeSource[]) sources.toArray(new CodeSource[sources.size()]);
+ return sources.toArray(new CodeSource[sources.size()]);
}
private CodeSigner[] emptySigner = new CodeSigner[0];
@@ -565,7 +565,7 @@
* but this handles a CodeSource of any type, just in case.
*/
CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
- List sourceList = new ArrayList();
+ List sourceList = new ArrayList<>();
for (int i = 0; i < sources.length; i++) {
sourceList.add(sources[i]);
}
@@ -586,6 +586,7 @@
* signing data that can be compared by object reference identity.
*/
private static class VerifierCodeSource extends CodeSource {
+ private static final long serialVersionUID = -9047366145967768825L;
URL vlocation;
CodeSigner[] vsigners;
@@ -653,16 +654,16 @@
return vcerts;
}
}
- private Map signerMap;
+ private Map signerMap;
- private synchronized Map signerMap() {
+ private synchronized Map signerMap() {
if (signerMap == null) {
/*
* Snapshot signer state so it doesn't change on us. We care
* only about the asserted signatures. Verification of
* signature validity happens via the JarEntry apis.
*/
- signerMap = new HashMap(verifiedSigners.size() + sigFileSigners.size());
+ signerMap = new HashMap<>(verifiedSigners.size() + sigFileSigners.size());
signerMap.putAll(verifiedSigners);
signerMap.putAll(sigFileSigners);
}
@@ -670,15 +671,15 @@
}
public synchronized Enumeration entryNames(JarFile jar, final CodeSource[] cs) {
- final Map map = signerMap();
- final Iterator itor = map.entrySet().iterator();
+ final Map map = signerMap();
+ final Iterator> itor = map.entrySet().iterator();
boolean matchUnsigned = false;
/*
* Grab a single copy of the CodeSigner arrays. Check
* to see if we can optimize CodeSigner equality test.
*/
- List req = new ArrayList(cs.length);
+ List req = new ArrayList<>(cs.length);
for (int i = 0; i < cs.length; i++) {
CodeSigner[] match = findMatchingSigners(cs[i]);
if (match != null) {
@@ -692,8 +693,8 @@
}
}
- final List signersReq = req;
- final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
+ final List signersReq = req;
+ final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
return new Enumeration() {
@@ -705,14 +706,14 @@
}
while (itor.hasNext()) {
- Map.Entry e = (Map.Entry) itor.next();
- if (signersReq.contains((CodeSigner[]) e.getValue())) {
- name = (String) e.getKey();
+ Map.Entry e = itor.next();
+ if (signersReq.contains(e.getValue())) {
+ name = e.getKey();
return true;
}
}
while (enum2.hasMoreElements()) {
- name = (String) enum2.nextElement();
+ name = enum2.nextElement();
return true;
}
return false;
@@ -733,13 +734,13 @@
* Like entries() but screens out internal JAR mechanism entries
* and includes signed entries with no ZIP data.
*/
- public Enumeration entries2(final JarFile jar, Enumeration e) {
- final Map map = new HashMap();
+ public Enumeration entries2(final JarFile jar, Enumeration extends ZipEntry> e) {
+ final Map map = new HashMap<>();
map.putAll(signerMap());
- final Enumeration enum_ = e;
+ final Enumeration extends ZipEntry> enum_ = e;
return new Enumeration() {
- Enumeration signers = null;
+ Enumeration signers = null;
JarEntry entry;
public boolean hasMoreElements() {
@@ -747,7 +748,7 @@
return true;
}
while (enum_.hasMoreElements()) {
- ZipEntry ze = (ZipEntry) enum_.nextElement();
+ ZipEntry ze = enum_.nextElement();
if (JarVerifier.isSigningRelated(ze.getName())) {
continue;
}
@@ -758,7 +759,7 @@
signers = Collections.enumeration(map.keySet());
}
while (signers.hasMoreElements()) {
- String name = (String) signers.nextElement();
+ String name = signers.nextElement();
entry = jar.newEntry(new ZipEntry(name));
return true;
}
@@ -778,7 +779,7 @@
}
};
}
- private Enumeration emptyEnumeration = new Enumeration() {
+ private Enumeration emptyEnumeration = new Enumeration() {
public boolean hasMoreElements() {
return false;
@@ -795,8 +796,8 @@
}
private Enumeration unsignedEntryNames(JarFile jar) {
- final Map map = signerMap();
- final Enumeration entries = jar.entries();
+ final Map map = signerMap();
+ final Enumeration entries = jar.entries();
return new Enumeration() {
String name;
@@ -811,7 +812,7 @@
}
while (entries.hasMoreElements()) {
String value;
- ZipEntry e = (ZipEntry) entries.nextElement();
+ ZipEntry e = entries.nextElement();
value = e.getName();
if (e.isDirectory() || isSigningRelated(value)) {
continue;
@@ -834,14 +835,14 @@
}
};
}
- private List jarCodeSigners;
+ private List jarCodeSigners;
- private synchronized List getJarCodeSigners() {
+ private synchronized List getJarCodeSigners() {
CodeSigner[] signers;
if (jarCodeSigners == null) {
- HashSet set = new HashSet();
+ HashSet set = new HashSet<>();
set.addAll(signerMap().values());
- jarCodeSigners = new ArrayList();
+ jarCodeSigners = new ArrayList<>();
jarCodeSigners.addAll(set);
}
return jarCodeSigners;
@@ -856,7 +857,7 @@
public CodeSource getCodeSource(URL url, String name) {
CodeSigner[] signers;
- signers = (CodeSigner[]) signerMap().get(name);
+ signers = signerMap().get(name);
return mapSignersToCodeSource(url, signers);
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/java/util/zip/ZipFile.java
--- a/src/share/classes/java/util/zip/ZipFile.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/java/util/zip/ZipFile.java Tue Aug 22 02:03:52 2017 +0100
@@ -86,12 +86,18 @@
private static final boolean usemmap;
+ private static final boolean ensuretrailingslash;
+
static {
// A system prpperty to disable mmap use to avoid vm crash when
// in-use zip file is accidently overwritten by others.
String prop = sun.misc.VM.getSavedProperty("sun.zip.disableMemoryMapping");
usemmap = (prop == null ||
!(prop.length() == 0 || prop.equalsIgnoreCase("true")));
+
+ // see getEntry() for details
+ prop = sun.misc.VM.getSavedProperty("jdk.util.zip.ensureTrailingSlash");
+ ensuretrailingslash = prop == null || !prop.equalsIgnoreCase("false");
}
/**
@@ -305,7 +311,16 @@
ensureOpen();
jzentry = getEntry(jzfile, zc.getBytes(name), true);
if (jzentry != 0) {
- ZipEntry ze = getZipEntry(name, jzentry);
+ // If no entry is found for the specified 'name' and
+ // the 'name' does not end with a forward slash '/',
+ // the implementation tries to find the entry with a
+ // slash '/' appended to the end of the 'name', before
+ // returning null. When such entry is found, the name
+ // that actually is found (with a slash '/' attached)
+ // is used
+ // (disabled if jdk.util.zip.ensureTrailingSlash=false)
+ ZipEntry ze = ensuretrailingslash ? getZipEntry(null, jzentry)
+ : getZipEntry(name, jzentry);
freeEntry(jzfile, jzentry);
return ze;
}
@@ -525,7 +540,9 @@
e.name = name;
} else {
byte[] bname = getEntryBytes(jzentry, JZENTRY_NAME);
- if (!zc.isUTF8() && (e.flag & EFS) != 0) {
+ if (bname == null) {
+ e.name = ""; // length 0 empty name
+ } else if (!zc.isUTF8() && (e.flag & EFS) != 0) {
e.name = zc.toStringUTF8(bname, bname.length);
} else {
e.name = zc.toString(bname, bname.length);
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/javax/imageio/spi/ServiceRegistry.java
--- a/src/share/classes/javax/imageio/spi/ServiceRegistry.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/javax/imageio/spi/ServiceRegistry.java Tue Aug 22 02:03:52 2017 +0100
@@ -26,6 +26,9 @@
package javax.imageio.spi;
import java.io.File;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -690,11 +693,12 @@
Class category;
- // Provider Objects organized by partial oridering
- PartiallyOrderedSet poset = new PartiallyOrderedSet();
+ // Provider Objects organized by partial ordering
+ final PartiallyOrderedSet poset = new PartiallyOrderedSet();
// Class -> Provider Object of that class
- Map,Object> map = new HashMap();
+ final Map,Object> map = new HashMap();
+ final Map,AccessControlContext> accMap = new HashMap<>();
public SubRegistry(ServiceRegistry registry, Class category) {
this.registry = registry;
@@ -709,6 +713,7 @@
deregisterServiceProvider(oprovider);
}
map.put(provider.getClass(), provider);
+ accMap.put(provider.getClass(), AccessController.getContext());
poset.add(provider);
if (provider instanceof RegisterableService) {
RegisterableService rs = (RegisterableService)provider;
@@ -728,6 +733,7 @@
if (provider == oprovider) {
map.remove(provider.getClass());
+ accMap.remove(provider.getClass());
poset.remove(provider);
if (provider instanceof RegisterableService) {
RegisterableService rs = (RegisterableService)provider;
@@ -773,11 +779,21 @@
iter.remove();
if (provider instanceof RegisterableService) {
- RegisterableService rs = (RegisterableService)provider;
- rs.onDeregistration(registry, category);
+ final RegisterableService rs = (RegisterableService)provider;
+ AccessControlContext acc = accMap.get(provider.getClass());
+ if (acc != null || System.getSecurityManager() == null) {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public Void run() {
+ rs.onDeregistration(registry, category);
+ return null;
+ }
+ }, acc);
+ }
}
}
poset.clear();
+ accMap.clear();
}
public void finalize() {
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/javax/naming/directory/BasicAttribute.java
--- a/src/share/classes/javax/naming/directory/BasicAttribute.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/javax/naming/directory/BasicAttribute.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -515,7 +515,7 @@
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject(); // read in the attrID
int n = s.readInt(); // number of values
- values = new Vector<>(n);
+ values = new Vector<>(Math.min(1024, n));
while (--n >= 0) {
values.addElement(s.readObject());
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/awt/image/ImageWatched.java
--- a/src/share/classes/sun/awt/image/ImageWatched.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/awt/image/ImageWatched.java Tue Aug 22 02:03:52 2017 +0100
@@ -29,6 +29,10 @@
import java.awt.Image;
import java.awt.image.ImageObserver;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
public abstract class ImageWatched {
public static Link endlink = new Link();
@@ -85,16 +89,26 @@
}
}
+ static class AccWeakReference extends WeakReference {
+
+ private final AccessControlContext acc;
+
+ AccWeakReference(T ref) {
+ super(ref);
+ acc = AccessController.getContext();
+ }
+ }
+
/*
* Standard Link implementation to manage a Weak Reference
* to an ImageObserver.
*/
public static class WeakLink extends Link {
- private WeakReference myref;
+ private final AccWeakReference myref;
private Link next;
public WeakLink(ImageObserver obs, Link next) {
- myref = new WeakReference(obs);
+ myref = new AccWeakReference(obs);
this.next = next;
}
@@ -120,6 +134,21 @@
return this;
}
+ private static boolean update(final ImageObserver iw, AccessControlContext acc,
+ final Image img, final int info,
+ final int x, final int y, final int w, final int h) {
+
+ if (acc != null || System.getSecurityManager() != null) {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public Boolean run() {
+ return iw.imageUpdate(img, info, x, y, w, h);
+ }
+ }, acc);
+ }
+ return false;
+ }
+
public boolean newInfo(Image img, int info,
int x, int y, int w, int h)
{
@@ -129,7 +158,7 @@
if (myiw == null) {
// My referent is null so we must prune in a second pass.
ret = true;
- } else if (myiw.imageUpdate(img, info, x, y, w, h) == false) {
+ } else if (update(myiw, myref.acc, img, info, x, y, w, h) == false) {
// My referent has lost interest so clear it and ask
// for a pruning pass to remove it later.
myref.clear();
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/awt/resources/awt_sv.properties
--- a/src/share/classes/sun/awt/resources/awt_sv.properties Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/awt/resources/awt_sv.properties Tue Aug 22 02:03:52 2017 +0100
@@ -71,7 +71,7 @@
AWT.f22=F22
AWT.f23=F23
AWT.f24=F24
-AWT.printScreen=Print Screen
+AWT.printScreen=Sk\u00E4rmutskrift
AWT.insert=Insert
AWT.help=Hj\u00E4lp
AWT.windows=Windows
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/instrument/InstrumentationImpl.java
--- a/src/share/classes/sun/instrument/InstrumentationImpl.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/instrument/InstrumentationImpl.java Tue Aug 22 02:03:52 2017 +0100
@@ -136,7 +136,7 @@
}
public void
- retransformClasses(Class>[] classes) {
+ retransformClasses(Class>... classes) {
if (!isRetransformClassesSupported()) {
throw new UnsupportedOperationException(
"retransformClasses is not supported in this environment");
@@ -150,7 +150,7 @@
}
public void
- redefineClasses(ClassDefinition[] definitions)
+ redefineClasses(ClassDefinition... definitions)
throws ClassNotFoundException {
if (!isRedefineClassesSupported()) {
throw new UnsupportedOperationException("redefineClasses is not supported in this environment");
@@ -321,7 +321,7 @@
try {
m = javaAgentClass.getDeclaredMethod( methodname,
- new Class[] {
+ new Class>[] {
String.class,
java.lang.instrument.Instrumentation.class
}
@@ -336,7 +336,7 @@
// now try the declared 1-arg method
try {
m = javaAgentClass.getDeclaredMethod(methodname,
- new Class[] { String.class });
+ new Class>[] { String.class });
} catch (NoSuchMethodException x) {
// ignore this exception because we'll try
// two arg inheritance next
@@ -347,7 +347,7 @@
// now try the inherited 2-arg method
try {
m = javaAgentClass.getMethod( methodname,
- new Class[] {
+ new Class>[] {
String.class,
java.lang.instrument.Instrumentation.class
}
@@ -363,7 +363,7 @@
// finally try the inherited 1-arg method
try {
m = javaAgentClass.getMethod(methodname,
- new Class[] { String.class });
+ new Class>[] { String.class });
} catch (NoSuchMethodException x) {
// none of the methods exists so we throw the
// first NoSuchMethodException as per 5.0
@@ -411,7 +411,7 @@
private byte[]
transform( ClassLoader loader,
String classname,
- Class classBeingRedefined,
+ Class> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer,
boolean isRetransformer) {
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/instrument/TransformerManager.java
--- a/src/share/classes/sun/instrument/TransformerManager.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/instrument/TransformerManager.java Tue Aug 22 02:03:52 2017 +0100
@@ -169,7 +169,7 @@
public byte[]
transform( ClassLoader loader,
String classname,
- Class classBeingRedefined,
+ Class> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer) {
boolean someoneTouchedTheBytecode = false;
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/launcher/resources/launcher_es.properties
--- a/src/share/classes/sun/launcher/resources/launcher_es.properties Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/launcher/resources/launcher_es.properties Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2017, 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 @@
java.launcher.ergo.message2 =\ porque la ejecuci\u00F3n se est\u00E1 llevando a cabo en una m\u00E1quina de clase de servidor.\n
# Translators please note do not translate the options themselves
-java.launcher.opt.footer =\ -cp \n -classpath \n Lista separada por {0} de directorios, archivos JAR\n y archivos ZIP para buscar archivos de clase.\n -D=\n definir una propiedad del sistema\n -verbose:[class|gc|jni]\n activar la salida verbose\n -version imprimir la versi\u00F3n del producto y salir\n -version:\n Advertencia: Esta funci\u00F3n est\u00E1 anticuada y se eliminar\u00E1\n en una versi\u00F3n futura.\n es necesario que se ejecute la versi\u00F3n especificada\n -showversion imprimir la versi\u00F3n del producto y continuar\n -jre-restrict-search | -no-jre-restrict-search\n Advertencia: Esta funci\u00F3n est\u00E1 anticuada y se eliminar\u00E1\n en una versi\u00F3n futura.\n incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n -? -help imprimir este mensaje de ayuda\n -X imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n -ea[:...|:]\n -enableassertions[:...|:]\n activar afirmaciones con la granularidad especificada\n -da[:...|:]\n -disableassertions[:...|:]\n desactivar afirmaciones con la granularidad especificada\n -esa | -enablesystemassertions\n activar afirmaciones del sistema\n -dsa | -disablesystemassertions\n desactivar afirmaciones del sistema\n -agentlib:[=]\n cargar la biblioteca de agente nativa , como -agentlib:hprof\n v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n -agentpath:[=]\n cargar biblioteca de agente nativa con el nombre de la ruta de acceso completa\n -javaagent:[=]\n cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n -splash:\n mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obtener m\u00E1s informaci\u00F3n.
+java.launcher.opt.footer =\ -cp \n -classpath \n Lista separada por {0} de directorios, archivos JAR\n y archivos ZIP para buscar archivos de clase.\n -D=\n definir una propiedad del sistema\n -verbose:[class|gc|jni]\n activar la salida verbose\n -version imprimir la versi\u00F3n del producto y salir\n -version:\n Advertencia: Esta funci\u00F3n est\u00E1 anticuada y se eliminar\u00E1\n en una versi\u00F3n futura.\n es necesario que se ejecute la versi\u00F3n especificada\n -showversion imprimir la versi\u00F3n del producto y continuar\n -jre-restrict-search | -no-jre-restrict-search\n Advertencia: Esta funci\u00F3n est\u00E1 anticuada y se eliminar\u00E1\n en una versi\u00F3n futura.\n incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n -? -help imprimir este mensaje de ayuda\n -X imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n -ea[:...|:]\n -enableassertions[:...|:]\n activar afirmaciones con la granularidad especificada\n -da[:...|:]\n -disableassertions[:...|:]\n desactivar afirmaciones con la granularidad especificada\n -esa | -enablesystemassertions\n activar afirmaciones del sistema\n -dsa | -disablesystemassertions\n desactivar afirmaciones del sistema\n -agentlib:[=]\n cargar la biblioteca de agente nativa , como -agentlib:hprof\n v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n -agentpath:[=]\n cargar biblioteca de agente nativa con el nombre de la ruta de acceso completa\n -javaagent:[=]\n cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n -splash:\n mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obtener m\u00E1s informaci\u00F3n.
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed ejecuci\u00F3n de modo mixto (por defecto)\n -Xint s\u00F3lo ejecuci\u00F3n de modo interpretado\n -Xbootclasspath:\n definir la ruta de acceso de b\u00FAsqueda para los recursos y clases de inicializaci\u00F3n de datos\n -Xbootclasspath/a:\n agregar al final de la ruta de acceso de la clase de inicializaci\u00F3n de datos\n -Xbootclasspath/p:\n anteponer a la ruta de acceso de la clase de inicializaci\u00F3n de datos\n -Xdiag mostrar mensajes de diagn\u00F3stico adicionales\n -Xnoclassgc desactivar la recolecci\u00F3n de basura de clases\n -Xincgc activar la recolecci\u00F3n de basura de clases\n -Xloggc: registrar el estado de GC en un archivo con registros de hora\n -Xbatch desactivar compilaci\u00F3n en segundo plano\n -Xms definir tama\u00F1o de pila Java inicial\n -Xmx definir tama\u00F1o de pila Java m\u00E1ximo\n -Xss definir tama\u00F1o de la pila del thread de Java\n -Xprof datos de salida de creaci\u00F3n de perfil de CPU\n -Xfuture activar las comprobaciones m\u00E1s estrictas, anticip\u00E1ndose al futuro valor por defecto\n -Xrs reducir el uso de se\u00F1ales de sistema operativo por parte de Java/VM (consulte la documentaci\u00F3n)\n -Xcheck:jni realizar comprobaciones adicionales para las funciones de JNI\n -Xshare:off no intentar usar datos de clase compartidos\n -Xshare:auto usar datos de clase compartidos si es posible (valor por defecto)\n -Xshare:on es obligatorio el uso de datos de clase compartidos, de lo contrario se emitir\u00E1 un fallo.\n -XshowSettings mostrar todos los valores y continuar\n -XshowSettings:all\n mostrar todos los valores y continuar\n -XshowSettings:vm mostrar todos los valores de la VM y continuar\n -XshowSettings:properties\n mostrar todos los valores de las propiedades y continuar\n -XshowSettings:locale\n mostrar todos los valores relacionados con la configuraci\u00F3n regional y continuar\n\nLas opciones -X no son est\u00E1ndar, por lo que podr\u00EDan cambiarse sin previo aviso.\n
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/launcher/resources/launcher_sv.properties
--- a/src/share/classes/sun/launcher/resources/launcher_sv.properties Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/launcher/resources/launcher_sv.properties Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2017, 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
@@ -37,7 +37,7 @@
java.launcher.opt.footer =\ -cp \n -classpath \n En lista \u00F6ver kataloger, JAR-arkiv och och ZIP-arkiv\n f\u00F6r s\u00F6kning efter klassfiler avgr\u00E4nsad med {0}.\n -D=\n ange en systemegenskap\n -verbose:[class|gc|jni]\n aktivera utf\u00F6rliga utdata\n -version skriv ut produktversion och avsluta\n -version:\n Varning: den h\u00E4r funktionen \u00E4r inaktuell och kommer\n att tas bort i en framtida utg\u00E5va.\n kr\u00E4v den angivna versionen f\u00F6r att k\u00F6ra\n -showversion skriv ut produktversion och forts\u00E4tt\n -jre-restrict-search | -no-jre-restrict-search\n Varning: den h\u00E4r funktionen \u00E4r inaktuell och kommer\n att tas bort i en framtida utg\u00E5va.\n inkludera/exkludera anv\u00E4ndarprivata JRE:er i versionss\u00F6kningen\n -? -help skriv ut det h\u00E4r hj\u00E4lpmeddelandet\n -X skriv ut hj\u00E4lp f\u00F6r icke-standardalternativ\n -ea[:...|:]\n -enableassertions[:...|:]\n aktivera verifieringar med den angivna detaljgraden\n -da[:...|:]\n -disableassertions[:...|:]\n avaktivera verifieringar med den angivna detaljgraden\n -esa | -enablesystemassertions\n aktivera systemverifieringar\n -dsa | -disablesystemassertions\n avaktivera systemverifieringar\n -agentlib:[=]\n ladda det ursprungliga agentbiblioteket , t.ex. -agentlib:hprof\n se \u00E4ven -agentlib:jdwp=help och -agentlib:hprof=help\n -agentpath:[=]\n ladda det ursprungliga agentbiblioteket med det fullst\u00E4ndiga s\u00F6kv\u00E4gsnamnet\n -javaagent:[=]\n ladda agenten f\u00F6r programmeringsspr\u00E5ket Java, se java.lang.instrument\n -splash:\n visa v\u00E4lkomstsk\u00E4rmen med den angivna bilden\nMer information finns p\u00E5 http://www.oracle.com/technetwork/java/javase/documentation/index.html.
# Translators please note do not translate the options themselves
-java.launcher.X.usage=\ -Xmixed k\u00F6rning i blandat l\u00E4ge (standard)\n -Xint endast k\u00F6rning i tolkat l\u00E4ge\n -Xbootclasspath:\n ange s\u00F6kv\u00E4g f\u00F6r programladdningsklasser och -resurser\n -Xbootclasspath/a:\n l\u00E4gg till i slutet av programladdningsklassens s\u00F6kv\u00E4g\n -Xbootclasspath/p:\n l\u00E4gg till i b\u00F6rjan av programladdningsklassens s\u00F6kv\u00E4g\n -Xdiag visa ytterligare diagnostiska meddelanden\n -Xnoclassgc avaktivera klassens skr\u00E4pinsamling\n -Xincgc aktivera inkrementell skr\u00E4pinsamling\n -Xloggc: logga GC-status till en fil med tidsst\u00E4mplar\n -Xbatch avaktivera bakgrundskompilering\n -Xms ange ursprunglig storlek f\u00F6r Java-heap\n -Xmx ange maximal storlek f\u00F6r Java-heap\n -Xss ange storlek f\u00F6r java-tr\u00E5dsstack\n -Xprof utdata f\u00F6r processorprofilering\n -Xfuture aktivera str\u00E4ngaste kontroller, f\u00F6rv\u00E4ntad framtida standard\n -Xrs minska OS-signalanv\u00E4ndning av Java/VM (se dokumentation)\n -Xcheck:jni utf\u00F6r ytterligare kontroller f\u00F6r JNI-funktioner\n -Xshare:off anv\u00E4nd inte delade klassdata\n -Xshare:auto anv\u00E4nd delade klassdata om det g\u00E5r (standard)\n -Xshare:on kr\u00E4v att delade klassdata anv\u00E4nds, annars slutf\u00F6r inte.\n -XshowSettings visa alla inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:all\n visa alla inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:vm visa alla vm-relaterade inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:properties\n visa alla egenskapsinst\u00E4llningar och forts\u00E4tt\n -XshowSettings:locale\n visa alla spr\u00E5krelaterade inst\u00E4llningar och forts\u00E4tt\n\n-X-alternativen \u00E4r inte standard och kan \u00E4ndras utan f\u00F6reg\u00E5ende meddelande.\n
+java.launcher.X.usage=\ -Xmixed exekvering i blandat l\u00E4ge (standard)\n -Xint endast exekvering i tolkat l\u00E4ge\n -Xbootclasspath:\n ange s\u00F6kv\u00E4g f\u00F6r programladdningsklasser och -resurser\n -Xbootclasspath/a:\n l\u00E4gg till i slutet av programladdningsklassens s\u00F6kv\u00E4g\n -Xbootclasspath/p:\n l\u00E4gg till i b\u00F6rjan av programladdningsklassens s\u00F6kv\u00E4g\n -Xdiag visa ytterligare diagnostiska meddelanden\n -Xnoclassgc avaktivera klassens skr\u00E4pinsamling\n -Xincgc aktivera inkrementell skr\u00E4pinsamling\n -Xloggc: logga GC-status till en fil med tidsst\u00E4mplar\n -Xbatch avaktivera bakgrundskompilering\n -Xms ange ursprunglig storlek f\u00F6r Java-heap\n -Xmx ange maximal storlek f\u00F6r Java-heap\n -Xss ange storlek f\u00F6r java-tr\u00E5dsstack\n -Xprof utdata f\u00F6r processorprofilering\n -Xfuture aktivera str\u00E4ngaste kontroller, f\u00F6rv\u00E4ntad framtida standard\n -Xrs minska OS-signalanv\u00E4ndning av Java/VM (se dokumentation)\n -Xcheck:jni utf\u00F6r ytterligare kontroller f\u00F6r JNI-funktioner\n -Xshare:off anv\u00E4nd inte delade klassdata\n -Xshare:auto anv\u00E4nd delade klassdata om det g\u00E5r (standard)\n -Xshare:on kr\u00E4v att delade klassdata anv\u00E4nds, annars slutf\u00F6r inte.\n -XshowSettings visa alla inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:all\n visa alla inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:vm visa alla vm-relaterade inst\u00E4llningar och forts\u00E4tt\n -XshowSettings:properties\n visa alla egenskapsinst\u00E4llningar och forts\u00E4tt\n -XshowSettings:locale\n visa alla spr\u00E5krelaterade inst\u00E4llningar och forts\u00E4tt\n\n-X-alternativen \u00E4r inte standard och kan \u00E4ndras utan f\u00F6reg\u00E5ende meddelande.\n
# Translators please note do not translate the options themselves
java.launcher.X.macosx.usage=\nF\u00F6ljande alternativ \u00E4r specifika f\u00F6r Mac OS X:\n -XstartOnFirstThread\n k\u00F6r huvudmetoden() p\u00E5 den f\u00F6rsta (AppKit) tr\u00E5den\n -Xdock:name="\n \u00E5sidosatt standardapplikationsnamn visas i docka\n -Xdock:icon=\n \u00E5sidosatt standardikon visas i docka\n\n
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/Agent.java
--- a/src/share/classes/sun/management/Agent.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/Agent.java Tue Aug 22 02:03:52 2017 +0100
@@ -383,11 +383,8 @@
adaptorClass.getMethod("initialize",
String.class, Properties.class);
initializeMethod.invoke(null,snmpPort,props);
- } catch (ClassNotFoundException x) {
- // The SNMP packages are not present: throws an exception.
- throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
- } catch (NoSuchMethodException x) {
- // should not happen...
+ } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException x) {
+ // snmp runtime doesn't exist - initialization fails
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
} catch (InvocationTargetException x) {
final Throwable cause = x.getCause();
@@ -397,9 +394,6 @@
throw (Error) cause;
// should not happen...
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,cause);
- } catch (IllegalAccessException x) {
- // should not happen...
- throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
}
}
@@ -440,8 +434,8 @@
} catch (IOException e) {
error(CONFIG_FILE_CLOSE_FAILED, fname);
}
- }
- }
+ }
+ }
}
public static void startAgent() throws Exception {
@@ -476,7 +470,7 @@
// invoke the premain(String args) method
Class> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
Method premain = clz.getMethod("premain",
- new Class[] { String.class });
+ new Class>[] { String.class });
premain.invoke(null, /* static */
new Object[] { args });
} catch (ClassNotFoundException ex) {
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/ConnectorAddressLink.java
--- a/src/share/classes/sun/management/ConnectorAddressLink.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/ConnectorAddressLink.java Tue Aug 22 02:03:52 2017 +0100
@@ -117,11 +117,11 @@
} catch (IllegalArgumentException iae) {
throw new IOException(iae.getMessage());
}
- List counters =
+ List counters =
new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
- Iterator i = counters.iterator();
+ Iterator i = counters.iterator();
if (i.hasNext()) {
- Counter c = (Counter) i.next();
+ Counter c = i.next();
return (String) c.getValue();
} else {
return null;
@@ -167,13 +167,13 @@
} catch (IllegalArgumentException iae) {
throw new IOException(iae.getMessage());
}
- List counters = new PerfInstrumentation(bb).getAllCounters();
- Map properties = new HashMap();
- for (Object c : counters) {
- String name = ((Counter) c).getName();
+ List counters = new PerfInstrumentation(bb).getAllCounters();
+ Map properties = new HashMap<>();
+ for (Counter c : counters) {
+ String name = c.getName();
if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
!name.equals(CONNECTOR_ADDRESS_COUNTER)) {
- properties.put(name, ((Counter) c).getValue().toString());
+ properties.put(name, c.getValue().toString());
}
}
return properties;
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/Flag.java
--- a/src/share/classes/sun/management/Flag.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/Flag.java Tue Aug 22 02:03:52 2017 +0100
@@ -91,7 +91,7 @@
Flag[] flags = new Flag[numFlags];
int count = getFlags(names, flags, numFlags);
- List result = new ArrayList();
+ List result = new ArrayList<>();
for (Flag f : flags) {
if (f != null) {
result.add(f);
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java
--- a/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java Tue Aug 22 02:03:52 2017 +0100
@@ -69,11 +69,7 @@
Field f = cl.getDeclaredField("builder");
f.setAccessible(true);
return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo());
- } catch(ClassNotFoundException e) {
- return null;
- } catch(NoSuchFieldException e) {
- return null;
- } catch(IllegalAccessException e) {
+ } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
return null;
}
}
@@ -82,7 +78,7 @@
synchronized(compositeTypeByBuilder) {
gict = compositeTypeByBuilder.get(builder);
if(gict == null) {
- OpenType[] gcNotifInfoItemTypes = new OpenType[] {
+ OpenType>[] gcNotifInfoItemTypes = new OpenType>[] {
SimpleType.STRING,
SimpleType.STRING,
SimpleType.STRING,
@@ -141,7 +137,7 @@
GC_INFO
};
private static HashMap compositeTypeByBuilder =
- new HashMap();
+ new HashMap<>();
public static String getGcName(CompositeData cd) {
String gcname = getString(cd, GC_NAME);
@@ -195,7 +191,7 @@
private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
if (baseGcNotifInfoCompositeType == null) {
try {
- OpenType[] baseGcNotifInfoItemTypes = new OpenType[] {
+ OpenType>[] baseGcNotifInfoItemTypes = new OpenType>[] {
SimpleType.STRING,
SimpleType.STRING,
SimpleType.STRING,
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/GarbageCollectorImpl.java
--- a/src/share/classes/sun/management/GarbageCollectorImpl.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/GarbageCollectorImpl.java Tue Aug 22 02:03:52 2017 +0100
@@ -70,14 +70,11 @@
private String[] poolNames = null;
synchronized String[] getAllPoolNames() {
if (poolNames == null) {
- List pools = ManagementFactory.getMemoryPoolMXBeans();
+ List pools = ManagementFactory.getMemoryPoolMXBeans();
poolNames = new String[pools.size()];
int i = 0;
- for (ListIterator iter = pools.listIterator();
- iter.hasNext();
- i++) {
- MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
- poolNames[i] = p.getName();
+ for (MemoryPoolMXBean m : pools) {
+ poolNames[i++] = m.getName();
}
}
return poolNames;
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/GcInfoBuilder.java
--- a/src/share/classes/sun/management/GcInfoBuilder.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/GcInfoBuilder.java Tue Aug 22 02:03:52 2017 +0100
@@ -104,7 +104,7 @@
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
- OpenType[] allItemTypes = new OpenType[itemCount];
+ OpenType>[] allItemTypes = new OpenType>[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/GcInfoCompositeData.java
--- a/src/share/classes/sun/management/GcInfoCompositeData.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/GcInfoCompositeData.java Tue Aug 22 02:03:52 2017 +0100
@@ -76,11 +76,7 @@
Field f = cl.getDeclaredField("builder");
f.setAccessible(true);
return (GcInfoBuilder)f.get(info);
- } catch(ClassNotFoundException e) {
- return null;
- } catch(NoSuchFieldException e) {
- return null;
- } catch(IllegalAccessException e) {
+ } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
return null;
}
}
@@ -92,11 +88,7 @@
Field f = cl.getDeclaredField("extAttributes");
f.setAccessible(true);
return (Object[])f.get(info);
- } catch(ClassNotFoundException e) {
- return null;
- } catch(NoSuchFieldException e) {
- return null;
- } catch(IllegalAccessException e) {
+ } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
return null;
}
}
@@ -180,10 +172,7 @@
Method m = GcInfo.class.getMethod("getMemoryUsageBeforeGc");
memoryUsageMapType =
MappedMXBeanType.getMappedType(m.getGenericReturnType());
- } catch (NoSuchMethodException e) {
- // Should never reach here
- throw new AssertionError(e);
- } catch (OpenDataException e) {
+ } catch (NoSuchMethodException | OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
}
@@ -197,7 +186,7 @@
static synchronized OpenType[] getBaseGcInfoItemTypes() {
if (baseGcInfoItemTypes == null) {
OpenType> memoryUsageOpenType = memoryUsageMapType.getOpenType();
- baseGcInfoItemTypes = new OpenType[] {
+ baseGcInfoItemTypes = new OpenType>[] {
SimpleType.LONG,
SimpleType.LONG,
SimpleType.LONG,
@@ -225,10 +214,7 @@
try {
TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC);
return cast(memoryUsageMapType.toJavaTypeData(td));
- } catch (InvalidObjectException e) {
- // Should never reach here
- throw new AssertionError(e);
- } catch (OpenDataException e) {
+ } catch (InvalidObjectException | OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
}
@@ -244,10 +230,7 @@
TabularData td = (TabularData) cd.get(MEMORY_USAGE_AFTER_GC);
//return (Map)
return cast(memoryUsageMapType.toJavaTypeData(td));
- } catch (InvalidObjectException e) {
- // Should never reach here
- throw new AssertionError(e);
- } catch (OpenDataException e) {
+ } catch (InvalidObjectException | OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/HotSpotDiagnostic.java
--- a/src/share/classes/sun/management/HotSpotDiagnostic.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/HotSpotDiagnostic.java Tue Aug 22 02:03:52 2017 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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,8 @@
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* Implementation of the diagnostic MBean for Hotspot VM.
@@ -41,6 +43,19 @@
}
public void dumpHeap(String outputFile, boolean live) throws IOException {
+
+ final String propertyName = "jdk.management.heapdump.allowAnyFileSuffix";
+ PrivilegedAction pa = new PrivilegedAction() {
+ @Override
+ public Boolean run() {
+ return Boolean.parseBoolean(System.getProperty(propertyName, "false"));
+ }
+ };
+ boolean allowAnyFileSuffix = AccessController.doPrivileged(pa);
+ if (!allowAnyFileSuffix && !outputFile.endsWith(".hprof")) {
+ throw new IllegalArgumentException("heapdump file must have .hprof extention");
+ }
+
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(outputFile);
@@ -54,7 +69,7 @@
public List getDiagnosticOptions() {
List allFlags = Flag.getAllFlags();
- List result = new ArrayList();
+ List result = new ArrayList<>();
for (Flag flag : allFlags) {
if (flag.isWriteable() && flag.isExternal()) {
result.add(flag.getVMOption());
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/HotspotCompilation.java
--- a/src/share/classes/sun/management/HotspotCompilation.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/HotspotCompilation.java Tue Aug 22 02:03:52 2017 +0100
@@ -120,13 +120,13 @@
// current implementation. We first look up in the SUN_CI namespace
// since most counters are in SUN_CI namespace.
- if ((c = (Counter) counters.get(SUN_CI + name)) != null) {
+ if ((c = counters.get(SUN_CI + name)) != null) {
return c;
}
- if ((c = (Counter) counters.get(COM_SUN_CI + name)) != null) {
+ if ((c = counters.get(COM_SUN_CI + name)) != null) {
return c;
}
- if ((c = (Counter) counters.get(JAVA_CI + name)) != null) {
+ if ((c = counters.get(JAVA_CI + name)) != null) {
return c;
}
@@ -136,10 +136,8 @@
private void initCompilerCounters() {
// Build a tree map of the current list of performance counters
- ListIterator iter = getInternalCompilerCounters().listIterator();
- counters = new TreeMap();
- while (iter.hasNext()) {
- Counter c = (Counter) iter.next();
+ counters = new TreeMap<>();
+ for (Counter c: getInternalCompilerCounters()) {
counters.put(c.getName(), c);
}
@@ -200,7 +198,7 @@
}
public java.util.List getCompilerThreadStats() {
- List list = new ArrayList(threads.length);
+ List list = new ArrayList<>(threads.length);
int i = 0;
if (threads[0] == null) {
// no adaptor thread
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/HotspotThread.java
--- a/src/share/classes/sun/management/HotspotThread.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/HotspotThread.java Tue Aug 22 02:03:52 2017 +0100
@@ -58,7 +58,7 @@
String[] names = new String[count];
long[] times = new long[count];
int numThreads = getInternalThreadTimes0(names, times);
- Map result = new HashMap(numThreads);
+ Map result = new HashMap<>(numThreads);
for (int i = 0; i < numThreads; i++) {
result.put(names[i], new Long(times[i]));
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/LazyCompositeData.java
--- a/src/share/classes/sun/management/LazyCompositeData.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/LazyCompositeData.java Tue Aug 22 02:03:52 2017 +0100
@@ -27,6 +27,7 @@
import java.io.Serializable;
import java.util.*;
+import javax.management.openmbean.ArrayType;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeType;
import javax.management.openmbean.OpenType;
@@ -48,40 +49,49 @@
private CompositeData compositeData;
// Implementation of the CompositeData interface
+ @Override
public boolean containsKey(String key) {
return compositeData().containsKey(key);
}
+ @Override
public boolean containsValue(Object value) {
return compositeData().containsValue(value);
}
+ @Override
public boolean equals(Object obj) {
return compositeData().equals(obj);
}
+ @Override
public Object get(String key) {
return compositeData().get(key);
}
+ @Override
public Object[] getAll(String[] keys) {
return compositeData().getAll(keys);
}
+ @Override
public CompositeType getCompositeType() {
return compositeData().getCompositeType();
}
+ @Override
public int hashCode() {
return compositeData().hashCode();
}
+ @Override
public String toString() {
/** FIXME: What should this be?? */
return compositeData().toString();
}
- public Collection values() {
+ @Override
+ public Collection> values() {
return compositeData().values();
}
@@ -126,54 +136,45 @@
if (cd == null)
throw new IllegalArgumentException("Null CompositeData");
- return ((Boolean) cd.get(itemName)).booleanValue();
+ return ((Boolean) cd.get(itemName));
}
static long getLong(CompositeData cd, String itemName) {
if (cd == null)
throw new IllegalArgumentException("Null CompositeData");
- return ((Long) cd.get(itemName)).longValue();
+ return ((Long) cd.get(itemName));
}
static int getInt(CompositeData cd, String itemName) {
if (cd == null)
throw new IllegalArgumentException("Null CompositeData");
- return ((Integer) cd.get(itemName)).intValue();
+ return ((Integer) cd.get(itemName));
}
/**
* Compares two CompositeTypes and returns true if
* all items in type1 exist in type2 and their item types
* are the same.
+ * @param type1 the base composite type
+ * @param type2 the checked composite type
+ * @return {@code true} if all items in type1 exist in type2 and their item
+ * types are the same.
*/
protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
if (type1 == type2) return true;
// We can't use CompositeType.isValue() since it returns false
// if the type name doesn't match.
- Set allItems = type1.keySet();
+ Set allItems = type1.keySet();
// Check all items in the type1 exist in type2
if (!type2.keySet().containsAll(allItems))
return false;
- for (Iterator iter = allItems.iterator(); iter.hasNext(); ) {
- String item = (String) iter.next();
- OpenType ot1 = type1.getType(item);
- OpenType ot2 = type2.getType(item);
- if (ot1 instanceof CompositeType) {
- if (! (ot2 instanceof CompositeType))
- return false;
- if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
- return false;
- } else if (ot1 instanceof TabularType) {
- if (! (ot2 instanceof TabularType))
- return false;
- if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
- return false;
- } else if (!ot1.equals(ot2)) {
+ for (String item: allItems) {
+ if (!isTypeMatched(type1.getType(item), type2.getType(item))) {
return false;
}
}
@@ -183,8 +184,8 @@
protected static boolean isTypeMatched(TabularType type1, TabularType type2) {
if (type1 == type2) return true;
- List list1 = type1.getIndexNames();
- List list2 = type2.getIndexNames();
+ List list1 = type1.getIndexNames();
+ List list2 = type2.getIndexNames();
// check if the list of index names are the same
if (!list1.equals(list2))
@@ -193,5 +194,41 @@
return isTypeMatched(type1.getRowType(), type2.getRowType());
}
+ protected static boolean isTypeMatched(ArrayType> type1, ArrayType> type2) {
+ if (type1 == type2) return true;
+
+ int dim1 = type1.getDimension();
+ int dim2 = type2.getDimension();
+
+ // check if the array dimensions are the same
+ if (dim1 != dim2)
+ return false;
+
+ return isTypeMatched(type1.getElementOpenType(), type2.getElementOpenType());
+ }
+
+ private static boolean isTypeMatched(OpenType> ot1, OpenType> ot2) {
+ if (ot1 instanceof CompositeType) {
+ if (! (ot2 instanceof CompositeType))
+ return false;
+ if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
+ return false;
+ } else if (ot1 instanceof TabularType) {
+ if (! (ot2 instanceof TabularType))
+ return false;
+ if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
+ return false;
+ } else if (ot1 instanceof ArrayType) {
+ if (! (ot2 instanceof ArrayType))
+ return false;
+ if (!isTypeMatched((ArrayType>) ot1, (ArrayType>) ot2)) {
+ return false;
+ }
+ } else if (!ot1.equals(ot2)) {
+ return false;
+ }
+ return true;
+ }
+
private static final long serialVersionUID = -2190411934472666714L;
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/ManagementFactoryHelper.java
--- a/src/share/classes/sun/management/ManagementFactoryHelper.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/ManagementFactoryHelper.java Tue Aug 22 02:03:52 2017 +0100
@@ -110,7 +110,7 @@
public static List getMemoryPoolMXBeans() {
MemoryPoolMXBean[] pools = MemoryImpl.getMemoryPools();
- List list = new ArrayList(pools.length);
+ List list = new ArrayList<>(pools.length);
for (MemoryPoolMXBean p : pools) {
list.add(p);
}
@@ -119,7 +119,7 @@
public static List getMemoryManagerMXBeans() {
MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers();
- List result = new ArrayList(mgrs.length);
+ List result = new ArrayList<>(mgrs.length);
for (MemoryManagerMXBean m : mgrs) {
result.add(m);
}
@@ -128,7 +128,7 @@
public static List getGarbageCollectorMXBeans() {
MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers();
- List result = new ArrayList(mgrs.length);
+ List result = new ArrayList<>(mgrs.length);
for (MemoryManagerMXBean m : mgrs) {
if (GarbageCollectorMXBean.class.isInstance(m)) {
result.add(GarbageCollectorMXBean.class.cast(m));
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/MappedMXBeanType.java
--- a/src/share/classes/sun/management/MappedMXBeanType.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/MappedMXBeanType.java Tue Aug 22 02:03:52 2017 +0100
@@ -62,18 +62,18 @@
@SuppressWarnings("unchecked")
public abstract class MappedMXBeanType {
private static final WeakHashMap convertedTypes =
- new WeakHashMap();
+ new WeakHashMap<>();
boolean isBasicType = false;
- OpenType openType = inProgress;
- Class mappedTypeClass;
+ OpenType> openType = inProgress;
+ Class> mappedTypeClass;
static synchronized MappedMXBeanType newMappedType(Type javaType)
throws OpenDataException {
MappedMXBeanType mt = null;
if (javaType instanceof Class) {
- final Class c = (Class) javaType;
+ final Class> c = (Class>) javaType;
if (c.isEnum()) {
mt = new EnumMXBeanType(c);
} else if (c.isArray()) {
@@ -85,7 +85,7 @@
final ParameterizedType pt = (ParameterizedType) javaType;
final Type rawType = pt.getRawType();
if (rawType instanceof Class) {
- final Class rc = (Class) rawType;
+ final Class> rc = (Class>) rawType;
if (rc == List.class) {
mt = new ListMXBeanType(pt);
} else if (rc == Map.class) {
@@ -106,7 +106,7 @@
}
// basic types do not require data mapping
- static synchronized MappedMXBeanType newBasicType(Class c, OpenType ot)
+ static synchronized MappedMXBeanType newBasicType(Class> c, OpenType> ot)
throws OpenDataException {
MappedMXBeanType mt = new BasicMXBeanType(c, ot);
convertedTypes.put(c, mt);
@@ -127,7 +127,7 @@
}
// Convert a class to an OpenType
- public static synchronized OpenType toOpenType(Type t)
+ public static synchronized OpenType> toOpenType(Type t)
throws OpenDataException {
MappedMXBeanType mt = getMappedType(t);
return mt.getOpenType();
@@ -152,7 +152,7 @@
}
// Return the mapped open type
- OpenType getOpenType() {
+ OpenType> getOpenType() {
return openType;
}
@@ -168,7 +168,7 @@
}
// Return the mapped open type
- Class getMappedTypeClass() {
+ Class> getMappedTypeClass() {
return mappedTypeClass;
}
@@ -192,8 +192,8 @@
// T <-> T (no conversion)
//
static class BasicMXBeanType extends MappedMXBeanType {
- final Class basicType;
- BasicMXBeanType(Class c, OpenType openType) {
+ final Class> basicType;
+ BasicMXBeanType(Class> c, OpenType> openType) {
this.basicType = c;
this.openType = openType;
this.mappedTypeClass = c;
@@ -228,7 +228,7 @@
//
static class EnumMXBeanType extends MappedMXBeanType {
final Class enumClass;
- EnumMXBeanType(Class c) {
+ EnumMXBeanType(Class> c) {
this.enumClass = c;
this.openType = STRING;
this.mappedTypeClass = String.class;
@@ -269,16 +269,16 @@
// E[] <-> openTypeData(E)[]
//
static class ArrayMXBeanType extends MappedMXBeanType {
- final Class arrayClass;
+ final Class> arrayClass;
protected MappedMXBeanType componentType;
protected MappedMXBeanType baseElementType;
- ArrayMXBeanType(Class c) throws OpenDataException {
+ ArrayMXBeanType(Class> c) throws OpenDataException {
this.arrayClass = c;
this.componentType = getMappedType(c.getComponentType());
StringBuilder className = new StringBuilder();
- Class et = c;
+ Class> et = c;
int dim;
for (dim = 0; et.isArray(); dim++) {
className.append('[');
@@ -299,7 +299,7 @@
throw ode;
}
- openType = new ArrayType(dim, baseElementType.getOpenType());
+ openType = new ArrayType<>(dim, baseElementType.getOpenType());
}
protected ArrayMXBeanType() {
@@ -395,7 +395,7 @@
throw ode;
}
- openType = new ArrayType(dim, baseElementType.getOpenType());
+ openType = new ArrayType<>(dim, baseElementType.getOpenType());
}
Type getJavaType() {
@@ -428,7 +428,7 @@
throw new OpenDataException("Element Type for " + pt +
" not supported");
}
- final Class et = (Class) argTypes[0];
+ final Class> et = (Class>) argTypes[0];
if (et.isArray()) {
throw new OpenDataException("Element Type for " + pt +
" not supported");
@@ -445,7 +445,7 @@
ode.initCause(e);
throw ode;
}
- openType = new ArrayType(1, paramType.getOpenType());
+ openType = new ArrayType<>(1, paramType.getOpenType());
}
Type getJavaType() {
@@ -473,7 +473,7 @@
throws OpenDataException, InvalidObjectException {
final Object[] openArray = (Object[]) data;
- List result = new ArrayList(openArray.length);
+ List result = new ArrayList<>(openArray.length);
for (Object o : openArray) {
result.add(paramType.toJavaTypeData(o));
}
@@ -514,7 +514,7 @@
// FIXME: generate typeName for generic
typeName = "Map<" + keyType.getName() + "," +
valueType.getName() + ">";
- final OpenType[] mapItemTypes = new OpenType[] {
+ final OpenType>[] mapItemTypes = new OpenType>[] {
keyType.getOpenType(),
valueType.getOpenType(),
};
@@ -543,7 +543,7 @@
final TabularData table = new TabularDataSupport(tabularType);
final CompositeType rowType = tabularType.getRowType();
- for (Map.Entry entry : map.entrySet()) {
+ for (Map.Entry entry : map.entrySet()) {
final Object key = keyType.toOpenTypeData(entry.getKey());
final Object value = valueType.toOpenTypeData(entry.getValue());
final CompositeData row =
@@ -560,7 +560,7 @@
final TabularData td = (TabularData) data;
- Map result = new HashMap();
+ Map result = new HashMap<>();
for (CompositeData row : (Collection) td.values()) {
Object key = keyType.toJavaTypeData(row.get(KEY));
Object value = valueType.toJavaTypeData(row.get(VALUE));
@@ -607,7 +607,7 @@
final boolean isCompositeData;
Method fromMethod = null;
- CompositeDataMXBeanType(Class c) throws OpenDataException {
+ CompositeDataMXBeanType(Class> c) throws OpenDataException {
this.javaClass = c;
this.mappedTypeClass = COMPOSITE_DATA_CLASS;
@@ -639,8 +639,8 @@
return javaClass.getMethods();
}
});
- final List names = new ArrayList();
- final List types = new ArrayList();
+ final List names = new ArrayList<>();
+ final List> types = new ArrayList<>();
/* Select public methods that look like "T getX()" or "boolean
isX()", where T is not void and X is not the empty
@@ -678,7 +678,7 @@
c.getName(),
nameArray, // field names
nameArray, // field descriptions
- types.toArray(new OpenType[0]));
+ types.toArray(new OpenType>[0]));
}
}
@@ -722,7 +722,7 @@
// so that no other classes are sent over the wire
CompositeData cd = (CompositeData) data;
CompositeType ct = cd.getCompositeType();
- String[] itemNames = (String[]) ct.keySet().toArray(new String[0]);
+ String[] itemNames = ct.keySet().toArray(new String[0]);
Object[] itemValues = cd.getAll(itemNames);
return new CompositeDataSupport(ct, itemNames, itemValues);
}
@@ -779,9 +779,9 @@
}
private static final long serialVersionUID = -3413063475064374490L;
}
- private static final OpenType inProgress;
+ private static final OpenType> inProgress;
static {
- OpenType t;
+ OpenType> t;
try {
t = new InProgress();
} catch (OpenDataException e) {
@@ -799,8 +799,8 @@
static {
try {
for (int i = 0; i < simpleTypes.length; i++) {
- final OpenType t = simpleTypes[i];
- Class c;
+ final OpenType> t = simpleTypes[i];
+ Class> c;
try {
c = Class.forName(t.getClassName(), false,
String.class.getClassLoader());
@@ -816,7 +816,7 @@
if (c.getName().startsWith("java.lang.")) {
try {
final Field typeField = c.getField("TYPE");
- final Class primitiveType = (Class) typeField.get(null);
+ final Class> primitiveType = (Class>) typeField.get(null);
MappedMXBeanType.newBasicType(primitiveType, t);
} catch (NoSuchFieldException e) {
// OK: must not be a primitive wrapper
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/MonitorInfoCompositeData.java
--- a/src/share/classes/sun/management/MonitorInfoCompositeData.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/MonitorInfoCompositeData.java Tue Aug 22 02:03:52 2017 +0100
@@ -92,7 +92,7 @@
monitorInfoCompositeType = (CompositeType)
MappedMXBeanType.toOpenType(MonitorInfo.class);
Set s = monitorInfoCompositeType.keySet();
- monitorInfoItemNames = (String[]) s.toArray(new String[0]);
+ monitorInfoItemNames = s.toArray(new String[0]);
} catch (OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/NotificationEmitterSupport.java
--- a/src/share/classes/sun/management/NotificationEmitterSupport.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/NotificationEmitterSupport.java Tue Aug 22 02:03:52 2017 +0100
@@ -71,7 +71,7 @@
efficient solution would be to clone the listener list
every time a notification is sent. */
synchronized (listenerLock) {
- List newList = new ArrayList(listenerList.size() + 1);
+ List newList = new ArrayList<>(listenerList.size() + 1);
newList.addAll(listenerList);
newList.add(new ListenerInfo(listener, filter, handback));
listenerList = newList;
@@ -82,12 +82,12 @@
throws ListenerNotFoundException {
synchronized (listenerLock) {
- List newList = new ArrayList(listenerList);
+ List newList = new ArrayList<>(listenerList);
/* We scan the list of listeners in reverse order because
in forward order we would have to repeat the loop with
the same index after a remove. */
for (int i=newList.size()-1; i>=0; i--) {
- ListenerInfo li = (ListenerInfo)newList.get(i);
+ ListenerInfo li = newList.get(i);
if (li.listener == listener)
newList.remove(i);
@@ -106,10 +106,10 @@
boolean found = false;
synchronized (listenerLock) {
- List newList = new ArrayList(listenerList);
+ List newList = new ArrayList<>(listenerList);
final int size = newList.size();
for (int i = 0; i < size; i++) {
- ListenerInfo li = (ListenerInfo) newList.get(i);
+ ListenerInfo li = newList.get(i);
if (li.listener == listener) {
found = true;
@@ -148,7 +148,7 @@
final int size = currentList.size();
for (int i = 0; i < size; i++) {
- ListenerInfo li = (ListenerInfo) currentList.get(i);
+ ListenerInfo li = currentList.get(i);
if (li.filter == null
|| li.filter.isNotificationEnabled(notification)) {
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/RuntimeImpl.java
--- a/src/share/classes/sun/management/RuntimeImpl.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/RuntimeImpl.java Tue Aug 22 02:03:52 2017 +0100
@@ -128,7 +128,7 @@
public Map getSystemProperties() {
Properties sysProps = System.getProperties();
- Map map = new HashMap();
+ Map map = new HashMap<>();
// Properties.entrySet() does not include the entries in
// the default properties. So use Properties.stringPropertyNames()
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/ThreadInfoCompositeData.java
--- a/src/share/classes/sun/management/ThreadInfoCompositeData.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/ThreadInfoCompositeData.java Tue Aug 22 02:03:52 2017 +0100
@@ -190,7 +190,7 @@
threadInfoV6Attributes.length;
String[] v5ItemNames = new String[numV5Attributes];
String[] v5ItemDescs = new String[numV5Attributes];
- OpenType[] v5ItemTypes = new OpenType[numV5Attributes];
+ OpenType>[] v5ItemTypes = new OpenType>[numV5Attributes];
int i = 0;
for (String n : itemNames) {
if (isV5Attribute(n)) {
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/counter/perf/PerfInstrumentation.java
--- a/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java Tue Aug 22 02:03:52 2017 +0100
@@ -73,7 +73,7 @@
buffer.position(prologue.getEntryOffset());
nextEntry = buffer.position();
// rebuild all the counters
- map = new TreeMap();
+ map = new TreeMap<>();
}
boolean hasNext() {
@@ -154,7 +154,7 @@
map.put(c.getName(), c);
}
}
- return new ArrayList(map.values());
+ return new ArrayList<>(map.values());
}
public synchronized List findByPattern(String patternString) {
@@ -167,19 +167,18 @@
Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher("");
- List matches = new ArrayList();
+ List matches = new ArrayList<>();
+
- Iterator iter = map.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry me = (Map.Entry) iter.next();
- String name = (String) me.getKey();
+ for (Map.Entry me: map.entrySet()) {
+ String name = me.getKey();
// apply pattern to counter name
matcher.reset(name);
// if the pattern matches, then add Counter to list
if (matcher.lookingAt()) {
- matches.add((Counter)me.getValue());
+ matches.add(me.getValue());
}
}
return matches;
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
--- a/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Tue Aug 22 02:03:52 2017 +0100
@@ -237,17 +237,16 @@
"the access file [" + accessFile + "] as the " +
"authenticated Subject is null");
}
- final Set principals = subject.getPrincipals();
- for (Iterator i = principals.iterator(); i.hasNext();) {
- final Principal p = (Principal) i.next();
- if (properties.containsKey(p.getName())) {
+ final Set principals = subject.getPrincipals();
+ for (Principal p1: principals) {
+ if (properties.containsKey(p1.getName())) {
return;
}
}
- final Set principalsStr = new HashSet();
- for (Iterator i = principals.iterator(); i.hasNext();) {
- final Principal p = (Principal) i.next();
- principalsStr.add(p.getName());
+
+ final Set principalsStr = new HashSet<>();
+ for (Principal p2: principals) {
+ principalsStr.add(p2.getName());
}
throw new SecurityException(
"Access denied! No entries found in the access file [" +
@@ -261,9 +260,9 @@
if (fname == null) {
return p;
}
- FileInputStream fin = new FileInputStream(fname);
- p.load(fin);
- fin.close();
+ try (FileInputStream fin = new FileInputStream(fname)) {
+ p.load(fin);
+ }
return p;
}
private final Map environment;
@@ -484,7 +483,7 @@
try {
// Export remote connector address and associated configuration
// properties to the instrumentation buffer.
- Map properties = new HashMap();
+ Map properties = new HashMap<>();
properties.put("remoteAddress", url.toString());
properties.put("authenticate", useAuthenticationStr);
properties.put("ssl", useSslStr);
@@ -510,7 +509,7 @@
System.setProperty("java.rmi.server.randomIDs", "true");
// This RMI server should not keep the VM alive
- Map env = new HashMap();
+ Map env = new HashMap<>();
env.put(RMIExporter.EXPORTER_ATTRIBUTE, new PermanentExporter());
env.put(EnvHelp.CREDENTIAL_TYPES, new String[]{
String[].class.getName(), String.class.getName()
@@ -657,12 +656,9 @@
try {
// Load the SSL keystore properties from the config file
Properties p = new Properties();
- InputStream in = new FileInputStream(sslConfigFileName);
- try {
+ try (InputStream in = new FileInputStream(sslConfigFileName)) {
BufferedInputStream bin = new BufferedInputStream(in);
p.load(bin);
- } finally {
- in.close();
}
String keyStore =
p.getProperty("javax.net.ssl.keyStore");
@@ -686,11 +682,8 @@
KeyStore ks = null;
if (keyStore != null) {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
- FileInputStream ksfis = new FileInputStream(keyStore);
- try {
+ try (FileInputStream ksfis = new FileInputStream(keyStore)) {
ks.load(ksfis, keyStorePasswd);
- } finally {
- ksfis.close();
}
}
KeyManagerFactory kmf = KeyManagerFactory.getInstance(
@@ -700,16 +693,13 @@
KeyStore ts = null;
if (trustStore != null) {
ts = KeyStore.getInstance(KeyStore.getDefaultType());
- FileInputStream tsfis = new FileInputStream(trustStore);
- try {
+ try (FileInputStream tsfis = new FileInputStream(trustStore)) {
ts.load(tsfis, trustStorePasswd);
- } finally {
- tsfis.close();
}
}
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
TrustManagerFactory.getDefaultAlgorithm());
- tmf.init((KeyStore) ts);
+ tmf.init(ts);
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
@@ -749,7 +739,7 @@
JMXServiceURL url = new JMXServiceURL("rmi", bindAddress, rmiPort);
- Map env = new HashMap();
+ Map env = new HashMap<>();
PermanentExporter exporter = new PermanentExporter();
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/jmxremote/SingleEntryRegistry.java
--- a/src/share/classes/sun/management/jmxremote/SingleEntryRegistry.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/jmxremote/SingleEntryRegistry.java Tue Aug 22 02:03:52 2017 +0100
@@ -32,6 +32,7 @@
package sun.management.jmxremote;
+import sun.misc.ObjectInputFilter;
import java.rmi.AccessException;
import java.rmi.NotBoundException;
import java.rmi.Remote;
@@ -56,7 +57,12 @@
String name,
Remote object)
throws RemoteException {
- super(port, csf, ssf);
+ super(port, csf, ssf, new ObjectInputFilter() {
+ @Override
+ public Status checkInput(ObjectInputFilter.FilterInfo info) {
+ return SingleEntryRegistry.singleRegistryFilter(info);
+ }
+ });
this.name = name;
this.object = object;
}
@@ -84,6 +90,23 @@
throw new AccessException("Cannot modify this registry");
}
+ /**
+ * ObjectInputFilter to check parameters to SingleEntryRegistry.
+ * Since it is a read-only Registry, no classes are accepted.
+ * String arguments are accepted without passing them to the serialFilter.
+ *
+ * @param info a reference to the serialization filter information
+ * @return Status.REJECTED if parameters are out of range
+ */
+ private static ObjectInputFilter.Status singleRegistryFilter(ObjectInputFilter.FilterInfo info) {
+ return (info.serialClass() != null ||
+ info.depth() > 2 ||
+ info.references() > 4 ||
+ info.arrayLength() >= 0)
+ ? ObjectInputFilter.Status.REJECTED
+ : ObjectInputFilter.Status.ALLOWED;
+ }
+
private final String name;
private final Remote object;
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/resources/agent_sv.properties
--- a/src/share/classes/sun/management/resources/agent_sv.properties Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/resources/agent_sv.properties Tue Aug 22 02:03:52 2017 +0100
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2017, 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
@@ -70,10 +70,10 @@
agent.err.invalid.snmp.port = Ogiltigt com.sun.management.snmp.port-nummer
agent.err.invalid.snmp.trap.port = Ogiltigt com.sun.management.snmp.trap-nummer
agent.err.unknown.snmp.interface = Ok\u00E4nt SNMP-gr\u00E4nssnitt
-agent.err.acl.file.notset = Ingen SNMP ACL-fil har angetts, men com.sun.management.snmp.acl=true
-agent.err.acl.file.notfound = SNMP ACL-filen hittades inte
-agent.err.acl.file.not.readable = SNMP ACL-filen \u00E4r inte l\u00E4sbar
-agent.err.acl.file.read.failed = Kunde inte l\u00E4sa filen SNMP ACL
+agent.err.acl.file.notset = Ingen SNMP \u00E5tkomstkontrollista-fil har angetts, men com.sun.management.snmp.acl=true
+agent.err.acl.file.notfound = SNMP \u00E5tkomstkontrollista-filen hittades inte
+agent.err.acl.file.not.readable = SNMP \u00E5tkomstkontrollista-filen \u00E4r inte l\u00E4sbar
+agent.err.acl.file.read.failed = Kunde inte l\u00E4sa filen SNMP \u00E5tkomstkontrollista
agent.err.acl.file.access.notrestricted = L\u00E4sbeh\u00F6righeten f\u00F6r filen m\u00E5ste begr\u00E4nsas
agent.err.snmp.adaptor.start.failed = Kunde inte starta SNMP-adaptern med adressen
@@ -85,7 +85,7 @@
jmxremote.ConnectorBootstrap.password.readonly = L\u00E4sbeh\u00F6righeten f\u00F6r l\u00F6senordsfilen m\u00E5ste begr\u00E4nsas: {0}
jmxremote.ConnectorBootstrap.file.readonly = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas {0}
-jmxremote.AdaptorBootstrap.getTargetList.processing = ACL bearbetas
+jmxremote.AdaptorBootstrap.getTargetList.processing = \u00E5tkomstkontrollista bearbetas
jmxremote.AdaptorBootstrap.getTargetList.adding = M\u00E5l l\u00E4ggs till: {0}
jmxremote.AdaptorBootstrap.getTargetList.starting = Adapterservern startas:
jmxremote.AdaptorBootstrap.getTargetList.initialize1 = Adaptern redo.
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/snmp/AdaptorBootstrap.java
--- a/src/share/classes/sun/management/snmp/AdaptorBootstrap.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/snmp/AdaptorBootstrap.java Tue Aug 22 02:03:52 2017 +0100
@@ -118,21 +118,22 @@
/**
* Retrieve the Trap Target List from the ACL file.
**/
+ @SuppressWarnings("unchecked")
private static List getTargetList(InetAddressAcl acl,
int defaultTrapPort) {
final ArrayList result =
- new ArrayList();
+ new ArrayList<>();
if (acl != null) {
if (log.isDebugOn())
log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing"));
- final Enumeration td=acl.getTrapDestinations();
+ final Enumeration td = acl.getTrapDestinations();
for (; td.hasMoreElements() ;) {
final InetAddress targetAddr = (InetAddress)td.nextElement();
final Enumeration tc =
acl.getTrapCommunities(targetAddr);
for (;tc.hasMoreElements() ;) {
- final String community = (String) tc.nextElement();
+ final String community = (String)tc.nextElement();
final NotificationTarget target =
new NotificationTargetImpl(targetAddr,
defaultTrapPort,
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/snmp/jvminstr/JVM_MANAGEMENT_MIB_IMPL.java
--- a/src/share/classes/sun/management/snmp/jvminstr/JVM_MANAGEMENT_MIB_IMPL.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/snmp/jvminstr/JVM_MANAGEMENT_MIB_IMPL.java Tue Aug 22 02:03:52 2017 +0100
@@ -90,14 +90,14 @@
SnmpOidTable table = null;
if(tableRef == null) {
table = new JVM_MANAGEMENT_MIBOidTable();
- tableRef = new WeakReference(table);
+ tableRef = new WeakReference<>(table);
return table;
}
table = tableRef.get();
if(table == null) {
table = new JVM_MANAGEMENT_MIBOidTable();
- tableRef = new WeakReference(table);
+ tableRef = new WeakReference<>(table);
}
return table;
@@ -198,7 +198,7 @@
* List of notification targets.
*/
private ArrayList notificationTargets =
- new ArrayList();
+ new ArrayList<>();
private final NotificationEmitter emitter;
private final NotificationHandler handler;
@@ -215,7 +215,7 @@
}
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
- final Iterator iterator = notificationTargets.iterator();
+ final Iterator iterator = notificationTargets.iterator();
final SnmpAdaptorServer adaptor =
(SnmpAdaptorServer) getSnmpAdaptor();
@@ -232,7 +232,7 @@
while(iterator.hasNext()) {
NotificationTarget target = null;
try {
- target = (NotificationTarget) iterator.next();
+ target = iterator.next();
SnmpPeer peer =
new SnmpPeer(target.getAddress(), target.getPort());
SnmpParameters p = new SnmpParameters();
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/snmp/jvminstr/JvmMemGCTableMetaImpl.java
--- a/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCTableMetaImpl.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCTableMetaImpl.java Tue Aug 22 02:03:52 2017 +0100
@@ -58,6 +58,8 @@
*/
public class JvmMemGCTableMetaImpl extends JvmMemGCTableMeta {
+ static final long serialVersionUID = 8250461197108867607L;
+
/**
* This class acts as a filter over the SnmpTableHandler
* used for the JvmMemoryManagerTable. It filters out
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerTableMetaImpl.java
--- a/src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerTableMetaImpl.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerTableMetaImpl.java Tue Aug 22 02:03:52 2017 +0100
@@ -61,12 +61,17 @@
*/
public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
+ static final long serialVersionUID = 36176771566817592L;
+
/**
* A concrete implementation of {@link SnmpNamedListTableCache}, for the
* jvmMemManagerTable.
**/
private static class JvmMemManagerTableCache
extends SnmpNamedListTableCache {
+
+ static final long serialVersionUID = 6564294074653009240L;
+
/**
* Create a weak cache for the jvmMemManagerTable.
* @param validity validity of the cached data, in ms.
@@ -87,7 +92,7 @@
* MemoryManagerMXBean
in the list.
* @return ((MemoryManagerMXBean)item).getName()
**/
- protected String getKey(Object context, List rawDatas,
+ protected String getKey(Object context, List> rawDatas,
int rank, Object item) {
if (item == null) return null;
final String name = ((MemoryManagerMXBean)item).getName();
@@ -99,7 +104,7 @@
* Call getTableHandler(JvmContextFactory.getUserData())
.
**/
public SnmpTableHandler getTableHandler() {
- final Map userData = JvmContextFactory.getUserData();
+ final Map userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
@@ -114,7 +119,7 @@
* Call ManagementFactory.getMemoryManagerMXBeans() to
* load the raw data of this table.
**/
- protected List loadRawDatas(Map userData) {
+ protected List loadRawDatas(Map userData) {
return ManagementFactory.getMemoryManagerMXBeans();
}
diff -r 350a10c3a425 -r 85bcd2abf0a2 src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelTableMetaImpl.java
--- a/src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelTableMetaImpl.java Wed Aug 16 16:15:10 2017 +0100
+++ b/src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelTableMetaImpl.java Tue Aug 22 02:03:52 2017 +0100
@@ -64,13 +64,17 @@
public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
implements Serializable {
+ static final long serialVersionUID = 1896509775012355443L;
+
/**
* A concrete implementation of {@link SnmpTableCache}, for the
* jvmMemMgrPoolRelTable.
**/
+
private static class JvmMemMgrPoolRelTableCache
extends SnmpTableCache {
+ static final long serialVersionUID = 6059937161990659184L;
final private JvmMemMgrPoolRelTableMetaImpl meta;
/**
@@ -87,7 +91,7 @@
* Call getTableDatas(JvmContextFactory.getUserData())
.
**/
public SnmpTableHandler getTableHandler() {
- final Map userData = JvmContextFactory.getUserData();
+ final Map userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
@@ -101,7 +105,7 @@
return buildPoolIndexMap((SnmpCachedData)handler);
// not optimizable... too bad.
- final Map