Merge
This commit is contained in:
commit
55ca6aeb17
@ -687,13 +687,13 @@ endif
|
||||
######################################################
|
||||
sane-alt_outputdir:
|
||||
ifdef ALT_OUTPUTDIR
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
|
||||
$(ECHO) "ERROR: ALT_OUTPUTDIR must be an Absolute Path Name, \n" \
|
||||
" not a Relative Path Name. \n" \
|
||||
"" >> $(ERROR_FILE) ; \
|
||||
fi
|
||||
ifeq ($(PLATFORM), windows)
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)'` -ne 1 ]; then \
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)'` -ne 1 ]; then \
|
||||
$(ECHO) "ERROR: On windows, ALT_OUTPUTDIR must contain the drive letter. \n" \
|
||||
"" >> $(ERROR_FILE) ; \
|
||||
fi
|
||||
@ -742,7 +742,7 @@ sane-outputdir:
|
||||
######################################################
|
||||
sane-alt_bootdir:
|
||||
ifdef ALT_BOOTDIR
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
|
||||
$(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \
|
||||
" not a Relative Path Name. \n" \
|
||||
" The current value of ALT_BOOTDIR is \n" \
|
||||
@ -772,7 +772,7 @@ sane-bootdir:
|
||||
######################################################
|
||||
sane-local-bootdir:
|
||||
ifeq ($(PLATFORM), windows)
|
||||
@if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -ci '^J:'` -ne 0 ]; then \
|
||||
@if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -c '^[jJ]:'` -ne 0 ]; then \
|
||||
$(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
|
||||
" drive is mapped over a network. Using a mapped drive for\n" \
|
||||
" the BOOTDIR may significantly slow down the build process.\n" \
|
||||
@ -789,7 +789,7 @@ endif
|
||||
######################################################
|
||||
sane-cacerts:
|
||||
ifdef ALT_CACERTS_FILE
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
|
||||
$(ECHO) "ERROR: ALT_CACERTS_FILE must be an Absolute Path Name, \n" \
|
||||
" not a Relative Path Name. \n" \
|
||||
" The current value of ALT_CACERTS_FILE is \n" \
|
||||
@ -1538,7 +1538,7 @@ endif
|
||||
sane-mozilla:
|
||||
ifeq ($(ARCH_DATA_MODEL), 32)
|
||||
ifdef ALT_MOZILLA_HEADERS_PATH
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
|
||||
@if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
|
||||
$(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
|
||||
" not a Relative Path Name. \n" \
|
||||
" The current value of ALT_MOZILLA_HEADERS_PATH is \n" \
|
||||
|
@ -135,9 +135,8 @@ $(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java
|
||||
|
||||
$(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class)
|
||||
@$(prep-target)
|
||||
$(CD) $(BUILDTOOLCLASSDIR) && \
|
||||
$(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
|
||||
$(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
|
||||
$(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
|
||||
-C $(BUILDTOOLCLASSDIR) $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
|
||||
@$(java-vm-cleanup)
|
||||
|
||||
$(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1999-2010 Sun Microsystems, Inc. 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
|
||||
@ -33,6 +33,7 @@ import java.io.IOException;
|
||||
/**
|
||||
* LDAP (RFC-1960) and LDAPv3 (RFC-2254) search filters.
|
||||
*
|
||||
* @author Xuelei Fan
|
||||
* @author Vincent Ryan
|
||||
* @author Jagane Sundar
|
||||
* @author Rosanna Lee
|
||||
@ -258,7 +259,7 @@ final class Filter {
|
||||
byte[] answer = new byte[j];
|
||||
System.arraycopy(tbuf, 0, answer, 0, j);
|
||||
if (dbg) {
|
||||
Ber.dumpBER(System.err, null, answer, 0, j);
|
||||
Ber.dumpBER(System.err, "", answer, 0, j);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
@ -330,7 +331,7 @@ final class Filter {
|
||||
}
|
||||
|
||||
|
||||
valueStart = eq + 1; // value starts after equal sign
|
||||
valueStart = eq + 1; // value starts after equal sign
|
||||
valueEnd = filtEnd;
|
||||
typeStart = filtStart; // beginning of string
|
||||
|
||||
@ -355,20 +356,199 @@ final class Filter {
|
||||
break;
|
||||
default:
|
||||
typeEnd = eq;
|
||||
//initializing ftype to make the compiler happy
|
||||
ftype = 0x00;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbg) {
|
||||
System.err.println("type: " + typeStart + ", " + typeEnd);
|
||||
System.err.println("value: " + valueStart + ", " + valueEnd);
|
||||
}
|
||||
|
||||
// check validity of type
|
||||
//
|
||||
// RFC4512 defines the type as the following ABNF:
|
||||
// attr = attributedescription
|
||||
// attributedescription = attributetype options
|
||||
// attributetype = oid
|
||||
// oid = descr / numericoid
|
||||
// descr = keystring
|
||||
// keystring = leadkeychar *keychar
|
||||
// leadkeychar = ALPHA
|
||||
// keychar = ALPHA / DIGIT / HYPHEN
|
||||
// numericoid = number 1*( DOT number )
|
||||
// number = DIGIT / ( LDIGIT 1*DIGIT )
|
||||
// options = *( SEMI option )
|
||||
// option = 1*keychar
|
||||
//
|
||||
// And RFC4515 defines the extensible type as the following ABNF:
|
||||
// attr [dnattrs] [matchingrule] / [dnattrs] matchingrule
|
||||
int optionsStart = -1;
|
||||
int extensibleStart = -1;
|
||||
if ((filter[typeStart] >= '0' && filter[typeStart] <= '9') ||
|
||||
(filter[typeStart] >= 'A' && filter[typeStart] <= 'Z') ||
|
||||
(filter[typeStart] >= 'a' && filter[typeStart] <= 'z')) {
|
||||
|
||||
boolean isNumericOid =
|
||||
filter[typeStart] >= '0' && filter[typeStart] <= '9';
|
||||
for (int i = typeStart + 1; i < typeEnd; i++) {
|
||||
// ';' is an indicator of attribute options
|
||||
if (filter[i] == ';') {
|
||||
if (isNumericOid && filter[i - 1] == '.') {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
|
||||
// attribute options
|
||||
optionsStart = i;
|
||||
break;
|
||||
}
|
||||
|
||||
// ':' is an indicator of extensible rules
|
||||
if (filter[i] == ':' && ftype == LDAP_FILTER_EXT) {
|
||||
if (isNumericOid && filter[i - 1] == '.') {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
|
||||
// extensible matching
|
||||
extensibleStart = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isNumericOid) {
|
||||
// numeric object identifier
|
||||
if ((filter[i] == '.' && filter[i - 1] == '.') ||
|
||||
(filter[i] != '.' &&
|
||||
!(filter[i] >= '0' && filter[i] <= '9'))) {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
} else {
|
||||
// descriptor
|
||||
if (filter[i] != '-' &&
|
||||
!(filter[i] >= '0' && filter[i] <= '9') &&
|
||||
!(filter[i] >= 'A' && filter[i] <= 'Z') &&
|
||||
!(filter[i] >= 'a' && filter[i] <= 'z')) {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ftype == LDAP_FILTER_EXT && filter[typeStart] == ':') {
|
||||
// extensible matching
|
||||
extensibleStart = typeStart;
|
||||
} else {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
|
||||
// check attribute options
|
||||
if (optionsStart > 0) {
|
||||
for (int i = optionsStart + 1; i < typeEnd; i++) {
|
||||
if (filter[i] == ';') {
|
||||
if (filter[i - 1] == ';') {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// ':' is an indicator of extensible rules
|
||||
if (filter[i] == ':' && ftype == LDAP_FILTER_EXT) {
|
||||
if (filter[i - 1] == ';') {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
|
||||
// extensible matching
|
||||
extensibleStart = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (filter[i] != '-' &&
|
||||
!(filter[i] >= '0' && filter[i] <= '9') &&
|
||||
!(filter[i] >= 'A' && filter[i] <= 'Z') &&
|
||||
!(filter[i] >= 'a' && filter[i] <= 'z')) {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check extensible matching
|
||||
if (extensibleStart > 0) {
|
||||
boolean isMatchingRule = false;
|
||||
for (int i = extensibleStart + 1; i < typeEnd; i++) {
|
||||
if (filter[i] == ':') {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
} else if ((filter[i] >= '0' && filter[i] <= '9') ||
|
||||
(filter[i] >= 'A' && filter[i] <= 'Z') ||
|
||||
(filter[i] >= 'a' && filter[i] <= 'z')) {
|
||||
boolean isNumericOid = filter[i] >= '0' && filter[i] <= '9';
|
||||
i++;
|
||||
for (int j = i; j < typeEnd; j++, i++) {
|
||||
// allows no more than two extensible rules
|
||||
if (filter[j] == ':') {
|
||||
if (isMatchingRule) {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
if (isNumericOid && filter[j - 1] == '.') {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
|
||||
isMatchingRule = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isNumericOid) {
|
||||
// numeric object identifier
|
||||
if ((filter[j] == '.' && filter[j - 1] == '.') ||
|
||||
(filter[j] != '.' &&
|
||||
!(filter[j] >= '0' && filter[j] <= '9'))) {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
} else {
|
||||
// descriptor
|
||||
if (filter[j] != '-' &&
|
||||
!(filter[j] >= '0' && filter[j] <= '9') &&
|
||||
!(filter[j] >= 'A' && filter[j] <= 'Z') &&
|
||||
!(filter[j] >= 'a' && filter[j] <= 'z')) {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ensure the latest byte is not isolated
|
||||
if (filter[typeEnd - 1] == '.' || filter[typeEnd - 1] == ';' ||
|
||||
filter[typeEnd - 1] == ':') {
|
||||
throw new InvalidSearchFilterException(
|
||||
"invalid attribute description");
|
||||
}
|
||||
|
||||
if (typeEnd == eq) { // filter type is of "equal"
|
||||
if (findUnescaped(filter, '*', valueStart, valueEnd) == -1) {
|
||||
ftype = LDAP_FILTER_EQUALITY;
|
||||
} else if (filter[valueStart] == '*' && valueStart == (valueEnd - 1)) {
|
||||
} else if (filter[valueStart] == '*' &&
|
||||
valueStart == (valueEnd - 1)) {
|
||||
ftype = LDAP_FILTER_PRESENT;
|
||||
} else {
|
||||
encodeSubstringFilter(ber, filter,
|
||||
typeStart, typeEnd, valueStart, valueEnd);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (dbg) {
|
||||
System.err.println("type: " + typeStart + ", " + typeEnd);
|
||||
System.err.println("value: " + valueStart + ", " + valueEnd);
|
||||
}
|
||||
|
||||
if (ftype == LDAP_FILTER_PRESENT) {
|
||||
@ -379,7 +559,7 @@ final class Filter {
|
||||
} else {
|
||||
ber.beginSeq(ftype);
|
||||
ber.encodeOctetString(filter, Ber.ASN_OCTET_STR,
|
||||
typeStart, typeEnd-typeStart);
|
||||
typeStart, typeEnd - typeStart);
|
||||
ber.encodeOctetString(
|
||||
unescapeFilterValue(filter, valueStart, valueEnd),
|
||||
Ber.ASN_OCTET_STR);
|
||||
@ -623,7 +803,8 @@ final class Filter {
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final boolean dbg = false;
|
||||
// private static final boolean dbg = false;
|
||||
private static final boolean dbg = true;
|
||||
private static int dbgIndent = 0;
|
||||
|
||||
private static void dprint(String msg) {
|
||||
|
@ -27,8 +27,12 @@ package java.lang;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/** Implementing this interface allows an object to be the target of
|
||||
* the "foreach" statement.
|
||||
/**
|
||||
* Implementing this interface allows an object to be the target of
|
||||
* the "foreach" statement.
|
||||
*
|
||||
* @param <T> the type of elements returned by the iterator
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public interface Iterable<T> {
|
||||
|
@ -1492,7 +1492,7 @@ public final class String
|
||||
*/
|
||||
public int hashCode() {
|
||||
int h = hash;
|
||||
if (h == 0) {
|
||||
if (h == 0 && count > 0) {
|
||||
int off = offset;
|
||||
char val[] = value;
|
||||
int len = count;
|
||||
|
@ -129,7 +129,8 @@ class IdentityScope extends Identity {
|
||||
/**
|
||||
* Returns the system's identity scope.
|
||||
*
|
||||
* @return the system's identity scope.
|
||||
* @return the system's identity scope, or {@code null} if none has been
|
||||
* set.
|
||||
*
|
||||
* @see #setSystemScope
|
||||
*/
|
||||
|
@ -103,6 +103,8 @@ package java.util;
|
||||
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
|
||||
* Java Collections Framework</a>.
|
||||
*
|
||||
* @param <E> the type of elements in this collection
|
||||
*
|
||||
* @author Josh Bloch
|
||||
* @author Neal Gafter
|
||||
* @see Set
|
||||
|
@ -253,7 +253,7 @@ final class DualPivotQuicksort {
|
||||
a[less] = ak;
|
||||
}
|
||||
less++;
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
/*
|
||||
* We know that pivot1 == a[e3] == pivot2. Thus, we know
|
||||
* that great will still be >= k when the following loop
|
||||
@ -531,7 +531,7 @@ final class DualPivotQuicksort {
|
||||
a[less] = ak;
|
||||
}
|
||||
less++;
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
/*
|
||||
* We know that pivot1 == a[e3] == pivot2. Thus, we know
|
||||
* that great will still be >= k when the following loop
|
||||
@ -826,7 +826,7 @@ final class DualPivotQuicksort {
|
||||
a[less] = ak;
|
||||
}
|
||||
less++;
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
/*
|
||||
* We know that pivot1 == a[e3] == pivot2. Thus, we know
|
||||
* that great will still be >= k when the following loop
|
||||
@ -1119,7 +1119,7 @@ final class DualPivotQuicksort {
|
||||
a[less] = ak;
|
||||
}
|
||||
less++;
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
/*
|
||||
* We know that pivot1 == a[e3] == pivot2. Thus, we know
|
||||
* that great will still be >= k when the following loop
|
||||
@ -1414,7 +1414,7 @@ final class DualPivotQuicksort {
|
||||
a[less] = ak;
|
||||
}
|
||||
less++;
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
/*
|
||||
* We know that pivot1 == a[e3] == pivot2. Thus, we know
|
||||
* that great will still be >= k when the following loop
|
||||
@ -1531,7 +1531,7 @@ final class DualPivotQuicksort {
|
||||
* Sorts the specified range of the array into ascending order. The range
|
||||
* to be sorted extends from the index {@code fromIndex}, inclusive, to
|
||||
* the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
|
||||
* the range to be sorted is empty and the call is a no-op).
|
||||
* the range to be sorted is empty and the call is a no-op).
|
||||
*
|
||||
* <p>The {@code <} relation does not provide a total order on all float
|
||||
* values: {@code -0.0f == 0.0f} is {@code true} and a {@code Float.NaN}
|
||||
@ -1787,7 +1787,7 @@ final class DualPivotQuicksort {
|
||||
a[less] = ak;
|
||||
}
|
||||
less++;
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
/*
|
||||
* We know that pivot1 == a[e3] == pivot2. Thus, we know
|
||||
* that great will still be >= k when the following loop
|
||||
@ -2160,7 +2160,7 @@ final class DualPivotQuicksort {
|
||||
a[less] = ak;
|
||||
}
|
||||
less++;
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
} else { // (a[k] > pivot1) - Move a[k] to right part
|
||||
/*
|
||||
* We know that pivot1 == a[e3] == pivot2. Thus, we know
|
||||
* that great will still be >= k when the following loop
|
||||
|
@ -41,6 +41,8 @@ package java.util;
|
||||
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
|
||||
* Java Collections Framework</a>.
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator
|
||||
*
|
||||
* @author Josh Bloch
|
||||
* @see Collection
|
||||
* @see ListIterator
|
||||
|
@ -89,6 +89,8 @@ package java.util;
|
||||
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
|
||||
* Java Collections Framework</a>.
|
||||
*
|
||||
* @param <E> the type of elements in this list
|
||||
*
|
||||
* @author Josh Bloch
|
||||
* @author Neal Gafter
|
||||
* @see Collection
|
||||
|
@ -59,10 +59,15 @@ abstract class AbstractWatchKey extends WatchKey {
|
||||
// pending events
|
||||
private List<WatchEvent<?>> events;
|
||||
|
||||
// maps a context to the last event for the context (iff the last queued
|
||||
// event for the context is an ENTRY_MODIFY event).
|
||||
private Map<Object,WatchEvent<?>> lastModifyEvents;
|
||||
|
||||
protected AbstractWatchKey(AbstractWatchService watcher) {
|
||||
this.watcher = watcher;
|
||||
this.state = State.READY;
|
||||
this.events = new ArrayList<WatchEvent<?>>();
|
||||
this.lastModifyEvents = new HashMap<Object,WatchEvent<?>>();
|
||||
}
|
||||
|
||||
final AbstractWatchService watcher() {
|
||||
@ -86,6 +91,7 @@ abstract class AbstractWatchKey extends WatchKey {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
final void signalEvent(WatchEvent.Kind<?> kind, Object context) {
|
||||
boolean isModify = (kind == StandardWatchEventKind.ENTRY_MODIFY);
|
||||
synchronized (this) {
|
||||
int size = events.size();
|
||||
if (size > 0) {
|
||||
@ -100,17 +106,43 @@ abstract class AbstractWatchKey extends WatchKey {
|
||||
return;
|
||||
}
|
||||
|
||||
// if this is a modify event and the last entry for the context
|
||||
// is a modify event then we simply increment the count
|
||||
if (!lastModifyEvents.isEmpty()) {
|
||||
if (isModify) {
|
||||
WatchEvent<?> ev = lastModifyEvents.get(context);
|
||||
if (ev != null) {
|
||||
assert ev.kind() == StandardWatchEventKind.ENTRY_MODIFY;
|
||||
((Event<?>)ev).increment();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// not a modify event so remove from the map as the
|
||||
// last event will no longer be a modify event.
|
||||
lastModifyEvents.remove(context);
|
||||
}
|
||||
}
|
||||
|
||||
// if the list has reached the limit then drop pending events
|
||||
// and queue an OVERFLOW event
|
||||
if (size >= MAX_EVENT_LIST_SIZE) {
|
||||
events.clear();
|
||||
kind = StandardWatchEventKind.OVERFLOW;
|
||||
isModify = false;
|
||||
context = null;
|
||||
}
|
||||
}
|
||||
|
||||
// non-repeated event
|
||||
events.add(new Event<Object>((WatchEvent.Kind<Object>)kind, context));
|
||||
Event<Object> ev =
|
||||
new Event<Object>((WatchEvent.Kind<Object>)kind, context);
|
||||
if (isModify) {
|
||||
lastModifyEvents.put(context, ev);
|
||||
} else if (kind == StandardWatchEventKind.OVERFLOW) {
|
||||
// drop all pending events
|
||||
events.clear();
|
||||
lastModifyEvents.clear();
|
||||
}
|
||||
events.add(ev);
|
||||
signal();
|
||||
}
|
||||
}
|
||||
@ -120,6 +152,7 @@ abstract class AbstractWatchKey extends WatchKey {
|
||||
synchronized (this) {
|
||||
List<WatchEvent<?>> result = events;
|
||||
events = new ArrayList<WatchEvent<?>>();
|
||||
lastModifyEvents.clear();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Portions Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Portions Copyright 2000-2010 Sun Microsystems, Inc. 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
|
||||
@ -36,9 +36,9 @@ import sun.security.krb5.Config;
|
||||
import sun.security.krb5.EncryptedData;
|
||||
import sun.security.krb5.EncryptionKey;
|
||||
import sun.security.krb5.KrbException;
|
||||
import sun.security.krb5.Asn1Exception;
|
||||
import sun.security.krb5.KrbCryptoException;
|
||||
import javax.crypto.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -48,6 +48,23 @@ import java.util.ArrayList;
|
||||
public abstract class EType {
|
||||
|
||||
private static final boolean DEBUG = Krb5.DEBUG;
|
||||
private static final boolean ALLOW_WEAK_CRYPTO;
|
||||
|
||||
static {
|
||||
boolean allowed = true;
|
||||
try {
|
||||
Config cfg = Config.getInstance();
|
||||
String temp = cfg.getDefault("allow_weak_crypto", "libdefaults");
|
||||
if (temp != null && temp.equals("false")) allowed = false;
|
||||
} catch (Exception exc) {
|
||||
if (DEBUG) {
|
||||
System.out.println ("Exception in getting allow_weak_crypto, " +
|
||||
"using default value " +
|
||||
exc.getMessage());
|
||||
}
|
||||
}
|
||||
ALLOW_WEAK_CRYPTO = allowed;
|
||||
}
|
||||
|
||||
public static EType getInstance (int eTypeConst)
|
||||
throws KdcErrException {
|
||||
@ -163,6 +180,10 @@ public abstract class EType {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Note: the first 2 entries of BUILTIN_ETYPES and BUILTIN_ETYPES_NOAES256
|
||||
// should be kept DES-related. They will be removed when allow_weak_crypto
|
||||
// is set to false.
|
||||
|
||||
private static final int[] BUILTIN_ETYPES = new int[] {
|
||||
EncryptedData.ETYPE_DES_CBC_MD5,
|
||||
EncryptedData.ETYPE_DES_CBC_CRC,
|
||||
@ -189,10 +210,17 @@ public abstract class EType {
|
||||
} catch (Exception e) {
|
||||
// should not happen
|
||||
}
|
||||
int[] result;
|
||||
if (allowed < 256) {
|
||||
return BUILTIN_ETYPES_NOAES256;
|
||||
result = BUILTIN_ETYPES_NOAES256;
|
||||
} else {
|
||||
result = BUILTIN_ETYPES;
|
||||
}
|
||||
return BUILTIN_ETYPES;
|
||||
if (!ALLOW_WEAK_CRYPTO) {
|
||||
// The first 2 etypes are now weak ones
|
||||
return Arrays.copyOfRange(result, 2, result.length);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,9 +235,7 @@ public abstract class EType {
|
||||
if (DEBUG) {
|
||||
System.out.println("Exception while getting " +
|
||||
configName + exc.getMessage());
|
||||
System.out.println("Using defaults " +
|
||||
"des-cbc-md5, des-cbc-crc, des3-cbc-sha1," +
|
||||
" aes128cts, aes256cts, rc4-hmac");
|
||||
System.out.println("Using default builtin etypes");
|
||||
}
|
||||
return getBuiltInDefaults();
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ import java.io.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.*;
|
||||
import sun.misc.IOUtils;
|
||||
|
||||
import sun.security.pkcs.EncryptedPrivateKeyInfo;
|
||||
|
||||
@ -677,50 +677,39 @@ abstract class JavaKeyStore extends KeyStoreSpi {
|
||||
entry.date = new Date(dis.readLong());
|
||||
|
||||
// Read the private key
|
||||
try {
|
||||
entry.protectedPrivKey = new byte[dis.readInt()];
|
||||
} catch (OutOfMemoryError e) {
|
||||
throw new IOException("Keysize too big");
|
||||
}
|
||||
dis.readFully(entry.protectedPrivKey);
|
||||
entry.protectedPrivKey =
|
||||
IOUtils.readFully(dis, dis.readInt(), true);
|
||||
|
||||
// Read the certificate chain
|
||||
int numOfCerts = dis.readInt();
|
||||
try {
|
||||
if (numOfCerts > 0) {
|
||||
entry.chain = new Certificate[numOfCerts];
|
||||
}
|
||||
} catch (OutOfMemoryError e) {
|
||||
throw new IOException
|
||||
("Too many certificates in chain");
|
||||
}
|
||||
for (int j = 0; j < numOfCerts; j++) {
|
||||
if (xVersion == 2) {
|
||||
// read the certificate type, and instantiate a
|
||||
// certificate factory of that type (reuse
|
||||
// existing factory if possible)
|
||||
String certType = dis.readUTF();
|
||||
if (cfs.containsKey(certType)) {
|
||||
// reuse certificate factory
|
||||
cf = cfs.get(certType);
|
||||
} else {
|
||||
// create new certificate factory
|
||||
cf = CertificateFactory.getInstance(certType);
|
||||
// store the certificate factory so we can
|
||||
// reuse it later
|
||||
cfs.put(certType, cf);
|
||||
if (numOfCerts > 0) {
|
||||
List<Certificate> certs = new ArrayList<>(
|
||||
numOfCerts > 10 ? 10 : numOfCerts);
|
||||
for (int j = 0; j < numOfCerts; j++) {
|
||||
if (xVersion == 2) {
|
||||
// read the certificate type, and instantiate a
|
||||
// certificate factory of that type (reuse
|
||||
// existing factory if possible)
|
||||
String certType = dis.readUTF();
|
||||
if (cfs.containsKey(certType)) {
|
||||
// reuse certificate factory
|
||||
cf = cfs.get(certType);
|
||||
} else {
|
||||
// create new certificate factory
|
||||
cf = CertificateFactory.getInstance(certType);
|
||||
// store the certificate factory so we can
|
||||
// reuse it later
|
||||
cfs.put(certType, cf);
|
||||
}
|
||||
}
|
||||
// instantiate the certificate
|
||||
encoded = IOUtils.readFully(dis, dis.readInt(), true);
|
||||
bais = new ByteArrayInputStream(encoded);
|
||||
certs.add(cf.generateCertificate(bais));
|
||||
bais.close();
|
||||
}
|
||||
// instantiate the certificate
|
||||
try {
|
||||
encoded = new byte[dis.readInt()];
|
||||
} catch (OutOfMemoryError e) {
|
||||
throw new IOException("Certificate too big");
|
||||
}
|
||||
dis.readFully(encoded);
|
||||
bais = new ByteArrayInputStream(encoded);
|
||||
entry.chain[j] = cf.generateCertificate(bais);
|
||||
bais.close();
|
||||
// We can be sure now that numOfCerts of certs are read
|
||||
entry.chain = certs.toArray(new Certificate[numOfCerts]);
|
||||
}
|
||||
|
||||
// Add the entry to the list
|
||||
@ -753,12 +742,7 @@ abstract class JavaKeyStore extends KeyStoreSpi {
|
||||
cfs.put(certType, cf);
|
||||
}
|
||||
}
|
||||
try {
|
||||
encoded = new byte[dis.readInt()];
|
||||
} catch (OutOfMemoryError e) {
|
||||
throw new IOException("Certificate too big");
|
||||
}
|
||||
dis.readFully(encoded);
|
||||
encoded = IOUtils.readFully(dis, dis.readInt(), true);
|
||||
bais = new ByteArrayInputStream(encoded);
|
||||
entry.cert = cf.generateCertificate(bais);
|
||||
bais.close();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright (c) 2007-2010 Sun Microsystems, Inc. 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
|
||||
@ -375,7 +375,8 @@ public final class TimestampedSigner extends ContentSigner {
|
||||
}
|
||||
if (!isSigner) {
|
||||
keyPurposes = cert.getExtendedKeyUsage();
|
||||
if (! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
|
||||
if (keyPurposes == null ||
|
||||
! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
|
||||
throw new CertificateException(
|
||||
"Certificate is not valid for timestamping");
|
||||
}
|
||||
|
@ -117,11 +117,6 @@ policy.ignoreIdentityScope=false
|
||||
#
|
||||
keystore.type=jks
|
||||
|
||||
#
|
||||
# Class to instantiate as the system scope:
|
||||
#
|
||||
system.scope=sun.security.provider.IdentityDatabase
|
||||
|
||||
#
|
||||
# List of comma-separated packages that start with or equal this string
|
||||
# will cause a security exception to be thrown when
|
||||
|
@ -624,8 +624,11 @@ class UnixPath
|
||||
public boolean endsWith(Path other) {
|
||||
UnixPath that = checkPath(other);
|
||||
|
||||
int thisLen = path.length;
|
||||
int thatLen = that.path.length;
|
||||
|
||||
// other path is longer
|
||||
if (that.path.length > path.length)
|
||||
if (thatLen > thisLen)
|
||||
return false;
|
||||
|
||||
// other path is absolute so this path must be absolute
|
||||
@ -643,10 +646,10 @@ class UnixPath
|
||||
if (thatOffsetCount == thisOffsetCount) {
|
||||
if (thisOffsetCount == 0)
|
||||
return true;
|
||||
int expectedLen = path.length;
|
||||
int expectedLen = thisLen;
|
||||
if (this.isAbsolute() && !that.isAbsolute())
|
||||
expectedLen--;
|
||||
if (that.path.length != expectedLen)
|
||||
if (thatLen != expectedLen)
|
||||
return false;
|
||||
} else {
|
||||
// this path has more elements so given path must be relative
|
||||
@ -658,7 +661,9 @@ class UnixPath
|
||||
// compare bytes
|
||||
int thisPos = offsets[thisOffsetCount - thatOffsetCount];
|
||||
int thatPos = that.offsets[0];
|
||||
while (thatPos < that.path.length) {
|
||||
if ((thatLen - thatPos) != (thisLen - thisPos))
|
||||
return false;
|
||||
while (thatPos < thatLen) {
|
||||
if (this.path[thisPos++] != that.path[thatPos++])
|
||||
return false;
|
||||
}
|
||||
|
@ -414,9 +414,9 @@ Java_java_io_UnixFileSystem_getSpace(JNIEnv *env, jobject this,
|
||||
jlong rv = 0L;
|
||||
|
||||
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
|
||||
struct statvfs fsstat;
|
||||
memset(&fsstat, 0, sizeof(struct statvfs));
|
||||
if (statvfs(path, &fsstat) == 0) {
|
||||
struct statvfs64 fsstat;
|
||||
memset(&fsstat, 0, sizeof(fsstat));
|
||||
if (statvfs64(path, &fsstat) == 0) {
|
||||
switch(t) {
|
||||
case java_io_FileSystem_SPACE_TOTAL:
|
||||
rv = jlong_mul(long_to_jlong(fsstat.f_frsize),
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 1995-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,25 +37,19 @@ GET=
|
||||
AWK = awk
|
||||
CAT = cat
|
||||
CD = cd
|
||||
CHMOD = chmod
|
||||
CP = cp
|
||||
CUT = cut
|
||||
ECHO = echo
|
||||
EGREP = egrep
|
||||
EXPAND = expand
|
||||
EXPR = expr
|
||||
KILL = /usr/bin/kill
|
||||
MKDIR = mkdir
|
||||
NOHUP = nohup
|
||||
PWD = pwd
|
||||
SED = sed
|
||||
SLEEP = sleep
|
||||
SORT = sort
|
||||
TEE = tee
|
||||
UNAME = uname
|
||||
UNIQ = uniq
|
||||
WC = wc
|
||||
XHOST = xhost
|
||||
ZIP = zip
|
||||
|
||||
# Get OS name from uname
|
||||
@ -211,66 +205,6 @@ ifdef JPRT_ARCHIVE_BUNDLE
|
||||
ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
|
||||
endif
|
||||
|
||||
# DISPLAY settings for virtual frame buffer
|
||||
START_XVFB = start-Xvfb.sh
|
||||
NOHUP_OUTPUT = $(ABS_TEST_OUTPUT_DIR)/start-Xvfb.nohup-output.txt
|
||||
DISPLAY_PID_FILE=$(ABS_TEST_OUTPUT_DIR)/xvfb-display-number.txt
|
||||
DISPLAY_SLEEP_TIME=10
|
||||
DISPLAY_MAX_SLEEPS=10
|
||||
ifeq ($(OS_NAME),solaris)
|
||||
VIRTUAL_FRAME_BUFFER = true
|
||||
endif
|
||||
ifeq ($(OS_NAME),linux)
|
||||
VIRTUAL_FRAME_BUFFER = true
|
||||
endif
|
||||
|
||||
# Does not work yet, display dies as soon as it gets used. :^(
|
||||
VIRTUAL_FRAME_BUFFER = false
|
||||
|
||||
# Are we using a VIRTUAL_FRAME_BUFFER (Xvfb)
|
||||
ifeq ($(VIRTUAL_FRAME_BUFFER),true)
|
||||
|
||||
PREP_DISPLAY = \
|
||||
$(CP) $(START_XVFB) $(ABS_TEST_OUTPUT_DIR); \
|
||||
$(CHMOD) a+x $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB); \
|
||||
( $(CD) $(ABS_TEST_OUTPUT_DIR) && \
|
||||
$(NOHUP) $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB) $(DISPLAY_PID_FILE) > $(NOHUP_OUTPUT) 2>&1 && \
|
||||
$(SLEEP) $(DISPLAY_SLEEP_TIME) ) & \
|
||||
count=1; \
|
||||
while [ ! -s $(DISPLAY_PID_FILE) ] ; do \
|
||||
$(ECHO) "Sleeping $(DISPLAY_SLEEP_TIME) more seconds, DISPLAY not ready"; \
|
||||
$(SLEEP) $(DISPLAY_SLEEP_TIME); \
|
||||
count=`$(EXPR) $${count} '+' 1`; \
|
||||
if [ $${count} -gt $(DISPLAY_MAX_SLEEPS) ] ; then \
|
||||
$(ECHO) "ERROR: DISPLAY not ready, giving up on DISPLAY"; \
|
||||
exit 9; \
|
||||
fi; \
|
||||
done ; \
|
||||
DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \
|
||||
export DISPLAY; \
|
||||
$(CAT) $(NOHUP_OUTPUT); \
|
||||
$(ECHO) "Prepared DISPLAY=$${DISPLAY}"; \
|
||||
$(XHOST) || \
|
||||
( $(ECHO) "ERROR: No display" ; exit 8)
|
||||
|
||||
KILL_DISPLAY = \
|
||||
( \
|
||||
DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \
|
||||
export DISPLAY; \
|
||||
if [ -s "$(DISPLAY_PID_FILE)" ] ; then \
|
||||
$(KILL) `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \
|
||||
$(KILL) -9 `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \
|
||||
fi; \
|
||||
$(ECHO) "Killed DISPLAY=$${DISPLAY}"; \
|
||||
)
|
||||
|
||||
else
|
||||
|
||||
PREP_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)"
|
||||
KILL_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)"
|
||||
|
||||
endif
|
||||
|
||||
# How to create the test bundle (pass or fail, we want to create this)
|
||||
# Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
|
||||
ZIP_UP_RESULTS = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \
|
||||
@ -327,7 +261,7 @@ BUNDLE_UP_AND_EXIT = \
|
||||
$(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
|
||||
fi; \
|
||||
$(CAT) $(STATS_TXT); \
|
||||
$(ZIP_UP_RESULTS) && $(KILL_DISPLAY) ; \
|
||||
$(ZIP_UP_RESULTS) ; \
|
||||
$(TESTEXIT) \
|
||||
)
|
||||
|
||||
@ -629,7 +563,6 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) $(EXCLUDELIST)
|
||||
( \
|
||||
( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
|
||||
export JT_HOME; \
|
||||
$(PREP_DISPLAY) && \
|
||||
$(shell $(GETMIXEDPATH) "$(JTREG)") \
|
||||
$(JTREG_BASIC_OPTIONS) \
|
||||
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \
|
||||
|
@ -1,6 +1,6 @@
|
||||
###########################################################################
|
||||
#
|
||||
# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 2009-2010 Sun Microsystems, Inc. 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
|
||||
@ -431,6 +431,12 @@ java/lang/ClassLoader/deadlock/TestCrossDelegate.sh generic-all
|
||||
|
||||
# jdk_management
|
||||
|
||||
# Fails on linux: KO: StringMonitor notification missed or not emitted
|
||||
javax/management/monitor/NonComparableAttributeValueTest.java generic-all
|
||||
|
||||
# Port conflict? Fails with communication error
|
||||
sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh generic-all
|
||||
|
||||
# Fails on Windows 2000, Test failed for iiop java.lang.NullPointerException
|
||||
# at org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(Unknown Source)
|
||||
# at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:653)
|
||||
@ -583,6 +589,9 @@ javax/print/attribute/MediaMappingsTest.java generic-all
|
||||
# Suspect many of these tests auffer from using fixed ports, no concrete
|
||||
# evidence.
|
||||
|
||||
# Times out on Windows X64
|
||||
sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java generic-all
|
||||
|
||||
# Dies on Solaris 10 sparc and sparcv9, Linux -ea -esa with
|
||||
# Interrupted or IO exception, maybe writing to non-unique named file?
|
||||
com/sun/net/httpserver/bugs/B6373555.java generic-all
|
||||
@ -736,6 +745,13 @@ java/net/ProxySelector/B6737819.java generic-all
|
||||
# Suspect many of these tests auffer from using fixed ports, no concrete
|
||||
# evidence.
|
||||
|
||||
# Occasionally Failing with java.lang.AssertionError on Windows X64
|
||||
# at sun.nio.ch.PendingIoCache.clearPendingIoMap(PendingIoCache.java:144)
|
||||
#java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all
|
||||
|
||||
# Some kind of sleep/wake problem on Windows X64
|
||||
java/nio/channels/Selector/Wakeup.java windows-all
|
||||
|
||||
# Fails with -ea -esa, Assertion error, but only on Solaris 10 machines?
|
||||
com/sun/nio/sctp/SctpChannel/Send.java generic-all
|
||||
com/sun/nio/sctp/SctpChannel/Shutdown.java generic-all
|
||||
@ -932,6 +948,18 @@ java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java generic-all
|
||||
|
||||
# jdk_security
|
||||
|
||||
# Unknown problem, could be a jtreg -samevm issue?
|
||||
# Error while cleaning up threads after test
|
||||
java/security/Security/SynchronizedAccess.java generic-all
|
||||
|
||||
# Failing on Solaris X64 (-d64 -server) with:
|
||||
# GSSException: Failure unspecified at GSS-API level
|
||||
# (Mechanism level: Specified version of key is not available (44))
|
||||
sun/security/krb5/auto/BasicKrb5Test.java generic-all
|
||||
|
||||
# Solaris X86 failures, readjar.jks: No such file or directory
|
||||
sun/security/tools/keytool/readjar.sh generic-all
|
||||
|
||||
# Fails with -ea -esa, but only on Solaris sparc? Suspect it is timing out
|
||||
sun/security/tools/keytool/standard.sh generic-all
|
||||
|
||||
@ -1256,6 +1284,13 @@ tools/jar/index/MetaInf.java windows-all
|
||||
|
||||
# jdk_util
|
||||
|
||||
# Fails with assertion error on windows
|
||||
# 11 separate stacktraces created... file reuse problem?
|
||||
java/util/zip/ZipFile/ReadLongZipFileName.java generic-all
|
||||
|
||||
# Recent failure on all platforms
|
||||
sun/util/resources/TimeZone/Bug6317929.java generic-all
|
||||
|
||||
# Fails with -ea -esa on all platforms with Assertion error
|
||||
java/util/ResourceBundle/Test4300693.java generic-all
|
||||
|
||||
|
311
jdk/test/com/sun/jndi/ldap/InvalidLdapFilters.java
Normal file
311
jdk/test/com/sun/jndi/ldap/InvalidLdapFilters.java
Normal file
@ -0,0 +1,311 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 6916202
|
||||
* @summary More cases of invalid ldap filters accepted and processed
|
||||
* @run main/othervm InvalidLdapFilters valid (cn=Babs)
|
||||
* @run main/othervm InvalidLdapFilters valid (&(cn=Bob))
|
||||
* @run main/othervm InvalidLdapFilters valid (&(objectClass=*)(uid=*))
|
||||
* @run main/othervm InvalidLdapFilters valid (|(cn=Bob))
|
||||
* @run main/othervm InvalidLdapFilters valid (|(objectClass=*)(uid=*))
|
||||
* @run main/othervm InvalidLdapFilters valid (!(cn=Tim))
|
||||
* @run main/othervm InvalidLdapFilters valid (!(!(cn=Tim)))
|
||||
* @run main/othervm InvalidLdapFilters valid (!(&(objectClass=*)(uid=*)))
|
||||
* @run main/othervm InvalidLdapFilters valid (!(|(objectClass=*)(uid=*)))
|
||||
* @run main/othervm InvalidLdapFilters valid (o=univ*of*mich*)
|
||||
* @run main/othervm InvalidLdapFilters valid (seeAlso=)
|
||||
* @run main/othervm InvalidLdapFilters valid (cn:caseExactMatch:=Flintstone)
|
||||
* @run main/othervm InvalidLdapFilters valid (cn:=Betty)
|
||||
* @run main/othervm InvalidLdapFilters valid (sn:dn:2.4.6.8.10:=Barney)
|
||||
* @run main/othervm InvalidLdapFilters valid (o:dn:=Ace)
|
||||
* @run main/othervm InvalidLdapFilters valid (:1.2.3:=Wilma)
|
||||
* @run main/othervm InvalidLdapFilters valid (:DN:2.4.6.8.10:=Dino)
|
||||
* @run main/othervm InvalidLdapFilters valid (1.2.3=abc)
|
||||
* @run main/othervm InvalidLdapFilters valid (cn;lang-de;lang-en=abc)
|
||||
* @run main/othervm InvalidLdapFilters valid (owner=abc)
|
||||
* @run main/othervm InvalidLdapFilters valid (sn;lang-en:dn:2.4.6.8.10:=Barney)
|
||||
* @run main/othervm InvalidLdapFilters valid
|
||||
(&(objectClass=Person)(|(sn=Jensen)(cn=Bab*)))
|
||||
* @run main/othervm InvalidLdapFilters invalid "(&(cn=Robert Dean)))"
|
||||
* @run main/othervm InvalidLdapFilters invalid (&|(cn=Bob))
|
||||
* @run main/othervm InvalidLdapFilters invalid (&&(cn=Bob))
|
||||
* @run main/othervm InvalidLdapFilters invalid (|&(cn=Bob))
|
||||
* @run main/othervm InvalidLdapFilters invalid (||(cn=Bob))
|
||||
* @run main/othervm InvalidLdapFilters invalid (:1.2.:=Wilma)
|
||||
* @run main/othervm InvalidLdapFilters invalid (::DN:2.4.6.8.10:=Dino)
|
||||
* @run main/othervm InvalidLdapFilters invalid (:DN::2.4.6.8.10:=Dino)
|
||||
* @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6.8.10::=Dino)
|
||||
* @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6..8.10:=Dino)
|
||||
* @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6.8.:=Dino)
|
||||
* @run main/othervm InvalidLdapFilters invalid (1.2.;::=abc)
|
||||
* @run main/othervm InvalidLdapFilters invalid (1.2.3;::=abc)
|
||||
* @run main/othervm InvalidLdapFilters invalid (1.2.3;x;=abc)
|
||||
* @run main/othervm InvalidLdapFilters invalid (1.2.3:x::=abc)
|
||||
* @run main/othervm InvalidLdapFilters invalid (1.2.3:x=abc)
|
||||
* @run main/othervm InvalidLdapFilters invalid (sn;:dn:2.4.6.8.10:=Barney)
|
||||
* @run main/othervm InvalidLdapFilters invalid "\"((objectClass=*)&(uid=*))\""
|
||||
* @run main/othervm InvalidLdapFilters invalid "&(objectClass=*)(uid=*)"
|
||||
* @run main/othervm InvalidLdapFilters invalid "(:DN:2.4.6.8.10:cn:=Dino)"
|
||||
* @run main/othervm InvalidLdapFilters invalid "(:DN:2.4.6.8.10:cn=Dino)"
|
||||
* @run main/othervm InvalidLdapFilters invalid
|
||||
"((objectCategory=person)(cn=u)(!(cn=u2*)))"
|
||||
* @run main/othervm InvalidLdapFilters invalid
|
||||
"((&(objectClass=user)(cn=andy*)(cn=steve*)(cn=bob*)))"
|
||||
*
|
||||
* @author Xuelei Fan
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import javax.naming.*;
|
||||
import javax.naming.directory.*;
|
||||
import java.util.Properties;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import java.net.Socket;
|
||||
import java.net.ServerSocket;
|
||||
|
||||
public class InvalidLdapFilters {
|
||||
// Should we run the client or server in a separate thread?
|
||||
//
|
||||
// Both sides can throw exceptions, but do you have a preference
|
||||
// as to which side should be the main thread.
|
||||
static boolean separateServerThread = true;
|
||||
|
||||
// use any free port by default
|
||||
volatile int serverPort = 0;
|
||||
|
||||
// Is the server ready to serve?
|
||||
volatile static boolean serverReady = false;
|
||||
|
||||
// Define the server side of the test.
|
||||
//
|
||||
// If the server prematurely exits, serverReady will be set to true
|
||||
// to avoid infinite hangs.
|
||||
void doServerSide() throws Exception {
|
||||
ServerSocket serverSock = new ServerSocket(serverPort);
|
||||
|
||||
// signal client, it's ready to accecpt connection
|
||||
serverPort = serverSock.getLocalPort();
|
||||
serverReady = true;
|
||||
|
||||
// accept a connection
|
||||
Socket socket = serverSock.accept();
|
||||
System.out.println("Server: Connection accepted");
|
||||
|
||||
InputStream is = socket.getInputStream();
|
||||
OutputStream os = socket.getOutputStream();
|
||||
|
||||
// read the bindRequest
|
||||
while (is.read() != -1) {
|
||||
// ignore
|
||||
is.skip(is.available());
|
||||
break;
|
||||
}
|
||||
|
||||
byte[] bindResponse = {0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
|
||||
0x01, 0x00, 0x04, 0x00, 0x04, 0x00};
|
||||
// write bindResponse
|
||||
os.write(bindResponse);
|
||||
os.flush();
|
||||
|
||||
// ignore any more request.
|
||||
while (is.read() != -1) {
|
||||
// ignore
|
||||
is.skip(is.available());
|
||||
}
|
||||
|
||||
is.close();
|
||||
os.close();
|
||||
socket.close();
|
||||
serverSock.close();
|
||||
}
|
||||
|
||||
// Define the client side of the test.
|
||||
//
|
||||
// If the server prematurely exits, serverReady will be set to true
|
||||
// to avoid infinite hangs.
|
||||
void doClientSide() throws Exception {
|
||||
// Wait for server to get started.
|
||||
while (!serverReady) {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
|
||||
// set up the environment for creating the initial context
|
||||
Hashtable<Object, Object> env = new Hashtable<Object, Object>();
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
||||
"com.sun.jndi.ldap.LdapCtxFactory");
|
||||
env.put(Context.PROVIDER_URL, "ldap://localhost:" + serverPort);
|
||||
env.put("com.sun.jndi.ldap.read.timeout", "1000");
|
||||
|
||||
// env.put(Context.SECURITY_AUTHENTICATION, "simple");
|
||||
// env.put(Context.SECURITY_PRINCIPAL,"cn=root");
|
||||
// env.put(Context.SECURITY_CREDENTIALS,"root");
|
||||
|
||||
// create initial context
|
||||
DirContext context = new InitialDirContext(env);
|
||||
|
||||
// searching
|
||||
SearchControls scs = new SearchControls();
|
||||
scs.setSearchScope(SearchControls.SUBTREE_SCOPE);
|
||||
|
||||
try {
|
||||
NamingEnumeration answer =
|
||||
context.search("o=sun,c=us", searchFilter, scs);
|
||||
} catch (InvalidSearchFilterException isfe) {
|
||||
if (filterIsValid) {
|
||||
// unexpected filter exception.
|
||||
throw new Exception("Unexpected ISFE", isfe);
|
||||
} else {
|
||||
// ignore, it is the expected filter exception.
|
||||
System.out.println("Expected exception: " + isfe.getMessage());
|
||||
}
|
||||
} catch (NamingException ne) {
|
||||
// maybe a read timeout exception, as the server does not response.
|
||||
if (filterIsValid) {
|
||||
System.out.println("Expected exception: " + ne.getMessage());
|
||||
} else {
|
||||
throw new Exception("Not an InvalidSearchFilterException", ne);
|
||||
}
|
||||
}
|
||||
|
||||
context.close();
|
||||
}
|
||||
|
||||
private static boolean filterIsValid;
|
||||
private static String searchFilter;
|
||||
|
||||
private static void parseArguments(String[] args) {
|
||||
System.out.println("arguments length: " + args.length);
|
||||
if (args[0].equals("valid")) {
|
||||
filterIsValid = true;
|
||||
}
|
||||
|
||||
searchFilter = args[1];
|
||||
}
|
||||
|
||||
/*
|
||||
* ============================================================
|
||||
* The remainder is just support stuff
|
||||
*/
|
||||
|
||||
// client and server thread
|
||||
Thread clientThread = null;
|
||||
Thread serverThread = null;
|
||||
|
||||
// client and server exceptions
|
||||
volatile Exception serverException = null;
|
||||
volatile Exception clientException = null;
|
||||
|
||||
void startServer(boolean newThread) throws Exception {
|
||||
if (newThread) {
|
||||
serverThread = new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
doServerSide();
|
||||
} catch (Exception e) {
|
||||
/*
|
||||
* Our server thread just died.
|
||||
*
|
||||
* Release the client, if not active already...
|
||||
*/
|
||||
System.err.println("Server died...");
|
||||
System.err.println(e);
|
||||
serverReady = true;
|
||||
serverException = e;
|
||||
}
|
||||
}
|
||||
};
|
||||
serverThread.start();
|
||||
} else {
|
||||
doServerSide();
|
||||
}
|
||||
}
|
||||
|
||||
void startClient(boolean newThread) throws Exception {
|
||||
if (newThread) {
|
||||
clientThread = new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
doClientSide();
|
||||
} catch (Exception e) {
|
||||
/*
|
||||
* Our client thread just died.
|
||||
*/
|
||||
System.err.println("Client died...");
|
||||
clientException = e;
|
||||
}
|
||||
}
|
||||
};
|
||||
clientThread.start();
|
||||
} else {
|
||||
doClientSide();
|
||||
}
|
||||
}
|
||||
|
||||
// Primary constructor, used to drive remainder of the test.
|
||||
InvalidLdapFilters() throws Exception {
|
||||
if (separateServerThread) {
|
||||
startServer(true);
|
||||
startClient(false);
|
||||
} else {
|
||||
startClient(true);
|
||||
startServer(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for other side to close down.
|
||||
*/
|
||||
if (separateServerThread) {
|
||||
serverThread.join();
|
||||
} else {
|
||||
clientThread.join();
|
||||
}
|
||||
|
||||
/*
|
||||
* When we get here, the test is pretty much over.
|
||||
*
|
||||
* If the main thread excepted, that propagates back
|
||||
* immediately. If the other thread threw an exception, we
|
||||
* should report back.
|
||||
*/
|
||||
if (serverException != null) {
|
||||
System.out.print("Server Exception:");
|
||||
throw serverException;
|
||||
}
|
||||
if (clientException != null) {
|
||||
System.out.print("Client Exception:");
|
||||
throw clientException;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// parse the customized arguments
|
||||
parseArguments(args);
|
||||
|
||||
// start the test
|
||||
new InvalidLdapFilters();
|
||||
}
|
||||
|
||||
}
|
@ -28,27 +28,33 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* Invokes Files.walkFileTree to traverse a file tree and prints
|
||||
* each of the directories and files. The -L option causes symbolic
|
||||
* links to be followed.
|
||||
* each of the directories and files. The -follow option causes symbolic
|
||||
* links to be followed and the -printCycles option will print links
|
||||
* where the target of the link is an ancestor directory.
|
||||
*/
|
||||
|
||||
public class PrintFileTree {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
boolean followLinks = false;
|
||||
Path dir;
|
||||
|
||||
if (args[0].equals("-L")) {
|
||||
followLinks = true;
|
||||
dir = Paths.get(args[1]);
|
||||
} else {
|
||||
dir = Paths.get(args[0]);
|
||||
boolean printCycles = false;
|
||||
int i = 0;
|
||||
while (i < (args.length-1)) {
|
||||
switch (args[i]) {
|
||||
case "-follow" : followLinks = true; break;
|
||||
case "-printCycles" : printCycles = true; break;
|
||||
default:
|
||||
throw new RuntimeException(args[i] + " not recognized");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
Path dir = Paths.get(args[i]);
|
||||
|
||||
Set<FileVisitOption> options = new HashSet<FileVisitOption>();
|
||||
if (followLinks)
|
||||
options.add(FileVisitOption.FOLLOW_LINKS);
|
||||
|
||||
final boolean reportCycles = printCycles;
|
||||
Files.walkFileTree(dir, options, Integer.MAX_VALUE, new FileVisitor<FileRef>() {
|
||||
public FileVisitResult preVisitDirectory(FileRef dir) {
|
||||
System.out.println(dir);
|
||||
@ -59,7 +65,8 @@ public class PrintFileTree {
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
public FileVisitResult visitFile(FileRef file, BasicFileAttributes attrs) {
|
||||
System.out.println(file);
|
||||
if (!attrs.isDirectory() || reportCycles)
|
||||
System.out.println(file);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
public FileVisitResult postVisitDirectory(FileRef dir, IOException exc) {
|
||||
|
@ -61,12 +61,20 @@ find "$ROOT" > out2
|
||||
diff out1 out2
|
||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||
|
||||
# repeat test following links (use -follow instead of -L
|
||||
# to allow running on older systems)
|
||||
$JAVA PrintFileTree -L "$ROOT" > out1
|
||||
find "$ROOT" -follow > out2
|
||||
# repeat test following links. Some versions of find(1) output
|
||||
# cycles (sym links to ancestor directories), other versions do
|
||||
# not. For that reason we run PrintFileTree with the -printCycles
|
||||
# option when the output without this option differs to find(1).
|
||||
find "$ROOT" -follow > out1
|
||||
$JAVA PrintFileTree -follow "$ROOT" > out2
|
||||
diff out1 out2
|
||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||
if [ $? != 0 ];
|
||||
then
|
||||
# re-run printing cycles to stdout
|
||||
$JAVA PrintFileTree -follow -printCycles "$ROOT" > out2
|
||||
diff out1 out2
|
||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||
fi
|
||||
|
||||
# test SKIP_SIBLINGS
|
||||
$JAVA SkipSiblings "$ROOT"
|
||||
|
@ -197,7 +197,7 @@ public class CheckPermissions {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
Path dir = Paths.get(System.getProperty("test.src", "."));
|
||||
Path dir = Paths.get(System.getProperty("test.dir", "."));
|
||||
Path file = dir.resolve("file1234").createFile();
|
||||
try {
|
||||
LoggingSecurityManager.install();
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 4313887 6838333
|
||||
* @bug 4313887 6838333 6925932
|
||||
* @summary Unit test for java.nio.file.Path path operations
|
||||
*/
|
||||
|
||||
@ -614,17 +614,34 @@ public class PathOps {
|
||||
test("/foo")
|
||||
.ends("foo")
|
||||
.ends("/foo")
|
||||
.notEnds("/");
|
||||
.notEnds("fool");
|
||||
test("/foo/bar")
|
||||
.ends("bar")
|
||||
.ends("foo/bar")
|
||||
.ends("/foo/bar")
|
||||
.notEnds("/bar");
|
||||
.notEnds("ar")
|
||||
.notEnds("barack")
|
||||
.notEnds("/bar")
|
||||
.notEnds("o/bar");
|
||||
test("foo")
|
||||
.ends("foo");
|
||||
.ends("foo")
|
||||
.notEnds("oo")
|
||||
.notEnds("oola");
|
||||
test("foo/bar")
|
||||
.ends("bar")
|
||||
.ends("foo/bar");
|
||||
.ends("foo/bar")
|
||||
.notEnds("r")
|
||||
.notEnds("barmaid")
|
||||
.notEnds("/bar");
|
||||
test("foo/bar/gus")
|
||||
.ends("gus")
|
||||
.ends("bar/gus")
|
||||
.ends("foo/bar/gus")
|
||||
.notEnds("g")
|
||||
.notEnds("/gus")
|
||||
.notEnds("r/gus")
|
||||
.notEnds("barack/gus")
|
||||
.notEnds("bar/gust");
|
||||
|
||||
// elements
|
||||
test("a/b/c")
|
||||
|
222
jdk/test/java/nio/file/WatchService/LotsOfEvents.java
Normal file
222
jdk/test/java/nio/file/WatchService/LotsOfEvents.java
Normal file
@ -0,0 +1,222 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 6907760 6929532
|
||||
* @summary Tests WatchService behavior when lots of events are pending
|
||||
* @library ..
|
||||
* @run main/timeout=180 LotsOfEvents
|
||||
*/
|
||||
|
||||
import java.nio.file.*;
|
||||
import static java.nio.file.StandardWatchEventKind.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class LotsOfEvents {
|
||||
|
||||
static final Random rand = new Random();
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Path dir = TestUtil.createTemporaryDirectory();
|
||||
try {
|
||||
testOverflowEvent(dir);
|
||||
testModifyEventsQueuing(dir);
|
||||
} finally {
|
||||
TestUtil.removeAll(dir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that OVERFLOW events are not retreived with other events.
|
||||
*/
|
||||
static void testOverflowEvent(Path dir)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
WatchService watcher = dir.getFileSystem().newWatchService();
|
||||
try {
|
||||
dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE);
|
||||
|
||||
// create a lot of files
|
||||
int n = 1024;
|
||||
Path[] files = new Path[n];
|
||||
for (int i=0; i<n; i++) {
|
||||
files[i] = dir.resolve("foo" + i).createFile();
|
||||
}
|
||||
|
||||
// give time for events to accumulate (improve chance of overflow)
|
||||
Thread.sleep(1000);
|
||||
|
||||
// check that we see the create events (or overflow)
|
||||
drainAndCheckOverflowEvents(watcher, ENTRY_CREATE, n);
|
||||
|
||||
// delete the files
|
||||
for (int i=0; i<n; i++) {
|
||||
files[i].delete();
|
||||
}
|
||||
|
||||
// give time for events to accumulate (improve chance of overflow)
|
||||
Thread.sleep(1000);
|
||||
|
||||
// check that we see the delete events (or overflow)
|
||||
drainAndCheckOverflowEvents(watcher, ENTRY_DELETE, n);
|
||||
} finally {
|
||||
watcher.close();
|
||||
}
|
||||
}
|
||||
|
||||
static void drainAndCheckOverflowEvents(WatchService watcher,
|
||||
WatchEvent.Kind<?> expectedKind,
|
||||
int count)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
// wait for key to be signalled - the timeout is long to allow for
|
||||
// polling implementations
|
||||
WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
|
||||
if (key != null && count == 0)
|
||||
throw new RuntimeException("Key was signalled (unexpected)");
|
||||
if (key == null && count > 0)
|
||||
throw new RuntimeException("Key not signalled (unexpected)");
|
||||
|
||||
int nread = 0;
|
||||
boolean gotOverflow = false;
|
||||
while (key != null) {
|
||||
List<WatchEvent<?>> events = key.pollEvents();
|
||||
for (WatchEvent<?> event: events) {
|
||||
WatchEvent.Kind<?> kind = event.kind();
|
||||
if (kind == expectedKind) {
|
||||
// expected event kind
|
||||
if (++nread > count)
|
||||
throw new RuntimeException("More events than expected!!");
|
||||
} else if (kind == OVERFLOW) {
|
||||
// overflow event should not be retrieved with other events
|
||||
if (events.size() > 1)
|
||||
throw new RuntimeException("Overflow retrieved with other events");
|
||||
gotOverflow = true;
|
||||
} else {
|
||||
throw new RuntimeException("Unexpected event '" + kind + "'");
|
||||
}
|
||||
}
|
||||
if (!key.reset())
|
||||
throw new RuntimeException("Key is no longer valid");
|
||||
key = watcher.poll(2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
// check that all expected events were received or there was an overflow
|
||||
if (nread < count && !gotOverflow)
|
||||
throw new RuntimeException("Insufficient events");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that check that ENTRY_MODIFY events are queued efficiently
|
||||
*/
|
||||
static void testModifyEventsQueuing(Path dir)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
// this test uses a random number of files
|
||||
final int nfiles = 5 + rand.nextInt(10);
|
||||
DirectoryEntry[] entries = new DirectoryEntry[nfiles];
|
||||
for (int i=0; i<nfiles; i++) {
|
||||
entries[i] = new DirectoryEntry(dir.resolve("foo" + i));
|
||||
|
||||
// "some" of the files exist, some do not.
|
||||
entries[i].deleteIfExists();
|
||||
if (rand.nextBoolean())
|
||||
entries[i].create();
|
||||
}
|
||||
|
||||
WatchService watcher = dir.getFileSystem().newWatchService();
|
||||
try {
|
||||
dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
|
||||
|
||||
// do several rounds of noise and test
|
||||
for (int round=0; round<10; round++) {
|
||||
|
||||
// make some noise!!!
|
||||
for (int i=0; i<100; i++) {
|
||||
DirectoryEntry entry = entries[rand.nextInt(nfiles)];
|
||||
int action = rand.nextInt(10);
|
||||
switch (action) {
|
||||
case 0 : entry.create(); break;
|
||||
case 1 : entry.deleteIfExists(); break;
|
||||
default: entry.modifyIfExists();
|
||||
}
|
||||
}
|
||||
|
||||
// process events and ensure that we don't get repeated modify
|
||||
// events for the same file.
|
||||
WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
|
||||
while (key != null) {
|
||||
Set<Path> modified = new HashSet<Path>();
|
||||
for (WatchEvent<?> event: key.pollEvents()) {
|
||||
WatchEvent.Kind<?> kind = event.kind();
|
||||
Path file = (kind == OVERFLOW) ? null : (Path)event.context();
|
||||
if (kind == ENTRY_MODIFY) {
|
||||
boolean added = modified.add(file);
|
||||
if (!added) {
|
||||
throw new RuntimeException(
|
||||
"ENTRY_MODIFY events not queued efficiently");
|
||||
}
|
||||
} else {
|
||||
if (file != null) modified.remove(file);
|
||||
}
|
||||
}
|
||||
if (!key.reset())
|
||||
throw new RuntimeException("Key is no longer valid");
|
||||
key = watcher.poll(2, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
watcher.close();
|
||||
}
|
||||
}
|
||||
|
||||
static class DirectoryEntry {
|
||||
private final Path file;
|
||||
DirectoryEntry(Path file) {
|
||||
this.file = file;
|
||||
}
|
||||
void create() throws IOException {
|
||||
if (file.notExists())
|
||||
file.createFile();
|
||||
|
||||
}
|
||||
void deleteIfExists() throws IOException {
|
||||
file.deleteIfExists();
|
||||
}
|
||||
void modifyIfExists() throws IOException {
|
||||
if (file.exists()) {
|
||||
OutputStream out = file.newOutputStream(StandardOpenOption.APPEND);
|
||||
try {
|
||||
out.write("message".getBytes());
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 6907760
|
||||
* @summary Check that the OVERFLOW event is not retrieved with other events
|
||||
* @library ..
|
||||
*/
|
||||
|
||||
import java.nio.file.*;
|
||||
import static java.nio.file.StandardWatchEventKind.*;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class OverflowEventIsLoner {
|
||||
|
||||
static void drainEvents(WatchService watcher,
|
||||
WatchEvent.Kind<?> expectedKind,
|
||||
int count)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
// wait for key to be signalled - the timeout is long to allow for
|
||||
// polling implementations
|
||||
WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
|
||||
if (key != null && count == 0)
|
||||
throw new RuntimeException("Key was signalled (unexpected)");
|
||||
if (key == null && count > 0)
|
||||
throw new RuntimeException("Key not signalled (unexpected)");
|
||||
|
||||
int nread = 0;
|
||||
boolean gotOverflow = false;
|
||||
do {
|
||||
List<WatchEvent<?>> events = key.pollEvents();
|
||||
for (WatchEvent<?> event: events) {
|
||||
WatchEvent.Kind<?> kind = event.kind();
|
||||
if (kind == expectedKind) {
|
||||
// expected event kind
|
||||
if (++nread > count)
|
||||
throw new RuntimeException("More events than expected!!");
|
||||
} else if (kind == OVERFLOW) {
|
||||
// overflow event should not be retrieved with other events
|
||||
if (events.size() > 1)
|
||||
throw new RuntimeException("Overflow retrieved with other events");
|
||||
gotOverflow = true;
|
||||
} else {
|
||||
throw new RuntimeException("Unexpected event '" + kind + "'");
|
||||
}
|
||||
}
|
||||
if (!key.reset())
|
||||
throw new RuntimeException("Key is no longer valid");
|
||||
key = watcher.poll(2, TimeUnit.SECONDS);
|
||||
} while (key != null);
|
||||
|
||||
// check that all expected events were received or there was an overflow
|
||||
if (nread < count && !gotOverflow)
|
||||
throw new RuntimeException("Insufficient events");
|
||||
}
|
||||
|
||||
|
||||
static void test(Path dir) throws IOException, InterruptedException {
|
||||
WatchService watcher = dir.getFileSystem().newWatchService();
|
||||
try {
|
||||
WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE);
|
||||
|
||||
// create a lot of files
|
||||
int n = 1024;
|
||||
Path[] files = new Path[n];
|
||||
for (int i=0; i<n; i++) {
|
||||
files[i] = dir.resolve("foo" + i).createFile();
|
||||
}
|
||||
|
||||
// give time for events to accumulate (improve chance of overflow)
|
||||
Thread.sleep(1000);
|
||||
|
||||
// check that we see the create events (or overflow)
|
||||
drainEvents(watcher, ENTRY_CREATE, n);
|
||||
|
||||
// delete the files
|
||||
for (int i=0; i<n; i++) {
|
||||
files[i].delete();
|
||||
}
|
||||
|
||||
// give time for events to accumulate (improve chance of overflow)
|
||||
Thread.sleep(1000);
|
||||
|
||||
// check that we see the delete events (or overflow)
|
||||
drainEvents(watcher, ENTRY_DELETE, n);
|
||||
} finally {
|
||||
watcher.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Path dir = TestUtil.createTemporaryDirectory();
|
||||
try {
|
||||
test(dir);
|
||||
} finally {
|
||||
TestUtil.removeAll(dir);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6921001
|
||||
* @summary The default system identity scope is now null.
|
||||
*/
|
||||
import java.security.*;
|
||||
|
||||
public class NoDefaultSystemScope {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
IdentityScope s = IdentityScope.getSystemScope();
|
||||
|
||||
if (s != null) {
|
||||
throw new Exception("The default system scope should be null");
|
||||
}
|
||||
System.out.println("TEST PASSED");
|
||||
}
|
||||
}
|
||||
|
50
jdk/test/sun/security/krb5/etype/WeakCrypto.java
Normal file
50
jdk/test/sun/security/krb5/etype/WeakCrypto.java
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
/*
|
||||
* @test
|
||||
* @bug 6844909
|
||||
* @run main/othervm WeakCrypto
|
||||
* @summary support allow_weak_crypto in krb5.conf
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import sun.security.krb5.internal.crypto.EType;
|
||||
import sun.security.krb5.EncryptedData;
|
||||
|
||||
public class WeakCrypto {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.setProperty("java.security.krb5.conf",
|
||||
System.getProperty("test.src", ".") +
|
||||
File.separator +
|
||||
"weakcrypto.conf");
|
||||
int[] etypes = EType.getBuiltInDefaults();
|
||||
|
||||
for (int i=0, length = etypes.length; i<length; i++) {
|
||||
if (etypes[i] == EncryptedData.ETYPE_DES_CBC_CRC ||
|
||||
etypes[i] == EncryptedData.ETYPE_DES_CBC_MD4 ||
|
||||
etypes[i] == EncryptedData.ETYPE_DES_CBC_MD5) {
|
||||
throw new Exception("DES should not appear");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2
jdk/test/sun/security/krb5/etype/weakcrypto.conf
Normal file
2
jdk/test/sun/security/krb5/etype/weakcrypto.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[libdefaults]
|
||||
allow_weak_crypto = false
|
Loading…
Reference in New Issue
Block a user