提交 09226860 编写于 作者: L lana

Merge

......@@ -188,3 +188,5 @@ f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63
26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64
130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65
4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66
ce9b02a3a17edd1983201002cfa0f364e4ab7524 jdk8-b67
53fb43e4d614c92310e1fb00ec41d1960fd9facf jdk8-b68
......@@ -35,7 +35,7 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = auth
SUBDIRS_misc = jgss sasl auth/module
SUBDIRS_misc = jgss sasl auth/module ntlm
include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber::
......
#
# 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.sun.security.ntlm
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = com/sun/security/ntlm
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk
......@@ -131,6 +131,7 @@ CORE_PKGS = \
java.util.concurrent \
java.util.concurrent.atomic \
java.util.concurrent.locks \
java.util.function \
java.util.jar \
java.util.logging \
java.util.prefs \
......
......@@ -147,6 +147,7 @@ JAVA_JAVA_java = \
java/lang/ref/PhantomReference.java \
java/lang/ref/ReferenceQueue.java \
java/lang/ref/Finalizer.java \
java/util/Base64.java \
java/util/BitSet.java \
java/util/Calendar.java \
java/util/GregorianCalendar.java \
......
......@@ -37,6 +37,8 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
JAVAC_MAX_WARNINGS=true
include $(BUILDDIR)/common/Defs.gmk
AUTO_FILES_JAVA_DIRS = java/util/function
# windows compiler flags
ifeq ($(PLATFORM),windows)
OTHER_CFLAGS =
......
......@@ -77,6 +77,7 @@ ifeq ($(PLATFORM), windows)
FILES_export += java/net/DualStackPlainSocketImpl.java
FILES_export += java/net/TwoStacksPlainDatagramSocketImpl.java
FILES_export += java/net/DualStackPlainDatagramSocketImpl.java
FILES_export += sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
else
FILES_export += java/net/PlainDatagramSocketImpl.java
endif
......
......@@ -69,6 +69,7 @@ FILES_java += \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/MimeTypesFileTypeDetector.java \
sun/nio/fs/PollingWatchService.java \
sun/nio/fs/SolarisAclFileAttributeView.java \
sun/nio/fs/SolarisFileStore.java \
......@@ -202,6 +203,8 @@ FILES_java += \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/MagicFileTypeDetector.java \
sun/nio/fs/MimeTypesFileTypeDetector.java \
sun/nio/fs/LinuxDosFileAttributeView.java \
sun/nio/fs/LinuxFileStore.java \
sun/nio/fs/LinuxFileSystem.java \
......@@ -239,6 +242,7 @@ FILES_c += \
UnixAsynchronousSocketChannelImpl.c \
\
GnomeFileTypeDetector.c \
MagicFileTypeDetector.c \
LinuxNativeDispatcher.c \
LinuxWatchService.c \
UnixCopyFile.c \
......@@ -254,6 +258,7 @@ FILES_export += \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/MagicFileTypeDetector.java \
sun/nio/fs/LinuxNativeDispatcher.java \
sun/nio/fs/LinuxWatchService.java \
sun/nio/fs/UnixCopyFile.java \
......@@ -277,6 +282,7 @@ FILES_java += \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/MimeTypesFileTypeDetector.java \
sun/nio/fs/BsdFileStore.java \
sun/nio/fs/BsdFileSystem.java \
sun/nio/fs/BsdFileSystemProvider.java \
......
......@@ -130,6 +130,8 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
Java_sun_nio_fs_LinuxWatchService_eventSize;
Java_sun_nio_fs_LinuxWatchService_eventOffsets;
Java_sun_nio_fs_LinuxWatchService_inotifyInit;
......
......@@ -40,7 +40,8 @@ AUTO_FILES_JAVA_DIRS = java/security
# Directories
#
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security
# The default security properties file is for linux
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-linux
ifeq ($(PLATFORM), solaris)
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris
......
......@@ -86,7 +86,6 @@ jprt.make.rule.core.test.targets= \
${jprt.my.test.target.set:TESTNAME=jdk_jmx}, \
${jprt.my.test.target.set:TESTNAME=jdk_text}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools}, \
${jprt.my.test.target.set:TESTNAME=jdk_jdi}, \
${jprt.my.test.target.set:TESTNAME=jdk_jfr}, \
${jprt.my.test.target.set:TESTNAME=jdk_other}
......@@ -103,6 +102,7 @@ jprt.make.rule.all.test.targets= \
${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \
${jprt.my.test.target.set:TESTNAME=jdk_jdi}, \
${jprt.my.test.target.set:TESTNAME=jdk_sound}, \
${jprt.my.test.target.set:TESTNAME=jdk_swing}
......
......@@ -38,10 +38,12 @@ SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk
# build sun/security/jgss/wrapper on non-windows platform
# build sun/security/jgss/wrapper on non-windows non-macosx platforms
JGSS_WRAPPER =
ifneq ($(PLATFORM), windows)
JGSS_WRAPPER = jgss/wrapper
ifneq ($(PLATFORM), macosx)
JGSS_WRAPPER = jgss/wrapper
endif
endif
# Build PKCS#11 on all platforms
......
......@@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -86,7 +87,23 @@ class Bundle {
private final static String[] ERA_KEYS = {
"long.Eras",
"Eras",
"short.Eras"
"narrow.Eras"
};
// Keys for individual time zone names
private final static String TZ_GEN_LONG_KEY = "timezone.displayname.generic.long";
private final static String TZ_GEN_SHORT_KEY = "timezone.displayname.generic.short";
private final static String TZ_STD_LONG_KEY = "timezone.displayname.standard.long";
private final static String TZ_STD_SHORT_KEY = "timezone.displayname.standard.short";
private final static String TZ_DST_LONG_KEY = "timezone.displayname.daylight.long";
private final static String TZ_DST_SHORT_KEY = "timezone.displayname.daylight.short";
private final static String[] ZONE_NAME_KEYS = {
TZ_STD_LONG_KEY,
TZ_STD_SHORT_KEY,
TZ_DST_LONG_KEY,
TZ_DST_SHORT_KEY,
TZ_GEN_LONG_KEY,
TZ_GEN_SHORT_KEY
};
private final String id;
......@@ -98,6 +115,7 @@ class Bundle {
return bundles.get(id);
}
@SuppressWarnings("ConvertToStringSwitch")
Bundle(String id, String cldrPath, String bundles, String currencies) {
this.id = id;
this.cldrPath = cldrPath;
......@@ -242,9 +260,12 @@ class Bundle {
// handle multiple inheritance for month and day names
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNarrows");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNarrows");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "narrow.AmPmMarkers");
adjustEraNames(myMap, calendarType);
......@@ -253,6 +274,99 @@ class Bundle {
handleDateTimeFormatPatterns(DATETIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "DateTimePatterns");
}
// if myMap has any empty timezone or metazone names, weed out them.
// Fill in any missing abbreviations if locale is "en".
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)
|| key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
@SuppressWarnings("unchecked")
Map<String, String> nameMap = (Map<String, String>) myMap.get(key);
if (nameMap.isEmpty()) {
// Some zones have only exemplarCity, which become empty.
// Remove those from the map.
it.remove();
continue;
}
if (id.startsWith("en")) {
fillInAbbrs(key, nameMap);
}
}
}
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)
|| key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
@SuppressWarnings("unchecked")
Map<String, String> nameMap = (Map<String, String>) myMap.get(key);
// Convert key/value pairs to an array.
String[] names = new String[ZONE_NAME_KEYS.length];
int ix = 0;
for (String nameKey : ZONE_NAME_KEYS) {
String name = nameMap.get(nameKey);
if (name == null) {
@SuppressWarnings("unchecked")
Map<String, String> parentNames = (Map<String, String>) parentsMap.get(key);
if (parentNames != null) {
name = parentNames.get(nameKey);
}
}
names[ix++] = name;
}
if (hasNulls(names)) {
String metaKey = toMetaZoneKey(key);
if (metaKey != null) {
Object obj = myMap.get(metaKey);
if (obj instanceof String[]) {
String[] metaNames = (String[]) obj;
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = metaNames[i];
}
}
} else if (obj instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, String> m = (Map<String, String>) obj;
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = m.get(ZONE_NAME_KEYS[i]);
}
}
}
}
// If there are still any nulls, try filling in them from en data.
if (hasNulls(names) && !id.equals("en")) {
@SuppressWarnings("unchecked")
String[] enNames = (String[]) Bundle.getBundle("en").getTargetMap().get(key);
if (enNames == null) {
if (metaKey != null) {
@SuppressWarnings("unchecked")
String[] metaNames = (String[]) Bundle.getBundle("en").getTargetMap().get(metaKey);
enNames = metaNames;
}
}
if (enNames != null) {
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = enNames[i];
}
}
}
// If there are still nulls, give up names.
if (hasNulls(names)) {
names = null;
}
}
}
// replace the Map with the array
if (names != null) {
myMap.put(key, names);
} else {
it.remove();
}
}
}
return myMap;
}
......@@ -352,20 +466,10 @@ class Bundle {
realKeys[index] = realKey;
eraNames[index++] = value;
}
if (eraNames[0] != null) {
if (eraNames[1] != null) {
if (eraNames[2] == null) {
// Eras -> short.Eras
// long.Eras -> Eras
map.put(realKeys[2], map.get(realKeys[1]));
map.put(realKeys[1], map.get(realKeys[0]));
}
} else {
// long.Eras -> Eras
map.put(realKeys[1], map.get(realKeys[0]));
for (int i = 0; i < eraNames.length; i++) {
if (eraNames[i] == null) {
map.put(realKeys[i], null);
}
// remove long.Eras
map.remove(realKeys[0]);
}
}
......@@ -473,6 +577,86 @@ class Bundle {
return jrePattern.toString();
}
private String toMetaZoneKey(String tzKey) {
if (tzKey.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)) {
String tz = tzKey.substring(CLDRConverter.TIMEZONE_ID_PREFIX.length());
String meta = CLDRConverter.handlerMetaZones.get(tz);
if (meta != null) {
return CLDRConverter.METAZONE_ID_PREFIX + meta;
}
}
return null;
}
private void fillInAbbrs(String key, Map<String, String> map) {
fillInAbbrs(TZ_STD_LONG_KEY, TZ_STD_SHORT_KEY, map);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
// If the standard std is "Standard Time" and daylight std is "Summer Time",
// replace the standard std with the generic std to avoid using
// the same abbrivation except for Australia time zone names.
String std = map.get(TZ_STD_SHORT_KEY);
String dst = map.get(TZ_DST_SHORT_KEY);
String gen = map.get(TZ_GEN_SHORT_KEY);
if (std != null) {
if (dst == null) {
// if dst is null, create long and short names from the standard
// std. ("Something Standard Time" to "Something Daylight Time",
// or "Something Time" to "Something Summer Time")
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.contains("Standard Time")) {
name = name.replace("Standard Time", "Daylight Time");
} else if (name.endsWith("Mean Time")) {
name = name.replace("Mean Time", "Summer Time");
} else if (name.endsWith(" Time")) {
name = name.replace(" Time", " Summer Time");
}
map.put(TZ_DST_LONG_KEY, name);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
}
}
if (gen == null) {
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.endsWith("Standard Time")) {
name = name.replace("Standard Time", "Time");
} else if (name.endsWith("Mean Time")) {
name = name.replace("Mean Time", "Time");
}
map.put(TZ_GEN_LONG_KEY, name);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
}
}
}
}
private void fillInAbbrs(String longKey, String shortKey, Map<String, String> map) {
String abbr = map.get(shortKey);
if (abbr == null) {
String name = map.get(longKey);
if (name != null) {
abbr = toAbbr(name);
if (abbr != null) {
map.put(shortKey, abbr);
}
}
}
}
private String toAbbr(String name) {
String[] substrs = name.split("\\s+");
StringBuilder sb = new StringBuilder();
for (String s : substrs) {
char c = s.charAt(0);
if (c >= 'A' && c <= 'Z') {
sb.append(c);
}
}
return sb.length() > 0 ? sb.toString() : null;
}
private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {
case 'G':
......@@ -539,4 +723,13 @@ class Bundle {
sb.append(c);
}
}
private static boolean hasNulls(Object[] array) {
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
return true;
}
}
return false;
}
}
......@@ -30,8 +30,27 @@ import java.util.Map;
import java.util.SortedSet;
public interface BundleGenerator {
static enum BundleType {
PLAIN("java.util.ListResourceBundle"),
OPEN("sun.util.resources.OpenListResourceBundle"),
TIMEZONE("sun.util.resources.TimeZoneNamesBundle");
private final String pathName, className;
private BundleType(String name) {
pathName = name;
int x = name.lastIndexOf('.');
className = name.substring(x + 1);
}
String getPathName() {
return pathName;
}
String getClassName() {
return className;
}
};
public void generateBundle(String packageName, String baseName, String localeID,
boolean useJava, Map<String, ?> map, boolean open) throws IOException;
boolean useJava, Map<String, ?> map, BundleType type) throws IOException;
public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException;
}
......@@ -25,6 +25,7 @@
package build.tools.cldrconverter;
import build.tools.cldrconverter.BundleGenerator.BundleType;
import java.io.File;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
......@@ -58,9 +59,8 @@ public class CLDRConverter {
static final String CURRENCY_SYMBOL_PREFIX = "currency.symbol.";
static final String CURRENCY_NAME_PREFIX = "currency.displayname.";
static final String TIMEZONE_ID_PREFIX = "timezone.id.";
static final String TIMEZONE_NAME_PREFIX = "timezone.displayname.";
static final String ZONE_NAME_PREFIX = "timezone.displayname.";
static final String METAZONE_ID_PREFIX = "metazone.id.";
static final String METAZONE_NAME_PREFIX = "metazone.displayname.";
private static SupplementDataParseHandler handlerSuppl;
static NumberingSystemsParseHandler handlerNumbering;
......@@ -236,7 +236,14 @@ public class CLDRConverter {
if (sb.indexOf("root") == -1) {
sb.append("root");
}
retList.add(new Bundle(id, sb.toString(), null, null));
Bundle b = new Bundle(id, sb.toString(), null, null);
// Insert the bundle for en at the top so that it will get
// processed first.
if ("en".equals(id)) {
retList.add(0, b);
} else {
retList.add(b);
}
}
}
}
......@@ -312,6 +319,7 @@ public class CLDRConverter {
Map<String, SortedSet<String>> metaInfo = new HashMap<>();
metaInfo.put("LocaleNames", new TreeSet<String>());
metaInfo.put("CurrencyNames", new TreeSet<String>());
metaInfo.put("TimeZoneNames", new TreeSet<String>());
metaInfo.put("CalendarData", new TreeSet<String>());
metaInfo.put("FormatData", new TreeSet<String>());
......@@ -348,24 +356,28 @@ public class CLDRConverter {
Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, bundle.getID());
if (!localeNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, true);
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) {
Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies());
if (!currencyNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, true);
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) {
Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, bundle.getID());
if (!zoneNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("TimeZoneNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getID(), true, zoneNamesMap, BundleType.TIMEZONE);
}
}
if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) {
Map<String, Object> calendarDataMap = extractCalendarData(targetMap, bundle.getID());
if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, false);
bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN);
}
}
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
......@@ -373,9 +385,10 @@ public class CLDRConverter {
// LocaleData.getAvailableLocales depends on having FormatData bundles around
if (!formatDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, false);
bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
}
}
// For testing
SortedSet<String> allLocales = new TreeSet<>();
allLocales.addAll(metaInfo.get("CurrencyNames"));
......@@ -431,6 +444,7 @@ public class CLDRConverter {
private KeyComparator() {
}
@Override
public int compare(String o1, String o2) {
int len1 = o1.length();
int len2 = o2.length();
......@@ -476,7 +490,26 @@ public class CLDRConverter {
}
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
return null;
Map<String, Object> names = new HashMap<>();
for (String tzid : handlerMetaZones.keySet()) {
String tzKey = TIMEZONE_ID_PREFIX + tzid;
Object data = map.get(tzKey);
if (data instanceof String[]) {
names.put(tzid, data);
} else {
String meta = handlerMetaZones.get(tzid);
if (meta != null) {
String metaKey = METAZONE_ID_PREFIX + meta;
data = map.get(metaKey);
if (data instanceof String[]) {
// Keep the metazone prefix here.
names.put(metaKey, data);
names.put(tzid, meta);
}
}
}
}
return names;
}
private static Map<String, Object> extractCalendarData(Map<String, Object> map, String id) {
......@@ -494,11 +527,19 @@ public class CLDRConverter {
copyIfPresent(map, prefix + "standalone.MonthNames", formatData);
copyIfPresent(map, prefix + "MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "standalone.MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "MonthNarrow", formatData);
copyIfPresent(map, prefix + "standalone.MonthNarrows", formatData);
copyIfPresent(map, prefix + "DayNames", formatData);
copyIfPresent(map, prefix + "standalone.DayNames", formatData);
copyIfPresent(map, prefix + "DayAbbreviations", formatData);
copyIfPresent(map, prefix + "standalone.DayAbbreviations", formatData);
copyIfPresent(map, prefix + "DayNarrows", formatData);
copyIfPresent(map, prefix + "standalone.DayNarrows", formatData);
copyIfPresent(map, prefix + "AmPmMarkers", formatData);
copyIfPresent(map, prefix + "narrow.AmPmMarkers", formatData);
copyIfPresent(map, prefix + "long.Eras", formatData);
copyIfPresent(map, prefix + "Eras", formatData);
copyIfPresent(map, prefix + "short.Eras", formatData);
copyIfPresent(map, prefix + "narrow.Eras", formatData);
copyIfPresent(map, prefix + "TimePatterns", formatData);
copyIfPresent(map, prefix + "DatePatterns", formatData);
copyIfPresent(map, prefix + "DateTimePatterns", formatData);
......@@ -560,7 +601,6 @@ public class CLDRConverter {
if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
outBuffer.append(' ');
break;
case '\\':
......@@ -584,7 +624,7 @@ public class CLDRConverter {
outBuffer.append('f');
break;
default:
if (!USE_UTF8 && ((aChar < 0x0020) || (aChar > 0x007e))) {
if (aChar < 0x0020 || (!USE_UTF8 && aChar > 0x007e)) {
formatter.format("\\u%04x", (int)aChar);
} else {
if (specialSaveChars.indexOf(aChar) != -1) {
......
......@@ -155,6 +155,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13);
break;
case "narrow":
pushStringArrayEntry(qName, attributes, prefix + "MonthNarrows/" + getContainerKey(), 13);
break;
default:
pushIgnoredContainer(qName);
break;
......@@ -191,6 +194,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7);
break;
case "narrow":
pushStringArrayEntry(qName, attributes, prefix + "DayNarrows/" + getContainerKey(), 7);
break;
default:
pushIgnoredContainer(qName);
break;
......@@ -219,25 +225,36 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "dayPeriodWidth":
// for FormatData
// create string array entry for am/pm. only keeping wide
if ("wide".equals(attributes.getValue("type"))) {
switch (attributes.getValue("type")) {
case "wide":
pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2);
} else {
break;
case "narrow":
pushStringArrayEntry(qName, attributes, "narrow.AmPmMarkers/" + getContainerKey(), 2);
break;
default:
pushIgnoredContainer(qName);
break;
}
break;
case "dayPeriod":
// for FormatData
// add to string array entry of AmPmMarkers element
switch (attributes.getValue("type")) {
case "am":
pushStringArrayElement(qName, attributes, 0);
break;
case "pm":
pushStringArrayElement(qName, attributes, 1);
break;
default:
if (attributes.getValue("alt") == null) {
switch (attributes.getValue("type")) {
case "am":
pushStringArrayElement(qName, attributes, 0);
break;
case "pm":
pushStringArrayElement(qName, attributes, 1);
break;
default:
pushIgnoredContainer(qName);
break;
}
} else {
// discard alt values
pushIgnoredContainer(qName);
break;
}
break;
case "eraNames":
......@@ -269,7 +286,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
assert currentContainer instanceof IgnoredContainer;
pushIgnoredContainer(qName);
} else {
String key = currentCalendarType.keyElementName() + "short.Eras";
String key = currentCalendarType.keyElementName() + "narrow.Eras";
pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
}
break;
......@@ -301,15 +318,15 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
break;
case "zone":
{
String zone = attributes.getValue("type");
String tzid = attributes.getValue("type"); // Olson tz id
zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone);
put(zonePrefix + tzid, new HashMap<String, String>());
pushKeyContainer(qName, attributes, tzid);
}
break;
case "metazone":
{
String zone = attributes.getValue("type");
String zone = attributes.getValue("type"); // LDML meta zone id
zonePrefix = CLDRConverter.METAZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone);
......@@ -323,16 +340,12 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
zoneNameStyle = "short";
pushContainer(qName, attributes);
break;
case "generic": // not used in JDK
pushIgnoredContainer(qName);
break;
case "standard": // standard time
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle);
break;
case "daylight":
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle);
case "generic": // generic name
case "standard": // standard time name
case "daylight": // daylight saving (summer) time name
pushStringEntry(qName, attributes, CLDRConverter.ZONE_NAME_PREFIX + qName + "." + zoneNameStyle);
break;
case "exemplarCity":
case "exemplarCity": // not used in JDK
pushIgnoredContainer(qName);
break;
......@@ -530,6 +543,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "timeZoneNames":
zonePrefix = null;
break;
case "generic":
case "standard":
case "daylight":
if (zonePrefix != null && (currentContainer instanceof Entry)) {
......
......@@ -46,8 +46,9 @@ class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
return null;
}
// metaZone: ID -> metazone
// per locale: ID -> names, metazone -> names
@Override
@SuppressWarnings("fallthrough")
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "timezone":
......
......@@ -28,14 +28,16 @@ package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Formatter;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
class ResourceBundleGenerator implements BundleGenerator {
@Override
public void generateBundle(String packageName, String baseName, String localeID, boolean useJava,
Map<String, ?> map, boolean open) throws IOException {
Map<String, ?> map, BundleType type) throws IOException {
String suffix = useJava ? ".java" : ".properties";
String lang = CLDRConverter.getLanguageCode(localeID);
String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator
......@@ -67,6 +69,28 @@ class ResourceBundleGenerator implements BundleGenerator {
encoding = "iso-8859-1";
}
Formatter fmt = null;
if (type == BundleType.TIMEZONE) {
fmt = new Formatter();
Set<String> metaKeys = new HashSet<>();
for (String key : map.keySet()) {
if (key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
String meta = key.substring(CLDRConverter.METAZONE_ID_PREFIX.length());
String[] value;
value = (String[]) map.get(key);
fmt.format(" final String[] %s = new String[] {\n", meta);
for (String s : value) {
fmt.format(" \"%s\",\n", CLDRConverter.saveConvert(s, useJava));
}
fmt.format(" };\n");
metaKeys.add(key);
}
}
for (String key : metaKeys) {
map.remove(key);
}
}
try (PrintWriter out = new PrintWriter(file, encoding)) {
// Output copyright headers
out.println(CopyrightHeaders.getOpenJDKCopyright());
......@@ -74,16 +98,15 @@ class ResourceBundleGenerator implements BundleGenerator {
if (useJava) {
out.println("package sun." + packageName + ";\n");
if (open) {
out.println("import sun.util.resources.OpenListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends OpenListResourceBundle {");
} else {
out.println("import java.util.ListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends ListResourceBundle {");
}
out.printf("import %s;\n\n", type.getPathName());
out.printf("public class %s%s extends %s {\n", baseName, "root".equals(localeID) ? "" : "_" + localeID, type.getClassName());
out.println(" @Override\n" +
" protected final Object[][] getContents() {\n" +
" final Object[][] data = new Object[][] {");
" protected final Object[][] getContents() {");
if (fmt != null) {
out.print(fmt.toString());
}
out.println(" final Object[][] data = new Object[][] {");
}
for (String key : map.keySet()) {
if (useJava) {
......@@ -91,7 +114,11 @@ class ResourceBundleGenerator implements BundleGenerator {
if (value == null) {
CLDRConverter.warning("null value for " + key);
} else if (value instanceof String) {
out.println(" { \"" + key + "\", \"" + CLDRConverter.saveConvert((String) value, useJava) + "\" },");
if (type == BundleType.TIMEZONE) {
out.printf(" { \"%s\", %s },\n", key, CLDRConverter.saveConvert((String) value, useJava));
} else {
out.printf(" { \"%s\", \"%s\" },\n", key, CLDRConverter.saveConvert((String) value, useJava));
}
} else if (value instanceof String[]) {
String[] values = (String[]) value;
out.println(" { \"" + key + "\",\n new String[] {");
......
......@@ -194,15 +194,6 @@ endif
##################################################################################################
# Why do we install a demo jar into the main jre/lib/ext????????????????
$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
$(MKDIR) -p $(@D)
$(CP) $< $@
BUILD_DEMOS += $(JDK_OUTPUTDIR)/lib/ext/zipfs.jar
##################################################################################################
# In the old makefiles, j2dbench was not compiled.
#$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench))
......
......@@ -121,6 +121,7 @@ ifneq ($(OPENJDK_TARGET_OS),linux)
sun/nio/fs/LinuxFileStore.java \
sun/nio/fs/LinuxFileSystem.java \
sun/nio/fs/LinuxFileSystemProvider.java \
sun/nio/fs/MagicFileTypeDetector.java \
sun/nio/fs/LinuxNativeDispatcher.java \
sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
sun/nio/fs/LinuxWatchService.java
......@@ -220,24 +221,10 @@ endif
EXFILES+=-linux-arm.java \
-linux-ppc.java
# TODO: Is this necessary?
ifeq ($(OPENJDK_TARGET_OS), windows)
EXFILES+=sun/nio/ch/AbstractPollSelectorImpl.java \
sun/nio/ch/DevPollArrayWrapper.java \
sun/nio/ch/DevPollSelectorImpl.java \
sun/nio/ch/DevPollSelectorProvider.java \
sun/nio/ch/InheritedChannel.java \
sun/nio/ch/PollSelectorProvider.java \
sun/nio/ch/PollSelectorImpl.java \
sun/nio/ch/Port.java \
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
sun/nio/ch/SolarisAsynchronousChannelProvider.java \
sun/nio/ch/SolarisEventPort.java \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
EXFILES+=sun/net/sdp/SdpProvider.java
else
EXFILES+=sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
endif
# Exclude nimbus files from rt.jar
......@@ -338,29 +325,14 @@ $(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers: $(JDK_BASE_HEADER_JAVA_FI
##########################################################################################
#
# This is an empty jar (only contains manifest) and fits poorly into framework...
# create simple rule instead
#
MANAGEMENT_AGENT_JAR_DEPS := $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
$(JDK_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
$(JAR) cfm $@ $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
JARS += $(JDK_OUTPUTDIR)/lib/management-agent.jar
##########################################################################################
ifndef OPENJDK
$(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES_JAR,\
$(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES,\
SETUP:=GENERATE_JDKBYTECODE,\
SRC:=$(JDK_TOPDIR)/src/closed/share/altclasses, \
BIN:=$(JDK_OUTPUTDIR)/altclasses_classes,\
JAR:=$(JDK_OUTPUTDIR)/lib/alt-rt.jar))
BIN:=$(JDK_OUTPUTDIR)/altclasses_classes))
$(BUILD_ALTCLASSES_JAR): $(BUILD_JDK)
JARS += $(JDK_OUTPUTDIR)/lib/alt-rt.jar
$(BUILD_ALTCLASSES): $(BUILD_JDK)
endif
......@@ -383,7 +355,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_15BYTECODE,\
SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\
$(eval $(call SetupJavaCompilation,BUILD_JOBJC,\
SETUP:=GENERATE_15BYTECODE,\
DISABLE_SJAVAC:=true,\
SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
......@@ -395,11 +367,9 @@ $(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\
JAR:=$(JDK_OUTPUTDIR)/lib/JObjC.jar, \
JARINDEX := true))
$(BUILD_JOBJC_JAR) : $(BUILD_JDK)
$(BUILD_JOBJC) : $(BUILD_JDK)
JARS += $(JDK_OUTPUTDIR)/lib/JObjC.jar
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS,\
SETUP:=GENERATE_JDKBYTECODE,\
SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
$(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
......@@ -409,16 +379,15 @@ $(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\
BIN:=$(JDK_OUTPUTDIR)/jobjc_classes_headers,\
HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers_jobjc))
$(BUILD_JOBJC_HEADERS_JAR) : $(BUILD_JDK)
JARS += $(BUILD_JOBJC_HEADERS_JAR)
$(BUILD_JOBJC_HEADERS) : $(BUILD_JDK)
endif
##########################################################################################
# copy with -a to preserve timestamps so dependencies down the line aren't messed up
all: $(BUILD_JDK) $(JARS) $(COPY_EXTRA) $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers
.PHONY: all
......@@ -125,7 +125,7 @@ endif
LIBVERIFY_OPTIMIZATION:=HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
LIBVERIFY_OPTIMIZATION:=LOW
endif
endif
......@@ -1645,7 +1645,7 @@ endif
LIBMANAGEMENT_OPTIMIZATION:=HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
LIBMANAGEMENT_OPTIMIZATION:=LOW
endif
endif
......@@ -1688,7 +1688,7 @@ BUILD_LIBHPROF_LDFLAGS:=
LIBHPROF_OPTIMIZATION:=HIGHEST
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
LIBHPROF_OPTIMIZATION:=LOW
endif
endif
......@@ -1897,6 +1897,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
UnixAsynchronousServerSocketChannelImpl.c \
UnixAsynchronousSocketChannelImpl.c \
GnomeFileTypeDetector.c \
MagicFileTypeDetector.c \
LinuxNativeDispatcher.c \
LinuxWatchService.c \
UnixCopyFile.c \
......@@ -2235,7 +2236,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS,\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_linux:=-lc -lpthread,\
LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
LDFLAGS_SUFFIX:=-lm $(LDFLAGS_JDKLIB_SUFFIX),\
LDFLAGS_SUFFIX_posix:=-lm -ljava -ljvm,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
RC_FLAGS:=$(RC_FLAGS)\
......@@ -2539,6 +2540,7 @@ BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
##########################################################################################
ifneq ($(OPENJDK_TARGET_OS), windows)
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
LIBRARY:=j2gss,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
......@@ -2558,6 +2560,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
endif
endif
##########################################################################################
......
......@@ -356,21 +356,9 @@ COPY_FILES += $(JVMCFG)
##########################################################################################
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-$(OPENJDK_TARGET_OS)
PROPS_DST := $(JDK_OUTPUTDIR)/lib/security/java.security
ifeq ($(OPENJDK_TARGET_OS), solaris)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-solaris
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-windows
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-macosx
endif
$(PROPS_DST): $(PROPS_SRC)
$(MKDIR) -p $(@D)
$(RM) $@
......
......@@ -446,9 +446,7 @@ ifndef OPENJDK
$(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
......@@ -476,9 +474,7 @@ ifndef OPENJDK
$(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
......@@ -518,9 +514,8 @@ ifndef OPENJDK
$(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
$(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\
......@@ -545,9 +540,7 @@ ifndef OPENJDK
$(JCE_JAR_DST) : $(JCE_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
......@@ -567,76 +560,86 @@ JARS += $(JCE_JAR_DST)
##########################################################################################
ifdef OPENJDK
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
# NOTE: We currently do not place restrictions on our limited export
# policy. This was not a typo.
#
US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
ifndef OPENJDK
$(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
else
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
# NOTE: We currently do not place restrictions on our limited export
# policy. This was not a typo.
#
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
$(install-file)
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
SUFFIXES:= .policy,\
JAR:=$(US_EXPORT_POLICY_JAR_DST), \
EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
SKIP_METAINF := true))
JARS += $(US_EXPORT_POLICY_JAR_DST)
endif
JARS += $(US_EXPORT_POLICY_JAR_DST)
##########################################################################################
LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
ifdef OPENJDK
ifndef OPENJDK
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
$(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
ifeq ($(UNLIMITED_CRYPTO), true)
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
else
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
$(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
endif
$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
ifeq ($(UNLIMITED_CRYPTO), true)
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
else
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
$(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
endif
$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
$(install-file)
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
SRCS:=$(LOCAL_POLICY_JAR_TMP),\
SUFFIXES:= .policy,\
JAR:=$(LOCAL_POLICY_JAR_DST), \
EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
SKIP_METAINF := true))
JARS += $(LOCAL_POLICY_JAR_DST)
endif
JARS += $(LOCAL_POLICY_JAR_DST)
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS),windows)
......@@ -648,9 +651,7 @@ SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
$(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
else
......@@ -676,9 +677,7 @@ UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
$(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
JARS += $(UCRYPTO_JAR_DST)
......@@ -897,14 +896,10 @@ LAUNCHER_ZIP_SRC := $(patsubst $(JDK_TOPDIR)/src/share/bin/%,$(IMAGES_OUTPUTDIR)
$(LAUNCHER_SRC_FILES)))
$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(install-file)
$(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)
......@@ -922,6 +917,55 @@ JARS+=$(IMAGES_OUTPUTDIR)/src.zip
##########################################################################################
#
# This is an empty jar (only contains manifest) and fits poorly into framework...
# create simple rule instead
#
$(IMAGES_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
$(JAR) cfm $@ $<
JARS += $(IMAGES_OUTPUTDIR)/lib/management-agent.jar
##########################################################################################
$(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
$(install-file)
JARS += $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS),macosx)
$(eval $(call SetupArchive,BUILD_JOBJC_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/jobjc_classes,\
JAR:=$(IMAGES_OUTPUTDIR)/lib/JObjC.jar, \
JARINDEX:=true))
JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
endif
##########################################################################################
ifndef OPENJDK
$(eval $(call SetupArchive,BUILD_ALT_RT_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/altclasses_classes,\
JAR:=$(IMAGES_OUTPUTDIR)/lib/alt-rt.jar))
JARS += $(IMAGES_OUTPUTDIR)/lib/alt-rt.jar
endif
##########################################################################################
# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that
# all jars can be found in one place when creating images in Images.gmk. It needs to be
# done here so that clean targets can be simple and accurate.
$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar
$(install-file)
JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
##########################################################################################
-include $(CUSTOM_MAKE_DIR)/CreateJars.gmk
##########################################################################################
......
......@@ -211,10 +211,11 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
endif
# Find all files to copy from $(JDK_OUTPUTDIR)/lib
# Jar files are not expected to be here
ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
\( -name "_the*" -o -name "javac_state " \) )
\( -name "_the*" -o -name "javac_state " -o -name "*.jar" \) )
# Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
# This might not exist if building overlay-images
# This is were the jar files are and might not exist if building overlay-images
ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
\( -name "_the*" -o -name "javac_state " \) )
......
......@@ -231,22 +231,6 @@ define install-file
endef
endif
ifndef OPENJDK
IMPORT_TARGET_FILES += \
$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar \
$(JDK_OUTPUTDIR)/lib/security/local_policy.jar
$(JDK_OUTPUTDIR)/lib/security/local_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
endif # OPENJDK
#######
all: $(IMPORT_TARGET_FILES)
......@@ -130,6 +130,8 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
Java_sun_nio_fs_LinuxWatchService_eventSize;
Java_sun_nio_fs_LinuxWatchService_eventOffsets;
Java_sun_nio_fs_LinuxWatchService_inotifyInit;
......
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
......@@ -37,6 +37,7 @@
#include "debugLoop.h"
#include "bag.h"
#include "invoker.h"
#include "sys.h"
/* How the options get to OnLoad: */
#define XDEBUG "-Xdebug"
......@@ -201,6 +202,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
jint jvmtiCompileTimeMajorVersion;
jint jvmtiCompileTimeMinorVersion;
jint jvmtiCompileTimeMicroVersion;
char *boot_path = NULL;
char npt_lib[MAXPATHLEN];
/* See if it's already loaded */
if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) {
......@@ -227,18 +230,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
vmInitialized = JNI_FALSE;
gdata->vmDead = JNI_FALSE;
/* Npt and Utf function init */
NPT_INITIALIZE(&(gdata->npt), NPT_VERSION, NULL);
if (gdata->npt == NULL) {
ERROR_MESSAGE(("JDWP: unable to initialize NPT library"));
return JNI_ERR;
}
gdata->npt->utf = (gdata->npt->utfInitialize)(NULL);
if (gdata->npt->utf == NULL) {
ERROR_MESSAGE(("JDWP: UTF function initialization failed"));
return JNI_ERR;
}
/* Get the JVMTI Env, IMPORTANT: Do this first! For jvmtiAllocate(). */
error = JVM_FUNC_PTR(vm,GetEnv)
(vm, (void **)&(gdata->jvmti), JVMTI_VERSION_1);
......@@ -277,6 +268,24 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
forceExit(1); /* Kill entire process, no core dump wanted */
}
JVMTI_FUNC_PTR(gdata->jvmti, GetSystemProperty)
(gdata->jvmti, (const char *)"sun.boot.library.path",
&boot_path);
dbgsysBuildLibName(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME);
/* Npt and Utf function init */
NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL);
jvmtiDeallocate(boot_path);
if (gdata->npt == NULL) {
ERROR_MESSAGE(("JDWP: unable to initialize NPT library"));
return JNI_ERR;
}
gdata->npt->utf = (gdata->npt->utfInitialize)(NULL);
if (gdata->npt->utf == NULL) {
ERROR_MESSAGE(("JDWP: UTF function initialization failed"));
return JNI_ERR;
}
/* Parse input options */
if (!parseOptions(options)) {
/* No message necessary, should have been printed out already */
......
/*
* Copyright (c) 2003, 2008, 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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -70,8 +70,13 @@ vprint_message(FILE *fp, const char *prefix, const char *suffix,
len = (int)strlen((char*)utf8buf);
/* Convert to platform encoding (ignore errors, dangerous area) */
(void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
utf8buf, len, pbuf, MAX_MESSAGE_LEN);
if (gdata->npt != NULL) {
(void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
utf8buf, len, pbuf, MAX_MESSAGE_LEN);
} else {
/* May be called before NPT is initialized so don't fault */
strncpy(pbuf, (char*)utf8buf, len);
}
(void)fprintf(fp, "%s%s%s", prefix, pbuf, suffix);
}
......
/*
* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
......@@ -144,7 +144,9 @@ loadTransport(char *name, jdwpTransportEnv **transportPtr)
/* First, look in sun.boot.library.path. This should find the standard
* dt_socket and dt_shmem transport libraries, or any library
* that was delivered with the J2SE.
* Note: Java property sun.boot.library.path contains a single directory.
* Note: Since 6819213 fixed, Java property sun.boot.library.path can
* contain multiple paths. Dll_dir is the first entry and
* -Dsun.boot.library.path entries are appended.
*/
libdir = gdata->property_sun_boot_library_path;
if (libdir == NULL) {
......
......@@ -30,14 +30,10 @@ import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.WritableRaster;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import javax.imageio.IIOException;
......@@ -48,6 +44,11 @@ import javax.imageio.metadata.IIOMetadata;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
import com.sun.imageio.plugins.common.ReaderUtil;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.SampleModel;
public class GIFImageReader extends ImageReader {
......@@ -194,6 +195,36 @@ public class GIFImageReader extends ImageReader {
return imageMetadata.imageHeight;
}
// We don't check all parameters as ImageTypeSpecifier.createIndexed do
// since this method is private and we pass consistent data here
private ImageTypeSpecifier createIndexed(byte[] r, byte[] g, byte[] b,
int bits) {
ColorModel colorModel;
if (imageMetadata.transparentColorFlag) {
// Some files erroneously have a transparent color index
// of 255 even though there are fewer than 256 colors.
int idx = Math.min(imageMetadata.transparentColorIndex,
r.length - 1);
colorModel = new IndexColorModel(bits, r.length, r, g, b, idx);
} else {
colorModel = new IndexColorModel(bits, r.length, r, g, b);
}
SampleModel sampleModel;
if (bits == 8) {
int[] bandOffsets = {0};
sampleModel =
new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
1, 1, 1, 1,
bandOffsets);
} else {
sampleModel =
new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
1, 1, bits);
}
return new ImageTypeSpecifier(colorModel, sampleModel);
}
public Iterator getImageTypes(int imageIndex) throws IIOException {
checkIndex(imageIndex);
......@@ -239,22 +270,7 @@ public class GIFImageReader extends ImageReader {
b[i] = colorTable[rgbIndex++];
}
byte[] a = null;
if (imageMetadata.transparentColorFlag) {
a = new byte[lutLength];
Arrays.fill(a, (byte)255);
// Some files erroneously have a transparent color index
// of 255 even though there are fewer than 256 colors.
int idx = Math.min(imageMetadata.transparentColorIndex,
lutLength - 1);
a[idx] = (byte)0;
}
int[] bitsPerSample = new int[1];
bitsPerSample[0] = bits;
l.add(ImageTypeSpecifier.createIndexed(r, g, b, a, bits,
DataBuffer.TYPE_BYTE));
l.add(createIndexed(r, g, b, bits));
return l.iterator();
}
......
......@@ -25,8 +25,6 @@
package com.sun.java.util.jar.pack;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
......@@ -42,40 +40,39 @@ import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.jar.Pack200;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Control block for publishing Pack200 options to the other classes.
*/
final class PropMap implements SortedMap<String, String> {
private final TreeMap<String, String> theMap = new TreeMap<>();;
private final List<PropertyChangeListener> listenerList = new ArrayList<>(1);
void addListener(PropertyChangeListener listener) {
// type is erased, elements are of type java.beans.PropertyChangeListener
private final List<Object> listenerList = new ArrayList<>(1);
void addListener(Object listener) {
assert Beans.isPropertyChangeListener(listener);
listenerList.add(listener);
}
void removeListener(PropertyChangeListener listener) {
void removeListener(Object listener) {
assert Beans.isPropertyChangeListener(listener);
listenerList.remove(listener);
}
void addListeners(ArrayList<PropertyChangeListener> listeners) {
listenerList.addAll(listeners);
}
void removeListeners(ArrayList<PropertyChangeListener> listeners) {
listenerList.removeAll(listeners);
}
// Override:
public String put(String key, String value) {
String oldValue = theMap.put(key, value);
if (value != oldValue && !listenerList.isEmpty()) {
assert Beans.isBeansPresent();
// Post the property change event.
PropertyChangeEvent event =
new PropertyChangeEvent(this, key,
oldValue, value);
for (PropertyChangeListener listener : listenerList) {
listener.propertyChange(event);
Object event = Beans.newPropertyChangeEvent(this, key, oldValue, value);
for (Object listener : listenerList) {
Beans.invokePropertyChange(listener, event);
}
}
return oldValue;
......@@ -339,4 +336,113 @@ final class PropMap implements SortedMap<String, String> {
public String lastKey() {
return theMap.lastKey();
}
/**
* A class that provides access to the java.beans.PropertyChangeListener
* and java.beans.PropertyChangeEvent without creating a static dependency
* on java.beans. This class can be removed once the addPropertyChangeListener
* and removePropertyChangeListener methods are removed from Packer and
* Unpacker.
*/
private static class Beans {
private static final Class<?> propertyChangeListenerClass =
getClass("java.beans.PropertyChangeListener");
private static final Class<?> propertyChangeEventClass =
getClass("java.beans.PropertyChangeEvent");
private static final Method propertyChangeMethod =
getMethod(propertyChangeListenerClass,
"propertyChange",
propertyChangeEventClass);
private static final Constructor<?> propertyEventCtor =
getConstructor(propertyChangeEventClass,
Object.class,
String.class,
Object.class,
Object.class);
private static Class<?> getClass(String name) {
try {
return Class.forName(name, true, Beans.class.getClassLoader());
} catch (ClassNotFoundException e) {
return null;
}
}
private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
try {
return (c == null) ? null : c.getDeclaredConstructor(types);
} catch (NoSuchMethodException x) {
throw new AssertionError(x);
}
}
private static Method getMethod(Class<?> c, String name, Class<?>... types) {
try {
return (c == null) ? null : c.getMethod(name, types);
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
}
/**
* Returns {@code true} if java.beans is present.
*/
static boolean isBeansPresent() {
return propertyChangeListenerClass != null &&
propertyChangeEventClass != null;
}
/**
* Returns {@code true} if the given object is a PropertyChangeListener
*/
static boolean isPropertyChangeListener(Object obj) {
if (propertyChangeListenerClass == null) {
return false;
} else {
return propertyChangeListenerClass.isInstance(obj);
}
}
/**
* Returns a new PropertyChangeEvent with the given source, property
* name, old and new values.
*/
static Object newPropertyChangeEvent(Object source, String prop,
Object oldValue, Object newValue)
{
try {
return propertyEventCtor.newInstance(source, prop, oldValue, newValue);
} catch (InstantiationException | IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
/**
* Invokes the given PropertyChangeListener's propertyChange method
* with the given event.
*/
static void invokePropertyChange(Object listener, Object ev) {
try {
propertyChangeMethod.invoke(listener, ev);
} catch (IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
}
}
......@@ -28,10 +28,6 @@ package com.sun.jmx.snmp;
import java.io.Serializable;
import java.util.Hashtable;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.Enumerated;
/**
* This class is an internal class which is used to represent RowStatus
......@@ -263,30 +259,30 @@ public class EnumRowStatus extends Enumerated implements Serializable {
// Documented in Enumerated
//
protected Hashtable getIntTable() {
@Override
protected Hashtable<Integer, String> getIntTable() {
return EnumRowStatus.getRSIntTable();
}
// Documented in Enumerated
//
protected Hashtable getStringTable() {
@Override
protected Hashtable<String, Integer> getStringTable() {
return EnumRowStatus.getRSStringTable();
}
static final Hashtable getRSIntTable() {
static Hashtable<Integer, String> getRSIntTable() {
return intTable ;
}
static final Hashtable getRSStringTable() {
static Hashtable<String, Integer> getRSStringTable() {
return stringTable ;
}
// Initialize the mapping tables.
//
final static Hashtable<Integer, String> intTable =
new Hashtable<Integer, String>();
final static Hashtable<String, Integer> stringTable =
new Hashtable<String, Integer>();
final static Hashtable<Integer, String> intTable = new Hashtable<>();
final static Hashtable<String, Integer> stringTable = new Hashtable<>();
static {
intTable.put(new Integer(0), "unspecified");
intTable.put(new Integer(3), "notReady");
......
......@@ -54,9 +54,9 @@ abstract public class Enumerated implements Serializable {
* @exception IllegalArgumentException One of the arguments passed to the method is illegal or inappropriate.
*/
public Enumerated() throws IllegalArgumentException {
Enumeration e =getIntTable().keys() ;
Enumeration<Integer> e =getIntTable().keys();
if (e.hasMoreElements()) {
value = ((Integer)e.nextElement()).intValue() ;
value = e.nextElement().intValue() ;
}
else {
throw new IllegalArgumentException() ;
......@@ -100,7 +100,7 @@ abstract public class Enumerated implements Serializable {
* to the method is illegal or inappropriate.
*/
public Enumerated(String valueString) throws IllegalArgumentException {
Integer index = (Integer)getStringTable().get(valueString) ;
Integer index = getStringTable().get(valueString) ;
if (index == null) {
throw new IllegalArgumentException() ;
}
......@@ -127,7 +127,7 @@ abstract public class Enumerated implements Serializable {
* @return An enumeration of Integer instances
*/
public Enumeration valueIndexes() {
public Enumeration<Integer> valueIndexes() {
return getIntTable().keys() ;
}
......@@ -138,7 +138,7 @@ abstract public class Enumerated implements Serializable {
* @return An enumeration of String instances
*/
public Enumeration valueStrings() {
public Enumeration<String> valueStrings() {
return getStringTable().keys() ;
}
......@@ -153,6 +153,7 @@ abstract public class Enumerated implements Serializable {
*
* @return True if this and obj are the same; false otherwise
*/
@Override
public boolean equals(Object obj) {
return ((obj != null) &&
......@@ -166,6 +167,7 @@ abstract public class Enumerated implements Serializable {
*
* @return A hash code value for this object.
*/
@Override
public int hashCode() {
String hashString = getClass().getName() + String.valueOf(value) ;
return hashString.hashCode() ;
......@@ -177,9 +179,9 @@ abstract public class Enumerated implements Serializable {
*
* @return The string for for this object.
*/
@Override
public String toString() {
return (String)getIntTable().get(new Integer(value)) ;
return getIntTable().get(new Integer(value)) ;
}
......@@ -193,7 +195,7 @@ abstract public class Enumerated implements Serializable {
* @return An hashtable for read-only purpose
*/
protected abstract Hashtable getIntTable() ;
protected abstract Hashtable<Integer,String> getIntTable() ;
......@@ -207,12 +209,12 @@ abstract public class Enumerated implements Serializable {
* @return An hashtable for read-only purpose
*/
protected abstract Hashtable getStringTable() ;
protected abstract Hashtable<String,Integer> getStringTable() ;
/**
* This variable keeps the integer form of the enumerated.
* The string form is retreived using getIntTable().
* The string form is retrieved using getIntTable().
*/
protected int value ;
......
......@@ -66,7 +66,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
*/
public AclImpl (PrincipalImpl owner, String name) {
super(owner);
entryList = new Vector<AclEntry>();
entryList = new Vector<>();
aclName = name;
}
......@@ -81,6 +81,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
* of this ACL.
* @see java.security.Principal
*/
@Override
public void setName(Principal caller, String name)
throws NotOwnerException {
if (!isOwner(caller))
......@@ -93,6 +94,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
*
* @return the name of this ACL.
*/
@Override
public String getName(){
return aclName;
}
......@@ -113,6 +115,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
* this ACL.
* @see java.security.Principal
*/
@Override
public boolean addEntry(Principal caller, AclEntry entry)
throws NotOwnerException {
if (!isOwner(caller))
......@@ -144,6 +147,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
* @see java.security.Principal
* @see java.security.acl.AclEntry
*/
@Override
public boolean removeEntry(Principal caller, AclEntry entry)
throws NotOwnerException {
if (!isOwner(caller))
......@@ -185,8 +189,9 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
* is allowed.
* @see java.security.Principal
*/
@Override
public Enumeration<Permission> getPermissions(Principal user){
Vector<Permission> empty = new Vector<Permission>();
Vector<Permission> empty = new Vector<>();
for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
AclEntry ent = e.nextElement();
if (ent.getPrincipal().equals(user))
......@@ -201,6 +206,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
*
* @return an enumeration of the entries in this ACL.
*/
@Override
public Enumeration<AclEntry> entries(){
return entryList.elements();
}
......@@ -221,10 +227,11 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
* @see java.security.Principal
* @see java.security.Permission
*/
@Override
public boolean checkPermission(Principal user,
java.security.acl.Permission perm) {
for (Enumeration e = entryList.elements();e.hasMoreElements();){
AclEntry ent = (AclEntry) e.nextElement();
for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
AclEntry ent = e.nextElement();
if (ent.getPrincipal().equals(user))
if (ent.checkPermission(perm)) return true;
}
......@@ -250,7 +257,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
*/
public boolean checkPermission(Principal user, String community,
java.security.acl.Permission perm) {
for (Enumeration e = entryList.elements();e.hasMoreElements();){
for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
AclEntryImpl ent = (AclEntryImpl) e.nextElement();
if (ent.getPrincipal().equals(user))
if (ent.checkPermission(perm) && ent.checkCommunity(community)) return true;
......@@ -269,7 +276,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
* @see java.security.Permission
*/
public boolean checkCommunity(String community) {
for (Enumeration e = entryList.elements();e.hasMoreElements();){
for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
AclEntryImpl ent = (AclEntryImpl) e.nextElement();
if (ent.checkCommunity(community)) return true;
}
......@@ -281,6 +288,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable {
*
* @return a string representation of the ACL contents.
*/
@Override
public String toString(){
return ("AclImpl: "+ getName());
}
......
......@@ -28,7 +28,9 @@
package com.sun.jmx.snmp.IPAcl;
import java.net.InetAddress;
import java.util.Hashtable;
import java.util.Vector;
class JDMAclBlock extends SimpleNode {
JDMAclBlock(int id) {
......@@ -51,11 +53,13 @@ class JDMAclBlock extends SimpleNode {
* Do no need to go through this part of the tree for
* building TrapEntry.
*/
public void buildTrapEntries(Hashtable dest) {}
@Override
public void buildTrapEntries(Hashtable<InetAddress, Vector<String>> dest) {}
/**
* Do no need to go through this part of the tree for
* building InformEntry.
*/
public void buildInformEntries(Hashtable dest) {}
@Override
public void buildInformEntries(Hashtable<InetAddress, Vector<String>> dest) {}
}
......@@ -27,7 +27,9 @@
package com.sun.jmx.snmp.IPAcl;
import java.net.InetAddress;
import java.util.Hashtable;
import java.util.Vector;
class JDMInformBlock extends SimpleNode {
JDMInformBlock(int id) {
......@@ -50,11 +52,13 @@ class JDMInformBlock extends SimpleNode {
* Do no need to go through this part of the tree for
* building AclEntry.
*/
@Override
public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {}
/**
* Do no need to go through this part of the tree for
* building TrapEntry.
*/
public void buildTrapEntries(Hashtable dest) {}
@Override
public void buildTrapEntries(Hashtable<InetAddress, Vector<String>> dest) {}
}
......@@ -28,7 +28,9 @@
package com.sun.jmx.snmp.IPAcl;
import java.net.InetAddress;
import java.util.Hashtable;
import java.util.Vector;
class JDMTrapBlock extends SimpleNode {
JDMTrapBlock(int id) {
......@@ -51,11 +53,13 @@ class JDMTrapBlock extends SimpleNode {
* Do no need to go through this part of the tree for
* building AclEntry.
*/
@Override
public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {}
/**
* Do no need to go through this part of the tree for
* building InformEntry.
*/
public void buildInformEntries(Hashtable dest) {}
@Override
public void buildInformEntries(Hashtable<InetAddress, Vector<String>> dest) {}
}
......@@ -27,18 +27,17 @@
package com.sun.jmx.snmp.IPAcl;
@SuppressWarnings("unchecked") // generated code, not worth fixing
class JJTParserState {
private java.util.Stack nodes;
private java.util.Stack marks;
private java.util.Stack<Node> nodes;
private java.util.Stack<Integer> marks;
private int sp; // number of nodes on stack
private int mk; // current mark
private boolean node_created;
JJTParserState() {
nodes = new java.util.Stack();
marks = new java.util.Stack();
nodes = new java.util.Stack<>();
marks = new java.util.Stack<>();
sp = 0;
mk = 0;
}
......@@ -62,7 +61,7 @@ class JJTParserState {
/* Returns the root node of the AST. It only makes sense to call
this after a successful parse. */
Node rootNode() {
return (Node)nodes.elementAt(0);
return nodes.elementAt(0);
}
/* Pushes a node on to the stack. */
......@@ -75,14 +74,14 @@ class JJTParserState {
stack. */
Node popNode() {
if (--sp < mk) {
mk = ((Integer)marks.pop()).intValue();
mk = marks.pop().intValue();
}
return (Node)nodes.pop();
return nodes.pop();
}
/* Returns the node currently on the top of the stack. */
Node peekNode() {
return (Node)nodes.peek();
return nodes.peek();
}
/* Returns the number of children on the stack in the current node
......@@ -96,7 +95,7 @@ class JJTParserState {
while (sp > mk) {
popNode();
}
mk = ((Integer)marks.pop()).intValue();
mk = marks.pop().intValue();
}
......@@ -112,7 +111,7 @@ class JJTParserState {
made the children of the definite node. Then the definite node
is pushed on to the stack. */
void closeNodeScope(Node n, int num) {
mk = ((Integer)marks.pop()).intValue();
mk = marks.pop().intValue();
while (num-- > 0) {
Node c = popNode();
c.jjtSetParent(n);
......@@ -132,7 +131,7 @@ class JJTParserState {
void closeNodeScope(Node n, boolean condition) {
if (condition) {
int a = nodeArity();
mk = ((Integer)marks.pop()).intValue();
mk = marks.pop().intValue();
while (a-- > 0) {
Node c = popNode();
c.jjtSetParent(n);
......@@ -142,7 +141,7 @@ class JJTParserState {
pushNode(n);
node_created = true;
} else {
mk = ((Integer)marks.pop()).intValue();
mk = marks.pop().intValue();
node_created = false;
}
}
......
......@@ -1168,7 +1168,7 @@ jjtree.openNodeScope(jjtn000);Token t;
return (jj_ntk = jj_nt.kind);
}
private java.util.Vector jj_expentries = new java.util.Vector();
private java.util.Vector<int[]> jj_expentries = new java.util.Vector<>();
private int[] jj_expentry;
private int jj_kind = -1;
private int[] jj_lasttokens = new int[100];
......@@ -1184,8 +1184,8 @@ jjtree.openNodeScope(jjtn000);Token t;
jj_expentry[i] = jj_lasttokens[i];
}
boolean exists = false;
for (java.util.Enumeration enumv = jj_expentries.elements(); enumv.hasMoreElements();) {
int[] oldentry = (int[])(enumv.nextElement());
for (java.util.Enumeration<int[]> enumv = jj_expentries.elements(); enumv.hasMoreElements();) {
int[] oldentry = enumv.nextElement();
if (oldentry.length == jj_expentry.length) {
exists = true;
for (int i = 0; i < jj_expentry.length; i++) {
......@@ -1236,7 +1236,7 @@ jjtree.openNodeScope(jjtn000);Token t;
jj_add_error_token(0, 0);
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = (int[])jj_expentries.elementAt(i);
exptokseq[i] = jj_expentries.elementAt(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
......
......@@ -126,7 +126,7 @@ public class SnmpAcl implements InetAddressAcl, Serializable {
*
* @return An enumeration of the entries in this ACL.
*/
public Enumeration entries() {
public Enumeration<AclEntry> entries() {
return acl.entries();
}
......@@ -137,11 +137,11 @@ public class SnmpAcl implements InetAddressAcl, Serializable {
public Enumeration<String> communities() {
HashSet<String> set = new HashSet<String>();
Vector<String> res = new Vector<String>();
for (Enumeration e = acl.entries() ; e.hasMoreElements() ;) {
for (Enumeration<AclEntry> e = acl.entries() ; e.hasMoreElements() ;) {
AclEntryImpl entry = (AclEntryImpl) e.nextElement();
for (Enumeration cs = entry.communities();
for (Enumeration<String> cs = entry.communities();
cs.hasMoreElements() ;) {
set.add((String) cs.nextElement());
set.add(cs.nextElement());
}
}
String[] objs = set.toArray(new String[0]);
......@@ -316,7 +316,7 @@ public class SnmpAcl implements InetAddressAcl, Serializable {
*
* @return An enumeration of the trap destinations (enumeration of <CODE>InetAddress</CODE>).
*/
public Enumeration getTrapDestinations() {
public Enumeration<InetAddress> getTrapDestinations() {
return trapDestList.keys();
}
......@@ -327,16 +327,16 @@ public class SnmpAcl implements InetAddressAcl, Serializable {
*
* @return An enumeration of trap communities for a given host (enumeration of <CODE>String</CODE>).
*/
public Enumeration getTrapCommunities(InetAddress i) {
Vector list = null;
if ((list = (Vector)trapDestList.get(i)) != null ) {
public Enumeration<String> getTrapCommunities(InetAddress i) {
Vector<String> list = null;
if ((list = trapDestList.get(i)) != null ) {
if (SNMP_LOGGER.isLoggable(Level.FINER)) {
SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
"getTrapCommunities", "["+i.toString()+"] is in list");
}
return list.elements();
} else {
list = new Vector();
list = new Vector<>();
if (SNMP_LOGGER.isLoggable(Level.FINER)) {
SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
"getTrapCommunities", "["+i.toString()+"] is not in list");
......@@ -350,7 +350,7 @@ public class SnmpAcl implements InetAddressAcl, Serializable {
*
* @return An enumeration of the inform destinations (enumeration of <CODE>InetAddress</CODE>).
*/
public Enumeration getInformDestinations() {
public Enumeration<InetAddress> getInformDestinations() {
return informDestList.keys();
}
......@@ -361,16 +361,16 @@ public class SnmpAcl implements InetAddressAcl, Serializable {
*
* @return An enumeration of inform communities for a given host (enumeration of <CODE>String</CODE>).
*/
public Enumeration getInformCommunities(InetAddress i) {
Vector list = null;
if ((list = (Vector)informDestList.get(i)) != null ) {
public Enumeration<String> getInformCommunities(InetAddress i) {
Vector<String> list = null;
if ((list = informDestList.get(i)) != null ) {
if (SNMP_LOGGER.isLoggable(Level.FINER)) {
SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
"getInformCommunities", "["+i.toString()+"] is in list");
}
return list.elements();
} else {
list = new Vector();
list = new Vector<>();
if (SNMP_LOGGER.isLoggable(Level.FINER)) {
SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
"getInformCommunities", "["+i.toString()+"] is not in list");
......@@ -426,15 +426,15 @@ public class SnmpAcl implements InetAddressAcl, Serializable {
throw new IllegalArgumentException(err.getMessage());
}
for(Enumeration e = acl.entries(); e.hasMoreElements();) {
for(Enumeration<AclEntry> e = acl.entries(); e.hasMoreElements();) {
AclEntryImpl aa = (AclEntryImpl) e.nextElement();
if (SNMP_LOGGER.isLoggable(Level.FINER)) {
SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
"readAuthorizedListFile",
"===> " + aa.getPrincipal().toString());
}
for (Enumeration eee = aa.permissions();eee.hasMoreElements();) {
java.security.acl.Permission perm = (java.security.acl.Permission)eee.nextElement();
for (Enumeration<java.security.acl.Permission> eee = aa.permissions();eee.hasMoreElements();) {
java.security.acl.Permission perm = eee.nextElement();
if (SNMP_LOGGER.isLoggable(Level.FINER)) {
SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
"readAuthorizedListFile", "perm = " + perm);
......
......@@ -99,7 +99,7 @@ public interface InetAddressAcl {
*
* @return An enumeration of the trap destinations (enumeration of <CODE>InetAddress</CODE>).
*/
public Enumeration getTrapDestinations();
public Enumeration<InetAddress> getTrapDestinations();
/**
* Returns an enumeration of trap communities for a given host.
......@@ -108,14 +108,14 @@ public interface InetAddressAcl {
*
* @return An enumeration of trap communities for a given host (enumeration of <CODE>String</CODE>).
*/
public Enumeration getTrapCommunities(InetAddress address);
public Enumeration<String> getTrapCommunities(InetAddress address);
/**
* Returns an enumeration of inform destinations.
*
* @return An enumeration of the inform destinations (enumeration of <CODE>InetAddress</CODE>).
*/
public Enumeration getInformDestinations();
public Enumeration<InetAddress> getInformDestinations();
/**
* Returns an enumeration of inform communities for a given host.
......@@ -124,5 +124,5 @@ public interface InetAddressAcl {
*
* @return An enumeration of inform communities for a given host (enumeration of <CODE>String</CODE>).
*/
public Enumeration getInformCommunities(InetAddress address);
public Enumeration<String> getInformCommunities(InetAddress address);
}
......@@ -59,6 +59,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* @exception IllegalAccessException The MIB cannot be initialized.
*/
@Override
public void init() throws IllegalAccessException {
}
......@@ -74,6 +75,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* @exception java.lang.Exception
*/
@Override
public ObjectName preRegister(MBeanServer server, ObjectName name)
throws Exception {
return name;
......@@ -87,6 +89,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* @return The returned oid is null.
*/
@Override
public long[] getRootOid() {
return null;
}
......@@ -99,6 +102,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* @exception SnmpStatusException An error occured during the operation.
*/
@Override
public void get(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
......@@ -108,9 +112,9 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpStatusException.noSuchName);
Enumeration l = inRequest.getElements();
Enumeration<SnmpVarBind> l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = (SnmpVarBind) l.nextElement();
SnmpVarBind varbind = l.nextElement();
varbind.setNoSuchObject();
}
}
......@@ -128,6 +132,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* cannot be performed.
*/
@Override
public void check(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
......@@ -145,6 +150,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* @exception SnmpStatusException An error occured during the operation.
*/
@Override
public void set(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
......@@ -162,6 +168,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* @exception SnmpStatusException An error occured during the operation.
*/
@Override
public void getNext(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
......@@ -171,9 +178,9 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpStatusException.noSuchName);
Enumeration l = inRequest.getElements();
Enumeration<SnmpVarBind> l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = (SnmpVarBind) l.nextElement();
SnmpVarBind varbind = l.nextElement();
varbind.setEndOfMibView();
}
}
......@@ -186,6 +193,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
* @exception SnmpStatusException An error occured during the operation.
*/
@Override
public void getBulk(SnmpMibRequest inRequest, int nonRepeat, int maxRepeat)
throws SnmpStatusException {
......@@ -196,9 +204,9 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpDefinitions.snmpRspGenErr, 0);
Enumeration l = inRequest.getElements();
Enumeration<SnmpVarBind> l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = (SnmpVarBind) l.nextElement();
SnmpVarBind varbind = l.nextElement();
varbind.setEndOfMibView();
}
}
......
......@@ -28,7 +28,6 @@ package com.sun.jmx.snmp.agent;
// java imports
//
import java.util.Vector;
import java.util.Enumeration;
import java.util.Iterator;
......@@ -149,8 +148,8 @@ public class SnmpGenericObjectServer {
final long[] idList = new long[size];
int i = 0;
for (Enumeration e=req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e=req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= e.nextElement();
try {
final long id = var.oid.getOidArc(depth);
nameList[i] = meta.getAttributeName(id);
......@@ -190,7 +189,7 @@ public class SnmpGenericObjectServer {
}
final Iterator it = result.iterator();
final Iterator<?> it = result.iterator();
for (int j=0; j < i; j++) {
if (!it.hasNext()) {
......@@ -312,8 +311,8 @@ public class SnmpGenericObjectServer {
final long[] idList = new long[size];
int i = 0;
for (Enumeration e=req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e=req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= e.nextElement();
try {
final long id = var.oid.getOidArc(depth);
final String attname = meta.getAttributeName(id);
......@@ -330,7 +329,7 @@ public class SnmpGenericObjectServer {
}
}
AttributeList result = null;
AttributeList result;
int errorCode = SnmpStatusException.noAccess;
try {
......@@ -345,7 +344,7 @@ public class SnmpGenericObjectServer {
result = new AttributeList();
}
final Iterator it = result.iterator();
final Iterator<?> it = result.iterator();
for (int j=0; j < i; j++) {
if (!it.hasNext()) {
......@@ -469,8 +468,8 @@ public class SnmpGenericObjectServer {
final Object data = req.getUserData();
for (Enumeration e=req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e=req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= e.nextElement();
try {
final long id = var.oid.getOidArc(depth);
// call meta.check() here, and meta.check will call check()
......
......@@ -164,11 +164,12 @@ public class SnmpIndex implements Serializable {
*
* @return A string representation of the index.
*/
@Override
public String toString() {
StringBuffer msg= new StringBuffer();
for(Enumeration e= oids.elements(); e.hasMoreElements(); ) {
SnmpOid val= (SnmpOid) e.nextElement();
msg.append( "//" + val.toString());
final StringBuilder msg= new StringBuilder();
for(Enumeration<SnmpOid> e= oids.elements(); e.hasMoreElements(); ) {
SnmpOid val= e.nextElement();
msg.append("//").append( val.toString());
}
return msg.toString();
}
......@@ -180,7 +181,7 @@ public class SnmpIndex implements Serializable {
* The list of OIDs.
* @serial
*/
private Vector<SnmpOid> oids = new Vector<SnmpOid>();
private Vector<SnmpOid> oids = new Vector<>();
/**
* The number of elements in the index.
......
......@@ -42,10 +42,6 @@ import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpDefinitions;
import com.sun.jmx.snmp.SnmpStatusException;
import com.sun.jmx.snmp.SnmpEngine;
import com.sun.jmx.snmp.SnmpUnknownModelException;
import com.sun.jmx.snmp.internal.SnmpAccessControlModel;
import com.sun.jmx.snmp.internal.SnmpEngineImpl;
/**
* Abstract class for representing an SNMP MIB.
......@@ -241,6 +237,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Implements the method defined in SnmpMibAgent. See SnmpMibAgent
// for java-doc
//
@Override
public void get(SnmpMibRequest req) throws SnmpStatusException {
// Builds the request tree: creation is not allowed, operation
......@@ -259,8 +256,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// For each sub-request stored in the request-tree, invoke the
// get() method.
for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
h = (SnmpRequestTree.Handler) eh.nextElement();
for (Enumeration<SnmpRequestTree.Handler> eh=handlers.getHandlers();eh.hasMoreElements();) {
h = eh.nextElement();
// Gets the Meta node. It can be either a Group Meta or a
// Table Meta.
......@@ -270,11 +267,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Gets the depth of the Meta node in the OID tree
final int depth = handlers.getOidDepth(h);
for (Enumeration rqs=handlers.getSubRequests(h);
for (Enumeration<SnmpMibSubRequest> rqs=handlers.getSubRequests(h);
rqs.hasMoreElements();) {
// Invoke the get() operation.
meta.get((SnmpMibSubRequest)rqs.nextElement(),depth);
meta.get(rqs.nextElement(),depth);
}
}
}
......@@ -286,6 +283,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Implements the method defined in SnmpMibAgent. See SnmpMibAgent
// for java-doc
//
@Override
public void set(SnmpMibRequest req) throws SnmpStatusException {
SnmpRequestTree handlers = null;
......@@ -307,8 +305,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
handlers.switchCreationFlag(false);
handlers.setPduType(reqType);
SnmpRequestTree.Handler h = null;
SnmpMibNode meta = null;
SnmpRequestTree.Handler h;
SnmpMibNode meta;
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
......@@ -317,8 +315,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// For each sub-request stored in the request-tree, invoke the
// get() method.
for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
h = (SnmpRequestTree.Handler) eh.nextElement();
for (Enumeration<SnmpRequestTree.Handler> eh=handlers.getHandlers();eh.hasMoreElements();) {
h = eh.nextElement();
// Gets the Meta node. It can be either a Group Meta or a
// Table Meta.
......@@ -328,11 +326,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Gets the depth of the Meta node in the OID tree
final int depth = handlers.getOidDepth(h);
for (Enumeration rqs=handlers.getSubRequests(h);
for (Enumeration<SnmpMibSubRequest> rqs=handlers.getSubRequests(h);
rqs.hasMoreElements();) {
// Invoke the set() operation
meta.set((SnmpMibSubRequest)rqs.nextElement(),depth);
meta.set(rqs.nextElement(),depth);
}
}
}
......@@ -346,6 +344,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Implements the method defined in SnmpMibAgent. See SnmpMibAgent
// for java-doc
//
@Override
public void check(SnmpMibRequest req) throws SnmpStatusException {
final int reqType = SnmpDefinitions.pduWalkRequest;
......@@ -353,8 +352,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// is atomic.
SnmpRequestTree handlers = getHandlers(req,true,true,reqType);
SnmpRequestTree.Handler h = null;
SnmpMibNode meta = null;
SnmpRequestTree.Handler h;
SnmpMibNode meta;
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
......@@ -363,8 +362,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// For each sub-request stored in the request-tree, invoke the
// check() method.
for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
h = (SnmpRequestTree.Handler) eh.nextElement();
for (Enumeration<SnmpRequestTree.Handler> eh=handlers.getHandlers();eh.hasMoreElements();) {
h = eh.nextElement();
// Gets the Meta node. It can be either a Group Meta or a
// Table Meta.
......@@ -374,11 +373,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Gets the depth of the Meta node in the OID tree
final int depth = handlers.getOidDepth(h);
for (Enumeration rqs=handlers.getSubRequests(h);
for (Enumeration<SnmpMibSubRequest> rqs=handlers.getSubRequests(h);
rqs.hasMoreElements();) {
// Invoke the check() operation
meta.check((SnmpMibSubRequest)rqs.nextElement(),depth);
meta.check(rqs.nextElement(),depth);
}
}
......@@ -398,13 +397,14 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Implements the method defined in SnmpMibAgent. See SnmpMibAgent
// for java-doc
//
@Override
public void getNext(SnmpMibRequest req) throws SnmpStatusException {
// Build the request tree for the operation
// The subrequest stored in the request tree are valid GET requests
SnmpRequestTree handlers = getGetNextHandlers(req);
SnmpRequestTree.Handler h = null;
SnmpMibNode meta = null;
SnmpRequestTree.Handler h;
SnmpMibNode meta;
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
......@@ -412,8 +412,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
}
// Now invoke get() for each subrequest of the request tree.
for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
h = (SnmpRequestTree.Handler) eh.nextElement();
for (Enumeration<SnmpRequestTree.Handler> eh=handlers.getHandlers();eh.hasMoreElements();) {
h = eh.nextElement();
// Gets the Meta node. It can be either a Group Meta or a
// Table Meta.
......@@ -423,11 +423,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Gets the depth of the Meta node in the OID tree
int depth = handlers.getOidDepth(h);
for (Enumeration rqs=handlers.getSubRequests(h);
for (Enumeration<SnmpMibSubRequest> rqs=handlers.getSubRequests(h);
rqs.hasMoreElements();) {
// Invoke the get() operation
meta.get((SnmpMibSubRequest)rqs.nextElement(),depth);
meta.get(rqs.nextElement(),depth);
}
}
}
......@@ -442,6 +442,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// Implements the method defined in SnmpMibAgent. See SnmpMibAgent
// for java-doc
//
@Override
public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat)
throws SnmpStatusException {
......@@ -456,10 +457,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
*
* @return The root object identifier.
*/
@Override
public long[] getRootOid() {
if( rootOid == null) {
Vector<Integer> list= new Vector<Integer>(10);
Vector<Integer> list= new Vector<>(10);
// Ask the tree to do the job !
//
......@@ -507,13 +509,13 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
new SnmpRequestTree(req,createflag,type);
int index=0;
SnmpVarBind var = null;
SnmpVarBind var;
final int ver= req.getVersion();
// For each varbind in the list finds its handling node.
for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) {
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements(); index++) {
var= (SnmpVarBind) e.nextElement();
var= e.nextElement();
try {
// Find the handling node for this varbind.
......@@ -657,10 +659,10 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
// request into a valid GET request, replacing the OIDs in the
// original GET-NEXT request with the OID of the first leaf that
// follows.
for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) {
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements(); index++) {
var = (SnmpVarBind) e.nextElement();
SnmpOid result = null;
var = e.nextElement();
SnmpOid result;
try {
// Find the node handling the OID that follows the varbind
// OID. `result' contains this next leaf OID.
......
......@@ -33,14 +33,12 @@ package com.sun.jmx.snmp.agent;
import java.io.Serializable;
import java.util.Vector;
import java.util.Enumeration;
import java.util.Set;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.MBeanRegistration;
import javax.management.ObjectName;
import javax.management.MalformedObjectNameException;
import javax.management.InstanceNotFoundException;
import javax.management.ServiceNotFoundException;
import javax.management.ReflectionException;
......@@ -94,6 +92,7 @@ public abstract class SnmpMibAgent
*
* @exception java.lang.Exception
*/
@Override
public abstract ObjectName preRegister(MBeanServer server,
ObjectName name)
throws java.lang.Exception;
......@@ -101,18 +100,21 @@ public abstract class SnmpMibAgent
/**
* Not used in this context.
*/
@Override
public void postRegister (Boolean registrationDone) {
}
/**
* Not used in this context.
*/
@Override
public void preDeregister() throws java.lang.Exception {
}
/**
* Not used in this context.
*/
@Override
public void postDeregister() {
}
......@@ -127,6 +129,7 @@ public abstract class SnmpMibAgent
*
* @exception SnmpStatusException An error occured during the operation.
*/
@Override
public abstract void get(SnmpMibRequest req)
throws SnmpStatusException;
......@@ -141,6 +144,7 @@ public abstract class SnmpMibAgent
*
* @exception SnmpStatusException An error occured during the operation.
*/
@Override
public abstract void getNext(SnmpMibRequest req)
throws SnmpStatusException;
......@@ -164,6 +168,7 @@ public abstract class SnmpMibAgent
*
* @exception SnmpStatusException An error occured during the operation.
*/
@Override
public abstract void getBulk(SnmpMibRequest req, int nonRepeat,
int maxRepeat)
throws SnmpStatusException;
......@@ -185,6 +190,7 @@ public abstract class SnmpMibAgent
* the exception is thrown in the {@link #check(SnmpMibRequest)}
* method instead.
*/
@Override
public abstract void set(SnmpMibRequest req)
throws SnmpStatusException;
......@@ -203,6 +209,7 @@ public abstract class SnmpMibAgent
* @exception SnmpStatusException The <CODE>set</CODE> operation
* cannot be performed.
*/
@Override
public abstract void check(SnmpMibRequest req)
throws SnmpStatusException;
......@@ -226,6 +233,7 @@ public abstract class SnmpMibAgent
* @return The MBean server or null if the MIB is not registered in any
* MBean server.
*/
@Override
public MBeanServer getMBeanServer() {
return server;
}
......@@ -236,6 +244,7 @@ public abstract class SnmpMibAgent
*
* @return The SNMP MIB handler.
*/
@Override
public SnmpMibHandler getSnmpAdaptor() {
return adaptor;
}
......@@ -246,6 +255,7 @@ public abstract class SnmpMibAgent
*
* @param stack The SNMP MIB handler.
*/
@Override
public void setSnmpAdaptor(SnmpMibHandler stack) {
if (adaptor != null) {
adaptor.removeMib(this);
......@@ -266,6 +276,7 @@ public abstract class SnmpMibAgent
*
* @since 1.5
*/
@Override
public void setSnmpAdaptor(SnmpMibHandler stack, SnmpOid[] oids) {
if (adaptor != null) {
adaptor.removeMib(this);
......@@ -288,6 +299,7 @@ public abstract class SnmpMibAgent
*
* @since 1.5
*/
@Override
public void setSnmpAdaptor(SnmpMibHandler stack, String contextName) {
if (adaptor != null) {
adaptor.removeMib(this, contextName);
......@@ -309,6 +321,7 @@ public abstract class SnmpMibAgent
*
* @since 1.5
*/
@Override
public void setSnmpAdaptor(SnmpMibHandler stack,
String contextName,
SnmpOid[] oids) {
......@@ -327,6 +340,7 @@ public abstract class SnmpMibAgent
*
* @return The name of the SNMP protocol adaptor.
*/
@Override
public ObjectName getSnmpAdaptorName() {
return adaptorName;
}
......@@ -344,6 +358,7 @@ public abstract class SnmpMibAgent
* @exception ServiceNotFoundException This SNMP MIB is not registered
* in the MBean server or the requested service is not supported.
*/
@Override
public void setSnmpAdaptorName(ObjectName name)
throws InstanceNotFoundException, ServiceNotFoundException {
......@@ -389,6 +404,7 @@ public abstract class SnmpMibAgent
*
* @since 1.5
*/
@Override
public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids)
throws InstanceNotFoundException, ServiceNotFoundException {
......@@ -434,6 +450,7 @@ public abstract class SnmpMibAgent
*
* @since 1.5
*/
@Override
public void setSnmpAdaptorName(ObjectName name, String contextName)
throws InstanceNotFoundException, ServiceNotFoundException {
......@@ -481,6 +498,7 @@ public abstract class SnmpMibAgent
*
* @since 1.5
*/
@Override
public void setSnmpAdaptorName(ObjectName name,
String contextName, SnmpOid[] oids)
throws InstanceNotFoundException, ServiceNotFoundException {
......@@ -522,6 +540,7 @@ public abstract class SnmpMibAgent
* @return <CODE>true</CODE> if the MIB module is bound,
* <CODE>false</CODE> otherwise.
*/
@Override
public boolean getBindingState() {
if (adaptor == null)
return false;
......@@ -534,6 +553,7 @@ public abstract class SnmpMibAgent
*
* @return The MIB name.
*/
@Override
public String getMibName() {
return mibName;
}
......@@ -681,7 +701,7 @@ public abstract class SnmpMibAgent
private Vector<SnmpVarBind> splitFrom(Vector<SnmpVarBind> original, int limit) {
int max= original.size();
Vector<SnmpVarBind> result= new Vector<SnmpVarBind>(max - limit);
Vector<SnmpVarBind> result= new Vector<>(max - limit);
int i= limit;
// Ok the loop looks a bit strange. But in order to improve the
......@@ -697,21 +717,12 @@ public abstract class SnmpMibAgent
return result;
}
private void concatVector(SnmpMibRequest req, Vector source) {
for(Enumeration e= source.elements(); e.hasMoreElements(); ) {
SnmpVarBind var= (SnmpVarBind) e.nextElement();
// We need to duplicate the SnmpVarBind otherwise it is going
// to be overloaded by the next get Next ...
req.addVarBind(new SnmpVarBind(var.oid, var.value));
}
}
private void concatVector(Vector<SnmpVarBind> target, Vector<SnmpVarBind> source) {
private void concatVector(SnmpMibRequest req, Vector<SnmpVarBind> source) {
for(Enumeration<SnmpVarBind> e= source.elements(); e.hasMoreElements(); ) {
SnmpVarBind var= e.nextElement();
// We need to duplicate the SnmpVarBind otherwise it is going
// to be overloaded by the next get Next ...
target.addElement(new SnmpVarBind(var.oid, var.value));
req.addVarBind(new SnmpVarBind(var.oid, var.value));
}
}
......
......@@ -29,20 +29,13 @@ package com.sun.jmx.snmp.agent;
//
import java.io.Serializable;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Vector;
// jmx imports
//
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// SNMP Runtime imports
//
import com.sun.jmx.snmp.agent.SnmpMibOid;
import com.sun.jmx.snmp.agent.SnmpMibNode;
/**
* Represents a node in an SNMP MIB which corresponds to a group.
......@@ -174,6 +167,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
* @exception SnmpStatusException An error occurred while accessing
* the MIB node.
*/
@Override
abstract public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException;
......@@ -203,6 +197,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
* @exception SnmpStatusException An error occurred while accessing
* the MIB node.
*/
@Override
abstract public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException;
......@@ -234,6 +229,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
* @exception SnmpStatusException An error occurred while accessing
* the MIB node.
*/
@Override
abstract public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException;
......@@ -241,8 +237,8 @@ public abstract class SnmpMibGroup extends SnmpMibOid
// If we reach this node, we are below the root OID, so we just
// return.
// --------------------------------------------------------------------
public void getRootOid(Vector result) {
return;
@Override
public void getRootOid(Vector<Integer> result) {
}
// -------------------------------------------------------------------
......@@ -264,7 +260,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
*/
void registerNestedArc(long arc) {
Long obj = new Long(arc);
if (subgroups == null) subgroups = new Hashtable<Long, Long>();
if (subgroups == null) subgroups = new Hashtable<>();
// registers the arc in the hashtable.
subgroups.put(obj,obj);
}
......@@ -312,6 +308,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
* @param node The node being registered.
*
*/
@Override
void registerNode(long[] oid, int cursor ,SnmpMibNode node)
throws IllegalAccessException {
super.registerNode(oid,cursor,node);
......@@ -325,13 +322,13 @@ public abstract class SnmpMibGroup extends SnmpMibOid
// -------------------------------------------------------------------
// see comments in SnmpMibNode
// -------------------------------------------------------------------
@Override
void findHandlingNode(SnmpVarBind varbind,
long[] oid, int depth,
SnmpRequestTree handlers)
throws SnmpStatusException {
int length = oid.length;
SnmpMibNode node = null;
if (handlers == null)
throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
......@@ -349,7 +346,6 @@ public abstract class SnmpMibGroup extends SnmpMibOid
// This arc leads to a subgroup: delegates the search to the
// method defined in SnmpMibOid
super.findHandlingNode(varbind,oid,depth,handlers);
return;
} else if (isTable(arc)) {
// This arc leads to a table: forward the search to the table.
......@@ -384,6 +380,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
// -------------------------------------------------------------------
// See comments in SnmpMibNode.
// -------------------------------------------------------------------
@Override
long[] findNextHandlingNode(SnmpVarBind varbind,
long[] oid, int pos, int depth,
SnmpRequestTree handlers, AcmChecker checker)
......
......@@ -37,7 +37,6 @@ import java.util.Enumeration;
// jmx imports
//
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
......@@ -79,10 +78,11 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
* @exception SnmpStatusException The default implementation (if not
* overridden) is to generate a SnmpStatusException.
*/
@Override
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
for (Enumeration e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var= (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var= e.nextElement();
SnmpStatusException x =
new SnmpStatusException(SnmpStatusException.noSuchObject);
req.registerGetException(var,x);
......@@ -102,10 +102,11 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
* @exception SnmpStatusException The default implementation (if not
* overridden) is to generate a SnmpStatusException.
*/
@Override
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
for (Enumeration e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var= (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var= e.nextElement();
SnmpStatusException x =
new SnmpStatusException(SnmpStatusException.noAccess);
req.registerSetException(var,x);
......@@ -123,12 +124,13 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
* @param depth The depth reached in the OID tree.
*
* @exception SnmpStatusException The default implementation (if not
* overriden) is to generate a SnmpStatusException.
* overridden) is to generate a SnmpStatusException.
*/
@Override
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
for (Enumeration e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var= (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var= e.nextElement();
SnmpStatusException x =
new SnmpStatusException(SnmpStatusException.noAccess);
req.registerCheckException(var,x);
......@@ -143,6 +145,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
//
// ---------------------------------------------------------------------
//
@Override
void findHandlingNode(SnmpVarBind varbind,
long[] oid, int depth,
SnmpRequestTree handlers)
......@@ -191,6 +194,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
//
// ---------------------------------------------------------------------
//
@Override
long[] findNextHandlingNode(SnmpVarBind varbind,
long[] oid, int pos, int depth,
SnmpRequestTree handlers,
......@@ -267,6 +271,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
/**
* Computes the root OID of the MIB.
*/
@Override
public void getRootOid(Vector<Integer> result) {
// If a node has several children, let assume that we are one step to
......@@ -359,7 +364,6 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
// String.valueOf(var) + " position= " + cursor);
children.insertElementAt(child, newPos);
child.registerNode(oid, cursor + 1, node);
return;
}
else {
// The node is already registered
......@@ -404,7 +408,6 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
}
}
children.setElementAt(node,pos);
return;
} else {
if (child == null)
throw new IllegalAccessException();
......@@ -469,7 +472,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
int max= varList.length -1 ;
int curr= low + (max-low)/2;
int elmt= 0;
int elmt;
while (low <= max) {
elmt= varList[curr];
if (cursor == elmt) {
......@@ -494,7 +497,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
if (varList == null)
return -1;
int max= varList.length -1 ;
int elmt=0;
int elmt;
//final int[] v = varList;
//if (index > a[max])
......@@ -528,7 +531,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable {
/**
* Contains the list of sub nodes.
*/
private NonSyncVector<SnmpMibNode> children = new NonSyncVector<SnmpMibNode>(1);
private NonSyncVector<SnmpMibNode> children = new NonSyncVector<>(1);
/**
* The number of sub nodes.
......
......@@ -50,7 +50,7 @@ public interface SnmpMibRequest {
* @return The element of the enumeration are instances of
* {@link com.sun.jmx.snmp.SnmpVarBind}
*/
public Enumeration getElements();
public Enumeration<SnmpVarBind> getElements();
/**
* Returns the vector of varbind to be handled by the SNMP mib node.
......
......@@ -87,6 +87,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
* Returns the local engine. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
* @return the local engine.
*/
@Override
public SnmpEngine getEngine() {
return engine;
}
......@@ -95,6 +96,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
* Gets the incoming request principal. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
* @return The request principal.
**/
@Override
public String getPrincipal() {
return principal;
}
......@@ -103,6 +105,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
* Gets the incoming request security level. This level is defined in {@link com.sun.jmx.snmp.SnmpEngine SnmpEngine}. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise -1 is returned.
* @return The security level.
*/
@Override
public int getSecurityLevel() {
return securityLevel;
}
......@@ -110,6 +113,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
* Gets the incoming request security model. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise -1 is returned.
* @return The security model.
*/
@Override
public int getSecurityModel() {
return securityModel;
}
......@@ -117,6 +121,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
* Gets the incoming request context name. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
* @return The context name.
*/
@Override
public byte[] getContextName() {
return contextName;
}
......@@ -125,6 +130,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
* Gets the incoming request context name used by Access Control Model in order to allow or deny the access to OIDs. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
* @return The checked context.
*/
@Override
public byte[] getAccessContextName() {
return accessContextName;
}
......@@ -133,6 +139,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public final SnmpPdu getPdu() {
return reqPdu;
}
......@@ -141,18 +148,21 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
public final Enumeration getElements() {return varbinds.elements();}
@Override
public final Enumeration<SnmpVarBind> getElements() {return varbinds.elements();}
// -------------------------------------------------------------------
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public final Vector<SnmpVarBind> getSubList() {return varbinds;}
// -------------------------------------------------------------------
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public final int getSize() {
if (varbinds == null) return 0;
return varbinds.size();
......@@ -162,24 +172,28 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public final int getVersion() {return version;}
// -------------------------------------------------------------------
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public final int getRequestPduVersion() {return reqPdu.version;}
// -------------------------------------------------------------------
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public final Object getUserData() {return data;}
// -------------------------------------------------------------------
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public final int getVarIndex(SnmpVarBind varbind) {
return varbinds.indexOf(varbind);
}
......@@ -188,6 +202,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------------
@Override
public void addVarBind(SnmpVarBind varbind) {
varbinds.addElement(varbind);
}
......@@ -218,7 +233,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest {
// Returns the underlying vector of SNMP varbinds (used for algorithm
// optimization).
// -------------------------------------------------------------------
final Vector getVarbinds() {return varbinds;}
final Vector<SnmpVarBind> getVarbinds() {return varbinds;}
// -------------------------------------------------------------------
// Private variables
......
......@@ -65,7 +65,8 @@ public interface SnmpMibSubRequest extends SnmpMibRequest {
* @return The elements of the enumeration are instances of
* {@link com.sun.jmx.snmp.SnmpVarBind}
*/
public Enumeration getElements();
@Override
public Enumeration<SnmpVarBind> getElements();
/**
* Return the list of varbind to be handled by the SNMP MIB node.
......@@ -85,6 +86,7 @@ public interface SnmpMibSubRequest extends SnmpMibRequest {
* @return The elements of the vector are instances of
* {@link com.sun.jmx.snmp.SnmpVarBind}
*/
@Override
public Vector<SnmpVarBind> getSubList();
/**
......
......@@ -266,6 +266,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* <p>
*
*/
@Override
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
......@@ -276,9 +277,9 @@ public abstract class SnmpMibTable extends SnmpMibNode
// each varbind involved (nb: should not happen, the error
// should have been registered earlier)
if (isnew) {
SnmpVarBind var = null;
for (Enumeration e= r.getElements(); e.hasMoreElements();) {
var = (SnmpVarBind) e.nextElement();
SnmpVarBind var;
for (Enumeration<SnmpVarBind> e= r.getElements(); e.hasMoreElements();) {
var = e.nextElement();
r.registerGetException(var,noSuchInstanceException);
}
}
......@@ -329,6 +330,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* <p>
*
*/
@Override
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
final SnmpOid oid = req.getEntryOid();
......@@ -389,6 +391,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* <p>
*
*/
@Override
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
......@@ -755,6 +758,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
*
* @exception IllegalArgumentException Listener parameter is null.
*/
@Override
public synchronized void
addNotificationListener(NotificationListener listener,
NotificationFilter filter, Object handback) {
......@@ -768,13 +772,11 @@ public abstract class SnmpMibTable extends SnmpMibNode
// looking for listener in handbackTable
//
Vector<Object> handbackList =
handbackTable.get(listener) ;
Vector<NotificationFilter> filterList =
filterTable.get(listener) ;
Vector<Object> handbackList = handbackTable.get(listener) ;
Vector<NotificationFilter> filterList = filterTable.get(listener) ;
if ( handbackList == null ) {
handbackList = new Vector<Object>() ;
filterList = new Vector<NotificationFilter>() ;
handbackList = new Vector<>() ;
filterList = new Vector<>() ;
handbackTable.put(listener, handbackList) ;
filterTable.put(listener, filterList) ;
}
......@@ -797,16 +799,14 @@ public abstract class SnmpMibTable extends SnmpMibNode
* @exception ListenerNotFoundException The listener is not registered
* in the MBean.
*/
@Override
public synchronized void
removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
// looking for listener in handbackTable
//
java.util.Vector handbackList =
(java.util.Vector) handbackTable.get(listener) ;
java.util.Vector filterList =
(java.util.Vector) filterTable.get(listener) ;
java.util.Vector<?> handbackList = handbackTable.get(listener) ;
if ( handbackList == null ) {
throw new ListenerNotFoundException("listener");
}
......@@ -822,6 +822,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* notification class and the notification type sent by the
* <CODE>SnmpMibTable</CODE>.
*/
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] types = {SnmpTableEntryNotification.SNMP_ENTRY_ADDED,
......@@ -1813,9 +1814,9 @@ public abstract class SnmpMibTable extends SnmpMibNode
//
// ---------------------------------------------------------------------
final static void checkRowStatusFail(SnmpMibSubRequest req,
int errorStatus)
static void checkRowStatusFail(SnmpMibSubRequest req, int errorStatus)
throws SnmpStatusException {
final SnmpVarBind statusvb = req.getRowStatusVarBind();
final SnmpStatusException x = new SnmpStatusException(errorStatus);
req.registerCheckException(statusvb,x);
......@@ -1827,9 +1828,9 @@ public abstract class SnmpMibTable extends SnmpMibNode
//
// ---------------------------------------------------------------------
final static void setRowStatusFail(SnmpMibSubRequest req,
int errorStatus)
static void setRowStatusFail(SnmpMibSubRequest req, int errorStatus)
throws SnmpStatusException {
final SnmpVarBind statusvb = req.getRowStatusVarBind();
final SnmpStatusException x = new SnmpStatusException(errorStatus);
req.registerSetException(statusvb,x);
......@@ -1840,6 +1841,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
// Implements the method defined in SnmpMibNode.
//
// ---------------------------------------------------------------------
@Override
final synchronized void findHandlingNode(SnmpVarBind varbind,
long[] oid, int depth,
SnmpRequestTree handlers)
......@@ -1909,11 +1911,15 @@ public abstract class SnmpMibTable extends SnmpMibNode
// largely inspired from the original getNext() method.
//
// ---------------------------------------------------------------------
@Override
final synchronized long[] findNextHandlingNode(SnmpVarBind varbind,
long[] oid, int pos, int depth,
SnmpRequestTree handlers,
AcmChecker checker)
long[] oid,
int pos,
int depth,
SnmpRequestTree handlers,
AcmChecker checker)
throws SnmpStatusException {
int length = oid.length;
if (handlers == null)
......@@ -1974,7 +1980,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
}
// Now that we've got everything right we can begin.
SnmpOid entryoid = null ;
SnmpOid entryoid;
if (pos == (length - 1)) {
// pos points to the last arc in the oid, and this arc is
......@@ -2200,28 +2206,25 @@ public abstract class SnmpMibTable extends SnmpMibNode
// loop on listener
//
for(java.util.Enumeration k = handbackTable.keys();
for(java.util.Enumeration<NotificationListener> k = handbackTable.keys();
k.hasMoreElements(); ) {
NotificationListener listener =
(NotificationListener) k.nextElement();
NotificationListener listener = k.nextElement();
// Get the associated handback list and the associated filter list
//
java.util.Vector handbackList =
(java.util.Vector) handbackTable.get(listener) ;
java.util.Vector filterList =
(java.util.Vector) filterTable.get(listener) ;
java.util.Vector<?> handbackList = handbackTable.get(listener) ;
java.util.Vector<NotificationFilter> filterList =
filterTable.get(listener) ;
// loop on handback
//
java.util.Enumeration f = filterList.elements();
for(java.util.Enumeration h = handbackList.elements();
java.util.Enumeration<NotificationFilter> f = filterList.elements();
for(java.util.Enumeration<?> h = handbackList.elements();
h.hasMoreElements(); ) {
Object handback = h.nextElement();
NotificationFilter filter =
(NotificationFilter)f.nextElement();
NotificationFilter filter = f.nextElement();
if ((filter == null) ||
(filter.isNotificationEnabled(notification))) {
......@@ -2300,7 +2303,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* OID was not found.
*
**/
private final int findObject(SnmpOid oid) {
private int findObject(SnmpOid oid) {
int low= 0;
int max= size - 1;
SnmpOid pos;
......@@ -2332,25 +2335,6 @@ public abstract class SnmpMibTable extends SnmpMibNode
return -1;
}
/**
* Search the position at which the given oid should be inserted
* in the OID table (tableoids).
*
* <p>
* @param oid The OID we would like to insert.
*
* @return The position at which the OID should be inserted in
* the table.
*
* @exception SnmpStatusException if the OID is already present in the
* table.
*
**/
private final int getInsertionPoint(SnmpOid oid)
throws SnmpStatusException {
return getInsertionPoint(oid, true);
}
/**
* Search the position at which the given oid should be inserted
* in the OID table (tableoids).
......@@ -2371,7 +2355,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* table and <code>fail</code> is <code>true</code>.
*
**/
private final int getInsertionPoint(SnmpOid oid, boolean fail)
private int getInsertionPoint(SnmpOid oid, boolean fail)
throws SnmpStatusException {
final int failStatus = SnmpStatusException.snmpRspNotWritable;
......@@ -2413,7 +2397,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* @param pos The position at which the OID to be removed is located.
*
**/
private final void removeOid(int pos) {
private void removeOid(int pos) {
if (pos >= tablecount) return;
if (pos < 0) return;
final int l1 = --tablecount-pos;
......@@ -2431,7 +2415,7 @@ public abstract class SnmpMibTable extends SnmpMibNode
* @param pos The position at which the OID to be added is located.
*
**/
private final void insertOid(int pos, SnmpOid oid) {
private void insertOid(int pos, SnmpOid oid) {
if (pos >= tablesize || tablecount == tablesize) {
// Vector must be enlarged
......@@ -2534,13 +2518,13 @@ public abstract class SnmpMibTable extends SnmpMibNode
* The list of entries.
* @serial
*/
private final Vector<Object> entries= new Vector<Object>();
private final Vector<Object> entries= new Vector<>();
/**
* The list of object names.
* @serial
*/
private final Vector<ObjectName> entrynames= new Vector<ObjectName>();
private final Vector<ObjectName> entrynames= new Vector<>();
/**
* Callback handlers
......@@ -2548,17 +2532,16 @@ public abstract class SnmpMibTable extends SnmpMibNode
// final Vector callbacks = new Vector();
/**
* Listener hastable containing the hand-back objects.
* Listener hashtable containing the hand-back objects.
*/
private Hashtable<NotificationListener, Vector<Object>> handbackTable =
new Hashtable<NotificationListener, Vector<Object>>();
new Hashtable<>();
/**
* Listener hastable containing the filter objects.
* Listener hashtable containing the filter objects.
*/
private Hashtable<NotificationListener, Vector<NotificationFilter>>
filterTable =
new Hashtable<NotificationListener, Vector<NotificationFilter>>();
filterTable = new Hashtable<>();
// PACKAGE VARIABLES
//------------------
......
......@@ -25,11 +25,9 @@
package com.sun.jmx.snmp.agent;
import java.util.Vector;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Arrays;
import java.util.logging.Level;
......@@ -77,7 +75,7 @@ final class SnmpRequestTree {
this.request = req;
this.version = req.getVersion();
this.creationflag = creationflag;
this.hashtable = new Hashtable<Object, Handler>();
this.hashtable = new Hashtable<>();
setPduType(pdutype);
}
......@@ -191,7 +189,7 @@ final class SnmpRequestTree {
// SnmSubRequest associated with an Handler node.
//-------------------------------------------------------------------
static final class Enum implements Enumeration {
static final class Enum implements Enumeration<SnmpMibSubRequest> {
Enum(SnmpRequestTree hlist,Handler h) {
handler = h;
this.hlist = hlist;
......@@ -203,11 +201,13 @@ final class SnmpRequestTree {
private int iter = 0;
private int size = 0;
@Override
public boolean hasMoreElements() {
return iter < size;
}
public Object nextElement() throws NoSuchElementException {
@Override
public SnmpMibSubRequest nextElement() throws NoSuchElementException {
if (iter == 0) {
if (handler.sublist != null) {
iter++;
......@@ -216,7 +216,7 @@ final class SnmpRequestTree {
}
iter ++;
if (iter > size) throw new NoSuchElementException();
Object result = hlist.getSubRequest(handler,entry);
SnmpMibSubRequest result = hlist.getSubRequest(handler,entry);
entry++;
return result;
}
......@@ -252,7 +252,8 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------
public Enumeration getElements() {
@Override
public Enumeration<SnmpVarBind> getElements() {
return varbinds.elements();
}
......@@ -260,6 +261,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------
@Override
public Vector<SnmpVarBind> getSubList() {
return varbinds;
}
......@@ -268,6 +270,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------
@Override
public final int getSize() {
if (varbinds == null) return 0;
return varbinds.size();
......@@ -277,6 +280,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------
@Override
public void addVarBind(SnmpVarBind varbind) {
// XXX not sure we must also add the varbind in the global
// request? or whether we should raise an exception:
......@@ -289,6 +293,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibSubRequest interface.
// See SnmpMibSubRequest for the java doc.
// -------------------------------------------------------------
@Override
public boolean isNewEntry() {
return isnew;
}
......@@ -297,6 +302,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibSubRequest interface.
// See SnmpMibSubRequest for the java doc.
// -------------------------------------------------------------
@Override
public SnmpOid getEntryOid() {
return entryoid;
}
......@@ -305,6 +311,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------
@Override
public int getVarIndex(SnmpVarBind varbind) {
if (varbind == null) return 0;
return global.getVarIndex(varbind);
......@@ -314,6 +321,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------
@Override
public Object getUserData() { return global.getUserData(); }
......@@ -322,6 +330,7 @@ final class SnmpRequestTree {
// See SnmpMibSubRequest for the java doc.
// -------------------------------------------------------------
@Override
public void registerGetException(SnmpVarBind var,
SnmpStatusException exception)
throws SnmpStatusException {
......@@ -364,6 +373,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibSubRequest interface.
// See SnmpMibSubRequest for the java doc.
// -------------------------------------------------------------
@Override
public void registerSetException(SnmpVarBind var,
SnmpStatusException exception)
throws SnmpStatusException {
......@@ -387,6 +397,7 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibSubRequest interface.
// See SnmpMibSubRequest for the java doc.
// -------------------------------------------------------------
@Override
public void registerCheckException(SnmpVarBind var,
SnmpStatusException exception)
throws SnmpStatusException {
......@@ -410,42 +421,52 @@ final class SnmpRequestTree {
// Implements the method defined in SnmpMibRequest interface.
// See SnmpMibRequest for the java doc.
// -------------------------------------------------------------
@Override
public int getVersion() {
return version;
}
@Override
public SnmpVarBind getRowStatusVarBind() {
return statusvb;
}
@Override
public SnmpPdu getPdu() {
return global.getPdu();
}
@Override
public int getRequestPduVersion() {
return global.getRequestPduVersion();
}
@Override
public SnmpEngine getEngine() {
return global.getEngine();
}
@Override
public String getPrincipal() {
return global.getPrincipal();
}
@Override
public int getSecurityLevel() {
return global.getSecurityLevel();
}
@Override
public int getSecurityModel() {
return global.getSecurityModel();
}
@Override
public byte[] getContextName() {
return global.getContextName();
}
@Override
public byte[] getAccessContextName() {
return global.getAccessContextName();
}
......@@ -485,7 +506,7 @@ final class SnmpRequestTree {
* Adds a varbind in this node sublist.
*/
public void addVarbind(SnmpVarBind varbind) {
if (sublist == null) sublist = new Vector<SnmpVarBind>();
if (sublist == null) sublist = new Vector<>();
sublist.addElement(varbind);
}
......@@ -503,7 +524,7 @@ final class SnmpRequestTree {
// Vectors are null: Allocate new vectors
entryoids = new SnmpOid[Delta];
entrylists = new Vector[Delta];
entrylists = (Vector<SnmpVarBind>[])new Vector<?>[Delta];
isentrynew = new boolean[Delta];
rowstatus = new SnmpVarBind[Delta];
entrysize = Delta;
......@@ -521,7 +542,7 @@ final class SnmpRequestTree {
// Allocate larger vectors
entrysize += Delta;
entryoids = new SnmpOid[entrysize];
entrylists = new Vector[entrysize];
entrylists = (Vector<SnmpVarBind>[])new Vector<?>[entrysize];
isentrynew = new boolean[entrysize];
rowstatus = new SnmpVarBind[entrysize];
......@@ -595,7 +616,7 @@ final class SnmpRequestTree {
// entryoids = new ArrayList();
// entrylists = new ArrayList();
// isentrynew = new ArrayList();
v = new Vector<SnmpVarBind>();
v = new Vector<>();
// entryoids.add(entryoid);
// entrylists.add(v);
// isentrynew.add(new Boolean(isnew));
......@@ -614,7 +635,7 @@ final class SnmpRequestTree {
// if (pos == -1 || pos >= entrycount ) {
// pos = getInsertionPoint(entryoids,entryoid);
// pos = getInsertionPoint(entryoids,entrycount,entryoid);
v = new Vector<SnmpVarBind>();
v = new Vector<>();
// entryoids.add(pos,entryoid);
// entrylists.add(pos,v);
// isentrynew.add(pos,new Boolean(isnew));
......@@ -775,7 +796,7 @@ final class SnmpRequestTree {
// If it is a table, there will be one subrequest per entry involved.
//-------------------------------------------------------------------
public Enumeration getSubRequests(Handler handler) {
public Enumeration<SnmpMibSubRequest> getSubRequests(Handler handler) {
return new Enum(this,handler);
}
......@@ -783,7 +804,7 @@ final class SnmpRequestTree {
// returns an enumeration of the Handlers stored in the Hashtable.
//-------------------------------------------------------------------
public Enumeration getHandlers() {
public Enumeration<Handler> getHandlers() {
return hashtable.elements();
}
......@@ -1048,7 +1069,6 @@ final class SnmpRequestTree {
handler.addVarbind(varbind);
else
handler.addVarbind(varbind,entryoid,isnew,statusvb);
return ;
}
......
......@@ -27,14 +27,7 @@ package com.sun.jmx.snmp.agent;
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Vector;
// jmx imports
//
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
......@@ -121,8 +114,8 @@ public class SnmpStandardObjectServer implements Serializable {
final Object data = req.getUserData();
for (Enumeration e= req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var= e.nextElement();
try {
final long id = var.oid.getOidArc(depth);
var.value = meta.get(id, data);
......@@ -182,9 +175,8 @@ public class SnmpStandardObjectServer implements Serializable {
final Object data = req.getUserData();
for (Enumeration e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var = null;
var = (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements();) {
SnmpVarBind var = e.nextElement();
try {
// This method will generate a SnmpStatusException
// if `depth' is out of bounds.
......@@ -248,8 +240,8 @@ public class SnmpStandardObjectServer implements Serializable {
final Object data = req.getUserData();
for (Enumeration e= req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var = (SnmpVarBind) e.nextElement();
for (Enumeration<SnmpVarBind> e= req.getElements(); e.hasMoreElements();) {
final SnmpVarBind var = e.nextElement();
try {
// This method will generate a SnmpStatusException
// if `depth' is out of bounds.
......
......@@ -33,7 +33,6 @@ package com.sun.jmx.snmp.daemon;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.Vector;
import java.util.NoSuchElementException;
......@@ -50,8 +49,6 @@ import javax.management.NotificationBroadcasterSupport;
import javax.management.MBeanNotificationInfo;
import javax.management.AttributeChangeNotification;
import javax.management.ListenerNotFoundException;
import javax.management.loading.ClassLoaderRepository;
import javax.management.MBeanServerFactory;
import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER;
......@@ -225,9 +222,8 @@ public abstract class CommunicatorServer
private transient Object stateLock = new Object();
private transient Vector<ClientHandler>
clientHandlerVector = new Vector<ClientHandler>() ;
clientHandlerVector = new Vector<>() ;
private transient Thread fatherThread = Thread.currentThread() ;
private transient Thread mainThread = null ;
private volatile boolean stopRequested = false ;
......@@ -328,6 +324,7 @@ public abstract class CommunicatorServer
* Has no effect if this <CODE>CommunicatorServer</CODE> is
* <CODE>ONLINE</CODE> or <CODE>STOPPING</CODE>.
*/
@Override
public void start() {
try {
start(0);
......@@ -346,6 +343,7 @@ public abstract class CommunicatorServer
* Has no effect if this <CODE>CommunicatorServer</CODE> is
* <CODE>OFFLINE</CODE> or <CODE>STOPPING</CODE>.
*/
@Override
public void stop() {
synchronized (stateLock) {
if (state == OFFLINE || state == STOPPING) {
......@@ -393,6 +391,7 @@ public abstract class CommunicatorServer
*
* @return True if connector is <CODE>ONLINE</CODE>; false otherwise.
*/
@Override
public boolean isActive() {
synchronized (stateLock) {
return (state == ONLINE);
......@@ -431,6 +430,7 @@ public abstract class CommunicatorServer
* @return true if the value of this MBean's State attribute is the
* same as the <VAR>wantedState</VAR> parameter; false otherwise.
*/
@Override
public boolean waitState(int wantedState, long timeOut) {
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
......@@ -595,6 +595,7 @@ public abstract class CommunicatorServer
* @return <CODE>ONLINE</CODE>, <CODE>OFFLINE</CODE>,
* <CODE>STARTING</CODE> or <CODE>STOPPING</CODE>.
*/
@Override
public int getState() {
synchronized (stateLock) {
return state ;
......@@ -607,6 +608,7 @@ public abstract class CommunicatorServer
* @return One of the strings "ONLINE", "OFFLINE", "STARTING" or
* "STOPPING".
*/
@Override
public String getStateString() {
return getStringForState(state) ;
}
......@@ -616,6 +618,7 @@ public abstract class CommunicatorServer
*
* @return The host name used by this <CODE>CommunicatorServer</CODE>.
*/
@Override
public String getHost() {
try {
host = InetAddress.getLocalHost().getHostName();
......@@ -630,6 +633,7 @@ public abstract class CommunicatorServer
*
* @return The port number used by this <CODE>CommunicatorServer</CODE>.
*/
@Override
public int getPort() {
synchronized (stateLock) {
return port ;
......@@ -645,6 +649,7 @@ public abstract class CommunicatorServer
* @exception java.lang.IllegalStateException This method has been invoked
* while the communicator was ONLINE or STARTING.
*/
@Override
public void setPort(int port) throws java.lang.IllegalStateException {
synchronized (stateLock) {
if ((state == ONLINE) || (state == STARTING))
......@@ -659,7 +664,8 @@ public abstract class CommunicatorServer
* Gets the protocol being used by this <CODE>CommunicatorServer</CODE>.
* @return The protocol as a string.
*/
public abstract String getProtocol() ;
@Override
public abstract String getProtocol();
/**
* Gets the number of clients that have been processed by this
......@@ -754,6 +760,7 @@ public abstract class CommunicatorServer
* <p>
* The <CODE>run</CODE> method executed by this connector's main thread.
*/
@Override
public void run() {
// Fix jaw.00667.B
......@@ -851,7 +858,7 @@ public abstract class CommunicatorServer
} finally {
synchronized (stateLock) {
interrupted = true;
Thread.currentThread().interrupted();
Thread.interrupted();
}
// ----------------------
......@@ -970,7 +977,7 @@ public abstract class CommunicatorServer
"MBeanServer argument must be MBean server where this " +
"server is registered, or an MBeanServerForwarder " +
"leading to that server";
Vector<MBeanServer> seenMBS = new Vector<MBeanServer>();
Vector<MBeanServer> seenMBS = new Vector<>();
for (MBeanServer mbs = newMBS;
mbs != bottomMBS;
mbs = ((MBeanServerForwarder) mbs).getMBeanServer()) {
......@@ -1153,8 +1160,7 @@ public abstract class CommunicatorServer
state = OFFLINE;
stopRequested = false;
servedClientCount = 0;
clientHandlerVector = new Vector<ClientHandler>();
fatherThread = Thread.currentThread();
clientHandlerVector = new Vector<>();
mainThread = null;
notifCount = 0;
notifInfos = null;
......@@ -1184,6 +1190,7 @@ public abstract class CommunicatorServer
*
* @exception IllegalArgumentException Listener parameter is null.
*/
@Override
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
......@@ -1207,6 +1214,7 @@ public abstract class CommunicatorServer
*
* @exception ListenerNotFoundException The listener is not registered.
*/
@Override
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
......@@ -1225,6 +1233,7 @@ public abstract class CommunicatorServer
* sent when the <tt>State</tt> attribute of this CommunicatorServer
* changes.
*/
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
// Initialize notifInfos on first call to getNotificationInfo()
......@@ -1304,6 +1313,7 @@ public abstract class CommunicatorServer
* the <CODE>MBeanServer</CODE> and re-thrown
* as an <CODE>MBeanRegistrationException</CODE>.
*/
@Override
public ObjectName preRegister(MBeanServer server, ObjectName name)
throws java.lang.Exception {
objectName = name;
......@@ -1325,6 +1335,7 @@ public abstract class CommunicatorServer
* successfully registered in the <CODE>MBeanServer</CODE>.
* The value false means that the registration phase has failed.
*/
@Override
public void postRegister(Boolean registrationDone) {
if (!registrationDone.booleanValue()) {
synchronized (this) {
......@@ -1340,6 +1351,7 @@ public abstract class CommunicatorServer
* the <CODE>MBeanServer</CODE> and re-thrown
* as an <CODE>MBeanRegistrationException</CODE>.
*/
@Override
public void preDeregister() throws java.lang.Exception {
synchronized (this) {
topMBS = bottomMBS = null;
......@@ -1354,22 +1366,8 @@ public abstract class CommunicatorServer
/**
* Do nothing.
*/
@Override
public void postDeregister(){
}
/**
* Load a class using the default loader repository
**/
Class loadClass(String className)
throws ClassNotFoundException {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
final ClassLoaderRepository clr =
MBeanServerFactory.getClassLoaderRepository(bottomMBS);
if (clr == null) throw new ClassNotFoundException(className);
return clr.loadClass(className);
}
}
}
......@@ -140,6 +140,7 @@ public interface SnmpAdaptorServerMBean extends CommunicatorServerMBean {
*
* @return The string "snmp".
*/
@Override
public String getProtocol();
/**
......@@ -636,7 +637,8 @@ public interface SnmpAdaptorServerMBean extends CommunicatorServerMBean {
* @exception IOException An I/O error occurred while sending the inform request.
* @exception SnmpStatusException If the inform request exceeds the limit defined by <CODE>bufferSize</CODE>.
*/
public Vector snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList)
public Vector<?> snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid,
SnmpVarBindList varBindList)
throws IllegalStateException, IOException, SnmpStatusException;
/**
......
......@@ -125,7 +125,7 @@ final class SnmpMibTree {
TreeNode node= retrieveChild(oid, cursor);
if (node == null)
return this;
if (children.size() == 0) {
if (children.isEmpty()) {
// In this case, the node does not have any children. So no point to
// continue the search ...
return node;
......@@ -149,24 +149,24 @@ final class SnmpMibTree {
public void printTree(String ident) {
StringBuffer buff= new StringBuffer();
StringBuilder buff= new StringBuilder();
if (agents == null) {
return;
}
for(Enumeration e= agents.elements(); e.hasMoreElements(); ) {
SnmpMibAgent mib= (SnmpMibAgent) e.nextElement();
for(Enumeration<SnmpMibAgent> e= agents.elements(); e.hasMoreElements(); ) {
SnmpMibAgent mib= e.nextElement();
if (mib == null)
buff.append("empty ");
else
buff.append(mib.getMibName() + " ");
buff.append(mib.getMibName()).append(" ");
}
ident+= " ";
if (children == null) {
return;
}
for(Enumeration e= children.elements(); e.hasMoreElements(); ) {
TreeNode node= (TreeNode) e.nextElement();
for(Enumeration<TreeNode> e= children.elements(); e.hasMoreElements(); ) {
TreeNode node= e.nextElement();
node.printTree(ident);
}
}
......@@ -185,7 +185,7 @@ final class SnmpMibTree {
}
private void removeAgentFully(SnmpMibAgent agent) {
Vector<TreeNode> v = new Vector<TreeNode>();
Vector<TreeNode> v = new Vector<>();
for(Enumeration<TreeNode> e= children.elements();
e.hasMoreElements(); ) {
......@@ -212,9 +212,9 @@ final class SnmpMibTree {
}
private void setAgent(SnmpMibAgent agent) {
this.agent = agent;
}
private void setAgent(SnmpMibAgent agent) {
this.agent = agent;
}
private void registerNode(long[] oid, int cursor, SnmpMibAgent agent) {
......@@ -247,20 +247,20 @@ final class SnmpMibTree {
private TreeNode retrieveChild(long[] oid, int current) {
long theValue= oid[current];
for(Enumeration e= children.elements(); e.hasMoreElements(); ) {
TreeNode node= (TreeNode) e.nextElement();
for(Enumeration<TreeNode> e= children.elements(); e.hasMoreElements(); ) {
TreeNode node= e.nextElement();
if (node.match(theValue))
return node;
}
return null;
}
final private boolean match(long value) {
private boolean match(long value) {
return (nodeValue == value) ? true : false;
}
private Vector<TreeNode> children= new Vector<TreeNode>();
private Vector<SnmpMibAgent> agents= new Vector<SnmpMibAgent>();
private Vector<TreeNode> children= new Vector<>();
private Vector<SnmpMibAgent> agents= new Vector<>();
private long nodeValue;
private SnmpMibAgent agent;
private TreeNode parent;
......
......@@ -31,7 +31,6 @@ package com.sun.jmx.snmp.daemon;
// java import
//
import java.util.Enumeration;
import java.util.Vector;
import java.util.logging.Level;
// jmx imports
//
......@@ -46,9 +45,6 @@ import com.sun.jmx.snmp.SnmpEngine;
//
import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER;
import com.sun.jmx.snmp.agent.SnmpMibAgent;
import com.sun.jmx.snmp.agent.SnmpMibRequest;
import com.sun.jmx.snmp.ThreadContext;
import com.sun.jmx.snmp.daemon.SnmpAdaptorServer;
import com.sun.jmx.snmp.internal.SnmpIncomingRequest;
import com.sun.jmx.snmp.ThreadContext;
......@@ -85,6 +81,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler {
init(server, req, nonRepeat, maxRepeat, R);
}
@Override
public void run() {
size= varBind.size();
......@@ -259,11 +256,12 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler {
* successful. As such the method getErrorIndex or getErrorStatus should be
* called.
*/
@Override
protected void updateResult(SnmpVarBind[] result) {
// we can assume that the run method is over ...
//
final Enumeration e= varBind.elements();
final Enumeration<SnmpVarBind> e= varBind.elements();
final int max= result.length;
// First go through all the values once ...
......@@ -284,7 +282,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler {
continue;
}
final SnmpVarBind element= (SnmpVarBind) e.nextElement();
final SnmpVarBind element= e.nextElement();
if (element == null) continue;
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
......@@ -309,7 +307,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler {
return;
if (e.hasMoreElements() ==false)
return;
final SnmpVarBind element= (SnmpVarBind) e.nextElement();
final SnmpVarBind element= e.nextElement();
if (element == null) continue;
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
......
......@@ -60,7 +60,7 @@ public class SnmpProperties {
InputStream is = new FileInputStream(file);
props.load(is);
is.close();
for (final Enumeration e = props.keys(); e.hasMoreElements() ; ) {
for (final Enumeration<?> e = props.keys(); e.hasMoreElements() ; ) {
final String key = (String) e.nextElement();
System.setProperty(key,props.getProperty(key));
}
......
......@@ -199,7 +199,7 @@ public class ThreadService implements TaskServer {
// re-init
this.setPriority(priority);
this.interrupted();
Thread.interrupted();
this.setContextClassLoader(cloader);
}
}
......
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
......@@ -53,12 +53,13 @@ public class KeyManagerFactory {
/**
* <p>The default KeyManager can be changed by setting the value of the
* "sun.ssl.keymanager.type" security property (in the Java security
* properties file) to the desired name.
* {@code sun.ssl.keymanager.type} security property to the desired name.
*
* @return the default type as specified in the
* Java security properties file, or an implementation-specific default
* if no such property exists.
* @return the default type as specified by the
* {@code sun.ssl.keymanager.type} security property, or an
* implementation-specific default if no such property exists.
*
* @see java.security.Security security properties
*/
public final static String getDefaultAlgorithm() {
String type;
......
/*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
......@@ -46,8 +46,8 @@ import java.lang.SecurityManager;
* convention follows the hierarchical property naming convention.
* Also, an asterisk
* may appear at the end of the name, following a ".", or by itself, to
* signify a wildcard match. For example: "foo.*" or "*" is valid,
* "*foo" or "a*b" is not valid.
* signify a wildcard match. For example: "foo.*" and "*" signify a wildcard
* match, while "*foo" and "a*b" do not.
* <P>
* The following table lists all the possible SSLPermission target names,
* and for each provides a description of what the permission allows
......
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
......@@ -53,12 +53,13 @@ public class TrustManagerFactory {
/**
* <p>The default TrustManager can be changed by setting the value of the
* "sun.ssl.trustmanager.type" security property
* (in the Java security properties file) to the desired name.
* {@code sun.ssl.trustmanager.type} security property to the desired name.
*
* @return the default type as specified in the
* Java security properties file, or an implementation-specific default
* if no such property exists.
* @return the default type as specified by the
* {@code sun.ssl.trustmanager.type} security property, or an
* implementation-specific default if no such property exists.
*
* @see java.security.Security security properties
*/
public final static String getDefaultAlgorithm() {
String type;
......
......@@ -264,7 +264,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
* <code>false</code> otherwise
*/
public boolean writeData(RowSetInternal caller) throws SQLException {
boolean conflict = false;
long conflicts = 0;
boolean showDel = false;
PreparedStatement pstmtIns = null;
iChangedValsInDbAndCRS = 0;
......@@ -337,8 +337,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
while (crs.next()) {
if (crs.rowDeleted()) {
// The row has been deleted.
if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
if (deleteOriginalRow(crs, this.crsResolve)) {
status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
conflicts++;
} else {
// delete happened without any occurrence of conflicts
// so update status accordingly
......@@ -349,8 +350,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// The row has been inserted.
pstmtIns = con.prepareStatement(insertCmd);
if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
if (insertNewRow(crs, pstmtIns, this.crsResolve)) {
status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
conflicts++;
} else {
// insert happened without any occurrence of conflicts
// so update status accordingly
......@@ -358,8 +360,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
}
} else if (crs.rowUpdated()) {
// The row has been updated.
if ( conflict = (updateOriginalRow(crs)) == true) {
if (updateOriginalRow(crs)) {
status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
conflicts++;
} else {
// update happened without any occurrence of conflicts
// so update status accordingly
......@@ -395,21 +398,12 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// reset
crs.setShowDeleted(showDel);
boolean boolConf = false;
for (int j=1;j<status.size();j++){
// ignore status for index = 0 which is set to null
if(! ((status.get(j)).equals(SyncResolver.NO_ROW_CONFLICT))) {
// there is at least one conflict which needs to be resolved
boolConf = true;
break;
}
}
crs.beforeFirst();
this.crsResolve.beforeFirst();
if(boolConf) {
SyncProviderException spe = new SyncProviderException(status.size() - 1+resBundle.handleGetObject("crswriter.conflictsno").toString());
if(conflicts != 0) {
SyncProviderException spe = new SyncProviderException(conflicts + " " +
resBundle.handleGetObject("crswriter.conflictsno").toString());
//SyncResolver syncRes = spe.getSyncResolver();
SyncResolverImpl syncResImpl = (SyncResolverImpl) spe.getSyncResolver();
......
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
......@@ -59,13 +59,9 @@ import sun.security.util.PropertyExpander;
*
* <ol>
* <li>
* Loop through the <code>java.security.Security</code> properties,
* Loop through the security properties,
* <i>auth.policy.url.1</i>, <i>auth.policy.url.2</i>, ...,
* <i>auth.policy.url.X</i>". These properties are set
* in the Java security properties file, which is located in the file named
* &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* <i>auth.policy.url.X</i>".
* Each property value specifies a <code>URL</code> pointing to a
* policy file to be loaded. Read in and load each policy.
*
......@@ -235,6 +231,7 @@ import sun.security.util.PropertyExpander;
* @see java.security.CodeSource
* @see java.security.Permissions
* @see java.security.ProtectionDomain
* @see java.security.Security security properties
*/
@Deprecated
public class PolicyFile extends javax.security.auth.Policy {
......
......@@ -1067,10 +1067,6 @@ public class Krb5LoginModule implements LoginModule {
if (ktab != null) {
if (!privCredSet.contains(ktab)) {
privCredSet.add(ktab);
// Compatibility; also add keys to privCredSet
for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) {
privCredSet.add(new Krb5Util.KeysFromKeyTab(key));
}
}
} else {
succeeded = false;
......
......@@ -34,7 +34,7 @@ import sun.invoke.util.Wrapper;
import java.io.*;
import java.util.*;
import com.sun.xml.internal.ws.org.objectweb.asm.*;
import jdk.internal.org.objectweb.asm.*;
import java.lang.reflect.*;
import static java.lang.invoke.MethodHandleStatics.*;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册