OpenJDK / bsd-port / jdk8 / jdk
changeset 6285:4a21f818ebb1
Merge
author | mullan |
---|---|
date | Mon, 17 Dec 2012 08:30:06 -0500 |
parents | e4d88a7352c6 a02212de8db6 |
children | bcf79e6f52a0 4d28776d7007 |
files | src/share/classes/sun/awt/TextureSizeConstraining.java test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java |
diffstat | 447 files changed, 6915 insertions(+), 2652 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Mon Dec 17 08:28:27 2012 -0500 +++ b/.hgtags Mon Dec 17 08:30:06 2012 -0500 @@ -188,3 +188,5 @@ 26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64 130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65 4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66 +ce9b02a3a17edd1983201002cfa0f364e4ab7524 jdk8-b67 +53fb43e4d614c92310e1fb00ec41d1960fd9facf jdk8-b68
--- a/make/com/sun/security/Makefile Mon Dec 17 08:28:27 2012 -0500 +++ b/make/com/sun/security/Makefile Mon Dec 17 08:30:06 2012 -0500 @@ -35,7 +35,7 @@ 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::
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/com/sun/security/ntlm/Makefile Mon Dec 17 08:30:06 2012 -0500 @@ -0,0 +1,39 @@ +# +# 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
--- a/make/sun/security/Makefile Mon Dec 17 08:28:27 2012 -0500 +++ b/make/sun/security/Makefile Mon Dec 17 08:30:06 2012 -0500 @@ -38,10 +38,12 @@ 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
--- a/make/tools/src/build/tools/cldrconverter/Bundle.java Mon Dec 17 08:28:27 2012 -0500 +++ b/make/tools/src/build/tools/cldrconverter/Bundle.java Mon Dec 17 08:30:06 2012 -0500 @@ -29,6 +29,7 @@ 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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; + } }
--- a/make/tools/src/build/tools/cldrconverter/BundleGenerator.java Mon Dec 17 08:28:27 2012 -0500 +++ b/make/tools/src/build/tools/cldrconverter/BundleGenerator.java Mon Dec 17 08:30:06 2012 -0500 @@ -30,8 +30,27 @@ 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; }
--- a/make/tools/src/build/tools/cldrconverter/CLDRConverter.java Mon Dec 17 08:28:27 2012 -0500 +++ b/make/tools/src/build/tools/cldrconverter/CLDRConverter.java Mon Dec 17 08:30:06 2012 -0500 @@ -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 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ private KeyComparator() { } + @Override public int compare(String o1, String o2) { int len1 = o1.length(); int len2 = o2.length(); @@ -476,7 +490,26 @@ } 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 @@ 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 @@ if (x == 0 || escapeSpace) { outBuffer.append('\\'); } - outBuffer.append(' '); break; case '\\': @@ -584,7 +624,7 @@ 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) {
--- a/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java Mon Dec 17 08:28:27 2012 -0500 +++ b/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java Mon Dec 17 08:30:06 2012 -0500 @@ -155,6 +155,9 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ zoneNameStyle = "short"; pushContainer(qName, attributes); break; - case "generic": // not used in JDK - pushIgnoredContainer(qName); + 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 "standard": // standard time - pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle); - break; - case "daylight": - pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle); - break; - case "exemplarCity": + case "exemplarCity": // not used in JDK pushIgnoredContainer(qName); break; @@ -530,6 +543,7 @@ case "timeZoneNames": zonePrefix = null; break; + case "generic": case "standard": case "daylight": if (zonePrefix != null && (currentContainer instanceof Entry)) {
--- a/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java Mon Dec 17 08:28:27 2012 -0500 +++ b/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java Mon Dec 17 08:30:06 2012 -0500 @@ -46,8 +46,9 @@ 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":
--- a/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java Mon Dec 17 08:28:27 2012 -0500 +++ b/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java Mon Dec 17 08:30:06 2012 -0500 @@ -28,14 +28,16 @@ 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 @@ 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 @@ 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() {"); + if (fmt != null) { + out.print(fmt.toString()); } - out.println(" @Override\n" + - " protected final Object[][] getContents() {\n" + - " final Object[][] data = new Object[][] {"); + out.println(" final Object[][] data = new Object[][] {"); } for (String key : map.keySet()) { if (useJava) { @@ -91,7 +114,11 @@ 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[] {");
--- a/makefiles/CompileDemos.gmk Mon Dec 17 08:28:27 2012 -0500 +++ b/makefiles/CompileDemos.gmk Mon Dec 17 08:30:06 2012 -0500 @@ -194,15 +194,6 @@ ################################################################################################## -# 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))
--- a/makefiles/CompileJavaClasses.gmk Mon Dec 17 08:28:27 2012 -0500 +++ b/makefiles/CompileJavaClasses.gmk Mon Dec 17 08:30:06 2012 -0500 @@ -221,24 +221,10 @@ 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 @@ -339,29 +325,14 @@ ########################################################################################## -# -# 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 @@ -384,7 +355,7 @@ 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 \ @@ -396,11 +367,9 @@ 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 \ @@ -410,16 +379,15 @@ 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
--- a/makefiles/CompileNativeLibraries.gmk Mon Dec 17 08:28:27 2012 -0500 +++ b/makefiles/CompileNativeLibraries.gmk Mon Dec 17 08:30:06 2012 -0500 @@ -125,7 +125,7 @@ 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 @@ 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 @@ 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 @@ -2236,7 +2236,7 @@ $(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)\ @@ -2540,6 +2540,7 @@ ########################################################################################## ifneq ($(OPENJDK_TARGET_OS), windows) +ifneq ($(OPENJDK_TARGET_OS), macosx) $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\ LIBRARY:=j2gss,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ @@ -2559,6 +2560,7 @@ BUILD_LIBRARIES += $(BUILD_LIBJ2GSS) endif +endif ##########################################################################################
--- a/makefiles/CreateJars.gmk Mon Dec 17 08:28:27 2012 -0500 +++ b/makefiles/CreateJars.gmk Mon Dec 17 08:30:06 2012 -0500 @@ -446,9 +446,7 @@ $(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 @@ $(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 @@ $(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 @@ $(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 @@ ########################################################################################## -ifdef OPENJDK +US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar -# -# 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 +ifndef OPENJDK -$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ -US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy + $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar + $(ECHO) $(LOG_INFO) Copying $(@F) + $(install-file) -$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\ +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_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/% + $(install-file) + + 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)) +endif + JARS += $(US_EXPORT_POLICY_JAR_DST) -endif - ########################################################################################## +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) $< $@ + # + # 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 -$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\ + 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)) +endif + JARS += $(LOCAL_POLICY_JAR_DST) -endif - ########################################################################################## ifeq ($(OPENJDK_TARGET_OS),windows) @@ -648,9 +651,7 @@ $(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_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_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 @@ ########################################################################################## +# +# 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 ##########################################################################################
--- a/makefiles/Images.gmk Mon Dec 17 08:28:27 2012 -0500 +++ b/makefiles/Images.gmk Mon Dec 17 08:30:06 2012 -0500 @@ -211,10 +211,11 @@ 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 " \) )
--- a/makefiles/Import.gmk Mon Dec 17 08:28:27 2012 -0500 +++ b/makefiles/Import.gmk Mon Dec 17 08:30:06 2012 -0500 @@ -231,22 +231,6 @@ 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)
--- a/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Mon Dec 17 08:30:06 2012 -0500 @@ -714,7 +714,8 @@ "PopupMenu.font", menuFont, "PopupMenu.background", menuBackgroundColor, - "PopupMenu.translucentBackground", translucentWhite, + // Fix for 7154516: make popups opaque + "PopupMenu.translucentBackground", white, "PopupMenu.foreground", menuForegroundColor, "PopupMenu.selectionBackground", menuSelectedBackgroundColor, "PopupMenu.selectionForeground", menuSelectedForegroundColor,
--- a/src/macosx/classes/sun/awt/CGraphicsConfig.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/awt/CGraphicsConfig.java Mon Dec 17 08:30:06 2012 -0500 @@ -31,13 +31,16 @@ import sun.java2d.SurfaceData; import sun.java2d.opengl.CGLLayer; +import sun.lwawt.LWGraphicsConfig; import sun.lwawt.macosx.CPlatformView; -public class CGraphicsConfig extends GraphicsConfiguration { +public abstract class CGraphicsConfig extends GraphicsConfiguration + implements LWGraphicsConfig { + private final CGraphicsDevice device; private ColorModel colorModel; - public CGraphicsConfig(CGraphicsDevice device) { + protected CGraphicsConfig(CGraphicsDevice device) { this.device = device; } @@ -84,88 +87,20 @@ return new AffineTransform(xscale, 0.0, 0.0, yscale, 0.0, 0.0); } - - /** - * The following methods are invoked from CToolkit.java and - * LWWindowPeer.java rather than having the native - * implementations hardcoded in those classes. This way the appropriate - * actions are taken based on the peer's GraphicsConfig, whether it is - * an CGLGraphicsConfig or something else. - */ - /** * Creates a new SurfaceData that will be associated with the given * LWWindowPeer. */ - public SurfaceData createSurfaceData(CPlatformView pView) { - throw new UnsupportedOperationException("not implemented"); - } + public abstract SurfaceData createSurfaceData(CPlatformView pView); /** * Creates a new SurfaceData that will be associated with the given * CGLLayer. */ - public SurfaceData createSurfaceData(CGLLayer layer) { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * Creates a new hidden-acceleration image of the given width and height - * that is associated with the target Component. - */ - public Image createAcceleratedImage(Component target, - int width, int height) - { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * The following methods correspond to the multibuffering methods in - * LWWindowPeer.java... - */ - - /** - * Attempts to create a native backbuffer for the given peer. If - * the requested configuration is not natively supported, an AWTException - * is thrown. Otherwise, if the backbuffer creation is successful, a - * handle to the native backbuffer is returned. - */ - public long createBackBuffer(CPlatformView pView, - int numBuffers, BufferCapabilities caps) - throws AWTException - { - throw new UnsupportedOperationException("not implemented"); - } - - public void destroyBackBuffer(long backBuffer) - throws AWTException - { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * Creates a VolatileImage that essentially wraps the target Component's - * backbuffer, using the provided backbuffer handle. - */ - public VolatileImage createBackBufferImage(Component target, - long backBuffer) - { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * Performs the native flip operation for the given target Component. - */ - public void flip(CPlatformView delegate, - Component target, VolatileImage xBackBuffer, - int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) - { - throw new UnsupportedOperationException("not implemented"); - } + public abstract SurfaceData createSurfaceData(CGLLayer layer); @Override - public boolean isTranslucencyCapable() { + public final boolean isTranslucencyCapable() { //we know for sure we have capable config :) return true; }
--- a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Mon Dec 17 08:30:06 2012 -0500 @@ -27,7 +27,6 @@ import java.awt.AWTException; import java.awt.BufferCapabilities; -import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; @@ -48,13 +47,10 @@ import sun.awt.CGraphicsConfig; import sun.awt.CGraphicsDevice; -import sun.awt.TextureSizeConstraining; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; -import sun.awt.image.SurfaceManager; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; -import sun.java2d.SunGraphics2D; import sun.java2d.Surface; import sun.java2d.SurfaceData; import sun.java2d.opengl.OGLContext.OGLContextCaps; @@ -63,18 +59,19 @@ import sun.java2d.pipe.hw.ContextCapabilities; import static sun.java2d.opengl.OGLSurfaceData.*; import static sun.java2d.opengl.OGLContext.OGLContextCaps.*; -import sun.java2d.opengl.CGLSurfaceData.CGLVSyncOffScreenSurfaceData; import sun.java2d.pipe.hw.AccelDeviceEventListener; import sun.java2d.pipe.hw.AccelDeviceEventNotifier; +import sun.lwawt.LWComponentPeer; import sun.lwawt.macosx.CPlatformView; -public class CGLGraphicsConfig extends CGraphicsConfig - implements OGLGraphicsConfig, TextureSizeConstraining +public final class CGLGraphicsConfig extends CGraphicsConfig + implements OGLGraphicsConfig { - //private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval; + //private static final int kOpenGLSwapInterval = + // RuntimeOptions.getCurrentOptions().OpenGLSwapInterval; private static final int kOpenGLSwapInterval = 0; // TODO - protected static boolean cglAvailable; + private static boolean cglAvailable; private static ImageCapabilities imageCaps = new CGLImageCaps(); private int pixfmt; @@ -82,7 +79,7 @@ private long pConfigInfo; private ContextCapabilities oglCaps; private OGLContext context; - private Object disposerReferent = new Object(); + private final Object disposerReferent = new Object(); public static native int getDefaultPixFmt(int screennum); private static native boolean initCGL(); @@ -94,7 +91,7 @@ cglAvailable = initCGL(); } - protected CGLGraphicsConfig(CGraphicsDevice device, int pixfmt, + private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt, long configInfo, ContextCapabilities oglCaps) { super(device); @@ -170,11 +167,13 @@ * Returns true if the provided capability bit is present for this config. * See OGLContext.java for a list of supported capabilities. */ - public final boolean isCapPresent(int cap) { + @Override + public boolean isCapPresent(int cap) { return ((oglCaps.getCaps() & cap) != 0); } - public final long getNativeConfigInfo() { + @Override + public long getNativeConfigInfo() { return pConfigInfo; } @@ -183,7 +182,8 @@ * * @see sun.java2d.pipe.hw.BufferedContextProvider#getContext */ - public final OGLContext getContext() { + @Override + public OGLContext getContext() { return context; } @@ -257,145 +257,83 @@ return ("CGLGraphicsConfig[dev="+screen+",pixfmt="+pixfmt+"]"); } - - /** - * The following methods are invoked from ComponentModel.java rather - * than having the Mac OS X-dependent implementations hardcoded in that - * class. This way the appropriate actions are taken based on the peer's - * GraphicsConfig, whether it is a CGraphicsConfig or a - * CGLGraphicsConfig. - */ - - /** - * Creates a new SurfaceData that will be associated with the given - * LWWindowPeer. - */ @Override public SurfaceData createSurfaceData(CPlatformView pView) { return CGLSurfaceData.createData(pView); } - /** - * Creates a new SurfaceData that will be associated with the given - * CGLLayer. - */ @Override public SurfaceData createSurfaceData(CGLLayer layer) { return CGLSurfaceData.createData(layer); } - /** - * Creates a new hidden-acceleration image of the given width and height - * that is associated with the target Component. - */ @Override public Image createAcceleratedImage(Component target, int width, int height) { ColorModel model = getColorModel(Transparency.OPAQUE); - WritableRaster wr = - model.createCompatibleWritableRaster(width, height); + WritableRaster wr = model.createCompatibleWritableRaster(width, height); return new OffScreenImage(target, model, wr, model.isAlphaPremultiplied()); } - /** - * The following methods correspond to the multibuffering methods in - * CWindowPeer.java... - */ - - /** - * Attempts to create a OGL-based backbuffer for the given peer. If - * the requested configuration is not natively supported, an AWTException - * is thrown. Otherwise, if the backbuffer creation is successful, a - * value of 1 is returned. - */ @Override - public long createBackBuffer(CPlatformView pView, - int numBuffers, BufferCapabilities caps) - throws AWTException - { - if (numBuffers > 2) { - throw new AWTException( - "Only double or single buffering is supported"); + public void assertOperationSupported(final int numBuffers, + final BufferCapabilities caps) + throws AWTException { + // Assume this method is never called with numBuffers != 2, as 0 is + // unsupported, and 1 corresponds to a SingleBufferStrategy which + // doesn't depend on the peer. Screen is considered as a separate + // "buffer". + if (numBuffers != 2) { + throw new AWTException("Only double buffering is supported"); } - BufferCapabilities configCaps = getBufferCapabilities(); + final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } - - // non-zero return value means backbuffer creation was successful - // (checked in CPlatformWindow.flip(), etc.) - return 1; } - /** - * Destroys the backbuffer object represented by the given handle value. - */ @Override - public void destroyBackBuffer(long backBuffer) { + public Image createBackBuffer(final LWComponentPeer<?, ?> peer) { + final Rectangle r = peer.getBounds(); + // It is possible for the component to have size 0x0, adjust it to + // be at least 1x1 to avoid IAE + final int w = Math.max(1, r.width); + final int h = Math.max(1, r.height); + final int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT + : Transparency.OPAQUE; + return new SunVolatileImage(this, w, h, transparency, null); } - /** - * Creates a VolatileImage that essentially wraps the target Component's - * backbuffer (the provided backbuffer handle is essentially ignored). - */ @Override - public VolatileImage createBackBufferImage(Component target, - long backBuffer) - { - return new SunVolatileImage(target, - target.getWidth(), target.getHeight(), - Boolean.TRUE); + public void destroyBackBuffer(final Image backBuffer) { + if (backBuffer != null) { + backBuffer.flush(); + } } - /** - * Performs the native OGL flip operation for the given target Component. - */ @Override - public void flip(CPlatformView pView, - Component target, VolatileImage xBackBuffer, - int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) - { - if (flipAction == BufferCapabilities.FlipContents.COPIED) { - SurfaceManager vsm = SurfaceManager.getManager(xBackBuffer); - SurfaceData sd = vsm.getPrimarySurfaceData(); - - if (sd instanceof CGLVSyncOffScreenSurfaceData) { - CGLVSyncOffScreenSurfaceData vsd = - (CGLVSyncOffScreenSurfaceData)sd; - SurfaceData bbsd = vsd.getFlipSurface(); - Graphics2D bbg = - new SunGraphics2D(bbsd, Color.black, Color.white, null); - try { - bbg.drawImage(xBackBuffer, 0, 0, null); - } finally { - bbg.dispose(); - } - } else { - pView.drawImageOnPeer(xBackBuffer, x1, y1, x2, y2); - return; - } - } else if (flipAction == BufferCapabilities.FlipContents.PRIOR) { - // not supported by CGL... - return; + public void flip(final LWComponentPeer<?, ?> peer, final Image backBuffer, + final int x1, final int y1, final int x2, final int y2, + final BufferCapabilities.FlipContents flipAction) { + final Graphics g = peer.getGraphics(); + try { + g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); + } finally { + g.dispose(); } - - OGLSurfaceData.swapBuffers(pView.getAWTView()); - if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { - Graphics g = xBackBuffer.getGraphics(); + final Graphics2D bg = (Graphics2D) backBuffer.getGraphics(); try { - g.setColor(target.getBackground()); - g.fillRect(0, 0, - xBackBuffer.getWidth(), - xBackBuffer.getHeight()); + bg.setBackground(peer.getBackground()); + bg.clearRect(0, 0, backBuffer.getWidth(null), + backBuffer.getHeight(null)); } finally { - g.dispose(); + bg.dispose(); } } } @@ -429,15 +367,10 @@ return imageCaps; } - /** - * {@inheritDoc} - * - * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage - */ - public VolatileImage - createCompatibleVolatileImage(int width, int height, - int transparency, int type) - { + @Override + public VolatileImage createCompatibleVolatileImage(int width, int height, + int transparency, + int type) { if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || transparency == Transparency.BITMASK) { @@ -473,15 +406,18 @@ * * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities */ + @Override public ContextCapabilities getContextCapabilities() { return oglCaps; } + @Override public void addDeviceEventListener(AccelDeviceEventListener l) { int screen = getDevice().getCoreGraphicsScreen(); AccelDeviceEventNotifier.addListener(l, screen); } + @Override public void removeDeviceEventListener(AccelDeviceEventListener l) { AccelDeviceEventNotifier.removeListener(l); }
--- a/src/macosx/classes/sun/lwawt/LWCanvasPeer.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/lwawt/LWCanvasPeer.java Mon Dec 17 08:30:06 2012 -0500 @@ -26,12 +26,9 @@ package sun.lwawt; -import java.awt.AWTException; -import java.awt.BufferCapabilities; import java.awt.Component; import java.awt.Dimension; import java.awt.GraphicsConfiguration; -import java.awt.Image; import java.awt.peer.CanvasPeer; import javax.swing.JComponent; @@ -42,35 +39,10 @@ LWCanvasPeer(final T target, final PlatformComponent platformComponent) { super(target, platformComponent); } - // ---- PEER METHODS ---- // - - @Override - public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException { - // TODO - } - - @Override - public Image getBackBuffer() { - // TODO - return null; - } - - @Override - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) { - // TODO - } - - @Override - public void destroyBuffers() { - // TODO - } @Override public final GraphicsConfiguration getAppropriateGraphicsConfiguration( - GraphicsConfiguration gc) - { + final GraphicsConfiguration gc) { // TODO return gc; }
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java Mon Dec 17 08:30:06 2012 -0500 @@ -138,6 +138,11 @@ */ static final char WIDE_CHAR = '0'; + /** + * The back buffer provide user with a BufferStrategy. + */ + private Image backBuffer; + private final class DelegateContainer extends Container { { enableEvents(0xFFFFFFFF); @@ -389,6 +394,7 @@ } protected void disposeImpl() { + destroyBuffers(); LWContainerPeer cp = getContainerPeer(); if (cp != null) { cp.removeChildPeer(this); @@ -415,6 +421,12 @@ return getWindowPeer().getGraphicsConfiguration(); } + + // Just a helper method + public final LWGraphicsConfig getLWGC() { + return (LWGraphicsConfig) getGraphicsConfiguration(); + } + /* * Overridden in LWWindowPeer to replace its surface * data and back buffer. @@ -506,31 +518,45 @@ return getGraphicsConfiguration().getColorModel(); } - @Override - public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException { - throw new AWTException("Back buffers are only supported for " + - "Window or Canvas components."); - } - - /* - * To be overridden in LWWindowPeer and LWCanvasPeer. - */ - @Override - public Image getBackBuffer() { - // Return null or throw AWTException? - return null; + public boolean isTranslucent() { + // Translucent windows of the top level are supported only + return false; } @Override - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) { - // Skip silently or throw AWTException? + public final void createBuffers(int numBuffers, BufferCapabilities caps) + throws AWTException { + getLWGC().assertOperationSupported(numBuffers, caps); + final Image buffer = getLWGC().createBackBuffer(this); + synchronized (getStateLock()) { + backBuffer = buffer; + } } @Override - public void destroyBuffers() { - // Do nothing + public final Image getBackBuffer() { + synchronized (getStateLock()) { + if (backBuffer != null) { + return backBuffer; + } + } + throw new IllegalStateException("Buffers have not been created"); + } + + @Override + public final void flip(int x1, int y1, int x2, int y2, + BufferCapabilities.FlipContents flipAction) { + getLWGC().flip(this, getBackBuffer(), x1, y1, x2, y2, flipAction); + } + + @Override + public final void destroyBuffers() { + final Image oldBB; + synchronized (getStateLock()) { + oldBB = backBuffer; + backBuffer = null; + } + getLWGC().destroyBackBuffer(oldBB); } // Helper method @@ -642,7 +668,7 @@ } } - protected final Color getBackground() { + public final Color getBackground() { synchronized (getStateLock()) { return background; } @@ -982,19 +1008,17 @@ } @Override - public Image createImage(ImageProducer producer) { + public final Image createImage(final ImageProducer producer) { return new ToolkitImage(producer); } @Override - public Image createImage(int w, int h) { - CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration(); - return gc.createAcceleratedImage(getTarget(), w, h); + public final Image createImage(final int width, final int height) { + return getLWGC().createAcceleratedImage(getTarget(), width, height); } @Override - public VolatileImage createVolatileImage(int w, int h) { - // TODO: is it a right/complete implementation? + public final VolatileImage createVolatileImage(final int w, final int h) { return new SunVolatileImage(getTarget(), w, h); } @@ -1105,8 +1129,6 @@ * of target.setLocation() or as a result of user actions (window is * dragged with mouse). * - * To be overridden in LWWindowPeer to update its GraphicsConfig. - * * This method could be called on the toolkit thread. */ protected final void handleMove(final int x, final int y, @@ -1122,13 +1144,19 @@ * Called when this peer's size has been changed either as a result of * target.setSize() or as a result of user actions (window is resized). * - * To be overridden in LWWindowPeer to update its SurfaceData and - * GraphicsConfig. - * * This method could be called on the toolkit thread. */ protected final void handleResize(final int w, final int h, final boolean updateTarget) { + Image oldBB = null; + synchronized (getStateLock()) { + if (backBuffer != null) { + oldBB = backBuffer; + backBuffer = getLWGC().createBackBuffer(this); + } + } + getLWGC().destroyBackBuffer(oldBB); + if (updateTarget) { AWTAccessor.getComponentAccessor().setSize(getTarget(), w, h); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/macosx/classes/sun/lwawt/LWGraphicsConfig.java Mon Dec 17 08:30:06 2012 -0500 @@ -0,0 +1,97 @@ +/* + * 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. + */ + +package sun.lwawt; + +import java.awt.AWTException; +import java.awt.BufferCapabilities; +import java.awt.Component; +import java.awt.Image; + +/** + * As lwawt can be used on different platforms with different graphic + * configurations, the general set of methods is necessary. This interface + * collects the methods that should be provided by GraphicsConfiguration, + * simplifying use by the LWAWT. + * + * @author Sergey Bylokhov + */ +public interface LWGraphicsConfig { + + /* + * A GraphicsConfiguration must implements following methods to indicate + * that it imposes certain limitations on the maximum size of supported + * textures. + */ + + /** + * Returns the maximum width of any texture image. By default return {@code + * Integer.MAX_VALUE}. + */ + int getMaxTextureWidth(); + + /** + * Returns the maximum height of any texture image. By default return {@code + * Integer.MAX_VALUE}. + */ + int getMaxTextureHeight(); + + /* + * The following methods correspond to the multi-buffering methods in + * LWComponentPeer.java. + */ + + /** + * Checks that the requested configuration is natively supported; if not, an + * AWTException is thrown. + */ + void assertOperationSupported(int numBuffers, BufferCapabilities caps) + throws AWTException; + + /** + * Creates a back buffer for the given peer and returns the image wrapper. + */ + Image createBackBuffer(LWComponentPeer<?, ?> peer); + + /** + * Destroys the back buffer object. + */ + void destroyBackBuffer(Image backBuffer); + + /** + * Performs the native flip operation for the given target Component. Our + * flip is implemented through normal drawImage() to the graphic object, + * because of our components uses a graphic object of the container(in this + * case we also apply necessary constrains) + */ + void flip(LWComponentPeer<?, ?> peer, Image backBuffer, int x1, int y1, + int x2, int y2, BufferCapabilities.FlipContents flipAction); + + /** + * Creates a new hidden-acceleration image of the given width and height + * that is associated with the target Component. + */ + Image createAcceleratedImage(Component target, int width, int height); +}
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Mon Dec 17 08:30:06 2012 -0500 @@ -27,7 +27,6 @@ import java.awt.*; import java.awt.event.*; -import java.awt.image.BufferedImage; import java.awt.peer.*; import java.util.List; @@ -75,17 +74,6 @@ private SurfaceData surfaceData; private final Object surfaceDataLock = new Object(); - private int backBufferCount; - private BufferCapabilities backBufferCaps; - - // The back buffer is used for two purposes: - // 1. To render all the lightweight peers - // 2. To provide user with a BufferStrategy - // Need to check if a single back buffer can be used for both -// TODO: VolatileImage -// private VolatileImage backBuffer; - private volatile BufferedImage backBuffer; - private volatile int windowState = Frame.NORMAL; // check that the mouse is over the window @@ -227,7 +215,6 @@ if (isGrabbing()) { ungrab(); } - destroyBuffers(); platformWindow.dispose(); super.disposeImpl(); } @@ -258,8 +245,10 @@ } @Override - public GraphicsConfiguration getGraphicsConfiguration() { - return graphicsConfig; + public final GraphicsConfiguration getGraphicsConfiguration() { + synchronized (getStateLock()) { + return graphicsConfig; + } } @Override @@ -285,48 +274,6 @@ } @Override - public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException - { - try { - // Assume this method is never called with numBuffers <= 1, as 0 is - // unsupported, and 1 corresponds to a SingleBufferStrategy which - // doesn't depend on the peer. Screen is considered as a separate - // "buffer", that's why numBuffers - 1 - assert numBuffers > 1; - - replaceSurfaceData(numBuffers - 1, caps, false); - } catch (InvalidPipeException z) { - throw new AWTException(z.toString()); - } - } - - @Override - public final Image getBackBuffer() { - synchronized (getStateLock()) { - return backBuffer; - } - } - - @Override - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) - { - platformWindow.flip(x1, y1, x2, y2, flipAction); - } - - @Override - public final void destroyBuffers() { - final Image oldBB = getBackBuffer(); - synchronized (getStateLock()) { - backBuffer = null; - } - if (oldBB != null) { - oldBB.flush(); - } - } - - @Override public void setBounds(int x, int y, int w, int h, int op) { if ((op & SET_CLIENT_SIZE) != 0) { // SET_CLIENT_SIZE is only applicable to window peers, so handle it here @@ -343,16 +290,14 @@ h = MINIMUM_HEIGHT; } - if (graphicsConfig instanceof TextureSizeConstraining) { - final int maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth(); - final int maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight(); + final int maxW = getLWGC().getMaxTextureWidth(); + final int maxH = getLWGC().getMaxTextureHeight(); - if (w > maxW) { - w = maxW; - } - if (h > maxH) { - h = maxH; - } + if (w > maxW) { + w = maxW; + } + if (h > maxH) { + h = maxH; } // Don't post ComponentMoved/Resized and Paint events @@ -431,21 +376,14 @@ min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT); } - final int maxW, maxH; - if (graphicsConfig instanceof TextureSizeConstraining) { - maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth(); - maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight(); - } else { - maxW = maxH = Integer.MAX_VALUE; - } - final Dimension max; if (getTarget().isMaximumSizeSet()) { max = getTarget().getMaximumSize(); - max.width = Math.min(max.width, maxW); - max.height = Math.min(max.height, maxH); + max.width = Math.min(max.width, getLWGC().getMaxTextureWidth()); + max.height = Math.min(max.height, getLWGC().getMaxTextureHeight()); } else { - max = new Dimension(maxW, maxH); + max = new Dimension(getLWGC().getMaxTextureWidth(), + getLWGC().getMaxTextureHeight()); } platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height); @@ -1014,21 +952,10 @@ replaceSurfaceData(true); } - private void replaceSurfaceData(boolean blit) { - replaceSurfaceData(backBufferCount, backBufferCaps, blit); - } - - private void replaceSurfaceData(int newBackBufferCount, - BufferCapabilities newBackBufferCaps, - boolean blit) { + private void replaceSurfaceData(final boolean blit) { synchronized (surfaceDataLock) { final SurfaceData oldData = getSurfaceData(); surfaceData = platformWindow.replaceSurfaceData(); - // TODO: volatile image - // VolatileImage oldBB = backBuffer; - BufferedImage oldBB = backBuffer; - backBufferCount = newBackBufferCount; - backBufferCaps = newBackBufferCaps; final Rectangle size = getSize(); if (getSurfaceData() != null && oldData != getSurfaceData()) { clearBackground(size.width, size.height); @@ -1043,35 +970,6 @@ // This can only happen when this peer is being created oldData.flush(); } - - // TODO: volatile image - // backBuffer = (VolatileImage)delegate.createBackBuffer(); - backBuffer = (BufferedImage) platformWindow.createBackBuffer(); - if (backBuffer != null) { - Graphics g = backBuffer.getGraphics(); - try { - Rectangle r = getBounds(); - if (g instanceof Graphics2D) { - ((Graphics2D) g).setComposite(AlphaComposite.Src); - } - g.setColor(nonOpaqueBackground); - g.fillRect(0, 0, r.width, r.height); - if (g instanceof SunGraphics2D) { - SG2DConstraint((SunGraphics2D) g, getRegion()); - } - if (!isTextured()) { - g.setColor(getBackground()); - g.fillRect(0, 0, r.width, r.height); - } - if (oldBB != null) { - // Draw the old back buffer to the new one - g.drawImage(oldBB, 0, 0, null); - oldBB.flush(); - } - } finally { - g.dispose(); - } - } } } @@ -1092,14 +990,6 @@ } } - public int getBackBufferCount() { - return backBufferCount; - } - - public BufferCapabilities getBackBufferCaps() { - return backBufferCaps; - } - /* * Request the window insets from the delegate and compares it * with the current one. This method is mostly called by the
--- a/src/macosx/classes/sun/lwawt/PlatformWindow.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java Mon Dec 17 08:30:06 2012 -0500 @@ -97,17 +97,6 @@ */ public SurfaceData replaceSurfaceData(); - /* - * Creates a new image to serve as a back buffer. - */ - public Image createBackBuffer(); - - /* - * Move the given part of the back buffer to the front buffer. - */ - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction); - public void setModalBlocked(boolean blocked); public void toFront();
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Mon Dec 17 08:30:06 2012 -0500 @@ -31,12 +31,9 @@ import sun.java2d.opengl.CGLLayer; import sun.java2d.SurfaceData; -import sun.awt.CGraphicsConfig; -import sun.awt.CGraphicsDevice; import sun.awt.CausedFocusEvent; import java.awt.*; -import java.awt.BufferCapabilities.FlipContents; import sun.util.logging.PlatformLogger; @@ -113,22 +110,6 @@ } @Override - public Image createBackBuffer() { - Rectangle r = peer.getBounds(); - Image im = null; - if (!r.isEmpty()) { - int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT : Transparency.OPAQUE; - im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); - } - return im; - } - - @Override - public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) { - throw new RuntimeException("Not implemented"); - } - - @Override public void setVisible(boolean visible) {} @Override
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Mon Dec 17 08:30:06 2012 -0500 @@ -26,7 +26,6 @@ package sun.lwawt.macosx; import java.awt.*; -import java.awt.image.VolatileImage; import sun.awt.CGraphicsConfig; import sun.lwawt.LWWindowPeer; @@ -115,26 +114,6 @@ // ---------------------------------------------------------------------- // PAINTING METHODS // ---------------------------------------------------------------------- - - public void drawImageOnPeer(VolatileImage xBackBuffer, int x1, int y1, int x2, int y2) { - Graphics g = peer.getGraphics(); - try { - g.drawImage(xBackBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); - } finally { - g.dispose(); - } - } - - public Image createBackBuffer() { - Rectangle r = peer.getBounds(); - Image im = null; - if (!r.isEmpty()) { - int transparency = (isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); - im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); - } - return im; - } - public SurfaceData replaceSurfaceData() { if (!LWCToolkit.getSunAwtDisableCALayers()) { surfaceData = windowLayer.replaceSurfaceData();
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Dec 17 08:30:06 2012 -0500 @@ -25,7 +25,6 @@ package sun.lwawt.macosx; -import java.awt.BufferCapabilities.FlipContents; import java.awt.*; import java.awt.Dialog.ModalityType; import java.awt.event.*; @@ -258,7 +257,7 @@ validateSurface(); } - protected int getInitialStyleBits() { + private int getInitialStyleBits() { // defaults style bits int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE; @@ -285,7 +284,6 @@ final boolean resizable = isFrame ? ((Frame)target).isResizable() : (isDialog ? ((Dialog)target).isResizable() : false); styleBits = SET(styleBits, RESIZABLE, resizable); if (!resizable) { - styleBits = SET(styleBits, RESIZABLE, false); styleBits = SET(styleBits, ZOOMABLE, false); } } @@ -380,7 +378,7 @@ } // this is the counter-point to -[CWindow _nativeSetStyleBit:] - protected void setStyleBits(final int mask, final boolean value) { + private void setStyleBits(final int mask, final boolean value) { nativeSetNSWindowStyleBits(getNSWindowPtr(), mask, value ? mask : 0); } @@ -402,11 +400,6 @@ } @Override // PlatformWindow - public Image createBackBuffer() { - return contentView.createBackBuffer(); - } - - @Override // PlatformWindow public void dispose() { if (owner != null) { CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr()); @@ -417,12 +410,6 @@ } @Override // PlatformWindow - public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) { - // TODO: not implemented - (new RuntimeException("unimplemented")).printStackTrace(); - } - - @Override // PlatformWindow public FontMetrics getFontMetrics(Font f) { // TODO: not implemented (new RuntimeException("unimplemented")).printStackTrace(); @@ -668,15 +655,8 @@ } @Override - public void setResizable(boolean resizable) { + public void setResizable(final boolean resizable) { setStyleBits(RESIZABLE, resizable); - - // Re-apply the size constraints and the size to ensure the space - // occupied by the grow box is counted properly - peer.updateMinimumSize(); - - Rectangle bounds = peer.getBounds(); - setBounds(bounds.x, bounds.y, bounds.width, bounds.height); } @Override @@ -889,7 +869,8 @@ responder.handleWindowFocusEvent(gained, oppositePeer); } - private void deliverMoveResizeEvent(int x, int y, int width, int height) { + private void deliverMoveResizeEvent(int x, int y, int width, int height, + boolean byUser) { // when the content view enters the full-screen mode, the native // move/resize notifications contain a bounds smaller than // the whole screen and therefore we ignore the native notifications @@ -901,7 +882,7 @@ final Rectangle oldB = nativeBounds; nativeBounds = new Rectangle(x, y, width, height); peer.notifyReshape(x, y, width, height); - if (!oldB.getSize().equals(nativeBounds.getSize()) ) { + if (byUser && !oldB.getSize().equals(nativeBounds.getSize())) { flushBuffers(); } //TODO validateSurface already called from notifyReshape
--- a/src/macosx/native/sun/awt/AWTWindow.m Mon Dec 17 08:28:27 2012 -0500 +++ b/src/macosx/native/sun/awt/AWTWindow.m Mon Dec 17 08:30:06 2012 -0500 @@ -160,6 +160,10 @@ BOOL resizable = IS(bits, RESIZABLE); [self updateMinMaxSize:resizable]; [self.nsWindow setShowsResizeIndicator:resizable]; + // Zoom button should be disabled, if the window is not resizable, + // otherwise button should be restored to initial state. + BOOL zoom = resizable && IS(bits, ZOOMABLE); + [[self.nsWindow standardWindowButton:NSWindowZoomButton] setEnabled:zoom]; } if (IS(mask, HAS_SHADOW)) { @@ -445,12 +449,13 @@ NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]); - static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIII)V"); + static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIIIZ)V"); JNFCallVoidMethod(env, platformWindow, jm_deliverMoveResizeEvent, (jint)frame.origin.x, (jint)frame.origin.y, (jint)frame.size.width, - (jint)frame.size.height); + (jint)frame.size.height, + (jboolean)[self.nsWindow inLiveResize]); (*env)->DeleteLocalRef(env, platformWindow); } @@ -784,7 +789,7 @@ // calls methods on NSWindow to change other properties, based on the mask if (mask & MASK(_METHOD_PROP_BITMASK)) { - [window setPropertiesForStyleBits:bits mask:mask]; + [window setPropertiesForStyleBits:newBits mask:mask]; } window.styleBits = newBits;
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Mon Dec 17 08:30:06 2012 -0500 @@ -30,14 +30,10 @@ 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.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 @@ 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 @@ 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(); }
--- a/src/share/classes/com/sun/java/util/jar/pack/PropMap.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/java/util/jar/pack/PropMap.java Mon Dec 17 08:30:06 2012 -0500 @@ -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.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 @@ 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); + } + } + } }
--- a/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ /** * <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;
--- a/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ /** * <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;
--- a/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Mon Dec 17 08:30:06 2012 -0500 @@ -264,7 +264,7 @@ * <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 @@ 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 @@ // 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 @@ } } 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 @@ // 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();
--- a/src/share/classes/com/sun/security/auth/PolicyFile.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/security/auth/PolicyFile.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ * * <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 - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> 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 @@ * @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 {
--- a/src/share/classes/com/sun/security/auth/login/ConfigFile.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/security/auth/login/ConfigFile.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, 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 @@ -49,13 +49,9 @@ * * <ol> * <li> - * Loop through the <code>java.security.Security</code> properties, + * Loop through the security properties, * <i>login.config.url.1</i>, <i>login.config.url.2</i>, ..., - * <i>login.config.url.X</i>. These properties are set - * in the Java security properties file, which is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * <i>login.config.url.X</i>. * Each property value specifies a <code>URL</code> pointing to a * login configuration file to be loaded. Read in and load * each configuration. @@ -87,6 +83,7 @@ * <code>javax.security.auth.login.Configuration</code> class. * * @see javax.security.auth.login.LoginContext + * @see java.security.Security security properties */ public class ConfigFile extends javax.security.auth.login.Configuration {
--- a/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Mon Dec 17 08:30:06 2012 -0500 @@ -1067,10 +1067,6 @@ 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;
--- a/src/share/classes/java/awt/color/ICC_Profile.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/awt/color/ICC_Profile.java Mon Dec 17 08:30:06 2012 -0500 @@ -1435,7 +1435,15 @@ int renderingIntent = intFromBigEndian(theHeader, icHdrRenderingIntent); /* set the rendering intent */ - return renderingIntent; + + /* According to ICC spec, only the least-significant 16 bits shall be + * used to encode the rendering intent. The most significant 16 bits + * shall be set to zero. Thus, we are ignoring two most significant + * bytes here. + * + * See http://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15. + */ + return (0xffff & renderingIntent); }
--- a/src/share/classes/java/awt/image/ColorConvertOp.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/awt/image/ColorConvertOp.java Mon Dec 17 08:30:06 2012 -0500 @@ -732,10 +732,16 @@ private int getRenderingIntent (ICC_Profile profile) { byte[] header = profile.getData(ICC_Profile.icSigHead); int index = ICC_Profile.icHdrRenderingIntent; - return (((header[index] & 0xff) << 24) | - ((header[index+1] & 0xff) << 16) | - ((header[index+2] & 0xff) << 8) | - (header[index+3] & 0xff)); + + /* According to ICC spec, only the least-significant 16 bits shall be + * used to encode the rendering intent. The most significant 16 bits + * shall be set to zero. Thus, we are ignoring two most significant + * bytes here. + * + * See http://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15. + */ + return ((header[index+2] & 0xff) << 8) | + (header[index+3] & 0xff); } /**
--- a/src/share/classes/java/lang/ThreadLocal.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/lang/ThreadLocal.java Mon Dec 17 08:30:06 2012 -0500 @@ -25,19 +25,21 @@ package java.lang; import java.lang.ref.*; +import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; /** * This class provides thread-local variables. These variables differ from * their normal counterparts in that each thread that accesses one (via its - * <tt>get</tt> or <tt>set</tt> method) has its own, independently initialized - * copy of the variable. <tt>ThreadLocal</tt> instances are typically private + * {@code get} or {@code set} method) has its own, independently initialized + * copy of the variable. {@code ThreadLocal} instances are typically private * static fields in classes that wish to associate state with a thread (e.g., * a user ID or Transaction ID). * * <p>For example, the class below generates unique identifiers local to each * thread. - * A thread's id is assigned the first time it invokes <tt>ThreadId.get()</tt> + * A thread's id is assigned the first time it invokes {@code ThreadId.get()} * and remains unchanged on subsequent calls. * <pre> * import java.util.concurrent.atomic.AtomicInteger; @@ -61,7 +63,7 @@ * } * </pre> * <p>Each thread holds an implicit reference to its copy of a thread-local - * variable as long as the thread is alive and the <tt>ThreadLocal</tt> + * variable as long as the thread is alive and the {@code ThreadLocal} * instance is accessible; after a thread goes away, all of its copies of * thread-local instances are subject to garbage collection (unless other * references to these copies exist). @@ -108,14 +110,14 @@ * thread-local variable. This method will be invoked the first * time a thread accesses the variable with the {@link #get} * method, unless the thread previously invoked the {@link #set} - * method, in which case the <tt>initialValue</tt> method will not + * method, in which case the {@code initialValue} method will not * be invoked for the thread. Normally, this method is invoked at * most once per thread, but it may be invoked again in case of * subsequent invocations of {@link #remove} followed by {@link #get}. * - * <p>This implementation simply returns <tt>null</tt>; if the + * <p>This implementation simply returns {@code null}; if the * programmer desires thread-local variables to have an initial - * value other than <tt>null</tt>, <tt>ThreadLocal</tt> must be + * value other than {@code null}, {@code ThreadLocal} must be * subclassed, and this method overridden. Typically, an * anonymous inner class will be used. * @@ -126,7 +128,21 @@ } /** + * Creates a thread local variable. The initial value of the variable is + * determined by invoking the {@code get} method on the {@code Supplier}. + * + * @param supplier the supplier to be used to determine the initial value + * @return a new thread local variable + * @throws NullPointerException if the specified supplier is null + * @since 1.8 + */ + public static <T> ThreadLocal<T> withInitial(Supplier<? extends T> supplier) { + return new SuppliedThreadLocal<>(supplier); + } + + /** * Creates a thread local variable. + * @see #withInitial(java.util.function.Supplier) */ public ThreadLocal() { } @@ -195,7 +211,7 @@ * reinitialized by invoking its {@link #initialValue} method, * unless its value is {@linkplain #set set} by the current thread * in the interim. This may result in multiple invocations of the - * <tt>initialValue</tt> method in the current thread. + * {@code initialValue} method in the current thread. * * @since 1.5 */ @@ -251,6 +267,24 @@ } /** + * An extension of ThreadLocal that obtains its initial value from + * the specified {@code Supplier}. + */ + static final class SuppliedThreadLocal<T> extends ThreadLocal<T> { + + private final Supplier<? extends T> supplier; + + SuppliedThreadLocal(Supplier<? extends T> supplier) { + this.supplier = Objects.requireNonNull(supplier); + } + + @Override + protected T initialValue() { + return supplier.get(); + } + } + + /** * ThreadLocalMap is a customized hash map suitable only for * maintaining thread local values. No operations are exported * outside of the ThreadLocal class. The class is package private to @@ -599,9 +633,9 @@ * @param i a position known NOT to hold a stale entry. The * scan starts at the element after i. * - * @param n scan control: <tt>log2(n)</tt> cells are scanned, + * @param n scan control: {@code log2(n)} cells are scanned, * unless a stale entry is found, in which case - * <tt>log2(table.length)-1</tt> additional cells are scanned. + * {@code log2(table.length)-1} additional cells are scanned. * When called from insertions, this parameter is the number * of elements, but when from replaceStaleEntry, it is the * table length. (Note: all this could be changed to be either
--- a/src/share/classes/java/lang/invoke/BoundMethodHandle.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/lang/invoke/BoundMethodHandle.java Mon Dec 17 08:30:06 2012 -0500 @@ -25,7 +25,7 @@ package java.lang.invoke; -import static com.sun.xml.internal.ws.org.objectweb.asm.Opcodes.*; +import static jdk.internal.org.objectweb.asm.Opcodes.*; import static java.lang.invoke.LambdaForm.basicTypes; import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic; import static java.lang.invoke.MethodHandleStatics.*; @@ -40,9 +40,9 @@ import sun.invoke.util.ValueConversions; import sun.invoke.util.Wrapper; -import com.sun.xml.internal.ws.org.objectweb.asm.ClassWriter; -import com.sun.xml.internal.ws.org.objectweb.asm.MethodVisitor; -import com.sun.xml.internal.ws.org.objectweb.asm.Type; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Type; /** * The flavor of method handle which emulates an invoke instruction
--- a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Mon Dec 17 08:30:06 2012 -0500 @@ -25,15 +25,15 @@ package java.lang.invoke; -import java.io.FileOutputStream; -import java.io.IOException; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.security.ProtectionDomain; import java.util.concurrent.atomic.AtomicInteger; -import sun.util.logging.PlatformLogger; import jdk.internal.org.objectweb.asm.*; import static jdk.internal.org.objectweb.asm.Opcodes.*; import sun.misc.Unsafe; +import java.security.AccessController; +import java.security.PrivilegedAction; /** * InnerClassLambdaMetafactory @@ -120,13 +120,34 @@ * * @return a CallSite, which, when invoked, will return an instance of the * functional interface - * @throws ReflectiveOperationException + * @throws ReflectiveOperationException, LambdaConversionException */ @Override CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException { final Class<?> innerClass = spinInnerClass(); if (invokedType.parameterCount() == 0) { - return new ConstantCallSite(MethodHandles.constant(samBase, innerClass.newInstance())); + final Constructor[] ctrs = AccessController.doPrivileged( + new PrivilegedAction<Constructor[]>() { + @Override + public Constructor[] run() { + return innerClass.getDeclaredConstructors(); + } + }); + if (ctrs.length != 1) { + throw new ReflectiveOperationException("Expected one lambda constructor for " + + innerClass.getCanonicalName() + ", got " + ctrs.length); + } + // The lambda implementing inner class constructor is private, set + // it accessible (by us) before creating the constant sole instance + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + ctrs[0].setAccessible(true); + return null; + } + }); + Object inst = ctrs[0].newInstance(); + return new ConstantCallSite(MethodHandles.constant(samBase, inst)); } else { return new ConstantCallSite( MethodHandles.Lookup.IMPL_LOOKUP @@ -144,7 +165,7 @@ private <T> Class<? extends T> spinInnerClass() throws LambdaConversionException { String samName = samBase.getName().replace('.', '/'); - cw.visit(CLASSFILE_VERSION, ACC_PUBLIC + ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL, + cw.visit(CLASSFILE_VERSION, ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL, isSerializable ? new String[]{samName, NAME_SERIALIZABLE} : new String[]{samName}); // Generate final fields to be filled in by constructor @@ -186,17 +207,27 @@ final byte[] classBytes = cw.toByteArray(); - if (System.getProperty("debug.dump.generated") != null) { + /*** Uncomment to dump the generated file System.out.printf("Loaded: %s (%d bytes) %n", lambdaClassName, classBytes.length); try (FileOutputStream fos = new FileOutputStream(lambdaClassName.replace('/', '.') + ".class")) { fos.write(classBytes); } catch (IOException ex) { - PlatformLogger.getLogger(InnerClassLambdaMetafactory.class.getName()).severe(ex.getMessage(), ex); + Logger.getLogger(InnerClassLambdaMetafactory.class.getName()).log(Level.SEVERE, null, ex); } - } + ***/ ClassLoader loader = targetClass.getClassLoader(); - ProtectionDomain pd = (loader == null) ? null : targetClass.getProtectionDomain(); + ProtectionDomain pd = (loader == null) + ? null + : AccessController.doPrivileged( + new PrivilegedAction<ProtectionDomain>() { + @Override + public ProtectionDomain run() { + return targetClass.getProtectionDomain(); + } + } + ); + return (Class<? extends T>) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length, loader, pd); } @@ -205,7 +236,7 @@ */ private void generateConstructor() { // Generate constructor - MethodVisitor ctor = cw.visitMethod(ACC_PUBLIC, NAME_CTOR, constructorDesc, null, null); + MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, constructorDesc, null, null); ctor.visitCode(); ctor.visitVarInsn(ALOAD, 0); ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID);
--- a/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Mon Dec 17 08:30:06 2012 -0500 @@ -34,7 +34,7 @@ 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.*;
--- a/src/share/classes/java/net/HttpCookie.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/net/HttpCookie.java Mon Dec 17 08:30:06 2012 -0500 @@ -30,6 +30,8 @@ import java.util.NoSuchElementException; import java.text.SimpleDateFormat; import java.util.TimeZone; +import java.util.Calendar; +import java.util.GregorianCalendar; import java.util.Date; import java.util.Locale; import java.util.Objects; @@ -89,7 +91,10 @@ private final static String[] COOKIE_DATE_FORMATS = { "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'", "EEE',' dd MMM yyyy HH:mm:ss 'GMT'", - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z" + "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + "EEE',' dd-MMM-yy HH:mm:ss 'GMT'", + "EEE',' dd MMM yy HH:mm:ss 'GMT'", + "EEE MMM dd yy HH:mm:ss 'GMT'Z" }; // constant strings represent set-cookie header token @@ -1025,13 +1030,29 @@ * specified by dateString */ private long expiryDate2DeltaSeconds(String dateString) { + Calendar cal = new GregorianCalendar(GMT); for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) { SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], Locale.US); + cal.set(1970, 0, 1, 0, 0, 0); df.setTimeZone(GMT); + df.setLenient(false); + df.set2DigitYearStart(cal.getTime()); try { - Date date = df.parse(dateString); - return (date.getTime() - whenCreated) / 1000; + cal.setTime(df.parse(dateString)); + if (!COOKIE_DATE_FORMATS[i].contains("yyyy")) { + // 2-digit years following the standard set + // out it rfc 6265 + int year = cal.get(Calendar.YEAR); + year %= 100; + if (year < 70) { + year += 2000; + } else { + year += 1900; + } + cal.set(Calendar.YEAR, year); + } + return (cal.getTimeInMillis() - whenCreated) / 1000; } catch (Exception e) { // Ignore, try the next date format }
--- a/src/share/classes/java/net/Inet6Address.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/net/Inet6Address.java Mon Dec 17 08:30:06 2012 -0500 @@ -25,9 +25,9 @@ package java.net; -import java.io.ObjectInputStream; import java.io.IOException; import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.util.Enumeration; /** @@ -116,7 +116,8 @@ * <h4> Special IPv6 address </h4> * * <blockquote> - * <table cellspacing=2 summary="Description of IPv4-mapped address"> <tr><th valign=top><i>IPv4-mapped address</i></th> + * <table cellspacing=2 summary="Description of IPv4-mapped address"> + * <tr><th valign=top><i>IPv4-mapped address</i></th> * <td>Of the form::ffff:w.x.y.z, this IPv6 address is used to * represent an IPv4 address. It allows the native program to * use the same address data structure and also the same @@ -130,35 +131,40 @@ * address.</td></tr> * </table></blockquote> * <p> - * <h4> <A NAME="scoped">Textual representation of IPv6 scoped addresses</a> </h4> - * <p> - * The textual representation of IPv6 addresses as described above can be extended - * to specify IPv6 scoped addresses. This extension to the basic addressing architecture - * is described in [draft-ietf-ipngwg-scoping-arch-04.txt]. - * <p> - * Because link-local and site-local addresses are non-global, it is possible that different hosts - * may have the same destination address and may be reachable through different interfaces on the - * same originating system. In this case, the originating system is said to be connected - * to multiple zones of the same scope. In order to disambiguate which is the intended destination - * zone, it is possible to append a zone identifier (or <i>scope_id</i>) to an IPv6 address. - * <p> - * The general format for specifying the <i>scope_id</i> is the following: + * <h4><A NAME="scoped">Textual representation of IPv6 scoped addresses</a></h4> + * + * <p> The textual representation of IPv6 addresses as described above can be + * extended to specify IPv6 scoped addresses. This extension to the basic + * addressing architecture is described in [draft-ietf-ipngwg-scoping-arch-04.txt]. + * + * <p> Because link-local and site-local addresses are non-global, it is possible + * that different hosts may have the same destination address and may be + * reachable through different interfaces on the same originating system. In + * this case, the originating system is said to be connected to multiple zones + * of the same scope. In order to disambiguate which is the intended destination + * zone, it is possible to append a zone identifier (or <i>scope_id</i>) to an + * IPv6 address. + * + * <p> The general format for specifying the <i>scope_id</i> is the following: + * * <p><blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote> * <p> The IPv6-address is a literal IPv6 address as described above. - * The <i>scope_id</i> refers to an interface on the local system, and it can be specified - * in two ways. - * <p><ol><li><i>As a numeric identifier.</i> This must be a positive integer that identifies the - * particular interface and scope as understood by the system. Usually, the numeric - * values can be determined through administration tools on the system. Each interface may - * have multiple values, one for each scope. If the scope is unspecified, then the default value - * used is zero.</li><p> - * <li><i>As a string.</i> This must be the exact string that is returned by - * {@link java.net.NetworkInterface#getName()} for the particular interface in question. - * When an Inet6Address is created in this way, the numeric scope-id is determined at the time - * the object is created by querying the relevant NetworkInterface.</li> - * </ol><p> - * Note also, that the numeric <i>scope_id</i> can be retrieved from Inet6Address instances returned from the - * NetworkInterface class. This can be used to find out the current scope ids configured on the system. + * The <i>scope_id</i> refers to an interface on the local system, and it can be + * specified in two ways. + * <p><ol><li><i>As a numeric identifier.</i> This must be a positive integer + * that identifies the particular interface and scope as understood by the + * system. Usually, the numeric values can be determined through administration + * tools on the system. Each interface may have multiple values, one for each + * scope. If the scope is unspecified, then the default value used is zero.</li> + * <p><li><i>As a string.</i> This must be the exact string that is returned by + * {@link java.net.NetworkInterface#getName()} for the particular interface in + * question. When an Inet6Address is created in this way, the numeric scope-id + * is determined at the time the object is created by querying the relevant + * NetworkInterface.</li></ol> + * + * <p> Note also, that the numeric <i>scope_id</i> can be retrieved from + * Inet6Address instances returned from the NetworkInterface class. This can be + * used to find out the current scope ids configured on the system. * @since 1.4 */ @@ -169,7 +175,7 @@ /* * cached scope_id - for link-local address use only. */ - private transient int cached_scope_id = 0; + private transient int cached_scope_id; // 0 /** * Holds a 128-bit (16 bytes) IPv6 address. @@ -179,37 +185,28 @@ byte[] ipaddress; /** - * scope_id. The scope specified when the object is created. If the object is created - * with an interface name, then the scope_id is not determined until the time it is needed. + * scope_id. The scope specified when the object is created. If the object + * is created with an interface name, then the scope_id is not determined + * until the time it is needed. */ - private int scope_id = 0; + private int scope_id; // 0 /** * This will be set to true when the scope_id field contains a valid * integer scope_id. */ - private boolean scope_id_set = false; + private boolean scope_id_set; // false /** * scoped interface. scope_id is derived from this as the scope_id of the first * address whose scope is the same as this address for the named interface. */ - private transient NetworkInterface scope_ifname = null; - - /** - * set if the object is constructed with a scoped interface instead of a - * numeric scope id. - */ - private boolean scope_ifname_set = false; + private transient NetworkInterface scope_ifname; // null private static final long serialVersionUID = 6880410070516793377L; - /* - * Perform initializations. - */ - static { - init(); - } + // Perform native initialization + static { init(); } Inet6Address() { super(); @@ -239,19 +236,24 @@ } catch (UnknownHostException e) {} /* cant happen if ifname is null */ } - Inet6Address (String hostName, byte addr[], NetworkInterface nif) throws UnknownHostException { + Inet6Address (String hostName, byte addr[], NetworkInterface nif) + throws UnknownHostException + { initif (hostName, addr, nif); } - Inet6Address (String hostName, byte addr[], String ifname) throws UnknownHostException { + Inet6Address (String hostName, byte addr[], String ifname) + throws UnknownHostException + { initstr (hostName, addr, ifname); } /** - * Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} - * except that the IPv6 scope_id is set to the value corresponding to the given interface - * for the address type specified in <code>addr</code>. - * The call will fail with an UnknownHostException if the given interface does not have a numeric + * Create an Inet6Address in the exact manner of {@link + * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is + * set to the value corresponding to the given interface for the address + * type specified in <code>addr</code>. The call will fail with an + * UnknownHostException if the given interface does not have a numeric * scope_id assigned for the given address type (eg. link-local or site-local). * See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6 * scoped addresses. @@ -260,14 +262,16 @@ * @param addr the raw IP address in network byte order * @param nif an interface this address must be associated with. * @return an Inet6Address object created from the raw IP address. - * @exception UnknownHostException if IP address is of illegal length, or if the interface - * does not have a numeric scope_id assigned for the given address type. + * @throws UnknownHostException + * if IP address is of illegal length, or if the interface does not + * have a numeric scope_id assigned for the given address type. * * @since 1.5 */ - - public static Inet6Address getByAddress(String host, byte[] addr, NetworkInterface nif) - throws UnknownHostException { + public static Inet6Address getByAddress(String host, byte[] addr, + NetworkInterface nif) + throws UnknownHostException + { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); @@ -282,9 +286,10 @@ } /** - * Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} - * except that the IPv6 scope_id is set to the given numeric value. - * The scope_id is not checked to determine if it corresponds to any interface on the system. + * Create an Inet6Address in the exact manner of {@link + * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is + * set to the given numeric value. The scope_id is not checked to determine + * if it corresponds to any interface on the system. * See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6 * scoped addresses. * @@ -292,13 +297,14 @@ * @param addr the raw IP address in network byte order * @param scope_id the numeric scope_id for the address. * @return an Inet6Address object created from the raw IP address. - * @exception UnknownHostException if IP address is of illegal length. + * @throws UnknownHostException if IP address is of illegal length. * * @since 1.5 */ - - public static Inet6Address getByAddress(String host, byte[] addr, int scope_id) - throws UnknownHostException { + public static Inet6Address getByAddress(String host, byte[] addr, + int scope_id) + throws UnknownHostException + { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); @@ -312,7 +318,9 @@ throw new UnknownHostException("addr is of illegal length"); } - private void initstr (String hostName, byte addr[], String ifname) throws UnknownHostException { + private void initstr(String hostName, byte addr[], String ifname) + throws UnknownHostException + { try { NetworkInterface nif = NetworkInterface.getByName (ifname); if (nif == null) { @@ -324,16 +332,17 @@ } } - private void initif(String hostName, byte addr[],NetworkInterface nif) throws UnknownHostException { + private void initif(String hostName, byte addr[],NetworkInterface nif) + throws UnknownHostException + { this.hostName = hostName; if (addr.length == INADDRSZ) { // normal IPv6 address family = IPv6; ipaddress = addr.clone(); } if (nif != null) { - this.scope_ifname = nif; - scope_ifname_set = true; - scope_id = deriveNumericScope (nif); + scope_ifname = nif; + scope_id = deriveNumericScope(nif); scope_id_set = true; } } @@ -344,17 +353,16 @@ * return true otherwise. */ private boolean differentLocalAddressTypes(Inet6Address other) { - - if (isLinkLocalAddress() && !other.isLinkLocalAddress()) { + if (isLinkLocalAddress() && !other.isLinkLocalAddress()) return false; - } - if (isSiteLocalAddress() && !other.isSiteLocalAddress()) { + if (isSiteLocalAddress() && !other.isSiteLocalAddress()) return false; - } return true; } - private int deriveNumericScope (NetworkInterface ifc) throws UnknownHostException { + private int deriveNumericScope(NetworkInterface ifc) + throws UnknownHostException + { Enumeration<InetAddress> addresses = ifc.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); @@ -373,16 +381,17 @@ throw new UnknownHostException ("no scope_id found"); } - private int deriveNumericScope (String ifname) throws UnknownHostException { + private int deriveNumericScope(String ifname) throws UnknownHostException { Enumeration<NetworkInterface> en; try { en = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { - throw new UnknownHostException ("could not enumerate local network interfaces"); + throw new UnknownHostException( + "could not enumerate local network interfaces"); } while (en.hasMoreElements()) { NetworkInterface ifc = en.nextElement(); - if (ifc.getName().equals (ifname)) { + if (ifc.getName().equals(ifname)) { Enumeration<InetAddress> addresses = ifc.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); @@ -400,7 +409,8 @@ } } } - throw new UnknownHostException ("No matching address found for interface : " +ifname); + throw new UnknownHostException( + "No matching address found for interface : " +ifname); } /** @@ -410,22 +420,14 @@ */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { - scope_ifname = null; - scope_ifname_set = false; s.defaultReadObject(); - if (ifname != null && !"".equals (ifname)) { + if (ifname != null && !ifname.equals("")) { try { scope_ifname = NetworkInterface.getByName(ifname); - if (scope_ifname == null) { - /* the interface does not exist on this system, so we clear - * the scope information completely */ - scope_id_set = false; - scope_ifname_set = false; - scope_id = 0; - } else { + if (scope_ifname != null) { try { - scope_id = deriveNumericScope (scope_ifname); + scope_id = deriveNumericScope(scope_ifname); } catch (UnknownHostException e) { // typically should not happen, but it may be that // the machine being used for deserialization has @@ -455,8 +457,9 @@ * address. 11111111 at the start of the address identifies the * address as being a multicast address. * - * @return a <code>boolean</code> indicating if the InetAddress is - * an IP multicast address + * @return a {@code boolean} indicating if the InetAddress is an IP + * multicast address + * * @since JDK1.1 */ @Override @@ -466,8 +469,10 @@ /** * Utility routine to check if the InetAddress in a wildcard address. - * @return a <code>boolean</code> indicating if the Inetaddress is + * + * @return a {@code boolean} indicating if the Inetaddress is * a wildcard address. + * * @since 1.4 */ @Override @@ -482,8 +487,9 @@ /** * Utility routine to check if the InetAddress is a loopback address. * - * @return a <code>boolean</code> indicating if the InetAddress is - * a loopback address; or false otherwise. + * @return a {@code boolean} indicating if the InetAddress is a loopback + * address; or false otherwise. + * * @since 1.4 */ @Override @@ -498,8 +504,9 @@ /** * Utility routine to check if the InetAddress is an link local address. * - * @return a <code>boolean</code> indicating if the InetAddress is - * a link local address; or false if address is not a link local unicast address. + * @return a {@code boolean} indicating if the InetAddress is a link local + * address; or false if address is not a link local unicast address. + * * @since 1.4 */ @Override @@ -511,8 +518,9 @@ /** * Utility routine to check if the InetAddress is a site local address. * - * @return a <code>boolean</code> indicating if the InetAddress is - * a site local address; or false if address is not a site local unicast address. + * @return a {@code boolean} indicating if the InetAddress is a site local + * address; or false if address is not a site local unicast address. + * * @since 1.4 */ @Override @@ -524,9 +532,10 @@ /** * Utility routine to check if the multicast address has global scope. * - * @return a <code>boolean</code> indicating if the address has - * is a multicast address of global scope, false if it is not - * of global scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of global scope, false if it is not of global scope or + * it is not a multicast address + * * @since 1.4 */ @Override @@ -538,9 +547,10 @@ /** * Utility routine to check if the multicast address has node scope. * - * @return a <code>boolean</code> indicating if the address has - * is a multicast address of node-local scope, false if it is not - * of node-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of node-local scope, false if it is not of node-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -552,9 +562,10 @@ /** * Utility routine to check if the multicast address has link scope. * - * @return a <code>boolean</code> indicating if the address has - * is a multicast address of link-local scope, false if it is not - * of link-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of link-local scope, false if it is not of link-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -566,9 +577,10 @@ /** * Utility routine to check if the multicast address has site scope. * - * @return a <code>boolean</code> indicating if the address has - * is a multicast address of site-local scope, false if it is not - * of site-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of site-local scope, false if it is not of site-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -580,10 +592,10 @@ /** * Utility routine to check if the multicast address has organization scope. * - * @return a <code>boolean</code> indicating if the address has - * is a multicast address of organization-local scope, - * false if it is not of organization-local scope - * or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of organization-local scope, false if it is not of + * organization-local scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -593,9 +605,9 @@ } /** - * Returns the raw IP address of this <code>InetAddress</code> - * object. The result is in network byte order: the highest order - * byte of the address is in <code>getAddress()[0]</code>. + * Returns the raw IP address of this {@code InetAddress} object. The result + * is in network byte order: the highest order byte of the address is in + * {@code getAddress()[0]}. * * @return the raw IP address of this object. */ @@ -609,9 +621,10 @@ * an interface. If no scoped_id is set, the returned value is zero. * * @return the scopeId, or zero if not set. + * * @since 1.5 */ - public int getScopeId () { + public int getScopeId() { return scope_id; } @@ -622,22 +635,23 @@ * @return the scoped interface, or null if not set. * @since 1.5 */ - public NetworkInterface getScopedInterface () { + public NetworkInterface getScopedInterface() { return scope_ifname; } /** - * Returns the IP address string in textual presentation. If the instance was created - * specifying a scope identifier then the scope id is appended to the IP address preceded by - * a "%" (per-cent) character. This can be either a numeric value or a string, depending on which - * was used to createthe instance. + * Returns the IP address string in textual presentation. If the instance + * was created specifying a scope identifier then the scope id is appended + * to the IP address preceded by a "%" (per-cent) character. This can be + * either a numeric value or a string, depending on which was used to create + * the instance. * * @return the raw IP address in a string format. */ @Override public String getHostAddress() { String s = numericToTextFormat(ipaddress); - if (scope_ifname_set) { /* must check this first */ + if (scope_ifname != null) { /* must check this first */ s = s + "%" + scope_ifname.getName(); } else if (scope_id_set) { s = s + "%" + scope_id; @@ -674,29 +688,27 @@ } /** - * Compares this object against the specified object. - * The result is <code>true</code> if and only if the argument is - * not <code>null</code> and it represents the same IP address as - * this object. - * <p> - * Two instances of <code>InetAddress</code> represent the same IP - * address if the length of the byte arrays returned by - * <code>getAddress</code> is the same for both, and each of the - * array components is the same for the byte arrays. + * Compares this object against the specified object. The result is {@code + * true} if and only if the argument is not {@code null} and it represents + * the same IP address as this object. + * + * <p> Two instances of {@code InetAddress} represent the same IP address + * if the length of the byte arrays returned by {@code getAddress} is the + * same for both, and each of the array components is the same for the byte + * arrays. * * @param obj the object to compare against. - * @return <code>true</code> if the objects are the same; - * <code>false</code> otherwise. + * + * @return {@code true} if the objects are the same; {@code false} otherwise. + * * @see java.net.InetAddress#getAddress() */ @Override public boolean equals(Object obj) { - if (obj == null || - !(obj instanceof Inet6Address)) + if (obj == null || !(obj instanceof Inet6Address)) return false; Inet6Address inetAddr = (Inet6Address)obj; - for (int i = 0; i < INADDRSZ; i++) { if (ipaddress[i] != inetAddr.ipaddress[i]) return false; @@ -709,8 +721,9 @@ * Utility routine to check if the InetAddress is an * IPv4 compatible IPv6 address. * - * @return a <code>boolean</code> indicating if the InetAddress is - * an IPv4 compatible IPv6 address; or false if address is IPv4 address. + * @return a {@code boolean} indicating if the InetAddress is an IPv4 + * compatible IPv6 address; or false if address is IPv4 address. + * * @since 1.4 */ public boolean isIPv4CompatibleAddress() { @@ -727,6 +740,7 @@ // Utilities private final static int INT16SZ = 2; + /* * Convert IPv6 binary address into presentation (printable) format. * @@ -735,9 +749,8 @@ * textual representation format * @since 1.4 */ - static String numericToTextFormat(byte[] src) - { - StringBuffer sb = new StringBuffer(39); + static String numericToTextFormat(byte[] src) { + StringBuilder sb = new StringBuilder(39); for (int i = 0; i < (INADDRSZ / INT16SZ); i++) { sb.append(Integer.toHexString(((src[i<<1]<<8) & 0xff00) | (src[(i<<1)+1] & 0xff))); @@ -766,9 +779,8 @@ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException { - if (scope_ifname_set) { + if (scope_ifname != null) ifname = scope_ifname.getName(); - } s.defaultWriteObject(); } }
--- a/src/share/classes/java/net/URLConnection.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/net/URLConnection.java Mon Dec 17 08:30:06 2012 -0500 @@ -129,15 +129,6 @@ * <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a> * </pre></blockquote> * - * Note about <code>fileNameMap</code>: In versions prior to JDK 1.1.6, - * field <code>fileNameMap</code> of <code>URLConnection</code> was public. - * In JDK 1.1.6 and later, <code>fileNameMap</code> is private; accessor - * and mutator methods {@link #getFileNameMap() getFileNameMap} and - * {@link #setFileNameMap(java.net.FileNameMap) setFileNameMap} are added - * to access it. This change is also described on the <a href= - * "http://java.sun.com/products/jdk/1.2/compatibility.html"> - * Compatibility</a> page. - * * Invoking the <tt>close()</tt> methods on the <tt>InputStream</tt> or <tt>OutputStream</tt> of an * <tt>URLConnection</tt> after a request may free network resources associated with this * instance, unless particular protocol specifications specify different behaviours @@ -305,8 +296,7 @@ * Loads filename map (a mimetable) from a data file. It will * first try to load the user-specific table, defined * by "content.types.user.table" property. If that fails, - * it tries to load the default built-in table at - * lib/content-types.properties under java home. + * it tries to load the default built-in table. * * @return the FileNameMap * @since 1.2
--- a/src/share/classes/java/net/doc-files/net-properties.html Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/net/doc-files/net-properties.html Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ <!-- - 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 @@ -237,6 +237,6 @@ </UL> <P>Since these 2 properties are part of the security policy, they are not set by either the -D option or the System.setProperty() API, -instead they are set in the JRE security policy file <code>lib/security/java.security</code>.</P> +instead they are set as security properties.</P> </BODY> </HTML>
--- a/src/share/classes/java/security/KeyStore.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/security/KeyStore.java Mon Dec 17 08:30:06 2012 -0500 @@ -695,27 +695,23 @@ } /** - * Returns the default keystore type as specified in the Java security - * properties file, or the string - * "jks" (acronym for "Java keystore") + * Returns the default keystore type as specified by the + * {@code keystore.type} security property, or the string + * {@literal "jks"} (acronym for {@literal "Java keystore"}) * if no such property exists. - * The Java security properties file is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. * * <p>The default keystore type can be used by applications that do not * want to use a hard-coded keystore type when calling one of the - * <code>getInstance</code> methods, and want to provide a default keystore + * {@code getInstance} methods, and want to provide a default keystore * type in case a user does not specify its own. * * <p>The default keystore type can be changed by setting the value of the - * "keystore.type" security property (in the Java security properties - * file) to the desired keystore type. + * {@code keystore.type} security property to the desired keystore type. * - * @return the default keystore type as specified in the - * Java security properties file, or the string "jks" + * @return the default keystore type as specified by the + * {@code keystore.type} security property, or the string {@literal "jks"} * if no such property exists. + * @see java.security.Security security properties */ public final static String getDefaultType() { String kstype;
--- a/src/share/classes/java/security/Policy.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/security/Policy.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -48,12 +48,8 @@ * <code>getPolicy</code> installs an instance of the default Policy * implementation (a default subclass implementation of this abstract class). * The default Policy implementation can be changed by setting the value - * of the "policy.provider" security property (in the Java security properties - * file) to the fully qualified name of the desired Policy subclass - * implementation. The Java security properties file is located in the - * file named <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * of the {@code policy.provider} security property to the fully qualified + * name of the desired Policy subclass implementation. * * <p> Application code can directly subclass Policy to provide a custom * implementation. In addition, an instance of a Policy object can be @@ -84,6 +80,7 @@ * @see java.security.Provider * @see java.security.ProtectionDomain * @see java.security.Permission + * @see java.security.Security security properties */ public abstract class Policy {
--- a/src/share/classes/java/security/Security.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/security/Security.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -39,6 +39,10 @@ * <p>This class centralizes all security properties and common security * methods. One of its primary uses is to manage providers. * + * <p>The default values of security properties are read from an + * implementation-specific location, which is typically the properties file + * {@code lib/security/java.security} in the Java installation directory. + * * @author Benjamin Renaud */
--- a/src/share/classes/java/security/cert/CertPathBuilder.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/security/cert/CertPathBuilder.java Mon Dec 17 08:30:06 2012 -0500 @@ -281,25 +281,23 @@ } /** - * Returns the default <code>CertPathBuilder</code> type as specified in - * the Java security properties file, or the string "PKIX" - * if no such property exists. The Java security properties file is - * located in the file named <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * Returns the default {@code CertPathBuilder} type as specified by + * the {@code certpathbuilder.type} security property, or the string + * {@literal "PKIX"} if no such property exists. * - * <p>The default <code>CertPathBuilder</code> type can be used by + * <p>The default {@code CertPathBuilder} type can be used by * applications that do not want to use a hard-coded type when calling one - * of the <code>getInstance</code> methods, and want to provide a default + * of the {@code getInstance} methods, and want to provide a default * type in case a user does not specify its own. * - * <p>The default <code>CertPathBuilder</code> type can be changed by - * setting the value of the "certpathbuilder.type" security property - * (in the Java security properties file) to the desired type. + * <p>The default {@code CertPathBuilder} type can be changed by + * setting the value of the {@code certpathbuilder.type} security property + * to the desired type. * - * @return the default <code>CertPathBuilder</code> type as specified - * in the Java security properties file, or the string "PKIX" - * if no such property exists. + * @see java.security.Security security properties + * @return the default {@code CertPathBuilder} type as specified + * by the {@code certpathbuilder.type} security property, or the string + * {@literal "PKIX"} if no such property exists. */ public final static String getDefaultType() { String cpbtype =
--- a/src/share/classes/java/security/cert/CertPathValidator.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/security/cert/CertPathValidator.java Mon Dec 17 08:30:06 2012 -0500 @@ -293,25 +293,23 @@ } /** - * Returns the default <code>CertPathValidator</code> type as specified in - * the Java security properties file, or the string "PKIX" - * if no such property exists. The Java security properties file is - * located in the file named <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * Returns the default {@code CertPathValidator} type as specified by + * the {@code certpathvalidator.type} security property, or the string + * {@literal "PKIX"} if no such property exists. * - * <p>The default <code>CertPathValidator</code> type can be used by + * <p>The default {@code CertPathValidator} type can be used by * applications that do not want to use a hard-coded type when calling one - * of the <code>getInstance</code> methods, and want to provide a default + * of the {@code getInstance} methods, and want to provide a default * type in case a user does not specify its own. * - * <p>The default <code>CertPathValidator</code> type can be changed by - * setting the value of the "certpathvalidator.type" security property - * (in the Java security properties file) to the desired type. + * <p>The default {@code CertPathValidator} type can be changed by + * setting the value of the {@code certpathvalidator.type} security + * property to the desired type. * - * @return the default <code>CertPathValidator</code> type as specified - * in the Java security properties file, or the string "PKIX" - * if no such property exists. + * @see java.security.Security security properties + * @return the default {@code CertPathValidator} type as specified + * by the {@code certpathvalidator.type} security property, or the string + * {@literal "PKIX"} if no such property exists. */ public final static String getDefaultType() { String cpvtype =
--- a/src/share/classes/java/security/cert/CertStore.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/security/cert/CertStore.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, 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 @@ -389,25 +389,23 @@ } /** - * Returns the default <code>CertStore</code> type as specified in the - * Java security properties file, or the string "LDAP" if no - * such property exists. The Java security properties file is located in - * the file named <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * Returns the default {@code CertStore} type as specified by the + * {@code certstore.type} security property, or the string + * {@literal "LDAP"} if no such property exists. * - * <p>The default <code>CertStore</code> type can be used by applications + * <p>The default {@code CertStore} type can be used by applications * that do not want to use a hard-coded type when calling one of the - * <code>getInstance</code> methods, and want to provide a default - * <code>CertStore</code> type in case a user does not specify its own. + * {@code getInstance} methods, and want to provide a default + * {@code CertStore} type in case a user does not specify its own. * - * <p>The default <code>CertStore</code> type can be changed by setting - * the value of the "certstore.type" security property (in the Java - * security properties file) to the desired type. + * <p>The default {@code CertStore} type can be changed by setting + * the value of the {@code certstore.type} security property to the + * desired type. * - * @return the default <code>CertStore</code> type as specified in the - * Java security properties file, or the string "LDAP" - * if no such property exists. + * @see java.security.Security security properties + * @return the default {@code CertStore} type as specified by the + * {@code certstore.type} security property, or the string + * {@literal "LDAP"} if no such property exists. */ public final static String getDefaultType() { String cstype;
--- a/src/share/classes/java/text/DateFormatSymbols.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/text/DateFormatSymbols.java Mon Dec 17 08:30:06 2012 -0500 @@ -688,7 +688,16 @@ } ResourceBundle resource = adapter.getLocaleData().getDateFormatData(locale); - eras = resource.getStringArray("Eras"); + // JRE and CLDR use different keys + // JRE: Eras, short.Eras and narrow.Eras + // CLDR: long.Eras, Eras and narrow.Eras + if (resource.containsKey("Eras")) { + eras = resource.getStringArray("Eras"); + } else if (resource.containsKey("long.Eras")) { + eras = resource.getStringArray("long.Eras"); + } else if (resource.containsKey("short.Eras")) { + eras = resource.getStringArray("short.Eras"); + } months = resource.getStringArray("MonthNames"); shortMonths = resource.getStringArray("MonthAbbreviations"); ampms = resource.getStringArray("AmPmMarkers");
--- a/src/share/classes/java/text/SimpleDateFormat.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/text/SimpleDateFormat.java Mon Dec 17 08:30:06 2012 -0500 @@ -48,12 +48,13 @@ import java.util.Locale; import java.util.Map; import java.util.SimpleTimeZone; +import java.util.SortedMap; import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import sun.util.locale.provider.LocaleProviderAdapter; import sun.util.calendar.CalendarUtils; import sun.util.calendar.ZoneInfoFile; +import sun.util.locale.provider.LocaleProviderAdapter; /** * <code>SimpleDateFormat</code> is a concrete class for formatting and @@ -1593,6 +1594,17 @@ private int matchString(String text, int start, int field, Map<String,Integer> data, CalendarBuilder calb) { if (data != null) { + // TODO: make this default when it's in the spec. + if (data instanceof SortedMap) { + for (String name : data.keySet()) { + if (text.regionMatches(true, start, name, 0, name.length())) { + calb.set(field, data.get(name)); + return start + name.length(); + } + } + return -start; + } + String bestMatch = null; for (String name : data.keySet()) { @@ -1803,7 +1815,7 @@ boolean obeyCount, boolean[] ambiguousYear, ParsePosition origPos, boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) { - Number number = null; + Number number; int value = 0; ParsePosition pos = new ParsePosition(0); pos.index = start; @@ -1876,9 +1888,7 @@ return index; } } else { - Map<String, Integer> map = calendar.getDisplayNames(field, - Calendar.ALL_STYLES, - locale); + Map<String, Integer> map = getDisplayNamesMap(field, locale); if ((index = matchString(text, start, field, map, calb)) > 0) { return index; } @@ -1940,7 +1950,7 @@ // count >= 3 // i.e., MMM or MMMM // Want to be able to parse both short and long forms. // Try count == 4 first: - int newStart = 0; + int newStart; if ((newStart = matchString(text, start, Calendar.MONTH, formatData.getMonths(), calb)) > 0) { return newStart; @@ -1951,9 +1961,7 @@ return index; } } else { - Map<String, Integer> map = calendar.getDisplayNames(field, - Calendar.ALL_STYLES, - locale); + Map<String, Integer> map = getDisplayNamesMap(field, locale); if ((index = matchString(text, start, field, map, calb)) > 0) { return index; } @@ -1979,7 +1987,7 @@ if (useDateFormatSymbols) { // Want to be able to parse both short and long forms. // Try count == 4 (DDDD) first: - int newStart = 0; + int newStart; if ((newStart=matchString(text, start, Calendar.DAY_OF_WEEK, formatData.getWeekdays(), calb)) > 0) { return newStart; @@ -2008,7 +2016,7 @@ return index; } } else { - Map<String,Integer> map = calendar.getDisplayNames(field, Calendar.ALL_STYLES, locale); + Map<String,Integer> map = getDisplayNamesMap(field, locale); if ((index = matchString(text, start, field, map, calb)) > 0) { return index; } @@ -2098,7 +2106,7 @@ break parsing; } - int sign = 0; + int sign; char c = text.charAt(pos.index); if (c == 'Z') { calb.set(Calendar.ZONE_OFFSET, 0).set(Calendar.DST_OFFSET, 0); @@ -2340,6 +2348,21 @@ && formatData.equals(that.formatData)); } + private static final int[] REST_OF_STYLES = { + Calendar.SHORT_STANDALONE, Calendar.LONG_FORMAT, Calendar.LONG_STANDALONE, + }; + private Map<String, Integer> getDisplayNamesMap(int field, Locale locale) { + Map<String, Integer> map = calendar.getDisplayNames(field, Calendar.SHORT_FORMAT, locale); + // Get all SHORT and LONG styles (avoid NARROW styles). + for (int style : REST_OF_STYLES) { + Map<String, Integer> m = calendar.getDisplayNames(field, style, locale); + if (m != null) { + map.putAll(m); + } + } + return map; + } + /** * After reading an object from the input stream, the format * pattern in the object is verified.
--- a/src/share/classes/java/util/Base64.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/util/Base64.java Mon Dec 17 08:30:06 2012 -0500 @@ -289,8 +289,8 @@ * * <p> This method first encodes all input bytes into a base64 encoded * byte array and then constructs a new String by using the encoded byte - * array and the {@link java.nio.charset.StandardCharsets.ISO_8859_1 ISO-8859-1} - * charset. + * array and the {@link java.nio.charset.StandardCharsets#ISO_8859_1 + * ISO-8859-1} charset. * * <p> In other words, an invocation of this method has exactly the same * effect as invoking @@ -358,9 +358,9 @@ * to encode any more input bytes. The encoding operation can be * continued, if there is more bytes in input buffer to be encoded, * by invoking this method again with an output buffer that has more - * {@linkplain Buffer#remaining remaining} bytes. This is typically - * done by draining any encoded bytes from the output buffer. The - * value returned from last invocation needs to be passed in as the + * {@linkplain java.nio.Buffer#remaining remaining} bytes. This is + * typically done by draining any encoded bytes from the output buffer. + * The value returned from last invocation needs to be passed in as the * third parameter {@code bytesOut} if it is to continue an unfinished * encoding, 0 otherwise. * @@ -806,9 +806,9 @@ * buffer has insufficient space to decode any more input bytes. * The decoding operation can be continued, if there is more bytes * in input buffer to be decoded, by invoking this method again with - * an output buffer that has more {@linkplain Buffer#remaining remaining} - * bytes.This is typically done by draining any decoded bytes from the - * output buffer. + * an output buffer that has more {@linkplain java.nio.Buffer#remaining + * remaining} bytes. This is typically done by draining any decoded + * bytes from the output buffer. * * <p><b>Recommended Usage Example</b> * <pre>
--- a/src/share/classes/java/util/Calendar.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/util/Calendar.java Mon Dec 17 08:30:06 2012 -0500 @@ -53,9 +53,7 @@ import java.text.DateFormatSymbols; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.spi.CalendarDataProvider; import sun.util.BuddhistCalendar; -import sun.util.locale.provider.LocaleProviderAdapter; import sun.util.calendar.ZoneInfo; import sun.util.locale.provider.CalendarDataUtility; @@ -746,6 +744,32 @@ /** * A style specifier for {@link #getDisplayName(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale) + * getDisplayNames} indicating a narrow name used for format. Narrow names + * are typically single character strings, such as "M" for Monday. + * + * @see #NARROW_STANDALONE + * @see #SHORT_FORMAT + * @see #LONG_FOTMAT + * @since 1.8 + */ + public static final int NARROW_FORMAT = 4; + + /** + * A style specifier for {@link #getDisplayName(int, int, Locale) + * getDisplayName} and {@link #getDisplayNames(int, int, Locale) + * getDisplayNames} indicating a narrow name independently. Narrow names + * are typically single character strings, such as "M" for Monday. + * + * @see #NARROW_FORMAT + * @see #SHORT_STANDALONE + * @see #LONG_STANDALONE + * @since 1.8 + */ + public static final int NARROW_STANDALONE = NARROW_FORMAT | STANDALONE_MASK; + + /** + * A style specifier for {@link #getDisplayName(int, int, Locale) + * getDisplayName} and {@link #getDisplayNames(int, int, Locale) * getDisplayNames} indicating a short name used for format. * * @see #SHORT_STANDALONE @@ -1472,30 +1496,31 @@ * @param style * the style applied to the string representation; one of {@link * #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, - * {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}. + * {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE}, + * {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}. * @param locale * the locale for the string representation * (any calendar types specified by {@code locale} are ignored) * @return the string representation of the given - * <code>field</code> in the given <code>style</code>, or - * <code>null</code> if no string representation is + * {@code field} in the given {@code style}, or + * {@code null} if no string representation is * applicable. * @exception IllegalArgumentException - * if <code>field</code> or <code>style</code> is invalid, - * or if this <code>Calendar</code> is non-lenient and any + * if {@code field} or {@code style} is invalid, + * or if this {@code Calendar} is non-lenient and any * of the calendar fields have invalid values * @exception NullPointerException - * if <code>locale</code> is null + * if {@code locale} is null * @since 1.6 */ public String getDisplayName(int field, int style, Locale locale) { - if (!checkDisplayNameParams(field, style, SHORT, LONG, locale, + if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale, ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } - // the standalone styles are supported only through CalendarDataProviders. - if (isStandaloneStyle(style)) { + // the standalone and narrow styles are supported only through CalendarDataProviders. + if (isStandaloneStyle(style) || isNarrowStyle(style)) { return CalendarDataUtility.retrieveFieldValueName(getCalendarType(), field, get(field), style, locale); @@ -1513,26 +1538,30 @@ } /** - * Returns a <code>Map</code> containing all names of the calendar - * <code>field</code> in the given <code>style</code> and - * <code>locale</code> and their corresponding field values. For - * example, if this <code>Calendar</code> is a {@link + * Returns a {@code Map} containing all names of the calendar + * {@code field} in the given {@code style} and + * {@code locale} and their corresponding field values. For + * example, if this {@code Calendar} is a {@link * GregorianCalendar}, the returned map would contain "Jan" to * {@link #JANUARY}, "Feb" to {@link #FEBRUARY}, and so on, in the * {@linkplain #SHORT short} style in an English locale. * + * <p>Narrow names may not be unique due to use of single characters, + * such as "S" for Sunday and Saturday. In that case narrow names are not + * included in the returned {@code Map}. + * * <p>The values of other calendar fields may be taken into * account to determine a set of display names. For example, if - * this <code>Calendar</code> is a lunisolar calendar system and + * this {@code Calendar} is a lunisolar calendar system and * the year value given by the {@link #YEAR} field has a leap * month, this method would return month names containing the leap * month name, and month names are mapped to their values specific * for the year. * * <p>The default implementation supports display names contained in - * a {@link DateFormatSymbols}. For example, if <code>field</code> - * is {@link #MONTH} and <code>style</code> is {@link - * #ALL_STYLES}, this method returns a <code>Map</code> containing + * a {@link DateFormatSymbols}. For example, if {@code field} + * is {@link #MONTH} and {@code style} is {@link + * #ALL_STYLES}, this method returns a {@code Map} containing * all strings returned by {@link DateFormatSymbols#getShortMonths()} * and {@link DateFormatSymbols#getMonths()}. * @@ -1541,30 +1570,31 @@ * @param style * the style applied to the string representation; one of {@link * #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, - * {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}. + * {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE}, + * {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE} * @param locale * the locale for the display names - * @return a <code>Map</code> containing all display names in - * <code>style</code> and <code>locale</code> and their - * field values, or <code>null</code> if no display names - * are defined for <code>field</code> + * @return a {@code Map} containing all display names in + * {@code style} and {@code locale} and their + * field values, or {@code null} if no display names + * are defined for {@code field} * @exception IllegalArgumentException - * if <code>field</code> or <code>style</code> is invalid, - * or if this <code>Calendar</code> is non-lenient and any + * if {@code field} or {@code style} is invalid, + * or if this {@code Calendar} is non-lenient and any * of the calendar fields have invalid values * @exception NullPointerException - * if <code>locale</code> is null + * if {@code locale} is null * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { - if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, + if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale, ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } if (style == ALL_STYLES || isStandaloneStyle(style)) { return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale); } - // SHORT or LONG + // SHORT, LONG, or NARROW return getDisplayNamesImpl(field, style, locale); } @@ -1599,6 +1629,12 @@ private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) { int baseStyle = getBaseStyle(style); // ignore the standalone mask + + // DateFormatSymbols doesn't support any narrow names. + if (baseStyle == NARROW_FORMAT) { + return null; + } + String[] strings = null; switch (field) { case ERA: @@ -1948,6 +1984,10 @@ return (style & STANDALONE_MASK) != 0; } + boolean isNarrowStyle(int style) { + return style == NARROW_FORMAT || style == NARROW_STANDALONE; + } + /** * Returns the pseudo-time-stamp for two fields, given their * individual pseudo-time-stamps. If either of the fields
--- a/src/share/classes/java/util/JapaneseImperialCalendar.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/util/JapaneseImperialCalendar.java Mon Dec 17 08:30:06 2012 -0500 @@ -946,8 +946,9 @@ set(field, getRolledValue(internalGet(field), amount, min, max)); } + @Override public String getDisplayName(int field, int style, Locale locale) { - if (!checkDisplayNameParams(field, style, SHORT, LONG, locale, + if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale, ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } @@ -956,11 +957,12 @@ // "GanNen" is supported only in the LONG style. if (field == YEAR - && (getBaseStyle(style) == SHORT || fieldValue != 1 || get(ERA) == 0)) { + && (getBaseStyle(style) != LONG || fieldValue != 1 || get(ERA) == 0)) { return null; } - String name = CalendarDataUtility.retrieveFieldValueName("japanese", field, fieldValue, style, locale); + String name = CalendarDataUtility.retrieveFieldValueName(getCalendarType(), field, + fieldValue, style, locale); // If the ERA value is null, then // try to get its name or abbreviation from the Era instance. if (name == null && field == ERA && fieldValue < eras.length) { @@ -970,27 +972,37 @@ return name; } + @Override public Map<String,Integer> getDisplayNames(int field, int style, Locale locale) { - if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, + if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale, ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } - Map<String, Integer> names = CalendarDataUtility.retrieveFieldValueNames("japanese", field, style, locale); + Map<String, Integer> names; + names = CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale); // If strings[] has fewer than eras[], get more names from eras[]. - if (field == ERA) { - int size = names.size(); - if (style == ALL_STYLES) { - size /= 2; // SHORT and LONG - } - if (size < eras.length) { - int baseStyle = getBaseStyle(style); - for (int i = size; i < eras.length; i++) { - Era era = eras[i]; - if (baseStyle == ALL_STYLES || baseStyle == SHORT) { - names.put(era.getAbbreviation(), i); + if (names != null) { + if (field == ERA) { + int size = names.size(); + if (style == ALL_STYLES) { + Set<Integer> values = new HashSet<>(); + // count unique era values + for (String key : names.keySet()) { + values.add(names.get(key)); } - if (baseStyle == ALL_STYLES || baseStyle == LONG) { - names.put(era.getName(), i); + size = values.size(); + } + if (size < eras.length) { + int baseStyle = getBaseStyle(style); + for (int i = size; i < eras.length; i++) { + Era era = eras[i]; + if (baseStyle == ALL_STYLES || baseStyle == SHORT + || baseStyle == NARROW_FORMAT) { + names.put(era.getAbbreviation(), i); + } + if (baseStyle == ALL_STYLES || baseStyle == LONG) { + names.put(era.getName(), i); + } } } }
--- a/src/share/classes/java/util/TimeZone.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/util/TimeZone.java Mon Dec 17 08:30:06 2012 -0500 @@ -43,12 +43,12 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.concurrent.ConcurrentHashMap; +import sun.misc.JavaAWTAccess; import sun.misc.SharedSecrets; -import sun.misc.JavaAWTAccess; import sun.security.action.GetPropertyAction; -import sun.util.locale.provider.TimeZoneNameUtility; import sun.util.calendar.ZoneInfo; import sun.util.calendar.ZoneInfoFile; +import sun.util.locale.provider.TimeZoneNameUtility; /** * <code>TimeZone</code> represents a time zone offset, and also figures out daylight @@ -399,28 +399,23 @@ if (style != SHORT && style != LONG) { throw new IllegalArgumentException("Illegal style: " + style); } - String id = getID(); - String[] names = getDisplayNames(id, locale); - if (names == null) { - if (id.startsWith("GMT") && id.length() > 3) { - char sign = id.charAt(3); - if (sign == '+' || sign == '-') { - return id; - } - } - int offset = getRawOffset(); - if (daylight) { - offset += getDSTSavings(); - } - return ZoneInfoFile.toCustomID(offset); + String name = TimeZoneNameUtility.retrieveDisplayName(id, daylight, style, locale); + if (name != null) { + return name; } - int index = daylight ? 3 : 1; - if (style == SHORT) { - index++; + if (id.startsWith("GMT") && id.length() > 3) { + char sign = id.charAt(3); + if (sign == '+' || sign == '-') { + return id; + } } - return names[index]; + int offset = getRawOffset(); + if (daylight) { + offset += getDSTSavings(); + } + return ZoneInfoFile.toCustomID(offset); } private static class DisplayNames { @@ -429,9 +424,12 @@ // Map(key=id, value=SoftReference(Map(key=locale, value=displaynames))) private static final Map<String, SoftReference<Map<Locale, String[]>>> CACHE = new ConcurrentHashMap<>(); + + private DisplayNames() { + } } - private static final String[] getDisplayNames(String id, Locale locale) { + private static String[] getDisplayNames(String id, Locale locale) { Map<String, SoftReference<Map<Locale, String[]>>> displayNames = DisplayNames.CACHE; SoftReference<Map<Locale, String[]>> ref = displayNames.get(id); @@ -631,14 +629,14 @@ } private static synchronized TimeZone setDefaultZone() { - TimeZone tz = null; + TimeZone tz; // get the time zone ID from the system properties String zoneID = AccessController.doPrivileged( new GetPropertyAction("user.timezone")); // if the time zone ID is not set (yet), perform the // platform to Java time zone ID mapping. - if (zoneID == null || zoneID.equals("")) { + if (zoneID == null || zoneID.isEmpty()) { String country = AccessController.doPrivileged( new GetPropertyAction("user.country")); String javaHome = AccessController.doPrivileged( @@ -670,8 +668,9 @@ assert tz != null; final String id = zoneID; - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { System.setProperty("user.timezone", id); return null; }
--- a/src/share/classes/java/util/logging/LogManager.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/util/logging/LogManager.java Mon Dec 17 08:30:06 2012 -0500 @@ -31,10 +31,10 @@ import java.security.*; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; -import java.net.URL; -import sun.security.action.GetPropertyAction; /** * There is a single global LogManager object that is used to @@ -150,7 +150,7 @@ // The map of the registered listeners. The map value is the registration // count to allow for cases where the same listener is registered many times. - private final Map<PropertyChangeListener,Integer> listenerMap = new HashMap<>(); + private final Map<Object,Integer> listenerMap = new HashMap<>(); // Table of named Loggers that maps names to Loggers. private Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>(); @@ -243,7 +243,7 @@ * Protected constructor. This is protected so that container applications * (such as J2EE containers) can subclass the object. It is non-public as * it is intended that there only be one LogManager object, whose value is - * retrieved by calling Logmanager.getLogManager. + * retrieved by calling LogManager.getLogManager. */ protected LogManager() { // Add a shutdown hook to close the global handlers. @@ -971,22 +971,24 @@ // Notify any interested parties that our properties have changed. // We first take a copy of the listener map so that we aren't holding any // locks when calling the listeners. - Map<PropertyChangeListener,Integer> listeners = null; + Map<Object,Integer> listeners = null; synchronized (listenerMap) { if (!listenerMap.isEmpty()) listeners = new HashMap<>(listenerMap); } if (listeners != null) { - PropertyChangeEvent ev = new PropertyChangeEvent(LogManager.class, null, null, null); - for (Map.Entry<PropertyChangeListener,Integer> entry : listeners.entrySet()) { - PropertyChangeListener listener = entry.getKey(); + assert Beans.isBeansPresent(); + Object ev = Beans.newPropertyChangeEvent(LogManager.class, null, null, null); + for (Map.Entry<Object,Integer> entry : listeners.entrySet()) { + Object listener = entry.getKey(); int count = entry.getValue().intValue(); for (int i = 0; i < count; i++) { - listener.propertyChange(ev); + Beans.invokePropertyChange(listener, ev); } } } + // Note that we need to reinitialize global handles when // they are first referenced. synchronized (this) { @@ -1269,4 +1271,100 @@ return loggingMXBean; } + /** + * 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. + */ + 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 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); + } + } + } }
--- a/src/share/classes/java/util/spi/CalendarNameProvider.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/util/spi/CalendarNameProvider.java Mon Dec 17 08:30:06 2012 -0500 @@ -174,7 +174,8 @@ * <p>{@code style} gives the style of the string representation. It is one * of {@link Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}), * {@link Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT} - * ({@link Calendar#LONG LONG}), or {@link Calendar#LONG_STANDALONE}. + * ({@link Calendar#LONG LONG}), {@link Calendar#LONG_STANDALONE}, + * {@link Calendar#NARROW_FORMAT}, or {@link Calendar#NARROW_STANDALONE}. * * <p>For example, the following call will return {@code "Sunday"}. * <pre> @@ -195,8 +196,10 @@ * the string representation style: one of {@link * Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}), * {@link Calendar#SHORT_STANDALONE}, {@link - * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or - * {@link Calendar#LONG_STANDALONE} + * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), + * {@link Calendar#LONG_STANDALONE}, + * {@link Calendar#NARROW_FORMAT}, + * or {@link Calendar#NARROW_STANDALONE} * @param locale * the desired locale * @return the string representation of the {@code field value}, or {@code @@ -226,8 +229,11 @@ * <p>{@code style} gives the style of the string representation. It must be * one of {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} ({@link * Calendar#SHORT SHORT}), {@link Calendar#SHORT_STANDALONE}, {@link - * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or {@link - * Calendar#LONG_STANDALONE}. + * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), {@link + * Calendar#LONG_STANDALONE}, {@link Calendar#NARROW_FORMAT}, or + * {@link Calendar#NARROW_STANDALONE}. Note that narrow names may + * not be unique due to use of single characters, such as "S" for Sunday + * and Saturday, and that no narrow names are included in that case. * * <p>For example, the following call will return a {@code Map} containing * {@code "January"} to {@link Calendar#JANUARY}, {@code "Jan"} to {@link @@ -247,8 +253,9 @@ * {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} * ({@link Calendar#SHORT SHORT}), {@link * Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT} - * ({@link Calendar#LONG LONG}), or {@link - * Calendar#LONG_STANDALONE}. + * ({@link Calendar#LONG LONG}), {@link Calendar#LONG_STANDALONE}, + * {@link Calendar#NARROW_FORMAT}, + * or {@link Calendar#NARROW_STANDALONE} * @param locale * the desired locale * @return a {@code Map} containing all display names of {@code field} in
--- a/src/share/classes/java/util/spi/TimeZoneNameProvider.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/java/util/spi/TimeZoneNameProvider.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -77,4 +77,34 @@ * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale) */ public abstract String getDisplayName(String ID, boolean daylight, int style, Locale locale); + + /** + * Returns a generic name for the given time zone {@code ID} that's suitable + * for presentation to the user in the specified {@code locale}. Generic + * time zone names are neutral from standard time and daylight saving + * time. For example, "PT" is the short generic name of time zone ID {@code + * America/Los_Angeles}, while its short standard time and daylight saving + * time names are "PST" and "PDT", respectively. Refer to + * {@link #getDisplayName(String, boolean, int, Locale) getDisplayName} + * for valid time zone IDs. + * + * <p>The default implementation of this method returns {@code null}. + * + * @param ID a time zone ID string + * @param style either {@link java.util.TimeZone#LONG TimeZone.LONG} or + * {@link java.util.TimeZone#SHORT TimeZone.SHORT} + * @param locale the desired locale + * @return the human-readable generic name of the given time zone in the + * given locale, or {@code null} if it's not available. + * @exception IllegalArgumentException if <code>style</code> is invalid, + * or <code>locale</code> isn't one of the locales returned from + * {@link LocaleServiceProvider#getAvailableLocales() + * getAvailableLocales()}. + * @exception NullPointerException if <code>ID</code> or <code>locale</code> + * is {@code null} + * @since 1.8 + */ + public String getGenericDisplayName(String ID, int style, Locale locale) { + return null; + } }
--- a/src/share/classes/javax/imageio/metadata/doc-files/gif_metadata.html Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/imageio/metadata/doc-files/gif_metadata.html Mon Dec 17 08:30:06 2012 -0500 @@ -90,7 +90,7 @@ <!-- Max value: 8 (inclusive) --> <!ATTLIST "LogicalScreenDescriptor" "pixelAspectRatio" #CDATA #REQUIRED> - <!-- If 0, indicates square pixels, else W/H = (value + 16)/64 --> + <!-- If 0, indicates square pixels, else W/H = (value + 15)/64 --> <!-- Data type: Integer --> <!-- Min value: 0 (inclusive) --> <!-- Max value: 255 (inclusive) -->
--- a/src/share/classes/javax/net/ssl/KeyManagerFactory.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/net/ssl/KeyManagerFactory.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, 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 @@ -53,17 +53,13 @@ * Obtains the default KeyManagerFactory algorithm name. * * <p>The default algorithm can be changed at runtime by setting - * the value of the "ssl.KeyManagerFactory.algorithm" security - * property (set in the Java security properties file or by calling - * {@link java.security.Security#setProperty(java.lang.String, - * java.lang.String)}) - * to the desired algorithm name. + * the value of the {@code ssl.KeyManagerFactory.algorithm} + * security property to the desired algorithm name. * - * @see java.security.Security#setProperty(java.lang.String, - * java.lang.String) - * @return the default algorithm name as specified in the - * Java security properties, or an implementation-specific - * default if no such property exists. + * @see java.security.Security security properties + * @return the default algorithm name as specified by the + * {@code ssl.KeyManagerFactory.algorithm} security property, or an + * implementation-specific default if no such property exists. */ public final static String getDefaultAlgorithm() { String type;
--- a/src/share/classes/javax/net/ssl/TrustManagerFactory.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/net/ssl/TrustManagerFactory.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, 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 @@ -53,14 +53,13 @@ * Obtains the default TrustManagerFactory algorithm name. * * <p>The default TrustManager can be changed at runtime by setting - * the value of the "ssl.TrustManagerFactory.algorithm" security - * property (set in the Java security properties file or by calling - * {@link java.security.Security#setProperty(String, String) }) - * to the desired algorithm name. + * the value of the {@code ssl.TrustManagerFactory.algorithm} + * security property to the desired algorithm name. * - * @return the default algorithm name as specified in the - * Java security properties, or an implementation-specific default - * if no such property exists. + * @see java.security.Security security properties + * @return the default algorithm name as specified by the + * {@code ssl.TrustManagerFactory.algorithm} security property, or an + * implementation-specific default if no such property exists. */ public final static String getDefaultAlgorithm() { String type;
--- a/src/share/classes/javax/security/auth/Policy.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/security/auth/Policy.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, 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 @@ -126,14 +126,9 @@ * are rejected. Such permission must be listed in the * <code>java.security.Policy</code>. * - * <p> The default <code>Policy</code> implementation can be changed by - * setting the value of the "auth.policy.provider" security property - * (in the Java security properties file) to the fully qualified name of - * the desired <code>Policy</code> implementation class. - * The Java security properties file is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * <p> The default {@code Policy} implementation can be changed by + * setting the value of the {@code auth.policy.provider} security property to + * the fully qualified name of the desired {@code Policy} implementation class. * * @deprecated as of JDK version 1.4 -- Replaced by java.security.Policy. * java.security.Policy has a method: @@ -154,7 +149,7 @@ * These two APIs provide callers the means to query the * Policy for Principal-based Permission entries. * - * + * @see java.security.Security security properties */ @Deprecated public abstract class Policy {
--- a/src/share/classes/javax/security/auth/callback/CallbackHandler.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/security/auth/callback/CallbackHandler.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2005, 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 @@ -49,13 +49,9 @@ * can then choose to prompt for a username and password serially, * or to prompt for both in a single window. * - * <p> A default <code>CallbackHandler</code> class implementation - * may be specified in the <i>auth.login.defaultCallbackHandler</i> - * security property. The security property can be set - * in the Java security properties file located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * <p> A default {@code CallbackHandler} class implementation + * may be specified by setting the value of the + * {@code auth.login.defaultCallbackHandler} security property. * * <p> If the security property is set to the fully qualified name of a * <code>CallbackHandler</code> implementation class, @@ -67,6 +63,7 @@ * <p> All default handler implementations must provide a public * zero-argument constructor. * + * @see java.security.Security security properties */ public interface CallbackHandler {
--- a/src/share/classes/javax/security/auth/login/Configuration.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/security/auth/login/Configuration.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ -173,12 +173,8 @@ * Configuration implementation (a default subclass implementation of this * abstract class). * The default Configuration implementation can be changed by setting the value - * of the "login.configuration.provider" security property (in the Java - * security properties file) to the fully qualified name of the desired - * Configuration subclass implementation. The Java security properties file - * is located in the file named <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * of the {@code login.configuration.provider} security property to the fully + * qualified name of the desired Configuration subclass implementation. * * <p> Application code can directly subclass Configuration to provide a custom * implementation. In addition, an instance of a Configuration object can be @@ -190,6 +186,7 @@ * for a list of standard Configuration types. * * @see javax.security.auth.login.LoginContext + * @see java.security.Security security properties */ public abstract class Configuration {
--- a/src/share/classes/javax/security/auth/login/LoginContext.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/security/auth/login/LoginContext.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ -163,9 +163,9 @@ * input parameter, or if the caller specifies a <code>null</code> * CallbackHandler object (and a <code>null</code> value is permitted), * the LoginContext queries the - * <i>auth.login.defaultCallbackHandler</i> security property - * for the fully qualified class name of a default handler implementation. - * If the security property is not set, + * {@code auth.login.defaultCallbackHandler} security property for the + * fully qualified class name of a default handler + * implementation. If the security property is not set, * then the underlying modules will not have a * CallbackHandler for use in communicating * with users. The caller thus assumes that the configured @@ -184,21 +184,13 @@ * </ul> * </ol> * - * <p> Note that Security Properties - * (such as <code>auth.login.defaultCallbackHandler</code>) - * can be set programmatically via the - * <code>java.security.Security</code> class, - * or statically in the Java security properties file located in the - * file named <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. - * * @see java.security.Security * @see javax.security.auth.AuthPermission * @see javax.security.auth.Subject * @see javax.security.auth.callback.CallbackHandler * @see javax.security.auth.login.Configuration * @see javax.security.auth.spi.LoginModule + * @see java.security.Security security properties */ public class LoginContext {
--- a/src/share/classes/javax/security/cert/X509Certificate.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/security/cert/X509Certificate.java Mon Dec 17 08:30:06 2012 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -96,21 +96,17 @@ * </pre> * <p> * In either case, the code that instantiates an X.509 certificate - * consults the Java security properties file to locate the actual - * implementation or instantiates a default implementation. + * consults the value of the {@code cert.provider.x509v1} security property + * to locate the actual implementation or instantiates a default implementation. * <p> - * The Java security properties file is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. - * In the Security properties file, a default implementation - * for X.509 v1 may be given such as: + * The {@code cert.provider.x509v1} property is set to a default + * implementation for X.509 such as: * <pre> * cert.provider.x509v1=com.sun.security.cert.internal.x509.X509V1CertImpl * </pre> * <p> - * The value of this <code>cert.provider.x509v1</code> property has to be - * changed to instatiate another implementation. If this security + * The value of this {@code cert.provider.x509v1} property has to be + * changed to instantiate another implementation. If this security * property is not set, a default implementation will be used. * Currently, due to possible security restrictions on access to * Security properties, this value is looked up and cached at class @@ -127,6 +123,7 @@ * @since 1.4 * @see Certificate * @see java.security.cert.X509Extension + * @see java.security.Security security properties */ public abstract class X509Certificate extends Certificate { @@ -156,8 +153,7 @@ * the data read from the input stream <code>inStream</code>. * The implementation (X509Certificate is an abstract class) is * provided by the class specified as the value of the - * <code>cert.provider.x509v1</code> - * property in the security properties file. + * {@code cert.provider.x509v1} security property. * * <p>Note: Only one DER-encoded * certificate is expected to be in the input stream. @@ -184,8 +180,7 @@ * the specified byte array. * The implementation (X509Certificate is an abstract class) is * provided by the class specified as the value of the - * <code>cert.provider.x509v1</code> - * property in the security properties file. + * {@code cert.provider.x509v1} security property. * * <p>Note: All X509Certificate * subclasses must provide a constructor of the form:
--- a/src/share/classes/javax/sql/rowset/serial/SerialArray.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/sql/rowset/serial/SerialArray.java Mon Dec 17 08:30:06 2012 -0500 @@ -31,6 +31,7 @@ import java.net.URL; import java.util.Arrays; + /** * A serialized version of an <code>Array</code> * object, which is the mapping in the Java programming language of an SQL @@ -41,44 +42,52 @@ * methods for getting the base type and the SQL name for the base type, and * methods for copying all or part of a <code>SerialArray</code> object. * <P> + * * Note: In order for this class to function correctly, a connection to the * data source * must be available in order for the SQL <code>Array</code> object to be * materialized (have all of its elements brought to the client server) * if necessary. At this time, logical pointers to the data in the data source, * such as locators, are not currently supported. + * + * <h4> Thread safety </h4> + * + * A SerialArray is not safe for use by multiple concurrent threads. If a + * SerialArray is to be used by more than one thread then access to the + * SerialArray should be controlled by appropriate synchronization. + * */ public class SerialArray implements Array, Serializable, Cloneable { - /** - * A serialized array in which each element is an <code>Object</code> - * in the Java programming language that represents an element - * in the SQL <code>ARRAY</code> value. - * @serial - */ + /** + * A serialized array in which each element is an <code>Object</code> + * in the Java programming language that represents an element + * in the SQL <code>ARRAY</code> value. + * @serial + */ private Object[] elements; - /** - * The SQL type of the elements in this <code>SerialArray</code> object. The - * type is expressed as one of the constants from the class - * <code>java.sql.Types</code>. - * @serial - */ + /** + * The SQL type of the elements in this <code>SerialArray</code> object. The + * type is expressed as one of the constants from the class + * <code>java.sql.Types</code>. + * @serial + */ private int baseType; - /** - * The type name used by the DBMS for the elements in the SQL <code>ARRAY</code> - * value that this <code>SerialArray</code> object represents. - * @serial - */ + /** + * The type name used by the DBMS for the elements in the SQL <code>ARRAY</code> + * value that this <code>SerialArray</code> object represents. + * @serial + */ private String baseTypeName; - /** - * The number of elements in this <code>SerialArray</code> object, which - * is also the number of elements in the SQL <code>ARRAY</code> value - * that this <code>SerialArray</code> object represents. - * @serial - */ + /** + * The number of elements in this <code>SerialArray</code> object, which + * is also the number of elements in the SQL <code>ARRAY</code> value + * that this <code>SerialArray</code> object represents. + * @serial + */ private int len; /** @@ -192,24 +201,19 @@ } /** - * This method frees the <code>Array</code> object and releases the resources that - * it holds. The object is invalid once the <code>free</code> - * method is called. - *<p> - * After <code>free</code> has been called, any attempt to invoke a - * method other than <code>free</code> will result in a <code>SQLException</code> - * being thrown. If <code>free</code> is called multiple times, the subsequent - * calls to <code>free</code> are treated as a no-op. - *<p> + * This method frees the {@code SeriableArray} object and releases the + * resources that it holds. The object is invalid once the {@code free} + * method is called. <p> If {@code free} is called multiple times, the + * subsequent calls to {@code free} are treated as a no-op. </P> * - * @throws SQLException if an error occurs releasing - * the Array's resources - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method + * @throws SQLException if an error occurs releasing the SerialArray's resources * @since 1.6 */ public void free() throws SQLException { - throw new SQLFeatureNotSupportedException("Feature not supported"); + if (elements != null) { + elements = null; + baseTypeName= null; + } } /** @@ -292,129 +296,140 @@ } - /** - * Returns a new array that is a copy of this <code>SerialArray</code> - * object. - * - * @return a copy of this <code>SerialArray</code> object as an - * <code>Object</code> in the Java programming language - * @throws SerialException if an error occurs retrieving a copy of - * this <code>SerialArray</code> object - */ + /** + * Returns a new array that is a copy of this <code>SerialArray</code> + * object. + * + * @return a copy of this <code>SerialArray</code> object as an + * <code>Object</code> in the Java programming language + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object + */ public Object getArray() throws SerialException { + isValid(); Object dst = new Object[len]; System.arraycopy((Object)elements, 0, dst, 0, len); return dst; } //[if an error occurstype map used??] - /** - * Returns a new array that is a copy of this <code>SerialArray</code> - * object, using the given type map for the custom - * mapping of each element when the elements are SQL UDTs. - * <P> - * This method does custom mapping if the array elements are a UDT - * and the given type map has an entry for that UDT. + /** + * Returns a new array that is a copy of this <code>SerialArray</code> + * object, using the given type map for the custom + * mapping of each element when the elements are SQL UDTs. + * <P> + * This method does custom mapping if the array elements are a UDT + * and the given type map has an entry for that UDT. * Custom mapping is recursive, - * meaning that if, for instance, an element of an SQL structured type - * is an SQL structured type that itself has an element that is an SQL - * structured type, each structured type that has a custom mapping will be - * mapped according to the given type map. - * + * meaning that if, for instance, an element of an SQL structured type + * is an SQL structured type that itself has an element that is an SQL + * structured type, each structured type that has a custom mapping will be + * mapped according to the given type map. + * * @param map a <code>java.util.Map</code> object in which * each entry consists of 1) a <code>String</code> object * giving the fully qualified name of a UDT and 2) the * <code>Class</code> object for the <code>SQLData</code> implementation * that defines how the UDT is to be mapped - * @return a copy of this <code>SerialArray</code> object as an - * <code>Object</code> in the Java programming language - * @throws SerialException if an error occurs - */ + * @return a copy of this <code>SerialArray</code> object as an + * <code>Object</code> in the Java programming language + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object + */ public Object getArray(Map<String, Class<?>> map) throws SerialException { + isValid(); Object dst[] = new Object[len]; System.arraycopy((Object)elements, 0, dst, 0, len); return dst; } - /** - * Returns a new array that is a copy of a slice - * of this <code>SerialArray</code> object, starting with the - * element at the given index and containing the given number - * of consecutive elements. - * - * @param index the index into this <code>SerialArray</code> object - * of the first element to be copied; - * the index of the first element is <code>0</code> - * @param count the number of consecutive elements to be copied, starting - * at the given index - * @return a copy of the designated elements in this <code>SerialArray</code> - * object as an <code>Object</code> in the Java programming language - * @throws SerialException if an error occurs - */ + /** + * Returns a new array that is a copy of a slice + * of this <code>SerialArray</code> object, starting with the + * element at the given index and containing the given number + * of consecutive elements. + * + * @param index the index into this <code>SerialArray</code> object + * of the first element to be copied; + * the index of the first element is <code>0</code> + * @param count the number of consecutive elements to be copied, starting + * at the given index + * @return a copy of the designated elements in this <code>SerialArray</code> + * object as an <code>Object</code> in the Java programming language + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object + */ public Object getArray(long index, int count) throws SerialException { + isValid(); Object dst = new Object[count]; System.arraycopy((Object)elements, (int)index, dst, 0, count); return dst; } - /** - * Returns a new array that is a copy of a slice - * of this <code>SerialArray</code> object, starting with the - * element at the given index and containing the given number - * of consecutive elements. - * <P> - * This method does custom mapping if the array elements are a UDT - * and the given type map has an entry for that UDT. + /** + * Returns a new array that is a copy of a slice + * of this <code>SerialArray</code> object, starting with the + * element at the given index and containing the given number + * of consecutive elements. + * <P> + * This method does custom mapping if the array elements are a UDT + * and the given type map has an entry for that UDT. * Custom mapping is recursive, - * meaning that if, for instance, an element of an SQL structured type - * is an SQL structured type that itself has an element that is an SQL - * structured type, each structured type that has a custom mapping will be - * mapped according to the given type map. - * - * @param index the index into this <code>SerialArray</code> object - * of the first element to be copied; the index of the - * first element in the array is <code>0</code> - * @param count the number of consecutive elements to be copied, starting - * at the given index + * meaning that if, for instance, an element of an SQL structured type + * is an SQL structured type that itself has an element that is an SQL + * structured type, each structured type that has a custom mapping will be + * mapped according to the given type map. + * + * @param index the index into this <code>SerialArray</code> object + * of the first element to be copied; the index of the + * first element in the array is <code>0</code> + * @param count the number of consecutive elements to be copied, starting + * at the given index * @param map a <code>java.util.Map</code> object in which * each entry consists of 1) a <code>String</code> object * giving the fully qualified name of a UDT and 2) the * <code>Class</code> object for the <code>SQLData</code> implementation * that defines how the UDT is to be mapped - * @return a copy of the designated elements in this <code>SerialArray</code> - * object as an <code>Object</code> in the Java programming language - * @throws SerialException if an error occurs - */ + * @return a copy of the designated elements in this <code>SerialArray</code> + * object as an <code>Object</code> in the Java programming language + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object + */ public Object getArray(long index, int count, Map<String,Class<?>> map) throws SerialException { + isValid(); Object dst = new Object[count]; System.arraycopy((Object)elements, (int)index, dst, 0, count); return dst; } - /** - * Retrieves the SQL type of the elements in this <code>SerialArray</code> - * object. The <code>int</code> returned is one of the constants in the class - * <code>java.sql.Types</code>. - * - * @return one of the constants in <code>java.sql.Types</code>, indicating - * the SQL type of the elements in this <code>SerialArray</code> object - * @throws SerialException if an error occurs - */ + /** + * Retrieves the SQL type of the elements in this <code>SerialArray</code> + * object. The <code>int</code> returned is one of the constants in the class + * <code>java.sql.Types</code>. + * + * @return one of the constants in <code>java.sql.Types</code>, indicating + * the SQL type of the elements in this <code>SerialArray</code> object + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object + */ public int getBaseType() throws SerialException { + isValid(); return baseType; } - /** - * Retrieves the DBMS-specific type name for the elements in this - * <code>SerialArray</code> object. - * - * @return the SQL type name used by the DBMS for the base type of this + /** + * Retrieves the DBMS-specific type name for the elements in this + * <code>SerialArray</code> object. + * + * @return the SQL type name used by the DBMS for the base type of this * <code>SerialArray</code> object - * @throws SerialException if an error occurs - */ + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object + */ public String getBaseTypeName() throws SerialException { + isValid(); return baseTypeName; } @@ -434,11 +449,13 @@ * @return a <code>ResultSet</code> object containing the designated * elements in this <code>SerialArray</code> object, with a * separate row for each element - * @throws SerialException, which in turn throws an - * <code>UnsupportedOperationException</code>, if this method is called + * @throws SerialException if called with the cause set to + * {@code UnsupportedOperationException} */ public ResultSet getResultSet(long index, int count) throws SerialException { - throw new UnsupportedOperationException(); + SerialException se = new SerialException(); + se.initCause(new UnsupportedOperationException()); + throw se; } /** @@ -461,13 +478,15 @@ * @return a <code>ResultSet</code> object containing all of the * elements in this <code>SerialArray</code> object, with a * separate row for each element - * @throws SerialException, which in turn throws an - * <code>UnsupportedOperationException</code>, if this method is called + * @throws SerialException if called with the cause set to + * {@code UnsupportedOperationException} */ public ResultSet getResultSet(Map<String, Class<?>> map) throws SerialException { - throw new UnsupportedOperationException(); + SerialException se = new SerialException(); + se.initCause(new UnsupportedOperationException()); + throw se; } /** @@ -480,11 +499,13 @@ * @return a <code>ResultSet</code> object containing all of the * elements in this <code>SerialArray</code> object, with a * separate row for each element - * @throws SerialException if called, which in turn throws an - * <code>UnsupportedOperationException</code>, if this method is called + * @throws SerialException if called with the cause set to + * {@code UnsupportedOperationException} */ public ResultSet getResultSet() throws SerialException { - throw new UnsupportedOperationException(); + SerialException se = new SerialException(); + se.initCause(new UnsupportedOperationException()); + throw se; } @@ -514,16 +535,19 @@ * @return a <code>ResultSet</code> object containing the designated * elements in this <code>SerialArray</code> object, with a * separate row for each element - * @throws SerialException if called, which in turn throws an - * <code>UnsupportedOperationException</code> + * @throws SerialException if called with the cause set to + * {@code UnsupportedOperationException} */ public ResultSet getResultSet(long index, int count, Map<String,Class<?>> map) throws SerialException { - throw new UnsupportedOperationException(); + SerialException se = new SerialException(); + se.initCause(new UnsupportedOperationException()); + throw se; } + /** * Compares this SerialArray to the specified object. The result is {@code * true} if and only if the argument is not {@code null} and is a {@code @@ -566,12 +590,12 @@ * reference to a clone of the underlying objects array, not a reference * to the original underlying object array of this {@code SerialArray} object. * - * @return a clone of this SerialArray + * @return a clone of this SerialArray */ public Object clone() { try { SerialArray sa = (SerialArray) super.clone(); - sa.elements = Arrays.copyOf(elements, len); + sa.elements = (elements != null) ? Arrays.copyOf(elements, len) : null; return sa; } catch (CloneNotSupportedException ex) { // this shouldn't happen, since we are Cloneable @@ -616,6 +640,19 @@ } /** + * Check to see if this object had previously had its {@code free} method + * called + * + * @throws SerialException + */ + private void isValid() throws SerialException { + if (elements == null) { + throw new SerialException("Error: You cannot call a method on a " + + "SerialArray instance once free() has been called."); + } + } + + /** * The identifier that assists in the serialization of this <code>SerialArray</code> * object. */
--- a/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Mon Dec 17 08:30:06 2012 -0500 @@ -51,6 +51,12 @@ * <code>Blob</code> object within a <code>SerialBlob</code> object * and to update or truncate a <code>Blob</code> object. * + * <h4> Thread safety </h4> + * + * <p> A SerialBlob is not safe for use by multiple concurrent threads. If a + * SerialBlob is to be used by more than one thread then access to the SerialBlob + * should be controlled by appropriate synchronization. + * * @author Jonathan Bruce */ public class SerialBlob implements Blob, Serializable, Cloneable { @@ -76,7 +82,7 @@ private long len; /** - * The orginal number of bytes in this <code>SerialBlob</code> object's + * The original number of bytes in this <code>SerialBlob</code> object's * array of bytes when it was first established. * @serial */ @@ -160,9 +166,11 @@ * @return an array of bytes that is a copy of a region of this * <code>SerialBlob</code> object, starting at the given * position and containing the given number of consecutive bytes - * @throws SerialException if the given starting position is out of bounds + * @throws SerialException if the given starting position is out of bounds; + * if {@code free} had previously been called on this object */ public byte[] getBytes(long pos, int length) throws SerialException { + isValid(); if (length > len) { length = (int)len; } @@ -189,9 +197,11 @@ * * @return a <code>long</code> indicating the length in bytes of this * <code>SerialBlob</code> object's array of bytes - * @throws SerialException if an error occurs + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object */ public long length() throws SerialException { + isValid(); return len; } @@ -203,12 +213,14 @@ * * @return a <code>java.io.InputStream</code> object that contains * this <code>SerialBlob</code> object's array of bytes - * @throws SerialException if an error occurs + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object * @see #setBinaryStream */ public java.io.InputStream getBinaryStream() throws SerialException { - InputStream stream = new ByteArrayInputStream(buf); - return stream; + isValid(); + InputStream stream = new ByteArrayInputStream(buf); + return stream; } /** @@ -227,12 +239,14 @@ * position; <code>-1</code> if the pattern is not found * or the given starting position is out of bounds; position * numbering for the return value starts at <code>1</code> - * @throws SerialException if an error occurs when serializing the blob + * @throws SerialException if an error occurs when serializing the blob; + * if {@code free} had previously been called on this object * @throws SQLException if there is an error accessing the <code>BLOB</code> * value from the database */ public long position(byte[] pattern, long start) throws SerialException, SQLException { + isValid(); if (start < 1 || start > len) { return -1; } @@ -270,12 +284,14 @@ * at the specified position; <code>-1</code> if the pattern is * not found or the given starting position is out of bounds; * position numbering for the return value starts at <code>1</code> - * @throws SerialException if an error occurs when serializing the blob + * @throws SerialException if an error occurs when serializing the blob; + * if {@code free} had previously been called on this object * @throws SQLException if there is an error accessing the <code>BLOB</code> * value from the database */ public long position(Blob pattern, long start) throws SerialException, SQLException { + isValid(); return position(pattern.getBytes(1, (int)(pattern.length())), start); } @@ -293,7 +309,8 @@ * @return the number of bytes written * @throws SerialException if there is an error accessing the * <code>BLOB</code> value; or if an invalid position is set; if an - * invalid offset value is set + * invalid offset value is set; + * if {@code free} had previously been called on this object * @throws SQLException if there is an error accessing the <code>BLOB</code> * value from the database * @see #getBytes @@ -328,7 +345,8 @@ * <code>BLOB</code> value; if an invalid position is set; if an * invalid offset value is set; if number of bytes to be written * is greater than the <code>SerialBlob</code> length; or the combined - * values of the length and offset is greater than the Blob buffer + * values of the length and offset is greater than the Blob buffer; + * if {@code free} had previously been called on this object * @throws SQLException if there is an error accessing the <code>BLOB</code> * value from the database. * @see #getBytes @@ -336,6 +354,7 @@ public int setBytes(long pos, byte[] bytes, int offset, int length) throws SerialException, SQLException { + isValid(); if (offset < 0 || offset > bytes.length) { throw new SerialException("Invalid offset in byte array set"); } @@ -378,11 +397,13 @@ * @throws SQLException if there is an error accessing the * <code>BLOB</code> value * @throws SerialException if the SerialBlob in not instantiated with a - * <code>Blob</code> object that supports <code>setBinaryStream()</code> + * <code>Blob</code> object that supports <code>setBinaryStream()</code>; + * if {@code free} had previously been called on this object * @see #getBinaryStream */ public java.io.OutputStream setBinaryStream(long pos) throws SerialException, SQLException { + isValid(); if (this.blob != null) { return this.blob.setBinaryStream(pos); } else { @@ -400,54 +421,75 @@ * value that this <code>Blob</code> object represents should be * truncated * @throws SerialException if there is an error accessing the Blob value; - * or the length to truncate is greater that the SerialBlob length + * or the length to truncate is greater that the SerialBlob length; + * if {@code free} had previously been called on this object */ public void truncate(long length) throws SerialException { - if (length > len) { - throw new SerialException - ("Length more than what can be truncated"); - } else if((int)length == 0) { - buf = new byte[0]; - len = length; - } else { - len = length; - buf = this.getBytes(1, (int)len); - } + isValid(); + if (length > len) { + throw new SerialException + ("Length more than what can be truncated"); + } else if((int)length == 0) { + buf = new byte[0]; + len = length; + } else { + len = length; + buf = this.getBytes(1, (int)len); + } } /** - * Returns an <code>InputStream</code> object that contains a partial <code>Blob</code> value, - * starting with the byte specified by pos, which is length bytes in length. + * Returns an + * <code>InputStream</code> object that contains a partial + * {@code Blob} value, starting with the byte specified by pos, which is + * length bytes in length. * - * @param pos the offset to the first byte of the partial value to be retrieved. - * The first byte in the <code>Blob</code> is at position 1 + * @param pos the offset to the first byte of the partial value to be + * retrieved. The first byte in the {@code Blob} is at position 1 * @param length the length in bytes of the partial value to be retrieved - * @return <code>InputStream</code> through which the partial <code>Blob</code> value can be read. - * @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes - * in the <code>Blob</code> or if pos + length is greater than the number of bytes - * in the <code>Blob</code> + * @return + * <code>InputStream</code> through which the partial {@code Blob} value can + * be read. + * @throws SQLException if pos is less than 1 or if pos is greater than the + * number of bytes in the {@code Blob} or if pos + length is greater than + * the number of bytes in the {@code Blob} + * @throws SerialException if the {@code free} method had been previously + * called on this object * * @since 1.6 */ - public InputStream getBinaryStream(long pos,long length) throws SQLException { - throw new java.lang.UnsupportedOperationException("Not supported"); + public InputStream getBinaryStream(long pos, long length) throws SQLException { + isValid(); + if (pos < 1 || pos > this.length()) { + throw new SerialException("Invalid position in BLOB object set"); + } + if (length < 1 || length > len - pos + 1) { + throw new SerialException("length is < 1 or pos + length >" + + "total number of bytes"); + } + return new ByteArrayInputStream(buf, (int) pos - 1, (int) length); } /** - * This method frees the <code>Blob</code> object and releases the resources that it holds. - * <code>Blob</code> object. The object is invalid once the <code>free</code> - * method is called. If <code>free</code> is called multiple times, the subsequent - * calls to <code>free</code> are treated as a no-op. + * This method frees the {@code SeriableBlob} object and releases the + * resources that it holds. The object is invalid once the {@code free} + * method is called. <p> If {@code free} is called multiple times, the + * subsequent calls to {@code free} are treated as a no-op. </P> * - * @throws SQLException if an error occurs releasing - * the Blob's resources + * @throws SQLException if an error occurs releasing the Blob's resources * @since 1.6 */ public void free() throws SQLException { - throw new java.lang.UnsupportedOperationException("Not supported"); + if (buf != null) { + buf = null; + if (blob != null) { + blob.free(); + } + blob = null; + } } /** @@ -494,7 +536,7 @@ public Object clone() { try { SerialBlob sb = (SerialBlob) super.clone(); - sb.buf = Arrays.copyOf(buf, (int)len); + sb.buf = (buf != null) ? Arrays.copyOf(buf, (int)len) : null; sb.blob = null; return sb; } catch (CloneNotSupportedException ex) { @@ -541,9 +583,21 @@ } /** - * The identifier that assists in the serialization of this <code>SerialBlob</code> - * object. + * Check to see if this object had previously had its {@code free} method + * called + * + * @throws SerialException */ + private void isValid() throws SerialException { + if (buf == null) { + throw new SerialException("Error: You cannot call a method on a " + + "SerialBlob instance once free() has been called."); + } + } + /** + * The identifier that assists in the serialization of this + * {@code SerialBlob} object. + */ static final long serialVersionUID = -8144641928112860441L; }
--- a/src/share/classes/javax/sql/rowset/serial/SerialClob.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/sql/rowset/serial/SerialClob.java Mon Dec 17 08:30:06 2012 -0500 @@ -44,6 +44,11 @@ * from a <code>SerialClob</code> object or to locate the start of * a pattern of characters. * + * <h4> Thread safety </h4> + * + * <p> A SerialClob is not safe for use by multiple concurrent threads. If a + * SerialClob is to be used by more than one thread then access to the SerialClob + * should be controlled by appropriate synchronization. * @author Jonathan Bruce */ public class SerialClob implements Clob, Serializable, Cloneable { @@ -180,9 +185,11 @@ * * @return a <code>long</code> indicating the length in characters of this * <code>SerialClob</code> object's array of character - * @throws SerialException if an error occurs + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object */ public long length() throws SerialException { + isValid(); return len; } @@ -194,9 +201,11 @@ * * @return a <code>java.io.Reader</code> object containing this * <code>SerialClob</code> object's data - * @throws SerialException if an error occurs + * @throws SerialException if an error occurs; + * if {@code free} had previously been called on this object */ public java.io.Reader getCharacterStream() throws SerialException { + isValid(); return (java.io.Reader) new CharArrayReader(buf); } @@ -210,13 +219,15 @@ * * @return a <code>java.io.InputStream</code> object containing * this <code>SerialClob</code> object's data - * @throws SerialException if this <code>SerialClob</code> object was not instantiated - * with a <code>Clob</code> object + * @throws SerialException if this {@code SerialClob} object was not + * instantiated with a <code>Clob</code> object; + * if {@code free} had previously been called on this object * @throws SQLException if there is an error accessing the - * <code>CLOB</code> value represented by the <code>Clob</code> object that was - * used to create this <code>SerialClob</code> object + * <code>CLOB</code> value represented by the <code>Clob</code> object + * that was used to create this <code>SerialClob</code> object */ public java.io.InputStream getAsciiStream() throws SerialException, SQLException { + isValid(); if (this.clob != null) { return this.clob.getAsciiStream(); } else { @@ -248,12 +259,14 @@ * this <code>SerialClob</code> object beginning at the * given position and containing the specified number of * consecutive characters - * @throws SerialException if either of the arguments is out of bounds + * @throws SerialException if either of the arguments is out of bounds; + * if {@code free} had previously been called on this object */ public String getSubString(long pos, int length) throws SerialException { + isValid(); if (pos < 1 || pos > this.length()) { - throw new SerialException("Invalid position in BLOB object set"); + throw new SerialException("Invalid position in SerialClob object set"); } if ((pos-1) + length > this.length()) { @@ -287,13 +300,14 @@ * <code>-1</code> if the given <code>String</code> object is * not found or the starting position is out of bounds; position * numbering for the return value starts at <code>1</code> - * @throws SerialException if an error occurs locating the String signature - * @throws SQLException if there is an error accessing the Blob value + * @throws SerialException if the {@code free} method had been + * previously called on this object + * @throws SQLException if there is an error accessing the Clob value * from the database. */ public long position(String searchStr, long start) throws SerialException, SQLException { - + isValid(); if (start < 1 || start > len) { return -1; } @@ -332,13 +346,14 @@ * @return the position at which the given <code>Clob</code> * object begins in this <code>SerialClob</code> object, * at or after the specified starting position - * @throws SerialException if an error occurs locating the Clob signature - * @throws SQLException if there is an error accessing the Blob value + * @throws SerialException if an error occurs locating the Clob signature; + * if the {@code free} method had been previously called on this object + * @throws SQLException if there is an error accessing the Clob value * from the database */ public long position(Clob searchStr, long start) throws SerialException, SQLException { - + isValid(); return position(searchStr.getSubString(1,(int)searchStr.length()), start); } @@ -358,7 +373,8 @@ * <code>CLOB</code> value; if an invalid position is set; if an * invalid offset value is set; if number of bytes to be written * is greater than the <code>SerialClob</code> length; or the combined - * values of the length and offset is greater than the Clob buffer + * values of the length and offset is greater than the Clob buffer; + * if the {@code free} method had been previously called on this object */ public int setString(long pos, String str) throws SerialException { return (setString(pos, str, 0, str.length())); @@ -383,10 +399,12 @@ * <code>CLOB</code> value; if an invalid position is set; if an * invalid offset value is set; if number of bytes to be written * is greater than the <code>SerialClob</code> length; or the combined - * values of the length and offset is greater than the Clob buffer + * values of the length and offset is greater than the Clob buffer; + * if the {@code free} method had been previously called on this object */ public int setString(long pos, String str, int offset, int length) throws SerialException { + isValid(); String temp = str.substring(offset); char cPattern[] = temp.toCharArray(); @@ -395,7 +413,7 @@ } if (pos < 1 || pos > this.length()) { - throw new SerialException("Invalid position in BLOB object set"); + throw new SerialException("Invalid position in Clob object set"); } if ((long)(length) > origLen) { @@ -430,13 +448,15 @@ * <code>CLOB</code> object * @return the stream to which ASCII encoded characters can be written * @throws SerialException if SerialClob is not instantiated with a - * Clob object that supports <code>setAsciiStream</code> + * Clob object; + * if the {@code free} method had been previously called on this object * @throws SQLException if there is an error accessing the * <code>CLOB</code> value * @see #getAsciiStream */ public java.io.OutputStream setAsciiStream(long pos) throws SerialException, SQLException { + isValid(); if (this.clob != null) { return this.clob.setAsciiStream(pos); } else { @@ -460,13 +480,15 @@ * * @return a stream to which Unicode encoded characters can be written * @throws SerialException if the SerialClob is not instantiated with - * a Clob object that supports <code>setCharacterStream</code> + * a Clob object; + * if the {@code free} method had been previously called on this object * @throws SQLException if there is an error accessing the * <code>CLOB</code> value * @see #getCharacterStream */ public java.io.Writer setCharacterStream(long pos) throws SerialException, SQLException { + isValid(); if (this.clob != null) { return this.clob.setCharacterStream(pos); } else { @@ -486,33 +508,80 @@ * * @param length the length, in bytes, to which the <code>CLOB</code> * value should be truncated - * @throws SQLException if there is an error accessing the - * <code>CLOB</code> value + * @throws SerialLException if there is an error accessing the + * <code>CLOB</code> value; + * if the {@code free} method had been previously called on this object */ public void truncate(long length) throws SerialException { - if (length > len) { - throw new SerialException - ("Length more than what can be truncated"); - } else { - len = length; - // re-size the buffer + isValid(); + if (length > len) { + throw new SerialException + ("Length more than what can be truncated"); + } else { + len = length; + // re-size the buffer - if (len == 0) { - buf = new char[] {}; - } else { + if (len == 0) { + buf = new char[] {}; + } else { buf = (this.getSubString(1, (int)len)).toCharArray(); - } - - } + } + } } + /** + * Returns a {@code Reader} object that contains a partial + * {@code SerialClob} value, starting + * with the character specified by pos, which is length characters in length. + * + * @param pos the offset to the first character of the partial value to + * be retrieved. The first character in the {@code SerialClob} is at position 1. + * @param length the length in characters of the partial value to be retrieved. + * @return {@code Reader} through which the partial {@code SerialClob} + * value can be read. + * @throws SQLException if pos is less than 1 or if pos is greater than the + * number of characters in the {@code SerialClob} or if pos + length + * is greater than the number of characters in the {@code SerialClob}; + * @throws SerialException if the {@code free} method had been previously + * called on this object + * @since 1.6 + */ public Reader getCharacterStream(long pos, long length) throws SQLException { - throw new java.lang.UnsupportedOperationException("Not supported"); + isValid(); + if (pos < 1 || pos > len) { + throw new SerialException("Invalid position in Clob object set"); + } + + if ((pos-1) + length > len) { + throw new SerialException("Invalid position and substring length"); + } + if (length <= 0) { + throw new SerialException("Invalid length specified"); + } + return new CharArrayReader(buf, (int)pos, (int)length); } + /** + * This method frees the {@code SeriableClob} object and releases the + * resources that it holds. + * The object is invalid once the {@code free} method is called. + * <p> + * If {@code free} is called multiple times, the subsequent + * calls to {@code free} are treated as a no-op. + * </P> + * @throws SQLException if an error occurs releasing + * the Clob's resources + * @since 1.6 + */ public void free() throws SQLException { - throw new java.lang.UnsupportedOperationException("Not supported"); + if (buf != null) { + buf = null; + if (clob != null) { + clob.free(); + } + clob = null; + } } /** @@ -559,7 +628,7 @@ public Object clone() { try { SerialClob sc = (SerialClob) super.clone(); - sc.buf = Arrays.copyOf(buf, (int)len); + sc.buf = (buf != null) ? Arrays.copyOf(buf, (int)len) : null; sc.clob = null; return sc; } catch (CloneNotSupportedException ex) { @@ -605,7 +674,20 @@ } /** - * The identifier that assists in the serialization of this <code>SerialClob</code> + * Check to see if this object had previously had its {@code free} method + * called + * + * @throws SerialException + */ + private void isValid() throws SerialException { + if (buf == null) { + throw new SerialException("Error: You cannot call a method on a " + + "SerialClob instance once free() has been called."); + } + } + + /** + * The identifier that assists in the serialization of this {@code SerialClob} * object. */ static final long serialVersionUID = -1662519690087375313L;
--- a/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java Mon Dec 17 08:30:06 2012 -0500 @@ -42,6 +42,12 @@ * <pre> * java.net.URL url = rowset.getURL(1); * </pre> + * + * <h4> Thread safety </h4> + * + * A SerialDatalink is not safe for use by multiple concurrent threads. If a + * SerialDatalink is to be used by more than one thread then access to the + * SerialDatalink should be controlled by appropriate synchronization. */ public class SerialDatalink implements Serializable, Cloneable {
--- a/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Mon Dec 17 08:30:06 2012 -0500 @@ -44,6 +44,12 @@ * Static or transient fields cannot be serialized; an attempt to serialize * them will result in a <code>SerialException</code> object being thrown. * + * <h4> Thread safety </h4> + * + * A SerialJavaObject is not safe for use by multiple concurrent threads. If a + * SerialJavaObject is to be used by more than one thread then access to the + * SerialJavaObject should be controlled by appropriate synchronization. + * * @author Jonathan Bruce */ public class SerialJavaObject implements Serializable, Cloneable {
--- a/src/share/classes/javax/sql/rowset/serial/SerialRef.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/sql/rowset/serial/SerialRef.java Mon Dec 17 08:30:06 2012 -0500 @@ -36,6 +36,13 @@ * The <code>SerialRef</code> class provides a constructor for * creating a <code>SerialRef</code> instance from a <code>Ref</code> * object and provides methods for getting and setting the <code>Ref</code> object. + * + * <h4> Thread safety </h4> + * + * A SerialRef is not safe for use by multiple concurrent threads. If a + * SerialRef is to be used by more than one thread then access to the SerialRef + * should be controlled by appropriate synchronization. + * */ public class SerialRef implements Ref, Serializable, Cloneable {
--- a/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Mon Dec 17 08:30:06 2012 -0500 @@ -50,6 +50,13 @@ * an instance from a <code>Struct</code> object, a method for retrieving * the SQL type name of the SQL structured type in the database, and methods * for retrieving its attribute values. + * + * <h4> Thread safety </h4> + * + * A SerialStruct is not safe for use by multiple concurrent threads. If a + * SerialStruct is to be used by more than one thread then access to the + * SerialStruct should be controlled by appropriate synchronization. + * */ public class SerialStruct implements Struct, Serializable, Cloneable {
--- a/src/share/classes/javax/swing/JColorChooser.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/swing/JColorChooser.java Mon Dec 17 08:30:06 2012 -0500 @@ -182,6 +182,7 @@ dialog = new ColorChooserDialog((Dialog)window, title, modal, c, chooserPane, okListener, cancelListener); } + dialog.getAccessibleContext().setAccessibleDescription(title); return dialog; } @@ -647,6 +648,7 @@ buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton okButton = new JButton(okString); getRootPane().setDefaultButton(okButton); + okButton.getAccessibleContext().setAccessibleDescription(okString); okButton.setActionCommand("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -659,6 +661,7 @@ buttonPane.add(okButton); cancelButton = new JButton(cancelString); + cancelButton.getAccessibleContext().setAccessibleDescription(cancelString); // The following few lines are used to register esc to close the dialog Action cancelKeyAction = new AbstractAction() { @@ -688,6 +691,7 @@ buttonPane.add(cancelButton); JButton resetButton = new JButton(resetString); + resetButton.getAccessibleContext().setAccessibleDescription(resetString); resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { reset();
--- a/src/share/classes/javax/swing/colorchooser/ColorChooserPanel.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/swing/colorchooser/ColorChooserPanel.java Mon Dec 17 08:30:06 2012 -0500 @@ -135,6 +135,7 @@ String label = this.model.getText(this, "HexCode"); // NON-NLS: suffix boolean visible = label != null; this.text.setVisible(visible); + this.text.getAccessibleContext().setAccessibleDescription(label); this.label.setVisible(visible); if (visible) { this.label.setText(label);
--- a/src/share/classes/javax/swing/colorchooser/ColorPanel.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/swing/colorchooser/ColorPanel.java Mon Dec 17 08:30:06 2012 -0500 @@ -37,6 +37,7 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.border.EmptyBorder; +import javax.swing.JSpinner.DefaultEditor; final class ColorPanel extends JPanel implements ActionListener { @@ -119,17 +120,26 @@ int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { + String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; - button.setText(this.model.getLabel(this, i)); + button.setText(text); + button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; - label.setText(this.model.getLabel(this, i)); + label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); + this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); + this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); + DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); + editor.getTextField().getAccessibleContext().setAccessibleName(text); + this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); + this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); + editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
--- a/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java Mon Dec 17 08:30:06 2012 -0500 @@ -94,6 +94,7 @@ tabbedPane = new JTabbedPane(); tabbedPane.setName("ColorChooser.tabPane"); tabbedPane.setInheritsPopupMenu(true); + tabbedPane.getAccessibleContext().setAccessibleDescription(tabbedPane.getName()); singlePanel = new JPanel(new CenterLayout()); singlePanel.setName("ColorChooser.panel"); singlePanel.setInheritsPopupMenu(true);
--- a/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Mon Dec 17 08:30:06 2012 -0500 @@ -1941,6 +1941,9 @@ for(int counter = beginRow + 1; counter <= endRow; counter++) { testRect = getPathBounds(tree, getPathForRow(tree, counter)); + if (testRect == null) { + return; + } if((testRect.y + testRect.height) > maxY) counter = endRow; } @@ -2069,7 +2072,7 @@ treeState.invalidatePathBounds(oldPath); updateSize(); } - else { + else if (editingBounds != null) { editingBounds.x = 0; editingBounds.width = tree.getSize().width; tree.repaint(editingBounds); @@ -2114,6 +2117,9 @@ tree.isPathSelected(path), tree.isExpanded(path), treeModel.isLeaf(path.getLastPathComponent()), row); Rectangle nodeBounds = getPathBounds(tree, path); + if (nodeBounds == null) { + return false; + } editingRow = row; @@ -2134,6 +2140,9 @@ // To make sure x/y are updated correctly, fetch // the bounds again. nodeBounds = getPathBounds(tree, path); + if (nodeBounds == null) { + return false; + } } else editorHasDifferentSize = false; @@ -3570,7 +3579,7 @@ if(pressedPath != null) { Rectangle bounds = getPathBounds(tree, pressedPath); - if(e.getY() >= (bounds.y + bounds.height)) { + if (bounds == null || e.getY() >= (bounds.y + bounds.height)) { return; } @@ -3832,6 +3841,10 @@ // And repaint Rectangle newMinBounds = getPathBounds(tree, minPath); + if (minBounds == null || newMinBounds == null) { + return; + } + if (indices.length == 1 && newMinBounds.height == minBounds.height) { tree.repaint(0, minBounds.y, tree.getWidth(), @@ -4466,27 +4479,28 @@ } } Rectangle newRect = ui.getPathBounds(tree, newPath); - - newRect.x = visRect.x; - newRect.width = visRect.width; - if(direction == -1) { - newRect.height = visRect.height; + if (newRect != null) { + newRect.x = visRect.x; + newRect.width = visRect.width; + if(direction == -1) { + newRect.height = visRect.height; + } + else { + newRect.y -= (visRect.height - newRect.height); + newRect.height = visRect.height; + } + + if(addToSelection) { + ui.extendSelection(newPath); + } + else if(changeSelection) { + tree.setSelectionPath(newPath); + } + else { + ui.setLeadSelectionPath(newPath, true); + } + tree.scrollRectToVisible(newRect); } - else { - newRect.y -= (visRect.height - newRect.height); - newRect.height = visRect.height; - } - - if(addToSelection) { - ui.extendSelection(newPath); - } - else if(changeSelection) { - tree.setSelectionPath(newPath); - } - else { - ui.setLeadSelectionPath(newPath, true); - } - tree.scrollRectToVisible(newRect); } }
--- a/src/share/classes/sun/awt/TextureSizeConstraining.java Mon Dec 17 08:28:27 2012 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * 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. - */ - -package sun.awt; - -/** - * A GraphicsConfiguration implements the TextureSizeConstraining - * interface to indicate that it imposes certain limitations on the - * maximum size of supported textures. - */ -public interface TextureSizeConstraining { - - /** - * Returns the maximum width of any texture image. - */ - public int getMaxTextureWidth(); - - /** - * Returns the maximum height of any texture image. - */ - public int getMaxTextureHeight(); - -}
--- a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java Mon Dec 17 08:30:06 2012 -0500 @@ -25,6 +25,7 @@ package sun.java2d.opengl; +import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.Transparency; import java.awt.geom.AffineTransform; @@ -99,6 +100,8 @@ CompositeType.AnyAlpha, blitIntArgbPreToSurface), + new OGLAnyCompositeBlit(OGLSurfaceData.OpenGLSurface), + new OGLSwToSurfaceScale(SurfaceType.IntRgb, OGLSurfaceData.PF_INT_RGB), new OGLSwToSurfaceScale(SurfaceType.IntRgbx, @@ -175,6 +178,9 @@ new OGLGeneralBlit(OGLSurfaceData.OpenGLTexture, CompositeType.SrcNoEa, blitIntArgbPreToTexture), + + new OGLAnyCompositeBlit(OGLSurfaceData.OpenGLTexture), + }; GraphicsPrimitiveMgr.register(primitives); } @@ -763,3 +769,49 @@ } } } + +class OGLAnyCompositeBlit extends Blit { + private WeakReference<SurfaceData> dstTmp; + + public OGLAnyCompositeBlit(SurfaceType dstType) { + super(SurfaceType.Any, CompositeType.Any, dstType); + } + public synchronized void Blit(SurfaceData src, SurfaceData dst, + Composite comp, Region clip, + int sx, int sy, int dx, int dy, + int w, int h) + { + Blit convertdst = Blit.getFromCache(dst.getSurfaceType(), + CompositeType.SrcNoEa, + SurfaceType.IntArgbPre); + + SurfaceData cachedDst = null; + + if (dstTmp != null) { + // use cached intermediate surface, if available + cachedDst = dstTmp.get(); + } + + // convert source to IntArgbPre + SurfaceData dstBuffer = convertFrom(convertdst, dst, dx, dy, w, h, + cachedDst, BufferedImage.TYPE_INT_ARGB_PRE); + + Blit performop = Blit.getFromCache(src.getSurfaceType(), + CompositeType.Any, dstBuffer.getSurfaceType()); + + performop.Blit(src, dstBuffer, comp, clip, + sx, sy, 0, 0, w, h); + + if (dstBuffer != cachedDst) { + // cache the intermediate surface + dstTmp = new WeakReference(dstBuffer); + } + + // now blit the buffer back to the destination + convertdst = Blit.getFromCache(dstBuffer.getSurfaceType(), + CompositeType.SrcNoEa, + dst.getSurfaceType()); + convertdst.Blit(dstBuffer, dst, AlphaComposite.Src, + clip, 0, 0, dx, dy, w, h); + } +}
--- a/src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java Mon Dec 17 08:30:06 2012 -0500 @@ -76,6 +76,7 @@ CompositeType comp, Color bgColor) { - return (bgColor == null || transparency == Transparency.OPAQUE); + return comp.isDerivedFrom(CompositeType.AnyAlpha) && + (bgColor == null || transparency == Transparency.OPAQUE); } }
--- a/src/share/classes/sun/net/www/MessageHeader.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/net/www/MessageHeader.java Mon Dec 17 08:30:06 2012 -0500 @@ -137,6 +137,43 @@ return null; } + /** + * Removes bare Negotiate and Kerberos headers when an "NTLM ..." + * appears. All Performed on headers with key being k. + * @return true if there is a change + */ + public boolean filterNTLMResponses(String k) { + boolean found = false; + for (int i=0; i<nkeys; i++) { + if (k.equalsIgnoreCase(keys[i]) + && values[i] != null && values[i].length() > 5 + && values[i].substring(0, 5).equalsIgnoreCase("NTLM ")) { + found = true; + break; + } + } + if (found) { + int j = 0; + for (int i=0; i<nkeys; i++) { + if (k.equalsIgnoreCase(keys[i]) && ( + "Negotiate".equalsIgnoreCase(values[i]) || + "Kerberos".equalsIgnoreCase(values[i]))) { + continue; + } + if (i != j) { + keys[j] = keys[i]; + values[j] = values[i]; + } + j++; + } + if (j != nkeys) { + nkeys = j; + return true; + } + } + return false; + } + class HeaderIterator implements Iterator<String> { int index = 0; int next = -1;
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Mon Dec 17 08:30:06 2012 -0500 @@ -1326,6 +1326,16 @@ if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(responses.toString()); } + + boolean b1 = responses.filterNTLMResponses("WWW-Authenticate"); + boolean b2 = responses.filterNTLMResponses("Proxy-Authenticate"); + if (b1 || b2) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + inputStream = http.getInputStream(); respCode = getResponseCode(); @@ -1784,6 +1794,13 @@ logger.fine(responses.toString()); } + if (responses.filterNTLMResponses("Proxy-Authenticate")) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + statusLine = responses.getValue(0); StringTokenizer st = new StringTokenizer(statusLine); st.nextToken();
--- a/src/share/classes/sun/print/PathGraphics.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/print/PathGraphics.java Mon Dec 17 08:30:06 2012 -0500 @@ -1025,7 +1025,8 @@ continue; } glyph = font2D.charToGlyph(c); - if (glyph != missingGlyph && glyph < numGlyphs && + if (glyph != missingGlyph && + glyph >= 0 && glyph < numGlyphs && (glyphToCharMap[glyph] == CharToGlyphMapper.INVISIBLE_GLYPH_ID)) { glyphToCharMap[glyph] = c;
--- a/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Mon Dec 17 08:30:06 2012 -0500 @@ -40,10 +40,7 @@ import sun.security.krb5.KrbException; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import java.util.Objects; -import java.util.Set; import sun.security.krb5.KerberosSecrets; import sun.security.krb5.PrincipalName; /** @@ -189,18 +186,6 @@ return subject; } - // A special KerberosKey, used as keys read from a KeyTab object. - // Each time new keys are read from KeyTab objects in the private - // credentials set, old ones are removed and new ones added. - public static class KeysFromKeyTab extends KerberosKey { - private static final long serialVersionUID = 8238092170252746927L; - - public KeysFromKeyTab(KerberosKey key) { - super(key.getPrincipal(), key.getEncoded(), - key.getKeyType(), key.getVersionNumber()); - } - } - /** * Credentials of a service, the private secret to authenticate its * identity, which can be: @@ -239,7 +224,7 @@ // Compatibility with old behavior: even when there is no // KerberosPrincipal, we can find one from KerberosKeys List<KerberosKey> keys = SubjectComber.findMany( - subj, null, null, KerberosKey.class); + subj, serverPrincipal, null, KerberosKey.class); if (!keys.isEmpty()) { sc.kp = keys.get(0).getPrincipal(); serverPrincipal = sc.kp.getName(); @@ -255,9 +240,9 @@ subj, null, null, KeyTab.class); sc.kk = SubjectComber.findMany( subj, serverPrincipal, null, KerberosKey.class); - sc.tgt = SubjectComber.find(subj, null, null, KerberosTicket.class); - - if (sc.ktabs.isEmpty() && sc.kk.isEmpty()) { + sc.tgt = SubjectComber.find( + subj, null, serverPrincipal, KerberosTicket.class); + if (sc.ktabs.isEmpty() && sc.kk.isEmpty() && sc.tgt == null) { return null; } return sc; @@ -268,37 +253,16 @@ } public KerberosKey[] getKKeys() { - if (ktabs.isEmpty()) { - return kk.toArray(new KerberosKey[kk.size()]); - } else { - List<KerberosKey> keys = new ArrayList<>(); - for (KeyTab ktab: ktabs) { - for (KerberosKey k: ktab.getKeys(kp)) { - keys.add(k); - } + List<KerberosKey> keys = new ArrayList<>(); + for (KerberosKey k: kk) { + keys.add(k); + } + for (KeyTab ktab: ktabs) { + for (KerberosKey k: ktab.getKeys(kp)) { + keys.add(k); } - // Compatibility: also add keys to privCredSet. Remove old - // ones first, only remove those from keytab. - if (!subj.isReadOnly()) { - Set<Object> pcs = subj.getPrivateCredentials(); - synchronized (pcs) { - Iterator<Object> iterator = pcs.iterator(); - while (iterator.hasNext()) { - Object obj = iterator.next(); - if (obj instanceof KeysFromKeyTab) { - KerberosKey key = (KerberosKey)obj; - if (Objects.equals(key.getPrincipal(), kp)) { - iterator.remove(); - } - } - } - } - for (KerberosKey key: keys) { - subj.getPrivateCredentials().add(new KeysFromKeyTab(key)); - } - } - return keys.toArray(new KerberosKey[keys.size()]); } + return keys.toArray(new KerberosKey[keys.size()]); } public EncryptionKey[] getEKeys() {
--- a/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java Mon Dec 17 08:30:06 2012 -0500 @@ -90,10 +90,6 @@ "libgssapi_krb5.so", "libgssapi_krb5.so.2", }; - } else if (osname.contains("OS X")) { - gssLibs = new String[]{ - "/usr/lib/sasl2/libgssapiv2.2.so", - }; } } else { gssLibs = new String[]{ defaultLib };
--- a/src/share/classes/sun/security/krb5/EncryptionKey.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/security/krb5/EncryptionKey.java Mon Dec 17 08:30:06 2012 -0500 @@ -555,6 +555,12 @@ int ktype; boolean etypeFound = false; + + // When no matched kvno is found, returns tke key of the same + // etype with the highest kvno + int kvno_found = 0; + EncryptionKey key_found = null; + for (int i = 0; i < keys.length; i++) { ktype = keys[i].getEType(); if (EType.isSupported(ktype)) { @@ -563,6 +569,10 @@ etypeFound = true; if (versionMatches(kvno, kv)) { return keys[i]; + } else if (kv > kvno_found) { + // kv is not null + key_found = keys[i]; + kvno_found = kv; } } } @@ -580,12 +590,17 @@ etypeFound = true; if (versionMatches(kvno, kv)) { return new EncryptionKey(etype, keys[i].getBytes()); + } else if (kv > kvno_found) { + key_found = new EncryptionKey(etype, keys[i].getBytes()); + kvno_found = kv; } } } } if (etypeFound) { - throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER); + return key_found; + // For compatibility, will not fail here. + //throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER); } return null; }
--- a/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java Mon Dec 17 08:30:06 2012 -0500 @@ -256,6 +256,7 @@ if (getFileChooser().getControlButtonsAreShown()) { approveButton.setText(getApproveButtonText(getFileChooser())); approveButton.setToolTipText(getApproveButtonToolTipText(getFileChooser())); + approveButton.setMnemonic(getApproveButtonMnemonic(getFileChooser())); } }
--- a/src/share/classes/sun/text/resources/FormatData.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/FormatData.java Mon Dec 17 08:30:06 2012 -0500 @@ -50,6 +50,20 @@ * Overrides ListResourceBundle */ protected final Object[][] getContents() { + final String[] buddhistEras = new String[] { // Thai Buddhist calendar era strings + "BC", // BC + "B.E." // Buddhist Era + }; + + // Japanese imperial calendar era abbreviations + final String[] japaneseEraAbbrs = new String[] { + "", + "M", + "T", + "S", + "H", + }; + return new Object[][] { { "MonthNames", new String[] { @@ -107,29 +121,49 @@ "Sat" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "W", + "T", + "F", + "S", + } + }, { "AmPmMarkers", new String[] { "AM", // am marker "PM" // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "a", // am marker + "p" // pm marker + } + }, { "Eras", new String[] { // era strings for GregorianCalendar "BC", "AD" } }, - { "buddhist.Eras", - new String[] { // Thai Buddhist calendar era strings - "BC", // BC - "B.E." // Buddhist Era + { "narrow.Eras", + new String[] { + "B", + "A", } }, + { "buddhist.Eras", + buddhistEras + }, { "buddhist.short.Eras", - new String[] { // Thai Buddhist calendar era strings - "BC", // BC - "B.E." // Buddhist Era - } + buddhistEras + }, + { "buddhist.narrow.Eras", + buddhistEras }, { "japanese.Eras", new String[] { // Japanese imperial calendar era strings @@ -141,13 +175,10 @@ } }, { "japanese.short.Eras", - new String[] { // Japanese imperial calendar era abbreviations - "", - "M", - "T", - "S", - "H", - } + japaneseEraAbbrs + }, + { "japanese.narrow.Eras", + japaneseEraAbbrs }, { "japanese.FirstYear", new String[] { // Japanese imperial calendar year name
--- a/src/share/classes/sun/text/resources/ar/FormatData_ar.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/ar/FormatData_ar.java Mon Dec 17 08:30:06 2012 -0500 @@ -107,6 +107,17 @@ "\u0633" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u062d", + "\u0646", + "\u062b", + "\u0631", + "\u062e", + "\u062c", + "\u0633", + } + }, { "AmPmMarkers", new String[] { "\u0635", // am marker
--- a/src/share/classes/sun/text/resources/be/FormatData_be.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/be/FormatData_be.java Mon Dec 17 08:30:06 2012 -0500 @@ -85,6 +85,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "\u0441", + "\u043b", + "\u0441", + "\u043a", + "\u043c", + "\u0447", + "\u043b", + "\u0436", + "\u0432", + "\u043a", + "\u043b", + "\u0441", + "", + } + }, { "DayNames", new String[] { "\u043d\u044f\u0434\u0437\u0435\u043b\u044f", // Sunday @@ -107,6 +124,17 @@ "\u0441\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0430", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u0434\u0430 \u043d.\u0435.",
--- a/src/share/classes/sun/text/resources/bg/FormatData_bg.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/bg/FormatData_bg.java Mon Dec 17 08:30:06 2012 -0500 @@ -107,6 +107,17 @@ "\u0421\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0432", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u043f\u0440.\u043d.\u0435.",
--- a/src/share/classes/sun/text/resources/ca/FormatData_ca.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/ca/FormatData_ca.java Mon Dec 17 08:30:06 2012 -0500 @@ -119,6 +119,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "g", + "f", + "m", + "a", + "m", + "j", + "j", + "a", + "s", + "o", + "n", + "d", + "", + } + }, { "DayNames", new String[] { "diumenge", // Sunday @@ -141,6 +158,28 @@ "ds." // abb Saturday } }, + { "DayNarrows", + new String[] { + "G", + "L", // Note: contributed item in CDLR + "T", + "C", + "J", + "V", + "S", + } + }, + { "standalone.DayNarrows", + new String[] { + "g", + "l", + "t", + "c", + "j", + "v", + "s", + } + }, { "NumberElements", new String[] { ",", // decimal separator
--- a/src/share/classes/sun/text/resources/cs/FormatData_cs.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/cs/FormatData_cs.java Mon Dec 17 08:30:06 2012 -0500 @@ -141,6 +141,17 @@ "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "\u00da", + "S", + "\u010c", + "P", + "S", + } + }, { "AmPmMarkers", new String[] { "dop.", // am marker
--- a/src/share/classes/sun/text/resources/da/FormatData_da.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/da/FormatData_da.java Mon Dec 17 08:30:06 2012 -0500 @@ -124,6 +124,17 @@ "l\u00f8" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "O", + "T", + "F", + "L", + } + }, { "NumberElements", new String[] { ",", // decimal separator
--- a/src/share/classes/sun/text/resources/de/FormatData_de.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/de/FormatData_de.java Mon Dec 17 08:30:06 2012 -0500 @@ -124,6 +124,17 @@ "Sa" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "D", + "M", + "D", + "F", + "S", + } + }, { "Eras", new String[] { // era strings "v. Chr.",
--- a/src/share/classes/sun/text/resources/el/FormatData_el.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/el/FormatData_el.java Mon Dec 17 08:30:06 2012 -0500 @@ -124,6 +124,17 @@ "\u03a3\u03b1\u03b2" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u039a", + "\u0394", + "\u03a4", + "\u03a4", + "\u03a0", + "\u03a0", + "\u03a3", + } + }, { "AmPmMarkers", new String[] { "\u03c0\u03bc", // am marker
--- a/src/share/classes/sun/text/resources/es/FormatData_es.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/es/FormatData_es.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "s\u00e1b" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "X", + "J", + "V", + "S", + } + }, { "NumberPatterns", new String[] { "#,##0.###;-#,##0.###", // decimal pattern
--- a/src/share/classes/sun/text/resources/et/FormatData_et.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/et/FormatData_et.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "L" // abb Saturday } }, + { "DayNarrows", + new String[] { + "P", + "E", + "T", + "K", + "N", + "R", + "L", + } + }, { "Eras", new String[] { // era strings "e.m.a.",
--- a/src/share/classes/sun/text/resources/fi/FormatData_fi.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/fi/FormatData_fi.java Mon Dec 17 08:30:06 2012 -0500 @@ -116,6 +116,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "T", + "H", + "M", + "H", + "T", + "K", + "H", + "E", + "S", + "L", + "M", + "J", + "", + } + }, { "DayNames", new String[] { "sunnuntai", // Sunday @@ -138,6 +155,28 @@ "la" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "K", + "T", + "P", + "L", + } + }, + { "standalone.DayNarrows", + new String[] { + "S", + "M", + "T", + "K", + "T", + "P", + "L", + } + }, { "NumberElements", new String[] { ",", // decimal separator @@ -181,6 +220,12 @@ "ip." // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "ap.", + "ip.", + } + }, }; } }
--- a/src/share/classes/sun/text/resources/fr/FormatData_fr.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/fr/FormatData_fr.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "sam." // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "J", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "BC",
--- a/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java Mon Dec 17 08:30:06 2012 -0500 @@ -99,6 +99,17 @@ "\u0936\u0928\u093f" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0930", + "\u0938\u094b", + "\u092e\u0902", + "\u092c\u0941", + "\u0917\u0941", + "\u0936\u0941", + "\u0936", + } + }, { "AmPmMarkers", new String[] { "\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928", // am marker
--- a/src/share/classes/sun/text/resources/hr/FormatData_hr.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/hr/FormatData_hr.java Mon Dec 17 08:30:06 2012 -0500 @@ -116,6 +116,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "1.", + "2.", + "3.", + "4.", + "5.", + "6.", + "7.", + "8.", + "9.", + "10.", + "11.", + "12.", + "", + } + }, { "DayNames", new String[] { "nedjelja", // Sunday @@ -138,6 +155,28 @@ "sub" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "U", + "S", + "\u010c", + "P", + "S", + } + }, + { "standalone.DayNarrows", + new String[] { + "n", + "p", + "u", + "s", + "\u010d", + "p", + "s", + } + }, { "NumberElements", new String[] { ",", // decimal separator
--- a/src/share/classes/sun/text/resources/hu/FormatData_hu.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/hu/FormatData_hu.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "Szo" // abb Saturday } }, + { "DayNarrows", + new String[] { + "V", + "H", + "K", + "Sz", + "Cs", + "P", + "Sz", + } + }, { "AmPmMarkers", new String[] { "DE", // am marker
--- a/src/share/classes/sun/text/resources/is/FormatData_is.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/is/FormatData_is.java Mon Dec 17 08:30:06 2012 -0500 @@ -82,6 +82,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "j", + "f", + "m", + "a", + "m", + "j", + "j", + "\u00e1", + "s", + "o", + "n", + "d", + "", + } + }, { "DayNames", new String[] { "sunnudagur", // Sunday @@ -104,6 +121,28 @@ "lau." // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "\u00de", + "M", + "F", + "F", + "L", + } + }, + { "standalone.DayNarrows", + new String[] { + "s", + "m", + "\u00fe", + "m", + "f", + "f", + "l", + } + }, { "NumberElements", new String[] { ",", // decimal separator
--- a/src/share/classes/sun/text/resources/it/FormatData_it.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/it/FormatData_it.java Mon Dec 17 08:30:06 2012 -0500 @@ -121,6 +121,17 @@ "sab" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "G", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "BC",
--- a/src/share/classes/sun/text/resources/iw/FormatData_iw.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/iw/FormatData_iw.java Mon Dec 17 08:30:06 2012 -0500 @@ -121,6 +121,28 @@ "\u05e9" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u05d0", + "\u05d1", + "\u05d2", + "\u05d3", + "\u05d4", + "\u05d5", + "\u05e9", + } + }, + { "standalone.DayNarrows", + new String[] { + "\u05d0", + "\u05d1", + "\u05d2", + "\u05d3", + "\u05d4", + "\u05d5", + "\u05e9", + } + }, { "Eras", new String[] { // era strings "\u05dc\u05e1\u05d4\"\u05e0",
--- a/src/share/classes/sun/text/resources/ja/FormatData_ja.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/ja/FormatData_ja.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "\u571f" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u65e5", + "\u6708", + "\u706b", + "\u6c34", + "\u6728", + "\u91d1", + "\u571f", + } + }, { "AmPmMarkers", new String[] { "\u5348\u524d", // am marker
--- a/src/share/classes/sun/text/resources/ko/FormatData_ko.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/ko/FormatData_ko.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "\ud1a0" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\uc77c", + "\uc6d4", + "\ud654", + "\uc218", + "\ubaa9", + "\uae08", + "\ud1a0", + } + }, { "AmPmMarkers", new String[] { "\uc624\uc804", // am marker
--- a/src/share/classes/sun/text/resources/lt/FormatData_lt.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/lt/FormatData_lt.java Mon Dec 17 08:30:06 2012 -0500 @@ -99,6 +99,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "S", + "V", + "K", + "B", + "G", + "B", + "L", + "R", + "R", + "S", + "L", + "G", + "", + } + }, { "DayNames", new String[] { "Sekmadienis", // Sunday @@ -121,6 +138,28 @@ "\u0160t" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "P", + "A", + "T", + "K", + "P", + "\u0160", + } + }, + { "standalone.DayNarrows", + new String[] { + "S", + "P", + "A", + "T", + "K", + "P", + "\u0160", + } + }, { "Eras", new String[] { // era strings "pr.Kr.",
--- a/src/share/classes/sun/text/resources/lv/FormatData_lv.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/lv/FormatData_lv.java Mon Dec 17 08:30:06 2012 -0500 @@ -121,6 +121,17 @@ "S" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "P", + "O", + "T", + "C", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "pm\u0113",
--- a/src/share/classes/sun/text/resources/mk/FormatData_mk.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/mk/FormatData_mk.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "\u0441\u0430\u0431." // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0432", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u043f\u0440.\u043d.\u0435.",
--- a/src/share/classes/sun/text/resources/ms/FormatData_ms.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/ms/FormatData_ms.java Mon Dec 17 08:30:06 2012 -0500 @@ -81,6 +81,23 @@ "", } }, + { "standalone.MonthNarrows", + new String[] { + "J", + "F", + "M", + "A", + "M", + "J", + "J", + "O", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "Ahad", @@ -103,6 +120,28 @@ "Sab", } }, + { "DayNarrows", + new String[] { + "A", + "I", + "S", + "R", + "K", + "J", + "S", + } + }, + { "standalone.DayNarrows", + new String[] { + "A", + "I", + "S", + "R", + "K", + "J", + "S", + } + }, { "Eras", new String[] { "BCE",
--- a/src/share/classes/sun/text/resources/mt/FormatData_mt.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/mt/FormatData_mt.java Mon Dec 17 08:30:06 2012 -0500 @@ -103,6 +103,17 @@ "Sib", } }, + { "DayNarrows", + new String[] { + "\u0126", + "T", + "T", + "E", + "\u0126", + "\u0120", + "S", + } + }, { "AmPmMarkers", new String[] { "QN",
--- a/src/share/classes/sun/text/resources/nl/FormatData_nl.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/nl/FormatData_nl.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "za" // abb Saturday } }, + { "DayNarrows", + new String[] { + "Z", + "M", + "D", + "W", + "D", + "V", + "Z", + } + }, { "Eras", new String[] { // era strings for GregorianCalendar "v. Chr.",
--- a/src/share/classes/sun/text/resources/pl/FormatData_pl.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/pl/FormatData_pl.java Mon Dec 17 08:30:06 2012 -0500 @@ -121,6 +121,17 @@ "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "W", + "\u015a", + "C", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "p.n.e.",
--- a/src/share/classes/sun/text/resources/pt/FormatData_pt.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/pt/FormatData_pt.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "S\u00e1b" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "S", + "T", + "Q", + "Q", + "S", + "S", + } + }, { "NumberElements", new String[] { ",", // decimal al separator
--- a/src/share/classes/sun/text/resources/ro/FormatData_ro.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/ro/FormatData_ro.java Mon Dec 17 08:30:06 2012 -0500 @@ -82,6 +82,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "I", + "F", + "M", + "A", + "M", + "I", + "I", + "A", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "duminic\u0103", // Sunday @@ -104,6 +121,29 @@ "S" // abb Saturday } }, + // commented out DayNarrows because most names are contributed. +// { "DayNarrows", +// new String[] { +// "D", +// "", +// "", +// "", +// "", +// "", +// "", +// } +// }, + { "standalone.DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "J", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "d.C.",
--- a/src/share/classes/sun/text/resources/ru/FormatData_ru.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/ru/FormatData_ru.java Mon Dec 17 08:30:06 2012 -0500 @@ -138,6 +138,28 @@ "\u0421\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0412", + "\u041f\u043d", + "\u0412\u0442", + "\u0421", + "\u0427", + "\u041f", + "\u0421", // contributed item in CLDR + } + }, + { "standalone.DayNarrows", + new String[] { + "\u0412", + "\u041f", + "\u0412", + "\u0421", + "\u0427", + "\u041f", + "\u0421", + } + }, { "Eras", new String[] { // era strings "\u0434\u043e \u043d.\u044d.",
--- a/src/share/classes/sun/text/resources/sk/FormatData_sk.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/sk/FormatData_sk.java Mon Dec 17 08:30:06 2012 -0500 @@ -138,6 +138,17 @@ "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "U", + "S", + "\u0160", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "pred n.l.",
--- a/src/share/classes/sun/text/resources/sl/FormatData_sl.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/sl/FormatData_sl.java Mon Dec 17 08:30:06 2012 -0500 @@ -121,6 +121,17 @@ "Sob" // abb Saturday } }, + { "DayNarrows", + new String[] { + "n", + "p", + "t", + "s", + "\u010d", + "p", + "s", + } + }, { "Eras", new String[] { // era strings "pr.n.\u0161.",
--- a/src/share/classes/sun/text/resources/sq/FormatData_sq.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/sq/FormatData_sq.java Mon Dec 17 08:30:06 2012 -0500 @@ -104,6 +104,17 @@ "Sht" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "H", + "M", + "M", + "E", + "P", + "S", + } + }, { "AmPmMarkers", new String[] { "PD", // am marker
--- a/src/share/classes/sun/text/resources/sr/FormatData_sr.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/sr/FormatData_sr.java Mon Dec 17 08:30:06 2012 -0500 @@ -103,12 +103,35 @@ "\u0441\u0443\u0431", } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0443", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { "\u043f. \u043d. \u0435.", "\u043d. \u0435", } }, + { "short.Eras", + new String[] { + "\u043f. \u043d. \u0435.", + "\u043d. \u0435.", + } + }, + { "narrow.Eras", + new String[] { + "\u043f.\u043d.\u0435.", + "\u043d.\u0435.", + } + }, { "NumberPatterns", new String[] { "#,##0.###",
--- a/src/share/classes/sun/text/resources/sv/FormatData_sv.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/sv/FormatData_sv.java Mon Dec 17 08:30:06 2012 -0500 @@ -82,6 +82,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "J", + "F", + "M", + "A", + "M", + "J", + "J", + "A", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "s\u00f6ndag", // Sunday @@ -104,12 +121,46 @@ "l\u00f6" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "O", + "T", + "F", + "L", + } + }, + { "standalone.DayNarrows", + new String[] { + "S", + "M", + "T", + "O", + "T", + "F", + "L", + } + }, + { "narrow.Eras", + new String[] { + "f.Kr.", + "e.Kr.", + } + }, { "AmPmMarkers", new String[] { "fm", // am marker "em" // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "f", + "e", + } + }, { "NumberElements", new String[] { ",", // decimal separator
--- a/src/share/classes/sun/text/resources/th/FormatData_th.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/th/FormatData_th.java Mon Dec 17 08:30:06 2012 -0500 @@ -99,6 +99,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "\u0e21.\u0e04.", + "\u0e01.\u0e1e.", + "\u0e21\u0e35.\u0e04.", + "\u0e40\u0e21.\u0e22.", + "\u0e1e.\u0e04.", + "\u0e21\u0e34.\u0e22.", + "\u0e01.\u0e04.", + "\u0e2a.\u0e04.", + "\u0e01.\u0e22.", + "\u0e15.\u0e04.", + "\u0e1e.\u0e22.", + "\u0e18.\u0e04.", + "", + } + }, { "DayNames", new String[] { "\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c", // Sunday @@ -121,6 +138,17 @@ "\u0e2a." // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0e2d", + "\u0e08", + "\u0e2d", + "\u0e1e", + "\u0e1e", + "\u0e28", + "\u0e2a", + } + }, { "AmPmMarkers", new String[] { "\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07", // am marker @@ -145,6 +173,12 @@ "\u0e04.\u0e28." } }, + { "narrow.Eras", + new String[] { + "\u0e01\u0e48\u0e2d\u0e19 \u0e04.\u0e28.", + "\u0e04.\u0e28.", + } + }, { "buddhist.TimePatterns", timePatterns },
--- a/src/share/classes/sun/text/resources/tr/FormatData_tr.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/tr/FormatData_tr.java Mon Dec 17 08:30:06 2012 -0500 @@ -82,6 +82,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "O", + "\u015e", + "M", + "N", + "M", + "H", + "T", + "A", + "E", + "E", + "K", + "A", + "", + } + }, { "DayNames", new String[] { "Pazar", // Sunday @@ -104,6 +121,17 @@ "Cmt" // abb Saturday } }, + { "DayNarrows", + new String[] { + "P", + "P", + "S", + "\u00c7", + "P", + "C", + "C", + } + }, { "NumberPatterns", new String[] { "#,##0.###;-#,##0.###", // decimal pattern
--- a/src/share/classes/sun/text/resources/uk/FormatData_uk.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/uk/FormatData_uk.java Mon Dec 17 08:30:06 2012 -0500 @@ -138,6 +138,17 @@ "\u0441\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u041d", + "\u041f", + "\u0412", + "\u0421", + "\u0427", + "\u041f", + "\u0421", + } + }, { "Eras", new String[] { // era strings "\u0434\u043e \u043d.\u0435.",
--- a/src/share/classes/sun/text/resources/vi/FormatData_vi.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/vi/FormatData_vi.java Mon Dec 17 08:30:06 2012 -0500 @@ -106,6 +106,17 @@ "Th 7" // abb Saturday } }, + { "DayNarrows", + new String[] { + "CN", + "T2", + "T3", + "T4", + "T5", + "T6", + "T7", + } + }, { "AmPmMarkers", new String[] { "SA", // am marker
--- a/src/share/classes/sun/text/resources/zh/FormatData_zh.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/text/resources/zh/FormatData_zh.java Mon Dec 17 08:30:06 2012 -0500 @@ -82,6 +82,23 @@ "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "1\u6708", + "2\u6708", + "3\u6708", + "4\u6708", + "5\u6708", + "6\u6708", + "7\u6708", + "8\u6708", + "9\u6708", + "10\u6708", + "11\u6708", + "12\u6708", + "", + } + }, { "DayNames", new String[] { "\u661f\u671f\u65e5", // Sunday @@ -104,6 +121,17 @@ "\u661f\u671f\u516d" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u65e5", + "\u4e00", + "\u4e8c", + "\u4e09", + "\u56db", + "\u4e94", + "\u516d", + } + }, { "AmPmMarkers", new String[] { "\u4e0a\u5348", // am marker
--- a/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java Mon Dec 17 08:30:06 2012 -0500 @@ -89,11 +89,6 @@ } @Override - public TimeZoneNameProvider getTimeZoneNameProvider() { - return null; - } - - @Override public Locale[] getAvailableLocales() { Set<String> all = createLanguageTagSet("All"); Locale[] locs = new Locale[all.size()];
--- a/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java Mon Dec 17 08:30:06 2012 -0500 @@ -25,7 +25,6 @@ package sun.util.locale.provider; -import java.util.Calendar; import static java.util.Calendar.*; import java.util.Locale; import java.util.Map;
--- a/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java Mon Dec 17 08:28:27 2012 -0500 +++ b/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java Mon Dec 17 08:30:06 2012 -0500 @@ -52,7 +52,7 @@ @Override public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) { String name = null; - String key = getKey(calendarType, field, style); + String key = getResourceKey(calendarType, field, style); if (key != null) { ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); if (rb.containsKey(key)) { @@ -64,9 +64,10 @@ name = strings[value]; // If name is empty in standalone, try its `format' style. if (name.length() == 0 - && (style == SHORT_STANDALONE || style == LONG_STANDALONE)) { + && (style == SHORT_STANDALONE || style == LONG_STANDALONE + || style == NARROW_STANDALONE)) { name = getDisplayName(calendarType, field, value, - style == SHORT_STANDALONE ? SHORT_FORMAT : LONG_FORMAT, + getBaseStyle(style), locale); } } @@ -75,15 +76,17 @@ return name; } + private static int[] REST_OF_STYLES = { + SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE, + NARROW_FORMAT, NARROW_STANDALONE + }; @Override public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) { Map<String, Integer> names; if (style == ALL_STYLES) { names = getDisplayNamesImpl(calendarType, field, SHORT_FORMAT, locale); - if (field != AM_PM) { - for (int st : new int[] { SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE }) { - names.putAll(getDisplayNamesImpl(calendarType, field, st, locale)); - } + for (int st : REST_OF_STYLES) { + names.putAll(getDisplayNamesImpl(calendarType, field, st, locale)); } } else { // specific style @@ -94,26 +97,28 @@ private Map<String, Integer> getDisplayNamesImpl(String calendarType, int field, int style, Locale locale) { - String key = getKey(calendarType, field, style); + String key = getResourceKey(calendarType, field, style); Map<String, Integer> map = new TreeMap<>(LengthBasedComparator.INSTANCE); if (key != null) { ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); if (rb.containsKey(key)) { String[] strings = rb.getStringArray(key); - if (field == YEAR) { - if (strings.length > 0) { - map.put(strings[0], 1); - } - } else { - int base = (field == DAY_OF_WEEK) ? 1 : 0; - for (int i = 0; i < strings.length; i++) { - String name = strings[i]; - // Ignore any empty string (some standalone month names - // are not defined) - if (name.length() == 0) { - continue; + if (!hasDuplicates(strings)) { + if (field == YEAR) { + if (strings.length > 0) { + map.put(strings[0], 1); } - map.put(name, base + i); + } else { + int base = (field == DAY_OF_WEEK) ? 1 : 0; + for (int i = 0; i < strings.length; i++) { + String name = strings[i]; + // Ignore any empty string (some standalone month names + // are not defined) + if (name.length() == 0) { + continue; + } + map.put(name, base + i); + } } } } @@ -121,6 +126,10 @@ return map; } + private int getBaseStyle(int style) { + return style & ~(SHORT_STANDALONE - SHORT_FORMAT); + } + /** * Comparator implementation for TreeMap which iterates keys from longest * to shortest. @@ -180,55 +189,92 @@ return langtags; } - private int getIntData(String key, Locale locale) { - ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getCalendarData(locale); - if (rb.containsKey(key)) { - String firstday = rb.getString(key); - return Integer.parseInt(firstday); + private boolean hasDuplicates(String[] strings) { + int len = strings.length; + for (int i = 0; i < len - 1; i++) { + String a = strings[i]; + if (a != null) { + for (int j = i + 1; j < len; j++) { + if (a.equals(strings[j])) { + return true; + } + } + } } - // Note that the base bundle of CLDR doesn't have the Calendar week parameters. - return 0; + return false; } - private String getKey(String type, int field, int style) { - boolean standalone = (style & 0x8000) != 0; - style &= ~0x8000; + private String getResourceKey(String type, int field, int style) { + int baseStyle = getBaseStyle(style); + boolean isStandalone = (style != baseStyle); if ("gregory".equals(type)) { type = null; } - + boolean isNarrow = (baseStyle == NARROW_FORMAT); StringBuilder key = new StringBuilder(); switch (field) { case ERA: if (type != null) { key.append(type).append('.'); } - if (style == SHORT) { - key.append("short."); + if (isNarrow) { + key.append("narrow.");