This commit is contained in:
Lana Steuck 2012-01-18 20:24:41 -08:00
commit 9ccc60ae83
156 changed files with 4781 additions and 891 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -25,15 +25,24 @@
BUILDDIR = ../.. BUILDDIR = ../..
PRODUCT = oracle PRODUCT = oracle
#SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
#SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
#SUBDIRS_MAKEFLAGS += JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation,-path
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
# # build com/oracle/security/ucrypto on Solaris platform for non-OpenJDK builds
# Files to compile UCRYPTO =
# ifndef OPENJDK
AUTO_FILES_JAVA_DIRS = com/oracle ifeq ($(PLATFORM), solaris)
UCRYPTO = security/ucrypto
endif
endif
#
# Rules SUBDIRS = net nio util $(UCRYPTO)
#
include $(BUILDDIR)/common/Classes.gmk include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber::
$(SUBDIRS-loop)

View File

@ -0,0 +1,40 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
BUILDDIR = ../../..
PACKAGE = com.oracle.net
PRODUCT = oracle
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = com/oracle/net
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk

View File

@ -0,0 +1,40 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
BUILDDIR = ../../..
PACKAGE = com.oracle.nio
PRODUCT = oracle
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = com/oracle/nio
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk

View File

@ -0,0 +1,30 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
ifndef OPENJDK
FILES_c = \
nativeFunc.c \
nativeCrypto.c
endif

View File

