Merge jdk7u66-b00 into jdk7u66-b01
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index ffed83b..02b5b6a 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -440,3 +440,4 @@
4cab26e4e27f8ff382b8d6487224af59dc7c1fa1 jdk7u65-b05
b2cd3babc4ca1fb48b6073665e627f8bfb65d547 jdk7u65-b06
bc5e69657c0f6d58775ac7441033bbcbbaee3268 jdk7u65-b07
+48eb3345e05fe904d2e92067da0abd04a9b375e4 jdk7u66-b00
diff --git a/corba/.hgtags b/corba/.hgtags
index a2afac9..e078527 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -442,3 +442,4 @@
12c1621ce88defa65ebc1bdffb7141bd7d0089a6 jdk7u65-b05
5041c713522c0fc68239fc91f7fb9498dd7edebb jdk7u65-b06
144887a766dc17a139524dd43f1a0bc8f2a2a3a2 jdk7u65-b07
+5b8210c41bc41135687028bcb000ca116e2090f6 jdk7u66-b00
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 591c84d..c5271c4 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -660,3 +660,4 @@
98a884fa64a9ef1753a28691106efe10942b9d70 jdk7u65-b05
6f1dddf9c632bfb14121c9521d17b64bd0be0cd2 jdk7u65-b06
a053d3d805355ffcd85c17e653182e17d4456bd5 jdk7u65-b07
+6b37a189944aaa09e81d97d394496464d16bee42 jdk7u66-b00
diff --git a/hotspot/make/windows/makefiles/trace.make b/hotspot/make/windows/makefiles/trace.make
index da4b347..ccdad95 100644
--- a/hotspot/make/windows/makefiles/trace.make
+++ b/hotspot/make/windows/makefiles/trace.make
@@ -40,8 +40,7 @@
traceEventIds.hpp \
traceTypes.hpp
-
-!if "$(OPENJDK)" != "true"
+!if EXISTS($(TraceAltSrcDir))
TraceGeneratedNames = $(TraceGeneratedNames) \
traceRequestables.hpp \
traceEventControl.hpp \
@@ -56,7 +55,7 @@
$(TraceOutDir)/traceEventIds.hpp \
$(TraceOutDir)/traceTypes.hpp
-!if "$(OPENJDK)" != "true"
+!if EXISTS($(TraceAltSrcDir))
TraceGeneratedFiles = $(TraceGeneratedFiles) \
$(TraceOutDir)/traceRequestables.hpp \
$(TraceOutDir)/traceEventControl.hpp \
@@ -68,7 +67,7 @@
XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
$(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod
-!if "$(OPENJDK)" != "true"
+!if EXISTS($(TraceAltSrcDir))
XML_DEPS = $(XML_DEPS) $(TraceAltSrcDir)/traceevents.xml
!endif
@@ -87,7 +86,7 @@
@echo Generating $@
@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceTypes.xsl -OUT $(TraceOutDir)/traceTypes.hpp
-!if "$(OPENJDK)" == "true"
+!if !EXISTS($(TraceAltSrcDir))
$(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS)
@echo Generating $@
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index eb9afa1..0ab37cf 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -443,3 +443,4 @@
319df7bff5bf7a9c2d659dd9021b918e729fa56f jdk7u65-b05
5fd236e2f1bbc09349858f9c56dd223b6d6f21f6 jdk7u65-b06
e1ae0b54e22200f2d67de39f6a16899ad4a1e574 jdk7u65-b07
+86e93799766d67102a37559b3831abcc825d7e24 jdk7u66-b00
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/StringLengthCall.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/StringLengthCall.java
index 104b16b..212a6d8 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/StringLengthCall.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/StringLengthCall.java
@@ -26,7 +26,7 @@
import java.util.Vector;
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
-import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
+import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
import com.sun.org.apache.bcel.internal.generic.InstructionList;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
@@ -51,7 +51,8 @@
il.append(methodGen.loadContextNode());
Type.Node.translateTo(classGen, methodGen, Type.String);
}
- il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
- "length", "()I")));
+ il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS,
+ "getStringLength",
+ "(Ljava/lang/String;)I")));
}
}
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
index ddefee2..74acd2a 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
@@ -1660,5 +1660,14 @@
}
+ /**
+ * Utility method to calculate string-length as a number of code points,
+ * to avoid possible errors with string that contains
+ * complementary characters
+ */
+ public static int getStringLength(String str) {
+ return str.codePointCount(0,str.length());
+ }
+
//-- End utility functions
}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java
index 1be146e..518c09a 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java
@@ -61,14 +61,13 @@
package com.sun.org.apache.xerces.internal.impl;
-import java.io.IOException;
-
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
-import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XML11Char;
+import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XMLString;
+import java.io.IOException;
/**
* Implements the entity scanner methods in
@@ -78,6 +77,7 @@
*
* @author Michael Glavassevich, IBM
* @author Neil Graham, IBM
+ * @version $Id: XML11EntityScanner.java,v 1.5 2010-11-01 04:39:40 joehw Exp $
*/
public class XML11EntityScanner
@@ -108,7 +108,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// peek at character
@@ -136,7 +136,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// scan character
@@ -148,7 +148,7 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = (char)c;
- load(1, false);
+ load(1, false, true);
}
if (c == '\r' && external) {
int cc = fCurrentEntity.ch[fCurrentEntity.position++];
@@ -183,7 +183,7 @@
public String scanNmtoken() throws IOException {
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// scan nmtoken
@@ -194,6 +194,7 @@
if (XML11Char.isXML11Name(ch)) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -206,7 +207,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -214,6 +215,7 @@
else if (XML11Char.isXML11NameHighSurrogate(ch)) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -226,7 +228,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
--fCurrentEntity.startPosition;
--fCurrentEntity.position;
break;
@@ -240,6 +242,7 @@
}
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -252,7 +255,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -294,7 +297,7 @@
public String scanName() throws IOException {
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// scan name
@@ -305,7 +308,7 @@
if (++fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = ch;
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
fCurrentEntity.columnNumber++;
String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
return symbol;
@@ -316,7 +319,7 @@
if (++fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = ch;
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
--fCurrentEntity.position;
--fCurrentEntity.startPosition;
return null;
@@ -332,7 +335,7 @@
fCurrentEntity.ch[0] = ch;
fCurrentEntity.ch[1] = ch2;
offset = 0;
- if (load(2, false)) {
+ if (load(2, false, true)) {
fCurrentEntity.columnNumber += 2;
String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
return symbol;
@@ -348,6 +351,7 @@
if (XML11Char.isXML11Name(ch)) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -360,7 +364,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -368,6 +372,7 @@
else if (XML11Char.isXML11NameHighSurrogate(ch)) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -380,7 +385,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
--fCurrentEntity.position;
--fCurrentEntity.startPosition;
break;
@@ -394,6 +399,7 @@
}
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -406,7 +412,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -449,7 +455,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// scan name
@@ -460,7 +466,7 @@
if (++fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = ch;
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
fCurrentEntity.columnNumber++;
String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
return symbol;
@@ -471,7 +477,7 @@
if (++fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = ch;
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
--fCurrentEntity.position;
--fCurrentEntity.startPosition;
return null;
@@ -487,7 +493,7 @@
fCurrentEntity.ch[0] = ch;
fCurrentEntity.ch[1] = ch2;
offset = 0;
- if (load(2, false)) {
+ if (load(2, false, true)) {
fCurrentEntity.columnNumber += 2;
String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
return symbol;
@@ -503,6 +509,7 @@
if (XML11Char.isXML11NCName(ch)) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -515,7 +522,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -523,6 +530,7 @@
else if (XML11Char.isXML11NameHighSurrogate(ch)) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -535,7 +543,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
--fCurrentEntity.startPosition;
--fCurrentEntity.position;
break;
@@ -549,6 +557,7 @@
}
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -561,7 +570,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -610,7 +619,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// scan qualified name
@@ -621,7 +630,7 @@
if (++fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = ch;
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
fCurrentEntity.columnNumber++;
String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
qname.setValues(null, name, name, null);
@@ -633,7 +642,7 @@
if (++fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = ch;
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
--fCurrentEntity.startPosition;
--fCurrentEntity.position;
return false;
@@ -649,7 +658,7 @@
fCurrentEntity.ch[0] = ch;
fCurrentEntity.ch[1] = ch2;
offset = 0;
- if (load(2, false)) {
+ if (load(2, false, true)) {
fCurrentEntity.columnNumber += 2;
String name = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 2);
qname.setValues(null, name, name, null);
@@ -674,6 +683,7 @@
}
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -689,7 +699,7 @@
index = index - offset;
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -697,6 +707,7 @@
else if (XML11Char.isXML11NameHighSurrogate(ch)) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -712,7 +723,7 @@
index = index - offset;
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
sawIncompleteSurrogatePair = true;
--fCurrentEntity.startPosition;
--fCurrentEntity.position;
@@ -728,6 +739,7 @@
}
if (++fCurrentEntity.position == fCurrentEntity.count) {
int length = fCurrentEntity.position - offset;
+ invokeListeners(length);
if (length == fCurrentEntity.ch.length) {
// bad luck we have to resize our buffer
char[] tmp = new char[fCurrentEntity.ch.length << 1];
@@ -743,7 +755,7 @@
index = index - offset;
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -820,11 +832,11 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
- load(1, false);
+ load(1, false, true);
fCurrentEntity.position = 0;
fCurrentEntity.startPosition = 0;
}
@@ -846,7 +858,7 @@
fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
fCurrentEntity.position = newlines;
fCurrentEntity.startPosition = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -869,7 +881,7 @@
fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
fCurrentEntity.position = newlines;
fCurrentEntity.startPosition = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -961,11 +973,11 @@
throws IOException {
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
- load(1, false);
+ load(1, false, true);
fCurrentEntity.startPosition = 0;
fCurrentEntity.position = 0;
}
@@ -987,7 +999,7 @@
fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
fCurrentEntity.position = newlines;
fCurrentEntity.startPosition = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1010,7 +1022,7 @@
fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
fCurrentEntity.position = newlines;
fCurrentEntity.startPosition = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1113,7 +1125,7 @@
do {
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, false);
}
boolean bNextEntity = false;
@@ -1127,7 +1139,7 @@
0,
fCurrentEntity.count - fCurrentEntity.position);
- bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false);
+ bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false, false);
fCurrentEntity.position = 0;
fCurrentEntity.startPosition = 0;
}
@@ -1140,7 +1152,7 @@
fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
fCurrentEntity.position = fCurrentEntity.count;
fCurrentEntity.startPosition = fCurrentEntity.count;
- load(0,true);
+ load(0,true, false);
return false;
}
@@ -1160,7 +1172,7 @@
fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
fCurrentEntity.position = newlines;
fCurrentEntity.startPosition = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1184,7 +1196,7 @@
fCurrentEntity.position = newlines;
fCurrentEntity.startPosition = newlines;
fCurrentEntity.count = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1309,7 +1321,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// skip character
@@ -1335,7 +1347,7 @@
// handle newlines
if (fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = (char)cc;
- load(1, false);
+ load(1, false, true);
}
int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
if (ccc == '\n' || ccc == 0x85) {
@@ -1369,7 +1381,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
@@ -1397,7 +1409,7 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
fCurrentEntity.ch[0] = (char)c;
- entityChanged = load(1, true);
+ entityChanged = load(1, true, true);
if (!entityChanged) {
// the load change the position to be 1,
// need to restore it when entity not changed
@@ -1424,7 +1436,7 @@
if (!entityChanged)
fCurrentEntity.position++;
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
if(fCurrentEntity == null){
return true ;
@@ -1445,7 +1457,7 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
fCurrentEntity.ch[0] = (char)c;
- entityChanged = load(1, true);
+ entityChanged = load(1, true, true);
if (!entityChanged) {
// the load change the position to be 1,
// need to restore it when entity not changed
@@ -1463,7 +1475,7 @@
if (!entityChanged)
fCurrentEntity.position++;
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
if(fCurrentEntity == null){
return true ;
@@ -1496,7 +1508,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, true);
}
// skip string
@@ -1508,10 +1520,11 @@
return false;
}
if (i < length - 1 && fCurrentEntity.position == fCurrentEntity.count) {
+ invokeListeners(0);
System.arraycopy(fCurrentEntity.ch, fCurrentEntity.count - i - 1, fCurrentEntity.ch, 0, i + 1);
// REVISIT: Can a string to be skipped cross an
// entity boundary? -Ac
- if (load(i + 1, false)) {
+ if (load(i + 1, false, false)) {
fCurrentEntity.startPosition -= i + 1;
fCurrentEntity.position -= i + 1;
return false;
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java
index 4acc9c9..5ad6bbf 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java
@@ -20,34 +20,28 @@
package com.sun.org.apache.xerces.internal.impl;
-import java.io.EOFException;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Vector;
-
-import com.sun.xml.internal.stream.Entity;
-import com.sun.xml.internal.stream.XMLBufferListener;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
-
-
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.util.EncodingMap;
-
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
-import com.sun.org.apache.xerces.internal.xni.QName;
-import com.sun.org.apache.xerces.internal.xni.XMLString;
+import com.sun.org.apache.xerces.internal.xni.*;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
-import com.sun.org.apache.xerces.internal.xni.*;
+import com.sun.xml.internal.stream.Entity;
+import com.sun.xml.internal.stream.XMLBufferListener;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Locale;
+import java.util.Vector;
/**
* Implements the entity scanner methods.
@@ -493,8 +487,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
}
// peek at character
@@ -535,8 +528,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
}
// scan character
@@ -546,9 +538,8 @@
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(1);
fCurrentEntity.ch[0] = (char)c;
- load(1, false);
+ load(1, false, true);
}
if (c == '\r' && isExternal) {
if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
@@ -593,8 +584,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
}
// scan nmtoken
@@ -626,7 +616,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -673,18 +663,16 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
}
// scan name
int offset = fCurrentEntity.position;
if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(1);
fCurrentEntity.ch[0] = fCurrentEntity.ch[offset];
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
fCurrentEntity.columnNumber++;
String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, 0, 1);
@@ -721,7 +709,7 @@
fCurrentEntity.ch, 0, length);
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -776,8 +764,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
}
// scan qualified name
@@ -789,11 +776,10 @@
if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) {
if (++fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(1);
fCurrentEntity.ch[0] = fCurrentEntity.ch[offset];
offset = 0;
- if (load(1, false)) {
+ if (load(1, false, true)) {
fCurrentEntity.columnNumber++;
//adding into symbol table.
//XXX We are trying to add single character in SymbolTable??????
@@ -843,7 +829,7 @@
index = index - offset;
}
offset = 0;
- if (load(length, false)) {
+ if (load(length, false, false)) {
break;
}
}
@@ -918,12 +904,10 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
} else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
- invokeListeners(0);
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
- load(1, false);
+ load(1, false, true);
fCurrentEntity.position = 0;
}
@@ -945,9 +929,8 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
offset = 0;
- invokeListeners(newlines);
fCurrentEntity.position = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -965,9 +948,8 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
offset = 0;
- invokeListeners(newlines);
fCurrentEntity.position = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1070,13 +1052,10 @@
}
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
} else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
- invokeListeners(0);
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
-
- load(1, false);
+ load(1, false, true);
fCurrentEntity.position = 0;
}
@@ -1099,10 +1078,9 @@
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(newlines);
offset = 0;
fCurrentEntity.position = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1121,9 +1099,8 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
offset = 0;
- invokeListeners(newlines);
fCurrentEntity.position = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1249,7 +1226,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, false);
}
boolean bNextEntity = false;
@@ -1263,7 +1240,7 @@
0,
fCurrentEntity.count - fCurrentEntity.position);
- bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false);
+ bNextEntity = load(fCurrentEntity.count - fCurrentEntity.position, false, false);
fCurrentEntity.position = 0;
fCurrentEntity.startPosition = 0;
}
@@ -1276,7 +1253,7 @@
fCurrentEntity.baseCharOffset += (fCurrentEntity.position - fCurrentEntity.startPosition);
fCurrentEntity.position = fCurrentEntity.count;
fCurrentEntity.startPosition = fCurrentEntity.count;
- load(0, true);
+ load(0, true, false);
return false;
}
@@ -1298,9 +1275,8 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
offset = 0;
- invokeListeners(newlines);
fCurrentEntity.position = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1318,10 +1294,9 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
offset = 0;
- invokeListeners(newlines);
fCurrentEntity.position = newlines;
fCurrentEntity.count = newlines;
- if (load(newlines, false)) {
+ if (load(newlines, false, true)) {
break;
}
}
@@ -1422,8 +1397,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
}
// skip character
@@ -1445,9 +1419,8 @@
} else if (c == '\n' && cc == '\r' && isExternal) {
// handle newlines
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(1);
fCurrentEntity.ch[0] = (char)cc;
- load(1, false);
+ load(1, false, true);
}
fCurrentEntity.position++;
if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
@@ -1498,8 +1471,7 @@
//boolean entityChanged = false;
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
}
//we are doing this check only in skipSpace() because it is called by
@@ -1522,9 +1494,8 @@
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
- invokeListeners(0);
fCurrentEntity.ch[0] = (char)c;
- entityChanged = load(1, true);
+ entityChanged = load(1, true, true);
if (!entityChanged){
// the load change the position to be 1,
// need to restore it when entity not changed
@@ -1549,8 +1520,7 @@
}
if (fCurrentEntity.position == fCurrentEntity.count) {
- invokeListeners(0);
- load(0, true);
+ load(0, true, true);
//we are doing this check only in skipSpace() because it is called by
//fMiscDispatcher and we want the parser to exit gracefully when document
@@ -1626,7 +1596,7 @@
if((fCurrentEntity.count - fCurrentEntity.position) < length){
int pos = fCurrentEntity.position;
invokeListeners(pos);
- entityChanged = load(fCurrentEntity.count, changeEntity);
+ entityChanged = load(fCurrentEntity.count, changeEntity, false);
fCurrentEntity.position = pos;
if(entityChanged)break;
}
@@ -1731,17 +1701,22 @@
* the current entity in place and the entity
* boundary will be signaled by the return
* value.
+ * @param notify Determine whether to notify listeners of
+ * the event
*
* @returns Returns true if the entity changed as a result of this
* load operation.
*/
- final boolean load(int offset, boolean changeEntity)
+ final boolean load(int offset, boolean changeEntity, boolean notify)
throws IOException {
if (DEBUG_BUFFER) {
System.out.print("(load, "+offset+": ");
print();
System.out.println();
}
+ if (notify) {
+ invokeListeners(offset);
+ }
//maintaing the count till last load
fCurrentEntity.fTotalCountTillLastLoad = fCurrentEntity.fTotalCountTillLastLoad + fCurrentEntity.fLastCount ;
// read characters
@@ -1778,7 +1753,7 @@
}
// handle the trailing edges
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, false);
}
}
@@ -2075,7 +2050,7 @@
*
* @param loadPos Starting position from which new data is being loaded into scanner buffer.
*/
- private void invokeListeners(int loadPos){
+ public void invokeListeners(int loadPos){
for(int i=0;i<listeners.size();i++){
XMLBufferListener listener =(XMLBufferListener) listeners.get(i);
listener.refresh(loadPos);
@@ -2108,7 +2083,7 @@
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, false);
}
// skip spaces
@@ -2123,7 +2098,7 @@
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
fCurrentEntity.ch[0] = (char)c;
- entityChanged = load(1, true);
+ entityChanged = load(1, true, false);
if (!entityChanged)
// the load change the position to be 1,
// need to restore it when entity not changed
@@ -2151,7 +2126,7 @@
if (!entityChanged)
fCurrentEntity.position++;
if (fCurrentEntity.position == fCurrentEntity.count) {
- load(0, true);
+ load(0, true, false);
}
} while (XMLChar.isSpace(c = fCurrentEntity.ch[fCurrentEntity.position]));
if (DEBUG_BUFFER) {
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index d407b3b..0664741 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -442,3 +442,4 @@
7bafb24c6466999bc08742b160d0e450bc12a2c5 jdk7u65-b05
35b31c516cab0a81fa9d2a119ec101be3f5a2969 jdk7u65-b06
eb89c1c30a93b1d43cbc1b7520bca46d31d0829a jdk7u65-b07
+d63ca1c5bdb9fb2e36ec4afda431c0d1dfdfc07c jdk7u66-b00
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 6b8a7a9..0454ac6 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -426,3 +426,4 @@
14b3f82c245fb8d0eeb21dc99ff0b4985571910c jdk7u65-b05
7d8e5d90789533b5cc22eeb15c19ce1bb8a20573 jdk7u65-b06
cde691a6989fa875107a3974aa92681d286be6ec jdk7u65-b07
+9ccfe70cee626ac7831cfa7b7a7eb7a88fe1cd42 jdk7u66-b00
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index ddce403..acd751a 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -7922,7 +7922,7 @@
res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_BACKWARD);
}
}
- if (!res) {
+ if (clearOnFailure && !res) {
if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("clear global focus owner");
}
diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
index b0b32f8..3fc5fb0 100644
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2368,7 +2368,8 @@
focusLog.finest("Request {0}", String.valueOf(hwFocusRequest));
}
if (hwFocusRequest == null &&
- heavyweight == nativeFocusOwner)
+ heavyweight == nativeFocusOwner &&
+ heavyweight.getContainingWindow() == nativeFocusedWindow)
{
if (descendant == currentFocusOwner) {
// Redundant request.
diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java
index ca517ab..9d06b45 100644
--- a/jdk/src/share/classes/java/lang/Class.java
+++ b/jdk/src/share/classes/java/lang/Class.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2338,44 +2338,110 @@
}
/**
+ * Atomic operations support.
+ */
+ private static class Atomic {
+ // initialize Unsafe machinery here, since we need to call Class.class instance method
+ // and have to avoid calling it in the static initializer of the Class class...
+ private static final Unsafe unsafe = Unsafe.getUnsafe();
+ // offset of Class.reflectionData instance field
+ private static final long reflectionDataOffset;
+ // offset of Class.annotationType instance field
+ private static final long annotationTypeOffset;
+
+ static {
+ Field[] fields = Class.class.getDeclaredFields0(false); // bypass caches
+ reflectionDataOffset = objectFieldOffset(fields, "reflectionData");
+ annotationTypeOffset = objectFieldOffset(fields, "annotationType");
+ }
+
+ private static long objectFieldOffset(Field[] fields, String fieldName) {
+ Field field = searchFields(fields, fieldName);
+ if (field == null) {
+ throw new Error("No " + fieldName + " field found in java.lang.Class");
+ }
+ return unsafe.objectFieldOffset(field);
+ }
+
+ static <T> boolean casReflectionData(Class<?> clazz,
+ SoftReference<ReflectionData<T>> oldData,
+ SoftReference<ReflectionData<T>> newData) {
+ return unsafe.compareAndSwapObject(clazz, reflectionDataOffset, oldData, newData);
+ }
+
+ static <T> boolean casAnnotationType(Class<?> clazz,
+ AnnotationType oldType,
+ AnnotationType newType) {
+ return unsafe.compareAndSwapObject(clazz, annotationTypeOffset, oldType, newType);
+ }
+ }
+
+ /**
* Reflection support.
*/
// Caches for certain reflective results
private static boolean useCaches = true;
- private volatile transient SoftReference<Field[]> declaredFields;
- private volatile transient SoftReference<Field[]> publicFields;
- private volatile transient SoftReference<Method[]> declaredMethods;
- private volatile transient SoftReference<Method[]> publicMethods;
- private volatile transient SoftReference<Constructor<T>[]> declaredConstructors;
- private volatile transient SoftReference<Constructor<T>[]> publicConstructors;
- // Intermediate results for getFields and getMethods
- private volatile transient SoftReference<Field[]> declaredPublicFields;
- private volatile transient SoftReference<Method[]> declaredPublicMethods;
+
+ // reflection data that might get invalidated when JVM TI RedefineClasses() is called
+ static class ReflectionData<T> {
+ volatile Field[] declaredFields;
+ volatile Field[] publicFields;
+ volatile Method[] declaredMethods;
+ volatile Method[] publicMethods;
+ volatile Constructor<T>[] declaredConstructors;
+ volatile Constructor<T>[] publicConstructors;
+ // Intermediate results for getFields and getMethods
+ volatile Field[] declaredPublicFields;
+ volatile Method[] declaredPublicMethods;
+ // Value of classRedefinedCount when we created this ReflectionData instance
+ final int redefinedCount;
+
+ ReflectionData(int redefinedCount) {
+ this.redefinedCount = redefinedCount;
+ }
+ }
+
+ private volatile transient SoftReference<ReflectionData<T>> reflectionData;
// Incremented by the VM on each call to JVM TI RedefineClasses()
// that redefines this class or a superclass.
private volatile transient int classRedefinedCount = 0;
- // Value of classRedefinedCount when we last cleared the cached values
- // that are sensitive to class redefinition.
- private volatile transient int lastRedefinedCount = 0;
+ // Lazily create and cache ReflectionData
+ private ReflectionData<T> reflectionData() {
+ SoftReference<ReflectionData<T>> reflectionData = this.reflectionData;
+ int classRedefinedCount = this.classRedefinedCount;
+ ReflectionData<T> rd;
+ if (useCaches &&
+ reflectionData != null &&
+ (rd = reflectionData.get()) != null &&
+ rd.redefinedCount == classRedefinedCount) {
+ return rd;
+ }
+ // else no SoftReference or cleared SoftReference or stale ReflectionData
+ // -> create and replace new instance
+ return newReflectionData(reflectionData, classRedefinedCount);
+ }
- // Clears cached values that might possibly have been obsoleted by
- // a class redefinition.
- private void clearCachesOnClassRedefinition() {
- if (lastRedefinedCount != classRedefinedCount) {
- declaredFields = publicFields = declaredPublicFields = null;
- declaredMethods = publicMethods = declaredPublicMethods = null;
- declaredConstructors = publicConstructors = null;
- annotations = declaredAnnotations = null;
+ private ReflectionData<T> newReflectionData(SoftReference<ReflectionData<T>> oldReflectionData,
+ int classRedefinedCount) {
+ if (!useCaches) return null;
- // Use of "volatile" (and synchronization by caller in the case
- // of annotations) ensures that no thread sees the update to
- // lastRedefinedCount before seeing the caches cleared.
- // We do not guard against brief windows during which multiple
- // threads might redundantly work to fill an empty cache.
- lastRedefinedCount = classRedefinedCount;
+ while (true) {
+ ReflectionData<T> rd = new ReflectionData<>(classRedefinedCount);
+ // try to CAS it...
+ if (Atomic.casReflectionData(this, oldReflectionData, new SoftReference<>(rd))) {
+ return rd;
+ }
+ // else retry
+ oldReflectionData = this.reflectionData;
+ classRedefinedCount = this.classRedefinedCount;
+ if (oldReflectionData != null &&
+ (rd = oldReflectionData.get()) != null &&
+ rd.redefinedCount == classRedefinedCount) {
+ return rd;
+ }
}
}
@@ -2403,7 +2469,7 @@
}
// Annotations handling
- private native byte[] getRawAnnotations();
+ native byte[] getRawAnnotations();
native ConstantPool getConstantPool();
@@ -2418,27 +2484,19 @@
// via ReflectionFactory.copyField.
private Field[] privateGetDeclaredFields(boolean publicOnly) {
checkInitted();
- Field[] res = null;
- if (useCaches) {
- clearCachesOnClassRedefinition();
- if (publicOnly) {
- if (declaredPublicFields != null) {
- res = declaredPublicFields.get();
- }
- } else {
- if (declaredFields != null) {
- res = declaredFields.get();
- }
- }
+ Field[] res;
+ ReflectionData<T> rd = reflectionData();
+ if (rd != null) {
+ res = publicOnly ? rd.declaredPublicFields : rd.declaredFields;
if (res != null) return res;
}
// No cached value available; request value from VM
res = Reflection.filterFields(this, getDeclaredFields0(publicOnly));
- if (useCaches) {
+ if (rd != null) {
if (publicOnly) {
- declaredPublicFields = new SoftReference<>(res);
+ rd.declaredPublicFields = res;
} else {
- declaredFields = new SoftReference<>(res);
+ rd.declaredFields = res;
}
}
return res;
@@ -2449,12 +2507,10 @@
// via ReflectionFactory.copyField.
private Field[] privateGetPublicFields(Set<Class<?>> traversedInterfaces) {
checkInitted();
- Field[] res = null;
- if (useCaches) {
- clearCachesOnClassRedefinition();
- if (publicFields != null) {
- res = publicFields.get();
- }
+ Field[] res;
+ ReflectionData<T> rd = reflectionData();
+ if (rd != null) {
+ res = rd.publicFields;
if (res != null) return res;
}
@@ -2487,8 +2543,8 @@
res = new Field[fields.size()];
fields.toArray(res);
- if (useCaches) {
- publicFields = new SoftReference<>(res);
+ if (rd != null) {
+ rd.publicFields = res;
}
return res;
}
@@ -2511,18 +2567,10 @@
// instead be copied via ReflectionFactory.copyConstructor.
private Constructor<T>[] privateGetDeclaredConstructors(boolean publicOnly) {
checkInitted();
- Constructor<T>[] res = null;
- if (useCaches) {
- clearCachesOnClassRedefinition();
- if (publicOnly) {
- if (publicConstructors != null) {
- res = publicConstructors.get();
- }
- } else {
- if (declaredConstructors != null) {
- res = declaredConstructors.get();
- }
- }
+ Constructor<T>[] res;
+ ReflectionData<T> rd = reflectionData();
+ if (rd != null) {
+ res = publicOnly ? rd.publicConstructors : rd.declaredConstructors;
if (res != null) return res;
}
// No cached value available; request value from VM
@@ -2531,11 +2579,11 @@
} else {
res = getDeclaredConstructors0(publicOnly);
}
- if (useCaches) {
+ if (rd != null) {
if (publicOnly) {
- publicConstructors = new SoftReference<>(res);
+ rd.publicConstructors = res;
} else {
- declaredConstructors = new SoftReference<>(res);
+ rd.declaredConstructors = res;
}
}
return res;
@@ -2552,27 +2600,19 @@
// via ReflectionFactory.copyMethod.
private Method[] privateGetDeclaredMethods(boolean publicOnly) {
checkInitted();
- Method[] res = null;
- if (useCaches) {
- clearCachesOnClassRedefinition();
- if (publicOnly) {
- if (declaredPublicMethods != null) {
- res = declaredPublicMethods.get();
- }
- } else {
- if (declaredMethods != null) {
- res = declaredMethods.get();
- }
- }
+ Method[] res;
+ ReflectionData<T> rd = reflectionData();
+ if (rd != null) {
+ res = publicOnly ? rd.declaredPublicMethods : rd.declaredMethods;
if (res != null) return res;
}
// No cached value available; request value from VM
res = Reflection.filterMethods(this, getDeclaredMethods0(publicOnly));
- if (useCaches) {
+ if (rd != null) {
if (publicOnly) {
- declaredPublicMethods = new SoftReference<>(res);
+ rd.declaredPublicMethods = res;
} else {
- declaredMethods = new SoftReference<>(res);
+ rd.declaredMethods = res;
}
}
return res;
@@ -2674,12 +2714,10 @@
// via ReflectionFactory.copyMethod.
private Method[] privateGetPublicMethods() {
checkInitted();
- Method[] res = null;
- if (useCaches) {
- clearCachesOnClassRedefinition();
- if (publicMethods != null) {
- res = publicMethods.get();
- }
+ Method[] res;
+ ReflectionData<T> rd = reflectionData();
+ if (rd != null) {
+ res = rd.publicMethods;
if (res != null) return res;
}
@@ -2727,8 +2765,8 @@
methods.addAllIfNotPresent(inheritedMethods);
methods.compactAndTrim();
res = methods.getArray();
- if (useCaches) {
- publicMethods = new SoftReference<>(res);
+ if (rd != null) {
+ rd.publicMethods = res;
}
return res;
}
@@ -2738,7 +2776,7 @@
// Helpers for fetchers of one field, method, or constructor
//
- private Field searchFields(Field[] fields, String name) {
+ private static Field searchFields(Field[] fields, String name) {
String internedName = name.intern();
for (int i = 0; i < fields.length; i++) {
if (fields[i].getName() == internedName) {
@@ -2756,7 +2794,7 @@
// of Field objects which have to be created for the common
// case where the field being requested is declared in the
// class which is being queried.
- Field res = null;
+ Field res;
// Search declared public fields
if ((res = searchFields(privateGetDeclaredFields(true), name)) != null) {
return res;
@@ -2808,7 +2846,7 @@
// number of Method objects which have to be created for the
// common case where the method being requested is declared in
// the class which is being queried.
- Method res = null;
+ Method res;
// Search declared public methods
if ((res = searchMethods(privateGetDeclaredMethods(true),
name,
@@ -3209,9 +3247,20 @@
// Annotations cache
private transient Map<Class<? extends Annotation>, Annotation> annotations;
private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
+ // Value of classRedefinedCount when we last cleared the cached annotations and declaredAnnotations fields
+ private transient int lastAnnotationsRedefinedCount = 0;
+
+ // Clears cached values that might possibly have been obsoleted by
+ // a class redefinition.
+ private void clearAnnotationCachesOnClassRedefinition() {
+ if (lastAnnotationsRedefinedCount != classRedefinedCount) {
+ annotations = declaredAnnotations = null;
+ lastAnnotationsRedefinedCount = classRedefinedCount;
+ }
+ }
private synchronized void initAnnotationsIfNecessary() {
- clearCachesOnClassRedefinition();
+ clearAnnotationCachesOnClassRedefinition();
if (annotations != null)
return;
declaredAnnotations = AnnotationParser.parseAnnotations(
@@ -3233,10 +3282,11 @@
// Annotation types cache their internal (AnnotationType) form
- private AnnotationType annotationType;
+ @SuppressWarnings("UnusedDeclaration")
+ private volatile transient AnnotationType annotationType;
- void setAnnotationType(AnnotationType type) {
- annotationType = type;
+ boolean casAnnotationType(AnnotationType oldType, AnnotationType newType) {
+ return Atomic.casAnnotationType(this, oldType, newType);
}
AnnotationType getAnnotationType() {
diff --git a/jdk/src/share/classes/java/lang/System.java b/jdk/src/share/classes/java/lang/System.java
index d7e1e4f..2165536 100644
--- a/jdk/src/share/classes/java/lang/System.java
+++ b/jdk/src/share/classes/java/lang/System.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1178,12 +1178,15 @@
public sun.reflect.ConstantPool getConstantPool(Class klass) {
return klass.getConstantPool();
}
- public void setAnnotationType(Class klass, AnnotationType type) {
- klass.setAnnotationType(type);
+ public boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType) {
+ return klass.casAnnotationType(oldType, newType);
}
public AnnotationType getAnnotationType(Class klass) {
return klass.getAnnotationType();
}
+ public byte[] getRawClassAnnotations(Class<?> klass) {
+ return klass.getRawAnnotations();
+ }
public <E extends Enum<E>>
E[] getEnumConstantsShared(Class<E> klass) {
return klass.getEnumConstantsShared();
diff --git a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java
index d4783ed..e6bda82 100644
--- a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java
+++ b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java
@@ -243,12 +243,12 @@
assert(names.length == nameCursor);
if (doesAlloc) {
// names = { argx,y,z,... new C, init method }
- names[NEW_OBJ] = new Name(NF_allocateInstance, names[DMH_THIS]);
- names[GET_MEMBER] = new Name(NF_constructorMethod, names[DMH_THIS]);
+ names[NEW_OBJ] = new Name(Lazy.NF_allocateInstance, names[DMH_THIS]);
+ names[GET_MEMBER] = new Name(Lazy.NF_constructorMethod, names[DMH_THIS]);
} else if (needsInit) {
- names[GET_MEMBER] = new Name(NF_internalMemberNameEnsureInit, names[DMH_THIS]);
+ names[GET_MEMBER] = new Name(Lazy.NF_internalMemberNameEnsureInit, names[DMH_THIS]);
} else {
- names[GET_MEMBER] = new Name(NF_internalMemberName, names[DMH_THIS]);
+ names[GET_MEMBER] = new Name(Lazy.NF_internalMemberName, names[DMH_THIS]);
}
Object[] outArgs = Arrays.copyOfRange(names, ARG_BASE, GET_MEMBER+1, Object[].class);
assert(outArgs[outArgs.length-1] == names[GET_MEMBER]); // look, shifted args!
@@ -596,18 +596,18 @@
final int RESULT = nameCursor-1; // either the call or the cast
Name[] names = arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
if (needsInit)
- names[INIT_BAR] = new Name(NF_ensureInitialized, names[DMH_THIS]);
+ names[INIT_BAR] = new Name(Lazy.NF_ensureInitialized, names[DMH_THIS]);
if (needsCast && !isGetter)
- names[PRE_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[SET_VALUE]);
+ names[PRE_CAST] = new Name(Lazy.NF_checkCast, names[DMH_THIS], names[SET_VALUE]);
Object[] outArgs = new Object[1 + linkerType.parameterCount()];
assert(outArgs.length == (isGetter ? 3 : 4));
outArgs[0] = UNSAFE;
if (isStatic) {
- outArgs[1] = names[F_HOLDER] = new Name(NF_staticBase, names[DMH_THIS]);
- outArgs[2] = names[F_OFFSET] = new Name(NF_staticOffset, names[DMH_THIS]);
+ outArgs[1] = names[F_HOLDER] = new Name(Lazy.NF_staticBase, names[DMH_THIS]);
+ outArgs[2] = names[F_OFFSET] = new Name(Lazy.NF_staticOffset, names[DMH_THIS]);
} else {
- outArgs[1] = names[OBJ_CHECK] = new Name(NF_checkBase, names[OBJ_BASE]);
- outArgs[2] = names[F_OFFSET] = new Name(NF_fieldOffset, names[DMH_THIS]);
+ outArgs[1] = names[OBJ_CHECK] = new Name(Lazy.NF_checkBase, names[OBJ_BASE]);
+ outArgs[2] = names[F_OFFSET] = new Name(Lazy.NF_fieldOffset, names[DMH_THIS]);
}
if (!isGetter) {
outArgs[3] = (needsCast ? names[PRE_CAST] : names[SET_VALUE]);
@@ -615,7 +615,7 @@
for (Object a : outArgs) assert(a != null);
names[LINKER_CALL] = new Name(linker, outArgs);
if (needsCast && isGetter)
- names[POST_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[LINKER_CALL]);
+ names[POST_CAST] = new Name(Lazy.NF_checkCast, names[DMH_THIS], names[LINKER_CALL]);
for (Name n : names) assert(n != null);
String fieldOrStatic = (isStatic ? "Static" : "Field");
String lambdaName = (linkerName + fieldOrStatic); // significant only for debugging
@@ -624,48 +624,54 @@
return new LambdaForm(lambdaName, ARG_LIMIT, names, RESULT);
}
- private static final NamedFunction
- NF_internalMemberName,
- NF_internalMemberNameEnsureInit,
- NF_ensureInitialized,
- NF_fieldOffset,
- NF_checkBase,
- NF_staticBase,
- NF_staticOffset,
- NF_checkCast,
- NF_allocateInstance,
- NF_constructorMethod;
- static {
- try {
- NamedFunction nfs[] = {
- NF_internalMemberName = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("internalMemberName", Object.class)),
- NF_internalMemberNameEnsureInit = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("internalMemberNameEnsureInit", Object.class)),
- NF_ensureInitialized = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("ensureInitialized", Object.class)),
- NF_fieldOffset = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("fieldOffset", Object.class)),
- NF_checkBase = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("checkBase", Object.class)),
- NF_staticBase = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("staticBase", Object.class)),
- NF_staticOffset = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("staticOffset", Object.class)),
- NF_checkCast = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("checkCast", Object.class, Object.class)),
- NF_allocateInstance = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("allocateInstance", Object.class)),
- NF_constructorMethod = new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("constructorMethod", Object.class))
- };
- for (NamedFunction nf : nfs) {
- // Each nf must be statically invocable or we get tied up in our bootstraps.
- assert(InvokerBytecodeGenerator.isStaticallyInvocable(nf.member)) : nf;
- nf.resolve();
+ /**
+ * Pre-initialized NamedFunctions for bootstrapping purposes.
+ * Factored in an inner class to delay initialization until first usage.
+ */
+ private static class Lazy {
+ static final NamedFunction
+ NF_internalMemberName,
+ NF_internalMemberNameEnsureInit,
+ NF_ensureInitialized,
+ NF_fieldOffset,
+ NF_checkBase,
+ NF_staticBase,
+ NF_staticOffset,
+ NF_checkCast,
+ NF_allocateInstance,
+ NF_constructorMethod;
+ static {
+ try {
+ NamedFunction nfs[] = {
+ NF_internalMemberName = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("internalMemberName", Object.class)),
+ NF_internalMemberNameEnsureInit = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("internalMemberNameEnsureInit", Object.class)),
+ NF_ensureInitialized = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("ensureInitialized", Object.class)),
+ NF_fieldOffset = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("fieldOffset", Object.class)),
+ NF_checkBase = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("checkBase", Object.class)),
+ NF_staticBase = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("staticBase", Object.class)),
+ NF_staticOffset = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("staticOffset", Object.class)),
+ NF_checkCast = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("checkCast", Object.class, Object.class)),
+ NF_allocateInstance = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("allocateInstance", Object.class)),
+ NF_constructorMethod = new NamedFunction(DirectMethodHandle.class
+ .getDeclaredMethod("constructorMethod", Object.class))
+ };
+ for (NamedFunction nf : nfs) {
+ // Each nf must be statically invocable or we get tied up in our bootstraps.
+ assert(InvokerBytecodeGenerator.isStaticallyInvocable(nf.member)) : nf;
+ nf.resolve();
+ }
+ } catch (ReflectiveOperationException ex) {
+ throw newInternalError(ex);
}
- } catch (ReflectiveOperationException ex) {
- throw newInternalError(ex);
}
}
}
diff --git a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index ca60316..55bf6ae 100644
--- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -613,6 +613,12 @@
return false; // inner class of some sort
if (cls.getClassLoader() != MethodHandle.class.getClassLoader())
return false; // not on BCP
+ MethodType mtype = member.getMethodOrFieldType();
+ if (!isStaticallyNameable(mtype.returnType()))
+ return false;
+ for (Class<?> ptype : mtype.parameterArray())
+ if (!isStaticallyNameable(ptype))
+ return false;
if (!member.isPrivate() && VerifyAccess.isSamePackage(MethodHandle.class, cls))
return true; // in java.lang.invoke package
if (member.isPublic() && isStaticallyNameable(cls))
diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java
index 2a6b8c1..ced6799 100644
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java
@@ -753,6 +753,10 @@
* to the target method handle.
* (The array may also be null when zero elements are required.)
* <p>
+ * If, when the adapter is called, the supplied array argument does
+ * not have the correct number of elements, the adapter will throw
+ * an {@link IllegalArgumentException} instead of invoking the target.
+ * <p>
* Here are some simple examples of array-spreading method handles:
* <blockquote><pre>
MethodHandle equals = publicLookup()
@@ -763,6 +767,12 @@
MethodHandle eq2 = equals.asSpreader(Object[].class, 2);
assert( (boolean) eq2.invokeExact(new Object[]{ "me", "me" }));
assert(!(boolean) eq2.invokeExact(new Object[]{ "me", "thee" }));
+// try to spread from anything but a 2-array:
+for (int n = 0; n <= 10; n++) {
+ Object[] badArityArgs = (n == 2 ? null : new Object[n]);
+ try { assert((boolean) eq2.invokeExact(badArityArgs) && false); }
+ catch (IllegalArgumentException ex) { } // OK
+}
// spread both arguments from a String array:
MethodHandle eq2s = equals.asSpreader(String[].class, 2);
assert( (boolean) eq2s.invokeExact(new String[]{ "me", "me" }));
diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java
index fec037f..30c4493 100644
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -430,7 +430,7 @@
// Spread the array.
MethodHandle aload = MethodHandles.arrayElementGetter(spreadArgType);
Name array = names[argIndex];
- names[nameCursor++] = new Name(NF_checkSpreadArgument, array, spreadArgCount);
+ names[nameCursor++] = new Name(Lazy.NF_checkSpreadArgument, array, spreadArgCount);
for (int j = 0; j < spreadArgCount; i++, j++) {
indexes[i] = nameCursor;
names[nameCursor++] = new Name(aload, array, j);
@@ -454,14 +454,8 @@
}
static void checkSpreadArgument(Object av, int n) {
- // FIXME: regression test for bug 7141637 erroneously expects an NPE, and other tests may expect IAE
- // but the actual exception raised by an arity mismatch should be WMTE
- final boolean RAISE_RANDOM_EXCEPTIONS = true; // FIXME: delete in JSR 292 M1
if (av == null) {
if (n == 0) return;
- int len;
- if (RAISE_RANDOM_EXCEPTIONS)
- len = ((Object[])av).length; // throw NPE; but delete this after tests are fixed
} else if (av instanceof Object[]) {
int len = ((Object[])av).length;
if (len == n) return;
@@ -470,19 +464,23 @@
if (len == n) return;
}
// fall through to error:
- if (RAISE_RANDOM_EXCEPTIONS)
- throw newIllegalArgumentException("Array is not of length "+n);
- throw new WrongMethodTypeException("Array is not of length "+n);
+ throw newIllegalArgumentException("array is not of length "+n);
}
- private static final NamedFunction NF_checkSpreadArgument;
- static {
- try {
- NF_checkSpreadArgument = new NamedFunction(MethodHandleImpl.class
- .getDeclaredMethod("checkSpreadArgument", Object.class, int.class));
- NF_checkSpreadArgument.resolve();
- } catch (ReflectiveOperationException ex) {
- throw newInternalError(ex);
+ /**
+ * Pre-initialized NamedFunctions for bootstrapping purposes.
+ * Factored in an inner class to delay initialization until first usage.
+ */
+ private static class Lazy {
+ static final NamedFunction NF_checkSpreadArgument;
+ static {
+ try {
+ NF_checkSpreadArgument = new NamedFunction(MethodHandleImpl.class
+ .getDeclaredMethod("checkSpreadArgument", Object.class, int.class));
+ NF_checkSpreadArgument.resolve();
+ } catch (ReflectiveOperationException ex) {
+ throw newInternalError(ex);
+ }
}
}
diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java
index 2f37b16..3dbe40b 100644
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java
@@ -248,6 +248,9 @@
* In general, the conditions under which a method handle may be
* looked up for a method {@code M} are exactly equivalent to the conditions
* under which the lookup class could have compiled and resolved a call to {@code M}.
+ * Where the JVM would raise exceptions like {@code NoSuchMethodError},
+ * a method handle lookup will generally raise a corresponding
+ * checked exception, such as {@code NoSuchMethodException}.
* And the effect of invoking the method handle resulting from the lookup
* is exactly equivalent to executing the compiled and resolved call to {@code M}.
* The same point is true of fields and constructors.
@@ -264,6 +267,12 @@
* (which will necessarily be a superclass of the lookup class)
* to the lookup class itself.
* <p>
+ * The JVM represents constructors and static initializer blocks as internal methods
+ * with special names ({@code "<init>"} and {@code "<clinit>"}).
+ * The internal syntax of invocation instructions allows them to refer to such internal
+ * methods as if they were normal methods, but the JVM verifier rejects them.
+ * A lookup of such an internal method will produce a {@code NoSuchMethodException}.
+ * <p>
* In some cases, access between nested classes is obtained by the Java compiler by creating
* an wrapper method to access a private method of another class
* in the same top-level declaration.
@@ -578,6 +587,15 @@
* The returned method handle will have
* {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
* the method's variable arity modifier bit ({@code 0x0080}) is set.
+ * <b>Example:</b>
+ * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle MH_asList = publicLookup().findStatic(Arrays.class,
+ "asList", methodType(List.class, Object[].class));
+assertEquals("[x, y]", MH_asList.invoke("x", "y").toString());
+ * }</pre></blockquote>
* @param refc the class from which the method is accessed
* @param name the name of the method
* @param type the type of the method
@@ -628,6 +646,34 @@
* {@link java.lang.invoke.MethodHandles#invoker MethodHandles.invoker}
* with the same {@code type} argument.
*
+ * <b>Example:</b>
+ * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle MH_concat = publicLookup().findVirtual(String.class,
+ "concat", methodType(String.class, String.class));
+MethodHandle MH_hashCode = publicLookup().findVirtual(Object.class,
+ "hashCode", methodType(int.class));
+MethodHandle MH_hashCode_String = publicLookup().findVirtual(String.class,
+ "hashCode", methodType(int.class));
+assertEquals("xy", (String) MH_concat.invokeExact("x", "y"));
+assertEquals("xy".hashCode(), (int) MH_hashCode.invokeExact((Object)"xy"));
+assertEquals("xy".hashCode(), (int) MH_hashCode_String.invokeExact("xy"));
+// interface method:
+MethodHandle MH_subSequence = publicLookup().findVirtual(CharSequence.class,
+ "subSequence", methodType(CharSequence.class, int.class, int.class));
+assertEquals("def", MH_subSequence.invoke("abcdefghi", 3, 6).toString());
+// constructor "internal method" must be accessed differently:
+MethodType MT_newString = methodType(void.class); //()V for new String()
+try { assertEquals("impossible", lookup()
+ .findVirtual(String.class, "<init>", MT_newString));
+ } catch (NoSuchMethodException ex) { } // OK
+MethodHandle MH_newString = publicLookup()
+ .findConstructor(String.class, MT_newString);
+assertEquals("", (String) MH_newString.invokeExact());
+ * }</pre></blockquote>
+ *
* @param refc the class or interface from which the method is accessed
* @param name the name of the method
* @param type the type of the method, with the receiver argument omitted
@@ -669,12 +715,30 @@
* If the constructor's class has not yet been initialized, that is done
* immediately, before the method handle is returned.
* <p>
- * Note: The requested type must have a return type of {@code void}.
- * This is consistent with the JVM's treatment of constructor type descriptors.
+ * <em>(Note: The requested type must have a return type of {@code void}.
+ * This is consistent with the JVM's treatment of constructor type descriptors.)</em>
* <p>
* The returned method handle will have
* {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
* the constructor's variable arity modifier bit ({@code 0x0080}) is set.
+ * <b>Example:</b>
+ * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle MH_newArrayList = publicLookup().findConstructor(
+ ArrayList.class, methodType(void.class, Collection.class));
+Collection orig = Arrays.asList("x", "y");
+Collection copy = (ArrayList) MH_newArrayList.invokeExact(orig);
+assert(orig != copy);
+assertEquals(orig, copy);
+// a variable-arity constructor:
+MethodHandle MH_newProcessBuilder = publicLookup().findConstructor(
+ ProcessBuilder.class, methodType(void.class, String[].class));
+ProcessBuilder pb = (ProcessBuilder)
+ MH_newProcessBuilder.invoke("x", "y", "z");
+assertEquals("[x, y, z]", pb.command().toString());
+ * }</pre></blockquote>
* @param refc the class or interface from which the method is accessed
* @param type the type of the method, with the receiver argument omitted, and a void return type
* @return the desired method handle
@@ -714,6 +778,45 @@
* The returned method handle will have
* {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
* the method's variable arity modifier bit ({@code 0x0080}) is set.
+ * <p>
+ * <em>(Note: JVM internal methods named {@code <init>} not visible to this API,
+ * even though the {@code invokespecial} instruction can refer to them
+ * in special circumstances. Use {@link #findConstructor findConstructor}
+ * to access instance initialization methods in a safe manner.)</em>
+ * <b>Example:</b>
+ * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+static class Listie extends ArrayList {
+ public String toString() { return "[wee Listie]"; }
+ static Lookup lookup() { return MethodHandles.lookup(); }
+}
+...
+// no access to constructor via invokeSpecial:
+MethodHandle MH_newListie = Listie.lookup()
+ .findConstructor(Listie.class, methodType(void.class));
+Listie l = (Listie) MH_newListie.invokeExact();
+try { assertEquals("impossible", Listie.lookup().findSpecial(
+ Listie.class, "<init>", methodType(void.class), Listie.class));
+ } catch (NoSuchMethodException ex) { } // OK
+// access to super and self methods via invokeSpecial:
+MethodHandle MH_super = Listie.lookup().findSpecial(
+ ArrayList.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_this = Listie.lookup().findSpecial(
+ Listie.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_duper = Listie.lookup().findSpecial(
+ Object.class, "toString" , methodType(String.class), Listie.class);
+assertEquals("[]", (String) MH_super.invokeExact(l));
+assertEquals(""+l, (String) MH_this.invokeExact(l));
+assertEquals("[]", (String) MH_duper.invokeExact(l)); // ArrayList method
+try { assertEquals("inaccessible", Listie.lookup().findSpecial(
+ String.class, "toString", methodType(String.class), Listie.class));
+ } catch (IllegalAccessException ex) { } // OK
+Listie subl = new Listie() { public String toString() { return "[subclass]"; } };
+assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
+ * }</pre></blockquote>
+ *
* @param refc the class or interface from which the method is accessed
* @param name the name of the method (which must not be "<init>")
* @param type the type of the method, with the receiver argument omitted
@@ -1017,15 +1120,16 @@
/// Helper methods, all package-private.
MemberName resolveOrFail(byte refKind, Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
- checkSymbolicClass(refc); // do this before attempting to resolve
name.getClass(); type.getClass(); // NPE
+ checkSymbolicClass(refc); // do this before attempting to resolve
return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
NoSuchFieldException.class);
}
MemberName resolveOrFail(byte refKind, Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
+ type.getClass(); // NPE
checkSymbolicClass(refc); // do this before attempting to resolve
- name.getClass(); type.getClass(); // NPE
+ checkMethodName(refKind, name);
return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
NoSuchMethodException.class);
}
@@ -1036,6 +1140,12 @@
throw new MemberName(refc).makeAccessException("symbolic reference class is not public", this);
}
+ void checkMethodName(byte refKind, String name) throws NoSuchMethodException {
+ if (name.startsWith("<") && refKind != REF_newInvokeSpecial)
+ throw new NoSuchMethodException("illegal method name: "+name);
+ }
+
+
/**
* Find my trustable caller class if m is a caller sensitive method.
* If this lookup object has private access, then the caller class is the lookupClass.
@@ -1406,6 +1516,9 @@
* <p>
* Before invoking its target, the invoker will spread the final array, apply
* reference casts as necessary, and unbox and widen primitive arguments.
+ * If, when the invoker is called, the supplied array argument does
+ * not have the correct number of elements, the invoker will throw
+ * an {@link IllegalArgumentException} instead of invoking the target.
* <p>
* This method is equivalent to the following code (though it may be more efficient):
* <p><blockquote><pre>
diff --git a/jdk/src/share/classes/java/net/CookieManager.java b/jdk/src/share/classes/java/net/CookieManager.java
index 532999b..caacbcf 100644
--- a/jdk/src/share/classes/java/net/CookieManager.java
+++ b/jdk/src/share/classes/java/net/CookieManager.java
@@ -310,7 +310,10 @@
// there is no dot at the beginning of effective request-host,
// the default Domain can only domain-match itself.)
if (cookie.getDomain() == null) {
- cookie.setDomain(uri.getHost());
+ String host = uri.getHost();
+ if (host != null && !host.contains("."))
+ host += ".local";
+ cookie.setDomain(host);
}
String ports = cookie.getPortlist();
if (ports != null) {
diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java
index a984cc3..fae3d8a 100644
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -867,7 +867,7 @@
return descriptors;
}
- private FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+ protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
String fontName = fontNames[fontIndex];
String styleName = styleNames[styleIndex];
diff --git a/jdk/src/share/classes/sun/invoke/util/VerifyAccess.java b/jdk/src/share/classes/sun/invoke/util/VerifyAccess.java
index 28436d7..41220d6 100644
--- a/jdk/src/share/classes/sun/invoke/util/VerifyAccess.java
+++ b/jdk/src/share/classes/sun/invoke/util/VerifyAccess.java
@@ -117,7 +117,7 @@
isSamePackage(defc, lookupClass))
return true;
if ((allowedModes & PROTECTED) != 0 &&
- isPublicSuperClass(defc, lookupClass))
+ isSuperClass(defc, lookupClass))
return true;
return false;
case PACKAGE_ONLY: // That is, zero. Unmarked member is package-only access.
@@ -139,8 +139,8 @@
lookupClass.isAssignableFrom(refc));
}
- static boolean isPublicSuperClass(Class<?> defc, Class<?> lookupClass) {
- return isPublic(defc.getModifiers()) && defc.isAssignableFrom(lookupClass);
+ static boolean isSuperClass(Class<?> defc, Class<?> lookupClass) {
+ return defc.isAssignableFrom(lookupClass);
}
/**
diff --git a/jdk/src/share/classes/sun/misc/JavaLangAccess.java b/jdk/src/share/classes/sun/misc/JavaLangAccess.java
index 09cd1bd..66680f3 100644
--- a/jdk/src/share/classes/sun/misc/JavaLangAccess.java
+++ b/jdk/src/share/classes/sun/misc/JavaLangAccess.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,10 @@
ConstantPool getConstantPool(Class klass);
/**
- * Set the AnnotationType instance corresponding to this class.
+ * Compare-And-Swap the AnnotationType instance corresponding to this class.
* (This method only applies to annotation types.)
*/
- void setAnnotationType(Class klass, AnnotationType annotationType);
+ boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType);
/**
* Get the AnnotationType instance corresponding to this class.
@@ -47,6 +47,12 @@
AnnotationType getAnnotationType(Class klass);
/**
+ * Get the array of bytes that is the class-file representation
+ * of this Class' annotations.
+ */
+ byte[] getRawClassAnnotations(Class<?> klass);
+
+ /**
* Returns the elements of an enum class or null if the
* Class object does not represent an enum type;
* the result is uncloned, cached, and shared by all callers.
diff --git a/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java b/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java
index 2a0e35a..2e53a8c 100644
--- a/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java
+++ b/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java
@@ -125,7 +125,7 @@
completeHeader = getHeader(preferredChunkDataSize);
/* start with an initial buffer */
- buf = new byte[preferredChunkDataSize + 32];
+ buf = new byte[preferredChunkGrossSize];
reset();
}
diff --git a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java
index d42bb90..86d3ab1 100644
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,35 @@
return Collections.emptyMap();
try {
- return parseAnnotations2(rawAnnotations, constPool, container);
+ return parseAnnotations2(rawAnnotations, constPool, container, null);
+ } catch(BufferUnderflowException e) {
+ throw new AnnotationFormatError("Unexpected end of annotations.");
+ } catch(IllegalArgumentException e) {
+ // Type mismatch in constant pool
+ throw new AnnotationFormatError(e);
+ }
+ }
+
+ /**
+ * Like {@link #parseAnnotations(byte[], sun.reflect.ConstantPool, Class)}
+ * with an additional parameter {@code selectAnnotationClasses} which selects the
+ * annotation types to parse (other than selected are quickly skipped).<p>
+ * This method is only used to parse select meta annotations in the construction
+ * phase of {@link AnnotationType} instances to prevent infinite recursion.
+ *
+ * @param selectAnnotationClasses an array of annotation types to select when parsing
+ */
+ @SafeVarargs
+ static Map<Class<? extends Annotation>, Annotation> parseSelectAnnotations(
+ byte[] rawAnnotations,
+ ConstantPool constPool,
+ Class<?> container,
+ Class<? extends Annotation> ... selectAnnotationClasses) {
+ if (rawAnnotations == null)
+ return Collections.emptyMap();
+
+ try {
+ return parseAnnotations2(rawAnnotations, constPool, container, selectAnnotationClasses);
} catch(BufferUnderflowException e) {
throw new AnnotationFormatError("Unexpected end of annotations.");
} catch(IllegalArgumentException e) {
@@ -79,22 +107,23 @@
private static Map<Class<? extends Annotation>, Annotation> parseAnnotations2(
byte[] rawAnnotations,
ConstantPool constPool,
- Class<?> container) {
+ Class<?> container,
+ Class<? extends Annotation>[] selectAnnotationClasses) {
Map<Class<? extends Annotation>, Annotation> result =
new LinkedHashMap<Class<? extends Annotation>, Annotation>();
ByteBuffer buf = ByteBuffer.wrap(rawAnnotations);
int numAnnotations = buf.getShort() & 0xFFFF;
for (int i = 0; i < numAnnotations; i++) {
- Annotation a = parseAnnotation(buf, constPool, container, false);
+ Annotation a = parseAnnotation2(buf, constPool, container, false, selectAnnotationClasses);
if (a != null) {
Class<? extends Annotation> klass = a.annotationType();
- AnnotationType type = AnnotationType.getInstance(klass);
- if (type.retention() == RetentionPolicy.RUNTIME)
- if (result.put(klass, a) != null)
+ if (AnnotationType.getInstance(klass).retention() == RetentionPolicy.RUNTIME &&
+ result.put(klass, a) != null) {
throw new AnnotationFormatError(
"Duplicate annotation for class: "+klass+": " + a);
}
}
+ }
return result;
}
@@ -191,6 +220,15 @@
ConstantPool constPool,
Class<?> container,
boolean exceptionOnMissingAnnotationClass) {
+ return parseAnnotation2(buf, constPool, container, exceptionOnMissingAnnotationClass, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Annotation parseAnnotation2(ByteBuffer buf,
+ ConstantPool constPool,
+ Class<?> container,
+ boolean exceptionOnMissingAnnotationClass,
+ Class<? extends Annotation>[] selectAnnotationClasses) {
int typeIndex = buf.getShort() & 0xFFFF;
Class<? extends Annotation> annotationClass = null;
String sig = "[unknown]";
@@ -216,6 +254,10 @@
skipAnnotation(buf, false);
return null;
}
+ if (selectAnnotationClasses != null && !contains(selectAnnotationClasses, annotationClass)) {
+ skipAnnotation(buf, false);
+ return null;
+ }
AnnotationType type = null;
try {
type = AnnotationType.getInstance(annotationClass);
@@ -791,6 +833,17 @@
skipMemberValue(buf);
}
+ /**
+ * Searches for given {@code element} in given {@code array} by identity.
+ * Returns {@code true} if found {@code false} if not.
+ */
+ private static boolean contains(Object[] array, Object element) {
+ for (Object e : array)
+ if (e == element)
+ return true;
+ return false;
+ }
+
/*
* This method converts the annotation map returned by the parseAnnotations()
* method to an array. It is called by Field.getDeclaredAnnotations(),
diff --git a/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java b/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java
index 530834c..a896213 100644
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
package sun.reflect.annotation;
+import sun.misc.JavaLangAccess;
+
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
@@ -45,29 +47,28 @@
* types. This matches the return value that must be used for a
* dynamic proxy, allowing for a simple isInstance test.
*/
- private final Map<String, Class<?>> memberTypes = new HashMap<String,Class<?>>();
+ private final Map<String, Class<?>> memberTypes;
/**
* Member name -> default value mapping.
*/
- private final Map<String, Object> memberDefaults =
- new HashMap<String, Object>();
+ private final Map<String, Object> memberDefaults;
/**
- * Member name -> Method object mapping. This (and its assoicated
+ * Member name -> Method object mapping. This (and its associated
* accessor) are used only to generate AnnotationTypeMismatchExceptions.
*/
- private final Map<String, Method> members = new HashMap<String, Method>();
+ private final Map<String, Method> members;
/**
* The retention policy for this annotation type.
*/
- private RetentionPolicy retention = RetentionPolicy.RUNTIME;;
+ private final RetentionPolicy retention;
/**
* Whether this annotation type is inherited.
*/
- private boolean inherited = false;
+ private final boolean inherited;
/**
* Returns an AnnotationType instance for the specified annotation type.
@@ -75,13 +76,20 @@
* @throw IllegalArgumentException if the specified class object for
* does not represent a valid annotation type
*/
- public static synchronized AnnotationType getInstance(
+ public static AnnotationType getInstance(
Class<? extends Annotation> annotationClass)
{
- AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess().
- getAnnotationType(annotationClass);
- if (result == null)
- result = new AnnotationType((Class<? extends Annotation>) annotationClass);
+ JavaLangAccess jla = sun.misc.SharedSecrets.getJavaLangAccess();
+ AnnotationType result = jla.getAnnotationType(annotationClass); // volatile read
+ if (result == null) {
+ result = new AnnotationType(annotationClass);
+ // try to CAS the AnnotationType: null -> result
+ if (!jla.casAnnotationType(annotationClass, null, result)) {
+ // somebody was quicker -> read it's result
+ result = jla.getAnnotationType(annotationClass);
+ assert result != null;
+ }
+ }
return result;
}
@@ -105,6 +113,9 @@
}
});
+ memberTypes = new HashMap<String,Class<?>>(methods.length+1, 1.0f);
+ memberDefaults = new HashMap<String, Object>(0);
+ members = new HashMap<String, Method>(methods.length+1, 1.0f);
for (Method method : methods) {
if (method.getParameterTypes().length != 0)
@@ -117,20 +128,27 @@
Object defaultValue = method.getDefaultValue();
if (defaultValue != null)
memberDefaults.put(name, defaultValue);
-
- members.put(name, method);
}
- sun.misc.SharedSecrets.getJavaLangAccess().
- setAnnotationType(annotationClass, this);
-
// Initialize retention, & inherited fields. Special treatment
// of the corresponding annotation types breaks infinite recursion.
if (annotationClass != Retention.class &&
annotationClass != Inherited.class) {
- Retention ret = annotationClass.getAnnotation(Retention.class);
+ JavaLangAccess jla = sun.misc.SharedSecrets.getJavaLangAccess();
+ Map<Class<? extends Annotation>, Annotation> metaAnnotations =
+ AnnotationParser.parseSelectAnnotations(
+ jla.getRawClassAnnotations(annotationClass),
+ jla.getConstantPool(annotationClass),
+ annotationClass,
+ Retention.class, Inherited.class
+ );
+ Retention ret = (Retention) metaAnnotations.get(Retention.class);
retention = (ret == null ? RetentionPolicy.CLASS : ret.value());
- inherited = annotationClass.isAnnotationPresent(Inherited.class);
+ inherited = metaAnnotations.containsKey(Inherited.class);
+ }
+ else {
+ retention = RetentionPolicy.RUNTIME;
+ inherited = false;
}
}
@@ -205,11 +223,10 @@
* For debugging.
*/
public String toString() {
- StringBuffer s = new StringBuffer("Annotation Type:" + "\n");
- s.append(" Member types: " + memberTypes + "\n");
- s.append(" Member defaults: " + memberDefaults + "\n");
- s.append(" Retention policy: " + retention + "\n");
- s.append(" Inherited: " + inherited);
- return s.toString();
+ return "Annotation Type:\n" +
+ " Member types: " + memberTypes + "\n" +
+ " Member defaults: " + memberDefaults + "\n" +
+ " Retention policy: " + retention + "\n" +
+ " Inherited: " + inherited;
}
}
diff --git a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
index 36cb10a..1aff478 100644
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.HashSet;
@@ -173,8 +174,16 @@
}
@Override
- public FontDescriptor[] getFontDescriptors(String fontName, int style) {
- return new FontDescriptor[0];
+ protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+ CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
+ int idx = fontIndex * NUM_STYLES + styleIndex;
+ String[] componentFaceNames = cfi[idx].getComponentFaceNames();
+ FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
+ for (int i = 0; i < componentFaceNames.length; i++) {
+ ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.UTF_8.newEncoder(), new int[0]);
+ }
+
+ return ret;
}
@Override
@@ -250,10 +259,12 @@
}
String[] fileNames = new String[numFonts];
+ String[] faceNames = new String[numFonts];
int index;
for (index = 0; index < fcFonts.length; index++) {
fileNames[index] = fcFonts[index].fontFile;
+ faceNames[index] = fcFonts[index].familyName;
}
if (installedFallbackFontFiles != null) {
@@ -266,7 +277,7 @@
= new CompositeFontDescriptor(
faceName,
1,
- null,
+ faceNames,
fileNames,
null, null);
}
diff --git a/jdk/src/solaris/native/java/util/FileSystemPreferences.c b/jdk/src/solaris/native/java/util/FileSystemPreferences.c
index 7bc1f45..757f64c 100644
--- a/jdk/src/solaris/native/java/util/FileSystemPreferences.c
+++ b/jdk/src/solaris/native/java/util/FileSystemPreferences.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,12 +38,14 @@
JNIEXPORT jint JNICALL
Java_java_util_prefs_FileSystemPreferences_chmod(JNIEnv *env,
jclass thisclass, jstring java_fname, jint permission) {
- const char *fname = JNU_GetStringPlatformChars(env, java_fname, JNI_FALSE);
- int result;
- result = chmod(fname, permission);
- if (result != 0)
- result = errno;
- JNU_ReleaseStringPlatformChars(env, java_fname, fname);
+ const char *fname = JNU_GetStringPlatformChars(env, java_fname, NULL);
+ int result = -1;
+ if (fname) {
+ result = chmod(fname, permission);
+ if (result != 0)
+ result = errno;
+ JNU_ReleaseStringPlatformChars(env, java_fname, fname);
+ }
return (jint) result;
}
@@ -61,13 +63,16 @@
JNIEXPORT jintArray JNICALL
Java_java_util_prefs_FileSystemPreferences_lockFile0(JNIEnv *env,
jclass thisclass, jstring java_fname, jint permission, jboolean shared) {
- const char *fname = JNU_GetStringPlatformChars(env, java_fname, JNI_FALSE);
+ const char *fname = JNU_GetStringPlatformChars(env, java_fname, NULL);
int fd, rc;
int result[2];
- jintArray javaResult;
+ jintArray javaResult = NULL;
int old_umask;
FLOCK fl;
+ if (!fname)
+ return javaResult;
+
fl.l_whence = SEEK_SET;
fl.l_len = 0;
fl.l_start = 0;
@@ -104,7 +109,8 @@
}
JNU_ReleaseStringPlatformChars(env, java_fname, fname);
javaResult = (*env)->NewIntArray(env,2);
- (*env)->SetIntArrayRegion(env, javaResult, 0, 2, result);
+ if (javaResult)
+ (*env)->SetIntArrayRegion(env, javaResult, 0, 2, result);
return javaResult;
}
diff --git a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
index f2e22fd..ff5bd9c 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -145,8 +145,12 @@
ptr = adapterInfo;
ret = NULL;
while (ptr != NULL) {
- // IPv4 interface
- if (ptr->Ipv6IfIndex == index) {
+ // in theory the IPv4 index and the IPv6 index can be the same
+ // where an interface is enabled for v4 and v6
+ // IfIndex == 0 IPv4 not available on this interface
+ // Ipv6IfIndex == 0 IPv6 not available on this interface
+ if (((ptr->IfIndex != 0)&&(ptr->IfIndex == index)) ||
+ ((ptr->Ipv6IfIndex !=0) && (ptr->Ipv6IfIndex == index))) {
ret = (IP_ADAPTER_ADDRESSES *) malloc(sizeof(IP_ADAPTER_ADDRESSES));
memcpy(ret, ptr, sizeof(IP_ADAPTER_ADDRESSES));
}
@@ -241,7 +245,7 @@
* set the index to the IPv6 index and add the
* IPv6 addresses
*/
- nif->index = ptr->Ipv6IfIndex;
+ nif->ipv6Index = ptr->Ipv6IfIndex;
c = getAddrsFromAdapter(ptr, &nif->addrs);
nif->naddrs += c;
break;
@@ -286,6 +290,9 @@
strcpy (nif->name, newname);
wcscpy ((PWCHAR)nif->displayName, ptr->FriendlyName);
nif->dNameIsUnicode = TRUE;
+
+ // the java.net.NetworkInterface abstraction only has index
+ // so the Ipv6IfIndex needs to map onto index
nif->index = ptr->Ipv6IfIndex;
nif->ipv6Index = ptr->Ipv6IfIndex;
nif->hasIpv6Address = TRUE;
@@ -442,7 +449,6 @@
(*env)->SetObjectField(env, netifObj, ni_nameID, name);
(*env)->SetObjectField(env, netifObj, ni_displayNameID, displayName);
(*env)->SetIntField(env, netifObj, ni_indexID, ifs->index);
-
/*
* Get the IP addresses for this interface if necessary
* Note that 0 is a valid number of addresses.
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.cpp b/jdk/src/windows/native/sun/windows/awt_Component.cpp
index a385c73..292a05a 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp
@@ -1719,9 +1719,11 @@
case WM_IME_SETCONTEXT:
// lParam is passed as pointer and it can be modified.
mr = WmImeSetContext(static_cast<BOOL>(wParam), &lParam);
+ CallProxyDefWindowProc(message, wParam, lParam, retValue, mr);
break;
case WM_IME_NOTIFY:
mr = WmImeNotify(wParam, lParam);
+ CallProxyDefWindowProc(message, wParam, lParam, retValue, mr);
break;
case WM_IME_STARTCOMPOSITION:
mr = WmImeStartComposition();
@@ -4066,7 +4068,7 @@
{
if (mr != mrConsume) {
HWND proxy = GetProxyFocusOwner();
- if (proxy != NULL) {
+ if (proxy != NULL && ::IsWindowEnabled(proxy)) {
retVal = ComCtl32Util::GetInstance().DefWindowProc(NULL, proxy, message, wParam, lParam);
mr = mrConsume;
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
index 6dfa710..473dac3 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
@@ -319,6 +319,8 @@
case WM_IME_STARTCOMPOSITION:
case WM_IME_ENDCOMPOSITION:
case WM_IME_COMPOSITION:
+ case WM_IME_SETCONTEXT:
+ case WM_IME_NOTIFY:
case WM_IME_CONTROL:
case WM_IME_COMPOSITIONFULL:
case WM_IME_SELECT:
diff --git a/jdk/test/java/awt/Focus/8013611/JDK8013611.java b/jdk/test/java/awt/Focus/8013611/JDK8013611.java
new file mode 100644
index 0000000..76b84a3
--- /dev/null
+++ b/jdk/test/java/awt/Focus/8013611/JDK8013611.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 8013611
+ @summary Tests showing a modal dialog with requesting focus in frame.
+ @author Anton.Tarasov: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main JDK8013611
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+
+public class JDK8013611 extends JFrame {
+ static JTextField textField = new JTextField("text");
+ static JButton button1 = new JButton("button1");
+ static JButton button2 = new JButton("button2");
+ static Robot robot;
+
+ static JDialog dialog;
+ static JButton button3 = new JButton("button3");
+
+ public static void main(String[] args) {
+ robot = Util.createRobot();
+
+ JDK8013611 frame = new JDK8013611();
+ frame.setLayout(new FlowLayout());
+ frame.add(textField);
+ frame.add(button1);
+ frame.add(button2);
+ frame.pack();
+
+ dialog = new JDialog(frame, true);
+ dialog.add(button3);
+ dialog.pack();
+
+ textField.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ dialog.setVisible(true);
+ }
+ });
+
+ button1.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent e) {
+ button2.requestFocusInWindow();
+ }
+ });
+
+ frame.setVisible(true);
+
+ frame.test();
+ }
+
+ public void test() {
+ if (!testFocused(textField)) {
+ Util.clickOnComp(textField, robot);
+ if (!testFocused(textField)) {
+ throw new RuntimeException("Error: couldn't focus " + textField);
+ }
+ }
+
+ robot.keyPress(KeyEvent.VK_TAB);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_TAB);
+
+ if (!testFocused(button3)) {
+ throw new RuntimeException("Test failed: dialog didn't get focus!");
+ }
+
+ System.out.println("Test passed.");
+ }
+
+ boolean testFocused(Component c) {
+ for (int i=0; i<10; i++) {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == c) {
+ return true;
+ }
+ Util.waitForIdle(robot);
+ }
+ return false;
+ }
+}
diff --git a/jdk/test/java/awt/Focus/DialogTraversFocusBackTest/DialogTraversFocusBackTest.java b/jdk/test/java/awt/Focus/DialogTraversFocusBackTest/DialogTraversFocusBackTest.java
new file mode 100644
index 0000000..1722782
--- /dev/null
+++ b/jdk/test/java/awt/Focus/DialogTraversFocusBackTest/DialogTraversFocusBackTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8031075
+ @summary Regression: focus disappears with shift+tab on dialogue having a focus component
+ @author mcherkas
+ @run main DialogTraversFocusBackTest
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class DialogTraversFocusBackTest {
+
+ private static Robot robot;
+ private volatile static JButton button;
+ private static Component currentFocusOwner;
+
+ public static void main(String[] args) throws Exception {
+ initUI();
+ sync();
+ initRobot();
+ runScript();
+ sync();
+ validate();
+ }
+
+ public static void sync() {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ toolkit.realSync();
+ }
+
+ private static void validate() throws Exception {
+ currentFocusOwner = FocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+ if(currentFocusOwner
+ != button) {
+ throw new Exception("Test failed! Wrong focus owner: " +
+ String.valueOf(currentFocusOwner) + "\n but must be: " +
+ button);
+ }
+ }
+
+ private static void runScript() {
+ robot.keyPress(KeyEvent.VK_SHIFT);
+ robot.keyPress(KeyEvent.VK_TAB);
+ robot.keyRelease(KeyEvent.VK_TAB);
+ robot.keyRelease(KeyEvent.VK_SHIFT);
+
+ }
+
+ private static void initRobot() throws AWTException {
+ robot = new Robot();
+ robot.setAutoDelay(100);
+
+ }
+
+ private static void initUI() throws Exception {
+ SwingUtilities.invokeAndWait( new Runnable() {
+ @Override
+ public void run() {
+ JDialog dialog = new JDialog((Frame)null, "Test Dialog");
+ button = new JButton("Button 1");
+ dialog.add(button);
+ dialog.pack();
+ dialog.setVisible(true);
+ }
+ });
+
+ }
+}
diff --git a/jdk/test/java/awt/Frame/7024749/bug7024749.java b/jdk/test/java/awt/Frame/7024749/bug7024749.java
index 2312447..8427cce 100644
--- a/jdk/test/java/awt/Frame/7024749/bug7024749.java
+++ b/jdk/test/java/awt/Frame/7024749/bug7024749.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7024749 7184326
+ * @bug 7024749 7184326 8019990
* @summary JDK7 b131---a crash in: Java_sun_awt_windows_ThemeReader_isGetThemeTransitionDurationDefined+0x75
* @library ../../regtesthelpers
* @build Util
diff --git a/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java b/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java
new file mode 100644
index 0000000..f60c335
--- /dev/null
+++ b/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7122142
+ * @summary Test deadlock situation when recursive annotations are parsed
+ */
+
+import java.lang.annotation.Retention;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+public class AnnotationTypeDeadlockTest {
+
+ @Retention(RUNTIME)
+ @AnnB
+ public @interface AnnA {
+ }
+
+ @Retention(RUNTIME)
+ @AnnA
+ public @interface AnnB {
+ }
+
+ static class Task extends Thread {
+ final CountDownLatch prepareLatch;
+ final AtomicInteger goLatch;
+ final Class<?> clazz;
+
+ Task(CountDownLatch prepareLatch, AtomicInteger goLatch, Class<?> clazz) {
+ super(clazz.getSimpleName());
+ setDaemon(true); // in case it deadlocks
+ this.prepareLatch = prepareLatch;
+ this.goLatch = goLatch;
+ this.clazz = clazz;
+ }
+
+ @Override
+ public void run() {
+ prepareLatch.countDown(); // notify we are prepared
+ while (goLatch.get() > 0); // spin-wait before go
+ clazz.getDeclaredAnnotations();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ CountDownLatch prepareLatch = new CountDownLatch(2);
+ AtomicInteger goLatch = new AtomicInteger(1);
+ Task taskA = new Task(prepareLatch, goLatch, AnnA.class);
+ Task taskB = new Task(prepareLatch, goLatch, AnnB.class);
+ taskA.start();
+ taskB.start();
+ // wait until both threads start-up
+ prepareLatch.await();
+ // let them go
+ goLatch.set(0);
+ // obtain ThreadMXBean
+ ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
+ // wait for threads to finish or dead-lock
+ while (taskA.isAlive() || taskB.isAlive()) {
+ // attempt to join threads
+ taskA.join(500L);
+ taskB.join(500L);
+ // detect dead-lock
+ long[] deadlockedIds = threadBean.findMonitorDeadlockedThreads();
+ if (deadlockedIds != null && deadlockedIds.length > 0) {
+ StringBuilder sb = new StringBuilder("deadlock detected:\n\n");
+ for (ThreadInfo ti : threadBean.getThreadInfo(deadlockedIds, Integer.MAX_VALUE)) {
+ sb.append(ti);
+ }
+ throw new IllegalStateException(sb.toString());
+ }
+ }
+ }
+}
diff --git a/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java b/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java
new file mode 100644
index 0000000..c91ec71
--- /dev/null
+++ b/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7122142
+ * @summary Test consistent parsing of ex-RUNTIME annotations that
+ * were changed and separately compiled to have CLASS retention
+ */
+
+import sun.misc.IOUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import static java.lang.annotation.RetentionPolicy.CLASS;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * This test simulates a situation where there are two mutually recursive
+ * {@link RetentionPolicy#RUNTIME RUNTIME} annotations {@link AnnA_v1 AnnA_v1}
+ * and {@link AnnB AnnB} and then the first is changed to have
+ * {@link RetentionPolicy#CLASS CLASS} retention and separately compiled.
+ * When {@link AnnA_v1 AnnA_v1} annotation is looked-up on {@link AnnB AnnB}
+ * it still appears to have {@link RetentionPolicy#RUNTIME RUNTIME} retention.
+ */
+public class AnnotationTypeRuntimeAssumptionTest {
+
+ @Retention(RUNTIME)
+ @AnnB
+ public @interface AnnA_v1 {
+ }
+
+ // An alternative version of AnnA_v1 with CLASS retention instead.
+ // Used to simulate separate compilation (see AltClassLoader below).
+ @Retention(CLASS)
+ @AnnB
+ public @interface AnnA_v2 {
+ }
+
+ @Retention(RUNTIME)
+ @AnnA_v1
+ public @interface AnnB {
+ }
+
+ @AnnA_v1
+ public static class TestTask implements Runnable {
+ @Override
+ public void run() {
+ AnnA_v1 ann1 = getDeclaredAnnotation(TestTask.class, AnnA_v1.class);
+ if (ann1 != null) {
+ throw new IllegalStateException(
+ "@" + ann1.annotationType().getSimpleName() +
+ " found on: " + TestTask.class.getName() +
+ " should not be visible at runtime");
+ }
+ AnnA_v1 ann2 = getDeclaredAnnotation(AnnB.class, AnnA_v1.class);
+ if (ann2 != null) {
+ throw new IllegalStateException(
+ "@" + ann2.annotationType().getSimpleName() +
+ " found on: " + AnnB.class.getName() +
+ " should not be visible at runtime");
+ }
+ }
+
+ private static <A extends Annotation> A getDeclaredAnnotation(Class<?> clazz, Class<A> annotationClass) {
+ for (Annotation ann : clazz.getDeclaredAnnotations()) {
+ if (ann.annotationType() == annotationClass) {
+ return annotationClass.cast(ann);
+ }
+ }
+ return null;
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ ClassLoader altLoader = new AltClassLoader(
+ AnnotationTypeRuntimeAssumptionTest.class.getClassLoader());
+
+ Runnable altTask = (Runnable) Class.forName(
+ TestTask.class.getName(),
+ true,
+ altLoader).newInstance();
+
+ altTask.run();
+ }
+
+ /**
+ * A ClassLoader implementation that loads alternative implementations of
+ * classes. If class name ends with "_v1" it locates instead a class with
+ * name ending with "_v2" and loads that class instead.
+ */
+ static class AltClassLoader extends ClassLoader {
+ AltClassLoader(ClassLoader parent) {
+ super(parent);
+ }
+
+ @Override
+ protected Class<?> loadClass(String name, boolean resolve)
+ throws ClassNotFoundException {
+ if (name.indexOf('.') < 0) { // root package is our class
+ synchronized (getClassLoadingLock(name)) {
+ // First, check if the class has already been loaded
+ Class<?> c = findLoadedClass(name);
+ if (c == null) {
+ c = findClass(name);
+ }
+ if (resolve) {
+ resolveClass(c);
+ }
+ return c;
+ }
+ }
+ else { // not our class
+ return super.loadClass(name, resolve);
+ }
+ }
+
+ @Override
+ protected Class<?> findClass(String name)
+ throws ClassNotFoundException {
+ // special class name -> replace it with alternative name
+ if (name.endsWith("_v1")) {
+ String altName = name.substring(0, name.length() - 3) + "_v2";
+ String altPath = altName.replace('.', '/').concat(".class");
+ try (InputStream is = getResourceAsStream(altPath)) {
+ if (is != null) {
+ byte[] bytes = IOUtils.readFully(is, -1, true);
+ // patch class bytes to contain original name
+ for (int i = 0; i < bytes.length - 2; i++) {
+ if (bytes[i] == '_' &&
+ bytes[i + 1] == 'v' &&
+ bytes[i + 2] == '2') {
+ bytes[i + 2] = '1';
+ }
+ }
+ return defineClass(name, bytes, 0, bytes.length);
+ }
+ else {
+ throw new ClassNotFoundException(name);
+ }
+ }
+ catch (IOException e) {
+ throw new ClassNotFoundException(name, e);
+ }
+ }
+ else { // not special class name -> just load the class
+ String path = name.replace('.', '/').concat(".class");
+ try (InputStream is = getResourceAsStream(path)) {
+ if (is != null) {
+ byte[] bytes = IOUtils.readFully(is, -1, true);
+ return defineClass(name, bytes, 0, bytes.length);
+ }
+ else {
+ throw new ClassNotFoundException(name);
+ }
+ }
+ catch (IOException e) {
+ throw new ClassNotFoundException(name, e);
+ }
+ }
+ }
+ }
+}
diff --git a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
index 9fd2429..4784d34 100644
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
@@ -64,7 +64,11 @@
new JavaDocExamplesTest().run();
}
public void run() throws Throwable {
+ testMisc();
+ testFindStatic();
+ testFindConstructor();
testFindVirtual();
+ testFindSpecial();
testPermuteArguments();
testDropArguments();
testFilterArguments();
@@ -110,7 +114,8 @@
{}
- @Test public void testFindVirtual() throws Throwable {
+ @Test public void testMisc() throws Throwable {
+// Extra tests, not from javadoc:
{}
MethodHandle CONCAT_3 = LOOKUP.findVirtual(String.class,
"concat", methodType(String.class, String.class));
@@ -125,6 +130,92 @@
{}
}
+ @Test public void testFindStatic() throws Throwable {
+{}
+MethodHandle MH_asList = publicLookup().findStatic(Arrays.class,
+ "asList", methodType(List.class, Object[].class));
+assertEquals("[x, y]", MH_asList.invoke("x", "y").toString());
+{}
+ }
+
+ @Test public void testFindVirtual() throws Throwable {
+{}
+MethodHandle MH_concat = publicLookup().findVirtual(String.class,
+ "concat", methodType(String.class, String.class));
+MethodHandle MH_hashCode = publicLookup().findVirtual(Object.class,
+ "hashCode", methodType(int.class));
+MethodHandle MH_hashCode_String = publicLookup().findVirtual(String.class,
+ "hashCode", methodType(int.class));
+assertEquals("xy", (String) MH_concat.invokeExact("x", "y"));
+assertEquals("xy".hashCode(), (int) MH_hashCode.invokeExact((Object)"xy"));
+assertEquals("xy".hashCode(), (int) MH_hashCode_String.invokeExact("xy"));
+// interface method:
+MethodHandle MH_subSequence = publicLookup().findVirtual(CharSequence.class,
+ "subSequence", methodType(CharSequence.class, int.class, int.class));
+assertEquals("def", MH_subSequence.invoke("abcdefghi", 3, 6).toString());
+// constructor "internal method" must be accessed differently:
+MethodType MT_newString = methodType(void.class); //()V for new String()
+try { assertEquals("impossible", lookup()
+ .findVirtual(String.class, "<init>", MT_newString));
+ } catch (NoSuchMethodException ex) { } // OK
+MethodHandle MH_newString = publicLookup()
+ .findConstructor(String.class, MT_newString);
+assertEquals("", (String) MH_newString.invokeExact());
+{}
+ }
+
+ @Test public void testFindConstructor() throws Throwable {
+{}
+MethodHandle MH_newArrayList = publicLookup().findConstructor(
+ ArrayList.class, methodType(void.class, Collection.class));
+Collection orig = Arrays.asList("x", "y");
+Collection copy = (ArrayList) MH_newArrayList.invokeExact(orig);
+assert(orig != copy);
+assertEquals(orig, copy);
+// a variable-arity constructor:
+MethodHandle MH_newProcessBuilder = publicLookup().findConstructor(
+ ProcessBuilder.class, methodType(void.class, String[].class));
+ProcessBuilder pb = (ProcessBuilder)
+ MH_newProcessBuilder.invoke("x", "y", "z");
+assertEquals("[x, y, z]", pb.command().toString());
+{}
+ }
+
+// for testFindSpecial
+{}
+static class Listie extends ArrayList {
+ public String toString() { return "[wee Listie]"; }
+ static Lookup lookup() { return MethodHandles.lookup(); }
+}
+{}
+
+ @Test public void testFindSpecial() throws Throwable {
+{}
+// no access to constructor via invokeSpecial:
+MethodHandle MH_newListie = Listie.lookup()
+ .findConstructor(Listie.class, methodType(void.class));
+Listie l = (Listie) MH_newListie.invokeExact();
+try { assertEquals("impossible", Listie.lookup().findSpecial(
+ Listie.class, "<init>", methodType(void.class), Listie.class));
+ } catch (NoSuchMethodException ex) { } // OK
+// access to super and self methods via invokeSpecial:
+MethodHandle MH_super = Listie.lookup().findSpecial(
+ ArrayList.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_this = Listie.lookup().findSpecial(
+ Listie.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_duper = Listie.lookup().findSpecial(
+ Object.class, "toString" , methodType(String.class), Listie.class);
+assertEquals("[]", (String) MH_super.invokeExact(l));
+assertEquals(""+l, (String) MH_this.invokeExact(l));
+assertEquals("[]", (String) MH_duper.invokeExact(l)); // ArrayList method
+try { assertEquals("inaccessible", Listie.lookup().findSpecial(
+ String.class, "toString", methodType(String.class), Listie.class));
+ } catch (IllegalAccessException ex) { } // OK
+Listie subl = new Listie() { public String toString() { return "[subclass]"; } };
+assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
+{}
+ }
+
@Test public void testPermuteArguments() throws Throwable {
{{
{} /// JAVADOC
@@ -275,6 +366,12 @@
MethodHandle eq2 = equals.asSpreader(Object[].class, 2);
assert( (boolean) eq2.invokeExact(new Object[]{ "me", "me" }));
assert(!(boolean) eq2.invokeExact(new Object[]{ "me", "thee" }));
+// try to spread from anything but a 2-array:
+for (int n = 0; n <= 10; n++) {
+ Object[] badArityArgs = (n == 2 ? null : new Object[n]);
+ try { assert((boolean) eq2.invokeExact(badArityArgs) && false); }
+ catch (IllegalArgumentException ex) { } // OK
+}
// spread both arguments from a String array:
MethodHandle eq2s = equals.asSpreader(String[].class, 2);
assert( (boolean) eq2s.invokeExact(new String[]{ "me", "me" }));
diff --git a/jdk/test/java/lang/invoke/MethodHandlesTest.java b/jdk/test/java/lang/invoke/MethodHandlesTest.java
index a6e93ba..90c3d99 100644
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java
@@ -363,6 +363,7 @@
protected Example(String name) { this.name = name; }
@SuppressWarnings("LeakingThisInConstructor")
protected Example(int x) { this(); called("protected <init>", this, x); }
+ //Example(Void x) { does not exist; lookup elicts NoSuchMethodException }
@Override public String toString() { return name; }
public void v0() { called("v0", this); }
@@ -463,6 +464,9 @@
return lookup.in(defc);
}
+ /** Is findVirtual (etc.) of "<init>" supposed to elicit a NoSuchMethodException? */
+ final static boolean INIT_REF_CAUSES_NSME = true;
+
@Test
public void testFindStatic() throws Throwable {
if (CAN_SKIP_WORKING) return;
@@ -483,6 +487,8 @@
testFindStatic(Example.class, Object.class, "s7", float.class, double.class);
testFindStatic(false, PRIVATE, Example.class, void.class, "bogus");
+ testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", int.class);
+ testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", Void.class);
testFindStatic(false, PRIVATE, Example.class, void.class, "v0");
}
@@ -505,11 +511,12 @@
target = maybeMoveIn(lookup, defc).findStatic(defc, methodName, type);
} catch (ReflectiveOperationException ex) {
noAccess = ex;
+ assertExceptionClass(
+ (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+ ? NoSuchMethodException.class
+ : IllegalAccessException.class,
+ noAccess);
if (verbosity >= 5) ex.printStackTrace(System.out);
- if (name.contains("bogus"))
- assertTrue(noAccess instanceof NoSuchMethodException);
- else
- assertTrue(noAccess instanceof IllegalAccessException);
}
if (verbosity >= 3)
System.out.println("findStatic "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
@@ -527,6 +534,13 @@
System.out.print(':');
}
+ static void assertExceptionClass(Class<? extends Throwable> expected,
+ Throwable actual) {
+ if (expected.isInstance(actual)) return;
+ actual.printStackTrace();
+ assertEquals(expected, actual.getClass());
+ }
+
static final boolean DEBUG_METHOD_HANDLE_NAMES = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
// rough check of name string
@@ -556,6 +570,8 @@
testFindVirtual(PubExample.class, void.class, "Pub/pro_v0");
testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "bogus");
+ testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", int.class);
+ testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", Void.class);
testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "s0");
// test dispatch
@@ -591,11 +607,12 @@
target = maybeMoveIn(lookup, defc).findVirtual(defc, methodName, type);
} catch (ReflectiveOperationException ex) {
noAccess = ex;
+ assertExceptionClass(
+ (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+ ? NoSuchMethodException.class
+ : IllegalAccessException.class,
+ noAccess);
if (verbosity >= 5) ex.printStackTrace(System.out);
- if (name.contains("bogus"))
- assertTrue(noAccess instanceof NoSuchMethodException);
- else
- assertTrue(noAccess instanceof IllegalAccessException);
}
if (verbosity >= 3)
System.out.println("findVirtual "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
@@ -632,11 +649,11 @@
testFindSpecial(SubExample.class, Example.class, void.class, "pkg_v0");
testFindSpecial(RemoteExample.class, PubExample.class, void.class, "Pub/pro_v0");
// Do some negative testing:
- testFindSpecial(false, EXAMPLE, SubExample.class, Example.class, void.class, "bogus");
- testFindSpecial(false, PRIVATE, SubExample.class, Example.class, void.class, "bogus");
for (Lookup lookup : new Lookup[]{ PRIVATE, EXAMPLE, PACKAGE, PUBLIC }) {
testFindSpecial(false, lookup, Object.class, Example.class, void.class, "v0");
+ testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "bogus");
testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", int.class);
+ testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", Void.class);
testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "s0");
}
}
@@ -662,19 +679,25 @@
countTest(positive);
String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo
MethodType type = MethodType.methodType(ret, params);
+ Lookup specialLookup = maybeMoveIn(lookup, specialCaller);
+ boolean specialAccessOK = (specialLookup.lookupClass() == specialCaller &&
+ (specialLookup.lookupModes() & Lookup.PRIVATE) != 0);
MethodHandle target = null;
Exception noAccess = null;
try {
if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
- if (verbosity >= 5) System.out.println(" lookup => "+maybeMoveIn(lookup, specialCaller));
- target = maybeMoveIn(lookup, specialCaller).findSpecial(defc, methodName, type, specialCaller);
+ if (verbosity >= 5) System.out.println(" lookup => "+specialLookup);
+ target = specialLookup.findSpecial(defc, methodName, type, specialCaller);
} catch (ReflectiveOperationException ex) {
noAccess = ex;
+ assertExceptionClass(
+ (!specialAccessOK) // this check should happen first
+ ? IllegalAccessException.class
+ : (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+ ? NoSuchMethodException.class
+ : IllegalAccessException.class,
+ noAccess);
if (verbosity >= 5) ex.printStackTrace(System.out);
- if (name.contains("bogus"))
- assertTrue(noAccess instanceof NoSuchMethodException);
- else
- assertTrue(noAccess instanceof IllegalAccessException);
}
if (verbosity >= 3)
System.out.println("findSpecial from "+specialCaller.getName()+" to "+defc.getName()+"."+name+"/"+type+" => "+target
@@ -719,7 +742,7 @@
target = lookup.findConstructor(defc, type);
} catch (ReflectiveOperationException ex) {
noAccess = ex;
- assertTrue(noAccess instanceof IllegalAccessException);
+ assertTrue(noAccess.getClass().getName(), noAccess instanceof IllegalAccessException);
}
if (verbosity >= 3)
System.out.println("findConstructor "+defc.getName()+".<init>/"+type+" => "+target
@@ -750,6 +773,8 @@
testBind(Example.class, Object.class, "v2", int.class, Object.class);
testBind(Example.class, Object.class, "v2", int.class, int.class);
testBind(false, PRIVATE, Example.class, void.class, "bogus");
+ testBind(false, PRIVATE, Example.class, void.class, "<init>", int.class);
+ testBind(false, PRIVATE, Example.class, void.class, "<init>", Void.class);
testBind(SubExample.class, void.class, "Sub/v0");
testBind(SubExample.class, void.class, "Sub/pkg_v0");
testBind(IntExample.Impl.class, void.class, "Int/v0");
@@ -773,11 +798,12 @@
target = maybeMoveIn(lookup, defc).bind(receiver, methodName, type);
} catch (ReflectiveOperationException ex) {
noAccess = ex;
+ assertExceptionClass(
+ (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+ ? NoSuchMethodException.class
+ : IllegalAccessException.class,
+ noAccess);
if (verbosity >= 5) ex.printStackTrace(System.out);
- if (name.contains("bogus"))
- assertTrue(noAccess instanceof NoSuchMethodException);
- else
- assertTrue(noAccess instanceof IllegalAccessException);
}
if (verbosity >= 3)
System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target
@@ -840,6 +866,10 @@
countTest(positive);
String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo
MethodType type = MethodType.methodType(ret, params);
+ Lookup specialLookup = (specialCaller != null ? maybeMoveIn(lookup, specialCaller) : null);
+ boolean specialAccessOK = (specialCaller != null &&
+ specialLookup.lookupClass() == specialCaller &&
+ (specialLookup.lookupModes() & Lookup.PRIVATE) != 0);
Method rmethod = defc.getDeclaredMethod(methodName, params);
MethodHandle target = null;
Exception noAccess = null;
@@ -848,16 +878,15 @@
try {
if (verbosity >= 4) System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
if (isSpecial)
- target = maybeMoveIn(lookup, specialCaller).unreflectSpecial(rmethod, specialCaller);
+ target = specialLookup.unreflectSpecial(rmethod, specialCaller);
else
target = maybeMoveIn(lookup, defc).unreflect(rmethod);
} catch (ReflectiveOperationException ex) {
noAccess = ex;
+ assertExceptionClass(
+ IllegalAccessException.class, // NSME is impossible, since it was already reflected
+ noAccess);
if (verbosity >= 5) ex.printStackTrace(System.out);
- if (name.contains("bogus"))
- assertTrue(noAccess instanceof NoSuchMethodException);
- else
- assertTrue(noAccess instanceof IllegalAccessException);
}
if (verbosity >= 3)
System.out.println("unreflect"+(isSpecial?"Special":"")+" "+defc.getName()+"."+name+"/"+type
@@ -1091,11 +1120,12 @@
} catch (ReflectiveOperationException ex) {
mh = null;
noAccess = ex;
+ assertExceptionClass(
+ (fname.contains("bogus"))
+ ? NoSuchFieldException.class
+ : IllegalAccessException.class,
+ noAccess);
if (verbosity >= 5) ex.printStackTrace(System.out);
- if (fname.contains("bogus"))
- assertTrue(noAccess instanceof NoSuchFieldException);
- else
- assertTrue(noAccess instanceof IllegalAccessException);
}
if (verbosity >= 3)
System.out.println("find"+(isStatic?"Static":"")+(isGetter?"Getter":"Setter")+" "+fclass.getName()+"."+fname+"/"+ftype
diff --git a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java
new file mode 100644
index 0000000..6640a0e
--- /dev/null
+++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8032585
+ * @summary JSR292: IllegalAccessError when attempting to invoke protected method from different package
+ *
+ * @compile p1/T2.java p2/T3.java
+ * @run main/othervm p2.T3
+ */
+public class Test {}
diff --git a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java
new file mode 100644
index 0000000..d702f99
--- /dev/null
+++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package p1;
+
+class T1 {
+ protected void m() { System.out.println("T1.m");}
+}
+
+public class T2 extends T1 {}
diff --git a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java
new file mode 100644
index 0000000..c79ffa9
--- /dev/null
+++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package p2;
+
+import p1.T2;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
+public class T3 extends T2 {
+ public static void main(String[] args) throws Throwable {
+ MethodHandles.lookup().findVirtual(T3.class, "m", MethodType.methodType(void.class));
+ System.out.println("TEST PASSED");
+ }
+}
diff --git a/jdk/test/java/net/CookieHandler/LocalHostCookie.java b/jdk/test/java/net/CookieHandler/LocalHostCookie.java
new file mode 100644
index 0000000..ac8d616
--- /dev/null
+++ b/jdk/test/java/net/CookieHandler/LocalHostCookie.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import com.sun.net.httpserver.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.*;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Executors;
+
+/*
+ * @test
+ * @bug 7169142
+ * @summary CookieHandler does not work with localhost
+ * @run main/othervm LocalHostCookie
+ */
+public class LocalHostCookie {
+
+ public static void main(String[] args) throws Exception {
+ new LocalHostCookie().runTest();
+ }
+
+ public void runTest() throws Exception {
+ Server s = null;
+ try {
+ s = new Server();
+ s.startServer();
+ URL url = new URL("http","localhost", s.getPort(), "/");
+ HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
+ urlConnection.setRequestMethod("GET");
+ urlConnection.setDoOutput(true);
+ urlConnection.connect();
+ urlConnection.getInputStream();
+
+ CookieHandler cookieHandler = CookieHandler.getDefault();
+ if (cookieHandler == null) {
+ cookieHandler = new java.net.CookieManager();
+ CookieHandler.setDefault(cookieHandler);
+ }
+ cookieHandler.put(urlConnection.getURL().toURI(),
+ urlConnection.getHeaderFields());
+ Map<String, List<String>> map =
+ cookieHandler.get(urlConnection.getURL().toURI(),
+ urlConnection.getHeaderFields());
+ if (map.containsKey("Cookie")) {
+ List<String> list = map.get("Cookie");
+ // name-value list will be empty if ".local" is not appended
+ if (list == null || list.size() == 0) {
+ throw new RuntimeException("Test failed!");
+ }
+ }
+ } finally {
+ s.stopServer();
+ }
+ }
+
+ class Server {
+ HttpServer server;
+
+ public void startServer() {
+ InetSocketAddress addr = new InetSocketAddress(0);
+ try {
+ server = HttpServer.create(addr, 0);
+ } catch (IOException ioe) {
+ throw new RuntimeException("Server could not be created");
+ }
+
+ server.createContext("/", new MyCookieHandler());
+ server.start();
+ }
+
+ public int getPort() {
+ return server.getAddress().getPort();
+ }
+
+ public void stopServer() {
+ server.stop(0);
+ }
+ }
+
+ class MyCookieHandler implements HttpHandler {
+
+ @Override
+ public void handle(HttpExchange exchange) throws IOException {
+ String requestMethod = exchange.getRequestMethod();
+ if (requestMethod.equalsIgnoreCase("GET")){
+ Headers responseHeaders = exchange.getResponseHeaders();
+ responseHeaders.set("Content-Type", "text/plain");
+ responseHeaders.set("Date", "June 13th 2012");
+ // No domain value set
+ responseHeaders.set("Set-Cookie2", "name=value");
+ exchange.sendResponseHeaders(200, 0);
+ OutputStream os = exchange.getResponseBody();
+ String str = "This is what the server sent!";
+ os.write(str.getBytes());
+ os.flush();
+ os.close();
+ }
+ }
+ }
+}
+
diff --git a/jdk/test/java/net/NetworkInterface/UniqueMacAddressesTest.java b/jdk/test/java/net/NetworkInterface/UniqueMacAddressesTest.java
new file mode 100644
index 0000000..c2f5c49
--- /dev/null
+++ b/jdk/test/java/net/NetworkInterface/UniqueMacAddressesTest.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+
+
+/*
+ * @test
+ * @bug 8021372
+ * @summary Tests that the MAC addresses returned by NetworkInterface.getNetworkInterfaces are unique for each adapter.
+ *
+ */
+public class UniqueMacAddressesTest {
+
+ public static void main(String[] args) throws Exception {
+ new UniqueMacAddressesTest().execute();
+ System.out.println("UniqueMacAddressesTest: OK");
+ }
+
+ public UniqueMacAddressesTest() {
+ System.out.println("UniqueMacAddressesTest: start ");
+ }
+
+ public void execute() throws Exception {
+ Enumeration<NetworkInterface> networkInterfaces;
+ boolean areMacAddressesUnique = false;
+ List<NetworkInterface> networkInterfaceList = new ArrayList<NetworkInterface>();
+ networkInterfaces = NetworkInterface.getNetworkInterfaces();
+
+ // build a list of NetworkInterface objects to test MAC address
+ // uniqueness
+ createNetworkInterfaceList(networkInterfaces, networkInterfaceList);
+ areMacAddressesUnique = checkMacAddressesAreUnique(networkInterfaceList);
+ if (!areMacAddressesUnique) {
+ throw new RuntimeException("mac address uniqueness test failed");
+ }
+ }
+
+ private boolean checkMacAddressesAreUnique (
+ List<NetworkInterface> networkInterfaces) throws Exception {
+ boolean uniqueMacAddresses = true;
+ for (NetworkInterface networkInterface : networkInterfaces) {
+ for (NetworkInterface comparisonNetIf : networkInterfaces) {
+ System.out.println("Comparing netif "
+ + networkInterface.getName() + " and netif "
+ + comparisonNetIf.getName());
+ if (testMacAddressesEqual(networkInterface, comparisonNetIf)) {
+ uniqueMacAddresses = false;
+ break;
+ }
+ }
+ if (uniqueMacAddresses != true)
+ break;
+ }
+ return uniqueMacAddresses;
+ }
+
+ private boolean testMacAddressesEqual(NetworkInterface netIf1,
+ NetworkInterface netIf2) throws Exception {
+
+ byte[] rawMacAddress1 = null;
+ byte[] rawMacAddress2 = null;
+ boolean macAddressesEqual = false;
+ if (!netIf1.getName().equals(netIf2.getName())) {
+ System.out.println("compare hardware addresses "
+ + createMacAddressString(netIf1) + " and " + createMacAddressString(netIf2));
+ rawMacAddress1 = netIf1.getHardwareAddress();
+ rawMacAddress2 = netIf2.getHardwareAddress();
+ macAddressesEqual = Arrays.equals(rawMacAddress1, rawMacAddress2);
+ } else {
+ // same interface
+ macAddressesEqual = false;
+ }
+ return macAddressesEqual;
+ }
+
+ private String createMacAddressString (NetworkInterface netIf) throws Exception {
+ byte[] macAddr = netIf.getHardwareAddress();
+ StringBuilder sb = new StringBuilder();
+ if (macAddr != null) {
+ for (int i = 0; i < macAddr.length; i++) {
+ sb.append(String.format("%02X%s", macAddr[i],
+ (i < macAddr.length - 1) ? "-" : ""));
+ }
+ }
+ return sb.toString();
+ }
+
+ private void createNetworkInterfaceList(Enumeration<NetworkInterface> nis,
+ List<NetworkInterface> networkInterfaceList) throws Exception {
+ byte[] macAddr = null;
+ NetworkInterface netIf = null;
+ while (nis.hasMoreElements()) {
+ netIf = (NetworkInterface) nis.nextElement();
+ macAddr = netIf.getHardwareAddress();
+ if (macAddr != null) {
+ System.out
+ .println("Adding NetworkInterface " + netIf.getName());
+ networkInterfaceList.add(netIf);
+ }
+ }
+ }
+}
diff --git a/jdk/test/javax/xml/jaxp/parsers/8027359/XML11EntityScannerTest.java b/jdk/test/javax/xml/jaxp/parsers/8027359/XML11EntityScannerTest.java
new file mode 100644
index 0000000..a430b5f
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8027359/XML11EntityScannerTest.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8027359
+ * @summary test that the XML11EntityScanner refreshes cache when it loads new data
+ * @run main XML11EntityScannerTest
+ */
+
+import java.io.*;
+import java.util.regex.Pattern;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.*;
+
+
+/**
+ * XML11EntityScanner functions similarly as XMLEntityScanner in handling data
+ * cache
+ */
+public class XML11EntityScannerTest {
+ static final String rawXML =
+ "<?xml version=\"1.1\" encoding=\"UTF-8\" standalone=\"no\"?>"
+ + "<WebOfTrustRC2 Version=\"4004\">"
+ + "<Identity Name=\"maggot\" PublishesTrustList=\"true\" Version=\"1\">"
+ + "<Context Name=\"Introduction\"/>"
+ + "<Context Name=\"FreetalkRC2\"/>"
+ + "<Property Name=\"IntroductionPuzzleCount\" Value=\"10\"/>"
+ + "<TrustList>"
+ + "<Trust Comment=\"\" Identity=\"USK@fdZ2In5mnLVG6RTc5hq9P~M1EG0WuH-itZ7mnQx2iuM,aUG-57VqxQLhQ4N1uNmH9kSI2syEfVFrVOIPAKTY2Yg,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@YwwRkHSo-xU8CvSFcLqlU2FFsQ3ztjr0X~xPXkX-klY,poB3tdcXrBU9naI0pyNVYp~zQmHaFkRRTj8xB8tuiPc,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@lsd~~79wrGvfb99FnAEY4VhJg2b5KFUloCOUff-Q2fk,71eV-F580euOtaCgim69Yw~2Rjh43DT49sl6zNamjk0,AQACAAE/WebOfTrustRC2/47\" Value=\"100\"/>"
+ + "<Trust Comment=\"Automatically assigned trust to a seed identity.\" Identity=\"USK@xyzElfFQnwBb4ZuSEh1aSNsbRjEGCTa-2rcjeW58A4E,TiYrXSCcoGETPf0TWLNthaimJEP1PW7nJ2tYXKxdC4s,AQACAAE/WebOfTrustRC2/456\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@pTtYoCsMO-~~2Grqya6Y7cf7nIU3VlL4168-c6EIwA8,QabBgrH1LYKKyBROnWz1r6iI8N7WFTt-mKD-0Qxsw1w,AQACAAE/WebOfTrustRC2/133\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@m~lDSvnetPNy77wsoxDZDUf7OkgX6ZAd7ob9orm3J4Y,SEX20g148KGJg3bsxvXNPNbUsVs1yQ5LfVUOGMh~1Q0,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@ss5yQit~bQL5easM68d4sImnPAxHNUbi99XtDMhpzgQ,CnpuD8dO29KvpkQyxtz1llAxHCB7yXfqrQLNRIELZow,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@krPcyGts~~wZTbABTAJ59nSplmum2~EkSD5IzinrFko,7YEbm-YEx1LFoZVHtGmIa5q0KbEjw48Rgwx2NqwrH~o,AQACAAE/WebOfTrustRC2/15\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@Usl-yNWc3VtuQWQ9srowZaWyfB6MiD9fzM5WexrlKE8,qMS83aGFsN~aFGajUmGrnbXvRIYZMd8N8IjnGmEvi-s,AQACAAE/WebOfTrustRC2/68\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@St0yKRdQJ3Lq17yoVt9h08bMfhqRhH1vtrcVVInoZVU,BaYM72qM3CYO1yzfVyO1UDUobL56CMbt9EQt3sEXabA,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@P8v4ZHUBPYGylYC-KHeWmeu5ZvB6RPYGgKcI5639Wz8,OM9PvjwMlt4L6jKRhqpvyblwpVMYumUgYFrAu3NxY~o,AQACAAE/WebOfTrustRC2/54\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@u2vn3Lh6Kte2-TgBSNKorbsKkuAt34ckoLmgx0ndXO0,4~q8q~3wIHjX9DT0yCNfQmr9oxmYrDZoQVLOdNg~yk0,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@MotrIucaZk37pJNS~HHpW5Vea3q0EZpfENPNGSjWh9s,RkFyDjl6-l7V-xYMWtGypmDYk-VehAU1LXmNYdIlHJs,AQACAAE/WebOfTrustRC2/108\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@KXAWN8DJxJ48XzZu7IBBpZ7SFc4n-OXqu4HhQC0V9Ww,DyklyACbgDCZyFpq-LeNqmuve7KWv-WDvJicd37ycn4,AQACAAE/WebOfTrustRC2/11\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@D6BZ1sSEmDMKNMPUN9I~7AalkkXockAdtbxONEN315w,0LiGUSSv4Ln4O7Xe4GQjpMEflNN7okKAH42Vlpv8d8s,AQACAAE/WebOfTrustRC2/56\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@sDehmSJoiaKYT455GIGHIVNKMs7KmiiwXXcCIcDhZ3o,upypWy-ze9Cz7WiCnbbJmoZOh7Xtveitftc5bE~p0Ug,AQACAAE/WebOfTrustRC2/6\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@GsTGXzIm9BTM5~KSZJknfTcPpJtlRs62aJtkNp05T5A,wuQcDjsdPQD9Fa21zWGB5GiiDlmf56vI9Niu5jl8eiM,AQACAAE/WebOfTrustRC2/31\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@eLFdT9VWP60iPNf8a3AkZrzgkcgje2n3Ca1yS8Tc5HU,5D0PISp19VkgzD4VSrRFTmo2CCvRoIuxlQzgMZBmj74,AQACAAE/WebOfTrustRC2/62\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@rz12UCXn-lG53i-6JswD98Kk9Zp0kt05gqIMNYc~9d0,42hoYZ5f~1fPuyvTOVYGJ~28MgYBSfoyzceR8-u1Z2I,AQACAAE/WebOfTrustRC2/126\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@5CYp3t28N5ZbPss9XhOkwUjD~T65q6-nc4aGwbV~-O0,CBfwMjYBiqKunzj3k6Ofpo9pyQsVFPz0OUWVzfd5a0c,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@dSSrRL9BY7JmTQD0dCpcIgVaLFF7pqU8EJzVUp1BYPA,EkTPkLrhEBQLPq-dRVPB1f2CAVdFGbXbUBlIww6re60,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@cw2rrCAcYTBjlO-I8DfEj-txttebZMG2LwuPGJV3Qlg,5ZcXLJW8G-R2SFqg4TEQX7IMs~e3Q4DjxUXGuHr9fxA,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@7zpRmhkkd5XcAUY6yUwp-53t7to3UN96w98~KQEwha0,30VpXev32s2mhmM5aBRJ---I0OlYbbN6~18j8rJ6qMU,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@YmCWYwlaSeE8o~8GawGYWeuPwsgVQtlBwlBkhGQFX04,H3DthY0MZXTe4rL0vsUOOMQDaj6UB9wK59yEwG8Q6No,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@aO9svsQEWmib~UyF1ihRUHA8i6uZprGy-tIS-Od9MMk,kwaMemPMVp-jcIRgGLAdF6PZimNE2cZFbvM6ShXAuZw,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@6J7FWPHwiCElTRXAO77tMGYAiLxerNF~5olAG0alQxQ,cz72iTz9FT~H57TgroVFv1eZlN5Ia5dhCtRa8bLh1KQ,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@kukYpNG56TNUnQzQe1RZvSYoqQ5B9lcoMZyDlh7xfO4,DNybejZVcWBAaByMRYYLZlgzUjQg28V8j6Zu1CtBc~g,AQACAAE/WebOfTrustRC2/27\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@a-tin0kMl1I~8xn5lkQDqYZRExKLzJITrxcNsr4T~fY,0VmnI67gAzIpdXlZFq~hYD8ikR5IEAg5QTwQv5Ifv5M,AQACAAE/WebOfTrustRC2/24\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@g~4XXw0hjp9TLocYZzunYWX6Don2AQhG-zplmzoCmY0,lyNjClSjRCrBZXVcmPKEAfvH01ySPgv1NWqL8wd11L8,AQACAAE/WebOfTrustRC2/115\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@UXgNMPe1YbVpXHOBXgMlcm9XcGY0G3gUtu43IO-YLLA,7EHSp20GHupg0rWrGPRY1g0TFJcRs-kubVtAcQRMxAc,AQACAAE/WebOfTrustRC2/69\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@lHrF2trsC9gyVeT2zpoL6IlZMz0aKlhN4xa2Ig70rmA,niASdKFC3nDfW6KMvzcv6VmRoHakE7GQAFpfz~2-v3Y,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@hp7IFNYSA97cHNAnHcreTJjQE5fF5sbsFlvbcZXaoxQ,O5h6cAcl5MvxuE2-xOkuvUP4JkT59NQNtaSmtuAS2Y8,AQACAAE/WebOfTrustRC2/16\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@QKPxALYrv6UyAGJs7tor8YlcikFzmy2msZ~42JMT~80,vx01piijkj0o3K8gzNaAOIIZ7NAtQVvPBxlRKtc4iP0,AQACAAE/WebOfTrustRC2/35\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@NmNfUNIr2WwIb9Ej1038Pk0M5gS1M0eHKvxdWqRUfTg,JUJYTsWuNQPOHK039Rczp6oPZDbfPdbO62gSaCuBXFQ,AQACAAE/WebOfTrustRC2/69\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@ONB7kRFo7mI0O3~QLRWlTbo1oB91XmGGS7KtSzz4XVI,yGiqMWRwR~i6ffAXOTBvrngHGC6nYOETUXj4L6Izj64,AQACAAE/WebOfTrustRC2/122\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@k-i0PmxoxO6Mahx8s850Rd7TEe0r4cnEohqC66aMDKw,IlTVYmQ9OSHjiu5pOLq4t-8r50SsVPNMlXn56zfpfDI,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@GtzvV-VHMGQILkpZ3O4CWBTWlhB423UUwpIlzRDgBLs,HUxBDT-Hhy6GqjBV24NRMjlK-o76YGMEgO~ZS6yighU,AQACAAE/WebOfTrustRC2/6\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@Ws0yzkcOYw6ax~kCtnzyX4MgLBHiQd5a6u9FMUmqLG4,zqNjNNGLz7HE4pdSPTovX2AwzGQWJ3-LI7YZt7aq3gg,AQACAAE/WebOfTrustRC2/30\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@6brkdrKlglWHnqMjWG6wrdLMWGPooc~7wQ7ID-PIsJk,X3RRBIdOQ5zthpkk8FjLL33LyoVVI4csJ1~g~sZ1msc,AQACAAE/WebOfTrustRC2/63\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@4DO0Yp1a3RZeAUAjeoPVu~GqpKhaX8RYqe~mwcWgjsM,klsqky963KI6uG3JqE1crihSeBbKBgkJHkIZ2xkWJ4A,AQACAAE/WebOfTrustRC2/36\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@axtoU6zHIkx3bicWK-hLNOj0br4xi0HW1qZ8H6CEv0U,SuPIncAHyYXmR9jQkTFUJd-QgGm0g9lW5ESUjzFOl~Q,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@BYsosP8TA22rSz1uA0KGbp6OVFZXhdgAlpH4R4hX9zE,o~qV5IzMR3m7ZOnnG5FPnDqpdffEpu7yOM7VEU9j6lQ,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@EilKmVin5cVL7b4FoEQ7ZoHS932O8OI880Qkd~tmzWs,8WK34lo95u~b60GLVczYU6EiRpY0LH7130~ASP9F6dU,AQACAAE/WebOfTrustRC2/75\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@xDYiCplSPLvFGC2dQjAC6eeaYVyQMtV-HmkpuKIJPgQ,CYKZcPacSNfB67IK10xlq7~bAqR-aOnZIA~yhHs2Hj0,AQACAAE/WebOfTrustRC2/71\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@DfCUA1sEJgiGzijEO0BWgeGjjHi28GGgv76H4rLujp8,1lnaOtPiXmvhpRZkBamZNF47uETNKIBgjSzElxcLhZc,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@F45FWNz9rs6TmafG~6n5Bg3Sr69YCHY9v01KTyK17lw,ikIvUS079Qw3aQknvdM8yKgr0XwjcqHgW0pWLu-1osA,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@VTDWbj9C5FUEXZBQRXmSsV1aEdOfsB9QHKzZ7-CnCh4,aDjtAVMuGPpCmw1rnCAj5myEnq9HYZeIzrfrhJO2JNw,AQACAAE/WebOfTrustRC2/52\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@dhYMUELq~HtJOweiV2JkGcoFS6hulHd9O~7a9LpGIxM,M-H3ySL8BdCctDUvwvbFNwHUyO1zghSNyotLqkKowi8,AQACAAE/WebOfTrustRC2/20\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@oRpTFVvCqp8qFWiZyCh2QhQ85eh3eP8C8G4YTFhm~rw,kyyeUPuksdt7omGFYFxoWPz3lu6e0q~G1HBx8wFztFc,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@RINL4YHPkTUGBWSoohAoO7Knzk89XSnqnQ6pUZkRY~w,OvIyTUUf4T2Tm46-em~A7zn1zBksIwe-hJP3KKdCe6s,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@sEZ-eWgUcQSj-To7lClNN6QNoKuvt0Cz3iTGKv63wQo,krEwvob7MhJ-pGvIk-RM8pVDPFSuXYTZw58oc2Lc49o,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@gNTVpdblFLSKMzUBEQM8YTfrO2fQQNIZeV7yJRTqYTQ,EKJhCmbQ5hpMU3cd-J91uneBF7CxTLPqffPs6DxoSMs,AQACAAE/WebOfTrustRC2/21\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@AV8Ubs8pbsMQ1F028a~pSJqtatznLjvhnwfSAtm1QKg,lUHPp~mgzV-pVoG9lYpceL6oOUtFRpvyQjGQdfx1GjY,AQACAAE/WebOfTrustRC2/41\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@xb3QGWdoUpeX9Fn1ZKeDwGN884c2XAMTpYLM9z4OIKo,aWNEDvjhhacFKAjiYJLaUnK1e7dQ9sCk-cnqkGZd7F8,AQACAAE/WebOfTrustRC2/9\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@MrxyFFM~n-kZ4kYvOOZodsvAA2vwp2XtAQJCrkEEU6s,tSHvx3u7uJN8ciaTqBIzt3lLmonM9mj6I7pz88MtBXc,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@-tpkd0enlFMTnjANRjzMKyfE3uyXU-WDX8VUqk3MXEg,J6h7edIdQCsiuc53qahzMzxsyNayXL~9IR0x5QoJVxk,AQACAAE/WebOfTrustRC2/15\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@gBQsXbnA9HX6wQB8x7DIEJT6e7lOxq5jGF353Po~p90,HjdyCLfG9r-zSBN6-AXwA1he9blIO2WEN9u7dMQ7H1w,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@ye~rQ4m~pu2Iu3O2TH-GOLBbSeKoQ~QR~vC6tJbKmDg,YSuI-J1nKZjGB2zmIa9Bh2Wtud~jzYBuR7OVhXYh7qM,AQACAAE/WebOfTrustRC2/99\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@HwgX8mU9A7bd2sCsM9And7fotpMGqfba9LzxZtOHHOU,10nYjjfKDH5RB3YvCCi5bpq4GPR-myd8ea7n8DRvx~c,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@qQArPJZuODDeM6C2ndbSczsFLWmLDm2SoaE-9F1hwQU,E3x6TbIvBj~6D9GrMUWSYgnNkLRg85BXXy5~mncoNEI,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@4hm9fo4IN0akORyJECttbEGZ~rPCPQ9KKAAH2AWMy8E,klvTyVp-GJznJq8Sln4W2GUfV6tVX2TI2sPCGBFU4tM,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@x7SDH5rL2-tGOaOKFFNMRrylCq94OfiZTWt4t3nwRHk,~E-kX9VqlANo4MeccvNlXDIjJ5xTWTEDNW-Qk04Ke6U,AQACAAE/WebOfTrustRC2/17\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@A9RAAKmky5yroigSupz6Bvrmc4q5FN1SXSrSXa6oRUg,s3RfurouqPnKmlGRkERao6jOJv9kcrVBBKAHqZVuQH4,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@yEstdNIW54-3~YA7QnYodpyWgPZStskrN9WXLHujUrE,j4PciAtpUHOjR2wmaaCKwiryJAi~exjETJ13UPGJLTg,AQACAAE/WebOfTrustRC2/58\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@NZSwPe8RJQOTSQ-~cAuxy97ieuX9reSft0cyD0vfbJg,99y8KOdRJmVLCWqryDzB8NdBrQGY7V9JDFtgCQBuGsU,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@Nq6iEvHP0B2VCszLCenQrfyJmkD0vas~00-9MoWgcTA,6dI2kB1z9mtjwITkhc9~V86QE5gM9CJBMjdpvRzKAoY,AQACAAE/WebOfTrustRC2/29\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@ZaNXnLCT7OQrwhp4I9V-rI1ZAV9WzegFj0HSaEJQ-Z4,i23K-dQupDenVE8O3xGv92vVanfDeyjLYWescevMbGg,AQACAAE/WebOfTrustRC2/14\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@53e9r9zEkJ0TRW~Tq8XIWjZ3WkL7Jv5Ez8LDhdwwzwM,7a0vL0OmWkHy3gC5Zs~MxB4k0QppwK4igrH6iuwls68,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@W1c~RYRC09xIHiHIucfV~Rj4J8uKAGrUeHmrH-q-U1c,niOrI75WMQ-Dtl9luIbKBmnvf6chkQEKvUvoKvSjhxI,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@G6zv74PaPcVZcf78lWp-e1TfrCSNZa1ZaPvmjm7DVzk,f4Ft3sLQ6cUEwpumpTMt5N17UORfZoXjGfmke5PJbdc,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@m5ILsPVAlcOY5D91J2iQu~PIntZb3L-B1VkONjEZs2k,592dl39JXIF1kpC4OMkw7ELOhdPrn~WXBsZln20pM7Q,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@iK69tf7gzQ53oZV60rF6ZSwwCfADMRsJeG2YmODdmJc,5czI5ZmWbWLDr2L9JdDmkt7qrr8fs55VDt3tXnrFw0E,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@bloE1LJ~qzSYUkU2nt7sB9kq060D4HTQC66pk5Q8NpA,DOOASUnp0kj6tOdhZJ-h5Tk7Ka50FSrUgsH7tCG1usU,AQACAAE/WebOfTrustRC2/58\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@0j-H~zKeP9mh6LEJUl4HSJYC-lQWstYRJeC~5E2F5~c,VbjnSixETRzKp80jYYXD-bqsTUWzxwcYmI9ZSWsBrik,AQACAAE/WebOfTrustRC2/13\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@~4ZW0eji3~hYAakiCI056soETGPf9O94GtoIpE2NGEg,GdtKsS~WeDlBS~OL1egxqZ4pr-iPXHjT2zcy8pjvEK4,AQACAAE/WebOfTrustRC2/88\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@YommlOi4fTYx9axhnl9iAi9BNHRvnM5XWjl21i0563k,5FswxS7hPf2erR8KkrBobG8R9bekaakeY1tM8DDNsjI,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@-ucM1bn8sICGRAemM8wZ~BVHgX3ZPUoutjZY64mBIcQ,Ko~kC54wZ-joCpfdc67Vds8LkAIxvTJGpMtfQSl4mAA,AQACAAE/WebOfTrustRC2/2\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@VwcZEhjtMuFcYIa8r0yksTs~FvMWB7swEz6tK67Vmsw,0blSLTQDms-WWbw1IBuKIoR2ZvSHpI21lMFeByQPuII,AQACAAE/WebOfTrustRC2/56\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@HAoXk-dW6~j5eLdAZCEjyKTVC974wkdl-4QqrPcbyzE,NlS05DkGK8QzL~EVUOfb~Jl1EZoVJTQBQBzA6N2qMn4,AQACAAE/WebOfTrustRC2/7\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@2PK-12eJFcVziT6eMpiUpOpTlmDNAoVOKZvA~8s7VSg,EaHdnKfKoWQDclX1mwcQeGr5jo1ijxyExYqL7Vsf-o8,AQACAAE/WebOfTrustRC2/33\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@8D3L5TDTyp5jnbT4imUWK12QC-B0iaSxFPOstMX2URg,ZtSShNkEVV8whaGQtIxiJ3FBroihw8YDyZrWvqncs0s,AQACAAE/WebOfTrustRC2/12\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@HKv7Hp94hFz8CKlINXCImq~XIBL9VfsPSgqfR0QIZFQ,vFM45qVvCajf3iqZm~ykZYwqM0KhaUSkU3RGaxJzHLI,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@NJu4xYtC3cgZo8s2xqmap3eh1dy60tFQFoxU8aeSnq8,fp~WLcrSSUKnr9wDDz-geb8FDwADCMCA9fjKt04Cyg8,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@IazjsmIK8VnIjDkq3-ecMEKHmi0dBT1QsNBq2mp2Fuo,uu24sWwNW~tjszdw19Mz18NBGx1MSADi03BHZnttwFo,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@IfxF-y7PNV97WUiHLqlIwXQyfVsHjI-Am4unZ0AK-Qk,Xm78gNC236A3wZ1RWBnft4oBGHU1R88Yt9AlphmtJPo,AQACAAE/WebOfTrustRC2/36\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@i1YvNnlMkd0i~0SiXiDHlGaxbtYd8ZqEUij~VzxyXmM,rxi19mph9KtHA6~gVGJ1rZ6kytff~kJDm6~NrA4YQaI,AQACAAE/WebOfTrustRC2/9\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@nXf5sbMSDqE~OkCQ~8JaMgPbj2LQJcuouvO56ADo28s,uEMqVaBzpA06TaC8A0cqKuv~lSfqZBiijasA3nlQ0Fc,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@Y8fLVylNs~pB6sdA5Dl1l6T~hXQrLNZLMgfDl5-E5Z0,n0zdN5XUa-D5Puf0L9wu~xQQmU~A5TpfqJ4RFHJLjLs,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@F0ixRao2hQlvTQDkN6rPcwLTG2nA6x0r8RrTQ0443IQ,LxN-gYvq4eWRuhjAgejmgNqYJdIw0q8IJ2XNwwVHhmQ,AQACAAE/WebOfTrustRC2/12\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@Pgk~nJzSVNAjFHh-qTovvm6muY08igdOCEWuyUrbFvk,NlwUDwfQlbXRjIaFAVljD5E1loXi31Xq6dG8YC7JOR0,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@m9gYemmVNXe32Ao6jeUgW8ttgGlMSIAW1608YZ19olE,LnEWPRzsPlPfq2~gIYQ5SVV-V2lthAx254dht9EZgyU,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@Pwiulr-xlPJelS5CO4~do78zZHTL5TNIChF5hpz8nkY,z77V~KhcKZRWLSWtVzaWO-dt~TzCCJFCHUDhHXI715M,AQACAAE/WebOfTrustRC2/8\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@OH3ZkrLAkMJbQTjVW3e9ioH04F7jpUVNMekiQAAvRjs,J6qOC05GoqRgST93M1V90HWxq9VK4PCKIpltkL8GAhg,AQACAAE/WebOfTrustRC2/5\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@nirNdzBgVyqMpnuT5UrmX~TU354qDIY7XAp04Kutysg,vpf1npG3nUARPSkFRx9xbVT~w1ELw0jQhdiXbxWcafg,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@ozK579KUDjjxkve1gKeV8IDd5qe0NPtxlFVV2-8iXrM,hlU82qnHi5ZnIfSD5~hr4wmUjNFJjQYted7FJWBj8z8,AQACAAE/WebOfTrustRC2/12\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@D6JSlrnlDDXfnGhijswHC5a4-EBuYNFhg2IyoFhzRRM,tCJy6EvZRhk-Og9CIkR3jfLD4VYxwOY5Wf991XMLdmE,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@Bn1Ozb4~Q639N~GvSXrbzZoVx9ziFfbkiKf1akXr9dQ,DrwwRjH~WrErR595BqxyDeisgcTLRZjCsQUBQSdnPLk,AQACAAE/WebOfTrustRC2/10\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@~aHztTNobVhKiaJ2eE-k6LLMy3qrRzL0zvk1UZp1xAU,xs3tuQsYRrTgxoU5qrayiwoOYEOLE6bTHvIKBQLIwco,AQACAAE/WebOfTrustRC2/3\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@jr3FrHPhtxP-IYQ-A12A3jjNNK4-KcHsUH8qNpBGHJ0,WK9IlZuG17JZ3YvaRUR-3uHf1YqkxxyGxkpkLW56ZTY,AQACAAE/WebOfTrustRC2/1\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@iBBjdbuuabx3v7iy-Pt3WZjWuixqo2-rzH~2kV4FkwE,Hll6SNQ~FXY5mrOY2W0GTfyNhJSlOrYutJmoXeSKseE,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@TKOVixP3xx6nA3-cgl2fksatQzxg4LlReoK0GFl7uAo,r~MCdO2rhGxBgRYv2EPuIE-tP7-0z6vuwbS04oyoAyI,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@bK9LQT2mqilUY4DxwmlKvKi5Jfwf4Brr~EQGa8RLIRU,Ni90~c4q-VNFrxFS7cDimQwCcRsqdScHoElWQgBpoT8,AQACAAE/WebOfTrustRC2/6\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@DYXv~V1jDo0XBhaiaGeRvy-~snqMbBiFR~R8TK8VBNg,4YYHZfVVYZmudSCOetDlNxnvbLy6IULV1SOgeC1zXmI,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@CSWvDlm9RM31O9NPpZomFvpTVM8cV0brixDXxpwnJ7A,4wfD~qxb5hFgCBN0JWgK6p11wUCpOHGOWhJ4i2FgFhY,AQACAAE/WebOfTrustRC2/0\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@sFsqYnIVQ9FwULsp3e-q0M46fRw2jVsLJYF9PUyHVME,aDhfrzYPt4O0BTuuRF3aCPTR0A~zr2rqHtPpJXeSqFU,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "<Trust Comment=\"\" Identity=\"USK@1QwMtp0oc4jIh6DFUjec~U0O3ldWHrRmhh5OZd41MMo,GZ-QOMc4mAkHhG4LwJWU~-rl0zJIp90YcB5hn3M9tlg,AQACAAE/WebOfTrustRC2/4\" Value=\"100\"/>"
+ + "</TrustList>"
+ + "</Identity>"
+ + "</WebOfTrustRC2>";
+
+ /**
+ * main method.
+ *
+ * @param args Standard args.
+ */
+ public static void main(String[] args) {
+ try {
+ final Document xmlDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(rawXML.getBytes("UTF-8")));
+ final Element identityElement = (Element) xmlDoc.getElementsByTagName("Identity").item(0);
+ final Element trustListElement = (Element) identityElement.getElementsByTagName("TrustList").item(0);
+ final NodeList trustList = trustListElement.getElementsByTagName("Trust");
+ final Pattern keyPattern = Pattern.compile("USK@[%,~" + "*-_./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" + "]+");
+ for (int i = 0; i < trustList.getLength(); ++i) {
+ Element trustElement = (Element) trustList.item(i);
+ final String identity = trustElement.getAttribute("Identity");
+ if (!keyPattern.matcher(identity).matches()) {
+ throw new RuntimeException("Parsing failure: Instead of USK URI I got: " + identity);
+ }
+ }
+ } catch (Exception ex) {
+ throw new RuntimeException(ex.getMessage());
+ }
+ }
+
+}
diff --git a/jdk/test/javax/xml/jaxp/parsers/8032909/XSLT.java b/jdk/test/javax/xml/jaxp/parsers/8032909/XSLT.java
new file mode 100644
index 0000000..d133920
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8032909/XSLT.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8032909
+ * @summary Test for XSLT string-length function with complementary chars
+ * @compile XSLT.java
+ * @run main/othervm XSLT a_utf16.xml a_utf16.xsl 1270
+ * @run main/othervm XSLT a_utf8.xml a_utf8.xsl 130
+ * @run main/othervm XSLT a_windows1252.xml a_windows1252.xsl 200
+ */
+
+import java.io.ByteArrayOutputStream;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+
+public class XSLT {
+ public static void main(String[] args) throws Exception {
+
+ ByteArrayOutputStream resStream = new ByteArrayOutputStream();
+ TransformerFactory trf = TransformerFactory.newInstance();
+ Transformer tr = trf.newTransformer(new StreamSource(System.getProperty("test.src", ".")+"/"+args[1]));
+ String res, expectedRes;
+ tr.transform( new StreamSource(System.getProperty("test.src", ".")+"/"+args[0]), new StreamResult(resStream));
+ res = resStream.toString();
+ System.out.println("Transformation completed. Result:"+res);
+
+ if (!res.replaceAll("\\s","").equals(args[2]))
+ throw new RuntimeException("Incorrect transformation result. Expected:"+args[2]+" Observed:"+res);
+ }
+}
diff --git a/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf16.xml b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf16.xml
new file mode 100644
index 0000000..fae65cc
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf16.xml
Binary files differ
diff --git a/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf16.xsl b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf16.xsl
new file mode 100644
index 0000000..4d88603
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf16.xsl
Binary files differ
diff --git a/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf8.xml b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf8.xml
new file mode 100644
index 0000000..a3b327f
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf8.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testxml>
+<Element>UTF-8_Element</Element>
+<Element2></Element2>
+</testxml>
diff --git a/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl
new file mode 100644
index 0000000..b7e222b
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text" />
+
+<xsl:template match="Element">
+<xsl:value-of select="string-length(.)"/>
+</xsl:template>
+<xsl:template match="Element2">
+<xsl:value-of select="string-length(.)"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/jdk/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml b/jdk/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml
new file mode 100644
index 0000000..6d5726e
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="windows-1252"?>
+<testxml>
+<Element>Windows-1252_Element</Element>
+<Element2></Element2>
+</testxml>
diff --git a/jdk/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl b/jdk/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl
new file mode 100644
index 0000000..ff50bf8
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="windows-1252"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text" />
+
+<xsl:template match="Element">
+<xsl:value-of select="string-length(.)"/>
+</xsl:template>
+<xsl:template match="Element2">
+<xsl:value-of select="string-length(.)"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 5d921bb..279b483 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -442,3 +442,4 @@
8f585b94be8c83f89fc481cf010a129ef75cd31b jdk7u65-b05
c3a8556785e89b7868fc4ece666120dbf8c5c7a7 jdk7u65-b06
1978b6434c4f717ba1bd715f016ab99dff879857 jdk7u65-b07
+684f0285b699d304d1efff487b550ff2e1679e98 jdk7u66-b00