1.1 --- a/make/common/shared/Sanity.gmk Tue Mar 09 15:28:09 2010 -0800
1.2 +++ b/make/common/shared/Sanity.gmk Tue Mar 09 15:29:13 2010 -0800
1.3 @@ -687,13 +687,13 @@
1.4 ######################################################
1.5 sane-alt_outputdir:
1.6 ifdef ALT_OUTPUTDIR
1.7 - @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
1.8 + @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
1.9 $(ECHO) "ERROR: ALT_OUTPUTDIR must be an Absolute Path Name, \n" \
1.10 " not a Relative Path Name. \n" \
1.11 "" >> $(ERROR_FILE) ; \
1.12 fi
1.13 ifeq ($(PLATFORM), windows)
1.14 - @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -ci '^([a-z]:)'` -ne 1 ]; then \
1.15 + @if [ `$(ECHO) $(subst \,/,$(ALT_OUTPUTDIR)) | $(EGREP) -c '^([A-Za-z]:)'` -ne 1 ]; then \
1.16 $(ECHO) "ERROR: On windows, ALT_OUTPUTDIR must contain the drive letter. \n" \
1.17 "" >> $(ERROR_FILE) ; \
1.18 fi
1.19 @@ -742,7 +742,7 @@
1.20 ######################################################
1.21 sane-alt_bootdir:
1.22 ifdef ALT_BOOTDIR
1.23 - @if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
1.24 + @if [ `$(ECHO) $(subst \,/,$(ALT_BOOTDIR)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
1.25 $(ECHO) "ERROR: ALT_BOOTDIR must be an Absolute Path Name, \n" \
1.26 " not a Relative Path Name. \n" \
1.27 " The current value of ALT_BOOTDIR is \n" \
1.28 @@ -772,7 +772,7 @@
1.29 ######################################################
1.30 sane-local-bootdir:
1.31 ifeq ($(PLATFORM), windows)
1.32 - @if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -ci '^J:'` -ne 0 ]; then \
1.33 + @if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -c '^[jJ]:'` -ne 0 ]; then \
1.34 $(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
1.35 " drive is mapped over a network. Using a mapped drive for\n" \
1.36 " the BOOTDIR may significantly slow down the build process.\n" \
1.37 @@ -789,7 +789,7 @@
1.38 ######################################################
1.39 sane-cacerts:
1.40 ifdef ALT_CACERTS_FILE
1.41 - @if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
1.42 + @if [ `$(ECHO) $(subst \,/,$(ALT_CACERTS_FILE)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
1.43 $(ECHO) "ERROR: ALT_CACERTS_FILE must be an Absolute Path Name, \n" \
1.44 " not a Relative Path Name. \n" \
1.45 " The current value of ALT_CACERTS_FILE is \n" \
1.46 @@ -1538,7 +1538,7 @@
1.47 sane-mozilla:
1.48 ifeq ($(ARCH_DATA_MODEL), 32)
1.49 ifdef ALT_MOZILLA_HEADERS_PATH
1.50 - @if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
1.51 + @if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -c '^([A-Za-z]:)?/'` -ne 1 ]; then \
1.52 $(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
1.53 " not a Relative Path Name. \n" \
1.54 " The current value of ALT_MOZILLA_HEADERS_PATH is \n" \
2.1 --- a/make/modules/tools/Makefile Tue Mar 09 15:28:09 2010 -0800
2.2 +++ b/make/modules/tools/Makefile Tue Mar 09 15:29:13 2010 -0800
2.3 @@ -135,9 +135,8 @@
2.4
2.5 $(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class)
2.6 @$(prep-target)
2.7 - $(CD) $(BUILDTOOLCLASSDIR) && \
2.8 - $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
2.9 - $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
2.10 + $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
2.11 + -C $(BUILDTOOLCLASSDIR) $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
2.12 @$(java-vm-cleanup)
2.13
2.14 $(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class)
3.1 --- a/src/share/classes/com/sun/jndi/ldap/Filter.java Tue Mar 09 15:28:09 2010 -0800
3.2 +++ b/src/share/classes/com/sun/jndi/ldap/Filter.java Tue Mar 09 15:29:13 2010 -0800
3.3 @@ -1,5 +1,5 @@
3.4 /*
3.5 - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
3.6 + * Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved.
3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3.8 *
3.9 * This code is free software; you can redistribute it and/or modify it
3.10 @@ -33,6 +33,7 @@
3.11 /**
3.12 * LDAP (RFC-1960) and LDAPv3 (RFC-2254) search filters.
3.13 *
3.14 + * @author Xuelei Fan
3.15 * @author Vincent Ryan
3.16 * @author Jagane Sundar
3.17 * @author Rosanna Lee
3.18 @@ -258,7 +259,7 @@
3.19 byte[] answer = new byte[j];
3.20 System.arraycopy(tbuf, 0, answer, 0, j);
3.21 if (dbg) {
3.22 - Ber.dumpBER(System.err, null, answer, 0, j);
3.23 + Ber.dumpBER(System.err, "", answer, 0, j);
3.24 }
3.25 return answer;
3.26 }
3.27 @@ -330,7 +331,7 @@
3.28 }
3.29
3.30
3.31 - valueStart = eq + 1; // value starts after equal sign
3.32 + valueStart = eq + 1; // value starts after equal sign
3.33 valueEnd = filtEnd;
3.34 typeStart = filtStart; // beginning of string
3.35
3.36 @@ -355,20 +356,199 @@
3.37 break;
3.38 default:
3.39 typeEnd = eq;
3.40 + //initializing ftype to make the compiler happy
3.41 + ftype = 0x00;
3.42 + break;
3.43 + }
3.44 +
3.45 + if (dbg) {
3.46 + System.err.println("type: " + typeStart + ", " + typeEnd);
3.47 + System.err.println("value: " + valueStart + ", " + valueEnd);
3.48 + }
3.49 +
3.50 + // check validity of type
3.51 + //
3.52 + // RFC4512 defines the type as the following ABNF:
3.53 + // attr = attributedescription
3.54 + // attributedescription = attributetype options
3.55 + // attributetype = oid
3.56 + // oid = descr / numericoid
3.57 + // descr = keystring
3.58 + // keystring = leadkeychar *keychar
3.59 + // leadkeychar = ALPHA
3.60 + // keychar = ALPHA / DIGIT / HYPHEN
3.61 + // numericoid = number 1*( DOT number )
3.62 + // number = DIGIT / ( LDIGIT 1*DIGIT )
3.63 + // options = *( SEMI option )
3.64 + // option = 1*keychar
3.65 + //
3.66 + // And RFC4515 defines the extensible type as the following ABNF:
3.67 + // attr [dnattrs] [matchingrule] / [dnattrs] matchingrule
3.68 + int optionsStart = -1;
3.69 + int extensibleStart = -1;
3.70 + if ((filter[typeStart] >= '0' && filter[typeStart] <= '9') ||
3.71 + (filter[typeStart] >= 'A' && filter[typeStart] <= 'Z') ||
3.72 + (filter[typeStart] >= 'a' && filter[typeStart] <= 'z')) {
3.73 +
3.74 + boolean isNumericOid =
3.75 + filter[typeStart] >= '0' && filter[typeStart] <= '9';
3.76 + for (int i = typeStart + 1; i < typeEnd; i++) {
3.77 + // ';' is an indicator of attribute options
3.78 + if (filter[i] == ';') {
3.79 + if (isNumericOid && filter[i - 1] == '.') {
3.80 + throw new InvalidSearchFilterException(
3.81 + "invalid attribute description");
3.82 + }
3.83 +
3.84 + // attribute options
3.85 + optionsStart = i;
3.86 + break;
3.87 + }
3.88 +
3.89 + // ':' is an indicator of extensible rules
3.90 + if (filter[i] == ':' && ftype == LDAP_FILTER_EXT) {
3.91 + if (isNumericOid && filter[i - 1] == '.') {
3.92 + throw new InvalidSearchFilterException(
3.93 + "invalid attribute description");
3.94 + }
3.95 +
3.96 + // extensible matching
3.97 + extensibleStart = i;
3.98 + break;
3.99 + }
3.100 +
3.101 + if (isNumericOid) {
3.102 + // numeric object identifier
3.103 + if ((filter[i] == '.' && filter[i - 1] == '.') ||
3.104 + (filter[i] != '.' &&
3.105 + !(filter[i] >= '0' && filter[i] <= '9'))) {
3.106 + throw new InvalidSearchFilterException(
3.107 + "invalid attribute description");
3.108 + }
3.109 + } else {
3.110 + // descriptor
3.111 + if (filter[i] != '-' &&
3.112 + !(filter[i] >= '0' && filter[i] <= '9') &&
3.113 + !(filter[i] >= 'A' && filter[i] <= 'Z') &&
3.114 + !(filter[i] >= 'a' && filter[i] <= 'z')) {
3.115 + throw new InvalidSearchFilterException(
3.116 + "invalid attribute description");
3.117 + }
3.118 + }
3.119 + }
3.120 + } else if (ftype == LDAP_FILTER_EXT && filter[typeStart] == ':') {
3.121 + // extensible matching
3.122 + extensibleStart = typeStart;
3.123 + } else {
3.124 + throw new InvalidSearchFilterException(
3.125 + "invalid attribute description");
3.126 + }
3.127 +
3.128 + // check attribute options
3.129 + if (optionsStart > 0) {
3.130 + for (int i = optionsStart + 1; i < typeEnd; i++) {
3.131 + if (filter[i] == ';') {
3.132 + if (filter[i - 1] == ';') {
3.133 + throw new InvalidSearchFilterException(
3.134 + "invalid attribute description");
3.135 + }
3.136 + continue;
3.137 + }
3.138 +
3.139 + // ':' is an indicator of extensible rules
3.140 + if (filter[i] == ':' && ftype == LDAP_FILTER_EXT) {
3.141 + if (filter[i - 1] == ';') {
3.142 + throw new InvalidSearchFilterException(
3.143 + "invalid attribute description");
3.144 + }
3.145 +
3.146 + // extensible matching
3.147 + extensibleStart = i;
3.148 + break;
3.149 + }
3.150 +
3.151 + if (filter[i] != '-' &&
3.152 + !(filter[i] >= '0' && filter[i] <= '9') &&
3.153 + !(filter[i] >= 'A' && filter[i] <= 'Z') &&
3.154 + !(filter[i] >= 'a' && filter[i] <= 'z')) {
3.155 + throw new InvalidSearchFilterException(
3.156 + "invalid attribute description");
3.157 + }
3.158 + }
3.159 + }
3.160 +
3.161 + // check extensible matching
3.162 + if (extensibleStart > 0) {
3.163 + boolean isMatchingRule = false;
3.164 + for (int i = extensibleStart + 1; i < typeEnd; i++) {
3.165 + if (filter[i] == ':') {
3.166 + throw new InvalidSearchFilterException(
3.167 + "invalid attribute description");
3.168 + } else if ((filter[i] >= '0' && filter[i] <= '9') ||
3.169 + (filter[i] >= 'A' && filter[i] <= 'Z') ||
3.170 + (filter[i] >= 'a' && filter[i] <= 'z')) {
3.171 + boolean isNumericOid = filter[i] >= '0' && filter[i] <= '9';
3.172 + i++;
3.173 + for (int j = i; j < typeEnd; j++, i++) {
3.174 + // allows no more than two extensible rules
3.175 + if (filter[j] == ':') {
3.176 + if (isMatchingRule) {
3.177 + throw new InvalidSearchFilterException(
3.178 + "invalid attribute description");
3.179 + }
3.180 + if (isNumericOid && filter[j - 1] == '.') {
3.181 + throw new InvalidSearchFilterException(
3.182 + "invalid attribute description");
3.183 + }
3.184 +
3.185 + isMatchingRule = true;
3.186 + break;
3.187 + }
3.188 +
3.189 + if (isNumericOid) {
3.190 + // numeric object identifier
3.191 + if ((filter[j] == '.' && filter[j - 1] == '.') ||
3.192 + (filter[j] != '.' &&
3.193 + !(filter[j] >= '0' && filter[j] <= '9'))) {
3.194 + throw new InvalidSearchFilterException(
3.195 + "invalid attribute description");
3.196 + }
3.197 + } else {
3.198 + // descriptor
3.199 + if (filter[j] != '-' &&
3.200 + !(filter[j] >= '0' && filter[j] <= '9') &&
3.201 + !(filter[j] >= 'A' && filter[j] <= 'Z') &&
3.202 + !(filter[j] >= 'a' && filter[j] <= 'z')) {
3.203 + throw new InvalidSearchFilterException(
3.204 + "invalid attribute description");
3.205 + }
3.206 + }
3.207 + }
3.208 + } else {
3.209 + throw new InvalidSearchFilterException(
3.210 + "invalid attribute description");
3.211 + }
3.212 + }
3.213 + }
3.214 +
3.215 + // ensure the latest byte is not isolated
3.216 + if (filter[typeEnd - 1] == '.' || filter[typeEnd - 1] == ';' ||
3.217 + filter[typeEnd - 1] == ':') {
3.218 + throw new InvalidSearchFilterException(
3.219 + "invalid attribute description");
3.220 + }
3.221 +
3.222 + if (typeEnd == eq) { // filter type is of "equal"
3.223 if (findUnescaped(filter, '*', valueStart, valueEnd) == -1) {
3.224 ftype = LDAP_FILTER_EQUALITY;
3.225 - } else if (filter[valueStart] == '*' && valueStart == (valueEnd - 1)) {
3.226 + } else if (filter[valueStart] == '*' &&
3.227 + valueStart == (valueEnd - 1)) {
3.228 ftype = LDAP_FILTER_PRESENT;
3.229 } else {
3.230 encodeSubstringFilter(ber, filter,
3.231 typeStart, typeEnd, valueStart, valueEnd);
3.232 return;
3.233 }
3.234 - break;
3.235 - }
3.236 - if (dbg) {
3.237 - System.err.println("type: " + typeStart + ", " + typeEnd);
3.238 - System.err.println("value: " + valueStart + ", " + valueEnd);
3.239 }
3.240
3.241 if (ftype == LDAP_FILTER_PRESENT) {
3.242 @@ -379,7 +559,7 @@
3.243 } else {
3.244 ber.beginSeq(ftype);
3.245 ber.encodeOctetString(filter, Ber.ASN_OCTET_STR,
3.246 - typeStart, typeEnd-typeStart);
3.247 + typeStart, typeEnd - typeStart);
3.248 ber.encodeOctetString(
3.249 unescapeFilterValue(filter, valueStart, valueEnd),
3.250 Ber.ASN_OCTET_STR);
3.251 @@ -623,7 +803,8 @@
3.252 //
3.253 ////////////////////////////////////////////////////////////////////////////
3.254
3.255 - private static final boolean dbg = false;
3.256 + // private static final boolean dbg = false;
3.257 + private static final boolean dbg = true;
3.258 private static int dbgIndent = 0;
3.259
3.260 private static void dprint(String msg) {
4.1 --- a/src/share/classes/java/lang/Iterable.java Tue Mar 09 15:28:09 2010 -0800
4.2 +++ b/src/share/classes/java/lang/Iterable.java Tue Mar 09 15:29:13 2010 -0800
4.3 @@ -27,8 +27,12 @@
4.4
4.5 import java.util.Iterator;
4.6
4.7 -/** Implementing this interface allows an object to be the target of
4.8 - * the "foreach" statement.
4.9 +/**
4.10 + * Implementing this interface allows an object to be the target of
4.11 + * the "foreach" statement.
4.12 + *
4.13 + * @param <T> the type of elements returned by the iterator
4.14 + *
4.15 * @since 1.5
4.16 */
4.17 public interface Iterable<T> {
5.1 --- a/src/share/classes/java/lang/String.java Tue Mar 09 15:28:09 2010 -0800
5.2 +++ b/src/share/classes/java/lang/String.java Tue Mar 09 15:29:13 2010 -0800
5.3 @@ -1492,7 +1492,7 @@
5.4 */
5.5 public int hashCode() {
5.6 int h = hash;
5.7 - if (h == 0) {
5.8 + if (h == 0 && count > 0) {
5.9 int off = offset;
5.10 char val[] = value;
5.11 int len = count;
6.1 --- a/src/share/classes/java/security/IdentityScope.java Tue Mar 09 15:28:09 2010 -0800
6.2 +++ b/src/share/classes/java/security/IdentityScope.java Tue Mar 09 15:29:13 2010 -0800
6.3 @@ -129,7 +129,8 @@
6.4 /**
6.5 * Returns the system's identity scope.
6.6 *
6.7 - * @return the system's identity scope.
6.8 + * @return the system's identity scope, or {@code null} if none has been
6.9 + * set.
6.10 *
6.11 * @see #setSystemScope
6.12 */
7.1 --- a/src/share/classes/java/util/Collection.java Tue Mar 09 15:28:09 2010 -0800
7.2 +++ b/src/share/classes/java/util/Collection.java Tue Mar 09 15:29:13 2010 -0800
7.3 @@ -103,6 +103,8 @@
7.4 * <a href="{@docRoot}/../technotes/guides/collections/index.html">
7.5 * Java Collections Framework</a>.
7.6 *
7.7 + * @param <E> the type of elements in this collection
7.8 + *
7.9 * @author Josh Bloch
7.10 * @author Neal Gafter
7.11 * @see Set
8.1 --- a/src/share/classes/java/util/DualPivotQuicksort.java Tue Mar 09 15:28:09 2010 -0800
8.2 +++ b/src/share/classes/java/util/DualPivotQuicksort.java Tue Mar 09 15:29:13 2010 -0800
8.3 @@ -253,7 +253,7 @@
8.4 a[less] = ak;
8.5 }
8.6 less++;
8.7 - } else { // (a[k] > pivot1) - Move a[k] to right part
8.8 + } else { // (a[k] > pivot1) - Move a[k] to right part
8.9 /*
8.10 * We know that pivot1 == a[e3] == pivot2. Thus, we know
8.11 * that great will still be >= k when the following loop
8.12 @@ -531,7 +531,7 @@
8.13 a[less] = ak;
8.14 }
8.15 less++;
8.16 - } else { // (a[k] > pivot1) - Move a[k] to right part
8.17 + } else { // (a[k] > pivot1) - Move a[k] to right part
8.18 /*
8.19 * We know that pivot1 == a[e3] == pivot2. Thus, we know
8.20 * that great will still be >= k when the following loop
8.21 @@ -826,7 +826,7 @@
8.22 a[less] = ak;
8.23 }
8.24 less++;
8.25 - } else { // (a[k] > pivot1) - Move a[k] to right part
8.26 + } else { // (a[k] > pivot1) - Move a[k] to right part
8.27 /*
8.28 * We know that pivot1 == a[e3] == pivot2. Thus, we know
8.29 * that great will still be >= k when the following loop
8.30 @@ -1119,7 +1119,7 @@
8.31 a[less] = ak;
8.32 }
8.33 less++;
8.34 - } else { // (a[k] > pivot1) - Move a[k] to right part
8.35 + } else { // (a[k] > pivot1) - Move a[k] to right part
8.36 /*
8.37 * We know that pivot1 == a[e3] == pivot2. Thus, we know
8.38 * that great will still be >= k when the following loop
8.39 @@ -1414,7 +1414,7 @@
8.40 a[less] = ak;
8.41 }
8.42 less++;
8.43 - } else { // (a[k] > pivot1) - Move a[k] to right part
8.44 + } else { // (a[k] > pivot1) - Move a[k] to right part
8.45 /*
8.46 * We know that pivot1 == a[e3] == pivot2. Thus, we know
8.47 * that great will still be >= k when the following loop
8.48 @@ -1531,7 +1531,7 @@
8.49 * Sorts the specified range of the array into ascending order. The range
8.50 * to be sorted extends from the index {@code fromIndex}, inclusive, to
8.51 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
8.52 - * the range to be sorted is empty and the call is a no-op).
8.53 + * the range to be sorted is empty and the call is a no-op).
8.54 *
8.55 * <p>The {@code <} relation does not provide a total order on all float
8.56 * values: {@code -0.0f == 0.0f} is {@code true} and a {@code Float.NaN}
8.57 @@ -1787,7 +1787,7 @@
8.58 a[less] = ak;
8.59 }
8.60 less++;
8.61 - } else { // (a[k] > pivot1) - Move a[k] to right part
8.62 + } else { // (a[k] > pivot1) - Move a[k] to right part
8.63 /*
8.64 * We know that pivot1 == a[e3] == pivot2. Thus, we know
8.65 * that great will still be >= k when the following loop
8.66 @@ -2160,7 +2160,7 @@
8.67 a[less] = ak;
8.68 }
8.69 less++;
8.70 - } else { // (a[k] > pivot1) - Move a[k] to right part
8.71 + } else { // (a[k] > pivot1) - Move a[k] to right part
8.72 /*
8.73 * We know that pivot1 == a[e3] == pivot2. Thus, we know
8.74 * that great will still be >= k when the following loop
9.1 --- a/src/share/classes/java/util/Iterator.java Tue Mar 09 15:28:09 2010 -0800
9.2 +++ b/src/share/classes/java/util/Iterator.java Tue Mar 09 15:29:13 2010 -0800
9.3 @@ -41,6 +41,8 @@
9.4 * <a href="{@docRoot}/../technotes/guides/collections/index.html">
9.5 * Java Collections Framework</a>.
9.6 *
9.7 + * @param <E> the type of elements returned by this iterator
9.8 + *
9.9 * @author Josh Bloch
9.10 * @see Collection
9.11 * @see ListIterator
10.1 --- a/src/share/classes/java/util/List.java Tue Mar 09 15:28:09 2010 -0800
10.2 +++ b/src/share/classes/java/util/List.java Tue Mar 09 15:29:13 2010 -0800
10.3 @@ -89,6 +89,8 @@
10.4 * <a href="{@docRoot}/../technotes/guides/collections/index.html">
10.5 * Java Collections Framework</a>.
10.6 *
10.7 + * @param <E> the type of elements in this list
10.8 + *
10.9 * @author Josh Bloch
10.10 * @author Neal Gafter
10.11 * @see Collection
11.1 --- a/src/share/classes/sun/nio/fs/AbstractWatchKey.java Tue Mar 09 15:28:09 2010 -0800
11.2 +++ b/src/share/classes/sun/nio/fs/AbstractWatchKey.java Tue Mar 09 15:29:13 2010 -0800
11.3 @@ -59,10 +59,15 @@
11.4 // pending events
11.5 private List<WatchEvent<?>> events;
11.6
11.7 + // maps a context to the last event for the context (iff the last queued
11.8 + // event for the context is an ENTRY_MODIFY event).
11.9 + private Map<Object,WatchEvent<?>> lastModifyEvents;
11.10 +
11.11 protected AbstractWatchKey(AbstractWatchService watcher) {
11.12 this.watcher = watcher;
11.13 this.state = State.READY;
11.14 this.events = new ArrayList<WatchEvent<?>>();
11.15 + this.lastModifyEvents = new HashMap<Object,WatchEvent<?>>();
11.16 }
11.17
11.18 final AbstractWatchService watcher() {
11.19 @@ -86,6 +91,7 @@
11.20 */
11.21 @SuppressWarnings("unchecked")
11.22 final void signalEvent(WatchEvent.Kind<?> kind, Object context) {
11.23 + boolean isModify = (kind == StandardWatchEventKind.ENTRY_MODIFY);
11.24 synchronized (this) {
11.25 int size = events.size();
11.26 if (size > 0) {
11.27 @@ -100,17 +106,43 @@
11.28 return;
11.29 }
11.30
11.31 + // if this is a modify event and the last entry for the context
11.32 + // is a modify event then we simply increment the count
11.33 + if (!lastModifyEvents.isEmpty()) {
11.34 + if (isModify) {
11.35 + WatchEvent<?> ev = lastModifyEvents.get(context);
11.36 + if (ev != null) {
11.37 + assert ev.kind() == StandardWatchEventKind.ENTRY_MODIFY;
11.38 + ((Event<?>)ev).increment();
11.39 + return;
11.40 + }
11.41 + } else {
11.42 + // not a modify event so remove from the map as the
11.43 + // last event will no longer be a modify event.
11.44 + lastModifyEvents.remove(context);
11.45 + }
11.46 + }
11.47 +
11.48 // if the list has reached the limit then drop pending events
11.49 // and queue an OVERFLOW event
11.50 if (size >= MAX_EVENT_LIST_SIZE) {
11.51 - events.clear();
11.52 kind = StandardWatchEventKind.OVERFLOW;
11.53 + isModify = false;
11.54 context = null;
11.55 }
11.56 }
11.57
11.58 // non-repeated event
11.59 - events.add(new Event<Object>((WatchEvent.Kind<Object>)kind, context));
11.60 + Event<Object> ev =
11.61 + new Event<Object>((WatchEvent.Kind<Object>)kind, context);
11.62 + if (isModify) {
11.63 + lastModifyEvents.put(context, ev);
11.64 + } else if (kind == StandardWatchEventKind.OVERFLOW) {
11.65 + // drop all pending events
11.66 + events.clear();
11.67 + lastModifyEvents.clear();
11.68 + }
11.69 + events.add(ev);
11.70 signal();
11.71 }
11.72 }
11.73 @@ -120,6 +152,7 @@
11.74 synchronized (this) {
11.75 List<WatchEvent<?>> result = events;
11.76 events = new ArrayList<WatchEvent<?>>();
11.77 + lastModifyEvents.clear();
11.78 return result;
11.79 }
11.80 }
12.1 --- a/src/share/classes/sun/security/krb5/internal/crypto/EType.java Tue Mar 09 15:28:09 2010 -0800
12.2 +++ b/src/share/classes/sun/security/krb5/internal/crypto/EType.java Tue Mar 09 15:29:13 2010 -0800
12.3 @@ -1,5 +1,5 @@
12.4 /*
12.5 - * Portions Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
12.6 + * Portions Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12.8 *
12.9 * This code is free software; you can redistribute it and/or modify it
12.10 @@ -36,9 +36,9 @@
12.11 import sun.security.krb5.EncryptedData;
12.12 import sun.security.krb5.EncryptionKey;
12.13 import sun.security.krb5.KrbException;
12.14 -import sun.security.krb5.Asn1Exception;
12.15 import sun.security.krb5.KrbCryptoException;
12.16 import javax.crypto.*;
12.17 +import java.util.Arrays;
12.18 import java.util.List;
12.19 import java.util.ArrayList;
12.20
12.21 @@ -48,6 +48,23 @@
12.22 public abstract class EType {
12.23
12.24 private static final boolean DEBUG = Krb5.DEBUG;
12.25 + private static final boolean ALLOW_WEAK_CRYPTO;
12.26 +
12.27 + static {
12.28 + boolean allowed = true;
12.29 + try {
12.30 + Config cfg = Config.getInstance();
12.31 + String temp = cfg.getDefault("allow_weak_crypto", "libdefaults");
12.32 + if (temp != null && temp.equals("false")) allowed = false;
12.33 + } catch (Exception exc) {
12.34 + if (DEBUG) {
12.35 + System.out.println ("Exception in getting allow_weak_crypto, " +
12.36 + "using default value " +
12.37 + exc.getMessage());
12.38 + }
12.39 + }
12.40 + ALLOW_WEAK_CRYPTO = allowed;
12.41 + }
12.42
12.43 public static EType getInstance (int eTypeConst)
12.44 throws KdcErrException {
12.45 @@ -163,6 +180,10 @@
12.46 return result;
12.47 }
12.48
12.49 + // Note: the first 2 entries of BUILTIN_ETYPES and BUILTIN_ETYPES_NOAES256
12.50 + // should be kept DES-related. They will be removed when allow_weak_crypto
12.51 + // is set to false.
12.52 +
12.53 private static final int[] BUILTIN_ETYPES = new int[] {
12.54 EncryptedData.ETYPE_DES_CBC_MD5,
12.55 EncryptedData.ETYPE_DES_CBC_CRC,
12.56 @@ -189,10 +210,17 @@
12.57 } catch (Exception e) {
12.58 // should not happen
12.59 }
12.60 + int[] result;
12.61 if (allowed < 256) {
12.62 - return BUILTIN_ETYPES_NOAES256;
12.63 + result = BUILTIN_ETYPES_NOAES256;
12.64 + } else {
12.65 + result = BUILTIN_ETYPES;
12.66 }
12.67 - return BUILTIN_ETYPES;
12.68 + if (!ALLOW_WEAK_CRYPTO) {
12.69 + // The first 2 etypes are now weak ones
12.70 + return Arrays.copyOfRange(result, 2, result.length);
12.71 + }
12.72 + return result;
12.73 }
12.74
12.75 /**
12.76 @@ -207,9 +235,7 @@
12.77 if (DEBUG) {
12.78 System.out.println("Exception while getting " +
12.79 configName + exc.getMessage());
12.80 - System.out.println("Using defaults " +
12.81 - "des-cbc-md5, des-cbc-crc, des3-cbc-sha1," +
12.82 - " aes128cts, aes256cts, rc4-hmac");
12.83 + System.out.println("Using default builtin etypes");
12.84 }
12.85 return getBuiltInDefaults();
12.86 }
13.1 --- a/src/share/classes/sun/security/provider/JavaKeyStore.java Tue Mar 09 15:28:09 2010 -0800
13.2 +++ b/src/share/classes/sun/security/provider/JavaKeyStore.java Tue Mar 09 15:29:13 2010 -0800
13.3 @@ -29,9 +29,9 @@
13.4 import java.security.*;
13.5 import java.security.cert.Certificate;
13.6 import java.security.cert.CertificateFactory;
13.7 -import java.security.cert.X509Certificate;
13.8 import java.security.cert.CertificateException;
13.9 import java.util.*;
13.10 +import sun.misc.IOUtils;
13.11
13.12 import sun.security.pkcs.EncryptedPrivateKeyInfo;
13.13
13.14 @@ -677,50 +677,39 @@
13.15 entry.date = new Date(dis.readLong());
13.16
13.17 // Read the private key
13.18 - try {
13.19 - entry.protectedPrivKey = new byte[dis.readInt()];
13.20 - } catch (OutOfMemoryError e) {
13.21 - throw new IOException("Keysize too big");
13.22 - }
13.23 - dis.readFully(entry.protectedPrivKey);
13.24 + entry.protectedPrivKey =
13.25 + IOUtils.readFully(dis, dis.readInt(), true);
13.26
13.27 // Read the certificate chain
13.28 int numOfCerts = dis.readInt();
13.29 - try {
13.30 - if (numOfCerts > 0) {
13.31 - entry.chain = new Certificate[numOfCerts];
13.32 + if (numOfCerts > 0) {
13.33 + List<Certificate> certs = new ArrayList<>(
13.34 + numOfCerts > 10 ? 10 : numOfCerts);
13.35 + for (int j = 0; j < numOfCerts; j++) {
13.36 + if (xVersion == 2) {
13.37 + // read the certificate type, and instantiate a
13.38 + // certificate factory of that type (reuse
13.39 + // existing factory if possible)
13.40 + String certType = dis.readUTF();
13.41 + if (cfs.containsKey(certType)) {
13.42 + // reuse certificate factory
13.43 + cf = cfs.get(certType);
13.44 + } else {
13.45 + // create new certificate factory
13.46 + cf = CertificateFactory.getInstance(certType);
13.47 + // store the certificate factory so we can
13.48 + // reuse it later
13.49 + cfs.put(certType, cf);
13.50 + }
13.51 + }
13.52 + // instantiate the certificate
13.53 + encoded = IOUtils.readFully(dis, dis.readInt(), true);
13.54 + bais = new ByteArrayInputStream(encoded);
13.55 + certs.add(cf.generateCertificate(bais));
13.56 + bais.close();
13.57 }
13.58 - } catch (OutOfMemoryError e) {
13.59 - throw new IOException
13.60 - ("Too many certificates in chain");
13.61 - }
13.62 - for (int j = 0; j < numOfCerts; j++) {
13.63 - if (xVersion == 2) {
13.64 - // read the certificate type, and instantiate a
13.65 - // certificate factory of that type (reuse
13.66 - // existing factory if possible)
13.67 - String certType = dis.readUTF();
13.68 - if (cfs.containsKey(certType)) {
13.69 - // reuse certificate factory
13.70 - cf = cfs.get(certType);
13.71 - } else {
13.72 - // create new certificate factory
13.73 - cf = CertificateFactory.getInstance(certType);
13.74 - // store the certificate factory so we can
13.75 - // reuse it later
13.76 - cfs.put(certType, cf);
13.77 - }
13.78 - }
13.79 - // instantiate the certificate
13.80 - try {
13.81 - encoded = new byte[dis.readInt()];
13.82 - } catch (OutOfMemoryError e) {
13.83 - throw new IOException("Certificate too big");
13.84 - }
13.85 - dis.readFully(encoded);
13.86 - bais = new ByteArrayInputStream(encoded);
13.87 - entry.chain[j] = cf.generateCertificate(bais);
13.88 - bais.close();
13.89 + // We can be sure now that numOfCerts of certs are read
13.90 + entry.chain = certs.toArray(new Certificate[numOfCerts]);
13.91 }
13.92
13.93 // Add the entry to the list
13.94 @@ -753,12 +742,7 @@
13.95 cfs.put(certType, cf);
13.96 }
13.97 }
13.98 - try {
13.99 - encoded = new byte[dis.readInt()];
13.100 - } catch (OutOfMemoryError e) {
13.101 - throw new IOException("Certificate too big");
13.102 - }
13.103 - dis.readFully(encoded);
13.104 + encoded = IOUtils.readFully(dis, dis.readInt(), true);
13.105 bais = new ByteArrayInputStream(encoded);
13.106 entry.cert = cf.generateCertificate(bais);
13.107 bais.close();
14.1 --- a/src/share/classes/sun/security/tools/TimestampedSigner.java Tue Mar 09 15:28:09 2010 -0800
14.2 +++ b/src/share/classes/sun/security/tools/TimestampedSigner.java Tue Mar 09 15:29:13 2010 -0800
14.3 @@ -1,5 +1,5 @@
14.4 /*
14.5 - * Copyright (c) 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
14.6 + * Copyright (c) 2007-2010 Sun Microsystems, Inc. All Rights Reserved.
14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14.8 *
14.9 * This code is free software; you can redistribute it and/or modify it
14.10 @@ -375,7 +375,8 @@
14.11 }
14.12 if (!isSigner) {
14.13 keyPurposes = cert.getExtendedKeyUsage();
14.14 - if (! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
14.15 + if (keyPurposes == null ||
14.16 + ! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
14.17 throw new CertificateException(
14.18 "Certificate is not valid for timestamping");
14.19 }
15.1 --- a/src/share/lib/security/java.security Tue Mar 09 15:28:09 2010 -0800
15.2 +++ b/src/share/lib/security/java.security Tue Mar 09 15:29:13 2010 -0800
15.3 @@ -118,11 +118,6 @@
15.4 keystore.type=jks
15.5
15.6 #
15.7 -# Class to instantiate as the system scope:
15.8 -#
15.9 -system.scope=sun.security.provider.IdentityDatabase
15.10 -
15.11 -#
15.12 # List of comma-separated packages that start with or equal this string
15.13 # will cause a security exception to be thrown when
15.14 # passed to checkPackageAccess unless the
16.1 --- a/src/solaris/classes/sun/nio/fs/UnixPath.java Tue Mar 09 15:28:09 2010 -0800
16.2 +++ b/src/solaris/classes/sun/nio/fs/UnixPath.java Tue Mar 09 15:29:13 2010 -0800
16.3 @@ -624,8 +624,11 @@
16.4 public boolean endsWith(Path other) {
16.5 UnixPath that = checkPath(other);
16.6
16.7 + int thisLen = path.length;
16.8 + int thatLen = that.path.length;
16.9 +
16.10 // other path is longer
16.11 - if (that.path.length > path.length)
16.12 + if (thatLen > thisLen)
16.13 return false;
16.14
16.15 // other path is absolute so this path must be absolute
16.16 @@ -643,10 +646,10 @@
16.17 if (thatOffsetCount == thisOffsetCount) {
16.18 if (thisOffsetCount == 0)
16.19 return true;
16.20 - int expectedLen = path.length;
16.21 + int expectedLen = thisLen;
16.22 if (this.isAbsolute() && !that.isAbsolute())
16.23 expectedLen--;
16.24 - if (that.path.length != expectedLen)
16.25 + if (thatLen != expectedLen)
16.26 return false;
16.27 } else {
16.28 // this path has more elements so given path must be relative
16.29 @@ -658,7 +661,9 @@
16.30 // compare bytes
16.31 int thisPos = offsets[thisOffsetCount - thatOffsetCount];
16.32 int thatPos = that.offsets[0];
16.33 - while (thatPos < that.path.length) {
16.34 + if ((thatLen - thatPos) != (thisLen - thisPos))
16.35 + return false;
16.36 + while (thatPos < thatLen) {
16.37 if (this.path[thisPos++] != that.path[thatPos++])
16.38 return false;
16.39 }
17.1 --- a/src/solaris/native/java/io/UnixFileSystem_md.c Tue Mar 09 15:28:09 2010 -0800
17.2 +++ b/src/solaris/native/java/io/UnixFileSystem_md.c Tue Mar 09 15:29:13 2010 -0800
17.3 @@ -414,9 +414,9 @@
17.4 jlong rv = 0L;
17.5
17.6 WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
17.7 - struct statvfs fsstat;
17.8 - memset(&fsstat, 0, sizeof(struct statvfs));
17.9 - if (statvfs(path, &fsstat) == 0) {
17.10 + struct statvfs64 fsstat;
17.11 + memset(&fsstat, 0, sizeof(fsstat));
17.12 + if (statvfs64(path, &fsstat) == 0) {
17.13 switch(t) {
17.14 case java_io_FileSystem_SPACE_TOTAL:
17.15 rv = jlong_mul(long_to_jlong(fsstat.f_frsize),
18.1 --- a/test/Makefile Tue Mar 09 15:28:09 2010 -0800
18.2 +++ b/test/Makefile Tue Mar 09 15:29:13 2010 -0800
18.3 @@ -1,5 +1,5 @@
18.4 #
18.5 -# Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
18.6 +# Copyright 1995-2010 Sun Microsystems, Inc. All Rights Reserved.
18.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18.8 #
18.9 # This code is free software; you can redistribute it and/or modify it
18.10 @@ -37,25 +37,19 @@
18.11 AWK = awk
18.12 CAT = cat
18.13 CD = cd
18.14 -CHMOD = chmod
18.15 CP = cp
18.16 CUT = cut
18.17 ECHO = echo
18.18 EGREP = egrep
18.19 EXPAND = expand
18.20 -EXPR = expr
18.21 -KILL = /usr/bin/kill
18.22 MKDIR = mkdir
18.23 -NOHUP = nohup
18.24 PWD = pwd
18.25 SED = sed
18.26 -SLEEP = sleep
18.27 SORT = sort
18.28 TEE = tee
18.29 UNAME = uname
18.30 UNIQ = uniq
18.31 WC = wc
18.32 -XHOST = xhost
18.33 ZIP = zip
18.34
18.35 # Get OS name from uname
18.36 @@ -211,66 +205,6 @@
18.37 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
18.38 endif
18.39
18.40 -# DISPLAY settings for virtual frame buffer
18.41 -START_XVFB = start-Xvfb.sh
18.42 -NOHUP_OUTPUT = $(ABS_TEST_OUTPUT_DIR)/start-Xvfb.nohup-output.txt
18.43 -DISPLAY_PID_FILE=$(ABS_TEST_OUTPUT_DIR)/xvfb-display-number.txt
18.44 -DISPLAY_SLEEP_TIME=10
18.45 -DISPLAY_MAX_SLEEPS=10
18.46 -ifeq ($(OS_NAME),solaris)
18.47 - VIRTUAL_FRAME_BUFFER = true
18.48 -endif
18.49 -ifeq ($(OS_NAME),linux)
18.50 - VIRTUAL_FRAME_BUFFER = true
18.51 -endif
18.52 -
18.53 -# Does not work yet, display dies as soon as it gets used. :^(
18.54 -VIRTUAL_FRAME_BUFFER = false
18.55 -
18.56 -# Are we using a VIRTUAL_FRAME_BUFFER (Xvfb)
18.57 -ifeq ($(VIRTUAL_FRAME_BUFFER),true)
18.58 -
18.59 - PREP_DISPLAY = \
18.60 - $(CP) $(START_XVFB) $(ABS_TEST_OUTPUT_DIR); \
18.61 - $(CHMOD) a+x $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB); \
18.62 - ( $(CD) $(ABS_TEST_OUTPUT_DIR) && \
18.63 - $(NOHUP) $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB) $(DISPLAY_PID_FILE) > $(NOHUP_OUTPUT) 2>&1 && \
18.64 - $(SLEEP) $(DISPLAY_SLEEP_TIME) ) & \
18.65 - count=1; \
18.66 - while [ ! -s $(DISPLAY_PID_FILE) ] ; do \
18.67 - $(ECHO) "Sleeping $(DISPLAY_SLEEP_TIME) more seconds, DISPLAY not ready"; \
18.68 - $(SLEEP) $(DISPLAY_SLEEP_TIME); \
18.69 - count=`$(EXPR) $${count} '+' 1`; \
18.70 - if [ $${count} -gt $(DISPLAY_MAX_SLEEPS) ] ; then \
18.71 - $(ECHO) "ERROR: DISPLAY not ready, giving up on DISPLAY"; \
18.72 - exit 9; \
18.73 - fi; \
18.74 - done ; \
18.75 - DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \
18.76 - export DISPLAY; \
18.77 - $(CAT) $(NOHUP_OUTPUT); \
18.78 - $(ECHO) "Prepared DISPLAY=$${DISPLAY}"; \
18.79 - $(XHOST) || \
18.80 - ( $(ECHO) "ERROR: No display" ; exit 8)
18.81 -
18.82 - KILL_DISPLAY = \
18.83 - ( \
18.84 - DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \
18.85 - export DISPLAY; \
18.86 - if [ -s "$(DISPLAY_PID_FILE)" ] ; then \
18.87 - $(KILL) `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \
18.88 - $(KILL) -9 `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \
18.89 - fi; \
18.90 - $(ECHO) "Killed DISPLAY=$${DISPLAY}"; \
18.91 - )
18.92 -
18.93 -else
18.94 -
18.95 - PREP_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)"
18.96 - KILL_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)"
18.97 -
18.98 -endif
18.99 -
18.100 # How to create the test bundle (pass or fail, we want to create this)
18.101 # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
18.102 ZIP_UP_RESULTS = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \
18.103 @@ -327,7 +261,7 @@
18.104 $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
18.105 fi; \
18.106 $(CAT) $(STATS_TXT); \
18.107 - $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) ; \
18.108 + $(ZIP_UP_RESULTS) ; \
18.109 $(TESTEXIT) \
18.110 )
18.111
18.112 @@ -629,7 +563,6 @@
18.113 ( \
18.114 ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
18.115 export JT_HOME; \
18.116 - $(PREP_DISPLAY) && \
18.117 $(shell $(GETMIXEDPATH) "$(JTREG)") \
18.118 $(JTREG_BASIC_OPTIONS) \
18.119 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \
19.1 --- a/test/ProblemList.txt Tue Mar 09 15:28:09 2010 -0800
19.2 +++ b/test/ProblemList.txt Tue Mar 09 15:29:13 2010 -0800
19.3 @@ -1,6 +1,6 @@
19.4 ###########################################################################
19.5 #
19.6 -# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
19.7 +# Copyright 2009-2010 Sun Microsystems, Inc. All Rights Reserved.
19.8 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19.9 #
19.10 # This code is free software; you can redistribute it and/or modify it
19.11 @@ -431,6 +431,12 @@
19.12
19.13 # jdk_management
19.14
19.15 +# Fails on linux: KO: StringMonitor notification missed or not emitted
19.16 +javax/management/monitor/NonComparableAttributeValueTest.java generic-all
19.17 +
19.18 +# Port conflict? Fails with communication error
19.19 +sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh generic-all
19.20 +
19.21 # Fails on Windows 2000, Test failed for iiop java.lang.NullPointerException
19.22 # at org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(Unknown Source)
19.23 # at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:653)
19.24 @@ -583,6 +589,9 @@
19.25 # Suspect many of these tests auffer from using fixed ports, no concrete
19.26 # evidence.
19.27
19.28 +# Times out on Windows X64
19.29 +sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java generic-all
19.30 +
19.31 # Dies on Solaris 10 sparc and sparcv9, Linux -ea -esa with
19.32 # Interrupted or IO exception, maybe writing to non-unique named file?
19.33 com/sun/net/httpserver/bugs/B6373555.java generic-all
19.34 @@ -736,6 +745,13 @@
19.35 # Suspect many of these tests auffer from using fixed ports, no concrete
19.36 # evidence.
19.37
19.38 +# Occasionally Failing with java.lang.AssertionError on Windows X64
19.39 +# at sun.nio.ch.PendingIoCache.clearPendingIoMap(PendingIoCache.java:144)
19.40 +#java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all
19.41 +
19.42 +# Some kind of sleep/wake problem on Windows X64
19.43 +java/nio/channels/Selector/Wakeup.java windows-all
19.44 +
19.45 # Fails with -ea -esa, Assertion error, but only on Solaris 10 machines?
19.46 com/sun/nio/sctp/SctpChannel/Send.java generic-all
19.47 com/sun/nio/sctp/SctpChannel/Shutdown.java generic-all
19.48 @@ -932,6 +948,18 @@
19.49
19.50 # jdk_security
19.51
19.52 +# Unknown problem, could be a jtreg -samevm issue?
19.53 +# Error while cleaning up threads after test
19.54 +java/security/Security/SynchronizedAccess.java generic-all
19.55 +
19.56 +# Failing on Solaris X64 (-d64 -server) with:
19.57 +# GSSException: Failure unspecified at GSS-API level
19.58 +# (Mechanism level: Specified version of key is not available (44))
19.59 +sun/security/krb5/auto/BasicKrb5Test.java generic-all
19.60 +
19.61 +# Solaris X86 failures, readjar.jks: No such file or directory
19.62 +sun/security/tools/keytool/readjar.sh generic-all
19.63 +
19.64 # Fails with -ea -esa, but only on Solaris sparc? Suspect it is timing out
19.65 sun/security/tools/keytool/standard.sh generic-all
19.66
19.67 @@ -1256,6 +1284,13 @@
19.68
19.69 # jdk_util
19.70
19.71 +# Fails with assertion error on windows
19.72 +# 11 separate stacktraces created... file reuse problem?
19.73 +java/util/zip/ZipFile/ReadLongZipFileName.java generic-all
19.74 +
19.75 +# Recent failure on all platforms
19.76 +sun/util/resources/TimeZone/Bug6317929.java generic-all
19.77 +
19.78 # Fails with -ea -esa on all platforms with Assertion error
19.79 java/util/ResourceBundle/Test4300693.java generic-all
19.80
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/test/com/sun/jndi/ldap/InvalidLdapFilters.java Tue Mar 09 15:29:13 2010 -0800
20.3 @@ -0,0 +1,311 @@
20.4 +/*
20.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20.7 + *
20.8 + * This code is free software; you can redistribute it and/or modify it
20.9 + * under the terms of the GNU General Public License version 2 only, as
20.10 + * published by the Free Software Foundation.
20.11 + *
20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20.15 + * version 2 for more details (a copy is included in the LICENSE file that
20.16 + * accompanied this code).
20.17 + *
20.18 + * You should have received a copy of the GNU General Public License version
20.19 + * 2 along with this work; if not, write to the Free Software Foundation,
20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20.21 + *
20.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
20.24 + * have any questions.
20.25 + */
20.26 +
20.27 +/**
20.28 + * @test
20.29 + * @bug 6916202
20.30 + * @summary More cases of invalid ldap filters accepted and processed
20.31 + * @run main/othervm InvalidLdapFilters valid (cn=Babs)
20.32 + * @run main/othervm InvalidLdapFilters valid (&(cn=Bob))
20.33 + * @run main/othervm InvalidLdapFilters valid (&(objectClass=*)(uid=*))
20.34 + * @run main/othervm InvalidLdapFilters valid (|(cn=Bob))
20.35 + * @run main/othervm InvalidLdapFilters valid (|(objectClass=*)(uid=*))
20.36 + * @run main/othervm InvalidLdapFilters valid (!(cn=Tim))
20.37 + * @run main/othervm InvalidLdapFilters valid (!(!(cn=Tim)))
20.38 + * @run main/othervm InvalidLdapFilters valid (!(&(objectClass=*)(uid=*)))
20.39 + * @run main/othervm InvalidLdapFilters valid (!(|(objectClass=*)(uid=*)))
20.40 + * @run main/othervm InvalidLdapFilters valid (o=univ*of*mich*)
20.41 + * @run main/othervm InvalidLdapFilters valid (seeAlso=)
20.42 + * @run main/othervm InvalidLdapFilters valid (cn:caseExactMatch:=Flintstone)
20.43 + * @run main/othervm InvalidLdapFilters valid (cn:=Betty)
20.44 + * @run main/othervm InvalidLdapFilters valid (sn:dn:2.4.6.8.10:=Barney)
20.45 + * @run main/othervm InvalidLdapFilters valid (o:dn:=Ace)
20.46 + * @run main/othervm InvalidLdapFilters valid (:1.2.3:=Wilma)
20.47 + * @run main/othervm InvalidLdapFilters valid (:DN:2.4.6.8.10:=Dino)
20.48 + * @run main/othervm InvalidLdapFilters valid (1.2.3=abc)
20.49 + * @run main/othervm InvalidLdapFilters valid (cn;lang-de;lang-en=abc)
20.50 + * @run main/othervm InvalidLdapFilters valid (owner=abc)
20.51 + * @run main/othervm InvalidLdapFilters valid (sn;lang-en:dn:2.4.6.8.10:=Barney)
20.52 + * @run main/othervm InvalidLdapFilters valid
20.53 + (&(objectClass=Person)(|(sn=Jensen)(cn=Bab*)))
20.54 + * @run main/othervm InvalidLdapFilters invalid "(&(cn=Robert Dean)))"
20.55 + * @run main/othervm InvalidLdapFilters invalid (&|(cn=Bob))
20.56 + * @run main/othervm InvalidLdapFilters invalid (&&(cn=Bob))
20.57 + * @run main/othervm InvalidLdapFilters invalid (|&(cn=Bob))
20.58 + * @run main/othervm InvalidLdapFilters invalid (||(cn=Bob))
20.59 + * @run main/othervm InvalidLdapFilters invalid (:1.2.:=Wilma)
20.60 + * @run main/othervm InvalidLdapFilters invalid (::DN:2.4.6.8.10:=Dino)
20.61 + * @run main/othervm InvalidLdapFilters invalid (:DN::2.4.6.8.10:=Dino)
20.62 + * @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6.8.10::=Dino)
20.63 + * @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6..8.10:=Dino)
20.64 + * @run main/othervm InvalidLdapFilters invalid (:DN:2.4.6.8.:=Dino)
20.65 + * @run main/othervm InvalidLdapFilters invalid (1.2.;::=abc)
20.66 + * @run main/othervm InvalidLdapFilters invalid (1.2.3;::=abc)
20.67 + * @run main/othervm InvalidLdapFilters invalid (1.2.3;x;=abc)
20.68 + * @run main/othervm InvalidLdapFilters invalid (1.2.3:x::=abc)
20.69 + * @run main/othervm InvalidLdapFilters invalid (1.2.3:x=abc)
20.70 + * @run main/othervm InvalidLdapFilters invalid (sn;:dn:2.4.6.8.10:=Barney)
20.71 + * @run main/othervm InvalidLdapFilters invalid "\"((objectClass=*)&(uid=*))\""
20.72 + * @run main/othervm InvalidLdapFilters invalid "&(objectClass=*)(uid=*)"
20.73 + * @run main/othervm InvalidLdapFilters invalid "(:DN:2.4.6.8.10:cn:=Dino)"
20.74 + * @run main/othervm InvalidLdapFilters invalid "(:DN:2.4.6.8.10:cn=Dino)"
20.75 + * @run main/othervm InvalidLdapFilters invalid
20.76 + "((objectCategory=person)(cn=u)(!(cn=u2*)))"
20.77 + * @run main/othervm InvalidLdapFilters invalid
20.78 + "((&(objectClass=user)(cn=andy*)(cn=steve*)(cn=bob*)))"
20.79 + *
20.80 + * @author Xuelei Fan
20.81 + */
20.82 +
20.83 +import java.io.*;
20.84 +import javax.naming.*;
20.85 +import javax.naming.directory.*;
20.86 +import java.util.Properties;
20.87 +import java.util.Hashtable;
20.88 +
20.89 +import java.net.Socket;
20.90 +import java.net.ServerSocket;
20.91 +
20.92 +public class InvalidLdapFilters {
20.93 + // Should we run the client or server in a separate thread?
20.94 + //
20.95 + // Both sides can throw exceptions, but do you have a preference
20.96 + // as to which side should be the main thread.
20.97 + static boolean separateServerThread = true;
20.98 +
20.99 + // use any free port by default
20.100 + volatile int serverPort = 0;
20.101 +
20.102 + // Is the server ready to serve?
20.103 + volatile static boolean serverReady = false;
20.104 +
20.105 + // Define the server side of the test.
20.106 + //
20.107 + // If the server prematurely exits, serverReady will be set to true
20.108 + // to avoid infinite hangs.
20.109 + void doServerSide() throws Exception {
20.110 + ServerSocket serverSock = new ServerSocket(serverPort);
20.111 +
20.112 + // signal client, it's ready to accecpt connection
20.113 + serverPort = serverSock.getLocalPort();
20.114 + serverReady = true;
20.115 +
20.116 + // accept a connection
20.117 + Socket socket = serverSock.accept();
20.118 + System.out.println("Server: Connection accepted");
20.119 +
20.120 + InputStream is = socket.getInputStream();
20.121 + OutputStream os = socket.getOutputStream();
20.122 +
20.123 + // read the bindRequest
20.124 + while (is.read() != -1) {
20.125 + // ignore
20.126 + is.skip(is.available());
20.127 + break;
20.128 + }
20.129 +
20.130 + byte[] bindResponse = {0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
20.131 + 0x01, 0x00, 0x04, 0x00, 0x04, 0x00};
20.132 + // write bindResponse
20.133 + os.write(bindResponse);
20.134 + os.flush();
20.135 +
20.136 + // ignore any more request.
20.137 + while (is.read() != -1) {
20.138 + // ignore
20.139 + is.skip(is.available());
20.140 + }
20.141 +
20.142 + is.close();
20.143 + os.close();
20.144 + socket.close();
20.145 + serverSock.close();
20.146 + }
20.147 +
20.148 + // Define the client side of the test.
20.149 + //
20.150 + // If the server prematurely exits, serverReady will be set to true
20.151 + // to avoid infinite hangs.
20.152 + void doClientSide() throws Exception {
20.153 + // Wait for server to get started.
20.154 + while (!serverReady) {
20.155 + Thread.sleep(50);
20.156 + }
20.157 +
20.158 + // set up the environment for creating the initial context
20.159 + Hashtable<Object, Object> env = new Hashtable<Object, Object>();
20.160 + env.put(Context.INITIAL_CONTEXT_FACTORY,
20.161 + "com.sun.jndi.ldap.LdapCtxFactory");
20.162 + env.put(Context.PROVIDER_URL, "ldap://localhost:" + serverPort);
20.163 + env.put("com.sun.jndi.ldap.read.timeout", "1000");
20.164 +
20.165 + // env.put(Context.SECURITY_AUTHENTICATION, "simple");
20.166 + // env.put(Context.SECURITY_PRINCIPAL,"cn=root");
20.167 + // env.put(Context.SECURITY_CREDENTIALS,"root");
20.168 +
20.169 + // create initial context
20.170 + DirContext context = new InitialDirContext(env);
20.171 +
20.172 + // searching
20.173 + SearchControls scs = new SearchControls();
20.174 + scs.setSearchScope(SearchControls.SUBTREE_SCOPE);
20.175 +
20.176 + try {
20.177 + NamingEnumeration answer =
20.178 + context.search("o=sun,c=us", searchFilter, scs);
20.179 + } catch (InvalidSearchFilterException isfe) {
20.180 + if (filterIsValid) {
20.181 + // unexpected filter exception.
20.182 + throw new Exception("Unexpected ISFE", isfe);
20.183 + } else {
20.184 + // ignore, it is the expected filter exception.
20.185 + System.out.println("Expected exception: " + isfe.getMessage());
20.186 + }
20.187 + } catch (NamingException ne) {
20.188 + // maybe a read timeout exception, as the server does not response.
20.189 + if (filterIsValid) {
20.190 + System.out.println("Expected exception: " + ne.getMessage());
20.191 + } else {
20.192 + throw new Exception("Not an InvalidSearchFilterException", ne);
20.193 + }
20.194 + }
20.195 +
20.196 + context.close();
20.197 + }
20.198 +
20.199 + private static boolean filterIsValid;
20.200 + private static String searchFilter;
20.201 +
20.202 + private static void parseArguments(String[] args) {
20.203 + System.out.println("arguments length: " + args.length);
20.204 + if (args[0].equals("valid")) {
20.205 + filterIsValid = true;
20.206 + }
20.207 +
20.208 + searchFilter = args[1];
20.209 + }
20.210 +
20.211 + /*
20.212 + * ============================================================
20.213 + * The remainder is just support stuff
20.214 + */
20.215 +
20.216 + // client and server thread
20.217 + Thread clientThread = null;
20.218 + Thread serverThread = null;
20.219 +
20.220 + // client and server exceptions
20.221 + volatile Exception serverException = null;
20.222 + volatile Exception clientException = null;
20.223 +
20.224 + void startServer(boolean newThread) throws Exception {
20.225 + if (newThread) {
20.226 + serverThread = new Thread() {
20.227 + public void run() {
20.228 + try {
20.229 + doServerSide();
20.230 + } catch (Exception e) {
20.231 + /*
20.232 + * Our server thread just died.
20.233 + *
20.234 + * Release the client, if not active already...
20.235 + */
20.236 + System.err.println("Server died...");
20.237 + System.err.println(e);
20.238 + serverReady = true;
20.239 + serverException = e;
20.240 + }
20.241 + }
20.242 + };
20.243 + serverThread.start();
20.244 + } else {
20.245 + doServerSide();
20.246 + }
20.247 + }
20.248 +
20.249 + void startClient(boolean newThread) throws Exception {
20.250 + if (newThread) {
20.251 + clientThread = new Thread() {
20.252 + public void run() {
20.253 + try {
20.254 + doClientSide();
20.255 + } catch (Exception e) {
20.256 + /*
20.257 + * Our client thread just died.
20.258 + */
20.259 + System.err.println("Client died...");
20.260 + clientException = e;
20.261 + }
20.262 + }
20.263 + };
20.264 + clientThread.start();
20.265 + } else {
20.266 + doClientSide();
20.267 + }
20.268 + }
20.269 +
20.270 + // Primary constructor, used to drive remainder of the test.
20.271 + InvalidLdapFilters() throws Exception {
20.272 + if (separateServerThread) {
20.273 + startServer(true);
20.274 + startClient(false);
20.275 + } else {
20.276 + startClient(true);
20.277 + startServer(false);
20.278 + }
20.279 +
20.280 + /*
20.281 + * Wait for other side to close down.
20.282 + */
20.283 + if (separateServerThread) {
20.284 + serverThread.join();
20.285 + } else {
20.286 + clientThread.join();
20.287 + }
20.288 +
20.289 + /*
20.290 + * When we get here, the test is pretty much over.
20.291 + *
20.292 + * If the main thread excepted, that propagates back
20.293 + * immediately. If the other thread threw an exception, we
20.294 + * should report back.
20.295 + */
20.296 + if (serverException != null) {
20.297 + System.out.print("Server Exception:");
20.298 + throw serverException;
20.299 + }
20.300 + if (clientException != null) {
20.301 + System.out.print("Client Exception:");
20.302 + throw clientException;
20.303 + }
20.304 + }
20.305 +
20.306 + public static void main(String[] args) throws Exception {
20.307 + // parse the customized arguments
20.308 + parseArguments(args);
20.309 +
20.310 + // start the test
20.311 + new InvalidLdapFilters();
20.312 + }
20.313 +
20.314 +}
21.1 --- a/test/java/nio/file/Files/PrintFileTree.java Tue Mar 09 15:28:09 2010 -0800
21.2 +++ b/test/java/nio/file/Files/PrintFileTree.java Tue Mar 09 15:29:13 2010 -0800
21.3 @@ -28,27 +28,33 @@
21.4
21.5 /**
21.6 * Invokes Files.walkFileTree to traverse a file tree and prints
21.7 - * each of the directories and files. The -L option causes symbolic
21.8 - * links to be followed.
21.9 + * each of the directories and files. The -follow option causes symbolic
21.10 + * links to be followed and the -printCycles option will print links
21.11 + * where the target of the link is an ancestor directory.
21.12 */
21.13
21.14 public class PrintFileTree {
21.15
21.16 public static void main(String[] args) throws Exception {
21.17 boolean followLinks = false;
21.18 - Path dir;
21.19 -
21.20 - if (args[0].equals("-L")) {
21.21 - followLinks = true;
21.22 - dir = Paths.get(args[1]);
21.23 - } else {
21.24 - dir = Paths.get(args[0]);
21.25 + boolean printCycles = false;
21.26 + int i = 0;
21.27 + while (i < (args.length-1)) {
21.28 + switch (args[i]) {
21.29 + case "-follow" : followLinks = true; break;
21.30 + case "-printCycles" : printCycles = true; break;
21.31 + default:
21.32 + throw new RuntimeException(args[i] + " not recognized");
21.33 + }
21.34 + i++;
21.35 }
21.36 + Path dir = Paths.get(args[i]);
21.37
21.38 Set<FileVisitOption> options = new HashSet<FileVisitOption>();
21.39 if (followLinks)
21.40 options.add(FileVisitOption.FOLLOW_LINKS);
21.41
21.42 + final boolean reportCycles = printCycles;
21.43 Files.walkFileTree(dir, options, Integer.MAX_VALUE, new FileVisitor<FileRef>() {
21.44 public FileVisitResult preVisitDirectory(FileRef dir) {
21.45 System.out.println(dir);
21.46 @@ -59,7 +65,8 @@
21.47 return FileVisitResult.CONTINUE;
21.48 }
21.49 public FileVisitResult visitFile(FileRef file, BasicFileAttributes attrs) {
21.50 - System.out.println(file);
21.51 + if (!attrs.isDirectory() || reportCycles)
21.52 + System.out.println(file);
21.53 return FileVisitResult.CONTINUE;
21.54 }
21.55 public FileVisitResult postVisitDirectory(FileRef dir, IOException exc) {
22.1 --- a/test/java/nio/file/Files/walk_file_tree.sh Tue Mar 09 15:28:09 2010 -0800
22.2 +++ b/test/java/nio/file/Files/walk_file_tree.sh Tue Mar 09 15:29:13 2010 -0800
22.3 @@ -61,12 +61,20 @@
22.4 diff out1 out2
22.5 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
22.6
22.7 -# repeat test following links (use -follow instead of -L
22.8 -# to allow running on older systems)
22.9 -$JAVA PrintFileTree -L "$ROOT" > out1
22.10 -find "$ROOT" -follow > out2
22.11 +# repeat test following links. Some versions of find(1) output
22.12 +# cycles (sym links to ancestor directories), other versions do
22.13 +# not. For that reason we run PrintFileTree with the -printCycles
22.14 +# option when the output without this option differs to find(1).
22.15 +find "$ROOT" -follow > out1
22.16 +$JAVA PrintFileTree -follow "$ROOT" > out2
22.17 diff out1 out2
22.18 -if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
22.19 +if [ $? != 0 ];
22.20 + then
22.21 + # re-run printing cycles to stdout
22.22 + $JAVA PrintFileTree -follow -printCycles "$ROOT" > out2
22.23 + diff out1 out2
22.24 + if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
22.25 + fi
22.26
22.27 # test SKIP_SIBLINGS
22.28 $JAVA SkipSiblings "$ROOT"
23.1 --- a/test/java/nio/file/Path/CheckPermissions.java Tue Mar 09 15:28:09 2010 -0800
23.2 +++ b/test/java/nio/file/Path/CheckPermissions.java Tue Mar 09 15:29:13 2010 -0800
23.3 @@ -197,7 +197,7 @@
23.4 }
23.5
23.6 public static void main(String[] args) throws IOException {
23.7 - Path dir = Paths.get(System.getProperty("test.src", "."));
23.8 + Path dir = Paths.get(System.getProperty("test.dir", "."));
23.9 Path file = dir.resolve("file1234").createFile();
23.10 try {
23.11 LoggingSecurityManager.install();
24.1 --- a/test/java/nio/file/Path/PathOps.java Tue Mar 09 15:28:09 2010 -0800
24.2 +++ b/test/java/nio/file/Path/PathOps.java Tue Mar 09 15:29:13 2010 -0800
24.3 @@ -22,7 +22,7 @@
24.4 */
24.5
24.6 /* @test
24.7 - * @bug 4313887 6838333
24.8 + * @bug 4313887 6838333 6925932
24.9 * @summary Unit test for java.nio.file.Path path operations
24.10 */
24.11
24.12 @@ -614,17 +614,34 @@
24.13 test("/foo")
24.14 .ends("foo")
24.15 .ends("/foo")
24.16 - .notEnds("/");
24.17 + .notEnds("fool");
24.18 test("/foo/bar")
24.19 .ends("bar")
24.20 .ends("foo/bar")
24.21 .ends("/foo/bar")
24.22 - .notEnds("/bar");
24.23 + .notEnds("ar")
24.24 + .notEnds("barack")
24.25 + .notEnds("/bar")
24.26 + .notEnds("o/bar");
24.27 test("foo")
24.28 - .ends("foo");
24.29 + .ends("foo")
24.30 + .notEnds("oo")
24.31 + .notEnds("oola");
24.32 test("foo/bar")
24.33 .ends("bar")
24.34 - .ends("foo/bar");
24.35 + .ends("foo/bar")
24.36 + .notEnds("r")
24.37 + .notEnds("barmaid")
24.38 + .notEnds("/bar");
24.39 + test("foo/bar/gus")
24.40 + .ends("gus")
24.41 + .ends("bar/gus")
24.42 + .ends("foo/bar/gus")
24.43 + .notEnds("g")
24.44 + .notEnds("/gus")
24.45 + .notEnds("r/gus")
24.46 + .notEnds("barack/gus")
24.47 + .notEnds("bar/gust");
24.48
24.49 // elements
24.50 test("a/b/c")
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/test/java/nio/file/WatchService/LotsOfEvents.java Tue Mar 09 15:29:13 2010 -0800
25.3 @@ -0,0 +1,222 @@
25.4 +/*
25.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
25.7 + *
25.8 + * This code is free software; you can redistribute it and/or modify it
25.9 + * under the terms of the GNU General Public License version 2 only, as
25.10 + * published by the Free Software Foundation.
25.11 + *
25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25.15 + * version 2 for more details (a copy is included in the LICENSE file that
25.16 + * accompanied this code).
25.17 + *
25.18 + * You should have received a copy of the GNU General Public License version
25.19 + * 2 along with this work; if not, write to the Free Software Foundation,
25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25.21 + *
25.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
25.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
25.24 + * have any questions.
25.25 + */
25.26 +
25.27 +/* @test
25.28 + * @bug 6907760 6929532
25.29 + * @summary Tests WatchService behavior when lots of events are pending
25.30 + * @library ..
25.31 + * @run main/timeout=180 LotsOfEvents
25.32 + */
25.33 +
25.34 +import java.nio.file.*;
25.35 +import static java.nio.file.StandardWatchEventKind.*;
25.36 +import java.io.IOException;
25.37 +import java.io.OutputStream;
25.38 +import java.util.*;
25.39 +import java.util.concurrent.TimeUnit;
25.40 +
25.41 +public class LotsOfEvents {
25.42 +
25.43 + static final Random rand = new Random();
25.44 +
25.45 + public static void main(String[] args) throws Exception {
25.46 + Path dir = TestUtil.createTemporaryDirectory();
25.47 + try {
25.48 + testOverflowEvent(dir);
25.49 + testModifyEventsQueuing(dir);
25.50 + } finally {
25.51 + TestUtil.removeAll(dir);
25.52 + }
25.53 + }
25.54 +
25.55 + /**
25.56 + * Tests that OVERFLOW events are not retreived with other events.
25.57 + */
25.58 + static void testOverflowEvent(Path dir)
25.59 + throws IOException, InterruptedException
25.60 + {
25.61 + WatchService watcher = dir.getFileSystem().newWatchService();
25.62 + try {
25.63 + dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE);
25.64 +
25.65 + // create a lot of files
25.66 + int n = 1024;
25.67 + Path[] files = new Path[n];
25.68 + for (int i=0; i<n; i++) {
25.69 + files[i] = dir.resolve("foo" + i).createFile();
25.70 + }
25.71 +
25.72 + // give time for events to accumulate (improve chance of overflow)
25.73 + Thread.sleep(1000);
25.74 +
25.75 + // check that we see the create events (or overflow)
25.76 + drainAndCheckOverflowEvents(watcher, ENTRY_CREATE, n);
25.77 +
25.78 + // delete the files
25.79 + for (int i=0; i<n; i++) {
25.80 + files[i].delete();
25.81 + }
25.82 +
25.83 + // give time for events to accumulate (improve chance of overflow)
25.84 + Thread.sleep(1000);
25.85 +
25.86 + // check that we see the delete events (or overflow)
25.87 + drainAndCheckOverflowEvents(watcher, ENTRY_DELETE, n);
25.88 + } finally {
25.89 + watcher.close();
25.90 + }
25.91 + }
25.92 +
25.93 + static void drainAndCheckOverflowEvents(WatchService watcher,
25.94 + WatchEvent.Kind<?> expectedKind,
25.95 + int count)
25.96 + throws IOException, InterruptedException
25.97 + {
25.98 + // wait for key to be signalled - the timeout is long to allow for
25.99 + // polling implementations
25.100 + WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
25.101 + if (key != null && count == 0)
25.102 + throw new RuntimeException("Key was signalled (unexpected)");
25.103 + if (key == null && count > 0)
25.104 + throw new RuntimeException("Key not signalled (unexpected)");
25.105 +
25.106 + int nread = 0;
25.107 + boolean gotOverflow = false;
25.108 + while (key != null) {
25.109 + List<WatchEvent<?>> events = key.pollEvents();
25.110 + for (WatchEvent<?> event: events) {
25.111 + WatchEvent.Kind<?> kind = event.kind();
25.112 + if (kind == expectedKind) {
25.113 + // expected event kind
25.114 + if (++nread > count)
25.115 + throw new RuntimeException("More events than expected!!");
25.116 + } else if (kind == OVERFLOW) {
25.117 + // overflow event should not be retrieved with other events
25.118 + if (events.size() > 1)
25.119 + throw new RuntimeException("Overflow retrieved with other events");
25.120 + gotOverflow = true;
25.121 + } else {
25.122 + throw new RuntimeException("Unexpected event '" + kind + "'");
25.123 + }
25.124 + }
25.125 + if (!key.reset())
25.126 + throw new RuntimeException("Key is no longer valid");
25.127 + key = watcher.poll(2, TimeUnit.SECONDS);
25.128 + }
25.129 +
25.130 + // check that all expected events were received or there was an overflow
25.131 + if (nread < count && !gotOverflow)
25.132 + throw new RuntimeException("Insufficient events");
25.133 + }
25.134 +
25.135 + /**
25.136 + * Tests that check that ENTRY_MODIFY events are queued efficiently
25.137 + */
25.138 + static void testModifyEventsQueuing(Path dir)
25.139 + throws IOException, InterruptedException
25.140 + {
25.141 + // this test uses a random number of files
25.142 + final int nfiles = 5 + rand.nextInt(10);
25.143 + DirectoryEntry[] entries = new DirectoryEntry[nfiles];
25.144 + for (int i=0; i<nfiles; i++) {
25.145 + entries[i] = new DirectoryEntry(dir.resolve("foo" + i));
25.146 +
25.147 + // "some" of the files exist, some do not.
25.148 + entries[i].deleteIfExists();
25.149 + if (rand.nextBoolean())
25.150 + entries[i].create();
25.151 + }
25.152 +
25.153 + WatchService watcher = dir.getFileSystem().newWatchService();
25.154 + try {
25.155 + dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
25.156 +
25.157 + // do several rounds of noise and test
25.158 + for (int round=0; round<10; round++) {
25.159 +
25.160 + // make some noise!!!
25.161 + for (int i=0; i<100; i++) {
25.162 + DirectoryEntry entry = entries[rand.nextInt(nfiles)];
25.163 + int action = rand.nextInt(10);
25.164 + switch (action) {
25.165 + case 0 : entry.create(); break;
25.166 + case 1 : entry.deleteIfExists(); break;
25.167 + default: entry.modifyIfExists();
25.168 + }
25.169 + }
25.170 +
25.171 + // process events and ensure that we don't get repeated modify
25.172 + // events for the same file.
25.173 + WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
25.174 + while (key != null) {
25.175 + Set<Path> modified = new HashSet<Path>();
25.176 + for (WatchEvent<?> event: key.pollEvents()) {
25.177 + WatchEvent.Kind<?> kind = event.kind();
25.178 + Path file = (kind == OVERFLOW) ? null : (Path)event.context();
25.179 + if (kind == ENTRY_MODIFY) {
25.180 + boolean added = modified.add(file);
25.181 + if (!added) {
25.182 + throw new RuntimeException(
25.183 + "ENTRY_MODIFY events not queued efficiently");
25.184 + }
25.185 + } else {
25.186 + if (file != null) modified.remove(file);
25.187 + }
25.188 + }
25.189 + if (!key.reset())
25.190 + throw new RuntimeException("Key is no longer valid");
25.191 + key = watcher.poll(2, TimeUnit.SECONDS);
25.192 + }
25.193 + }
25.194 +
25.195 + } finally {
25.196 + watcher.close();
25.197 + }
25.198 + }
25.199 +
25.200 + static class DirectoryEntry {
25.201 + private final Path file;
25.202 + DirectoryEntry(Path file) {
25.203 + this.file = file;
25.204 + }
25.205 + void create() throws IOException {
25.206 + if (file.notExists())
25.207 + file.createFile();
25.208 +
25.209 + }
25.210 + void deleteIfExists() throws IOException {
25.211 + file.deleteIfExists();
25.212 + }
25.213 + void modifyIfExists() throws IOException {
25.214 + if (file.exists()) {
25.215 + OutputStream out = file.newOutputStream(StandardOpenOption.APPEND);
25.216 + try {
25.217 + out.write("message".getBytes());
25.218 + } finally {
25.219 + out.close();
25.220 + }
25.221 + }
25.222 + }
25.223 + }
25.224 +
25.225 +}
26.1 --- a/test/java/nio/file/WatchService/OverflowEventIsLoner.java Tue Mar 09 15:28:09 2010 -0800
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,122 +0,0 @@
26.4 -/*
26.5 - * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
26.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26.7 - *
26.8 - * This code is free software; you can redistribute it and/or modify it
26.9 - * under the terms of the GNU General Public License version 2 only, as
26.10 - * published by the Free Software Foundation.
26.11 - *
26.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
26.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26.15 - * version 2 for more details (a copy is included in the LICENSE file that
26.16 - * accompanied this code).
26.17 - *
26.18 - * You should have received a copy of the GNU General Public License version
26.19 - * 2 along with this work; if not, write to the Free Software Foundation,
26.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26.21 - *
26.22 - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
26.23 - * CA 95054 USA or visit www.sun.com if you need additional information or
26.24 - * have any questions.
26.25 - */
26.26 -
26.27 -/* @test
26.28 - * @bug 6907760
26.29 - * @summary Check that the OVERFLOW event is not retrieved with other events
26.30 - * @library ..
26.31 - */
26.32 -
26.33 -import java.nio.file.*;
26.34 -import static java.nio.file.StandardWatchEventKind.*;
26.35 -import java.io.IOException;
26.36 -import java.util.List;
26.37 -import java.util.concurrent.TimeUnit;
26.38 -
26.39 -public class OverflowEventIsLoner {
26.40 -
26.41 - static void drainEvents(WatchService watcher,
26.42 - WatchEvent.Kind<?> expectedKind,
26.43 - int count)
26.44 - throws IOException, InterruptedException
26.45 - {
26.46 - // wait for key to be signalled - the timeout is long to allow for
26.47 - // polling implementations
26.48 - WatchKey key = watcher.poll(15, TimeUnit.SECONDS);
26.49 - if (key != null && count == 0)
26.50 - throw new RuntimeException("Key was signalled (unexpected)");
26.51 - if (key == null && count > 0)
26.52 - throw new RuntimeException("Key not signalled (unexpected)");
26.53 -
26.54 - int nread = 0;
26.55 - boolean gotOverflow = false;
26.56 - do {
26.57 - List<WatchEvent<?>> events = key.pollEvents();
26.58 - for (WatchEvent<?> event: events) {
26.59 - WatchEvent.Kind<?> kind = event.kind();
26.60 - if (kind == expectedKind) {
26.61 - // expected event kind
26.62 - if (++nread > count)
26.63 - throw new RuntimeException("More events than expected!!");
26.64 - } else if (kind == OVERFLOW) {
26.65 - // overflow event should not be retrieved with other events
26.66 - if (events.size() > 1)
26.67 - throw new RuntimeException("Overflow retrieved with other events");
26.68 - gotOverflow = true;
26.69 - } else {
26.70 - throw new RuntimeException("Unexpected event '" + kind + "'");
26.71 - }
26.72 - }
26.73 - if (!key.reset())
26.74 - throw new RuntimeException("Key is no longer valid");
26.75 - key = watcher.poll(2, TimeUnit.SECONDS);
26.76 - } while (key != null);
26.77 -
26.78 - // check that all expected events were received or there was an overflow
26.79 - if (nread < count && !gotOverflow)
26.80 - throw new RuntimeException("Insufficient events");
26.81 - }
26.82 -
26.83 -
26.84 - static void test(Path dir) throws IOException, InterruptedException {
26.85 - WatchService watcher = dir.getFileSystem().newWatchService();
26.86 - try {
26.87 - WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE);
26.88 -
26.89 - // create a lot of files
26.90 - int n = 1024;
26.91 - Path[] files = new Path[n];
26.92 - for (int i=0; i<n; i++) {
26.93 - files[i] = dir.resolve("foo" + i).createFile();
26.94 - }
26.95 -
26.96 - // give time for events to accumulate (improve chance of overflow)
26.97 - Thread.sleep(1000);
26.98 -
26.99 - // check that we see the create events (or overflow)
26.100 - drainEvents(watcher, ENTRY_CREATE, n);
26.101 -
26.102 - // delete the files
26.103 - for (int i=0; i<n; i++) {
26.104 - files[i].delete();
26.105 - }
26.106 -
26.107 - // give time for events to accumulate (improve chance of overflow)
26.108 - Thread.sleep(1000);
26.109 -
26.110 - // check that we see the delete events (or overflow)
26.111 - drainEvents(watcher, ENTRY_DELETE, n);
26.112 - } finally {
26.113 - watcher.close();
26.114 - }
26.115 - }
26.116 -
26.117 - public static void main(String[] args) throws Exception {
26.118 - Path dir = TestUtil.createTemporaryDirectory();
26.119 - try {
26.120 - test(dir);
26.121 - } finally {
26.122 - TestUtil.removeAll(dir);
26.123 - }
26.124 - }
26.125 -}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/test/java/security/IdentityScope/NoDefaultSystemScope.java Tue Mar 09 15:29:13 2010 -0800
27.3 @@ -0,0 +1,42 @@
27.4 +/*
27.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
27.7 + *
27.8 + * This code is free software; you can redistribute it and/or modify it
27.9 + * under the terms of the GNU General Public License version 2 only, as
27.10 + * published by the Free Software Foundation.
27.11 + *
27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
27.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27.15 + * version 2 for more details (a copy is included in the LICENSE file that
27.16 + * accompanied this code).
27.17 + *
27.18 + * You should have received a copy of the GNU General Public License version
27.19 + * 2 along with this work; if not, write to the Free Software Foundation,
27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27.21 + *
27.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
27.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
27.24 + * have any questions.
27.25 + */
27.26 +
27.27 +/*
27.28 + * @test
27.29 + * @bug 6921001
27.30 + * @summary The default system identity scope is now null.
27.31 + */
27.32 +import java.security.*;
27.33 +
27.34 +public class NoDefaultSystemScope {
27.35 +
27.36 + public static void main(String args[]) throws Exception {
27.37 + IdentityScope s = IdentityScope.getSystemScope();
27.38 +
27.39 + if (s != null) {
27.40 + throw new Exception("The default system scope should be null");
27.41 + }
27.42 + System.out.println("TEST PASSED");
27.43 + }
27.44 +}
27.45 +
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/test/sun/security/krb5/etype/WeakCrypto.java Tue Mar 09 15:29:13 2010 -0800
28.3 @@ -0,0 +1,50 @@
28.4 +/*
28.5 + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28.7 + *
28.8 + * This code is free software; you can redistribute it and/or modify it
28.9 + * under the terms of the GNU General Public License version 2 only, as
28.10 + * published by the Free Software Foundation.
28.11 + *
28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28.15 + * version 2 for more details (a copy is included in the LICENSE file that
28.16 + * accompanied this code).
28.17 + *
28.18 + * You should have received a copy of the GNU General Public License version
28.19 + * 2 along with this work; if not, write to the Free Software Foundation,
28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
28.21 + *
28.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
28.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
28.24 + * have any questions.
28.25 + */
28.26 +/*
28.27 + * @test
28.28 + * @bug 6844909
28.29 + * @run main/othervm WeakCrypto
28.30 + * @summary support allow_weak_crypto in krb5.conf
28.31 + */
28.32 +
28.33 +import java.io.File;
28.34 +import sun.security.krb5.internal.crypto.EType;
28.35 +import sun.security.krb5.EncryptedData;
28.36 +
28.37 +public class WeakCrypto {
28.38 + public static void main(String[] args) throws Exception {
28.39 + System.setProperty("java.security.krb5.conf",
28.40 + System.getProperty("test.src", ".") +
28.41 + File.separator +
28.42 + "weakcrypto.conf");
28.43 + int[] etypes = EType.getBuiltInDefaults();
28.44 +
28.45 + for (int i=0, length = etypes.length; i<length; i++) {
28.46 + if (etypes[i] == EncryptedData.ETYPE_DES_CBC_CRC ||
28.47 + etypes[i] == EncryptedData.ETYPE_DES_CBC_MD4 ||
28.48 + etypes[i] == EncryptedData.ETYPE_DES_CBC_MD5) {
28.49 + throw new Exception("DES should not appear");
28.50 + }
28.51 + }
28.52 + }
28.53 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/test/sun/security/krb5/etype/weakcrypto.conf Tue Mar 09 15:29:13 2010 -0800
29.3 @@ -0,0 +1,2 @@
29.4 +[libdefaults]
29.5 +allow_weak_crypto = false