@ -0,0 +1,270 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile for building ucrypto.jar and its native libraries.
#
# This file was modified from make/sun/security/pkcs11/Makefile.
#
#
# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Oracle
# JDK builds respectively.)
#
# This Makefile does the "real" build of the Ucrypto provider files.
# Since the sources are unavailable for OpenJDK, this Makefile is only
# useful for JDK.
#
#
# Main Targets (JDK on Solaris):
#
# all The usual, ucrypto.jar plus the native libraries.
# builds and installs the prebuilt/signed jar.
#
# clobber/clean Cleans up the temp directory, ucrypto.jar, the
# native libraries, and the config file from the
# build area
#
# jar Builds, signs and installs ucrypto.jar
# (Can only be done on machines with access to
# the signing keystore)
#
# Other lesser-used Targets (JDK on Solaris):
#
# build-jar Builds ucrypto.jar (no sign/install)
#
# sign Builds/signs ucrypto.jar (no install)
#
# release Builds all targets in preparation
# for workspace integration.
# (Can only be done on machines with access to
# the signing keystore)
#
# install-prebuilt Installs the pre-built jar files
#
# NOTE: None of the above target will update the prebuilt provider binary
# under the closed workspace. To update it, you must explicitly copy the
# binary from either the tmp/signed or lib/ext directory.
#
# This makefile was written to support parallel target execution.
#
BUILDDIR = ../../../..
include $(BUILDDIR)/common/Defs.gmk
ifndef OPENJDK
ifneq ($(PLATFORM), solaris)
all:
else
PACKAGE = com.oracle.security.ucrypto
LIBRARY = j2ucrypto
PRODUCT = oracle
#
# The following is for when we need to do postprocessing
# (signing/obfuscation) against a read-only build. If the OUTPUTDIR
# isn't writable, the build currently crashes out.
#
ifdef ALT_JCE_BUILD_DIR
# =====================================================
# Where to place the output, in case we're building from a read-only
# build area. (e.g. a release engineering build.)
JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR}
IGNORE_WRITABLE_OUTPUTDIR_TEST=true
else
JCE_BUILD_DIR=${TEMPDIR}
endif
JAVAC_MAX_WARNINGS=false
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
JAVAC_WARNINGS_FATAL=true
#
# C and Java Files
#
include FILES_c.gmk
#
# Subdirectories of these are automatically included.
#
AUTO_FILES_JAVA_DIRS = com/oracle/security/ucrypto
#
# Java files that define native methods
#
FILES_export = \
com/oracle/security/ucrypto/UcryptoProvider.java \
com/oracle/security/ucrypto/NativeCipher.java \
com/oracle/security/ucrypto/NativeDigest.java \
com/oracle/security/ucrypto/NativeKey.java \
com/oracle/security/ucrypto/NativeRSASignature.java \
com/oracle/security/ucrypto/NativeRSACipher.java
#
# Find native code
#
vpath %.c \
$(CLOSED_PLATFORM_SRC)/native/com/oracle/security/ucrypto
#
# Find include files
#
OTHER_INCLUDES += \
-I$(CLOSED_PLATFORM_SRC)/native/com/oracle/security/ucrypto
#
# Rules
#
CLASSDESTDIR = $(TEMPDIR)/classes
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk
#
# Libraries to link
#
OTHER_LDLIBS = -ldl
# Default config file
UCRYPTO_CFG_SRC = $(CLOSED_SRC)/share/lib/security/ucrypto-solaris.cfg
UCRYPTO_CFG_BUILD = $(LIBDIR)/security/ucrypto-solaris.cfg
#
# We use a variety of subdirectories in the $(TEMPDIR) depending on what
# part of the build we're doing. Build is initially done in the unsigned
# area and when files are signed, they will be placed in the appropriate area.
#
UNSIGNED_DIR = $(TEMPDIR)/unsigned
#
# Rules
#
all: ucrypto-cfg build-jar install-prebuilt
$(build-warning)
ucrypto-cfg: $(UCRYPTO_CFG_BUILD)
$(UCRYPTO_CFG_BUILD): $(UCRYPTO_CFG_SRC)
$(install-file)
include $(BUILDDIR)/javax/crypto/Defs-jce.gmk
# =====================================================
# Build the unsigned ucrypto.jar file.
#
JAR_DESTFILE = $(EXTDIR)/ucrypto.jar
#
# The ucrypto.jar needs to be in the extension class directory,
# therefore none of its classes can appear in $(CLASSBINDIR).
# Currently no one is using any of the internals, so these files
# should not have been built.
#
#
# Since the -C option to jar is used below, each directory entry must be
# preceded with the appropriate directory to "cd" into.
#
JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
build-jar: $(UNSIGNED_DIR)/ucrypto.jar
#
# Build ucrypto.jar.
#
$(UNSIGNED_DIR)/ucrypto.jar: build
$(prep-target)
$(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \
$(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup)
#
# Sign ucrypto.jar
#
SIGNED_DIR = $(JCE_BUILD_DIR)/signed
sign: $(SIGNED_DIR)/ucrypto.jar
ifndef ALT_JCE_BUILD_DIR
$(SIGNED_DIR)/ucrypto.jar: $(UNSIGNED_DIR)/ucrypto.jar
else
#
# We have to remove the build dependency, otherwise, we'll try to rebuild it
# which we can't do on a read-only filesystem.
#
$(SIGNED_DIR)/ucrypto.jar:
@if [ ! -r $(UNSIGNED_DIR)/ucrypto.jar ] ; then \
$(ECHO) "Couldn't find $(UNSIGNED_DIR)/ucrypto.jar"; \
exit 1; \
fi
endif
$(call sign-file, $(UNSIGNED_DIR)/ucrypto.jar)
# =====================================================
# Create the Release Engineering files. Signed builds, etc.
#
release: $(SIGNED_DIR)/ucrypto.jar
$(RM) $(JCE_BUILD_DIR)/release/ucrypto.jar
$(MKDIR) -p $(JCE_BUILD_DIR)/release
$(CP) $(SIGNED_DIR)/ucrypto.jar $(JCE_BUILD_DIR)/release
$(release-warning)
# =====================================================
# Install routines.
#
#
# Install ucrypto.jar, depending on which type is requested.
#
jar: $(JAR_DESTFILE)
$(release-warning)
$(JAR_DESTFILE): $(SIGNED_DIR)/ucrypto.jar
$(install-file)
install-prebuilt:
@$(ECHO) "\n>>>Installing prebuilt OracleUcrypto provider..."
$(RM) $(JAR_DESTFILE)
$(CP) $(PREBUILT_DIR)/ucrypto/ucrypto.jar $(JAR_DESTFILE)
# =====================================================
# Support routines.
#
clobber clean::
$(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR)
$(RM) -r $(UCRYPTO_CFG_BUILD)
.PHONY: build-jar jar sign release install-prebuilt
endif #ifneq ($(PLATFORM), solaris)
endif #ifndef OPENJDK

View File

@ -0,0 +1,69 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Define public interface.
SUNWprivate_1.1 {
global:
JNI_OnLoad;
Java_com_oracle_security_ucrypto_UcryptoProvider_loadLibraries;
Java_com_oracle_security_ucrypto_UcryptoProvider_getMechList;
Java_com_oracle_security_ucrypto_NativeDigest_nativeInit;
Java_com_oracle_security_ucrypto_NativeDigest_nativeUpdate;
Java_com_oracle_security_ucrypto_NativeDigest_nativeDigest;
Java_com_oracle_security_ucrypto_NativeDigest_nativeClone;
Java_com_oracle_security_ucrypto_NativeDigest_nativeFree;
Java_com_oracle_security_ucrypto_NativeCipher_nativeInit;
Java_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
Java_com_oracle_security_ucrypto_NativeKey_nativeFree;
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII;
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI;
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal;
Java_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic;
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeInit;
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeUpdate;
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeDigest;
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeClone;
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeFree;
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeInit;
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree;
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII;
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI;
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal;
JavaCritical_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic;
local:
*;
};

View File

@ -0,0 +1,40 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
BUILDDIR = ../../..
PACKAGE = com.oracle.util
PRODUCT = oracle
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = com/oracle/util
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -47,8 +47,8 @@ SUNWprivate_1.1 {
Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseSession; Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseSession;
# Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseAllSessions; # Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseAllSessions;
Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetSessionInfo; Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetSessionInfo;
# Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetOperationState; Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetOperationState;
# Java_sun_security_pkcs11_wrapper_PKCS11_C_1SetOperationState; Java_sun_security_pkcs11_wrapper_PKCS11_C_1SetOperationState;
Java_sun_security_pkcs11_wrapper_PKCS11_C_1Login; Java_sun_security_pkcs11_wrapper_PKCS11_C_1Login;
Java_sun_security_pkcs11_wrapper_PKCS11_C_1Logout; Java_sun_security_pkcs11_wrapper_PKCS11_C_1Logout;
Java_sun_security_pkcs11_wrapper_PKCS11_C_1CreateObject; Java_sun_security_pkcs11_wrapper_PKCS11_C_1CreateObject;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1225,14 +1225,7 @@ LoadMainClass(JNIEnv *env, int mode, char *name)
"checkAndLoadMain", "checkAndLoadMain",
"(ZILjava/lang/String;)Ljava/lang/Class;")); "(ZILjava/lang/String;)Ljava/lang/Class;"));
switch (mode) { str = NewPlatformString(env, name);
case LM_CLASS:
str = NewPlatformString(env, name);
break;
default:
str = (*env)->NewStringUTF(env, name);
break;
}
result = (*env)->CallStaticObjectMethod(env, cls, mid, USE_STDERR, mode, str); result = (*env)->CallStaticObjectMethod(env, cls, mid, USE_STDERR, mode, str);
if (JLI_IsTraceLauncher()) { if (JLI_IsTraceLauncher()) {

View File

@ -818,8 +818,9 @@ public final class Math {
return (a >= b) ? a : b; return (a >= b) ? a : b;
} }
private static long negativeZeroFloatBits = Float.floatToIntBits(-0.0f); // Use raw bit-wise conversions on guaranteed non-NaN arguments.
private static long negativeZeroDoubleBits = Double.doubleToLongBits(-0.0d); private static long negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f);
private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);
/** /**
* Returns the greater of two {@code float} values. That is, * Returns the greater of two {@code float} values. That is,
@ -836,9 +837,12 @@ public final class Math {
* @return the larger of {@code a} and {@code b}. * @return the larger of {@code a} and {@code b}.
*/ */
public static float max(float a, float b) { public static float max(float a, float b) {
if (a != a) return a; // a is NaN if (a != a)
if ((a == 0.0f) && (b == 0.0f) return a; // a is NaN
&& (Float.floatToIntBits(a) == negativeZeroFloatBits)) { if ((a == 0.0f) &&
(b == 0.0f) &&
(Float.floatToRawIntBits(a) == negativeZeroFloatBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b; return b;
} }
return (a >= b) ? a : b; return (a >= b) ? a : b;
@ -859,9 +863,12 @@ public final class Math {
* @return the larger of {@code a} and {@code b}. * @return the larger of {@code a} and {@code b}.
*/ */
public static double max(double a, double b) { public static double max(double a, double b) {
if (a != a) return a; // a is NaN if (a != a)
if ((a == 0.0d) && (b == 0.0d) return a; // a is NaN
&& (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) { if ((a == 0.0d) &&
(b == 0.0d) &&
(Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b; return b;
} }
return (a >= b) ? a : b; return (a >= b) ? a : b;
@ -910,9 +917,12 @@ public final class Math {
* @return the smaller of {@code a} and {@code b}. * @return the smaller of {@code a} and {@code b}.
*/ */
public static float min(float a, float b) { public static float min(float a, float b) {
if (a != a) return a; // a is NaN if (a != a)
if ((a == 0.0f) && (b == 0.0f) return a; // a is NaN
&& (Float.floatToIntBits(b) == negativeZeroFloatBits)) { if ((a == 0.0f) &&
(b == 0.0f) &&
(Float.floatToRawIntBits(b) == negativeZeroFloatBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b; return b;
} }
return (a <= b) ? a : b; return (a <= b) ? a : b;
@ -933,9 +943,12 @@ public final class Math {
* @return the smaller of {@code a} and {@code b}. * @return the smaller of {@code a} and {@code b}.
*/ */
public static double min(double a, double b) { public static double min(double a, double b) {
if (a != a) return a; // a is NaN if (a != a)
if ((a == 0.0d) && (b == 0.0d) return a; // a is NaN
&& (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) { if ((a == 0.0d) &&
(b == 0.0d) &&
(Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b; return b;
} }
return (a <= b) ? a : b; return (a <= b) ? a : b;
@ -1900,7 +1913,7 @@ public final class Math {
/** /**
* Returns a floating-point power of two in the normal range. * Returns a floating-point power of two in the normal range.
*/ */
public static float powerOfTwoF(int n) { static float powerOfTwoF(int n) {
assert(n >= FloatConsts.MIN_EXPONENT && n <= FloatConsts.MAX_EXPONENT); assert(n >= FloatConsts.MIN_EXPONENT && n <= FloatConsts.MAX_EXPONENT);
return Float.intBitsToFloat(((n + FloatConsts.EXP_BIAS) << return Float.intBitsToFloat(((n + FloatConsts.EXP_BIAS) <<
(FloatConsts.SIGNIFICAND_WIDTH-1)) (FloatConsts.SIGNIFICAND_WIDTH-1))

View File

@ -58,8 +58,7 @@ public class Object {
* *
* @return The {@code Class} object that represents the runtime * @return The {@code Class} object that represents the runtime
* class of this object. * class of this object.
* @see Class Literals, section 15.8.2 of * @jls 15.8.2 Class Literals
* <cite>The Java&trade; Language Specification</cite>.
*/ */
public final native Class<?> getClass(); public final native Class<?> getClass();
@ -92,7 +91,7 @@ public class Object {
* objects. (This is typically implemented by converting the internal * objects. (This is typically implemented by converting the internal
* address of the object into an integer, but this implementation * address of the object into an integer, but this implementation
* technique is not required by the * technique is not required by the
* Java<font size="-2"><sup>TM</sup></font> programming language.) * Java&trade; programming language.)
* *
* @return a hash code value for this object. * @return a hash code value for this object.
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
@ -203,7 +202,7 @@ public class Object {
* exception at run time. * exception at run time.
* *
* @return a clone of this instance. * @return a clone of this instance.
* @exception CloneNotSupportedException if the object's class does not * @throws CloneNotSupportedException if the object's class does not
* support the {@code Cloneable} interface. Subclasses * support the {@code Cloneable} interface. Subclasses
* that override the {@code clone} method can also * that override the {@code clone} method can also
* throw this exception to indicate that an instance cannot * throw this exception to indicate that an instance cannot
@ -264,7 +263,7 @@ public class Object {
* <p> * <p>
* Only one thread at a time can own an object's monitor. * Only one thread at a time can own an object's monitor.
* *
* @exception IllegalMonitorStateException if the current thread is not * @throws IllegalMonitorStateException if the current thread is not
* the owner of this object's monitor. * the owner of this object's monitor.
* @see java.lang.Object#notifyAll() * @see java.lang.Object#notifyAll()
* @see java.lang.Object#wait() * @see java.lang.Object#wait()
@ -288,7 +287,7 @@ public class Object {
* description of the ways in which a thread can become the owner of * description of the ways in which a thread can become the owner of
* a monitor. * a monitor.
* *
* @exception IllegalMonitorStateException if the current thread is not * @throws IllegalMonitorStateException if the current thread is not
* the owner of this object's monitor. * the owner of this object's monitor.
* @see java.lang.Object#notify() * @see java.lang.Object#notify()
* @see java.lang.Object#wait() * @see java.lang.Object#wait()
@ -368,11 +367,11 @@ public class Object {
* a monitor. * a monitor.
* *
* @param timeout the maximum time to wait in milliseconds. * @param timeout the maximum time to wait in milliseconds.
* @exception IllegalArgumentException if the value of timeout is * @throws IllegalArgumentException if the value of timeout is
* negative. * negative.
* @exception IllegalMonitorStateException if the current thread is not * @throws IllegalMonitorStateException if the current thread is not
* the owner of the object's monitor. * the owner of the object's monitor.
* @exception InterruptedException if any thread interrupted the * @throws InterruptedException if any thread interrupted the
* current thread before or while the current thread * current thread before or while the current thread
* was waiting for a notification. The <i>interrupted * was waiting for a notification. The <i>interrupted
* status</i> of the current thread is cleared when * status</i> of the current thread is cleared when
@ -433,12 +432,12 @@ public class Object {
* @param timeout the maximum time to wait in milliseconds. * @param timeout the maximum time to wait in milliseconds.
* @param nanos additional time, in nanoseconds range * @param nanos additional time, in nanoseconds range
* 0-999999. * 0-999999.
* @exception IllegalArgumentException if the value of timeout is * @throws IllegalArgumentException if the value of timeout is
* negative or the value of nanos is * negative or the value of nanos is
* not in the range 0-999999. * not in the range 0-999999.
* @exception IllegalMonitorStateException if the current thread is not * @throws IllegalMonitorStateException if the current thread is not
* the owner of this object's monitor. * the owner of this object's monitor.
* @exception InterruptedException if any thread interrupted the * @throws InterruptedException if any thread interrupted the
* current thread before or while the current thread * current thread before or while the current thread
* was waiting for a notification. The <i>interrupted * was waiting for a notification. The <i>interrupted
* status</i> of the current thread is cleared when * status</i> of the current thread is cleared when
@ -489,9 +488,9 @@ public class Object {
* description of the ways in which a thread can become the owner of * description of the ways in which a thread can become the owner of
* a monitor. * a monitor.
* *
* @exception IllegalMonitorStateException if the current thread is not * @throws IllegalMonitorStateException if the current thread is not
* the owner of the object's monitor. * the owner of the object's monitor.
* @exception InterruptedException if any thread interrupted the * @throws InterruptedException if any thread interrupted the
* current thread before or while the current thread * current thread before or while the current thread
* was waiting for a notification. The <i>interrupted * was waiting for a notification. The <i>interrupted
* status</i> of the current thread is cleared when * status</i> of the current thread is cleared when
@ -510,7 +509,7 @@ public class Object {
* system resources or to perform other cleanup. * system resources or to perform other cleanup.
* <p> * <p>
* The general contract of {@code finalize} is that it is invoked * The general contract of {@code finalize} is that it is invoked
* if and when the Java<font size="-2"><sup>TM</sup></font> virtual * if and when the Java&trade; virtual
* machine has determined that there is no longer any * machine has determined that there is no longer any
* means by which this object can be accessed by any thread that has * means by which this object can be accessed by any thread that has
* not yet died, except as a result of an action taken by the * not yet died, except as a result of an action taken by the
@ -549,6 +548,9 @@ public class Object {
* ignored. * ignored.
* *
* @throws Throwable the {@code Exception} raised by this method * @throws Throwable the {@code Exception} raised by this method
* @see java.lang.ref.WeakReference
* @see java.lang.ref.PhantomReference
* @jls 12.6 Finalization of Class Instances
*/ */
protected void finalize() throws Throwable { } protected void finalize() throws Throwable { }
} }

View File

@ -161,6 +161,8 @@ public final class StrictMath {
* in radians. * in radians.
*/ */
public static strictfp double toRadians(double angdeg) { public static strictfp double toRadians(double angdeg) {
// Do not delegate to Math.toRadians(angdeg) because
// this method has the strictfp modifier.
return angdeg / 180.0 * PI; return angdeg / 180.0 * PI;
} }
@ -176,6 +178,8 @@ public final class StrictMath {
* in degrees. * in degrees.
*/ */
public static strictfp double toDegrees(double angrad) { public static strictfp double toDegrees(double angrad) {
// Do not delegate to Math.toDegrees(angrad) because
// this method has the strictfp modifier.
return angrad * 180.0 / PI; return angrad * 180.0 / PI;
} }
@ -708,7 +712,7 @@ public final class StrictMath {
* @return the absolute value of the argument. * @return the absolute value of the argument.
*/ */
public static int abs(int a) { public static int abs(int a) {
return (a < 0) ? -a : a; return Math.abs(a);
} }
/** /**
@ -725,7 +729,7 @@ public final class StrictMath {
* @return the absolute value of the argument. * @return the absolute value of the argument.
*/ */
public static long abs(long a) { public static long abs(long a) {
return (a < 0) ? -a : a; return Math.abs(a);
} }
/** /**
@ -744,7 +748,7 @@ public final class StrictMath {
* @return the absolute value of the argument. * @return the absolute value of the argument.
*/ */
public static float abs(float a) { public static float abs(float a) {
return (a <= 0.0F) ? 0.0F - a : a; return Math.abs(a);
} }
/** /**
@ -763,7 +767,7 @@ public final class StrictMath {
* @return the absolute value of the argument. * @return the absolute value of the argument.
*/ */
public static double abs(double a) { public static double abs(double a) {
return (a <= 0.0D) ? 0.0D - a : a; return Math.abs(a);
} }
/** /**
@ -777,7 +781,7 @@ public final class StrictMath {
* @return the larger of {@code a} and {@code b}. * @return the larger of {@code a} and {@code b}.
*/ */
public static int max(int a, int b) { public static int max(int a, int b) {
return (a >= b) ? a : b; return Math.max(a, b);
} }
/** /**
@ -791,13 +795,9 @@ public final class StrictMath {
* @return the larger of {@code a} and {@code b}. * @return the larger of {@code a} and {@code b}.
*/ */
public static long max(long a, long b) { public static long max(long a, long b) {
return (a >= b) ? a : b; return Math.max(a, b);
} }
// Use raw bit-wise conversions on guaranteed non-NaN arguments.
private static long negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f);
private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);
/** /**
* Returns the greater of two {@code float} values. That is, * Returns the greater of two {@code float} values. That is,
* the result is the argument closer to positive infinity. If the * the result is the argument closer to positive infinity. If the
@ -813,15 +813,7 @@ public final class StrictMath {
* @return the larger of {@code a} and {@code b}. * @return the larger of {@code a} and {@code b}.
*/ */
public static float max(float a, float b) { public static float max(float a, float b) {
if (a != a) return Math.max(a, b);
return a; // a is NaN
if ((a == 0.0f) &&
(b == 0.0f) &&
(Float.floatToRawIntBits(a) == negativeZeroFloatBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b;
}
return (a >= b) ? a : b;
} }
/** /**
@ -839,15 +831,7 @@ public final class StrictMath {
* @return the larger of {@code a} and {@code b}. * @return the larger of {@code a} and {@code b}.
*/ */
public static double max(double a, double b) { public static double max(double a, double b) {
if (a != a) return Math.max(a, b);
return a; // a is NaN
if ((a == 0.0d) &&
(b == 0.0d) &&
(Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b;
}
return (a >= b) ? a : b;
} }
/** /**
@ -861,7 +845,7 @@ public final class StrictMath {
* @return the smaller of {@code a} and {@code b}. * @return the smaller of {@code a} and {@code b}.
*/ */
public static int min(int a, int b) { public static int min(int a, int b) {
return (a <= b) ? a : b; return Math.min(a, b);
} }
/** /**
@ -875,7 +859,7 @@ public final class StrictMath {
* @return the smaller of {@code a} and {@code b}. * @return the smaller of {@code a} and {@code b}.
*/ */
public static long min(long a, long b) { public static long min(long a, long b) {
return (a <= b) ? a : b; return Math.min(a, b);
} }
/** /**
@ -893,15 +877,7 @@ public final class StrictMath {
* @return the smaller of {@code a} and {@code b.} * @return the smaller of {@code a} and {@code b.}
*/ */
public static float min(float a, float b) { public static float min(float a, float b) {
if (a != a) return Math.min(a, b);
return a; // a is NaN
if ((a == 0.0f) &&
(b == 0.0f) &&
(Float.floatToRawIntBits(b) == negativeZeroFloatBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b;
}
return (a <= b) ? a : b;
} }
/** /**
@ -919,15 +895,7 @@ public final class StrictMath {
* @return the smaller of {@code a} and {@code b}. * @return the smaller of {@code a} and {@code b}.
*/ */
public static double min(double a, double b) { public static double min(double a, double b) {
if (a != a) return Math.min(a, b);
return a; // a is NaN
if ((a == 0.0d) &&
(b == 0.0d) &&
(Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b;
}
return (a <= b) ? a : b;
} }
/** /**

View File

@ -625,7 +625,7 @@ public class Throwable implements Serializable {
* at Resource2.close(Resource2.java:20) * at Resource2.close(Resource2.java:20)
* at Foo4.main(Foo4.java:5) * at Foo4.main(Foo4.java:5)
* Caused by: java.lang.Exception: Rats, you caught me * Caused by: java.lang.Exception: Rats, you caught me
* at Resource2$CloseFailException.<init>(Resource2.java:45) * at Resource2$CloseFailException.&lt;init&gt;(Resource2.java:45)
* ... 2 more * ... 2 more
* </pre> * </pre>
*/ */

View File

@ -275,7 +275,7 @@ mh.invokeExact(System.out, "Hello, world.");
* generates a single invokevirtual instruction with * generates a single invokevirtual instruction with
* the symbolic type descriptor indicated in the following comment. * the symbolic type descriptor indicated in the following comment.
* In these examples, the helper method {@code assertEquals} is assumed to * In these examples, the helper method {@code assertEquals} is assumed to
* be a method which calls {@link Objects.equals java.util.Objects#equals} * be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals }
* on its arguments, and asserts that the result is true. * on its arguments, and asserts that the result is true.
* *
* <h3>Exceptions</h3> * <h3>Exceptions</h3>

View File

@ -92,7 +92,7 @@ class FileTreeWalker {
(System.getSecurityManager() == null)) (System.getSecurityManager() == null))
{ {
BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get(); BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
if (!followLinks || !cached.isSymbolicLink()) if (cached != null && (!followLinks || !cached.isSymbolicLink()))
attrs = cached; attrs = cached;
} }
IOException exc = null; IOException exc = null;

View File

@ -1431,7 +1431,7 @@ public final class Files {
* <li>It is <i>transitive</i>: for three {@code Paths} * <li>It is <i>transitive</i>: for three {@code Paths}
* {@code f}, {@code g}, and {@code h}, if {@code isSameFile(f,g)} returns * {@code f}, {@code g}, and {@code h}, if {@code isSameFile(f,g)} returns
* {@code true} and {@code isSameFile(g,h)} returns {@code true}, then * {@code true} and {@code isSameFile(g,h)} returns {@code true}, then
* {@code isSameFile(g,h)} will return return {@code true}. * {@code isSameFile(f,h)} will return return {@code true}.
* </ul> * </ul>
* *
* @param path * @param path

View File

@ -72,7 +72,7 @@ import java.util.Iterator;
* directory and is UTF-8 encoded. * directory and is UTF-8 encoded.
* <pre> * <pre>
* Path path = FileSystems.getDefault().getPath("logs", "access.log"); * Path path = FileSystems.getDefault().getPath("logs", "access.log");
* BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8); * BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
* </pre> * </pre>
* *
* <a name="interop"><h4>Interoperability</h4></a> * <a name="interop"><h4>Interoperability</h4></a>

View File

@ -216,11 +216,8 @@ public class Agent {
adaptorClass.getMethod("initialize", adaptorClass.getMethod("initialize",
String.class, Properties.class); String.class, Properties.class);
initializeMethod.invoke(null,snmpPort,props); initializeMethod.invoke(null,snmpPort,props);
} catch (ClassNotFoundException x) { } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException x) {
// The SNMP packages are not present: throws an exception. // snmp runtime doesn't exist - initialization fails
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
} catch (NoSuchMethodException x) {
// should not happen...
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x); throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
} catch (InvocationTargetException x) { } catch (InvocationTargetException x) {
final Throwable cause = x.getCause(); final Throwable cause = x.getCause();
@ -230,9 +227,6 @@ public class Agent {
throw (Error) cause; throw (Error) cause;
// should not happen... // should not happen...
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,cause); throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,cause);
} catch (IllegalAccessException x) {
// should not happen...
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
} }
} }
@ -273,8 +267,8 @@ public class Agent {
} catch (IOException e) { } catch (IOException e) {
error(CONFIG_FILE_CLOSE_FAILED, fname); error(CONFIG_FILE_CLOSE_FAILED, fname);
} }
} }
} }
} }
public static void startAgent() throws Exception { public static void startAgent() throws Exception {
@ -309,7 +303,7 @@ public class Agent {
// invoke the premain(String args) method // invoke the premain(String args) method
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname); Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
Method premain = clz.getMethod("premain", Method premain = clz.getMethod("premain",
new Class[] { String.class }); new Class<?>[] { String.class });
premain.invoke(null, /* static */ premain.invoke(null, /* static */
new Object[] { args }); new Object[] { args });
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {

View File

@ -117,11 +117,11 @@ public class ConnectorAddressLink {
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
throw new IOException(iae.getMessage()); throw new IOException(iae.getMessage());
} }
List counters = List<Counter> counters =
new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER); new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
Iterator i = counters.iterator(); Iterator<Counter> i = counters.iterator();
if (i.hasNext()) { if (i.hasNext()) {
Counter c = (Counter) i.next(); Counter c = i.next();
return (String) c.getValue(); return (String) c.getValue();
} else { } else {
return null; return null;
@ -167,13 +167,13 @@ public class ConnectorAddressLink {
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
throw new IOException(iae.getMessage()); throw new IOException(iae.getMessage());
} }
List counters = new PerfInstrumentation(bb).getAllCounters(); List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
Map<String, String> properties = new HashMap<String, String>(); Map<String, String> properties = new HashMap<>();
for (Object c : counters) { for (Counter c : counters) {
String name = ((Counter) c).getName(); String name = c.getName();
if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) && if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
!name.equals(CONNECTOR_ADDRESS_COUNTER)) { !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
properties.put(name, ((Counter) c).getValue().toString()); properties.put(name, c.getValue().toString());
} }
} }
return properties; return properties;

View File

@ -91,7 +91,7 @@ class Flag {
Flag[] flags = new Flag[numFlags]; Flag[] flags = new Flag[numFlags];
int count = getFlags(names, flags, numFlags); int count = getFlags(names, flags, numFlags);
List<Flag> result = new ArrayList<Flag>(); List<Flag> result = new ArrayList<>();
for (Flag f : flags) { for (Flag f : flags) {
if (f != null) { if (f != null) {
result.add(f); result.add(f);

View File

@ -69,11 +69,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
Field f = cl.getDeclaredField("builder"); Field f = cl.getDeclaredField("builder");
f.setAccessible(true); f.setAccessible(true);
return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo()); return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo());
} catch(ClassNotFoundException e) { } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
return null;
} catch(NoSuchFieldException e) {
return null;
} catch(IllegalAccessException e) {
return null; return null;
} }
} }
@ -82,7 +78,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
synchronized(compositeTypeByBuilder) { synchronized(compositeTypeByBuilder) {
gict = compositeTypeByBuilder.get(builder); gict = compositeTypeByBuilder.get(builder);
if(gict == null) { if(gict == null) {
OpenType[] gcNotifInfoItemTypes = new OpenType[] { OpenType<?>[] gcNotifInfoItemTypes = new OpenType<?>[] {
SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING,
@ -141,7 +137,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
GC_INFO GC_INFO
}; };
private static HashMap<GcInfoBuilder,CompositeType> compositeTypeByBuilder = private static HashMap<GcInfoBuilder,CompositeType> compositeTypeByBuilder =
new HashMap<GcInfoBuilder,CompositeType>(); new HashMap<>();
public static String getGcName(CompositeData cd) { public static String getGcName(CompositeData cd) {
String gcname = getString(cd, GC_NAME); String gcname = getString(cd, GC_NAME);
@ -195,7 +191,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
private static synchronized CompositeType getBaseGcNotifInfoCompositeType() { private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
if (baseGcNotifInfoCompositeType == null) { if (baseGcNotifInfoCompositeType == null) {
try { try {
OpenType[] baseGcNotifInfoItemTypes = new OpenType[] { OpenType<?>[] baseGcNotifInfoItemTypes = new OpenType<?>[] {
SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING,

View File

@ -70,14 +70,11 @@ class GarbageCollectorImpl extends MemoryManagerImpl
private String[] poolNames = null; private String[] poolNames = null;
synchronized String[] getAllPoolNames() { synchronized String[] getAllPoolNames() {
if (poolNames == null) { if (poolNames == null) {
List pools = ManagementFactory.getMemoryPoolMXBeans(); List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
poolNames = new String[pools.size()]; poolNames = new String[pools.size()];
int i = 0; int i = 0;
for (ListIterator iter = pools.listIterator(); for (MemoryPoolMXBean m : pools) {
iter.hasNext(); poolNames[i++] = m.getName();
i++) {
MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
poolNames[i] = p.getName();
} }
} }
return poolNames; return poolNames;

View File

@ -104,7 +104,7 @@ public class GcInfoBuilder {
int itemCount = numGcInfoItems + gcExtItemCount; int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount]; allItemNames = new String[itemCount];
String[] allItemDescs = 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, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems); System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);

View File

@ -76,11 +76,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
Field f = cl.getDeclaredField("builder"); Field f = cl.getDeclaredField("builder");
f.setAccessible(true); f.setAccessible(true);
return (GcInfoBuilder)f.get(info); return (GcInfoBuilder)f.get(info);
} catch(ClassNotFoundException e) { } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
return null;
} catch(NoSuchFieldException e) {
return null;
} catch(IllegalAccessException e) {
return null; return null;
} }
} }
@ -92,11 +88,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
Field f = cl.getDeclaredField("extAttributes"); Field f = cl.getDeclaredField("extAttributes");
f.setAccessible(true); f.setAccessible(true);
return (Object[])f.get(info); return (Object[])f.get(info);
} catch(ClassNotFoundException e) { } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
return null;
} catch(NoSuchFieldException e) {
return null;
} catch(IllegalAccessException e) {
return null; return null;
} }
} }
@ -180,10 +172,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
Method m = GcInfo.class.getMethod("getMemoryUsageBeforeGc"); Method m = GcInfo.class.getMethod("getMemoryUsageBeforeGc");
memoryUsageMapType = memoryUsageMapType =
MappedMXBeanType.getMappedType(m.getGenericReturnType()); MappedMXBeanType.getMappedType(m.getGenericReturnType());
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException | OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
} catch (OpenDataException e) {
// Should never reach here // Should never reach here
throw new AssertionError(e); throw new AssertionError(e);
} }
@ -197,7 +186,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
static synchronized OpenType[] getBaseGcInfoItemTypes() { static synchronized OpenType[] getBaseGcInfoItemTypes() {
if (baseGcInfoItemTypes == null) { if (baseGcInfoItemTypes == null) {
OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType(); OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
baseGcInfoItemTypes = new OpenType[] { baseGcInfoItemTypes = new OpenType<?>[] {
SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.LONG,
@ -225,10 +214,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
try { try {
TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC); TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC);
return cast(memoryUsageMapType.toJavaTypeData(td)); return cast(memoryUsageMapType.toJavaTypeData(td));
} catch (InvalidObjectException e) { } catch (InvalidObjectException | OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
} catch (OpenDataException e) {
// Should never reach here // Should never reach here
throw new AssertionError(e); throw new AssertionError(e);
} }
@ -244,10 +230,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
TabularData td = (TabularData) cd.get(MEMORY_USAGE_AFTER_GC); TabularData td = (TabularData) cd.get(MEMORY_USAGE_AFTER_GC);
//return (Map<String,MemoryUsage>) //return (Map<String,MemoryUsage>)
return cast(memoryUsageMapType.toJavaTypeData(td)); return cast(memoryUsageMapType.toJavaTypeData(td));
} catch (InvalidObjectException e) { } catch (InvalidObjectException | OpenDataException e) {
// Should never reach here
throw new AssertionError(e);
} catch (OpenDataException e) {
// Should never reach here // Should never reach here
throw new AssertionError(e); throw new AssertionError(e);
} }

View File

@ -48,7 +48,7 @@ public class HotSpotDiagnostic implements HotSpotDiagnosticMXBean {
public List<VMOption> getDiagnosticOptions() { public List<VMOption> getDiagnosticOptions() {
List<Flag> allFlags = Flag.getAllFlags(); List<Flag> allFlags = Flag.getAllFlags();
List<VMOption> result = new ArrayList<VMOption>(); List<VMOption> result = new ArrayList<>();
for (Flag flag : allFlags) { for (Flag flag : allFlags) {
if (flag.isWriteable() && flag.isExternal()) { if (flag.isWriteable() && flag.isExternal()) {
result.add(flag.getVMOption()); result.add(flag.getVMOption());

View File

@ -120,13 +120,13 @@ class HotspotCompilation
// current implementation. We first look up in the SUN_CI namespace // current implementation. We first look up in the SUN_CI namespace
// since most counters are in 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; return c;
} }
if ((c = (Counter) counters.get(COM_SUN_CI + name)) != null) { if ((c = counters.get(COM_SUN_CI + name)) != null) {
return c; return c;
} }
if ((c = (Counter) counters.get(JAVA_CI + name)) != null) { if ((c = counters.get(JAVA_CI + name)) != null) {
return c; return c;
} }
@ -136,10 +136,8 @@ class HotspotCompilation
private void initCompilerCounters() { private void initCompilerCounters() {
// Build a tree map of the current list of performance counters // Build a tree map of the current list of performance counters
ListIterator iter = getInternalCompilerCounters().listIterator(); counters = new TreeMap<>();
counters = new TreeMap<String, Counter>(); for (Counter c: getInternalCompilerCounters()) {
while (iter.hasNext()) {
Counter c = (Counter) iter.next();
counters.put(c.getName(), c); counters.put(c.getName(), c);
} }
@ -200,7 +198,7 @@ class HotspotCompilation
} }
public java.util.List<CompilerThreadStat> getCompilerThreadStats() { public java.util.List<CompilerThreadStat> getCompilerThreadStats() {
List<CompilerThreadStat> list = new ArrayList<CompilerThreadStat>(threads.length); List<CompilerThreadStat> list = new ArrayList<>(threads.length);
int i = 0; int i = 0;
if (threads[0] == null) { if (threads[0] == null) {
// no adaptor thread // no adaptor thread

View File

@ -58,7 +58,7 @@ class HotspotThread
String[] names = new String[count]; String[] names = new String[count];
long[] times = new long[count]; long[] times = new long[count];
int numThreads = getInternalThreadTimes0(names, times); int numThreads = getInternalThreadTimes0(names, times);
Map<String, Long> result = new HashMap<String, Long>(numThreads); Map<String, Long> result = new HashMap<>(numThreads);
for (int i = 0; i < numThreads; i++) { for (int i = 0; i < numThreads; i++) {
result.put(names[i], new Long(times[i])); result.put(names[i], new Long(times[i]));
} }

View File

@ -81,7 +81,7 @@ public abstract class LazyCompositeData
return compositeData().toString(); return compositeData().toString();
} }
public Collection values() { public Collection<?> values() {
return compositeData().values(); return compositeData().values();
} }
@ -153,16 +153,15 @@ public abstract class LazyCompositeData
// We can't use CompositeType.isValue() since it returns false // We can't use CompositeType.isValue() since it returns false
// if the type name doesn't match. // if the type name doesn't match.
Set allItems = type1.keySet(); Set<String> allItems = type1.keySet();
// Check all items in the type1 exist in type2 // Check all items in the type1 exist in type2
if (!type2.keySet().containsAll(allItems)) if (!type2.keySet().containsAll(allItems))
return false; return false;
for (Iterator iter = allItems.iterator(); iter.hasNext(); ) { for (String item: allItems) {
String item = (String) iter.next(); OpenType<?> ot1 = type1.getType(item);
OpenType ot1 = type1.getType(item); OpenType<?> ot2 = type2.getType(item);
OpenType ot2 = type2.getType(item);
if (ot1 instanceof CompositeType) { if (ot1 instanceof CompositeType) {
if (! (ot2 instanceof CompositeType)) if (! (ot2 instanceof CompositeType))
return false; return false;
@ -183,8 +182,8 @@ public abstract class LazyCompositeData
protected static boolean isTypeMatched(TabularType type1, TabularType type2) { protected static boolean isTypeMatched(TabularType type1, TabularType type2) {
if (type1 == type2) return true; if (type1 == type2) return true;
List list1 = type1.getIndexNames(); List<String> list1 = type1.getIndexNames();
List list2 = type2.getIndexNames(); List<String> list2 = type2.getIndexNames();
// check if the list of index names are the same // check if the list of index names are the same
if (!list1.equals(list2)) if (!list1.equals(list2))

View File

@ -110,7 +110,7 @@ public class ManagementFactoryHelper {
public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() { public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
MemoryPoolMXBean[] pools = MemoryImpl.getMemoryPools(); MemoryPoolMXBean[] pools = MemoryImpl.getMemoryPools();
List<MemoryPoolMXBean> list = new ArrayList<MemoryPoolMXBean>(pools.length); List<MemoryPoolMXBean> list = new ArrayList<>(pools.length);
for (MemoryPoolMXBean p : pools) { for (MemoryPoolMXBean p : pools) {
list.add(p); list.add(p);
} }
@ -119,7 +119,7 @@ public class ManagementFactoryHelper {
public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() { public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers(); MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers();
List<MemoryManagerMXBean> result = new ArrayList<MemoryManagerMXBean>(mgrs.length); List<MemoryManagerMXBean> result = new ArrayList<>(mgrs.length);
for (MemoryManagerMXBean m : mgrs) { for (MemoryManagerMXBean m : mgrs) {
result.add(m); result.add(m);
} }
@ -128,7 +128,7 @@ public class ManagementFactoryHelper {
public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() { public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers(); MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers();
List<GarbageCollectorMXBean> result = new ArrayList<GarbageCollectorMXBean>(mgrs.length); List<GarbageCollectorMXBean> result = new ArrayList<>(mgrs.length);
for (MemoryManagerMXBean m : mgrs) { for (MemoryManagerMXBean m : mgrs) {
if (GarbageCollectorMXBean.class.isInstance(m)) { if (GarbageCollectorMXBean.class.isInstance(m)) {
result.add(GarbageCollectorMXBean.class.cast(m)); result.add(GarbageCollectorMXBean.class.cast(m));

View File

@ -62,18 +62,18 @@ import com.sun.management.VMOption;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public abstract class MappedMXBeanType { public abstract class MappedMXBeanType {
private static final WeakHashMap<Type,MappedMXBeanType> convertedTypes = private static final WeakHashMap<Type,MappedMXBeanType> convertedTypes =
new WeakHashMap<Type,MappedMXBeanType>(); new WeakHashMap<>();
boolean isBasicType = false; boolean isBasicType = false;
OpenType openType = inProgress; OpenType<?> openType = inProgress;
Class mappedTypeClass; Class<?> mappedTypeClass;
static synchronized MappedMXBeanType newMappedType(Type javaType) static synchronized MappedMXBeanType newMappedType(Type javaType)
throws OpenDataException { throws OpenDataException {
MappedMXBeanType mt = null; MappedMXBeanType mt = null;
if (javaType instanceof Class) { if (javaType instanceof Class) {
final Class c = (Class) javaType; final Class<?> c = (Class<?>) javaType;
if (c.isEnum()) { if (c.isEnum()) {
mt = new EnumMXBeanType(c); mt = new EnumMXBeanType(c);
} else if (c.isArray()) { } else if (c.isArray()) {
@ -85,7 +85,7 @@ public abstract class MappedMXBeanType {
final ParameterizedType pt = (ParameterizedType) javaType; final ParameterizedType pt = (ParameterizedType) javaType;
final Type rawType = pt.getRawType(); final Type rawType = pt.getRawType();
if (rawType instanceof Class) { if (rawType instanceof Class) {
final Class rc = (Class) rawType; final Class<?> rc = (Class<?>) rawType;
if (rc == List.class) { if (rc == List.class) {
mt = new ListMXBeanType(pt); mt = new ListMXBeanType(pt);
} else if (rc == Map.class) { } else if (rc == Map.class) {
@ -106,7 +106,7 @@ public abstract class MappedMXBeanType {
} }
// basic types do not require data mapping // 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 { throws OpenDataException {
MappedMXBeanType mt = new BasicMXBeanType(c, ot); MappedMXBeanType mt = new BasicMXBeanType(c, ot);
convertedTypes.put(c, mt); convertedTypes.put(c, mt);
@ -127,7 +127,7 @@ public abstract class MappedMXBeanType {
} }
// Convert a class to an OpenType // Convert a class to an OpenType
public static synchronized OpenType toOpenType(Type t) public static synchronized OpenType<?> toOpenType(Type t)
throws OpenDataException { throws OpenDataException {
MappedMXBeanType mt = getMappedType(t); MappedMXBeanType mt = getMappedType(t);
return mt.getOpenType(); return mt.getOpenType();
@ -152,7 +152,7 @@ public abstract class MappedMXBeanType {
} }
// Return the mapped open type // Return the mapped open type
OpenType getOpenType() { OpenType<?> getOpenType() {
return openType; return openType;
} }
@ -168,7 +168,7 @@ public abstract class MappedMXBeanType {
} }
// Return the mapped open type // Return the mapped open type
Class getMappedTypeClass() { Class<?> getMappedTypeClass() {
return mappedTypeClass; return mappedTypeClass;
} }
@ -192,8 +192,8 @@ public abstract class MappedMXBeanType {
// T <-> T (no conversion) // T <-> T (no conversion)
// //
static class BasicMXBeanType extends MappedMXBeanType { static class BasicMXBeanType extends MappedMXBeanType {
final Class basicType; final Class<?> basicType;
BasicMXBeanType(Class c, OpenType openType) { BasicMXBeanType(Class<?> c, OpenType<?> openType) {
this.basicType = c; this.basicType = c;
this.openType = openType; this.openType = openType;
this.mappedTypeClass = c; this.mappedTypeClass = c;
@ -228,7 +228,7 @@ public abstract class MappedMXBeanType {
// //
static class EnumMXBeanType extends MappedMXBeanType { static class EnumMXBeanType extends MappedMXBeanType {
final Class enumClass; final Class enumClass;
EnumMXBeanType(Class c) { EnumMXBeanType(Class<?> c) {
this.enumClass = c; this.enumClass = c;
this.openType = STRING; this.openType = STRING;
this.mappedTypeClass = String.class; this.mappedTypeClass = String.class;
@ -269,16 +269,16 @@ public abstract class MappedMXBeanType {
// E[] <-> openTypeData(E)[] // E[] <-> openTypeData(E)[]
// //
static class ArrayMXBeanType extends MappedMXBeanType { static class ArrayMXBeanType extends MappedMXBeanType {
final Class arrayClass; final Class<?> arrayClass;
protected MappedMXBeanType componentType; protected MappedMXBeanType componentType;
protected MappedMXBeanType baseElementType; protected MappedMXBeanType baseElementType;
ArrayMXBeanType(Class c) throws OpenDataException { ArrayMXBeanType(Class<?> c) throws OpenDataException {
this.arrayClass = c; this.arrayClass = c;
this.componentType = getMappedType(c.getComponentType()); this.componentType = getMappedType(c.getComponentType());
StringBuilder className = new StringBuilder(); StringBuilder className = new StringBuilder();
Class et = c; Class<?> et = c;
int dim; int dim;
for (dim = 0; et.isArray(); dim++) { for (dim = 0; et.isArray(); dim++) {
className.append('['); className.append('[');
@ -299,7 +299,7 @@ public abstract class MappedMXBeanType {
throw ode; throw ode;
} }
openType = new ArrayType(dim, baseElementType.getOpenType()); openType = new ArrayType<>(dim, baseElementType.getOpenType());
} }
protected ArrayMXBeanType() { protected ArrayMXBeanType() {
@ -395,7 +395,7 @@ public abstract class MappedMXBeanType {
throw ode; throw ode;
} }
openType = new ArrayType(dim, baseElementType.getOpenType()); openType = new ArrayType<>(dim, baseElementType.getOpenType());
} }
Type getJavaType() { Type getJavaType() {
@ -428,7 +428,7 @@ public abstract class MappedMXBeanType {
throw new OpenDataException("Element Type for " + pt + throw new OpenDataException("Element Type for " + pt +
" not supported"); " not supported");
} }
final Class et = (Class) argTypes[0]; final Class<?> et = (Class<?>) argTypes[0];
if (et.isArray()) { if (et.isArray()) {
throw new OpenDataException("Element Type for " + pt + throw new OpenDataException("Element Type for " + pt +
" not supported"); " not supported");
@ -445,7 +445,7 @@ public abstract class MappedMXBeanType {
ode.initCause(e); ode.initCause(e);
throw ode; throw ode;
} }
openType = new ArrayType(1, paramType.getOpenType()); openType = new ArrayType<>(1, paramType.getOpenType());
} }
Type getJavaType() { Type getJavaType() {
@ -473,7 +473,7 @@ public abstract class MappedMXBeanType {
throws OpenDataException, InvalidObjectException { throws OpenDataException, InvalidObjectException {
final Object[] openArray = (Object[]) data; final Object[] openArray = (Object[]) data;
List<Object> result = new ArrayList<Object>(openArray.length); List<Object> result = new ArrayList<>(openArray.length);
for (Object o : openArray) { for (Object o : openArray) {
result.add(paramType.toJavaTypeData(o)); result.add(paramType.toJavaTypeData(o));
} }
@ -514,7 +514,7 @@ public abstract class MappedMXBeanType {
// FIXME: generate typeName for generic // FIXME: generate typeName for generic
typeName = "Map<" + keyType.getName() + "," + typeName = "Map<" + keyType.getName() + "," +
valueType.getName() + ">"; valueType.getName() + ">";
final OpenType[] mapItemTypes = new OpenType[] { final OpenType<?>[] mapItemTypes = new OpenType<?>[] {
keyType.getOpenType(), keyType.getOpenType(),
valueType.getOpenType(), valueType.getOpenType(),
}; };
@ -543,7 +543,7 @@ public abstract class MappedMXBeanType {
final TabularData table = new TabularDataSupport(tabularType); final TabularData table = new TabularDataSupport(tabularType);
final CompositeType rowType = tabularType.getRowType(); final CompositeType rowType = tabularType.getRowType();
for (Map.Entry entry : map.entrySet()) { for (Map.Entry<Object, Object> entry : map.entrySet()) {
final Object key = keyType.toOpenTypeData(entry.getKey()); final Object key = keyType.toOpenTypeData(entry.getKey());
final Object value = valueType.toOpenTypeData(entry.getValue()); final Object value = valueType.toOpenTypeData(entry.getValue());
final CompositeData row = final CompositeData row =
@ -560,7 +560,7 @@ public abstract class MappedMXBeanType {
final TabularData td = (TabularData) data; final TabularData td = (TabularData) data;
Map<Object, Object> result = new HashMap<Object, Object>(); Map<Object, Object> result = new HashMap<>();
for (CompositeData row : (Collection<CompositeData>) td.values()) { for (CompositeData row : (Collection<CompositeData>) td.values()) {
Object key = keyType.toJavaTypeData(row.get(KEY)); Object key = keyType.toJavaTypeData(row.get(KEY));
Object value = valueType.toJavaTypeData(row.get(VALUE)); Object value = valueType.toJavaTypeData(row.get(VALUE));
@ -607,7 +607,7 @@ public abstract class MappedMXBeanType {
final boolean isCompositeData; final boolean isCompositeData;
Method fromMethod = null; Method fromMethod = null;
CompositeDataMXBeanType(Class c) throws OpenDataException { CompositeDataMXBeanType(Class<?> c) throws OpenDataException {
this.javaClass = c; this.javaClass = c;
this.mappedTypeClass = COMPOSITE_DATA_CLASS; this.mappedTypeClass = COMPOSITE_DATA_CLASS;
@ -639,8 +639,8 @@ public abstract class MappedMXBeanType {
return javaClass.getMethods(); return javaClass.getMethods();
} }
}); });
final List<String> names = new ArrayList<String>(); final List<String> names = new ArrayList<>();
final List<OpenType> types = new ArrayList<OpenType>(); final List<OpenType<?>> types = new ArrayList<>();
/* Select public methods that look like "T getX()" or "boolean /* Select public methods that look like "T getX()" or "boolean
isX()", where T is not void and X is not the empty isX()", where T is not void and X is not the empty
@ -678,7 +678,7 @@ public abstract class MappedMXBeanType {
c.getName(), c.getName(),
nameArray, // field names nameArray, // field names
nameArray, // field descriptions nameArray, // field descriptions
types.toArray(new OpenType[0])); types.toArray(new OpenType<?>[0]));
} }
} }
@ -722,7 +722,7 @@ public abstract class MappedMXBeanType {
// so that no other classes are sent over the wire // so that no other classes are sent over the wire
CompositeData cd = (CompositeData) data; CompositeData cd = (CompositeData) data;
CompositeType ct = cd.getCompositeType(); 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); Object[] itemValues = cd.getAll(itemNames);
return new CompositeDataSupport(ct, itemNames, itemValues); return new CompositeDataSupport(ct, itemNames, itemValues);
} }
@ -779,9 +779,9 @@ public abstract class MappedMXBeanType {
} }
private static final long serialVersionUID = -3413063475064374490L; private static final long serialVersionUID = -3413063475064374490L;
} }
private static final OpenType inProgress; private static final OpenType<?> inProgress;
static { static {
OpenType t; OpenType<?> t;
try { try {
t = new InProgress(); t = new InProgress();
} catch (OpenDataException e) { } catch (OpenDataException e) {
@ -799,8 +799,8 @@ public abstract class MappedMXBeanType {
static { static {
try { try {
for (int i = 0; i < simpleTypes.length; i++) { for (int i = 0; i < simpleTypes.length; i++) {
final OpenType t = simpleTypes[i]; final OpenType<?> t = simpleTypes[i];
Class c; Class<?> c;
try { try {
c = Class.forName(t.getClassName(), false, c = Class.forName(t.getClassName(), false,
String.class.getClassLoader()); String.class.getClassLoader());
@ -816,7 +816,7 @@ public abstract class MappedMXBeanType {
if (c.getName().startsWith("java.lang.")) { if (c.getName().startsWith("java.lang.")) {
try { try {
final Field typeField = c.getField("TYPE"); final Field typeField = c.getField("TYPE");
final Class primitiveType = (Class) typeField.get(null); final Class<?> primitiveType = (Class<?>) typeField.get(null);
MappedMXBeanType.newBasicType(primitiveType, t); MappedMXBeanType.newBasicType(primitiveType, t);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
// OK: must not be a primitive wrapper // OK: must not be a primitive wrapper

View File

@ -92,7 +92,7 @@ public class MonitorInfoCompositeData extends LazyCompositeData {
monitorInfoCompositeType = (CompositeType) monitorInfoCompositeType = (CompositeType)
MappedMXBeanType.toOpenType(MonitorInfo.class); MappedMXBeanType.toOpenType(MonitorInfo.class);
Set<String> s = monitorInfoCompositeType.keySet(); Set<String> s = monitorInfoCompositeType.keySet();
monitorInfoItemNames = (String[]) s.toArray(new String[0]); monitorInfoItemNames = s.toArray(new String[0]);
} catch (OpenDataException e) { } catch (OpenDataException e) {
// Should never reach here // Should never reach here
throw new AssertionError(e); throw new AssertionError(e);

View File

@ -71,7 +71,7 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
efficient solution would be to clone the listener list efficient solution would be to clone the listener list
every time a notification is sent. */ every time a notification is sent. */
synchronized (listenerLock) { synchronized (listenerLock) {
List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList.size() + 1); List<ListenerInfo> newList = new ArrayList<>(listenerList.size() + 1);
newList.addAll(listenerList); newList.addAll(listenerList);
newList.add(new ListenerInfo(listener, filter, handback)); newList.add(new ListenerInfo(listener, filter, handback));
listenerList = newList; listenerList = newList;
@ -82,12 +82,12 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
throws ListenerNotFoundException { throws ListenerNotFoundException {
synchronized (listenerLock) { synchronized (listenerLock) {
List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList); List<ListenerInfo> newList = new ArrayList<>(listenerList);
/* We scan the list of listeners in reverse order because /* We scan the list of listeners in reverse order because
in forward order we would have to repeat the loop with in forward order we would have to repeat the loop with
the same index after a remove. */ the same index after a remove. */
for (int i=newList.size()-1; i>=0; i--) { for (int i=newList.size()-1; i>=0; i--) {
ListenerInfo li = (ListenerInfo)newList.get(i); ListenerInfo li = newList.get(i);
if (li.listener == listener) if (li.listener == listener)
newList.remove(i); newList.remove(i);
@ -106,10 +106,10 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
boolean found = false; boolean found = false;
synchronized (listenerLock) { synchronized (listenerLock) {
List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList); List<ListenerInfo> newList = new ArrayList<>(listenerList);
final int size = newList.size(); final int size = newList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
ListenerInfo li = (ListenerInfo) newList.get(i); ListenerInfo li = newList.get(i);
if (li.listener == listener) { if (li.listener == listener) {
found = true; found = true;
@ -148,7 +148,7 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
final int size = currentList.size(); final int size = currentList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
ListenerInfo li = (ListenerInfo) currentList.get(i); ListenerInfo li = currentList.get(i);
if (li.filter == null if (li.filter == null
|| li.filter.isNotificationEnabled(notification)) { || li.filter.isNotificationEnabled(notification)) {

View File

@ -128,7 +128,7 @@ class RuntimeImpl implements RuntimeMXBean {
public Map<String,String> getSystemProperties() { public Map<String,String> getSystemProperties() {
Properties sysProps = System.getProperties(); Properties sysProps = System.getProperties();
Map<String,String> map = new HashMap<String, String>(); Map<String,String> map = new HashMap<>();
// Properties.entrySet() does not include the entries in // Properties.entrySet() does not include the entries in
// the default properties. So use Properties.stringPropertyNames() // the default properties. So use Properties.stringPropertyNames()

View File

@ -190,7 +190,7 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
threadInfoV6Attributes.length; threadInfoV6Attributes.length;
String[] v5ItemNames = new String[numV5Attributes]; String[] v5ItemNames = new String[numV5Attributes];
String[] v5ItemDescs = new String[numV5Attributes]; String[] v5ItemDescs = new String[numV5Attributes];
OpenType[] v5ItemTypes = new OpenType[numV5Attributes]; OpenType<?>[] v5ItemTypes = new OpenType<?>[numV5Attributes];
int i = 0; int i = 0;
for (String n : itemNames) { for (String n : itemNames) {
if (isV5Attribute(n)) { if (isV5Attribute(n)) {

View File

@ -73,7 +73,7 @@ public class PerfInstrumentation {
buffer.position(prologue.getEntryOffset()); buffer.position(prologue.getEntryOffset());
nextEntry = buffer.position(); nextEntry = buffer.position();
// rebuild all the counters // rebuild all the counters
map = new TreeMap<String, Counter>(); map = new TreeMap<>();
} }
boolean hasNext() { boolean hasNext() {
@ -154,7 +154,7 @@ public class PerfInstrumentation {
map.put(c.getName(), c); map.put(c.getName(), c);
} }
} }
return new ArrayList<Counter>(map.values()); return new ArrayList<>(map.values());
} }
public synchronized List<Counter> findByPattern(String patternString) { public synchronized List<Counter> findByPattern(String patternString) {
@ -167,7 +167,8 @@ public class PerfInstrumentation {
Pattern pattern = Pattern.compile(patternString); Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher(""); Matcher matcher = pattern.matcher("");
List<Counter> matches = new ArrayList<Counter>(); List<Counter> matches = new ArrayList<>();
for (Map.Entry<String,Counter> me: map.entrySet()) { for (Map.Entry<String,Counter> me: map.entrySet()) {
String name = me.getKey(); String name = me.getKey();

View File

@ -234,14 +234,15 @@ public final class ConnectorBootstrap {
"authenticated Subject is null"); "authenticated Subject is null");
} }
final Set<Principal> principals = subject.getPrincipals(); final Set<Principal> principals = subject.getPrincipals();
for (Principal p: principals) { for (Principal p1: principals) {
if (properties.containsKey(p.getName())) { if (properties.containsKey(p1.getName())) {
return; return;
} }
} }
final Set<String> principalsStr = new HashSet<String>();
for (Principal p: principals) { final Set<String> principalsStr = new HashSet<>();
principalsStr.add(p.getName()); for (Principal p2: principals) {
principalsStr.add(p2.getName());
} }
throw new SecurityException( throw new SecurityException(
"Access denied! No entries found in the access file [" + "Access denied! No entries found in the access file [" +
@ -255,9 +256,9 @@ public final class ConnectorBootstrap {
if (fname == null) { if (fname == null) {
return p; return p;
} }
FileInputStream fin = new FileInputStream(fname); try (FileInputStream fin = new FileInputStream(fname)) {
p.load(fin); p.load(fin);
fin.close(); }
return p; return p;
} }
private final Map<String, Object> environment; private final Map<String, Object> environment;
@ -430,7 +431,7 @@ public final class ConnectorBootstrap {
try { try {
// Export remote connector address and associated configuration // Export remote connector address and associated configuration
// properties to the instrumentation buffer. // properties to the instrumentation buffer.
Map<String, String> properties = new HashMap<String, String>(); Map<String, String> properties = new HashMap<>();
properties.put("remoteAddress", url.toString()); properties.put("remoteAddress", url.toString());
properties.put("authenticate", useAuthenticationStr); properties.put("authenticate", useAuthenticationStr);
properties.put("ssl", useSslStr); properties.put("ssl", useSslStr);
@ -456,7 +457,7 @@ public final class ConnectorBootstrap {
System.setProperty("java.rmi.server.randomIDs", "true"); System.setProperty("java.rmi.server.randomIDs", "true");
// This RMI server should not keep the VM alive // This RMI server should not keep the VM alive
Map<String, Object> env = new HashMap<String, Object>(); Map<String, Object> env = new HashMap<>();
env.put(RMIExporter.EXPORTER_ATTRIBUTE, new PermanentExporter()); env.put(RMIExporter.EXPORTER_ATTRIBUTE, new PermanentExporter());
// The local connector server need only be available via the // The local connector server need only be available via the
@ -599,12 +600,9 @@ public final class ConnectorBootstrap {
try { try {
// Load the SSL keystore properties from the config file // Load the SSL keystore properties from the config file
Properties p = new Properties(); Properties p = new Properties();
InputStream in = new FileInputStream(sslConfigFileName); try (InputStream in = new FileInputStream(sslConfigFileName)) {
try {
BufferedInputStream bin = new BufferedInputStream(in); BufferedInputStream bin = new BufferedInputStream(in);
p.load(bin); p.load(bin);
} finally {
in.close();
} }
String keyStore = String keyStore =
p.getProperty("javax.net.ssl.keyStore"); p.getProperty("javax.net.ssl.keyStore");
@ -628,11 +626,8 @@ public final class ConnectorBootstrap {
KeyStore ks = null; KeyStore ks = null;
if (keyStore != null) { if (keyStore != null) {
ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks = KeyStore.getInstance(KeyStore.getDefaultType());
FileInputStream ksfis = new FileInputStream(keyStore); try (FileInputStream ksfis = new FileInputStream(keyStore)) {
try {
ks.load(ksfis, keyStorePasswd); ks.load(ksfis, keyStorePasswd);
} finally {
ksfis.close();
} }
} }
KeyManagerFactory kmf = KeyManagerFactory.getInstance( KeyManagerFactory kmf = KeyManagerFactory.getInstance(
@ -642,11 +637,8 @@ public final class ConnectorBootstrap {
KeyStore ts = null; KeyStore ts = null;
if (trustStore != null) { if (trustStore != null) {
ts = KeyStore.getInstance(KeyStore.getDefaultType()); ts = KeyStore.getInstance(KeyStore.getDefaultType());
FileInputStream tsfis = new FileInputStream(trustStore); try (FileInputStream tsfis = new FileInputStream(trustStore)) {
try {
ts.load(tsfis, trustStorePasswd); ts.load(tsfis, trustStorePasswd);
} finally {
tsfis.close();
} }
} }
TrustManagerFactory tmf = TrustManagerFactory.getInstance( TrustManagerFactory tmf = TrustManagerFactory.getInstance(
@ -689,7 +681,7 @@ public final class ConnectorBootstrap {
JMXServiceURL url = new JMXServiceURL("rmi", null, 0); JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
Map<String, Object> env = new HashMap<String, Object>(); Map<String, Object> env = new HashMap<>();
PermanentExporter exporter = new PermanentExporter(); PermanentExporter exporter = new PermanentExporter();

View File

@ -118,21 +118,22 @@ public final class AdaptorBootstrap {
/** /**
* Retrieve the Trap Target List from the ACL file. * Retrieve the Trap Target List from the ACL file.
**/ **/
@SuppressWarnings("unchecked")
private static List<NotificationTarget> getTargetList(InetAddressAcl acl, private static List<NotificationTarget> getTargetList(InetAddressAcl acl,
int defaultTrapPort) { int defaultTrapPort) {
final ArrayList<NotificationTarget> result = final ArrayList<NotificationTarget> result =
new ArrayList<NotificationTarget>(); new ArrayList<>();
if (acl != null) { if (acl != null) {
if (log.isDebugOn()) if (log.isDebugOn())
log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing")); log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing"));
final Enumeration td=acl.getTrapDestinations(); final Enumeration td = acl.getTrapDestinations();
for (; td.hasMoreElements() ;) { for (; td.hasMoreElements() ;) {
final InetAddress targetAddr = (InetAddress)td.nextElement(); final InetAddress targetAddr = (InetAddress)td.nextElement();
final Enumeration tc = final Enumeration tc =
acl.getTrapCommunities(targetAddr); acl.getTrapCommunities(targetAddr);
for (;tc.hasMoreElements() ;) { for (;tc.hasMoreElements() ;) {
final String community = (String) tc.nextElement(); final String community = (String)tc.nextElement();
final NotificationTarget target = final NotificationTarget target =
new NotificationTargetImpl(targetAddr, new NotificationTargetImpl(targetAddr,
defaultTrapPort, defaultTrapPort,

View File

@ -90,14 +90,14 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
SnmpOidTable table = null; SnmpOidTable table = null;
if(tableRef == null) { if(tableRef == null) {
table = new JVM_MANAGEMENT_MIBOidTable(); table = new JVM_MANAGEMENT_MIBOidTable();
tableRef = new WeakReference<SnmpOidTable>(table); tableRef = new WeakReference<>(table);
return table; return table;
} }
table = tableRef.get(); table = tableRef.get();
if(table == null) { if(table == null) {
table = new JVM_MANAGEMENT_MIBOidTable(); table = new JVM_MANAGEMENT_MIBOidTable();
tableRef = new WeakReference<SnmpOidTable>(table); tableRef = new WeakReference<>(table);
} }
return table; return table;
@ -198,7 +198,7 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
* List of notification targets. * List of notification targets.
*/ */
private ArrayList<NotificationTarget> notificationTargets = private ArrayList<NotificationTarget> notificationTargets =
new ArrayList<NotificationTarget>(); new ArrayList<>();
private final NotificationEmitter emitter; private final NotificationEmitter emitter;
private final NotificationHandler handler; private final NotificationHandler handler;
@ -215,7 +215,7 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
} }
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) { private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
final Iterator iterator = notificationTargets.iterator(); final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
final SnmpAdaptorServer adaptor = final SnmpAdaptorServer adaptor =
(SnmpAdaptorServer) getSnmpAdaptor(); (SnmpAdaptorServer) getSnmpAdaptor();
@ -232,7 +232,7 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
while(iterator.hasNext()) { while(iterator.hasNext()) {
NotificationTarget target = null; NotificationTarget target = null;
try { try {
target = (NotificationTarget) iterator.next(); target = iterator.next();
SnmpPeer peer = SnmpPeer peer =
new SnmpPeer(target.getAddress(), target.getPort()); new SnmpPeer(target.getAddress(), target.getPort());
SnmpParameters p = new SnmpParameters(); SnmpParameters p = new SnmpParameters();

View File

@ -58,6 +58,8 @@ import sun.management.snmp.util.JvmContextFactory;
*/ */
public class JvmMemGCTableMetaImpl extends JvmMemGCTableMeta { public class JvmMemGCTableMetaImpl extends JvmMemGCTableMeta {
static final long serialVersionUID = 8250461197108867607L;
/** /**
* This class acts as a filter over the SnmpTableHandler * This class acts as a filter over the SnmpTableHandler
* used for the JvmMemoryManagerTable. It filters out * used for the JvmMemoryManagerTable. It filters out

View File

@ -61,12 +61,17 @@ import sun.management.snmp.util.JvmContextFactory;
*/ */
public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta { public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
static final long serialVersionUID = 36176771566817592L;
/** /**
* A concrete implementation of {@link SnmpNamedListTableCache}, for the * A concrete implementation of {@link SnmpNamedListTableCache}, for the
* jvmMemManagerTable. * jvmMemManagerTable.
**/ **/
private static class JvmMemManagerTableCache private static class JvmMemManagerTableCache
extends SnmpNamedListTableCache { extends SnmpNamedListTableCache {
static final long serialVersionUID = 6564294074653009240L;
/** /**
* Create a weak cache for the jvmMemManagerTable. * Create a weak cache for the jvmMemManagerTable.
* @param validity validity of the cached data, in ms. * @param validity validity of the cached data, in ms.
@ -87,7 +92,7 @@ public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
* <code>MemoryManagerMXBean</code> in the list. * <code>MemoryManagerMXBean</code> in the list.
* @return <code>((MemoryManagerMXBean)item).getName()</code> * @return <code>((MemoryManagerMXBean)item).getName()</code>
**/ **/
protected String getKey(Object context, List rawDatas, protected String getKey(Object context, List<?> rawDatas,
int rank, Object item) { int rank, Object item) {
if (item == null) return null; if (item == null) return null;
final String name = ((MemoryManagerMXBean)item).getName(); final String name = ((MemoryManagerMXBean)item).getName();
@ -99,7 +104,7 @@ public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
* Call <code>getTableHandler(JvmContextFactory.getUserData())</code>. * Call <code>getTableHandler(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }
@ -114,7 +119,7 @@ public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
* Call ManagementFactory.getMemoryManagerMXBeans() to * Call ManagementFactory.getMemoryManagerMXBeans() to
* load the raw data of this table. * load the raw data of this table.
**/ **/
protected List loadRawDatas(Map userData) { protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
return ManagementFactory.getMemoryManagerMXBeans(); return ManagementFactory.getMemoryManagerMXBeans();
} }

View File

@ -64,13 +64,17 @@ import sun.management.snmp.util.JvmContextFactory;
public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
implements Serializable { implements Serializable {
static final long serialVersionUID = 1896509775012355443L;
/** /**
* A concrete implementation of {@link SnmpTableCache}, for the * A concrete implementation of {@link SnmpTableCache}, for the
* jvmMemMgrPoolRelTable. * jvmMemMgrPoolRelTable.
**/ **/
private static class JvmMemMgrPoolRelTableCache private static class JvmMemMgrPoolRelTableCache
extends SnmpTableCache { extends SnmpTableCache {
static final long serialVersionUID = 6059937161990659184L;
final private JvmMemMgrPoolRelTableMetaImpl meta; final private JvmMemMgrPoolRelTableMetaImpl meta;
/** /**
@ -87,7 +91,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }
@ -101,7 +105,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
return buildPoolIndexMap((SnmpCachedData)handler); return buildPoolIndexMap((SnmpCachedData)handler);
// not optimizable... too bad. // not optimizable... too bad.
final Map<String, SnmpOid> m = new HashMap<String, SnmpOid>(); final Map<String, SnmpOid> m = new HashMap<>();
SnmpOid index=null; SnmpOid index=null;
while ((index = handler.getNext(index))!=null) { while ((index = handler.getNext(index))!=null) {
final MemoryPoolMXBean mpm = final MemoryPoolMXBean mpm =
@ -124,7 +128,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
final SnmpOid[] indexes = cached.indexes; final SnmpOid[] indexes = cached.indexes;
final Object[] datas = cached.datas; final Object[] datas = cached.datas;
final int len = indexes.length; final int len = indexes.length;
final Map<String, SnmpOid> m = new HashMap<String, SnmpOid>(len); final Map<String, SnmpOid> m = new HashMap<>(len);
for (int i=0; i<len; i++) { for (int i=0; i<len; i++) {
final SnmpOid index = indexes[i]; final SnmpOid index = indexes[i];
if (index == null) continue; if (index == null) continue;
@ -165,13 +169,13 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
final long time = System.currentTimeMillis(); final long time = System.currentTimeMillis();
// Build a Map poolname -> index // Build a Map poolname -> index
final Map poolIndexMap = buildPoolIndexMap(mpHandler); final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);
// For each memory manager, get the list of memory pools // For each memory manager, get the list of memory pools
// For each memory pool, find its index in the memory pool table // For each memory pool, find its index in the memory pool table
// Create a row in the relation table. // Create a row in the relation table.
final TreeMap<SnmpOid, Object> table = final TreeMap<SnmpOid, Object> table =
new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator); new TreeMap<>(SnmpCachedData.oidComparator);
updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap); updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);
return new SnmpCachedData(time,table); return new SnmpCachedData(time,table);
@ -207,7 +211,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData, protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
MemoryManagerMXBean mmm, MemoryManagerMXBean mmm,
SnmpOid mmIndex, SnmpOid mmIndex,
Map poolIndexMap) { Map<String, SnmpOid> poolIndexMap) {
// The MemoryManager index is an int, so it's the first // The MemoryManager index is an int, so it's the first
// and only subidentifier. // and only subidentifier.
@ -230,7 +234,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
for (int i = 0; i < mpList.length; i++) { for (int i = 0; i < mpList.length; i++) {
final String mpmName = mpList[i]; final String mpmName = mpList[i];
if (mpmName == null) continue; if (mpmName == null) continue;
final SnmpOid mpIndex = (SnmpOid)poolIndexMap.get(mpmName); final SnmpOid mpIndex = poolIndexMap.get(mpmName);
if (mpIndex == null) continue; if (mpIndex == null) continue;
// The MemoryPool index is an int, so it's the first // The MemoryPool index is an int, so it's the first
@ -261,7 +265,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData, protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
SnmpTableHandler mmHandler, SnmpTableHandler mmHandler,
SnmpTableHandler mpHandler, SnmpTableHandler mpHandler,
Map poolIndexMap) { Map<String, SnmpOid> poolIndexMap) {
if (mmHandler instanceof SnmpCachedData) { if (mmHandler instanceof SnmpCachedData) {
updateTreeMap(table,userData,(SnmpCachedData)mmHandler, updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
mpHandler,poolIndexMap); mpHandler,poolIndexMap);
@ -280,7 +284,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData, protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
SnmpCachedData mmHandler, SnmpCachedData mmHandler,
SnmpTableHandler mpHandler, SnmpTableHandler mpHandler,
Map poolIndexMap) { Map<String, SnmpOid> poolIndexMap) {
final SnmpOid[] indexes = mmHandler.indexes; final SnmpOid[] indexes = mmHandler.indexes;
final Object[] datas = mmHandler.datas; final Object[] datas = mmHandler.datas;

View File

@ -61,11 +61,16 @@ import sun.management.snmp.util.JvmContextFactory;
*/ */
public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta { public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
static final long serialVersionUID = -2525820976094284957L;
/** /**
* A concrete implementation of {@link SnmpNamedListTableCache}, for the * A concrete implementation of {@link SnmpNamedListTableCache}, for the
* jvmMemPoolTable. * jvmMemPoolTable.
**/ **/
private static class JvmMemPoolTableCache extends SnmpNamedListTableCache { private static class JvmMemPoolTableCache extends SnmpNamedListTableCache {
static final long serialVersionUID = -1755520683086760574L;
/** /**
* Create a weak cache for the jvmMemPoolTable. * Create a weak cache for the jvmMemPoolTable.
* @param validity validity of the cached data, in ms. * @param validity validity of the cached data, in ms.
@ -86,7 +91,7 @@ public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
* <code>MemoryPoolMXBean</code> in the list. * <code>MemoryPoolMXBean</code> in the list.
* @return <code>((MemoryPoolMXBean)item).getName()</code> * @return <code>((MemoryPoolMXBean)item).getName()</code>
**/ **/
protected String getKey(Object context, List rawDatas, protected String getKey(Object context, List<?> rawDatas,
int rank, Object item) { int rank, Object item) {
if (item == null) return null; if (item == null) return null;
final String name = ((MemoryPoolMXBean)item).getName(); final String name = ((MemoryPoolMXBean)item).getName();
@ -98,7 +103,7 @@ public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }
@ -113,7 +118,7 @@ public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
* Call ManagementFactory.getMemoryPoolMXBeans() to * Call ManagementFactory.getMemoryPoolMXBeans() to
* load the raw data of this table. * load the raw data of this table.
**/ **/
protected List loadRawDatas(Map userData) { protected List<MemoryPoolMXBean> loadRawDatas(Map<Object, Object> userData) {
return ManagementFactory.getMemoryPoolMXBeans(); return ManagementFactory.getMemoryPoolMXBeans();
} }
} }

View File

@ -275,7 +275,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/ */
public EnumJvmMemoryGCCall getJvmMemoryGCCall() public EnumJvmMemoryGCCall getJvmMemoryGCCall()
throws SnmpStatusException { throws SnmpStatusException {
final Map m = JvmContextFactory.getUserData(); final Map<Object,Object> m = JvmContextFactory.getUserData();
if (m != null) { if (m != null) {
final EnumJvmMemoryGCCall cached final EnumJvmMemoryGCCall cached

View File

@ -50,6 +50,8 @@ import sun.management.snmp.util.MibLogger;
* The class is used for representing SNMP metadata for the "JvmMemory" group. * The class is used for representing SNMP metadata for the "JvmMemory" group.
*/ */
public class JvmMemoryMetaImpl extends JvmMemoryMeta { public class JvmMemoryMetaImpl extends JvmMemoryMeta {
static final long serialVersionUID = -6500448253825893071L;
/** /**
* Constructor for the metadata associated to "JvmMemory". * Constructor for the metadata associated to "JvmMemory".
*/ */

View File

@ -47,6 +47,8 @@ import sun.management.snmp.jvmmib.JvmOSMBean;
*/ */
public class JvmOSImpl implements JvmOSMBean, Serializable { public class JvmOSImpl implements JvmOSMBean, Serializable {
static final long serialVersionUID = 1839834731763310809L;
/** /**
* Constructor for the "JvmOS" group. * Constructor for the "JvmOS" group.
* If the group contains a table, the entries created through an * If the group contains a table, the entries created through an

View File

@ -44,6 +44,8 @@ import sun.management.snmp.jvmmib.JvmRTBootClassPathEntryMBean;
public class JvmRTBootClassPathEntryImpl public class JvmRTBootClassPathEntryImpl
implements JvmRTBootClassPathEntryMBean, Serializable { implements JvmRTBootClassPathEntryMBean, Serializable {
static final long serialVersionUID = -2282652055235913013L;
private final String item; private final String item;
private final int index; private final int index;

View File

@ -71,6 +71,8 @@ import sun.management.snmp.util.JvmContextFactory;
public class JvmRTBootClassPathTableMetaImpl public class JvmRTBootClassPathTableMetaImpl
extends JvmRTBootClassPathTableMeta { extends JvmRTBootClassPathTableMeta {
static final long serialVersionUID = -8659886610487538299L;
private SnmpTableCache cache; private SnmpTableCache cache;
/** /**
@ -78,6 +80,7 @@ public class JvmRTBootClassPathTableMetaImpl
* JvmRTBootClassPathTable. * JvmRTBootClassPathTable.
**/ **/
private static class JvmRTBootClassPathTableCache extends SnmpTableCache { private static class JvmRTBootClassPathTableCache extends SnmpTableCache {
static final long serialVersionUID = -2637458695413646098L;
private JvmRTBootClassPathTableMetaImpl meta; private JvmRTBootClassPathTableMetaImpl meta;
JvmRTBootClassPathTableCache(JvmRTBootClassPathTableMetaImpl meta, JvmRTBootClassPathTableCache(JvmRTBootClassPathTableMetaImpl meta,
@ -90,7 +93,7 @@ public class JvmRTBootClassPathTableMetaImpl
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }

View File

@ -44,6 +44,7 @@ import sun.management.snmp.jvmmib.JvmRTClassPathEntryMBean;
public class JvmRTClassPathEntryImpl implements JvmRTClassPathEntryMBean, public class JvmRTClassPathEntryImpl implements JvmRTClassPathEntryMBean,
Serializable { Serializable {
static final long serialVersionUID = 8524792845083365742L;
private final String item; private final String item;
private final int index; private final int index;

View File

@ -70,6 +70,8 @@ import sun.management.snmp.util.JvmContextFactory;
*/ */
public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta { public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
static final long serialVersionUID = -6914494148818455166L;
private SnmpTableCache cache; private SnmpTableCache cache;
/** /**
@ -77,6 +79,7 @@ public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
* JvmRTClassPathTable. * JvmRTClassPathTable.
**/ **/
private static class JvmRTClassPathTableCache extends SnmpTableCache { private static class JvmRTClassPathTableCache extends SnmpTableCache {
static final long serialVersionUID = 3805032372592117315L;
private JvmRTClassPathTableMetaImpl meta; private JvmRTClassPathTableMetaImpl meta;
JvmRTClassPathTableCache(JvmRTClassPathTableMetaImpl meta, JvmRTClassPathTableCache(JvmRTClassPathTableMetaImpl meta,
@ -89,7 +92,7 @@ public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }

View File

@ -44,6 +44,7 @@ import sun.management.snmp.jvmmib.JvmRTInputArgsEntryMBean;
public class JvmRTInputArgsEntryImpl implements JvmRTInputArgsEntryMBean, public class JvmRTInputArgsEntryImpl implements JvmRTInputArgsEntryMBean,
Serializable { Serializable {
static final long serialVersionUID = 1000306518436503395L;
private final String item; private final String item;
private final int index; private final int index;

View File

@ -70,6 +70,7 @@ import sun.management.snmp.util.JvmContextFactory;
*/ */
public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta { public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
static final long serialVersionUID = -2083438094888099238L;
private SnmpTableCache cache; private SnmpTableCache cache;
/** /**
@ -77,6 +78,8 @@ public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
* JvmRTInputArgsTable. * JvmRTInputArgsTable.
**/ **/
private static class JvmRTInputArgsTableCache extends SnmpTableCache { private static class JvmRTInputArgsTableCache extends SnmpTableCache {
static final long serialVersionUID = 1693751105464785192L;
private JvmRTInputArgsTableMetaImpl meta; private JvmRTInputArgsTableMetaImpl meta;
JvmRTInputArgsTableCache(JvmRTInputArgsTableMetaImpl meta, JvmRTInputArgsTableCache(JvmRTInputArgsTableMetaImpl meta,
@ -89,7 +92,7 @@ public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }

View File

@ -44,6 +44,7 @@ import sun.management.snmp.jvmmib.JvmRTLibraryPathEntryMBean;
public class JvmRTLibraryPathEntryImpl implements JvmRTLibraryPathEntryMBean, public class JvmRTLibraryPathEntryImpl implements JvmRTLibraryPathEntryMBean,
Serializable { Serializable {
static final long serialVersionUID = -3322438153507369765L;
private final String item; private final String item;
private final int index; private final int index;

View File

@ -70,6 +70,7 @@ import sun.management.snmp.util.JvmContextFactory;
*/ */
public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta { public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
static final long serialVersionUID = 6713252710712502068L;
private SnmpTableCache cache; private SnmpTableCache cache;
/** /**
@ -77,6 +78,7 @@ public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
* JvmRTLibraryPathTable. * JvmRTLibraryPathTable.
**/ **/
private static class JvmRTLibraryPathTableCache extends SnmpTableCache { private static class JvmRTLibraryPathTableCache extends SnmpTableCache {
static final long serialVersionUID = 2035304445719393195L;
private JvmRTLibraryPathTableMetaImpl meta; private JvmRTLibraryPathTableMetaImpl meta;
JvmRTLibraryPathTableCache(JvmRTLibraryPathTableMetaImpl meta, JvmRTLibraryPathTableCache(JvmRTLibraryPathTableMetaImpl meta,
@ -89,7 +91,7 @@ public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }

View File

@ -68,6 +68,7 @@ import sun.management.snmp.jvmmib.JvmRTLibraryPathTableMeta;
*/ */
public class JvmRuntimeMetaImpl extends JvmRuntimeMeta { public class JvmRuntimeMetaImpl extends JvmRuntimeMeta {
static final long serialVersionUID = -6570428414857608618L;
/** /**
* Constructor for the metadata associated to "JvmRuntime". * Constructor for the metadata associated to "JvmRuntime".
*/ */

View File

@ -53,6 +53,8 @@ import sun.management.snmp.util.MibLogger;
public class JvmThreadInstanceEntryImpl public class JvmThreadInstanceEntryImpl
implements JvmThreadInstanceEntryMBean, Serializable { implements JvmThreadInstanceEntryMBean, Serializable {
static final long serialVersionUID = 910173589985461347L;
public final static class ThreadStateMap { public final static class ThreadStateMap {
public final static class Byte0 { public final static class Byte0 {
public final static byte inNative = (byte)0x80; // bit 1 public final static byte inNative = (byte)0x80; // bit 1

View File

@ -78,6 +78,8 @@ import sun.management.snmp.util.JvmContextFactory;
public class JvmThreadInstanceTableMetaImpl public class JvmThreadInstanceTableMetaImpl
extends JvmThreadInstanceTableMeta { extends JvmThreadInstanceTableMeta {
static final long serialVersionUID = -8432271929226397492L;
/** /**
* Maximum depth of the stacktrace that might be returned through * Maximum depth of the stacktrace that might be returned through
* SNMP. * SNMP.
@ -135,6 +137,7 @@ public class JvmThreadInstanceTableMetaImpl
private static class JvmThreadInstanceTableCache private static class JvmThreadInstanceTableCache
extends SnmpTableCache { extends SnmpTableCache {
static final long serialVersionUID = 4947330124563406878L;
final private JvmThreadInstanceTableMetaImpl meta; final private JvmThreadInstanceTableMetaImpl meta;
/** /**
@ -151,7 +154,7 @@ public class JvmThreadInstanceTableMetaImpl
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/ **/
public SnmpTableHandler getTableHandler() { public SnmpTableHandler getTableHandler() {
final Map userData = JvmContextFactory.getUserData(); final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData); return getTableDatas(userData);
} }
@ -172,7 +175,7 @@ public class JvmThreadInstanceTableMetaImpl
SnmpOid indexes[] = new SnmpOid[id.length]; SnmpOid indexes[] = new SnmpOid[id.length];
final TreeMap<SnmpOid, Object> table = final TreeMap<SnmpOid, Object> table =
new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator); new TreeMap<>(SnmpCachedData.oidComparator);
for(int i = 0; i < id.length; i++) { for(int i = 0; i < id.length; i++) {
log.debug("", "Making index for thread id [" + id[i] +"]"); log.debug("", "Making index for thread id [" + id[i] +"]");
//indexes[i] = makeOid(id[i]); //indexes[i] = makeOid(id[i]);
@ -277,7 +280,7 @@ public class JvmThreadInstanceTableMetaImpl
// Get the request contextual cache (userData). // Get the request contextual cache (userData).
// //
final Map m = JvmContextFactory.getUserData(); final Map<Object,Object> m = JvmContextFactory.getUserData();
// Get the handler. // Get the handler.
// //

View File

@ -66,6 +66,8 @@ import sun.management.snmp.jvmmib.JvmThreadInstanceTableMeta;
*/ */
public class JvmThreadingMetaImpl extends JvmThreadingMeta { public class JvmThreadingMetaImpl extends JvmThreadingMeta {
static final long serialVersionUID = -2104788458393251457L;
/** /**
* Constructor for the metadata associated to "JvmThreading". * Constructor for the metadata associated to "JvmThreading".
*/ */

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmClassesVerboseLevel extends Enumerated implements Serializable { public class EnumJvmClassesVerboseLevel extends Enumerated implements Serializable {
static final long serialVersionUID = -620710366914810374L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "verbose"); intTable.put(new Integer(2), "verbose");
intTable.put(new Integer(1), "silent"); intTable.put(new Integer(1), "silent");
@ -70,11 +71,11 @@ public class EnumJvmClassesVerboseLevel extends Enumerated implements Serializab
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer,String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String,Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmJITCompilerTimeMonitoring extends Enumerated implements Serializable { public class EnumJvmJITCompilerTimeMonitoring extends Enumerated implements Serializable {
static final long serialVersionUID = 3953565918146461236L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "supported"); intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported"); intTable.put(new Integer(1), "unsupported");
@ -70,11 +71,11 @@ public class EnumJvmJITCompilerTimeMonitoring extends Enumerated implements Seri
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer, String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String, Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,12 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmMemManagerState extends Enumerated implements Serializable { public class EnumJvmMemManagerState extends Enumerated implements Serializable {
static final long serialVersionUID = 8249515157795166343L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "valid"); intTable.put(new Integer(2), "valid");
intTable.put(new Integer(1), "invalid"); intTable.put(new Integer(1), "invalid");
@ -70,11 +72,11 @@ public class EnumJvmMemManagerState extends Enumerated implements Serializable {
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer, String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String, Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmMemPoolCollectThreshdSupport extends Enumerated implements Serializable { public class EnumJvmMemPoolCollectThreshdSupport extends Enumerated implements Serializable {
static final long serialVersionUID = 8610091819732806282L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "supported"); intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported"); intTable.put(new Integer(1), "unsupported");
@ -70,11 +71,11 @@ public class EnumJvmMemPoolCollectThreshdSupport extends Enumerated implements S
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer, String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String, Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmMemPoolState extends Enumerated implements Serializable { public class EnumJvmMemPoolState extends Enumerated implements Serializable {
static final long serialVersionUID = 3038175407527743027L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "valid"); intTable.put(new Integer(2), "valid");
intTable.put(new Integer(1), "invalid"); intTable.put(new Integer(1), "invalid");
@ -70,11 +71,11 @@ public class EnumJvmMemPoolState extends Enumerated implements Serializable {
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer,String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String,Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmMemPoolThreshdSupport extends Enumerated implements Serializable { public class EnumJvmMemPoolThreshdSupport extends Enumerated implements Serializable {
static final long serialVersionUID = 7014693561120661029L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "supported"); intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported"); intTable.put(new Integer(1), "unsupported");
@ -70,11 +71,11 @@ public class EnumJvmMemPoolThreshdSupport extends Enumerated implements Serializ
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer,String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String,Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmMemPoolType extends Enumerated implements Serializable { public class EnumJvmMemPoolType extends Enumerated implements Serializable {
static final long serialVersionUID = -7214498472962396555L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "heap"); intTable.put(new Integer(2), "heap");
intTable.put(new Integer(1), "nonheap"); intTable.put(new Integer(1), "nonheap");
@ -70,11 +71,11 @@ public class EnumJvmMemPoolType extends Enumerated implements Serializable {
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer,String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String,Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmMemoryGCCall extends Enumerated implements Serializable { public class EnumJvmMemoryGCCall extends Enumerated implements Serializable {
static final long serialVersionUID = -2869147994287351375L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "supported"); intTable.put(new Integer(2), "supported");
intTable.put(new Integer(5), "failed"); intTable.put(new Integer(5), "failed");
@ -76,11 +77,11 @@ public class EnumJvmMemoryGCCall extends Enumerated implements Serializable {
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer, String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String, Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmMemoryGCVerboseLevel extends Enumerated implements Serializable { public class EnumJvmMemoryGCVerboseLevel extends Enumerated implements Serializable {
static final long serialVersionUID = 1362427628755978190L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "verbose"); intTable.put(new Integer(2), "verbose");
intTable.put(new Integer(1), "silent"); intTable.put(new Integer(1), "silent");
@ -70,11 +71,11 @@ public class EnumJvmMemoryGCVerboseLevel extends Enumerated implements Serializa
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer,String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String,Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmRTBootClassPathSupport extends Enumerated implements Serializable { public class EnumJvmRTBootClassPathSupport extends Enumerated implements Serializable {
static final long serialVersionUID = -5957542680437939894L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(2), "supported"); intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported"); intTable.put(new Integer(1), "unsupported");
@ -70,11 +71,11 @@ public class EnumJvmRTBootClassPathSupport extends Enumerated implements Seriali
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer, String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String, Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmThreadContentionMonitoring extends Enumerated implements Serializable { public class EnumJvmThreadContentionMonitoring extends Enumerated implements Serializable {
static final long serialVersionUID = -6411827583604137210L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(3), "enabled"); intTable.put(new Integer(3), "enabled");
intTable.put(new Integer(4), "disabled"); intTable.put(new Integer(4), "disabled");
@ -72,11 +73,11 @@ public class EnumJvmThreadContentionMonitoring extends Enumerated implements Ser
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer,String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String,Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
*/ */
public class EnumJvmThreadCpuTimeMonitoring extends Enumerated implements Serializable { public class EnumJvmThreadCpuTimeMonitoring extends Enumerated implements Serializable {
static final long serialVersionUID = -532837824105215699L;
protected static Hashtable<Integer, String> intTable = protected static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>(); new Hashtable<>();
protected static Hashtable<String, Integer> stringTable = protected static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>(); new Hashtable<>();
static { static {
intTable.put(new Integer(3), "enabled"); intTable.put(new Integer(3), "enabled");
intTable.put(new Integer(4), "disabled"); intTable.put(new Integer(4), "disabled");
@ -72,11 +73,11 @@ public class EnumJvmThreadCpuTimeMonitoring extends Enumerated implements Serial
super(x); super(x);
} }
protected Hashtable getIntTable() { protected Hashtable<Integer,String> getIntTable() {
return intTable ; return intTable ;
} }
protected Hashtable getStringTable() { protected Hashtable<String,Integer> getStringTable() {
return stringTable ; return stringTable ;
} }

View File

@ -53,6 +53,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public abstract class JVM_MANAGEMENT_MIB extends SnmpMib implements Serializable { public abstract class JVM_MANAGEMENT_MIB extends SnmpMib implements Serializable {
static final long serialVersionUID = 6895037919735816732L;
/** /**
* Default constructor. Initialize the Mib tree. * Default constructor. Initialize the Mib tree.
*/ */

View File

@ -47,6 +47,7 @@ import com.sun.jmx.snmp.SnmpOidTableSupport;
*/ */
public class JVM_MANAGEMENT_MIBOidTable extends SnmpOidTableSupport implements Serializable { public class JVM_MANAGEMENT_MIBOidTable extends SnmpOidTableSupport implements Serializable {
static final long serialVersionUID = -5010870014488732061L;
/** /**
* Default constructor. Initialize the Mib tree. * Default constructor. Initialize the Mib tree.
*/ */

View File

@ -70,6 +70,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmClassLoadingMeta extends SnmpMibGroup public class JvmClassLoadingMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 5722857476941218568L;
/** /**
* Constructor for the metadata associated to "JvmClassLoading". * Constructor for the metadata associated to "JvmClassLoading".
*/ */

View File

@ -70,6 +70,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmCompilationMeta extends SnmpMibGroup public class JvmCompilationMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -95492874115033638L;
/** /**
* Constructor for the metadata associated to "JvmCompilation". * Constructor for the metadata associated to "JvmCompilation".
*/ */

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmMemGCEntryMeta extends SnmpMibEntry public class JvmMemGCEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 6082082529298387063L;
/** /**
* Constructor for the metadata associated to "JvmMemGCEntry". * Constructor for the metadata associated to "JvmMemGCEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmMemGCTableMeta extends SnmpMibTable implements Serializable { public class JvmMemGCTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -8843296871149264612L;
/** /**
* Constructor for the table. Initialize metadata for "JvmMemGCTableMeta". * Constructor for the table. Initialize metadata for "JvmMemGCTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmMemManagerEntryMeta extends SnmpMibEntry public class JvmMemManagerEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 8166956416408970453L;
/** /**
* Constructor for the metadata associated to "JvmMemManagerEntry". * Constructor for the metadata associated to "JvmMemManagerEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmMemManagerTableMeta extends SnmpMibTable implements Serializable { public class JvmMemManagerTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 5026520607518015233L;
/** /**
* Constructor for the table. Initialize metadata for "JvmMemManagerTableMeta". * Constructor for the table. Initialize metadata for "JvmMemManagerTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmMemMgrPoolRelEntryMeta extends SnmpMibEntry public class JvmMemMgrPoolRelEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 7414270971113459798L;
/** /**
* Constructor for the metadata associated to "JvmMemMgrPoolRelEntry". * Constructor for the metadata associated to "JvmMemMgrPoolRelEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmMemMgrPoolRelTableMeta extends SnmpMibTable implements Serializable { public class JvmMemMgrPoolRelTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -310733366542788998L;
/** /**
* Constructor for the table. Initialize metadata for "JvmMemMgrPoolRelTableMeta". * Constructor for the table. Initialize metadata for "JvmMemMgrPoolRelTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmMemPoolEntryMeta extends SnmpMibEntry public class JvmMemPoolEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 7220682779249102830L;
/** /**
* Constructor for the metadata associated to "JvmMemPoolEntry". * Constructor for the metadata associated to "JvmMemPoolEntry".
*/ */

View File

@ -68,6 +68,8 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmMemPoolTableMeta extends SnmpMibTable implements Serializable { public class JvmMemPoolTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -2799470815264898659L;
/** /**
* Constructor for the table. Initialize metadata for "JvmMemPoolTableMeta". * Constructor for the table. Initialize metadata for "JvmMemPoolTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -70,6 +70,8 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmOSMeta extends SnmpMibGroup public class JvmOSMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -2024138733580127133L;
/** /**
* Constructor for the metadata associated to "JvmOS". * Constructor for the metadata associated to "JvmOS".
*/ */

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmRTBootClassPathEntryMeta extends SnmpMibEntry public class JvmRTBootClassPathEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 7703840715080588941L;
/** /**
* Constructor for the metadata associated to "JvmRTBootClassPathEntry". * Constructor for the metadata associated to "JvmRTBootClassPathEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmRTBootClassPathTableMeta extends SnmpMibTable implements Serializable { public class JvmRTBootClassPathTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 42471379600792135L;
/** /**
* Constructor for the table. Initialize metadata for "JvmRTBootClassPathTableMeta". * Constructor for the table. Initialize metadata for "JvmRTBootClassPathTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmRTClassPathEntryMeta extends SnmpMibEntry public class JvmRTClassPathEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 3388703998226830801L;
/** /**
* Constructor for the metadata associated to "JvmRTClassPathEntry". * Constructor for the metadata associated to "JvmRTClassPathEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmRTClassPathTableMeta extends SnmpMibTable implements Serializable { public class JvmRTClassPathTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -1518727175345404443L;
/** /**
* Constructor for the table. Initialize metadata for "JvmRTClassPathTableMeta". * Constructor for the table. Initialize metadata for "JvmRTClassPathTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmRTInputArgsEntryMeta extends SnmpMibEntry public class JvmRTInputArgsEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -7729576810347358025L;
/** /**
* Constructor for the metadata associated to "JvmRTInputArgsEntry". * Constructor for the metadata associated to "JvmRTInputArgsEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmRTInputArgsTableMeta extends SnmpMibTable implements Serializable { public class JvmRTInputArgsTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 5395531763015738645L;
/** /**
* Constructor for the table. Initialize metadata for "JvmRTInputArgsTableMeta". * Constructor for the table. Initialize metadata for "JvmRTInputArgsTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmRTLibraryPathEntryMeta extends SnmpMibEntry public class JvmRTLibraryPathEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -5851555586263475792L;
/** /**
* Constructor for the metadata associated to "JvmRTLibraryPathEntry". * Constructor for the metadata associated to "JvmRTLibraryPathEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmRTLibraryPathTableMeta extends SnmpMibTable implements Serializable { public class JvmRTLibraryPathTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -632403620113109468L;
/** /**
* Constructor for the table. Initialize metadata for "JvmRTLibraryPathTableMeta". * Constructor for the table. Initialize metadata for "JvmRTLibraryPathTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -70,6 +70,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmRuntimeMeta extends SnmpMibGroup public class JvmRuntimeMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 1994595220765880109L;
/** /**
* Constructor for the metadata associated to "JvmRuntime". * Constructor for the metadata associated to "JvmRuntime".
*/ */

View File

@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmThreadInstanceEntryMeta extends SnmpMibEntry public class JvmThreadInstanceEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -2015330111801477399L;
/** /**
* Constructor for the metadata associated to "JvmThreadInstanceEntry". * Constructor for the metadata associated to "JvmThreadInstanceEntry".
*/ */

View File

@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
*/ */
public class JvmThreadInstanceTableMeta extends SnmpMibTable implements Serializable { public class JvmThreadInstanceTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 2519514732589115954L;
/** /**
* Constructor for the table. Initialize metadata for "JvmThreadInstanceTableMeta". * Constructor for the table. Initialize metadata for "JvmThreadInstanceTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.

View File

@ -70,6 +70,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
public class JvmThreadingMeta extends SnmpMibGroup public class JvmThreadingMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer { implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 5223833578005322854L;
/** /**
* Constructor for the metadata associated to "JvmThreading". * Constructor for the metadata associated to "JvmThreading".
*/ */

View File

@ -32,7 +32,7 @@ public class MibLogger {
final Logger logger; final Logger logger;
final String className; final String className;
static String getClassName(Class clazz) { static String getClassName(Class<?> clazz) {
if (clazz == null) return null; if (clazz == null) return null;
if (clazz.isArray()) if (clazz.isArray())
return getClassName(clazz.getComponentType()) + "[]"; return getClassName(clazz.getComponentType()) + "[]";
@ -44,7 +44,7 @@ public class MibLogger {
else return fullname.substring(lastpoint+1,len); else return fullname.substring(lastpoint+1,len);
} }
static String getLoggerName(Class clazz) { static String getLoggerName(Class<?> clazz) {
if (clazz == null) return "sun.management.snmp.jvminstr"; if (clazz == null) return "sun.management.snmp.jvminstr";
Package p = clazz.getPackage(); Package p = clazz.getPackage();
if (p == null) return "sun.management.snmp.jvminstr"; if (p == null) return "sun.management.snmp.jvminstr";
@ -53,11 +53,11 @@ public class MibLogger {
else return pname; else return pname;
} }
public MibLogger(Class clazz) { public MibLogger(Class<?> clazz) {
this(getLoggerName(clazz),getClassName(clazz)); this(getLoggerName(clazz),getClassName(clazz));
} }
public MibLogger(Class clazz, String postfix) { public MibLogger(Class<?> clazz, String postfix) {
this(getLoggerName(clazz)+((postfix==null)?"":"."+postfix), this(getLoggerName(clazz)+((postfix==null)?"":"."+postfix),
getClassName(clazz)); getClassName(clazz));
} }

View File

@ -59,7 +59,7 @@ public abstract class SnmpListTableCache extends SnmpTableCache {
* <var>rawDatas</var> list iterator. * <var>rawDatas</var> list iterator.
* @param item The raw data object for which an index must be determined. * @param item The raw data object for which an index must be determined.
**/ **/
protected abstract SnmpOid getIndex(Object context, List rawDatas, protected abstract SnmpOid getIndex(Object context, List<?> rawDatas,
int rank, Object item); int rank, Object item);
/** /**
@ -75,7 +75,7 @@ public abstract class SnmpListTableCache extends SnmpTableCache {
* extracted. * extracted.
* @return By default <var>item</var> is returned. * @return By default <var>item</var> is returned.
**/ **/
protected Object getData(Object context, List rawDatas, protected Object getData(Object context, List<?> rawDatas,
int rank, Object item) { int rank, Object item) {
return item; return item;
} }
@ -95,14 +95,14 @@ public abstract class SnmpListTableCache extends SnmpTableCache {
* computed. * computed.
* @return the computed cached data. * @return the computed cached data.
**/ **/
protected SnmpCachedData updateCachedDatas(Object context, List rawDatas) { protected SnmpCachedData updateCachedDatas(Object context, List<?> rawDatas) {
final int size = ((rawDatas == null)?0:rawDatas.size()); final int size = ((rawDatas == null)?0:rawDatas.size());
if (size == 0) return null; if (size == 0) return null;
final long time = System.currentTimeMillis(); final long time = System.currentTimeMillis();
final Iterator it = rawDatas.iterator(); final Iterator<?> it = rawDatas.iterator();
final TreeMap<SnmpOid, Object> map = final TreeMap<SnmpOid, Object> map =
new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator); new TreeMap<>(SnmpCachedData.oidComparator);
for (int rank=0; it.hasNext() ; rank++) { for (int rank=0; it.hasNext() ; rank++) {
final Object item = it.next(); final Object item = it.next();
final SnmpOid index = getIndex(context, rawDatas, rank, item); final SnmpOid index = getIndex(context, rawDatas, rank, item);

View File

@ -55,7 +55,7 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
* This map associate an entry name with the SnmpOid index that's * This map associate an entry name with the SnmpOid index that's
* been allocated for it. * been allocated for it.
**/ **/
protected TreeMap names = new TreeMap(); protected TreeMap<String, SnmpOid> names = new TreeMap<>();
/** /**
* The last allocate index. * The last allocate index.
@ -80,7 +80,7 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
* <var>rawDatas</var> list iterator. * <var>rawDatas</var> list iterator.
* @param item The raw data object for which a key name must be determined. * @param item The raw data object for which a key name must be determined.
**/ **/
protected abstract String getKey(Object context, List rawDatas, protected abstract String getKey(Object context, List<?> rawDatas,
int rank, Object item); int rank, Object item);
/** /**
@ -97,7 +97,7 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
* <var>rawDatas</var> list iterator. * <var>rawDatas</var> list iterator.
* @param item The raw data object for which an index must be determined. * @param item The raw data object for which an index must be determined.
**/ **/
protected SnmpOid makeIndex(Object context, List rawDatas, protected SnmpOid makeIndex(Object context, List<?> rawDatas,
int rank, Object item) { int rank, Object item) {
// check we are in the limits of an unsigned32. // check we are in the limits of an unsigned32.
@ -151,7 +151,7 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
* <var>rawDatas</var> list iterator. * <var>rawDatas</var> list iterator.
* @param item The raw data object for which an index must be determined. * @param item The raw data object for which an index must be determined.
**/ **/
protected SnmpOid getIndex(Object context, List rawDatas, protected SnmpOid getIndex(Object context, List<?> rawDatas,
int rank, Object item) { int rank, Object item) {
final String key = getKey(context,rawDatas,rank,item); final String key = getKey(context,rawDatas,rank,item);
final Object index = (names==null||key==null)?null:names.get(key); final Object index = (names==null||key==null)?null:names.get(key);
@ -174,8 +174,8 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
* @param rawDatas The table datas from which the cached data will be * @param rawDatas The table datas from which the cached data will be
* computed. * computed.
**/ **/
protected SnmpCachedData updateCachedDatas(Object context, List rawDatas) { protected SnmpCachedData updateCachedDatas(Object context, List<?> rawDatas) {
TreeMap ctxt = new TreeMap(); TreeMap<String,SnmpOid> ctxt = new TreeMap<>();
final SnmpCachedData result = final SnmpCachedData result =
super.updateCachedDatas(context,rawDatas); super.updateCachedDatas(context,rawDatas);
names = ctxt; names = ctxt;
@ -191,7 +191,7 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
* the {@link JvmContextFactory}. * the {@link JvmContextFactory}.
* *
**/ **/
protected abstract List loadRawDatas(Map userData); protected abstract List<?> loadRawDatas(Map<Object,Object> userData);
/** /**
*The name under which the raw data is to be found/put in *The name under which the raw data is to be found/put in
@ -212,16 +212,16 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
* the request contextual cache. * the request contextual cache.
* *
**/ **/
protected List getRawDatas(Map<Object, Object> userData, String key) { protected List<?> getRawDatas(Map<Object, Object> userData, String key) {
List rawDatas = null; List<?> rawDatas = null;
// Look for memory manager list in request contextual cache. // Look for memory manager list in request contextual cache.
if (userData != null) if (userData != null)
rawDatas = (List) userData.get(key); rawDatas = (List<?>)userData.get(key);
if (rawDatas == null) { if (rawDatas == null) {
// No list in contextual cache, get it from API // No list in contextual cache, get it from API
rawDatas = loadRawDatas(userData); rawDatas = loadRawDatas(userData);
// Put list in cache... // Put list in cache...
@ -250,12 +250,12 @@ public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
(context instanceof Map)?Util.<Map<Object, Object>>cast(context):null; (context instanceof Map)?Util.<Map<Object, Object>>cast(context):null;
// Look for memory manager list in request contextual cache. // Look for memory manager list in request contextual cache.
final List rawDatas = getRawDatas(userData,getRawDatasKey()); final List<?> rawDatas = getRawDatas(userData,getRawDatasKey());
log.debug("updateCachedDatas","rawDatas.size()=" + log.debug("updateCachedDatas","rawDatas.size()=" +
((rawDatas==null)?"<no data>":""+rawDatas.size())); ((rawDatas==null)?"<no data>":""+rawDatas.size()));
TreeMap ctxt = new TreeMap(); TreeMap<String,SnmpOid> ctxt = new TreeMap<>();
final SnmpCachedData result = final SnmpCachedData result =
super.updateCachedDatas(ctxt,rawDatas); super.updateCachedDatas(ctxt,rawDatas);
names = ctxt; names = ctxt;

View File

@ -98,7 +98,7 @@ public abstract class SnmpTableCache implements Serializable {
final SnmpCachedData cached = getCachedDatas(); final SnmpCachedData cached = getCachedDatas();
if (cached != null) return cached; if (cached != null) return cached;
final SnmpCachedData computedDatas = updateCachedDatas(context); final SnmpCachedData computedDatas = updateCachedDatas(context);
if (validity != 0) datas = new WeakReference<SnmpCachedData>(computedDatas); if (validity != 0) datas = new WeakReference<>(computedDatas);
return computedDatas; return computedDatas;
} }

View File

@ -168,7 +168,7 @@ public class VM {
// //
// The initial value of this field is arbitrary; during JRE initialization // The initial value of this field is arbitrary; during JRE initialization
// it will be reset to the value specified on the command line, if any, // it will be reset to the value specified on the command line, if any,
// otherwise to Runtime.getRuntime.maxDirectMemory(). // otherwise to Runtime.getRuntime().maxMemory().
// //
private static long directMemory = 64 * 1024 * 1024; private static long directMemory = 64 * 1024 * 1024;

View File

@ -47,8 +47,6 @@ public class HttpClient extends NetworkClient {
private boolean inCache; private boolean inCache;
protected CookieHandler cookieHandler;
// Http requests we send // Http requests we send
MessageHeader requests; MessageHeader requests;
@ -201,14 +199,6 @@ public class HttpClient extends NetworkClient {
} }
setConnectTimeout(to); setConnectTimeout(to);
// get the cookieHandler if there is any
cookieHandler = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<CookieHandler>() {
public CookieHandler run() {
return CookieHandler.getDefault();
}
});
capture = HttpCapture.getCapture(url); capture = HttpCapture.getCapture(url);
openServer(); openServer();
} }
@ -656,6 +646,7 @@ public class HttpClient extends NetworkClient {
// we've finished parsing http headers // we've finished parsing http headers
// check if there are any applicable cookies to set (in cache) // check if there are any applicable cookies to set (in cache)
CookieHandler cookieHandler = httpuc.getCookieHandler();
if (cookieHandler != null) { if (cookieHandler != null) {
URI uri = ParseUtil.toURI(url); URI uri = ParseUtil.toURI(url);
// NOTE: That cast from Map shouldn't be necessary but // NOTE: That cast from Map shouldn't be necessary but

Some files were not shown because too many files have changed in this diff Show More