Merge
This commit is contained in:
commit
81d2d33d87
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,8 @@ LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/*/share/classes \
|
||||
-name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \
|
||||
-name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \
|
||||
-name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \
|
||||
-name "CalendarData_*.java" -o -name "CalendarData_*.properties")
|
||||
-name "CalendarData_*.java" -o -name "CalendarData_*.properties" -o \
|
||||
-name "BreakIteratorInfo_*.java" -o -name "BreakIteratorRules_*.java")
|
||||
|
||||
# Then translate the locale files into for example: FormatData_sv
|
||||
LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
|
||||
@ -86,6 +87,12 @@ $(eval $(call CaptureLocale,FormatData))
|
||||
#sun.text.resources.CollationData
|
||||
$(eval $(call CaptureLocale,CollationData))
|
||||
|
||||
#sun.text.resources.BreakIteratorInfo
|
||||
$(eval $(call CaptureLocale,BreakIteratorInfo))
|
||||
|
||||
#sun.text.resources.BreakIteratorRules
|
||||
$(eval $(call CaptureLocale,BreakIteratorRules))
|
||||
|
||||
#sun.util.resources.TimeZoneNames
|
||||
$(eval $(call CaptureLocale,TimeZoneNames))
|
||||
|
||||
|
@ -973,7 +973,6 @@ ifndef BUILD_HEADLESS_ONLY
|
||||
#
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LIBSPLASHSCREEN_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
|
||||
LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
|
||||
LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.spi.BreakIteratorProvider;
|
||||
import java.text.spi.CollatorProvider;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
@ -102,6 +103,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
||||
@Override
|
||||
protected Set<String> createLanguageTagSet(String category) {
|
||||
ResourceBundle rb = ResourceBundle.getBundle("sun.util.cldr.CLDRLocaleDataMetaInfo", Locale.ROOT);
|
||||
if (rb.containsKey(category)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
String supportedLocaleString = rb.getString(category);
|
||||
Set<String> tagset = new HashSet<>();
|
||||
StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.text.spi.DateFormatProvider;
|
||||
import java.text.spi.DateFormatSymbolsProvider;
|
||||
import java.text.spi.DecimalFormatSymbolsProvider;
|
||||
import java.text.spi.NumberFormatProvider;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
@ -356,6 +357,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
|
||||
|
||||
protected Set<String> createLanguageTagSet(String category) {
|
||||
String supportedLocaleString = LocaleDataMetaInfo.getSupportedLocaleString(category);
|
||||
if (supportedLocaleString == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
Set<String> tagset = new HashSet<>();
|
||||
StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,6 +57,12 @@ public class LocaleDataMetaInfo {
|
||||
resourceNameToLocales.put("CollationData",
|
||||
" #CollationData_ENLocales# | #CollationData_NonENLocales# ");
|
||||
|
||||
resourceNameToLocales.put("BreakIteratorInfo",
|
||||
" #BreakIteratorInfo_ENLocales# | #BreakIteratorInfo_NonENLocales# ");
|
||||
|
||||
resourceNameToLocales.put("BreakIteratorRules",
|
||||
" #BreakIteratorRules_ENLocales# | #BreakIteratorRules_NonENLocales# ");
|
||||
|
||||
resourceNameToLocales.put("TimeZoneNames",
|
||||
" #TimeZoneNames_ENLocales# | #TimeZoneNames_NonENLocales# ");
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -295,7 +295,7 @@ public abstract class LocaleProviderAdapter {
|
||||
* A utility method for implementing the default LocaleServiceProvider.isSupportedLocale
|
||||
* for the JRE, CLDR, and FALLBACK adapters.
|
||||
*/
|
||||
static boolean isSupportedLocale(Locale locale, LocaleProviderAdapter.Type type, Set<String> langtags) {
|
||||
public static boolean isSupportedLocale(Locale locale, LocaleProviderAdapter.Type type, Set<String> langtags) {
|
||||
assert type == Type.JRE || type == Type.CLDR || type == Type.FALLBACK;
|
||||
if (Locale.ROOT.equals(locale)) {
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,8 +48,11 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import sun.util.locale.provider.JRELocaleProviderAdapter;
|
||||
import sun.util.locale.provider.LocaleDataMetaInfo;
|
||||
import sun.util.locale.provider.LocaleProviderAdapter;
|
||||
import static sun.util.locale.provider.LocaleProviderAdapter.Type.CLDR;
|
||||
import static sun.util.locale.provider.LocaleProviderAdapter.Type.JRE;
|
||||
|
||||
/**
|
||||
@ -204,35 +207,23 @@ public class LocaleData {
|
||||
@Override
|
||||
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
|
||||
List<Locale> candidates = super.getCandidateLocales(baseName, locale);
|
||||
/* Get the locale string list from LocaleDataMetaInfo class. */
|
||||
String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName);
|
||||
|
||||
if (localeString != null && localeString.length() != 0) {
|
||||
for (Iterator<Locale> l = candidates.iterator(); l.hasNext();) {
|
||||
Locale loc = l.next();
|
||||
String lstr;
|
||||
if (loc.getScript().length() > 0) {
|
||||
lstr = loc.toLanguageTag().replace('-', '_');
|
||||
} else {
|
||||
lstr = loc.toString();
|
||||
int idx = lstr.indexOf("_#");
|
||||
if (idx >= 0) {
|
||||
lstr = lstr.substring(0, idx);
|
||||
}
|
||||
}
|
||||
/* Every locale string in the locale string list returned from
|
||||
the above getSupportedLocaleString is enclosed
|
||||
within two white spaces so that we could check some locale
|
||||
such as "en".
|
||||
*/
|
||||
if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) {
|
||||
l.remove();
|
||||
// Weed out Locales which are known to have no resource bundles
|
||||
int lastDot = baseName.lastIndexOf('.');
|
||||
String category = (lastDot >= 0) ? baseName.substring(lastDot + 1) : baseName;
|
||||
LocaleProviderAdapter.Type type = baseName.contains(DOTCLDR) ? CLDR : JRE;
|
||||
LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type);
|
||||
Set<String> langtags = ((JRELocaleProviderAdapter)adapter).getLanguageTagSet(category);
|
||||
if (!langtags.isEmpty()) {
|
||||
for (Iterator<Locale> itr = candidates.iterator(); itr.hasNext();) {
|
||||
if (!LocaleProviderAdapter.isSupportedLocale(itr.next(), type, langtags)) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force fallback to Locale.ENGLISH for CLDR time zone names support
|
||||
if (locale.getLanguage() != "en"
|
||||
&& baseName.contains(CLDR) && baseName.endsWith("TimeZoneNames")) {
|
||||
&& type == CLDR && category.equals("TimeZoneNames")) {
|
||||
candidates.add(candidates.size() - 1, Locale.ENGLISH);
|
||||
}
|
||||
return candidates;
|
||||
@ -254,7 +245,7 @@ public class LocaleData {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String CLDR = ".cldr";
|
||||
private static final String DOTCLDR = ".cldr";
|
||||
|
||||
/**
|
||||
* Changes baseName to its per-language package name and
|
||||
@ -275,8 +266,8 @@ public class LocaleData {
|
||||
assert JRE.getUtilResourcesPackage().length()
|
||||
== JRE.getTextResourcesPackage().length();
|
||||
int index = JRE.getUtilResourcesPackage().length();
|
||||
if (baseName.indexOf(CLDR, index) > 0) {
|
||||
index += CLDR.length();
|
||||
if (baseName.indexOf(DOTCLDR, index) > 0) {
|
||||
index += DOTCLDR.length();
|
||||
}
|
||||
newBaseName = baseName.substring(0, index + 1) + lang
|
||||
+ baseName.substring(index);
|
||||
|
@ -43,7 +43,6 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* CredentialsCache stores credentials(tickets, session keys, etc) in a
|
||||
@ -388,52 +387,36 @@ public class FileCredentialsCache extends CredentialsCache
|
||||
|
||||
/*
|
||||
* For Unix platforms we use the default cache name to be
|
||||
* /tmp/krbcc_uid ; for all other platforms we use
|
||||
* {user_home}/krb5_cc{user_name}
|
||||
* Please note that for Windows 2K we will use LSA to get
|
||||
* /tmp/krb5cc_uid ; for all other platforms we use
|
||||
* {user_home}/krb5cc_{user_name}
|
||||
* Please note that for Windows we will use LSA to get
|
||||
* the TGT from the the default cache even before we come here;
|
||||
* however when we create cache we will create a cache under
|
||||
* {user_home}/krb5_cc{user_name} for non-Unix platforms including
|
||||
* Windows 2K.
|
||||
* {user_home}/krb5cc_{user_name} for non-Unix platforms including
|
||||
* Windows.
|
||||
*/
|
||||
|
||||
if (osname != null) {
|
||||
String cmd = null;
|
||||
String uidStr = null;
|
||||
long uid = 0;
|
||||
|
||||
if (osname.startsWith("SunOS") ||
|
||||
(osname.startsWith("Linux"))) {
|
||||
try {
|
||||
Class<?> c = Class.forName
|
||||
("com.sun.security.auth.module.UnixSystem");
|
||||
Constructor<?> constructor = c.getConstructor();
|
||||
Object obj = constructor.newInstance();
|
||||
Method method = c.getMethod("getUid");
|
||||
uid = ((Long)method.invoke(obj)).longValue();
|
||||
name = File.separator + "tmp" +
|
||||
if (osname != null && !osname.startsWith("Windows")) {
|
||||
long uid = sun.misc.VM.getuid();
|
||||
if (uid != -1) {
|
||||
name = File.separator + "tmp" +
|
||||
File.separator + stdCacheNameComponent + "_" + uid;
|
||||
if (DEBUG) {
|
||||
System.out.println(">>>KinitOptions cache name is " +
|
||||
name);
|
||||
}
|
||||
return name;
|
||||
} catch (Exception e) {
|
||||
if (DEBUG) {
|
||||
System.out.println("Exception in obtaining uid " +
|
||||
"for Unix platforms " +
|
||||
"Using user's home directory");
|
||||
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (DEBUG) {
|
||||
System.out.println(">>>KinitOptions cache name is " +
|
||||
name);
|
||||
}
|
||||
return name;
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
System.out.println("Error in obtaining uid " +
|
||||
"for Unix platforms " +
|
||||
"Using user's home directory");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// we did not get the uid;
|
||||
|
||||
|
||||
String user_name =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("user.name"));
|
||||
|
@ -8,7 +8,7 @@ keys=2d dnd i18n
|
||||
othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces
|
||||
|
||||
# Tests that cannot run concurrently
|
||||
exclusiveAccess.dirs=java/rmi/Naming java/util/Currency java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
|
||||
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
|
||||
|
||||
# Group definitions
|
||||
groups=TEST.groups [closed/TEST.groups]
|
||||
|
@ -32,8 +32,8 @@ public class NMTHelper
|
||||
executeDcmd("vmNativeMemory", "baseline");
|
||||
}
|
||||
|
||||
// Total: reserved=3484685KB +293KB, committed=266629KB +293KB
|
||||
private static Pattern totalLine = Pattern.compile("^Total: reserved=\\d+KB .*KB, committed=\\d+KB (.*)KB$");
|
||||
// Total: reserved=3484685KB +293KB, committed=266629KB +293KB
|
||||
private static Pattern totalLine = Pattern.compile("^Total: reserved=\\d+KB .*KB, committed=\\d+KB (.*)KB$");
|
||||
|
||||
public static long committedDiff() throws Exception {
|
||||
String res = (String) executeDcmd("vmNativeMemory", "detail.diff");
|
||||
|
@ -50,6 +50,7 @@ public class LowMemoryTest {
|
||||
private static boolean testFailed = false;
|
||||
private static final int NUM_TRIGGERS = 5;
|
||||
private static final int NUM_CHUNKS = 2;
|
||||
private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
|
||||
private static long chunkSize;
|
||||
|
||||
/**
|
||||
@ -59,11 +60,14 @@ public class LowMemoryTest {
|
||||
*/
|
||||
public static void main(String a[]) throws Throwable {
|
||||
final String main = "LowMemoryTest$TestMain";
|
||||
RunUtil.runTestKeepGcOpts(main);
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
|
||||
RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
|
||||
// Use a low young gen size to ensure that the
|
||||
// allocated objects are put in the old gen.
|
||||
final String nmFlag = "-Xmn" + YOUNG_GEN_SIZE;
|
||||
RunUtil.runTestKeepGcOpts(main, nmFlag);
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseSerialGC");
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseParallelGC");
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseG1GC");
|
||||
RunUtil.runTestClearGcOpts(main, nmFlag, "-XX:+UseConcMarkSweepGC");
|
||||
}
|
||||
|
||||
private static volatile boolean listenerInvoked = false;
|
||||
@ -156,6 +160,16 @@ public class LowMemoryTest {
|
||||
chunkSize = (mu.getMax() - mu.getUsed()) / 20;
|
||||
newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
|
||||
|
||||
// Sanity check. Make sure the chunkSize is large than the YOUNG_GEN_SIZE
|
||||
// If the chunkSize are lower than the YOUNG_GEN_SIZE, we will get intermittent
|
||||
// failures when objects end up in the young gen instead of the old gen.
|
||||
// Tweak the test if this fails.
|
||||
if (chunkSize < YOUNG_GEN_SIZE) {
|
||||
throw new RuntimeException("TEST FAILED: " +
|
||||
" chunkSize: " + chunkSize + " is less than YOUNG_GEN_SIZE: " + YOUNG_GEN_SIZE +
|
||||
" max: " + mu.getMax() + " used: " + mu.getUsed() + " newThreshold: " + newThreshold);
|
||||
}
|
||||
|
||||
System.out.println("Setting threshold for " + mpool.getName() +
|
||||
" from " + mpool.getUsageThreshold() + " to " + newThreshold +
|
||||
". Current used = " + mu.getUsed());
|
||||
|
@ -31,7 +31,7 @@
|
||||
* @author Mandy Chung
|
||||
*
|
||||
* @build MemoryManagement MemoryUtil
|
||||
* @run main/othervm/timeout=600 MemoryManagement
|
||||
* @run main/othervm/timeout=600 -Xmn8m MemoryManagement
|
||||
*/
|
||||
|
||||
import java.lang.management.*;
|
||||
@ -49,6 +49,8 @@ public class MemoryManagement {
|
||||
private static volatile boolean trace = false;
|
||||
private static volatile boolean testFailed = false;
|
||||
private static final int NUM_CHUNKS = 2;
|
||||
// Must match -Xmn set on the @run line
|
||||
private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
|
||||
private static volatile long chunkSize;
|
||||
private static volatile int listenerInvoked = 0;
|
||||
|
||||
@ -112,6 +114,16 @@ public class MemoryManagement {
|
||||
}
|
||||
newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
|
||||
|
||||
// Sanity check. Make sure the chunkSize is large than the YOUNG_GEN_SIZE
|
||||
// If the chunkSize are lower than the YOUNG_GEN_SIZE, we will get intermittent
|
||||
// failures when objects end up in the young gen instead of the old gen.
|
||||
// Tweak the test if this fails.
|
||||
if (chunkSize < YOUNG_GEN_SIZE) {
|
||||
throw new RuntimeException("TEST FAILED: " +
|
||||
" chunkSize: " + chunkSize + " is less than YOUNG_GEN_SIZE: " + YOUNG_GEN_SIZE +
|
||||
" max: " + mu.getMax() + " used: " + mu.getUsed() + " newThreshold: " + newThreshold);
|
||||
}
|
||||
|
||||
System.out.println("Setting threshold for " + mpool.getName() +
|
||||
" from " + mpool.getUsageThreshold() + " to " + newThreshold +
|
||||
". Current used = " + mu.getUsed());
|
||||
|
@ -97,25 +97,16 @@ run PropertiesTest -c dump1 dump2 ${PROPS}
|
||||
# Dump built-in currency data + overrides in properties file copied into
|
||||
# JRE image.
|
||||
|
||||
# Copy the test properties file. If testjava is not a typical jdk-image
|
||||
# or testjava is not writable, make a private copy of it.
|
||||
COPIED=0
|
||||
if [ -w ${TESTJAVA}${FS}jre${FS}lib ]
|
||||
then
|
||||
WRITABLEJDK=$TESTJAVA
|
||||
# Make a private copy of the jdk so we can write to the properties file location
|
||||
# without disturbing other users, including concurrently executing tests.
|
||||
WRITABLEJDK=.${FS}testjava
|
||||
cp -Hr $TESTJAVA $WRITABLEJDK
|
||||
if [ -d ${TESTJAVA}${FS}jre ]; then
|
||||
PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
|
||||
else
|
||||
WRITABLEJDK=.${FS}testjava
|
||||
if [ -d ${TESTJAVA}${FS}jre ]
|
||||
then
|
||||
PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
|
||||
else
|
||||
PROPLOCATION=${WRITABLEJDK}${FS}lib
|
||||
fi
|
||||
cp -r $TESTJAVA $WRITABLEJDK
|
||||
chmod -R +w $WRITABLEJDK
|
||||
COPIED=1
|
||||
PROPLOCATION=${WRITABLEJDK}${FS}lib
|
||||
fi
|
||||
chmod -R +w $WRITABLEJDK
|
||||
cp ${PROPS} $PROPLOCATION
|
||||
echo "Properties location: ${PROPLOCATION}"
|
||||
|
||||
@ -125,11 +116,7 @@ sh -xc "${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} Propert
|
||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||
|
||||
# Cleanup
|
||||
rm -f ${PROPLOCATION}${FS}currency.properties
|
||||
if [ $COPIED -eq 1 ]
|
||||
then
|
||||
rm -rf $WRITABLEJDK
|
||||
fi
|
||||
rm -rf $WRITABLEJDK
|
||||
|
||||
# compare the two dump files
|
||||
run PropertiesTest -c dump1 dump3 ${PROPS}
|
||||
|
@ -51,23 +51,23 @@ import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
public class CheckZombieLockTest {
|
||||
|
||||
private static final String WRITABLE_DIR = "writable-dir";
|
||||
private static final String WRITABLE_DIR = "writable-lockfile-dir";
|
||||
private static volatile boolean supportsLocking = true;
|
||||
|
||||
static enum TestCase {
|
||||
WRITABLE, // just verifies that we can create a file in our 'writable-dir'
|
||||
WRITABLE, // just verifies that we can create a file in our 'writable-lockfile-dir'
|
||||
CLOSE, // checks that closing a FileHandler removes its lock file
|
||||
CREATE_FIRST, // verifies that 'writable-dir' contains no lock, then creates a first FileHandler.
|
||||
CREATE_NEXT, // verifies that 'writable-dir' contains a single lock, then creates the next FileHandler
|
||||
CREATE_FIRST, // verifies that 'writable-lockfile-dir' contains no lock, then creates a first FileHandler.
|
||||
CREATE_NEXT, // verifies that 'writable-lockfile-dir' contains a single lock, then creates the next FileHandler
|
||||
REUSE, // verifies that zombie lock files can be reused
|
||||
CLEANUP // removes "writable-dir"
|
||||
CLEANUP // removes "writable-lockfile-dir"
|
||||
};
|
||||
|
||||
public static void main(String... args) throws IOException {
|
||||
// we'll base all file creation attempts on the system temp directory,
|
||||
// %t
|
||||
File writableDir = setup();
|
||||
System.out.println("Writable dir is: "+writableDir.getAbsolutePath());
|
||||
System.out.println("Writable dir is: " + writableDir.getAbsolutePath());
|
||||
// we now have one writable directory to work with:
|
||||
// writableDir
|
||||
if (args == null || args.length == 0) {
|
||||
@ -104,7 +104,7 @@ public class CheckZombieLockTest {
|
||||
case REUSE: testFileHandlerReuse(writableDir); break;
|
||||
// Removes the writableDir
|
||||
case CLEANUP: delete(writableDir); break;
|
||||
default: throw new RuntimeException("No such test case: "+arg);
|
||||
default: throw new RuntimeException("No such test case: " + arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class CheckZombieLockTest {
|
||||
// Test 1: make sure we can create/delete files in the writable dir.
|
||||
final File file = new File(writableDir, "test.txt");
|
||||
if (!createFile(file, false)) {
|
||||
throw new IOException("Can't create "+file+"\n\tUnable to run test");
|
||||
throw new IOException("Can't create " + file + "\n\tUnable to run test");
|
||||
} else {
|
||||
delete(file);
|
||||
}
|
||||
@ -159,22 +159,22 @@ public class CheckZombieLockTest {
|
||||
private static void testFileHandlerClose(File writableDir) throws IOException {
|
||||
File fakeLock = new File(writableDir, "log.log.lck");
|
||||
if (!createFile(fakeLock, false)) {
|
||||
throw new IOException("Can't create fake lock file: "+fakeLock);
|
||||
throw new IOException("Can't create fake lock file: " + fakeLock);
|
||||
}
|
||||
try {
|
||||
List<File> before = listLocks(writableDir, true);
|
||||
System.out.println("before: " +before.size() + " locks found");
|
||||
System.out.println("before: " + before.size() + " locks found");
|
||||
FileHandler handler = createFileHandler(writableDir);
|
||||
System.out.println("handler created: "+handler);
|
||||
System.out.println("handler created: " + handler);
|
||||
List<File> after = listLocks(writableDir, true);
|
||||
System.out.println("after creating handler: " + after.size() + " locks found");
|
||||
handler.close();
|
||||
System.out.println("handler closed: "+handler);
|
||||
System.out.println("handler closed: " + handler);
|
||||
List<File> afterClose = listLocks(writableDir, true);
|
||||
System.out.println("after closing handler: " + afterClose.size() + " locks found");
|
||||
afterClose.removeAll(before);
|
||||
if (!afterClose.isEmpty()) {
|
||||
throw new RuntimeException("Zombie lock file detected: "+ afterClose);
|
||||
throw new RuntimeException("Zombie lock file detected: " + afterClose);
|
||||
}
|
||||
} finally {
|
||||
if (fakeLock.canRead()) delete(fakeLock);
|
||||
@ -186,21 +186,22 @@ public class CheckZombieLockTest {
|
||||
|
||||
private static void testFileHandlerReuse(File writableDir) throws IOException {
|
||||
List<File> before = listLocks(writableDir, true);
|
||||
System.out.println("before: " +before.size() + " locks found");
|
||||
System.out.println("before: " + before.size() + " locks found");
|
||||
try {
|
||||
if (!before.isEmpty()) {
|
||||
throw new RuntimeException("Expected no lock file! Found: "+before);
|
||||
throw new RuntimeException("Expected no lock file! Found: " + before);
|
||||
}
|
||||
} finally {
|
||||
before.stream().forEach(CheckZombieLockTest::delete);
|
||||
}
|
||||
|
||||
FileHandler handler1 = createFileHandler(writableDir);
|
||||
System.out.println("handler created: "+handler1);
|
||||
System.out.println("handler created: " + handler1);
|
||||
List<File> after = listLocks(writableDir, true);
|
||||
System.out.println("after creating handler: " + after.size() + " locks found");
|
||||
if (after.size() != 1) {
|
||||
throw new RuntimeException("Unexpected number of lock files found for "+handler1+": "+after);
|
||||
throw new RuntimeException("Unexpected number of lock files found for "
|
||||
+ handler1 + ": " + after);
|
||||
}
|
||||
final File lock = after.get(0);
|
||||
after.clear();
|
||||
@ -208,33 +209,34 @@ public class CheckZombieLockTest {
|
||||
after = listLocks(writableDir, true);
|
||||
System.out.println("after closing handler: " + after.size() + " locks found");
|
||||
if (!after.isEmpty()) {
|
||||
throw new RuntimeException("Unexpected number of lock files found for "+handler1+": "+after);
|
||||
throw new RuntimeException("Unexpected number of lock files found for "
|
||||
+ handler1 + ": " + after);
|
||||
}
|
||||
if (!createFile(lock, false)) {
|
||||
throw new IOException("Can't create fake lock file: "+lock);
|
||||
throw new IOException("Can't create fake lock file: " + lock);
|
||||
}
|
||||
try {
|
||||
before = listLocks(writableDir, true);
|
||||
System.out.println("before: " +before.size() + " locks found");
|
||||
System.out.println("before: " + before.size() + " locks found");
|
||||
if (before.size() != 1) {
|
||||
throw new RuntimeException("Unexpected number of lock files found: "+before+" expected ["
|
||||
+lock+"].");
|
||||
throw new RuntimeException("Unexpected number of lock files found: "
|
||||
+ before + " expected [" + lock + "].");
|
||||
}
|
||||
FileHandler handler2 = createFileHandler(writableDir);
|
||||
System.out.println("handler created: "+handler2);
|
||||
System.out.println("handler created: " + handler2);
|
||||
after = listLocks(writableDir, true);
|
||||
System.out.println("after creating handler: " + after.size() + " locks found");
|
||||
after.removeAll(before);
|
||||
if (!after.isEmpty()) {
|
||||
throw new RuntimeException("Unexpected lock file found: "+after
|
||||
throw new RuntimeException("Unexpected lock file found: " + after
|
||||
+ "\n\t" + lock + " should have been reused");
|
||||
}
|
||||
handler2.close();
|
||||
System.out.println("handler closed: "+handler2);
|
||||
System.out.println("handler closed: " + handler2);
|
||||
List<File> afterClose = listLocks(writableDir, true);
|
||||
System.out.println("after closing handler: " + afterClose.size() + " locks found");
|
||||
if (!afterClose.isEmpty()) {
|
||||
throw new RuntimeException("Zombie lock file detected: "+ afterClose);
|
||||
throw new RuntimeException("Zombie lock file detected: " + afterClose);
|
||||
}
|
||||
|
||||
if (supportsLocking) {
|
||||
@ -243,18 +245,19 @@ public class CheckZombieLockTest {
|
||||
StandardOpenOption.WRITE);
|
||||
try {
|
||||
if (fc.tryLock() != null) {
|
||||
System.out.println("locked: "+lock);
|
||||
System.out.println("locked: " + lock);
|
||||
handler2 = createFileHandler(writableDir);
|
||||
System.out.println("handler created: "+handler2);
|
||||
System.out.println("handler created: " + handler2);
|
||||
after = listLocks(writableDir, true);
|
||||
System.out.println("after creating handler: " + after.size() + " locks found");
|
||||
System.out.println("after creating handler: " + after.size()
|
||||
+ " locks found");
|
||||
after.removeAll(before);
|
||||
if (after.size() != 1) {
|
||||
throw new RuntimeException("Unexpected lock files found: "+after
|
||||
throw new RuntimeException("Unexpected lock files found: " + after
|
||||
+ "\n\t" + lock + " should not have been reused");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Failed to lock: "+lock);
|
||||
throw new RuntimeException("Failed to lock: " + lock);
|
||||
}
|
||||
} finally {
|
||||
delete(lock);
|
||||
@ -271,22 +274,23 @@ public class CheckZombieLockTest {
|
||||
private static void testFileHandlerCreate(File writableDir, boolean first)
|
||||
throws IOException {
|
||||
List<File> before = listLocks(writableDir, true);
|
||||
System.out.println("before: " +before.size() + " locks found");
|
||||
System.out.println("before: " + before.size() + " locks found");
|
||||
try {
|
||||
if (first && !before.isEmpty()) {
|
||||
throw new RuntimeException("Expected no lock file! Found: "+before);
|
||||
throw new RuntimeException("Expected no lock file! Found: " + before);
|
||||
} else if (!first && before.size() != 1) {
|
||||
throw new RuntimeException("Expected a single lock file! Found: "+before);
|
||||
throw new RuntimeException("Expected a single lock file! Found: " + before);
|
||||
}
|
||||
} finally {
|
||||
before.stream().forEach(CheckZombieLockTest::delete);
|
||||
}
|
||||
FileHandler handler = createFileHandler(writableDir);
|
||||
System.out.println("handler created: "+handler);
|
||||
System.out.println("handler created: " + handler);
|
||||
List<File> after = listLocks(writableDir, true);
|
||||
System.out.println("after creating handler: " + after.size() + " locks found");
|
||||
if (after.size() != 1) {
|
||||
throw new RuntimeException("Unexpected number of lock files found for "+handler+": "+after);
|
||||
throw new RuntimeException("Unexpected number of lock files found for "
|
||||
+ handler + ": " + after);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +309,7 @@ public class CheckZombieLockTest {
|
||||
tmpDir = System.getProperty("user.home");
|
||||
}
|
||||
File tmpOrHomeDir = new File(tmpDir);
|
||||
// Create a writable directory here (%t/writable-dir)
|
||||
// Create a writable directory here (%t/writable-lockfile-dir)
|
||||
File writableDir = new File(tmpOrHomeDir, WRITABLE_DIR);
|
||||
if (!createFile(writableDir, true)) {
|
||||
throw new RuntimeException("Test setup failed: unable to create"
|
||||
@ -314,9 +318,10 @@ public class CheckZombieLockTest {
|
||||
}
|
||||
|
||||
// try to determine whether file locking is supported
|
||||
final String uniqueFileName = UUID.randomUUID().toString()+".lck";
|
||||
try {
|
||||
FileChannel fc = FileChannel.open(Paths.get(writableDir.getAbsolutePath(),
|
||||
UUID.randomUUID().toString()+".lck"),
|
||||
uniqueFileName),
|
||||
StandardOpenOption.CREATE_NEW, StandardOpenOption.APPEND,
|
||||
StandardOpenOption.DELETE_ON_CLOSE);
|
||||
try {
|
||||
@ -326,9 +331,11 @@ public class CheckZombieLockTest {
|
||||
} finally {
|
||||
fc.close();
|
||||
}
|
||||
} catch(Throwable t) {
|
||||
} catch (IOException t) {
|
||||
// should not happen
|
||||
t.printStackTrace();
|
||||
System.err.println("Failed to create new file " + uniqueFileName +
|
||||
" in " + writableDir.getAbsolutePath());
|
||||
throw new RuntimeException("Test setup failed: unable to run test", t);
|
||||
}
|
||||
return writableDir;
|
||||
}
|
||||
|
47
jdk/test/sun/security/krb5/ccache/DefaultFile.java
Normal file
47
jdk/test/sun/security/krb5/ccache/DefaultFile.java
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8054817
|
||||
* @summary File ccache only recognizes Linux and Solaris defaults
|
||||
*/
|
||||
|
||||
import sun.security.krb5.internal.ccache.FileCredentialsCache;
|
||||
|
||||
public class DefaultFile {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// There are 2 cases where default ccache name is not
|
||||
// /tmp/krb5cc_uid.
|
||||
if (System.getenv("KRB5CCNAME") != null) {
|
||||
return;
|
||||
}
|
||||
if (System.getProperty("os.name").startsWith("Windows")) {
|
||||
return;
|
||||
}
|
||||
String name = FileCredentialsCache.getDefaultCacheName();
|
||||
if (!name.startsWith("/tmp/krb5cc_")) {
|
||||
throw new Exception("default name is " + name);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user