Date: Fri, 26 Feb 2010 03:54:52 -0800
Subject: [PATCH 026/190] 6887703: Unsigned applet can retrieve the dragged
information before drop action occur
Reviewed-by: uta
---
.../sun/awt/dnd/SunDropTargetContextPeer.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
index c137800b5ed..4753b2e5b61 100644
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
@@ -57,6 +57,7 @@ import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.datatransfer.DataTransferer;
import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
+import sun.security.util.SecurityConstants;
/**
*
@@ -216,6 +217,18 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
throws UnsupportedFlavorException, IOException,
InvalidDnDOperationException
{
+
+ SecurityManager sm = System.getSecurityManager();
+ try {
+ if (!dropComplete && sm != null) {
+ sm.checkSystemClipboardAccess();
+ }
+ } catch (Exception e) {
+ Thread currentThread = Thread.currentThread();
+ currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, e);
+ return null;
+ }
+
Long lFormat = null;
Transferable localTransferable = local;
From ec862c8b4396e00e7e978f994e2dcbdf8255ce38 Mon Sep 17 00:00:00 2001
From: Denis Fokin
Date: Sat, 6 Mar 2010 03:37:53 +0300
Subject: [PATCH 027/190] 6932659: JTreg test files were missed in push of
6887703
Reviewed-by: uta
---
.../regtesthelpers/process/ProcessCommunicator.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java b/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java
index 820c6cb1803..f303727036e 100644
--- a/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java
+++ b/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java
@@ -146,7 +146,16 @@ public class ProcessCommunicator {
final String classPathArguments, final String [] args)
{
StringBuilder commandBuilder = new StringBuilder();
- commandBuilder.append(javaPath).append(classPathArguments).append(classToExecute.getName());
+ commandBuilder.append(javaPath).append(" ");
+ commandBuilder.append("-cp ").append(System.getProperty("test.classes", ".")).append(File.pathSeparatorChar);
+
+ if (classPathArguments.trim().length() > 0) {
+ commandBuilder.append(classPathArguments).append(" ");
+ }
+
+ commandBuilder.append(" ");
+ commandBuilder.append(classToExecute.getName());
+
for (String argument:args) {
commandBuilder.append(" ").append(argument);
}
From 61995b9270bb58f70fd01828d8ab4f613e7199c3 Mon Sep 17 00:00:00 2001
From: Masayoshi Okutsu
Date: Wed, 10 Mar 2010 14:32:47 +0900
Subject: [PATCH 028/190] 6932473: (tz) javazic produces incorrect
SimpleTimeZone parameters with Sun<=7
Reviewed-by: peytoia
---
jdk/make/tools/src/build/tools/javazic/RuleDay.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/jdk/make/tools/src/build/tools/javazic/RuleDay.java b/jdk/make/tools/src/build/tools/javazic/RuleDay.java
index f9629b77d88..88e7062578f 100644
--- a/jdk/make/tools/src/build/tools/javazic/RuleDay.java
+++ b/jdk/make/tools/src/build/tools/javazic/RuleDay.java
@@ -139,7 +139,7 @@ class RuleDay {
if (isLast()) {
return -1;
}
- return getDay();
+ return isEarlier() ? -getDay() : getDay();
}
/**
@@ -147,13 +147,10 @@ class RuleDay {
* @return the SimpleTimeZone day-of-week rule value
*/
int getDayOfWeekForSimpleTimeZoneInt() {
- if (!isLater() && !isEarlier() && !isLast()) {
- return 0;
- }
- if (isLater()) {
+ if (isEarlier() || isLater()) {
return -getDayOfWeekNum();
}
- return getDayOfWeekNum();
+ return isLast() ? getDayOfWeekNum() : 0;
}
/**
From 77c61b98194b4c058f25511b246e055d4cd79457 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Wed, 10 Mar 2010 14:44:53 +0000
Subject: [PATCH 029/190] 6933618:
java/net/MulticastSocket/NoLoopbackPackets.java fails when rerun
Reviewed-by: alanb
---
.../MulticastSocket/NoLoopbackPackets.java | 115 +++++++++---------
1 file changed, 60 insertions(+), 55 deletions(-)
diff --git a/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java b/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java
index 83419886880..7953d513eb5 100644
--- a/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java
+++ b/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java
@@ -29,9 +29,7 @@
import java.util.*;
import java.net.*;
-
public class NoLoopbackPackets {
- private static int PORT = 9001;
private static String osname;
static boolean isWindows() {
@@ -68,40 +66,47 @@ public class NoLoopbackPackets {
return;
}
- // we will send packets to three multicast groups :-
- // 224.1.1.1, ::ffff:224.1.1.2, and ff02::1:1
- //
- List groups = new ArrayList();
- groups.add(new InetSocketAddress(InetAddress.getByName("224.1.1.1"), PORT));
- groups.add(new InetSocketAddress(InetAddress.getByName("::ffff:224.1.1.2"), PORT));
- groups.add(new InetSocketAddress(InetAddress.getByName("ff02::1:1"), PORT));
-
- Thread sender = new Thread(new Sender(groups));
- sender.setDaemon(true); // we want sender to stop when main thread exits
- sender.start();
-
- // Now try to receive multicast packets. we should not see any of them
- // since we disable loopback mode.
- //
- MulticastSocket msock = new MulticastSocket(PORT);
- msock.setSoTimeout(5000); // 5 seconds
-
- byte[] buf = new byte[1024];
- DatagramPacket packet = new DatagramPacket(buf, 0, buf.length);
+ MulticastSocket msock = null;
List failedGroups = new ArrayList();
- for (SocketAddress group : groups) {
- msock.joinGroup(group, null);
+ try {
+ msock = new MulticastSocket();
+ int port = msock.getLocalPort();
- try {
- msock.receive(packet);
+ // we will send packets to three multicast groups :-
+ // 224.1.1.1, ::ffff:224.1.1.2, and ff02::1:1
+ //
+ List groups = new ArrayList();
+ groups.add(new InetSocketAddress(InetAddress.getByName("224.1.1.1"), port));
+ groups.add(new InetSocketAddress(InetAddress.getByName("::ffff:224.1.1.2"), port));
+ groups.add(new InetSocketAddress(InetAddress.getByName("ff02::1:1"), port));
- // it is an error if we receive something
- failedGroups.add(group);
- } catch (SocketTimeoutException e) {
- // we expect this
+ Thread sender = new Thread(new Sender(groups));
+ sender.setDaemon(true); // we want sender to stop when main thread exits
+ sender.start();
+
+ // Now try to receive multicast packets. we should not see any of them
+ // since we disable loopback mode.
+ //
+ msock.setSoTimeout(5000); // 5 seconds
+
+ byte[] buf = new byte[1024];
+ DatagramPacket packet = new DatagramPacket(buf, 0, buf.length);
+ for (SocketAddress group : groups) {
+ msock.joinGroup(group, null);
+
+ try {
+ msock.receive(packet);
+
+ // it is an error if we receive something
+ failedGroups.add(group);
+ } catch (SocketTimeoutException e) {
+ // we expect this
+ }
+
+ msock.leaveGroup(group, null);
}
-
- msock.leaveGroup(group, null);
+ } finally {
+ if (msock != null) try { msock.close(); } catch (Exception e) {}
}
if (failedGroups.size() > 0) {
@@ -111,36 +116,36 @@ public class NoLoopbackPackets {
throw new RuntimeException("test failed.");
}
}
-}
-class Sender implements Runnable {
- private List sendToGroups;
+ static class Sender implements Runnable {
+ private List sendToGroups;
- public Sender(List groups) {
- sendToGroups = groups;
- }
+ public Sender(List groups) {
+ sendToGroups = groups;
+ }
- public void run() {
- byte[] buf = "hello world".getBytes();
- List packets = new ArrayList();
+ public void run() {
+ byte[] buf = "hello world".getBytes();
+ List packets = new ArrayList();
- try {
- for (SocketAddress group : sendToGroups) {
- DatagramPacket packet = new DatagramPacket(buf, buf.length, group);
- packets.add(packet);
- }
-
- MulticastSocket msock = new MulticastSocket();
- msock.setLoopbackMode(true); // disable loopback mode
- for (;;) {
- for (DatagramPacket packet : packets) {
- msock.send(packet);
+ try {
+ for (SocketAddress group : sendToGroups) {
+ DatagramPacket packet = new DatagramPacket(buf, buf.length, group);
+ packets.add(packet);
}
- Thread.currentThread().sleep(1000); // 1 second
+ MulticastSocket msock = new MulticastSocket();
+ msock.setLoopbackMode(true); // disable loopback mode
+ for (;;) {
+ for (DatagramPacket packet : packets) {
+ msock.send(packet);
+ }
+
+ Thread.sleep(1000); // 1 second
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
- } catch (Exception e) {
- throw new RuntimeException(e);
}
}
}
From 3f5bea08cdf76be473a23f2932390162ab4e1730 Mon Sep 17 00:00:00 2001
From: Ulf Zibis
Date: Wed, 10 Mar 2010 14:53:51 -0800
Subject: [PATCH 030/190] 6931812: A better implementation of
sun.nio.cs.Surrogate.isBMP(int)
Uc >> 16 == 0 is superior to (int) (char) uc == uc
Reviewed-by: sherman
---
jdk/src/share/classes/sun/nio/cs/Surrogate.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/jdk/src/share/classes/sun/nio/cs/Surrogate.java b/jdk/src/share/classes/sun/nio/cs/Surrogate.java
index 4791255435b..5f48f07fa0b 100644
--- a/jdk/src/share/classes/sun/nio/cs/Surrogate.java
+++ b/jdk/src/share/classes/sun/nio/cs/Surrogate.java
@@ -78,8 +78,8 @@ public class Surrogate {
* Tells whether or not the given UCS-4 character is in the Basic
* Multilingual Plane, and can be represented using a single char.
*/
- public static boolean isBMP(int uc) {
- return (int) (char) uc == uc;
+ public static boolean isBMPCodePoint(int uc) {
+ return uc >> 16 == 0;
}
/**
@@ -290,7 +290,7 @@ public class Surrogate {
* error() will return a descriptive result object
*/
public int generate(int uc, int len, CharBuffer dst) {
- if (Surrogate.isBMP(uc)) {
+ if (Surrogate.isBMPCodePoint(uc)) {
if (Surrogate.is(uc)) {
error = CoderResult.malformedForLength(len);
return -1;
@@ -334,7 +334,7 @@ public class Surrogate {
* error() will return a descriptive result object
*/
public int generate(int uc, int len, char[] da, int dp, int dl) {
- if (Surrogate.isBMP(uc)) {
+ if (Surrogate.isBMPCodePoint(uc)) {
if (Surrogate.is(uc)) {
error = CoderResult.malformedForLength(len);
return -1;
From 2ed0d6358308431d00f55762656428e1deb0cf6b Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons
Date: Wed, 10 Mar 2010 16:23:18 -0800
Subject: [PATCH 031/190] 6933914: fix missing newlines
Reviewed-by: ohair
---
.../test/tools/javac/OverrideChecks/6738538/T6738538a.java | 2 +-
.../test/tools/javac/OverrideChecks/6738538/T6738538b.java | 2 +-
langtools/test/tools/javac/api/6731573/Erroneous.java | 2 +-
langtools/test/tools/javac/api/6731573/T6731573.java | 2 +-
langtools/test/tools/javac/cast/6548436/T6548436d.java | 2 +-
langtools/test/tools/javac/cast/6558559/T6558559a.java | 2 +-
langtools/test/tools/javac/cast/6558559/T6558559b.java | 2 +-
langtools/test/tools/javac/cast/6586091/T6586091.java | 2 +-
langtools/test/tools/javac/enum/T6724345.java | 2 +-
langtools/test/tools/javac/generics/T6557954.java | 2 +-
langtools/test/tools/javac/generics/T6751514.java | 2 +-
langtools/test/tools/javac/generics/T6869075.java | 2 +-
.../test/tools/javac/generics/inference/6569789/T6569789.java | 2 +-
.../test/tools/javac/generics/inference/6650759/T6650759a.java | 2 +-
langtools/test/tools/javac/generics/wildcards/T6732484.java | 2 +-
.../test/tools/javac/processing/model/util/elements/Foo.java | 2 +-
langtools/test/tools/javac/varargs/T6746184.java | 2 +-
langtools/test/tools/javap/T6305779.java | 0
langtools/test/tools/javap/T6715251.java | 2 +-
langtools/test/tools/javap/T6715753.java | 2 +-
20 files changed, 19 insertions(+), 19 deletions(-)
delete mode 100644 langtools/test/tools/javap/T6305779.java
diff --git a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java
index 183983cdd3e..331a129a264 100644
--- a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java
+++ b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java
@@ -41,4 +41,4 @@ class T6738538a {
public T m();
}
class Crash & I> {}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java
index 0370abf872b..23ac41bd432 100644
--- a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java
+++ b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java
@@ -44,4 +44,4 @@ class T6738538b {
}
class C2 & I2> {}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/api/6731573/Erroneous.java b/langtools/test/tools/javac/api/6731573/Erroneous.java
index 10ce9051a27..7902f871c95 100644
--- a/langtools/test/tools/javac/api/6731573/Erroneous.java
+++ b/langtools/test/tools/javac/api/6731573/Erroneous.java
@@ -1,4 +1,4 @@
class A {
boolean b;
boolean b;
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/api/6731573/T6731573.java b/langtools/test/tools/javac/api/6731573/T6731573.java
index 01fac8b6f44..a08a04f5c25 100644
--- a/langtools/test/tools/javac/api/6731573/T6731573.java
+++ b/langtools/test/tools/javac/api/6731573/T6731573.java
@@ -106,4 +106,4 @@ public class T6731573 extends ToolTester {
public static void main(String... args) throws Exception {
new T6731573().test();
}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/cast/6548436/T6548436d.java b/langtools/test/tools/javac/cast/6548436/T6548436d.java
index 626afbc16c7..8a18f2108e5 100644
--- a/langtools/test/tools/javac/cast/6548436/T6548436d.java
+++ b/langtools/test/tools/javac/cast/6548436/T6548436d.java
@@ -37,4 +37,4 @@ public class T6548436d {
static void test(Base extends Double> je) {
Object o = (Base)je;
}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/cast/6558559/T6558559a.java b/langtools/test/tools/javac/cast/6558559/T6558559a.java
index f02664d4e11..b5f271c1681 100644
--- a/langtools/test/tools/javac/cast/6558559/T6558559a.java
+++ b/langtools/test/tools/javac/cast/6558559/T6558559a.java
@@ -37,4 +37,4 @@ class T6558559a {
A> x = null;
B> y = (B>)x;
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/cast/6558559/T6558559b.java b/langtools/test/tools/javac/cast/6558559/T6558559b.java
index 23cfdae9cc9..a40279f29d3 100644
--- a/langtools/test/tools/javac/cast/6558559/T6558559b.java
+++ b/langtools/test/tools/javac/cast/6558559/T6558559b.java
@@ -40,4 +40,4 @@ class T6558559b {
Object o = unboundList;
Throwable t3 = (Throwable) o;
}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/cast/6586091/T6586091.java b/langtools/test/tools/javac/cast/6586091/T6586091.java
index 5cc9ae8aa75..f832d124cb8 100644
--- a/langtools/test/tools/javac/cast/6586091/T6586091.java
+++ b/langtools/test/tools/javac/cast/6586091/T6586091.java
@@ -35,4 +35,4 @@ class T6586091 {
A> t = null;
B c = (B)t;
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/enum/T6724345.java b/langtools/test/tools/javac/enum/T6724345.java
index d71ce5611f6..58650843535 100644
--- a/langtools/test/tools/javac/enum/T6724345.java
+++ b/langtools/test/tools/javac/enum/T6724345.java
@@ -48,4 +48,4 @@ class T6724345 {
enum E implements I {
V {public void i() {}};
}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/generics/T6557954.java b/langtools/test/tools/javac/generics/T6557954.java
index f77a04db163..50555414519 100644
--- a/langtools/test/tools/javac/generics/T6557954.java
+++ b/langtools/test/tools/javac/generics/T6557954.java
@@ -33,4 +33,4 @@
class T6557954 {
class Foo {}
T6557954.Foo f;
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/generics/T6751514.java b/langtools/test/tools/javac/generics/T6751514.java
index 79d88efb5cf..c2eca50a597 100644
--- a/langtools/test/tools/javac/generics/T6751514.java
+++ b/langtools/test/tools/javac/generics/T6751514.java
@@ -79,4 +79,4 @@ public class T6751514 {
" - found: " + found + ")");
}
}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/generics/T6869075.java b/langtools/test/tools/javac/generics/T6869075.java
index 1b745acc8ff..5412bdae4f6 100644
--- a/langtools/test/tools/javac/generics/T6869075.java
+++ b/langtools/test/tools/javac/generics/T6869075.java
@@ -64,4 +64,4 @@ public class T6869075 {
" - found: " + found + ")");
}
}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/generics/inference/6569789/T6569789.java b/langtools/test/tools/javac/generics/inference/6569789/T6569789.java
index d7036ff98f7..dbbf627835d 100644
--- a/langtools/test/tools/javac/generics/inference/6569789/T6569789.java
+++ b/langtools/test/tools/javac/generics/inference/6569789/T6569789.java
@@ -41,4 +41,4 @@ public class T6569789 {
}
static void testMethod(T t) {}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java b/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java
index 9e65330940a..e8462e78d3f 100644
--- a/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java
+++ b/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java
@@ -42,4 +42,4 @@ class T6650759a {
Integer test = getGenericValue(new IntegerInterface());
testSet(getGenericValue(new IntegerInterface()));
}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/generics/wildcards/T6732484.java b/langtools/test/tools/javac/generics/wildcards/T6732484.java
index 42906e92944..7882c128237 100644
--- a/langtools/test/tools/javac/generics/wildcards/T6732484.java
+++ b/langtools/test/tools/javac/generics/wildcards/T6732484.java
@@ -34,4 +34,4 @@ class T6732484 {
class B extends A {}
A super B> f;
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/processing/model/util/elements/Foo.java b/langtools/test/tools/javac/processing/model/util/elements/Foo.java
index 146b6ccfb7b..0dd9e692901 100644
--- a/langtools/test/tools/javac/processing/model/util/elements/Foo.java
+++ b/langtools/test/tools/javac/processing/model/util/elements/Foo.java
@@ -26,4 +26,4 @@
* Dummy type to compile.
*/
public class Foo {
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/varargs/T6746184.java b/langtools/test/tools/javac/varargs/T6746184.java
index f1b5ca46028..a23244b0749 100644
--- a/langtools/test/tools/javac/varargs/T6746184.java
+++ b/langtools/test/tools/javac/varargs/T6746184.java
@@ -36,4 +36,4 @@ public class T6746184 {
class A {
public static void m(final Object... varargs) {}
private static void m(final Object singleArg) {}
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javap/T6305779.java b/langtools/test/tools/javap/T6305779.java
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/langtools/test/tools/javap/T6715251.java b/langtools/test/tools/javap/T6715251.java
index 357a83c3190..ba6eee0a93d 100644
--- a/langtools/test/tools/javap/T6715251.java
+++ b/langtools/test/tools/javap/T6715251.java
@@ -71,4 +71,4 @@ public class T6715251 {
String log;
int errors;
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javap/T6715753.java b/langtools/test/tools/javap/T6715753.java
index b331b5f98e1..93194500a91 100644
--- a/langtools/test/tools/javap/T6715753.java
+++ b/langtools/test/tools/javap/T6715753.java
@@ -47,4 +47,4 @@ public class T6715753 {
throw new Exception("test failed");
}
}
-}
\ No newline at end of file
+}
From 02e9344ed0d81d332646c9926522a435a04a4085 Mon Sep 17 00:00:00 2001
From: Yuka Kamiya
Date: Thu, 11 Mar 2010 11:54:17 +0900
Subject: [PATCH 032/190] 6933032: (tz) Support tzdata2010e
Reviewed-by: okutsu
---
jdk/make/sun/javazic/tzdata/VERSION | 2 +-
jdk/make/sun/javazic/tzdata/asia | 26 ++++++-
jdk/make/sun/javazic/tzdata/australasia | 91 +++++++++---------------
jdk/make/sun/javazic/tzdata/southamerica | 36 +++++++++-
4 files changed, 92 insertions(+), 63 deletions(-)
diff --git a/jdk/make/sun/javazic/tzdata/VERSION b/jdk/make/sun/javazic/tzdata/VERSION
index 07595249769..4f195ed78fc 100644
--- a/jdk/make/sun/javazic/tzdata/VERSION
+++ b/jdk/make/sun/javazic/tzdata/VERSION
@@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
-tzdata2010b
+tzdata2010e
diff --git a/jdk/make/sun/javazic/tzdata/asia b/jdk/make/sun/javazic/tzdata/asia
index a8e6746fb30..ae6d3b94524 100644
--- a/jdk/make/sun/javazic/tzdata/asia
+++ b/jdk/make/sun/javazic/tzdata/asia
@@ -247,11 +247,31 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # Al Manamah
# until further notice." I take that last sentence as the
# establishment of a rule.
+# From Nobutomo Nakano (2010-02-19):
+# We received a report from Bangladesh saying that the start/end of
+# Bangladesh DST is incorrect. Currently we have only the Bengali version
+# of the official mail from BTRC which describes the following:
+#
+# "From 2010 each year when local standard time is about to reach
+# March 31 at 10:59:00 PM clocks are turned forward 1 hour (11:59:00 PM)
+# and when local daylight time is about to October 31 at 11:59:00 PM
+# clocks are turned backward 1 hour (10:59:00 PM)."
+#
+# So, DST will start/end 1 minute earlier.
+
+# From Arthur David Olson (2010-03-03):
+# The file
+#
+# http://www.cabinet.gov/bd/file_upload/news_events/en_169.pdf
+#
+# is in Bengali; it does contain two "31"s as well as two "11.59"s and a "10.59"
+# which is consistent with the information provided by Nobutomo Nakano.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Dhaka 2009 only - Jun 19 23:00 1:00 S
-Rule Dhaka 2010 only - Jan 1 0:00 0 -
-Rule Dhaka 2010 max - Mar 31 23:00 1:00 S
-Rule Dhaka 2010 max - Nov 1 0:00 0 -
+Rule Dhaka 2009 only - Dec 31 23:59 0 -
+Rule Dhaka 2010 max - Mar 31 22:59 1:00 S
+Rule Dhaka 2010 max - Oct 31 23:59 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Dhaka 6:01:40 - LMT 1890
diff --git a/jdk/make/sun/javazic/tzdata/australasia b/jdk/make/sun/javazic/tzdata/australasia
index 940d4e16614..9f4e4818af3 100644
--- a/jdk/make/sun/javazic/tzdata/australasia
+++ b/jdk/make/sun/javazic/tzdata/australasia
@@ -289,11 +289,30 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
#
# http://www.fiji.gov.fj/publish/page_16198.shtml
#
+
+# From Steffen Thorsen (2010-03-03):
+# The Cabinet in Fiji has decided to end DST about a month early, on
+# 2010-03-28 at 03:00.
+# The plan is to observe DST again, from 2010-10-24 to sometime in March
+# 2011 (last Sunday a good guess?).
+#
+# Official source:
+#
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166
+#
+#
+# A bit more background info here:
+#
+# http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
+#
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
Rule Fiji 1999 2000 - Feb lastSun 3:00 0 -
Rule Fiji 2009 only - Nov 29 2:00 1:00 S
-Rule Fiji 2010 only - Apr 25 3:00 0 -
+Rule Fiji 2010 only - Mar lastSun 3:00 0 -
+Rule Fiji 2010 only - Oct 24 2:00 1:00 S
+Rule Fiji 2011 only - Mar lastSun 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:53:40 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time
@@ -471,70 +490,30 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5
# Samoa
-# From Alexander Krivenyshev (2008-12-06):
-# The Samoa government (Western Samoa) may implement DST on the first Sunday of
-# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28,
-# 2010).
-#
-# "Selected Committee reports to Cabinet on Daylight Saving Time",
-# Government of Samoa:
-#
-# http://www.govt.ws/pr_article.cfm?pr_id=560
-#
-# or
-#
-# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
-#
-
-# From Steffen Thorsen (2009-08-27):
-# Samoa's parliament passed the Daylight Saving Bill 2009, and will start
-# daylight saving time on the first Sunday of October 2009 and end on the
-# last Sunday of March 2010. We hope that the full text will be published
-# soon, but we believe that the bill is only valid for 2009-2010. Samoa's
-# Daylight Saving Act 2009 will be enforced as soon as the Head of State
-# executes a proclamation publicizing this Act.
+# From Steffen Thorsen (2009-10-16):
+# We have been in contact with the government of Samoa again, and received
+# the following info:
#
-# Some background information here, which will be updated once we have
-# more details:
+# "Cabinet has now approved Daylight Saving to be effected next year
+# commencing from the last Sunday of September 2010 and conclude first
+# Sunday of April 2011."
+#
+# Background info:
#
# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
#
-
-# From Alexander Krivenyshev (2009-10-03):
-# First, my deepest condolences to people of Samoa islands and all families and
-# loved ones around the world who lost their lives in the earthquake and tsunami.
#
-# Considering the recent devastation on Samoa by earthquake and tsunami and that
-# many government offices/ ministers are closed- not sure if "Daylight Saving
-# Bill 2009" will be implemented in next few days- on October 4, 2009.
-#
-# Here is reply from Consulate-General of Samoa in New Zealand
-# ---------------------------
-# Consul General
-# consulgeneral@samoaconsulate.org.nz
-#
-# Talofa Alexander,
-#
-# Thank you for your sympathy for our country but at this time we have not
-# been informed about the Daylight Savings Time Change. Most Ministries in
-# Apia are closed or relocating due to weather concerns.
-#
-# When we do find out if they are still proceeding with the time change we
-# will advise you soonest.
-#
-# Kind Regards,
-# Lana
-# for: Consul General
-
-# From Steffen Thorsen (2009-10-05):
-# We have called a hotel in Samoa and asked about local time there - they
-# are still on standard time.
+# Samoa's Daylight Saving Time Act 2009 is available here, but does not
+# contain any dates:
+#
+# http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
+#
Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5
-11:26:56 - LMT 1911
-11:30 - SAMT 1950 # Samoa Time
- -11:00 - WST 2009 Oct 4
- -11:00 1:00 WSDT 2010 Mar 28
+ -11:00 - WST 2010 Oct 24
+ -11:00 1:00 WSDT 2011 Apr 3
-11:00 - WST
# Solomon Is
diff --git a/jdk/make/sun/javazic/tzdata/southamerica b/jdk/make/sun/javazic/tzdata/southamerica
index 693fec63423..76f1acaf005 100644
--- a/jdk/make/sun/javazic/tzdata/southamerica
+++ b/jdk/make/sun/javazic/tzdata/southamerica
@@ -1143,6 +1143,18 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# http://www.shoa.cl/noticias/2008/04hora/hora.htm
# .
+# From Angel Chiang (2010-03-04):
+# Subject: DST in Chile exceptionally extended to 3 April due to earthquake
+#
+# http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098
+#
+# (in Spanish, last paragraph).
+#
+# This is breaking news. There should be more information available later.
+
+# From Arthur Daivd Olson (2010-03-06):
+# Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
Rule Chile 1928 1932 - Apr 1 0:00 0 -
@@ -1177,7 +1189,9 @@ Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
# N.B.: the end of March 29 in Chile is March 30 in Universal time,
# which is used below in specifying the transition.
Rule Chile 2008 only - Mar 30 3:00u 0 -
-Rule Chile 2009 max - Mar Sun>=9 3:00u 0 -
+Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
+Rule Chile 2010 only - Apr 4 3:00u 0 -
+Rule Chile 2011 max - Mar Sun>=9 3:00u 0 -
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -1386,8 +1400,24 @@ Rule Para 2002 2003 - Sep Sun>=1 0:00 1:00 S
# Decree 1,867 (2004-03-05)
# From Carlos Raul Perasso via Jesper Norgaard Welen (2006-10-13)
#
-Rule Para 2004 max - Oct Sun>=15 0:00 1:00 S
-Rule Para 2005 max - Mar Sun>=8 0:00 0 -
+Rule Para 2004 2009 - Oct Sun>=15 0:00 1:00 S
+Rule Para 2005 2009 - Mar Sun>=8 0:00 0 -
+# From Carlos Raul Perasso (2010-02-18):
+# By decree number 3958 issued yesterday (
+#
+# http://www.presidencia.gov.py/v1/wp-content/uploads/2010/02/decreto3958.pdf
+#
+# )
+# Paraguay changes its DST schedule, postponing the March rule to April and
+# modifying the October date. The decree reads:
+# ...
+# Art. 1. It is hereby established that from the second Sunday of the month of
+# April of this year (2010), the official time is to be set back 60 minutes,
+# and that on the first Sunday of the month of October, it is to be set
+# forward 60 minutes, in all the territory of the Paraguayan Republic.
+# ...
+Rule Para 2010 max - Oct Sun>=1 0:00 1:00 S
+Rule Para 2010 max - Apr Sun>=8 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Asuncion -3:50:40 - LMT 1890
From a55a44a6e208d039c6a8c17907a7a2c9b10d06ac Mon Sep 17 00:00:00 2001
From: Sergey Malenkov
Date: Thu, 11 Mar 2010 17:39:33 +0300
Subject: [PATCH 033/190] 6707226: java.beans.Statement & java.beans.Expression
miss one important usecase
Reviewed-by: rupashka
---
.../share/classes/java/beans/Expression.java | 23 ++++++++++
.../share/classes/java/beans/Statement.java | 21 ++++++---
.../java/beans/Statement/Test6707226.java | 45 +++++++++++++++++++
3 files changed, 83 insertions(+), 6 deletions(-)
create mode 100644 jdk/test/java/beans/Statement/Test6707226.java
diff --git a/jdk/src/share/classes/java/beans/Expression.java b/jdk/src/share/classes/java/beans/Expression.java
index 35761cae63b..de672aa30ec 100644
--- a/jdk/src/share/classes/java/beans/Expression.java
+++ b/jdk/src/share/classes/java/beans/Expression.java
@@ -98,6 +98,29 @@ public class Expression extends Statement {
setValue(value);
}
+ /**
+ * {@inheritDoc}
+ *
+ * If the invoked method completes normally,
+ * the value it returns is copied in the {@code value} property.
+ * Note that the {@code value} property is set to {@code null},
+ * if the return type of the underlying method is {@code void}.
+ *
+ * @throws NullPointerException if the value of the {@code target} or
+ * {@code methodName} property is {@code null}
+ * @throws NoSuchMethodException if a matching method is not found
+ * @throws SecurityException if a security manager exists and
+ * it denies the method invocation
+ * @throws Exception that is thrown by the invoked method
+ *
+ * @see java.lang.reflect.Method
+ * @since 1.7
+ */
+ @Override
+ public void execute() throws Exception {
+ setValue(invoke());
+ }
+
/**
* If the value property of this instance is not already set,
* this method dynamically finds the method with the specified
diff --git a/jdk/src/share/classes/java/beans/Statement.java b/jdk/src/share/classes/java/beans/Statement.java
index f498f0b2fb4..e5ca91a7aa9 100644
--- a/jdk/src/share/classes/java/beans/Statement.java
+++ b/jdk/src/share/classes/java/beans/Statement.java
@@ -127,8 +127,8 @@ public class Statement {
}
/**
- * The execute method finds a method whose name is the same
- * as the methodName property, and invokes the method on
+ * The {@code execute} method finds a method whose name is the same
+ * as the {@code methodName} property, and invokes the method on
* the target.
*
* When the target's class defines many methods with the given name
@@ -136,7 +136,7 @@ public class Statement {
* the algorithm specified in the Java Language Specification
* (15.11). The dynamic class of the target and arguments are used
* in place of the compile-time type information and, like the
- * java.lang.reflect.Method
class itself, conversion between
+ * {@link java.lang.reflect.Method} class itself, conversion between
* primitive values and their associated wrapper classes is handled
* internally.
*
@@ -147,13 +147,22 @@ public class Statement {
*
* The reserved method name "new" may be used to call a class's constructor
* as if all classes defined static "new" methods. Constructor invocations
- * are typically considered Expression
s rather than Statement
s
+ * are typically considered {@code Expression}s rather than {@code Statement}s
* as they return a value.
*
- * The method names "get" and "set" defined in the java.util.List
+ * The method names "get" and "set" defined in the {@link java.util.List}
* interface may also be applied to array instances, mapping to
- * the static methods of the same name in the Array
class.
+ * the static methods of the same name in the {@code Array} class.
*
+ *
+ * @throws NullPointerException if the value of the {@code target} or
+ * {@code methodName} property is {@code null}
+ * @throws NoSuchMethodException if a matching method is not found
+ * @throws SecurityException if a security manager exists and
+ * it denies the method invocation
+ * @throws Exception that is thrown by the invoked method
+ *
+ * @see java.lang.reflect.Method
*/
public void execute() throws Exception {
invoke();
diff --git a/jdk/test/java/beans/Statement/Test6707226.java b/jdk/test/java/beans/Statement/Test6707226.java
new file mode 100644
index 00000000000..9701de4081c
--- /dev/null
+++ b/jdk/test/java/beans/Statement/Test6707226.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6707226
+ * @summary Tests the value updating in Expression
+ * @author Sergey Malenkov
+ */
+
+import java.beans.Expression;
+
+public class Test6707226 {
+ public static void main(String[] args) throws Exception {
+ Object value = new Object();
+
+ Expression expression = new Expression(value, Object.class, "new", null);
+ if (!value.equals(expression.getValue()))
+ throw new Error("the value is updated unexpectedly");
+
+ expression.execute();
+ if (value.equals(expression.getValue()))
+ throw new Error("the value is not updated as expected");
+ }
+}
From ae14beadd3d2783881e6e5daa35ef17f5f11bc85 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Thu, 11 Mar 2010 16:17:57 +0000
Subject: [PATCH 034/190] 6934054: java/net/Socket/FDClose.java return error in
samevm
Test is no longer useful
Reviewed-by: alanb
---
jdk/test/ProblemList.txt | 1 -
jdk/test/java/net/Socket/FDClose.java | 71 ---------------------------
2 files changed, 72 deletions(-)
delete mode 100644 jdk/test/java/net/Socket/FDClose.java
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 8b3f03d837e..e294b9c29e8 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -661,7 +661,6 @@ java/net/Socket/DeadlockTest.java generic-all
java/net/Socket/AccurateTimeout.java generic-all
java/net/Socket/asyncClose/BrokenPipe.java generic-all
java/net/Socket/CloseAvailable.java generic-all
-java/net/Socket/FDClose.java generic-all
# Linux X64 address already in use, samevm issues
java/net/Socket/LingerTest.java generic-all
diff --git a/jdk/test/java/net/Socket/FDClose.java b/jdk/test/java/net/Socket/FDClose.java
deleted file mode 100644
index a64478a1ca2..00000000000
--- a/jdk/test/java/net/Socket/FDClose.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 1998-2002 Sun Microsystems, Inc. All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/**
- * @test
- * @bug 4152799
- * @summary test to see if interrupting a socket accept closes fd0
- */
-import java.net.*;
-import java.io.*;
-import java.util.*;
-
-public class FDClose {
-
- static boolean isServerReady = false;
-
- public static void main(String[] args) throws Exception {
-
- Thread me = Thread.currentThread();
-
- // Put a thread waiting on SocketServer.Accept
- AReader test = new AReader();
- Thread readerThread = new Thread(test);
- readerThread.start();
-
- // wait for the server socket to be ready
- while (!isServerReady) {
- me.sleep(100);
- }
-
- // Interrupt the waiting thread
- readerThread.interrupt();
-
- // Wait another moment
- me.sleep(100);
-
- // Check to see if fd0 is closed
- System.in.available();
- }
-
- public static class AReader implements Runnable {
- public void run() {
- try {
- ServerSocket sock = new ServerSocket(0);
- isServerReady = true;
- sock.accept();
- } catch (Exception e) {
- }
- }
- }
-}
From 9cf7c0352d87ea6064cf5722c5db42eb97be270c Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Thu, 11 Mar 2010 17:37:33 +0000
Subject: [PATCH 035/190] 6933629:
java/net/HttpURLConnection/HttpResponseCode.java fails if run in samevm mode
Reviewed-by: alanb
---
jdk/test/ProblemList.txt | 1 -
jdk/test/java/net/CookieHandler/CookieHandlerTest.java | 4 ++++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index e294b9c29e8..b6442f648d8 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -700,7 +700,6 @@ java/net/URLConnection/TimeoutTest.java generic-all
java/net/URLConnection/ZeroContentLength.java generic-all
# Solaris 11 i586 fails with samevm, not sure why
-java/net/HttpURLConnection/HttpResponseCode.java generic-all
java/net/ResponseCache/B6181108.java generic-all
java/net/ResponseCache/ResponseCacheTest.java generic-all
java/net/URL/GetContent.java generic-all
diff --git a/jdk/test/java/net/CookieHandler/CookieHandlerTest.java b/jdk/test/java/net/CookieHandler/CookieHandlerTest.java
index a3b4ada2761..221be099783 100644
--- a/jdk/test/java/net/CookieHandler/CookieHandlerTest.java
+++ b/jdk/test/java/net/CookieHandler/CookieHandlerTest.java
@@ -24,9 +24,13 @@
/* @test
* @summary Unit test for java.net.CookieHandler
* @bug 4696506
+ * @run main/othervm CookieHandlerTest
* @author Yingxian Wang
*/
+// Run in othervm since a default cookier handler is set and this
+// can effect other HTTP related tests.
+
import java.net.*;
import java.util.*;
import java.io.*;
From 63a75eead0dd9631bd016edcef1022b961d9e68f Mon Sep 17 00:00:00 2001
From: Damjan Jovanovic
Date: Thu, 11 Mar 2010 17:50:30 +0000
Subject: [PATCH 036/190] 6223635: Code hangs at connect call even when Timeout
is specified when using a socks proxy
Reviewed-by: michaelm, chegar
---
.../classes/java/net/SocketInputStream.java | 8 +-
.../classes/java/net/SocksSocketImpl.java | 82 ++++++++---
.../java/net/Socket/SocksConnectTimeout.java | 132 ++++++++++++++++++
3 files changed, 197 insertions(+), 25 deletions(-)
create mode 100644 jdk/test/java/net/Socket/SocksConnectTimeout.java
diff --git a/jdk/src/share/classes/java/net/SocketInputStream.java b/jdk/src/share/classes/java/net/SocketInputStream.java
index 63ef40ecb79..e8086559f19 100644
--- a/jdk/src/share/classes/java/net/SocketInputStream.java
+++ b/jdk/src/share/classes/java/net/SocketInputStream.java
@@ -118,6 +118,10 @@ class SocketInputStream extends FileInputStream
* @exception IOException If an I/O error has occurred.
*/
public int read(byte b[], int off, int length) throws IOException {
+ return read(b, off, length, impl.getTimeout());
+ }
+
+ int read(byte b[], int off, int length, int timeout) throws IOException {
int n;
// EOF already encountered
@@ -143,7 +147,7 @@ class SocketInputStream extends FileInputStream
// acquire file descriptor and do the read
FileDescriptor fd = impl.acquireFD();
try {
- n = socketRead0(fd, b, off, length, impl.getTimeout());
+ n = socketRead0(fd, b, off, length, timeout);
if (n > 0) {
return n;
}
@@ -161,7 +165,7 @@ class SocketInputStream extends FileInputStream
impl.setConnectionResetPending();
impl.acquireFD();
try {
- n = socketRead0(fd, b, off, length, impl.getTimeout());
+ n = socketRead0(fd, b, off, length, timeout);
if (n > 0) {
return n;
}
diff --git a/jdk/src/share/classes/java/net/SocksSocketImpl.java b/jdk/src/share/classes/java/net/SocksSocketImpl.java
index 383ac2fcbf6..d4da9c98c17 100644
--- a/jdk/src/share/classes/java/net/SocksSocketImpl.java
+++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java
@@ -98,11 +98,31 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
super.connect(new InetSocketAddress(host, port), timeout);
}
+ private static int remainingMillis(long deadlineMillis) throws IOException {
+ if (deadlineMillis == 0L)
+ return 0;
+
+ final long remaining = deadlineMillis - System.currentTimeMillis();
+ if (remaining > 0)
+ return (int) remaining;
+
+ throw new SocketTimeoutException();
+ }
+
private int readSocksReply(InputStream in, byte[] data) throws IOException {
+ return readSocksReply(in, data, 0L);
+ }
+
+ private int readSocksReply(InputStream in, byte[] data, long deadlineMillis) throws IOException {
int len = data.length;
int received = 0;
for (int attempts = 0; received < len && attempts < 3; attempts++) {
- int count = in.read(data, received, len - received);
+ int count;
+ try {
+ count = ((SocketInputStream)in).read(data, received, len - received, remainingMillis(deadlineMillis));
+ } catch (SocketTimeoutException e) {
+ throw new SocketTimeoutException("Connect timed out");
+ }
if (count < 0)
throw new SocketException("Malformed reply from SOCKS server");
received += count;
@@ -115,6 +135,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
*/
private boolean authenticate(byte method, InputStream in,
BufferedOutputStream out) throws IOException {
+ return authenticate(method, in, out, 0L);
+ }
+
+ private boolean authenticate(byte method, InputStream in,
+ BufferedOutputStream out,
+ long deadlineMillis) throws IOException {
// No Authentication required. We're done then!
if (method == NO_AUTH)
return true;
@@ -162,7 +188,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out.write(0);
out.flush();
byte[] data = new byte[2];
- int i = readSocksReply(in, data);
+ int i = readSocksReply(in, data, deadlineMillis);
if (i != 2 || data[1] != 0) {
/* RFC 1929 specifies that the connection MUST be closed if
authentication fails */
@@ -201,18 +227,18 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// out.write(outToken);
// out.flush();
// data = new byte[2];
-// i = readSocksReply(in, data);
+// i = readSocksReply(in, data, deadlineMillis);
// if (i != 2 || data[1] == 0xff) {
// in.close();
// out.close();
// return false;
// }
-// i = readSocksReply(in, data);
+// i = readSocksReply(in, data, deadlineMillis);
// int len = 0;
// len = ((int)data[0] & 0xff) << 8;
// len += data[1];
// data = new byte[len];
-// i = readSocksReply(in, data);
+// i = readSocksReply(in, data, deadlineMillis);
// if (i == len)
// return true;
// in.close();
@@ -231,7 +257,8 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
private void connectV4(InputStream in, OutputStream out,
- InetSocketAddress endpoint) throws IOException {
+ InetSocketAddress endpoint,
+ long deadlineMillis) throws IOException {
if (!(endpoint.getAddress() instanceof Inet4Address)) {
throw new SocketException("SOCKS V4 requires IPv4 only addresses");
}
@@ -249,7 +276,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out.write(0);
out.flush();
byte[] data = new byte[8];
- int n = readSocksReply(in, data);
+ int n = readSocksReply(in, data, deadlineMillis);
if (n != 8)
throw new SocketException("Reply from SOCKS server has bad length: " + n);
if (data[0] != 0 && data[0] != 4)
@@ -296,6 +323,15 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
*/
@Override
protected void connect(SocketAddress endpoint, int timeout) throws IOException {
+ final long deadlineMillis;
+
+ if (timeout == 0) {
+ deadlineMillis = 0L;
+ } else {
+ long finish = System.currentTimeMillis() + timeout;
+ deadlineMillis = finish < 0 ? Long.MAX_VALUE : finish;
+ }
+
SecurityManager security = System.getSecurityManager();
if (endpoint == null || !(endpoint instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
@@ -322,7 +358,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
/*
* No default proxySelector --> direct connection
*/
- super.connect(epoint, timeout);
+ super.connect(epoint, remainingMillis(deadlineMillis));
return;
}
URI uri;
@@ -345,13 +381,13 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
java.util.Iterator iProxy = null;
iProxy = sel.select(uri).iterator();
if (iProxy == null || !(iProxy.hasNext())) {
- super.connect(epoint, timeout);
+ super.connect(epoint, remainingMillis(deadlineMillis));
return;
}
while (iProxy.hasNext()) {
p = iProxy.next();
if (p == null || p == Proxy.NO_PROXY) {
- super.connect(epoint, timeout);
+ super.connect(epoint, remainingMillis(deadlineMillis));
return;
}
if (p.type() != Proxy.Type.SOCKS)
@@ -364,7 +400,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// Connects to the SOCKS server
try {
- privilegedConnect(server, serverPort, timeout);
+ privilegedConnect(server, serverPort, remainingMillis(deadlineMillis));
// Worked, let's get outta here
break;
} catch (IOException e) {
@@ -388,7 +424,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
} else {
// Connects to the SOCKS server
try {
- privilegedConnect(server, serverPort, timeout);
+ privilegedConnect(server, serverPort, remainingMillis(deadlineMillis));
} catch (IOException e) {
throw new SocketException(e.getMessage());
}
@@ -403,7 +439,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// DOMAIN type of addresses (unresolved addresses here)
if (epoint.isUnresolved())
throw new UnknownHostException(epoint.toString());
- connectV4(in, out, epoint);
+ connectV4(in, out, epoint, deadlineMillis);
return;
}
@@ -414,7 +450,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out.write(USER_PASSW);
out.flush();
byte[] data = new byte[2];
- int i = readSocksReply(in, data);
+ int i = readSocksReply(in, data, deadlineMillis);
if (i != 2 || ((int)data[0]) != PROTO_VERS) {
// Maybe it's not a V5 sever after all
// Let's try V4 before we give up
@@ -422,12 +458,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// DOMAIN type of addresses (unresolved addresses here)
if (epoint.isUnresolved())
throw new UnknownHostException(epoint.toString());
- connectV4(in, out, epoint);
+ connectV4(in, out, epoint, deadlineMillis);
return;
}
if (((int)data[1]) == NO_METHODS)
throw new SocketException("SOCKS : No acceptable methods");
- if (!authenticate(data[1], in, out)) {
+ if (!authenticate(data[1], in, out, deadlineMillis)) {
throw new SocketException("SOCKS : authentication failed");
}
out.write(PROTO_VERS);
@@ -457,7 +493,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
out.flush();
data = new byte[4];
- i = readSocksReply(in, data);
+ i = readSocksReply(in, data, deadlineMillis);
if (i != 4)
throw new SocketException("Reply from SOCKS server has bad length");
SocketException ex = null;
@@ -469,33 +505,33 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
switch(data[3]) {
case IPV4:
addr = new byte[4];
- i = readSocksReply(in, addr);
+ i = readSocksReply(in, addr, deadlineMillis);
if (i != 4)
throw new SocketException("Reply from SOCKS server badly formatted");
data = new byte[2];
- i = readSocksReply(in, data);
+ i = readSocksReply(in, data, deadlineMillis);
if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted");
break;
case DOMAIN_NAME:
len = data[1];
byte[] host = new byte[len];
- i = readSocksReply(in, host);
+ i = readSocksReply(in, host, deadlineMillis);
if (i != len)
throw new SocketException("Reply from SOCKS server badly formatted");
data = new byte[2];
- i = readSocksReply(in, data);
+ i = readSocksReply(in, data, deadlineMillis);
if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted");
break;
case IPV6:
len = data[1];
addr = new byte[len];
- i = readSocksReply(in, addr);
+ i = readSocksReply(in, addr, deadlineMillis);
if (i != len)
throw new SocketException("Reply from SOCKS server badly formatted");
data = new byte[2];
- i = readSocksReply(in, data);
+ i = readSocksReply(in, data, deadlineMillis);
if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted");
break;
diff --git a/jdk/test/java/net/Socket/SocksConnectTimeout.java b/jdk/test/java/net/Socket/SocksConnectTimeout.java
new file mode 100644
index 00000000000..0821b976c09
--- /dev/null
+++ b/jdk/test/java/net/Socket/SocksConnectTimeout.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6223635
+ * @summary Code hangs at connect call even when Timeout is specified
+ */
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.Socket;
+import java.net.ServerSocket;
+import java.net.SocketTimeoutException;
+import java.io.IOException;
+import java.io.Closeable;
+import java.util.concurrent.Phaser;
+import java.util.concurrent.TimeUnit;
+
+public class SocksConnectTimeout {
+ static ServerSocket serverSocket;
+ static final boolean debug = true;
+ static final Phaser startPhaser = new Phaser(2);
+ static final Phaser finishPhaser = new Phaser(2);
+ static int failed, passed;
+
+ public static void main(String[] args) {
+ try {
+ serverSocket = new ServerSocket(0);
+
+ (new Thread() {
+ @Override
+ public void run() { serve(); }
+ }).start();
+
+ Proxy socksProxy = new Proxy(Proxy.Type.SOCKS,
+ new InetSocketAddress(InetAddress.getLocalHost(), serverSocket.getLocalPort()));
+
+ test(socksProxy);
+ } catch (IOException e) {
+ unexpected(e);
+ } finally {
+ close(serverSocket);
+
+ if (failed > 0)
+ throw new RuntimeException("Test Failed: passed:" + passed + ", failed:" + failed);
+ }
+ }
+
+ static void test(Proxy proxy) {
+ startPhaser.arriveAndAwaitAdvance();
+ Socket socket = null;
+ try {
+ socket = new Socket(proxy);
+ connectWithTimeout(socket);
+ failed("connected successfully!");
+ } catch (SocketTimeoutException socketTimeout) {
+ debug("Passed: Received: " + socketTimeout);
+ passed();
+ } catch (Exception exception) {
+ failed("Connect timeout test failed", exception);
+ } finally {
+ finishPhaser.arriveAndAwaitAdvance();
+ close(socket);
+ }
+ }
+
+ static void connectWithTimeout(Socket socket) throws IOException {
+ socket.connect(new InetSocketAddress(InetAddress.getLocalHost(), 1234), 500);
+ }
+
+ static void serve() {
+ Socket client = null;
+ try {
+ startPhaser.arriveAndAwaitAdvance();
+ client = serverSocket.accept();
+ finishPhaser.awaitAdvanceInterruptibly(finishPhaser.arrive(), 5, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ unexpected(e);
+ } finally {
+ close(client);
+ }
+ }
+
+ static void debug(String message) {
+ if (debug)
+ System.out.println(message);
+ }
+
+ static void unexpected(Exception e ) {
+ System.out.println("Unexcepted Exception: " + e);
+ }
+
+ static void close(Closeable closeable) {
+ if (closeable != null) try { closeable.close(); } catch (IOException e) {unexpected(e);}
+ }
+
+ static void failed(String message) {
+ System.out.println(message);
+ failed++;
+ }
+
+ static void failed(String message, Exception e) {
+ System.out.println(message);
+ System.out.println(e);
+ failed++;
+ }
+
+ static void passed() { passed++; };
+
+}
From 57a26502f08da59bd72cd0515f3d6fec9f6e3823 Mon Sep 17 00:00:00 2001
From: Xueming Shen
Date: Thu, 11 Mar 2010 14:06:09 -0800
Subject: [PATCH 037/190] 6929479: Add a system property
sun.zip.disableMemoryMapping to disable mmap use in ZipFile
System property sun.zip.disableMemoryMapping to disable mmap use
Reviewed-by: alanb
---
.../share/classes/java/util/zip/ZipFile.java | 19 ++-
jdk/src/share/native/java/util/zip/ZipFile.c | 5 +-
jdk/src/share/native/java/util/zip/zip_util.c | 140 ++++++++++--------
jdk/src/share/native/java/util/zip/zip_util.h | 10 +-
4 files changed, 105 insertions(+), 69 deletions(-)
diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java
index 583d7dcfe1a..6eabd7b9805 100644
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java
@@ -36,6 +36,8 @@ import java.util.Enumeration;
import java.util.Set;
import java.util.HashSet;
import java.util.NoSuchElementException;
+import java.security.AccessController;
+import sun.security.action.GetPropertyAction;
import static java.util.zip.ZipConstants64.*;
/**
@@ -78,6 +80,17 @@ class ZipFile implements ZipConstants, Closeable {
private static native void initIDs();
+ private static final boolean usemmap;
+
+ static {
+ // A system prpperty to disable mmap use to avoid vm crash when
+ // in-use zip file is accidently overwritten by others.
+ String prop = AccessController.doPrivileged(
+ new GetPropertyAction("sun.zip.disableMemoryMapping"));
+ usemmap = (prop == null ||
+ !(prop.length() == 0 || prop.equalsIgnoreCase("true")));
+ }
+
/**
* Opens a zip file for reading.
*
@@ -196,7 +209,7 @@ class ZipFile implements ZipConstants, Closeable {
throw new NullPointerException("charset is null");
this.zc = ZipCoder.get(charset);
long t0 = System.nanoTime();
- jzfile = open(name, mode, file.lastModified());
+ jzfile = open(name, mode, file.lastModified(), usemmap);
sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
sun.misc.PerfCounter.getZipFileCount().increment();
this.name = name;
@@ -673,8 +686,8 @@ class ZipFile implements ZipConstants, Closeable {
}
- private static native long open(String name, int mode, long lastModified)
- throws IOException;
+ private static native long open(String name, int mode, long lastModified,
+ boolean usemmap) throws IOException;
private static native int getTotal(long jzfile);
private static native int read(long jzfile, long jzentry,
long pos, byte[] b, int off, int len);
diff --git a/jdk/src/share/native/java/util/zip/ZipFile.c b/jdk/src/share/native/java/util/zip/ZipFile.c
index f1da2a7bba7..6699d08e6db 100644
--- a/jdk/src/share/native/java/util/zip/ZipFile.c
+++ b/jdk/src/share/native/java/util/zip/ZipFile.c
@@ -81,7 +81,8 @@ ThrowZipException(JNIEnv *env, const char *msg)
JNIEXPORT jlong JNICALL
Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
- jint mode, jlong lastModified)
+ jint mode, jlong lastModified,
+ jboolean usemmap)
{
const char *path = JNU_GetStringPlatformChars(env, name, 0);
char *msg = 0;
@@ -109,7 +110,7 @@ Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
goto finally;
}
#endif
- zip = ZIP_Put_In_Cache(path, zfd, &msg, lastModified);
+ zip = ZIP_Put_In_Cache0(path, zfd, &msg, lastModified, usemmap);
}
if (zip != 0) {
diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c
index e6d2ef00452..986f0aaa669 100644
--- a/jdk/src/share/native/java/util/zip/zip_util.c
+++ b/jdk/src/share/native/java/util/zip/zip_util.c
@@ -251,11 +251,16 @@ freeZip(jzfile *zip)
if (zip->lock != NULL) MDESTROY(zip->lock);
free(zip->name);
freeCEN(zip);
+
#ifdef USE_MMAP
- if (zip->maddr != NULL) munmap((char *)zip->maddr, zip->mlen);
-#else
- free(zip->cencache.data);
+ if (zip->usemmap) {
+ if (zip->maddr != NULL)
+ munmap((char *)zip->maddr, zip->mlen);
+ } else
#endif
+ {
+ free(zip->cencache.data);
+ }
if (zip->comment != NULL)
free(zip->comment);
if (zip->zfd != -1) ZFILE_Close(zip->zfd);
@@ -585,49 +590,53 @@ readCEN(jzfile *zip, jint knownTotal)
ZIP_FORMAT_ERROR("invalid END header (bad central directory offset)");
#ifdef USE_MMAP
- /* On Solaris & Linux prior to JDK 6, we used to mmap the whole jar file to
- * read the jar file contents. However, this greatly increased the perceived
- * footprint numbers because the mmap'ed pages were adding into the totals shown
- * by 'ps' and 'top'. We switched to mmaping only the central directory of jar
- * file while calling 'read' to read the rest of jar file. Here are a list of
- * reasons apart from above of why we are doing so:
- * 1. Greatly reduces mmap overhead after startup complete;
- * 2. Avoids dual path code maintainance;
- * 3. Greatly reduces risk of address space (not virtual memory) exhaustion.
- */
- if (pagesize == 0) {
- pagesize = (jlong)sysconf(_SC_PAGESIZE);
- if (pagesize == 0) goto Catch;
- }
- if (cenpos > pagesize) {
- offset = cenpos & ~(pagesize - 1);
- } else {
- offset = 0;
- }
- /* When we are not calling recursively, knownTotal is -1. */
- if (knownTotal == -1) {
- void* mappedAddr;
- /* Mmap the CEN and END part only. We have to figure
- out the page size in order to make offset to be multiples of
- page size.
- */
- zip->mlen = cenpos - offset + cenlen + endhdrlen;
- zip->offset = offset;
- mappedAddr = mmap64(0, zip->mlen, PROT_READ, MAP_SHARED, zip->zfd, (off64_t) offset);
- zip->maddr = (mappedAddr == (void*) MAP_FAILED) ? NULL :
- (unsigned char*)mappedAddr;
-
- if (zip->maddr == NULL) {
- jio_fprintf(stderr, "mmap failed for CEN and END part of zip file\n");
- goto Catch;
+ if (zip->usemmap) {
+ /* On Solaris & Linux prior to JDK 6, we used to mmap the whole jar file to
+ * read the jar file contents. However, this greatly increased the perceived
+ * footprint numbers because the mmap'ed pages were adding into the totals shown
+ * by 'ps' and 'top'. We switched to mmaping only the central directory of jar
+ * file while calling 'read' to read the rest of jar file. Here are a list of
+ * reasons apart from above of why we are doing so:
+ * 1. Greatly reduces mmap overhead after startup complete;
+ * 2. Avoids dual path code maintainance;
+ * 3. Greatly reduces risk of address space (not virtual memory) exhaustion.
+ */
+ if (pagesize == 0) {
+ pagesize = (jlong)sysconf(_SC_PAGESIZE);
+ if (pagesize == 0) goto Catch;
}
- }
- cenbuf = zip->maddr + cenpos - offset;
-#else
- if ((cenbuf = malloc((size_t) cenlen)) == NULL ||
- (readFullyAt(zip->zfd, cenbuf, cenlen, cenpos) == -1))
- goto Catch;
+ if (cenpos > pagesize) {
+ offset = cenpos & ~(pagesize - 1);
+ } else {
+ offset = 0;
+ }
+ /* When we are not calling recursively, knownTotal is -1. */
+ if (knownTotal == -1) {
+ void* mappedAddr;
+ /* Mmap the CEN and END part only. We have to figure
+ out the page size in order to make offset to be multiples of
+ page size.
+ */
+ zip->mlen = cenpos - offset + cenlen + endhdrlen;
+ zip->offset = offset;
+ mappedAddr = mmap64(0, zip->mlen, PROT_READ, MAP_SHARED, zip->zfd, (off64_t) offset);
+ zip->maddr = (mappedAddr == (void*) MAP_FAILED) ? NULL :
+ (unsigned char*)mappedAddr;
+
+ if (zip->maddr == NULL) {
+ jio_fprintf(stderr, "mmap failed for CEN and END part of zip file\n");
+ goto Catch;
+ }
+ }
+ cenbuf = zip->maddr + cenpos - offset;
+ } else
#endif
+ {
+ if ((cenbuf = malloc((size_t) cenlen)) == NULL ||
+ (readFullyAt(zip->zfd, cenbuf, cenlen, cenpos) == -1))
+ goto Catch;
+ }
+
cenend = cenbuf + cenlen;
/* Initialize zip file data structures based on the total number
@@ -700,9 +709,11 @@ readCEN(jzfile *zip, jint knownTotal)
cenpos = -1;
Finally:
-#ifndef USE_MMAP
- free(cenbuf);
+#ifdef USE_MMAP
+ if (!zip->usemmap)
#endif
+ free(cenbuf);
+
return cenpos;
}
@@ -782,8 +793,16 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
* If a zip error occurs, then *pmsg will be set to the error message text if
* pmsg != 0. Otherwise, *pmsg will be set to NULL.
*/
+
jzfile *
ZIP_Put_In_Cache(const char *name, ZFILE zfd, char **pmsg, jlong lastModified)
+{
+ return ZIP_Put_In_Cache0(name, zfd, pmsg, lastModified, JNI_TRUE);
+}
+
+jzfile *
+ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
+ jboolean usemmap)
{
static char errbuf[256];
jlong len;
@@ -793,6 +812,9 @@ ZIP_Put_In_Cache(const char *name, ZFILE zfd, char **pmsg, jlong lastModified)
return NULL;
}
+#ifdef USE_MMAP
+ zip->usemmap = usemmap;
+#endif
zip->refs = 1;
zip->lastModified = lastModified;
@@ -877,8 +899,6 @@ ZIP_Close(jzfile *zip)
return;
}
-#ifndef USE_MMAP
-
/* Empirically, most CEN headers are smaller than this. */
#define AMPLE_CEN_HEADER_SIZE 160
@@ -928,7 +948,6 @@ sequentialAccessReadCENHeader(jzfile *zip, jlong cenpos)
cache->pos = cenpos;
return cen;
}
-#endif /* not USE_MMAP */
typedef enum { ACCESS_RANDOM, ACCESS_SEQUENTIAL } AccessHint;
@@ -953,14 +972,17 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
ze->comment = NULL;
#ifdef USE_MMAP
- cen = (char*) zip->maddr + zc->cenpos - zip->offset;
-#else
- if (accessHint == ACCESS_RANDOM)
- cen = readCENHeader(zip, zc->cenpos, AMPLE_CEN_HEADER_SIZE);
- else
- cen = sequentialAccessReadCENHeader(zip, zc->cenpos);
- if (cen == NULL) goto Catch;
+ if (zip->usemmap) {
+ cen = (char*) zip->maddr + zc->cenpos - zip->offset;
+ } else
#endif
+ {
+ if (accessHint == ACCESS_RANDOM)
+ cen = readCENHeader(zip, zc->cenpos, AMPLE_CEN_HEADER_SIZE);
+ else
+ cen = sequentialAccessReadCENHeader(zip, zc->cenpos);
+ if (cen == NULL) goto Catch;
+ }
nlen = CENNAM(cen);
elen = CENEXT(cen);
@@ -976,7 +998,6 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
if ((ze->name = malloc(nlen + 1)) == NULL) goto Catch;
memcpy(ze->name, cen + CENHDR, nlen);
ze->name[nlen] = '\0';
-
if (elen > 0) {
char *extra = cen + CENHDR + nlen;
@@ -1037,9 +1058,10 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
ze = NULL;
Finally:
-#ifndef USE_MMAP
- if (cen != NULL && accessHint == ACCESS_RANDOM) free(cen);
+#ifdef USE_MMAP
+ if (!zip->usemmap)
#endif
+ if (cen != NULL && accessHint == ACCESS_RANDOM) free(cen);
return ze;
}
diff --git a/jdk/src/share/native/java/util/zip/zip_util.h b/jdk/src/share/native/java/util/zip/zip_util.h
index 114fe842fcb..44765b2ca3e 100644
--- a/jdk/src/share/native/java/util/zip/zip_util.h
+++ b/jdk/src/share/native/java/util/zip/zip_util.h
@@ -45,9 +45,6 @@
* Header sizes including signatures
*/
-#ifdef USE_MMAP
-#define SIGSIZ 4
-#endif
#define LOCHDR 30
#define EXTHDR 16
#define CENHDR 46
@@ -211,9 +208,9 @@ typedef struct jzfile { /* Zip file */
jlong mlen; /* length (in bytes) mmaped */
jlong offset; /* offset of the mmapped region from the
start of the file. */
-#else
- cencache cencache; /* CEN header cache */
+ jboolean usemmap; /* if mmap is used. */
#endif
+ cencache cencache; /* CEN header cache */
ZFILE zfd; /* open file descriptor */
void *lock; /* read lock */
char *comment; /* zip file comment */
@@ -259,6 +256,9 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified);
jzfile *
ZIP_Put_In_Cache(const char *name, ZFILE zfd, char **pmsg, jlong lastModified);
+jzfile *
+ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified, jboolean usemmap);
+
void JNICALL
ZIP_Close(jzfile *zip);
From 2c08386c7594df03b5c31f3d410b5389be364388 Mon Sep 17 00:00:00 2001
From: Andrew John Hughes
Date: Fri, 12 Mar 2010 01:09:13 +0000
Subject: [PATCH 038/190] 6934327: Update linux fontconfigs for Ubuntu and
Fedora
Use fontconfigs suitable for recent Fedora, Ubuntu and Debian releases.
Reviewed-by: prr
---
.../linux.fontconfig.Fedora.properties | 276 ++++++++++++---
.../linux.fontconfig.Ubuntu.properties | 333 ++++++++++++++----
2 files changed, 497 insertions(+), 112 deletions(-)
diff --git a/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Fedora.properties b/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Fedora.properties
index d11f2ec2817..47982212931 100644
--- a/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Fedora.properties
+++ b/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Fedora.properties
@@ -26,134 +26,310 @@
# Version
-# Uses Fedora Core 6 fonts and file paths.
+# Uses Fedora 9 fonts and file paths.
version=1
# Component Font Mappings
-dialog.plain.latin-1=DejaVu LGC Sans
+dialog.plain.latin-1=DejaVu Sans
dialog.plain.japanese-x0208=Sazanami Gothic
dialog.plain.korean=Baekmuk Gulim
dialog.plain.chinese-big5=AR PL ShanHeiSun Uni
dialog.plain.chinese-gb18030=AR PL ShanHeiSun Uni
+dialog.plain.bengali=Lohit Bengali
+dialog.plain.gujarati=Lohit Gujarati
+dialog.plain.hindi=Lohit Hindi
+dialog.plain.malayalam=Lohit Malayalam
+dialog.plain.oriya=Lohit Oriya
+dialog.plain.punjabi=Lohit Punjabi
+dialog.plain.tamil=Lohit Tamil
+dialog.plain.telugu=Lohit Telugu
+dialog.plain.sinhala=LKLUG
-dialog.bold.latin-1=DejaVu LGC Sans Bold
+dialog.bold.latin-1=DejaVu Sans Bold
dialog.bold.japanese-x0208=Sazanami Gothic
dialog.bold.korean=Baekmuk Gulim
dialog.bold.chinese-big5=AR PL ShanHeiSun Uni
dialog.bold.chinese-gb18030=AR PL ShanHeiSun Uni
+dialog.bold.bengali=Lohit Bengali
+dialog.bold.gujarati=Lohit Gujarati
+dialog.bold.hindi=Lohit Hindi
+dialog.bold.malayalam=Lohit Malayalam
+dialog.bold.oriya=Lohit Oriya
+dialog.bold.punjabi=Lohit Punjabi
+dialog.bold.tamil=Lohit Tamil
+dialog.bold.telugu=Lohit Telugu
+dialog.bold.sinhala=LKLUG
-dialog.italic.latin-1=DejaVu LGC Sans Oblique
+dialog.italic.latin-1=DejaVu Sans Oblique
dialog.italic.japanese-x0208=Sazanami Gothic
dialog.italic.korean=Baekmuk Gulim
dialog.italic.chinese-big5=AR PL ShanHeiSun Uni
dialog.italic.chinese-gb18030=AR PL ShanHeiSun Uni
+dialog.italic.bengali=Lohit Bengali
+dialog.italic.gujarati=Lohit Gujarati
+dialog.italic.hindi=Lohit Hindi
+dialog.italic.malayalam=Lohit Malayalam
+dialog.italic.oriya=Lohit Oriya
+dialog.italic.punjabi=Lohit Punjabi
+dialog.italic.tamil=Lohit Tamil
+dialog.italic.telugu=Lohit Telugu
+dialog.italic.sinhala=LKLUG
-dialog.bolditalic.latin-1=DejaVu LGC Sans Bold Oblique
+dialog.bolditalic.latin-1=DejaVu Sans Bold Oblique
dialog.bolditalic.japanese-x0208=Sazanami Gothic
dialog.bolditalic.korean=Baekmuk Gulim
dialog.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
dialog.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni
+dialog.bolditalic.bengali=Lohit Bengali
+dialog.bolditalic.gujarati=Lohit Gujarati
+dialog.bolditalic.hindi=Lohit Hindi
+dialog.bolditalic.malayalam=Lohit Malayalam
+dialog.bolditalic.oriya=Lohit Oriya
+dialog.bolditalic.punjabi=Lohit Punjabi
+dialog.bolditalic.tamil=Lohit Tamil
+dialog.bolditalic.telugu=Lohit Telugu
+dialog.bolditalic.sinhala=LKLUG
-
-sansserif.plain.latin-1=DejaVu LGC Sans
+sansserif.plain.latin-1=DejaVu Sans
sansserif.plain.japanese-x0208=Sazanami Gothic
sansserif.plain.korean=Baekmuk Gulim
sansserif.plain.chinese-big5=AR PL ShanHeiSun Uni
sansserif.plain.chinese-gb18030=AR PL ShanHeiSun Uni
+sansserif.plain.bengali=Lohit Bengali
+sansserif.plain.gujarati=Lohit Gujarati
+sansserif.plain.hindi=Lohit Hindi
+sansserif.plain.malayalam=Lohit Malayalam
+sansserif.plain.oriya=Lohit Oriya
+sansserif.plain.punjabi=Lohit Punjabi
+sansserif.plain.tamil=Lohit Tamil
+sansserif.plain.telugu=Lohit Telugu
+sansserif.plain.sinhala=LKLUG
-sansserif.bold.latin-1=DejaVu LGC Sans Bold
+sansserif.bold.latin-1=DejaVu Sans Bold
sansserif.bold.japanese-x0208=Sazanami Gothic
sansserif.bold.korean=Baekmuk Gulim
sansserif.bold.chinese-big5=AR PL ShanHeiSun Uni
sansserif.bold.chinese-gb18030=AR PL ShanHeiSun Uni
+sansserif.bold.bengali=Lohit Bengali
+sansserif.bold.gujarati=Lohit Gujarati
+sansserif.bold.hindi=Lohit Hindi
+sansserif.bold.malayalam=Lohit Malayalam
+sansserif.bold.oriya=Lohit Oriya
+sansserif.bold.punjabi=Lohit Punjabi
+sansserif.bold.tamil=Lohit Tamil
+sansserif.bold.telugu=Lohit Telugu
+sansserif.bold.sinhala=LKLUG
-sansserif.italic.latin-1=DejaVu LGC Sans Oblique
+sansserif.italic.latin-1=DejaVu Sans Oblique
sansserif.italic.japanese-x0208=Sazanami Gothic
sansserif.italic.korean=Baekmuk Gulim
sansserif.italic.chinese-big5=AR PL ShanHeiSun Uni
sansserif.italic.chinese-gb18030=AR PL ShanHeiSun Uni
+sansserif.italic.bengali=Lohit Bengali
+sansserif.italic.gujarati=Lohit Gujarati
+sansserif.italic.hindi=Lohit Hindi
+sansserif.italic.malayalam=Lohit Malayalam
+sansserif.italic.oriya=Lohit Oriya
+sansserif.italic.punjabi=Lohit Punjabi
+sansserif.italic.tamil=Lohit Tamil
+sansserif.italic.telugu=Lohit Telugu
+sansserif.italic.sinhala=LKLUG
-sansserif.bolditalic.latin-1=DejaVu LGC Sans Bold Oblique
+sansserif.bolditalic.latin-1=DejaVu Sans Bold Oblique
sansserif.bolditalic.japanese-x0208=Sazanami Gothic
sansserif.bolditalic.korean=Baekmuk Gulim
sansserif.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
sansserif.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni
+sansserif.bolditalic.bengali=Lohit Bengali
+sansserif.bolditalic.gujarati=Lohit Gujarati
+sansserif.bolditalic.hindi=Lohit Hindi
+sansserif.bolditalic.malayalam=Lohit Malayalam
+sansserif.bolditalic.oriya=Lohit Oriya
+sansserif.bolditalic.punjabi=Lohit Punjabi
+sansserif.bolditalic.tamil=Lohit Tamil
+sansserif.bolditalic.telugu=Lohit Telugu
+sansserif.bolditalic.sinhala=LKLUG
-
-serif.plain.latin-1=DejaVu LGC Serif
+serif.plain.latin-1=DejaVu Serif
serif.plain.japanese-x0208=Sazanami Mincho
serif.plain.korean=Baekmuk Batang
serif.plain.chinese-big5=AR PL ZenKai Uni
serif.plain.chinese-gb18030=AR PL ZenKai Uni
+serif.plain.bengali=Lohit Bengali
+serif.plain.gujarati=Lohit Gujarati
+serif.plain.hindi=Lohit Hindi
+serif.plain.malayalam=Lohit Malayalam
+serif.plain.oriya=Lohit Oriya
+serif.plain.punjabi=Lohit Punjabi
+serif.plain.tamil=Lohit Tamil
+serif.plain.telugu=Lohit Telugu
+serif.plain.sinhala=LKLUG
-serif.bold.latin-1=DejaVu LGC Serif Bold
+serif.bold.latin-1=DejaVu Serif Bold
serif.bold.japanese-x0208=Sazanami Mincho
serif.bold.korean=Baekmuk Batang
serif.bold.chinese-big5=AR PL ZenKai Uni
serif.bold.chinese-gb18030=AR PL ZenKai Uni
+serif.bold.bengali=Lohit Bengali
+serif.bold.gujarati=Lohit Gujarati
+serif.bold.hindi=Lohit Hindi
+serif.bold.malayalam=Lohit Malayalam
+serif.bold.oriya=Lohit Oriya
+serif.bold.punjabi=Lohit Punjabi
+serif.bold.tamil=Lohit Tamil
+serif.bold.telugu=Lohit Telugu
+serif.bold.sinhala=LKLUG
-serif.italic.latin-1=DejaVu LGC Serif Oblique
+serif.italic.latin-1=DejaVu Serif Oblique
serif.italic.japanese-x0208=Sazanami Mincho
serif.italic.korean=Baekmuk Batang
serif.italic.chinese-big5=AR PL ZenKai Uni
serif.italic.chinese-gb18030=AR PL ZenKai Uni
+serif.italic.bengali=Lohit Bengali
+serif.italic.gujarati=Lohit Gujarati
+serif.italic.hindi=Lohit Hindi
+serif.italic.malayalam=Lohit Malayalam
+serif.italic.oriya=Lohit Oriya
+serif.italic.punjabi=Lohit Punjabi
+serif.italic.tamil=Lohit Tamil
+serif.italic.telugu=Lohit Telugu
+serif.italic.sinhala=LKLUG
-serif.bolditalic.latin-1=DejaVu LGC Serif Bold Oblique
+serif.bolditalic.latin-1=DejaVu Serif Bold Oblique
serif.bolditalic.japanese-x0208=Sazanami Mincho
serif.bolditalic.korean=Baekmuk Batang
serif.bolditalic.chinese-big5=AR PL ZenKai Uni
serif.bolditalic.chinese-gb18030=AR PL ZenKai Uni
+serif.bolditalic.bengali=Lohit Bengali
+serif.bolditalic.gujarati=Lohit Gujarati
+serif.bolditalic.hindi=Lohit Hindi
+serif.bolditalic.malayalam=Lohit Malayalam
+serif.bolditalic.oriya=Lohit Oriya
+serif.bolditalic.punjabi=Lohit Punjabi
+serif.bolditalic.tamil=Lohit Tamil
+serif.bolditalic.telugu=Lohit Telugu
+serif.bolditalic.sinhala=LKLUG
-
-monospaced.plain.latin-1=DejaVu LGC Sans Mono
+monospaced.plain.latin-1=DejaVu Sans Mono
monospaced.plain.japanese-x0208=Sazanami Gothic
monospaced.plain.korean=Baekmuk Gulim
monospaced.plain.chinese-big5=AR PL ShanHeiSun Uni
monospaced.plain.chinese-gb18030=AR PL ShanHeiSun Uni
+monospaced.plain.bengali=Lohit Bengali
+monospaced.plain.gujarati=Lohit Gujarati
+monospaced.plain.hindi=Lohit Hindi
+monospaced.plain.malayalam=Lohit Malayalam
+monospaced.plain.oriya=Lohit Oriya
+monospaced.plain.punjabi=Lohit Punjabi
+monospaced.plain.tamil=Lohit Tamil
+monospaced.plain.telugu=Lohit Telugu
+monospaced.plain.sinhala=LKLUG
-monospaced.bold.latin-1=DejaVu LGC Sans Mono Bold
+monospaced.bold.latin-1=DejaVu Sans Mono Bold
monospaced.bold.japanese-x0208=Sazanami Gothic
monospaced.bold.korean=Baekmuk Gulim
monospaced.bold.chinese-big5=AR PL ShanHeiSun Uni
monospaced.bold.chinese-gb18030=AR PL ShanHeiSun Uni
+monospaced.bold.bengali=Lohit Bengali
+monospaced.bold.gujarati=Lohit Gujarati
+monospaced.bold.hindi=Lohit Hindi
+monospaced.bold.malayalam=Lohit Malayalam
+monospaced.bold.oriya=Lohit Oriya
+monospaced.bold.punjabi=Lohit Punjabi
+monospaced.bold.tamil=Lohit Tamil
+monospaced.bold.telugu=Lohit Telugu
+monospaced.bold.sinhala=LKLUG
-monospaced.italic.latin-1=DejaVu LGC Sans Mono Oblique
+monospaced.italic.latin-1=DejaVu Sans Mono Oblique
monospaced.italic.japanese-x0208=Sazanami Gothic
monospaced.italic.korean=Baekmuk Gulim
monospaced.italic.chinese-big5=AR PL ShanHeiSun Uni
monospaced.italic.chinese-gb18030=AR PL ShanHeiSun Uni
+monospaced.italic.bengali=Lohit Bengali
+monospaced.italic.gujarati=Lohit Gujarati
+monospaced.italic.hindi=Lohit Hindi
+monospaced.italic.malayalam=Lohit Malayalam
+monospaced.italic.oriya=Lohit Oriya
+monospaced.italic.punjabi=Lohit Punjabi
+monospaced.italic.tamil=Lohit Tamil
+monospaced.italic.telugu=Lohit Telugu
+monospaced.italic.sinhala=LKLUG
-monospaced.bolditalic.latin-1=DejaVu LGC Sans Mono Bold Oblique
+monospaced.bolditalic.latin-1=DejaVu Sans Mono Bold Oblique
monospaced.bolditalic.japanese-x0208=Sazanami Gothic
monospaced.bolditalic.korean=Baekmuk Gulim
monospaced.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
monospaced.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni
+monospaced.bolditalic.bengali=Lohit Bengali
+monospaced.bolditalic.gujarati=Lohit Gujarati
+monospaced.bolditalic.hindi=Lohit Hindi
+monospaced.bolditalic.malayalam=Lohit Malayalam
+monospaced.bolditalic.oriya=Lohit Oriya
+monospaced.bolditalic.punjabi=Lohit Punjabi
+monospaced.bolditalic.tamil=Lohit Tamil
+monospaced.bolditalic.telugu=Lohit Telugu
+monospaced.bolditalic.sinhala=LKLUG
-
-dialoginput.plain.latin-1=DejaVu LGC Sans Mono
+dialoginput.plain.latin-1=DejaVu Sans Mono
dialoginput.plain.japanese-x0208=Sazanami Gothic
dialoginput.plain.korean=Baekmuk Gulim
dialoginput.plain.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.plain.chinese-gb18030=AR PL ShanHeiSun Uni
+dialoginput.plain.bengali=Lohit Bengali
+dialoginput.plain.gujarati=Lohit Gujarati
+dialoginput.plain.hindi=Lohit Hindi
+dialoginput.plain.malayalam=Lohit Malayalam
+dialoginput.plain.oriya=Lohit Oriya
+dialoginput.plain.punjabi=Lohit Punjabi
+dialoginput.plain.tamil=Lohit Tamil
+dialoginput.plain.telugu=Lohit Telugu
+dialoginput.plain.sinhala=LKLUG
-dialoginput.bold.latin-1=DejaVu LGC Sans Mono Bold
+dialoginput.bold.latin-1=DejaVu Sans Mono Bold
dialoginput.bold.japanese-x0208=Sazanami Gothic
dialoginput.bold.korean=Baekmuk Gulim
dialoginput.bold.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.bold.chinese-gb18030=AR PL ShanHeiSun Uni
+dialoginput.bold.bengali=Lohit Bengali
+dialoginput.bold.gujarati=Lohit Gujarati
+dialoginput.bold.hindi=Lohit Hindi
+dialoginput.bold.malayalam=Lohit Malayalam
+dialoginput.bold.oriya=Lohit Oriya
+dialoginput.bold.punjabi=Lohit Punjabi
+dialoginput.bold.tamil=Lohit Tamil
+dialoginput.bold.telugu=Lohit Telugu
+dialoginput.bold.sinhala=LKLUG
-dialoginput.italic.latin-1=DejaVu LGC Sans Mono Oblique
+dialoginput.italic.latin-1=DejaVu Sans Mono Oblique
dialoginput.italic.japanese-x0208=Sazanami Gothic
dialoginput.italic.korean=Baekmuk Gulim
dialoginput.italic.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.italic.chinese-gb18030=AR PL ShanHeiSun Uni
+dialoginput.italic.bengali=Lohit Bengali
+dialoginput.italic.gujarati=Lohit Gujarati
+dialoginput.italic.hindi=Lohit Hindi
+dialoginput.italic.malayalam=Lohit Malayalam
+dialoginput.italic.oriya=Lohit Oriya
+dialoginput.italic.punjabi=Lohit Punjabi
+dialoginput.italic.tamil=Lohit Tamil
+dialoginput.italic.telugu=Lohit Telugu
+dialoginput.italic.sinhala=LKLUG
-dialoginput.bolditalic.latin-1=DejaVu LGC Sans Mono Bold Oblique
+dialoginput.bolditalic.latin-1=DejaVu Sans Mono Bold Oblique
dialoginput.bolditalic.japanese-x0208=Sazanami Gothic
dialoginput.bolditalic.korean=Baekmuk Gulim
dialoginput.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni
+dialoginput.bolditalic.bengali=Lohit Bengali
+dialoginput.bolditalic.gujarati=Lohit Gujarati
+dialoginput.bolditalic.hindi=Lohit Hindi
+dialoginput.bolditalic.malayalam=Lohit Malayalam
+dialoginput.bolditalic.oriya=Lohit Oriya
+dialoginput.bolditalic.punjabi=Lohit Punjabi
+dialoginput.bolditalic.tamil=Lohit Tamil
+dialoginput.bolditalic.telugu=Lohit Telugu
+dialoginput.bolditalic.sinhala=LKLUG
# Search Sequences
@@ -162,28 +338,40 @@ sequence.allfonts.Big5=chinese-big5,latin-1
sequence.allfonts.x-euc-jp-linux=japanese-x0208,latin-1
sequence.allfonts.EUC-KR=korean,latin-1
sequence.allfonts.GB18030=chinese-gb18030,latin-1
-sequence.fallback=chinese-big5,chinese-gb18030,japanese-x0208,korean
+sequence.fallback=chinese-big5,chinese-gb18030,japanese-x0208,korean,bengali,gujarati,hindi,oriya,punjabi,malayalam,tamil,telugu,sinhala
# Font File Names
-filename.DejaVu_LGC_Sans=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf
-filename.DejaVu_LGC_Sans_Bold=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans-Bold.ttf
-filename.DejaVu_LGC_Sans_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans-Oblique.ttf
-filename.DejaVu_LGC_Sans_Bold_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans-BoldOblique.ttf
+filename.DejaVu_Sans=/usr/share/fonts/dejavu/DejaVuSans.ttf
+filename.DejaVu_Sans_Bold=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf
+filename.DejaVu_Sans_Oblique=/usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf
+filename.DejaVu_Sans_Bold_Oblique=/usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf
-filename.DejaVu_LGC_Sans_Mono=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono.ttf
-filename.DejaVu_LGC_Sans_Mono_Bold=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-Bold.ttf
-filename.DejaVu_LGC_Sans_Mono_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-Oblique.ttf
-filename.DejaVu_LGC_Sans_Mono_Bold_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-BoldOblique.ttf
+filename.DejaVu_Sans_Mono=/usr/share/fonts/dejavu/DejaVuSansMono.ttf
+filename.DejaVu_Sans_Mono_Bold=/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf
+filename.DejaVu_Sans_Mono_Oblique=/usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf
+filename.DejaVu_Sans_Mono_Bold_Oblique=/usr/share/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf
-filename.DejaVu_LGC_Serif=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif.ttf
-filename.DejaVu_LGC_Serif_Bold=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif-Bold.ttf
-filename.DejaVu_LGC_Serif_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif-Oblique.ttf
-filename.DejaVu_LGC_Serif_Bold_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif-BoldOblique.ttf
+filename.DejaVu_Serif=/usr/share/fonts/dejavu/DejaVuSerif.ttf
+filename.DejaVu_Serif_Bold=/usr/share/fonts/dejavu/DejaVuSerif-Bold.ttf
+filename.DejaVu_Serif_Oblique=/usr/share/fonts/dejavu/DejaVuSerif-Oblique.ttf
+filename.DejaVu_Serif_Bold_Oblique=/usr/share/fonts/dejavu/DejaVuSerif-BoldOblique.ttf
+
+filename.Sazanami_Gothic=/usr/share/fonts/sazanami-fonts-gothic/sazanami-gothic.ttf
+filename.Sazanami_Mincho=/usr/share/fonts/sazanami-fonts-mincho/sazanami-mincho.ttf
+filename.AR_PL_ShanHeiSun_Uni=/usr/share/fonts/cjkunifonts-uming/uming.ttc
+filename.AR_PL_ZenKai_Uni=/usr/share/fonts/cjkunifonts-ukai/ukai.ttc
+filename.Baekmuk_Gulim=/usr/share/fonts/baekmuk-ttf-gulim/gulim.ttf
+filename.Baekmuk_Batang=/usr/share/fonts/baekmuk-ttf-batang/batang.ttf
+
+filename.Lohit_Bengali=/usr/share/fonts/lohit-bengali/lohit_bn.ttf
+filename.Lohit_Gujarati=/usr/share/fonts/lohit-gujarati/lohit_gu.ttf
+filename.Lohit_Hindi=/usr/share/fonts/lohit-hindi/lohit_hi.ttf
+filename.Lohit_Kannda=/usr/share/fonts/lohit-kannada/lohit_kn.ttf
+filename.Lohit_Malayalam=/usr/share/fonts/lohit-malayalam/lohit_ml.ttf
+filename.Lohit_Oriya=/usr/share/fonts/lohit-oriya/lohit_or.ttf
+filename.Lohit_Punjabi=/usr/share/fonts/lohit-punjabi/lohit_pa.ttf
+filename.Lohit_Tamil=/usr/share/fonts/lohit-tamil/lohit_ta.ttf
+filename.Lohit_Telugu=/usr/share/fonts/lohit-telugu/lohit_te.ttf
+filename.LKLUG=/usr/share/fonts/lklug/lklug.ttf
-filename.Sazanami_Gothic=/usr/share/fonts/japanese/TrueType/sazanami-gothic.ttf
-filename.Sazanami_Mincho=/usr/share/fonts/japanese/TrueType/sazanami-mincho.ttf
-filename.AR_PL_ShanHeiSun_Uni=/usr/share/fonts/chinese/TrueType/uming.ttf
-filename.AR_PL_ZenKai_Uni=/usr/share/fonts/chinese/TrueType/ukai.ttf
-filename.Baekmuk_Gulim=/usr/share/fonts/korean/TrueType/gulim.ttf
-filename.Baekmuk_Batang=/usr/share/fonts/korean/TrueType/batang.ttf
diff --git a/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Ubuntu.properties b/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Ubuntu.properties
index 64b0db3c14c..80d16adbba3 100644
--- a/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Ubuntu.properties
+++ b/jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Ubuntu.properties
@@ -26,106 +26,253 @@
# Version
-# Uses Ubuntu 6.10 (Edgy) fonts and file paths.
+# Uses Ubuntu 8.04 (hardy), Debian 6.0 (Squeeze) (and more recent releases) fonts and file paths.
version=1
# Component Font Mappings
-dialog.plain.latin-1=DejaVu Sans
-dialog.plain.japanese-x0208=Kochi Gothic
-dialog.plain.korean=Baekmuk Dotum
+# Chinese fonts
+allfonts.umingcn=AR PL UMing CN
+#allfonts.umingcn.motif=AR PL UMing CN
+allfonts.uminghk=AR PL UMing HK
+#allfonts.uminghk.motif=AR PL UMing HK
+allfonts.umingtw=AR PL UMing TW
+#allfonts.umingtw.motif=AR PL UMing TW
+allfonts.wqy-zenhei=WenQuanYi Zen Hei
+#allfonts.wqy-zenhei.motif=WenQuanYi Zen Hei
+allfonts.shanheisun=AR PL ShanHeiSun Uni
+#allfonts.shanheisun.motif=AR PL ShanHeiSun Uni
-dialog.bold.latin-1=DejaVu Sans Bold
-dialog.bold.japanese-x0208=Kochi Gothic
-dialog.bold.korean=Baekmuk Dotum
-
-dialog.italic.latin-1=DejaVu Sans Oblique
-dialog.italic.japanese-x0208=Kochi Gothic
-dialog.italic.korean=Baekmuk Dotum
-
-dialog.bolditalic.latin-1=DejaVu Sans Bold Oblique
-dialog.bolditalic.japanese-x0208=Kochi Gothic
-dialog.bolditalic.korean=Baekmuk Dotum
-
-
-sansserif.plain.latin-1=DejaVu Sans
-sansserif.plain.japanese-x0208=Kochi Gothic
-sansserif.plain.korean=Baekmuk Dotum
-
-sansserif.bold.latin-1=DejaVu Sans Bold
-sansserif.bold.japanese-x0208=Kochi Gothic
-sansserif.bold.korean=Baekmuk Dotum
-
-sansserif.italic.latin-1=DejaVu Sans Oblique
-sansserif.italic.japanese-x0208=Kochi Gothic
-sansserif.italic.korean=Baekmuk Dotum
-
-sansserif.bolditalic.latin-1=DejaVu Sans Bold Oblique
-sansserif.bolditalic.japanese-x0208=Kochi Gothic
-sansserif.bolditalic.korean=Baekmuk Dotum
+# Indic scripts
+allfonts.bengali=Lohit Bengali
+allfonts.gujarati=Lohit Gujarati
+allfonts.hindi=Lohit Hindi
+#allfonts.malayalam=Lohit Malayalam
+allfonts.oriya=Lohit Oriya
+allfonts.punjabi=Lohit Punjabi
+allfonts.tamil=Lohit Tamil
+allfonts.telugu=Lohit Telugu
+allfonts.sinhala=LKLUG
serif.plain.latin-1=DejaVu Serif
-serif.plain.japanese-x0208=Kochi Mincho
-serif.plain.korean=Baekmuk Batang
+#serif.plain.latin-1.motif=LuxiSerif-Regular
+serif.plain.japanese-kochi=Kochi Mincho
+serif.plain.japanese-sazanami=Sazanami Mincho
+serif.plain.japanese-vlgothic=Sazanami Mincho
+serif.plain.korean-baekmuk=Baekmuk Batang
+#serif.plain.korean-baekmuk.motif=Baekmuk Batang
+serif.plain.korean-un=UnBatang
+#serif.plain.korean-un.motif=UnBatang
serif.bold.latin-1=DejaVu Serif Bold
-serif.bold.japanese-x0208=Kochi Mincho
-serif.bold.korean=Baekmuk Batang
+#serif.bold.latin-1.motif=LuxiSerif-Bold
+serif.bold.japanese-kochi=Kochi Mincho
+serif.bold.japanese-sazanami=Sazanami Mincho
+serif.bold.japanese-vlgothic=Sazanami Mincho
+serif.bold.korean-baekmuk=Baekmuk Batang
+#serif.bold.korean-baekmuk.motif=Baekmuk Batang
+serif.bold.korean-un=UnBatang Bold
+#serif.bold.korean-un.motif=UnBatang Bold
serif.italic.latin-1=DejaVu Serif Oblique
-serif.italic.japanese-x0208=Kochi Mincho
-serif.italic.korean=Baekmuk Batang
+#serif.italic.latin-1.motif=LuxiSerif-Oblique
+serif.italic.japanese-kochi=Kochi Mincho
+serif.italic.japanese-sazanami=Sazanami Mincho
+serif.italic.japanese-vlgothic=Sazanami Mincho
+serif.italic.korean-baekmuk=Baekmuk Batang
+#serif.italic.korean-baekmuk.motif=Baekmuk Batang
+serif.italic.korean-un=UnBatang
+#serif.italic.korean-un.motif=UnBatang
serif.bolditalic.latin-1=DejaVu Serif Bold Oblique
-serif.bolditalic.japanese-x0208=Kochi Mincho
-serif.bolditalic.korean=Baekmuk Batang
+#serif.bolditalic.latin-1.motif=LuxiSerif-BoldOblique
+serif.bolditalic.japanese-kochi=Kochi Mincho
+serif.bolditalic.japanese-sazanami=Sazanami Mincho
+serif.bolditalic.japanese-vlgothic=Sazanami Mincho
+serif.bolditalic.korean-baekmuk=Baekmuk Batang
+#serif.bolditalic.korean-baekmuk.motif=Baekmuk Batang
+serif.bolditalic.korean-un=UnBatang Bold
+#serif.bolditalic.korean-un.motif=UnBatang Bold
+sansserif.plain.latin-1=DejaVu Sans
+#sansserif.plain.latin-1.motif=LuxiSans-Regular
+sansserif.plain.japanese-kochi=Kochi Gothic
+sansserif.plain.japanese-sazanami=Sazanami Gothic
+sansserif.plain.japanese-vlgothic=VL PGothic
+sansserif.plain.korean-baekmuk=Baekmuk Gulim
+#sansserif.plain.korean-baekmuk.motif=Baekmuk Gulim
+sansserif.plain.korean-un=UnDotum
+#sansserif.plain.korean-un.motif=UnDotum
+
+sansserif.bold.latin-1=DejaVu Sans Bold
+#sansserif.bold.latin-1.motif=LuxiSans-Bold
+sansserif.bold.japanese-kochi=Kochi Gothic
+sansserif.bold.japanese-sazanami=Sazanami Gothic
+sansserif.bold.japanese-vlgothic=VL PGothic
+sansserif.bold.korean-baekmuk=Baekmuk Gulim
+#sansserif.bold.korean-baekmuk.motif=Baekmuk Gulim
+sansserif.bold.korean-un=UnDotum Bold
+#sansserif.bold.korean-un.motif=UnDotum Bold
+
+sansserif.italic.latin-1=DejaVu Sans Oblique
+#sansserif.italic.latin-1.motif=LuxiSans-Oblique
+sansserif.italic.japanese-kochi=Kochi Gothic
+sansserif.italic.japanese-sazanami=Sazanami Gothic
+sansserif.italic.japanese-vlgothic=VL PGothic
+sansserif.italic.korean-baekmuk=Baekmuk Gulim
+#sansserif.italic.korean-baekmuk.motif=Baekmuk Gulim
+sansserif.italic.korean-un=UnDotum
+#sansserif.italic.korean-un.motif=UnDotum
+
+sansserif.bolditalic.latin-1=DejaVu Sans Bold Oblique
+#sansserif.bolditalic.latin-1.motif=LuxiSans-BoldOblique
+sansserif.bolditalic.japanese-kochi=Kochi Gothic
+sansserif.bolditalic.japanese-sazanami=Sazanami Gothic
+sansserif.bolditalic.japanese-vlgothic=VL PGothic
+sansserif.bolditalic.korean-baekmuk=Baekmuk Gulim
+#sansserif.bolditalic.korean-baekmuk.motif=Baekmuk Gulim
+sansserif.bolditalic.korean-un=UnDotum Bold
+#sansserif.bolditalic.korean-un.motif=UnDotum Bold
monospaced.plain.latin-1=DejaVu Sans Mono
-monospaced.plain.japanese-x0208=Kochi Gothic
-monospaced.plain.korean=Baekmuk Dotum
+#monospaced.plain.latin-1.motif=LuxiMono-Regular
+monospaced.plain.japanese-kochi=Kochi Gothic
+monospaced.plain.japanese-sazanami=Sazanami Gothic
+monospaced.plain.japanese-vlgothic=VL Gothic
+monospaced.plain.korean-baekmuk=Baekmuk Gulim
+#monospaced.plain.korean-baekmuk.motif=Baekmuk Gulim
+monospaced.plain.korean-un=UnDotum
+#monospaced.plain.korean-un.motif=UnDotum
monospaced.bold.latin-1=DejaVu Sans Mono Bold
-monospaced.bold.japanese-x0208=Kochi Gothic
-monospaced.bold.korean=Baekmuk Dotum
+#monospaced.bold.latin-1.motif=LuxiMono-Bold
+monospaced.bold.japanese-kochi=Kochi Gothic
+monospaced.bold.japanese-sazanami=Sazanami Gothic
+monospaced.bold.japanese-vlgothic=VL Gothic
+monospaced.bold.korean-baekmuk=Baekmuk Gulim
+#monospaced.bold.korean-baekmuk.motif=Baekmuk Gulim
+monospaced.bold.korean-un=UnDotum Bold
+#monospaced.bold.korean-un.motif=UnDotum Bold
monospaced.italic.latin-1=DejaVu Sans Mono Oblique
-monospaced.italic.japanese-x0208=Kochi Gothic
-monospaced.italic.korean=Baekmuk Dotum
+#monospaced.italic.latin-1.motif=LuxiMono-Oblique
+monospaced.italic.japanese-kochi=Kochi Gothic
+monospaced.italic.japanese-sazanami=Sazanami Gothic
+monospaced.italic.japanese-vlgothic=VL Gothic
+monospaced.italic.korean-baekmuk=Baekmuk Gulim
+#monospaced.italic.korean-baekmuk.motif=Baekmuk Gulim
+monospaced.italic.korean-un=UnDotum
+#monospaced.italic.korean-un.motif=UnDotum
monospaced.bolditalic.latin-1=DejaVu Sans Mono Bold Oblique
-monospaced.bolditalic.japanese-x0208=Kochi Gothic
-monospaced.bolditalic.korean=Baekmuk Dotum
+#monospaced.bolditalic.latin-1.motif=LuxiMono-BoldOblique
+monospaced.bolditalic.japanese-kochi=Kochi Gothic
+monospaced.bolditalic.japanese-sazanami=Sazanami Gothic
+monospaced.bolditalic.japanese-vlgothic=VL Gothic
+monospaced.bolditalic.korean-baekmuk=Baekmuk Gulim
+#monospaced.bolditalic.korean-baekmuk.motif=Baekmuk Gulim
+monospaced.bolditalic.korean-un=UnDotum Bold
+#monospaced.bolditalic.korean-un.motif=UnDotum Bold
+dialog.plain.latin-1=DejaVu Sans
+#dialog.plain.latin-1.motif=LuxiSans-Regular
+dialog.plain.japanese-kochi=Kochi Gothic
+dialog.plain.japanese-sazanami=Sazanami Gothic
+dialog.plain.japanese-vlgothic=VL PGothic
+dialog.plain.korean-baekmuk=Baekmuk Gulim
+#dialog.plain.korean-baekmuk.motif=Baekmuk Gulim
+dialog.plain.korean-un=UnDotum
+#dialog.plain.korean-un.motif=UnDotum
+
+dialog.bold.latin-1=DejaVu Sans Bold
+#dialog.bold.latin-1.motif=LuxiSans-Bold
+dialog.bold.japanese-kochi=Kochi Gothic
+dialog.bold.japanese-sazanami=Sazanami Gothic
+dialog.bold.japanese-vlgothic=VL PGothic
+dialog.bold.korean-baekmuk=Baekmuk Gulim
+#dialog.bold.korean-baekmuk.motif=Baekmuk Gulim
+dialog.bold.korean-un=UnDotum Bold
+#dialog.bold.korean-un.motif=UnDotum Bold
+
+dialog.italic.latin-1=DejaVu Sans Oblique
+#dialog.italic.latin-1.motif=LuxiSans-Oblique
+dialog.italic.japanese-kochi=Kochi Gothic
+dialog.italic.japanese-sazanami=Sazanami Gothic
+dialog.italic.japanese-vlgothic=VL PGothic
+dialog.italic.korean-baekmuk=Baekmuk Gulim
+#dialog.italic.korean-baekmuk.motif=Baekmuk Gulim
+dialog.italic.korean-un=UnDotum
+#dialog.italic.korean-un.motif=UnDotum
+
+dialog.bolditalic.latin-1=DejaVu Sans Bold Oblique
+#dialog.bolditalic.latin-1.motif=LuxiSans-BoldOblique
+dialog.bolditalic.japanese-kochi=Kochi Gothic
+dialog.bolditalic.japanese-sazanami=Sazanami Gothic
+dialog.bolditalic.japanese-vlgothic=VL PGothic
+dialog.bolditalic.korean-baekmuk=Baekmuk Gulim
+#dialog.bolditalic.korean-baekmuk.motif=Baekmuk Gulim
+dialog.bolditalic.korean-un=UnDotum Bold
+#dialog.bolditalic.korean-un.motif=UnDotum Bold
dialoginput.plain.latin-1=DejaVu Sans Mono
-dialoginput.plain.japanese-x0208=Kochi Gothic
-dialoginput.plain.korean=Baekmuk Dotum
+#dialoginput.plain.latin-1.motif=LuxiMono-Regular
+dialoginput.plain.japanese-kochi=Kochi Gothic
+dialoginput.plain.japanese-sazanami=Sazanami Gothic
+dialoginput.plain.japanese-vlgothic=VL Gothic
+dialoginput.plain.korean-baekmuk=Baekmuk Gulim
+#dialoginput.plain.korean-baekmuk.motif=Baekmuk Gulim
+dialoginput.plain.korean-un=UnDotum
+#dialoginput.plain.korean-un.motif=UnDotum
dialoginput.bold.latin-1=DejaVu Sans Mono Bold
-dialoginput.bold.japanese-x0208=Kochi Gothic
-dialoginput.bold.korean=Baekmuk Dotum
+#dialoginput.bold.latin-1.motif=LuxiMono-Bold
+dialoginput.bold.japanese-kochi=Kochi Gothic
+dialoginput.bold.japanese-sazanami=Sazanami Gothic
+dialoginput.bold.japanese-vlgothic=VL Gothic
+dialoginput.bold.korean-baekmuk=Baekmuk Gulim
+#dialoginput.bold.korean-baekmuk.motif=Baekmuk Gulim
+dialoginput.bold.korean-un=UnDotum Bold
+#dialoginput.bold.korean-un.motif=UnDotum Bold
dialoginput.italic.latin-1=DejaVu Sans Mono Oblique
-dialoginput.italic.japanese-x0208=Kochi Gothic
-dialoginput.italic.korean=Baekmuk Dotum
+#dialoginput.italic.latin-1.motif=LuxiMono-Oblique
+dialoginput.italic.japanese-kochi=Kochi Gothic
+dialoginput.italic.japanese-sazanami=Sazanami Gothic
+dialoginput.italic.japanese-vlgothic=VL Gothic
+dialoginput.italic.korean-baekmuk=Baekmuk Gulim
+#dialoginput.italic.korean-baekmuk.motif=Baekmuk Gulim
+dialoginput.italic.korean-un=UnDotum
+#dialoginput.italic.korean-un.motif=UnDotum
dialoginput.bolditalic.latin-1=DejaVu Sans Mono Bold Oblique
-dialoginput.bolditalic.japanese-x0208=Kochi Gothic
-dialoginput.bolditalic.korean=Baekmuk Dotum
-
-allfonts.chinese-big5=AR PL ZenKai Uni
-allfonts.chinese-gb18030=AR PL ZenKai Uni
+#dialoginput.bolditalic.latin-1.motif=LuxiMono-BoldOblique
+dialoginput.bolditalic.japanese-kochi=Kochi Gothic
+dialoginput.bolditalic.japanese-sazanami=Sazanami Gothic
+dialoginput.bolditalic.japanese-vlgothic=VL Gothic
+dialoginput.bolditalic.korean-baekmuk=Baekmuk Gulim
+#dialoginput.bolditalic.korean-baekmuk.motif=Baekmuk Gulim
+dialoginput.bolditalic.korean-un=UnDotum Bold
+#dialoginput.bolditalic.korean-un.motif=UnDotum Bold
# Search Sequences
sequence.allfonts=latin-1
-sequence.allfonts.Big5=chinese-big5,latin-1
-sequence.allfonts.x-euc-jp-linux=japanese-x0208,latin-1
-sequence.allfonts.EUC-KR=korean,latin-1
-sequence.allfonts.GB18030=chinese-gb18030,latin-1
-sequence.fallback=chinese-big5,chinese-gb18030,japanese-x0208,korean
+sequence.allfonts.GB18030=latin-1,umingcn,shanheisun,wqy-zenhei
+sequence.allfonts.GB2312=latin-1,umingcn,shanheisun,wqy-zenhei
+sequence.allfonts.GBK=latin-1,umingcn,shanheisun,wqy-zenhei
+sequence.allfonts.x-euc-jp-linux=latin-1,japanese-vlgothic,japanese-sazanami,japanese-kochi
+sequence.allfonts.EUC-KR=latin-1,korean-un,korean-baekmuk
+sequence.allfonts.Big5=latin-1,umingtw,shanheisun,wqy-zenhei
+sequence.allfonts.Big5-HKSCS=latin-1,uminghk,shanheisun,wqy-zenhei
+#sequence.fallback=uminghk,shanheisun,wqy-zenhei,japanese-vlgothic,japanese-kochi,japanese-sazanami,korean-un,korean-baekmuk,bengali,gujarati,hindi,oriya,punjabi,malayalam,tamil,telugu,sinhala
+sequence.fallback=uminghk,shanheisun,wqy-zenhei,japanese-vlgothic,japanese-sazanami,japanese-kochi,korean-un,korean-baekmuk,bengali,gujarati,hindi,oriya,punjabi,tamil,telugu
+
+# Exclusion Ranges
+
+exclusion.japanese-kochi=0390-03d6,2200-22ef,2701-27be
+exclusion.japanese-sazanami=0390-03d6,2200-22ef,2701-27be
+exclusion.japanese-vlgothic=0390-03d6,2200-22ef,2701-27be
# Font File Names
@@ -144,8 +291,58 @@ filename.DejaVu_Serif_Bold=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold
filename.DejaVu_Serif_Oblique=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Oblique.ttf
filename.DejaVu_Serif_Bold_Oblique=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldOblique.ttf
-filename.Kochi_Gothic=/usr/share/fonts/truetype/kochi/kochi-gothic-subst.ttf
-filename.Kochi_Mincho=/usr/share/fonts/truetype/kochi/kochi-mincho-subst.ttf
-filename.AR_PL_ZenKai_Uni=/usr/share/fonts//truetype/arphic/ukai.ttf
-filename.Baekmuk_Dotum=/usr/share/fonts/truetype/baekmuk/dotum.ttf
+filename.AR_PL_UMing_CN=/usr/share/fonts/truetype/arphic/uming.ttc
+filename.AR_PL_UMing_HK=/usr/share/fonts/truetype/arphic/uming.ttc
+filename.AR_PL_UMing_TW=/usr/share/fonts/truetype/arphic/uming.ttc
+filename.AR_PL_ShanHeiSun_Uni=/usr/share/fonts/truetype/arphic/uming.ttf
+
+filename.WenQuanYi_Zen_Hei=/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf
filename.Baekmuk_Batang=/usr/share/fonts/truetype/baekmuk/batang.ttf
+filename.UnBatang=/usr/share/fonts/truetype/unfonts/UnBatang.ttf
+filename.UnBatang_Bold=/usr/share/fonts/truetype/unfonts/UnBatangBold.ttf
+filename.Baekmuk_Gulim=/usr/share/fonts/truetype/baekmuk/gulim.ttf
+filename.UnDotum=/usr/share/fonts/truetype/unfonts/UnDotum.ttf
+filename.UnDotum_Bold=/usr/share/fonts/truetype/unfonts/UnDotumBold.ttf
+filename.Kochi_Gothic=/usr/share/fonts/truetype/kochi/kochi-gothic.ttf
+filename.Sazanami_Gothic=/usr/share/fonts/truetype/sazanami/sazanami-gothic.ttf
+filename.Kochi_Mincho=/usr/share/fonts/truetype/kochi/kochi-mincho.ttf
+filename.Sazanami_Mincho=/usr/share/fonts/truetype/sazanami/sazanami-mincho.ttf
+filename.VL_Gothic=/usr/share/fonts/truetype/vlgothic/VL-Gothic-Regular.ttf
+filename.VL_PGothic=/usr/share/fonts/truetype/vlgothic/VL-PGothic-Regular.ttf
+
+filename.Lohit_Bengali=/usr/share/fonts/truetype/ttf-bengali-fonts/lohit_bn.ttf
+filename.Lohit_Gujarati=/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_gu.ttf
+filename.Lohit_Hindi=/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf
+filename.Lohit_Kannda=/usr/share/fonts/truetype/ttf-kannada-fonts/lohit_kn.ttf
+#filename.Lohit_Malayalam=/usr/share/fonts/lohit-malayalam/lohit_ml.ttf
+filename.Lohit_Oriya=/usr/share/fonts/truetype/ttf-oriya-fonts/lohit_or.ttf
+filename.Lohit_Punjabi=/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf
+filename.Lohit_Tamil=/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf
+filename.Lohit_Telugu=/usr/share/fonts/truetype/ttf-telugu-fonts/lohit_te.ttf
+filename.LKLUG=/usr/share/fonts/truetype/ttf-sinhala-lklug/lklug.ttf
+
+filename.LuxiSans-Regular=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxisr.ttf
+filename.LuxiSans-Bold=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxisb.ttf
+filename.LuxiSans-Oblique=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxisri.ttf
+filename.LuxiSans-BoldOblique=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxisbi.ttf
+filename.LuxiMono-Regular=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luximr.ttf
+filename.LuxiMono-Bold=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luximb.ttf
+filename.LuxiMono-Oblique=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luximri.ttf
+filename.LuxiMono-BoldOblique=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luximbi.ttf
+filename.LuxiSerif-Regular=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxirr.ttf
+filename.LuxiSerif-Bold=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxirb.ttf
+filename.LuxiSerif-Oblique=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxirri.ttf
+filename.LuxiSerif-BoldOblique=/usr/share/fonts/truetype/ttf-xfree86-nonfree/luxirbi.ttf
+
+# AWT X11 font paths
+awtfontpath.latin-1=/usr/share/fonts/X11/Type1
+awtfontpath.umingcn=/usr/share/fonts/truetype/arphic
+awtfontpath.uminghk=/usr/share/fonts/truetype/arphic
+awtfontpath.umingtw=/usr/share/fonts/truetype/arphic
+awtfontpath.shanheisun=/usr/share/fonts/truetype/arphic
+awtfontpath.wqy-zenhei=/usr/share/fonts/truetype/wqy
+awtfontpath.japanese-kochi=/usr/share/fonts/truetype/kochi
+awtfontpath.japanese-sazanami=/usr/share/fonts/truetype/sazanami
+awtfontpath.japanese-vlgothic=/usr/share/fonts/truetype/vlgothic
+awtfontpath.korean-baekmuk=/usr/share/fonts/truetype/baekmuk
+awtfontpath.korean-un=/usr/share/fonts/truetype/unfonts
From 79132950401e57e86593f440446030af23a53c80 Mon Sep 17 00:00:00 2001
From: Kelly O'Hair
Date: Fri, 12 Mar 2010 09:03:02 -0800
Subject: [PATCH 039/190] 6933294: Fix some test/Makefile issues around Linux
ARCH settings, better defaults
Reviewed-by: jjg
---
jdk/test/Makefile | 89 ++++++++++++++++++++++++++++------------
jdk/test/ProblemList.txt | 12 ++++++
2 files changed, 75 insertions(+), 26 deletions(-)
diff --git a/jdk/test/Makefile b/jdk/test/Makefile
index bb5a34fde0a..20bd55408d0 100644
--- a/jdk/test/Makefile
+++ b/jdk/test/Makefile
@@ -70,6 +70,10 @@ endif
ifeq ($(UNAME_S), Linux)
OS_NAME = linux
OS_ARCH := $(shell $(UNAME) -m)
+ # Check for unknown arch, try uname -p if uname -m says unknown
+ ifeq ($(OS_ARCH),unknown)
+ OS_ARCH := $(shell $(UNAME) -p)
+ endif
OS_VERSION := $(shell $(UNAME) -r)
endif
ifndef OS_NAME
@@ -93,16 +97,26 @@ endif
# Only want major and minor numbers from os version
OS_VERSION := $(shell $(ECHO) "$(OS_VERSION)" | $(CUT) -d'.' -f1,2)
-# Try and use names i586, x64, and ia64 consistently
-OS_ARCH:=$(subst X64,x64,$(OS_ARCH))
-OS_ARCH:=$(subst AMD64,x64,$(OS_ARCH))
-OS_ARCH:=$(subst amd64,x64,$(OS_ARCH))
-OS_ARCH:=$(subst x86_64,x64,$(OS_ARCH))
-OS_ARCH:=$(subst EM64T,x64,$(OS_ARCH))
-OS_ARCH:=$(subst em64t,x64,$(OS_ARCH))
-OS_ARCH:=$(subst intel64,x64,$(OS_ARCH))
-OS_ARCH:=$(subst Intel64,x64,$(OS_ARCH))
-OS_ARCH:=$(subst INTEL64,x64,$(OS_ARCH))
+# Name to use for x86_64 arch (historically amd64, but should change someday)
+OS_ARCH_X64_NAME:=amd64
+#OS_ARCH_X64_NAME:=x64
+
+# Alternate arch names (in case this arch is known by a second name)
+# PROBLEM_LISTS may use either name.
+OS_ARCH2-amd64:=x64
+#OS_ARCH2-x64:=amd64
+
+# Try and use the arch names consistently
+OS_ARCH:=$(subst x64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst X64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst AMD64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst amd64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst x86_64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst EM64T,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst em64t,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst Intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
+OS_ARCH:=$(subst INTEL64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(subst IA64,ia64,$(OS_ARCH))
OS_ARCH:=$(subst X86,i586,$(OS_ARCH))
OS_ARCH:=$(subst x86,i586,$(OS_ARCH))
@@ -110,17 +124,32 @@ OS_ARCH:=$(subst i386,i586,$(OS_ARCH))
OS_ARCH:=$(subst i486,i586,$(OS_ARCH))
OS_ARCH:=$(subst i686,i586,$(OS_ARCH))
-# Check for ARCH_DATA_MODEL, adjust OS_ARCH accordingly
+# Default ARCH_DATA_MODEL settings
+ARCH_DATA_MODEL-i586 = 32
+ARCH_DATA_MODEL-$(OS_ARCH_X64_NAME) = 64
+ARCH_DATA_MODEL-ia64 = 64
+ARCH_DATA_MODEL-sparc = 32
+ARCH_DATA_MODEL-sparcv9 = 64
+
+# If ARCH_DATA_MODEL is not defined, try and pick a reasonable default
+ifndef ARCH_DATA_MODEL
+ ARCH_DATA_MODEL:=$(ARCH_DATA_MODEL-$(OS_ARCH))
+endif
ifndef ARCH_DATA_MODEL
ARCH_DATA_MODEL=32
endif
+
+# Platform directory name
+PLATFORM_OS = $(OS_NAME)-$(OS_ARCH)
+
+# Check ARCH_DATA_MODEL, adjust OS_ARCH accordingly on solaris
ARCH_DATA_MODEL_ERROR= \
- ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) cannot be used with $(OS_NAME)-$(ARCH)
+ ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) cannot be used with $(PLATFORM_OS)
ifeq ($(ARCH_DATA_MODEL),64)
- ifeq ($(OS_NAME)-$(OS_ARCH),solaris-i586)
- OS_ARCH=x64
+ ifeq ($(PLATFORM_OS),solaris-i586)
+ OS_ARCH=$(OS_ARCH_X64_NAME)
endif
- ifeq ($(OS_NAME)-$(OS_ARCH),solaris-sparc)
+ ifeq ($(PLATFORM_OS),solaris-sparc)
OS_ARCH=sparcv9
endif
ifeq ($(OS_ARCH),i586)
@@ -131,7 +160,7 @@ ifeq ($(ARCH_DATA_MODEL),64)
endif
else
ifeq ($(ARCH_DATA_MODEL),32)
- ifeq ($(OS_ARCH),x64)
+ ifeq ($(OS_ARCH),$(OS_ARCH_X64_NAME))
x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
endif
ifeq ($(OS_ARCH),ia64)
@@ -145,6 +174,12 @@ else
endif
endif
+# Alternate OS_ARCH name (defaults to OS_ARCH)
+OS_ARCH2:=$(OS_ARCH2-$(OS_ARCH))
+ifeq ($(OS_ARCH2),)
+ OS_ARCH2:=$(OS_ARCH)
+endif
+
# Root of this test area (important to use full paths in some places)
TEST_ROOT := $(shell $(PWD))
@@ -152,21 +187,21 @@ TEST_ROOT := $(shell $(PWD))
ifdef ALT_OUTPUTDIR
ABS_OUTPUTDIR = $(ALT_OUTPUTDIR)
else
- ABS_OUTPUTDIR = $(TEST_ROOT)/../build/$(OS_NAME)-$(OS_ARCH)
+ ABS_OUTPUTDIR = $(TEST_ROOT)/../build/$(PLATFORM_OS)
endif
-ABS_BUILD_ROOT = $(ABS_OUTPUTDIR)
-ABS_TEST_OUTPUT_DIR := $(ABS_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
+ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
+ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
ifndef PRODUCT_HOME
# Try to use j2sdk-image if it exists
- ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image
- PRODUCT_HOME := \
- $(shell \
- if [ -d $(ABS_JDK_IMAGE) ] ; then \
- $(ECHO) "$(ABS_JDK_IMAGE)"; \
- else \
- $(ECHO) "$(ABS_BUILD_ROOT)"; \
+ ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/j2sdk-image
+ PRODUCT_HOME := \
+ $(shell \
+ if [ -d $(ABS_JDK_IMAGE) ] ; then \
+ $(ECHO) "$(ABS_JDK_IMAGE)"; \
+ else \
+ $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)"; \
fi)
PRODUCT_HOME := $(PRODUCT_HOME)
endif
@@ -325,8 +360,10 @@ $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
@$(RM) $@ $@.temp1 $@.temp2
@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' ) ;\
+ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)' ) ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)' ) ;\
+ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH2)' ) ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all' ) ;\
($(ECHO) "#") ;\
) | $(SED) -e 's@^[\ ]*@@' \
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index e294b9c29e8..21367171f76 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -744,6 +744,9 @@ java/net/ProxySelector/B6737819.java generic-all
# Suspect many of these tests auffer from using fixed ports, no concrete
# evidence.
+# Failing on Solaris x86 and Linux x86, filed 6934585
+java/nio/channels/AsynchronousSocketChannel/Basic.java generic-all
+
# Occasionally Failing with java.lang.AssertionError on Windows X64
# at sun.nio.ch.PendingIoCache.clearPendingIoMap(PendingIoCache.java:144)
#java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all
@@ -947,6 +950,15 @@ java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java generic-all
# jdk_security
+# Failing on Solaris i586, 3/9/2010, not a -samevm issue (jdk_security3)
+sun/security/pkcs11/Secmod/AddPrivateKey.java solaris-i586
+sun/security/pkcs11/ec/ReadCertificates.java solaris-i586
+sun/security/pkcs11/ec/ReadPKCS12.java solaris-i586
+sun/security/pkcs11/ec/TestCurves.java solaris-i586
+sun/security/pkcs11/ec/TestECDSA.java solaris-i586
+sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586
+sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586
+
# Unknown problem, could be a jtreg -samevm issue?
# Error while cleaning up threads after test
java/security/Security/SynchronizedAccess.java generic-all
From a49bd21f3d0a0f63a4c73f7c0b3bbdf2391ac913 Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons
Date: Fri, 12 Mar 2010 12:00:42 -0800
Subject: [PATCH 040/190] 6934224: update langtools/test/Makefile
Reviewed-by: ohair
---
langtools/make/jprt.properties | 1 -
langtools/test/Makefile | 333 +++++++++++++++++++++++++++++----
2 files changed, 297 insertions(+), 37 deletions(-)
diff --git a/langtools/make/jprt.properties b/langtools/make/jprt.properties
index f75871dec9b..c232655990a 100644
--- a/langtools/make/jprt.properties
+++ b/langtools/make/jprt.properties
@@ -50,6 +50,5 @@ jprt.solaris_x64_5.10.build.platform.match32=solaris_i586_5.10
jprt.test.targets=
# Directories needed to build
-jprt.bundle.src.dirs=make src
jprt.bundle.exclude.src.dirs=build dist
diff --git a/langtools/test/Makefile b/langtools/test/Makefile
index 427694966fb..59ed5fc1be2 100644
--- a/langtools/test/Makefile
+++ b/langtools/test/Makefile
@@ -1,7 +1,21 @@
#
-# Makefile to run jtreg and any other tests
+# Makefile to run jtreg and other tests
#
+# Product builds and langtools builds
+#
+# A full product build (or "control" build) creates a complete JDK image.
+# To test a product build, set TESTJAVA to the path for the image.
+#
+# A langtools build just builds the langtools components of a JDK.
+# To test a langtools build, set TESTJAVA to the path for a recent JDK
+# build, and set TESTBOOTCLASSPATH to the compiled langtools classes --
+# for example build/classes or dist/lib/classes.jar.
+
+# JPRT
+# JPRT may invoke this Makefile directly, as part of a langtools build,
+# or indirectly, via FOREST/test/Makefile, as part of a control build.
+
# Get OS/ARCH specifics
OSNAME = $(shell uname -s)
ifeq ($(OSNAME), SunOS)
@@ -41,8 +55,11 @@ endif
# Root of this test area (important to use full paths in some places)
TEST_ROOT := $(shell pwd)
-# Default bundle of all test results (passed or not)
-JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
+# Default bundle of all test results (passed or not) (JPRT only)
+ifdef JPRT_JOB_ID
+ JPRT_CLEAN = clean
+ JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
+endif
ifeq ($(PLATFORM), windows)
SLASH_JAVA = J:
@@ -57,8 +74,21 @@ else
JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
endif
JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
+JTDIFF = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtdiff
-# Default JDK for JTREG
+# Default JCK to run
+ifdef JPRT_JCK_HOME
+ JCK_HOME = $(JPRT_JCK_HOME)
+else
+ JCK_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
+endif
+
+# Default JDK for JTREG and JCK
+#
+# JT_JAVA is the version of java used to run jtreg/JCK. Since it is now
+# standard to execute tests in sameVM mode, it should normally be set the
+# same as TESTJAVA (although not necessarily so.)
+#
ifdef JPRT_JAVA_HOME
JT_JAVA = $(JPRT_JAVA_HOME)
else
@@ -72,49 +102,275 @@ else
TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
endif
-TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
+# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from
+# make/Makefile
+# For langtools, this is a directory containing build and dist
+# For a control build, this is build/$(PRODUCT)-$(ARCH)/j2sdk-image
+ifdef PRODUCT_HOME
+ ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0)
+ TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
+ endif
+ ifeq ($(shell [ -r $(PRODUCT_HOME)/lib/tools.jar ]; echo $$?),0)
+ TESTJAVA = $(PRODUCT_HOME)
+ endif
+endif
+
+ifdef TESTBOOTCLASSPATH
+ JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH)
+### In the following, -refvmoptions is an undocumented option
+### The following does not work JCK 7 b30 2/6/2010. Awaiting b31.
+ JCK_OPTIONS += \
+ -vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
+ -refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH)
+endif
+
+# Concurrency is the number of tests that can execute at once.
+# Supported for JCK, not supported for jtreg.
+# On an otherwise empty machine, suggest setting to (#cpus + 2)
+# If unset, the default is (#cpus)
+### RFE: determine and use #cpus
+ifdef JCK_CONCURRENCY
+ JCK_OPTIONS += -concurrency:$(JCK_CONCURRENCY)
+endif
+
+# JCK is executed using "Multi-JVM Group Mode", which is a hybrid
+# of otherVM and sameVM modes. New JVMs are created and reused for
+# a number of tests, then eventually discarded and a new one started.
+# This amortizes the JVM startup time. The "group size" defines
+# how many tests are run in a JVM before it is replaced.
+# If unset, the default is 100.
+JCK_GROUP_SIZE = 1000
+ifdef JCK_GROUP_SIZE
+ JCK_COMPILER_OPTIONS += \
+ -jtoptions:-Ejck.env.compiler.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) \
+ -jtoptions:-Ejck.env.compiler.compRefExecute.groupMode.groupSize=$(JCK_GROUP_SIZE)
+### The following is not supported. Awaiting RFE 6924287
+### 6924287: Jck4Jdk: Allow to configure test group size for group mode via simple command line option
+### JCK_RUNTIME_OPTIONS += \
+### -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE)
+endif
+
+# Assertions: some tests show failures when assertions are enabled.
+# Since javac is typically loaded via the bootclassloader (either via TESTJAVA
+# or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac.
+JTREG_OPTIONS += $(ASSERTION_OPTIONS)
+JCK_OPTIONS += $(ASSERTION_OPTIONS:%=-vmoptions:%)
+
+# Include shared options
+JCK_COMPILER_OPTIONS += $(JCK_OPTIONS)
+JCK_RUNTIME_OPTIONS += $(JCK_OPTIONS)
+
+# Exit codes:
+# jtreg, jck: 0: OK, 1: tests failed, 2: tests error; 3+: SERIOUS
+FATAL_JTREG_EXIT = 3
+FATAL_JCK_EXIT = 3
+# jtdiff: 0: OK, 1: differences found; 2+: SERIOUS
+FATAL_JTDIFF_EXIT = 2
+#
+# Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid
+# having make exit with non-zero return code.
+EXIT = exit
+# Function to exit shell if exit code of preceding command is greater than or equal
+# to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed.
+EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi
# The test directories to run
DEFAULT_TESTDIRS = .
TESTDIRS = $(DEFAULT_TESTDIRS)
# Root of all test results
-TEST_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH)
+TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools
+ABS_TEST_OUTPUT_DIR := \
+ $(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
+ cd $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \
+ pwd )
+# Subdirectories for different test runs
+JTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg
+JCK_COMPILER_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-compiler
+JCK_RUNTIME_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jck-runtime-Xcompile
-# Default make rule
-all apt javac javadoc javah javap: clean check jtreg-tests $(JPRT_ARCHIVE_BUNDLE)
+# Default make rule -- warning, may take a while
+all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary
+ @echo "Testing completed successfully"
+
+jtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
+ @echo "Testing completed successfully"
+
+jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary
+ @echo "Testing completed successfully"
+
+jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary
@echo "Testing completed successfully"
# for use with JPRT -testrule
-all: TESTDIRS = .
-apt: TESTDIRS = tools/apt
-javac: TESTDIRS = tools/javac
-javadoc: TESTDIRS = tools/javadoc com/sun/javadoc
-javah: TESTDIRS = tools/javah
-javap: TESTDIRS = tools/javap
+all: JTREG_TESTDIRS = .
+jtreg: JTREG_TESTDIRS = .
+apt: JTREG_TESTDIRS = tools/apt
+javac: JTREG_TESTDIRS = tools/javac
+javadoc: JTREG_TESTDIRS = tools/javadoc com/sun/javadoc
+javah: JTREG_TESTDIRS = tools/javah
+javap: JTREG_TESTDIRS = tools/javap
+
+# Run jtreg tests
+#
+# JTREG_HOME
+# Installed location of jtreg
+# JT_JAVA
+# Version of java used to run jtreg. Should normally be the same as TESTJAVA
+# TESTJAVA
+# Version of java to be tested.
+# JTREG_OPTIONS
+# Additional options for jtreg
+# JTREG_TESTDIRS
+# Directories of tests to be run
+# JTREG_OUTPUT_DIR
+# Where to write the results
+# JTREG_REFERENCE
+# (Optional) reference results (e.g. work, report or summary.txt)
+#
+jtreg-tests: check-jtreg FRC
+ @rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \
+ $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt
+ @mkdir -p $(JTREG_OUTPUT_DIR)
+ JT_JAVA=$(JT_JAVA) $(JTREG) \
+ -J-Xmx512m \
+ -a -samevm -ignore:quiet -v:fail,error,nopass \
+ -r:$(JTREG_OUTPUT_DIR)/JTreport \
+ -w:$(JTREG_OUTPUT_DIR)/JTwork \
+ -jdk:$(TESTJAVA) \
+ $(JAVA_ARGS:%=-vmoption:%) \
+ $(JTREG_OPTIONS) \
+ $(JTREG_TESTDIRS) \
+ || ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \
+ echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \
+ )
+ifdef JTREG_REFERENCE
+ JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JTREG_OUTPUT_DIR)/diff.html \
+ $(JTREG_REFERENCE) $(JTREG_OUTPUT_DIR)/JTreport \
+ || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
+endif
+
+jtreg-summary: FRC
+ if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \
+ echo ; echo "Summary of jtreg test failures" ; \
+ cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \
+ grep -v 'Not run' | grep -v 'Passed' ; \
+ echo ; \
+ $(EXIT) `cat $(JTREG_OUTPUT_DIR)/status.txt` ; \
+ fi
# Check to make sure these directories exist
-check: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
+check-jtreg: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
-# Run the tests
-jtreg-tests: FRC
- @echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)"
- @rm -f -r $(TEST_OUTPUT_DIR)/JTwork $(TEST_OUTPUT_DIR)/JTreport
- @mkdir -p $(TEST_OUTPUT_DIR)
- JT_JAVA=$(JT_JAVA) $(JTREG) \
- -a -samevm -k:\!ignore -v:fail,error,nopass \
- -r:$(TEST_OUTPUT_DIR)/JTreport \
- -w:$(TEST_OUTPUT_DIR)/JTwork \
- -jdk:$(TESTJAVA) \
- -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
- $(JAVA_ARGS:%=-vmoption:%) \
- $(TESTDIRS) \
- || ( status=$$? ; \
- echo ; echo "Summary of test failures" ; \
- cat $(TEST_OUTPUT_DIR)/JTreport/text/summary.txt | \
- grep -v 'Not run' | grep -v 'Passed' ; \
- echo ; \
- exit $$status )
+
+# Run JCK-compiler tests
+#
+# JCK_HOME
+# Installed location of JCK: should include JCK-compiler, and JCK-extras
+# JT_JAVA
+# Version of java used to run JCK. Should normally be the same as TESTJAVA
+# TESTJAVA
+# Version of java to be tested.
+# JCK_COMPILER_OPTIONS
+# Additional options for JCK-compiler
+# JCK_COMPILER_TESTDIRS
+# Directories of tests to be run
+# JCK_COMPILER_OUTPUT_DIR
+# Where to write the results
+# JCK_COMPILER_REFERENCE
+# (Optional) reference results (e.g. work, report or summary.txt)
+#
+jck-compiler-tests: check-jck FRC
+ @rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \
+ $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt
+ @mkdir -p $(JCK_COMPILER_OUTPUT_DIR)
+ $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
+ -jar $(JCK_HOME)/JCK-compiler-7/lib/jtjck.jar \
+ -v:non-pass \
+ -r:$(JCK_COMPILER_OUTPUT_DIR)/report \
+ -w:$(JCK_COMPILER_OUTPUT_DIR)/work \
+ -jdk:$(TESTJAVA) \
+ $(JCK_COMPILER_OPTIONS) \
+ $(JCK_COMPILER_TESTDIRS) \
+ || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
+ echo $$status > $(JCK_COMPILER_OUTPUT_DIR)/status.txt \
+ )
+ifdef JCK_COMPILER_REFERENCE
+ JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_COMPILER_OUTPUT_DIR)/diff.html \
+ $(JCK_COMPILER_REFERENCE) $(JCK_COMPILER_OUTPUT_DIR)/report \
+ || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
+endif
+
+jck-compiler-summary: FRC
+ if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \
+ echo ; echo "Summary of JCK-compiler test failures" ; \
+ cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \
+ grep -v 'Not run' | grep -v 'Passed' ; \
+ echo ; \
+ $(EXIT) `cat $(JCK_COMPILER_OUTPUT_DIR)/status.txt` ; \
+ fi
+
+# Run JCK-runtime tests in -Xcompile mode
+# This is a special mode to test javac by compiling the tests in the JCK-runtime test suite
+# Normal JCK-runtime invocation belongs in the jdk/ repository.
+#
+# JCK_HOME
+# Installed location of JCK: should include JCK-compiler, JCK-runtime and JCK-extras
+# JT_JAVA
+# Version of java used to run JCK. Should normally be the same as TESTJAVA
+# TESTJAVA
+# Version of java to be tested.
+# JCK_RUNTIME_OPTIONS
+# Additional options for JCK-runtime
+# JCK_RUNTIME_TESTDIRS
+# Directories of tests to be run
+# JCK_RUNTIME_OUTPUT_DIR
+# Where to write the results
+# JCK_RUNTIME_REFERENCE
+# (Optional) reference results (e.g. work, report or summary.txt)
+#
+jck-runtime-tests: check-jck FRC
+ @rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \
+ $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt
+ @mkdir -p $(JCK_RUNTIME_OUTPUT_DIR)
+ $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
+ -jar $(JCK_HOME)/JCK-runtime-7/lib/jtjck.jar \
+ -v:non-pass \
+ -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \
+ -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \
+ -jdk:$(TESTJAVA) \
+ -Xcompile \
+ $(JCK_RUNTIME_OPTIONS) \
+ $(JCK_RUNTIME_TESTDIRS) \
+ || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
+ echo $$status > $(JCK_RUNTIME_OUTPUT_DIR)/status.txt \
+ )
+ifdef JCK_RUNTIME_REFERENCE
+ JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_RUNTIME_OUTPUT_DIR)/diff.html \
+ $(JCK_RUNTIME_REFERENCE) $(JCK_RUNTIME_OUTPUT_DIR)/report \
+ || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
+endif
+
+jck-runtime-summary: FRC
+ if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \
+ echo ; echo "Summary of JCK-runtime test failures" ; \
+ cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \
+ grep -v 'Not run' | grep -v 'Passed' ; \
+ echo ; \
+ $(EXIT) `cat $(JCK_RUNTIME_OUTPUT_DIR)/status.txt` ; \
+ fi
+
+# Check to make sure these directories exist
+check-jck: $(JT_HOME) $(JCK_HOME) $(PRODUCT_HOME)
+
+all-summary: FRC
+ if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
+ echo ; echo "Summary of test failures" ; \
+ cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \
+ grep -v 'Not run' | grep -v 'Passed' ; \
+ echo ; \
+ $(EXIT) 1
+ fi
# Bundle up the results
$(JPRT_ARCHIVE_BUNDLE): FRC
@@ -124,12 +380,17 @@ $(JPRT_ARCHIVE_BUNDLE): FRC
# Cleanup
clean:
- rm -f -r $(TEST_OUTPUT_DIR)
rm -f $(JPRT_ARCHIVE_BUNDLE)
# Used to force a target rules to run
FRC:
# Phony targets (e.g. these are not filenames)
-.PHONY: all tests clean check
+.PHONY: all clean \
+ jtreg javac javadoc javah javap jtreg-tests jtreg-summary check-jtreg \
+ jck-compiler jck-compiler-tests jck-compiler-summary \
+ jck-runtime jck-runtime-tests jck-runtime-summary check-jck
+
+# No use of suffix rules
+.SUFFIXES:
From a4d7c77789ad1e0b327d9863c229d8f82ee1c038 Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons
Date: Fri, 12 Mar 2010 15:22:50 -0800
Subject: [PATCH 041/190] 6934712: run langtools jtreg tests from top level
test/Makefile
Reviewed-by: ohair
---
test/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/Makefile b/test/Makefile
index bf9a4a1daf0..0888529a92b 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -49,7 +49,7 @@ fi
endef
# Test target list for langtools repository
-LANGTOOLS_TEST_LIST = langtools_all
+LANGTOOLS_TEST_LIST = langtools_jtreg
# Test target list for jdk repository
JDK_TEST_LIST = \
@@ -74,7 +74,7 @@ all: $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST)
# Test targets
$(LANGTOOLS_TEST_LIST):
- @$(call SUBDIR_TEST, $(LANGTOOLS_DIR), all)
+ @$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@))
$(JDK_TEST_LIST):
@$(call SUBDIR_TEST, $(JDK_DIR), $@)
From c21467f5549f69b5bc4067b624dd7de900017458 Mon Sep 17 00:00:00 2001
From: Kelly O'Hair
Date: Fri, 12 Mar 2010 17:44:50 -0800
Subject: [PATCH 042/190] 6934759: Add langtools testing to jprt control builds
Reviewed-by: jjg
---
make/jprt.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make/jprt.properties b/make/jprt.properties
index f08ea270041..54d64ae3b6a 100644
--- a/make/jprt.properties
+++ b/make/jprt.properties
@@ -62,6 +62,7 @@ jprt.test.targets= \
# Test targets in test/Makefile
jprt.make.rule.test.targets= \
+ *-product-*-langtools_jtreg, \
*-product-*-jdk_beans1, \
*-product-*-jdk_beans2, \
*-product-*-jdk_beans3, \
@@ -84,7 +85,6 @@ jprt.make.rule.test.targets= \
*-product-*-jdk_util
# Not Ready Yet:
-# *-product-*-langtools_all
# *-product-*-jdk_awt
# *-product-*-jdk_rmi
# *-product-*-jdk_swing
From 1be45512de2ca864aaaee32c5c8e797d89d3356b Mon Sep 17 00:00:00 2001
From: Pavel Porvatov
Date: Mon, 15 Mar 2010 16:16:06 +0300
Subject: [PATCH 043/190] 6931347: SynthTabbedPaneUI.paintTabArea() is not
called when tabbed pane is painted
Reviewed-by: peterz
---
.../swing/plaf/synth/SynthTabbedPaneUI.java | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
index 387f1ddce53..039abfed9f0 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
@@ -489,23 +489,6 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
}
- /**
- * @inheritDoc
- */
- @Override
- protected void paintTabArea(Graphics g, int tabPlacement,
- int selectedIndex) {
- // This can be invoked from ScrollabeTabPanel
- Insets insets = tabPane.getInsets();
- int x = insets.left;
- int y = insets.top;
- int width = tabPane.getWidth() - insets.left - insets.right;
- int height = tabPane.getHeight() - insets.top - insets.bottom;
-
- paintTabArea(tabAreaContext, g, tabPlacement, selectedIndex,
- new Rectangle(x, y, width, height));
- }
-
private void paintTabArea(SynthContext ss, Graphics g,
int tabPlacement, int selectedIndex,
Rectangle tabAreaBounds) {
From d8ec45338281f546ce845d87e0782eb53f6912e4 Mon Sep 17 00:00:00 2001
From: Karen Kinnear
Date: Mon, 15 Mar 2010 15:51:36 -0400
Subject: [PATCH 044/190] 6932480: Fix crash in CompilerThread/Parser. Unloaded
array klass?
Restore code deleted in 6626217
Reviewed-by: asaha, kevinw
---
hotspot/src/share/vm/ci/ciEnv.cpp | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp
index d358e65d07f..7ac5b275dae 100644
--- a/hotspot/src/share/vm/ci/ciEnv.cpp
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp
@@ -370,6 +370,30 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
KILL_COMPILE_ON_FATAL_(fail_type));
}
+ // If we fail to find an array klass, look again for its element type.
+ // The element type may be available either locally or via constraints.
+ // In either case, if we can find the element type in the system dictionary,
+ // we must build an array type around it. The CI requires array klasses
+ // to be loaded if their element klasses are loaded, except when memory
+ // is exhausted.
+ if (sym->byte_at(0) == '[' &&
+ (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
+ // We have an unloaded array.
+ // Build it on the fly if the element class exists.
+ symbolOop elem_sym = oopFactory::new_symbol(sym->as_utf8()+1,
+ sym->utf8_length()-1,
+ KILL_COMPILE_ON_FATAL_(fail_type));
+ // Get element ciKlass recursively.
+ ciKlass* elem_klass =
+ get_klass_by_name_impl(accessing_klass,
+ get_object(elem_sym)->as_symbol(),
+ require_local);
+ if (elem_klass != NULL && elem_klass->is_loaded()) {
+ // Now make an array for it
+ return ciObjArrayKlass::make_impl(elem_klass);
+ }
+ }
+
if (found_klass != NULL) {
// Found it. Build a CI handle.
return get_object(found_klass)->as_klass();
From f2034e6bbad86bbca7549a7e982fcbedfe6d91b2 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Tue, 16 Mar 2010 10:05:51 +0000
Subject: [PATCH 045/190] 6934923: test/java/net/ipv6tests/TcpTest.java hangs
on Solaris 10
Reviewed-by: alanb
---
jdk/test/java/net/ipv6tests/TcpTest.java | 8 +++---
jdk/test/java/net/ipv6tests/Tests.java | 33 +++++++++++++++++-------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/jdk/test/java/net/ipv6tests/TcpTest.java b/jdk/test/java/net/ipv6tests/TcpTest.java
index ec07a8bdd1a..38bb74513a8 100644
--- a/jdk/test/java/net/ipv6tests/TcpTest.java
+++ b/jdk/test/java/net/ipv6tests/TcpTest.java
@@ -47,9 +47,11 @@ public class TcpTest extends Tests {
try {
ia4any = InetAddress.getByName ("0.0.0.0");
ia6any = InetAddress.getByName ("::0");
- int scope = ia6addr.getScopeId();
- if (scope != 0) {
- ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6%"+scope);
+ if (ia6addr != null) {
+ int scope = ia6addr.getScopeId();
+ if (scope != 0) {
+ ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6%"+scope);
+ }
} else {
ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6");
}
diff --git a/jdk/test/java/net/ipv6tests/Tests.java b/jdk/test/java/net/ipv6tests/Tests.java
index 4527427d956..096bd3d2608 100644
--- a/jdk/test/java/net/ipv6tests/Tests.java
+++ b/jdk/test/java/net/ipv6tests/Tests.java
@@ -38,12 +38,25 @@ public class Tests {
OutputStream o1 = s1.getOutputStream();
OutputStream o2 = s2.getOutputStream();
- simpleWrite (o1, 100);
- simpleWrite (o2, 200);
+ startSimpleWriter("SimpleWriter-1", o1, 100);
+ startSimpleWriter("SimpleWriter-2", o2, 200);
simpleRead (i2, 100);
simpleRead (i1, 200);
}
+ static void startSimpleWriter(String threadName, final OutputStream os, final int start) {
+ (new Thread(new Runnable() {
+ public void run() {
+ try { simpleWrite(os, start); }
+ catch (Exception e) {unexpected(e); }
+ }}, threadName)).start();
+ }
+
+ static void unexpected(Exception e ) {
+ System.out.println("Unexcepted Exception: " + e);
+ e.printStackTrace();
+ }
+
/**
* Send a packet from s1 to s2 (ia2/s2.localPort) and check it
* Send a packet from s2 to s1 (ia1/s1.localPort) and check it
@@ -247,13 +260,15 @@ public class Tests {
}
private NetworkInterface getNextIf () {
- while (ifs.hasMoreElements()) {
- NetworkInterface nic = (NetworkInterface)ifs.nextElement();
- try {
- if (nic.isUp() && !nic.isLoopback())
- return nic;
- } catch (SocketException e) {
- // ignore
+ if (ifs != null) {
+ while (ifs.hasMoreElements()) {
+ NetworkInterface nic = (NetworkInterface)ifs.nextElement();
+ try {
+ if (nic.isUp() && !nic.isLoopback())
+ return nic;
+ } catch (SocketException e) {
+ // ignore
+ }
}
}
From 9b2361737348f8ce7d0f320ca24dc7018fb3bb49 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Tue, 16 Mar 2010 14:31:57 +0000
Subject: [PATCH 046/190] 6935199: java/net regression tests failing with
Assertions
Reviewed-by: michaelm
---
jdk/test/ProblemList.txt | 4 ----
jdk/test/java/net/CookieHandler/TestHttpCookie.java | 1 -
jdk/test/java/net/URLClassLoader/closetest/CloseTest.java | 2 --
3 files changed, 7 deletions(-)
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index a68d4ce170c..f5ce15187b2 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -596,10 +596,6 @@ sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java
# Interrupted or IO exception, maybe writing to non-unique named file?
com/sun/net/httpserver/bugs/B6373555.java generic-all
-# Dies on pretty much all platforms when run with -ea -esa, Assertion error
-java/net/CookieHandler/TestHttpCookie.java generic-all
-java/net/URLClassLoader/closetest/CloseTest.java generic-all
-
# Fails on OpenSolaris, BindException unexpected
java/net/BindException/Test.java generic-all
diff --git a/jdk/test/java/net/CookieHandler/TestHttpCookie.java b/jdk/test/java/net/CookieHandler/TestHttpCookie.java
index df0dd74cdb7..cf88ae336dd 100644
--- a/jdk/test/java/net/CookieHandler/TestHttpCookie.java
+++ b/jdk/test/java/net/CookieHandler/TestHttpCookie.java
@@ -48,7 +48,6 @@ public class TestHttpCookie {
}
TestHttpCookie(String cHeader) {
- assert cHeader != null;
this.cHeader = cHeader;
try {
diff --git a/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java b/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java
index b0fdd577b42..092bf542a5b 100644
--- a/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java
+++ b/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java
@@ -34,7 +34,6 @@
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
-import java.util.concurrent.*;
import com.sun.net.httpserver.*;
public class CloseTest {
@@ -107,7 +106,6 @@ public class CloseTest {
} else {
copyFile (new File (src, f), new File (dst, f));
}
- assert false;
}
}
From 69e5f8b79159855263482acb40a2c536465fb6e9 Mon Sep 17 00:00:00 2001
From: Weijun Wang
Date: Wed, 17 Mar 2010 09:55:04 +0800
Subject: [PATCH 047/190] 6868865: Test: sun/security/tools/jarsigner/oldsig.sh
fails under all platforms
Reviewed-by: wetmore
---
jdk/test/sun/security/tools/jarsigner/oldsig.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/jdk/test/sun/security/tools/jarsigner/oldsig.sh b/jdk/test/sun/security/tools/jarsigner/oldsig.sh
index d7420dc4f3e..19358de3227 100644
--- a/jdk/test/sun/security/tools/jarsigner/oldsig.sh
+++ b/jdk/test/sun/security/tools/jarsigner/oldsig.sh
@@ -1,5 +1,5 @@
#
-# Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+# Copyright 2007-2010 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
#
# @test
-# @bug 6543940
+# @bug 6543940 6868865
# @summary Exception thrown when signing a jarfile in java 1.5
#
# @run shell oldsig.sh
@@ -77,5 +77,6 @@ ${TESTJAVA}${FS}bin${FS}jar uvf B.jar B.class
${TESTJAVA}${FS}bin${FS}jarsigner \
-keystore ${TESTSRC}${FS}JarSigning.keystore \
-storepass bbbbbb \
+ -digestalg SHA1 \
B.jar c
${TESTJAVA}${FS}bin${FS}jarsigner -verify B.jar
From a0553816a11d47d22a8e5118805065dd9b56a73d Mon Sep 17 00:00:00 2001
From: Pavel Porvatov
Date: Wed, 17 Mar 2010 12:48:21 +0300
Subject: [PATCH 048/190] 6933784: NIMBUS: ImageView getNoImageIcon and
getLoadingImageIcon returns nulls instead of an icon
Reviewed-by: peterz
---
.../swing/plaf/synth/SynthLookAndFeel.java | 8 ++
.../javax/swing/plaf/synth/Test6933784.java | 76 +++++++++++++++++++
2 files changed, 84 insertions(+)
create mode 100644 jdk/test/javax/swing/plaf/synth/Test6933784.java
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
index 1db09641cc9..d3dafcc4890 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
@@ -648,6 +648,14 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
table.put("ColorChooser.swatchesDefaultRecentColor", Color.RED);
table.put("ColorChooser.swatchesSwatchSize", new Dimension(10, 10));
+ // These need to be defined for ImageView.
+ table.put("html.pendingImage", SwingUtilities2.makeIcon(getClass(),
+ BasicLookAndFeel.class,
+ "icons/image-delayed.png"));
+ table.put("html.missingImage", SwingUtilities2.makeIcon(getClass(),
+ BasicLookAndFeel.class,
+ "icons/image-failed.png"));
+
// These are needed for PopupMenu.
table.put("PopupMenu.selectedWindowInputMapBindings", new Object[] {
"ESCAPE", "cancel",
diff --git a/jdk/test/javax/swing/plaf/synth/Test6933784.java b/jdk/test/javax/swing/plaf/synth/Test6933784.java
new file mode 100644
index 00000000000..ceaa4f7d1b8
--- /dev/null
+++ b/jdk/test/javax/swing/plaf/synth/Test6933784.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ @bug 6933784
+ @summary NIMBUS: ImageView getNoImageIcon and getLoadingImageIcon returns nulls instead of an icon
+ @author Pavel Porvatov
+ @run main Test6933784
+*/
+
+import javax.swing.*;
+import javax.swing.plaf.nimbus.NimbusLookAndFeel;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.text.Element;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.ImageView;
+import java.io.StringReader;
+
+public class Test6933784 {
+ public static void main(String[] args) throws Exception {
+ UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+ checkImages();
+
+ UIManager.setLookAndFeel(new NimbusLookAndFeel());
+
+ checkImages();
+ }
+
+ private static void checkImages() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ HTMLEditorKit c = new HTMLEditorKit();
+ HTMLDocument doc = new HTMLDocument();
+
+ try {
+ c.read(new StringReader("Test"), doc, 0);
+ } catch (Exception e) {
+ throw new RuntimeException("The test failed", e);
+ }
+
+ Element elem = doc.getElement("test");
+ ImageView iv = new ImageView(elem);
+
+ if (iv.getLoadingImageIcon() == null) {
+ throw new RuntimeException("getLoadingImageIcon returns null");
+ }
+
+ if (iv.getNoImageIcon() == null) {
+ throw new RuntimeException("getNoImageIcon returns null");
+ }
+ }
+ });
+ }
+}
From 9d111384633c8af91154c5bd8bdbdd83e8b99f75 Mon Sep 17 00:00:00 2001
From: Peter Zhelezniakov
Date: Thu, 18 Mar 2010 12:02:12 +0300
Subject: [PATCH 049/190] 6932524: NIMBUS: 3 constructors of JSplitPane creates
new jsp with continuous layout - they should not
Reviewed-by: alexp
---
jdk/src/share/classes/javax/swing/JSplitPane.java | 10 +++-------
jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf | 1 -
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/jdk/src/share/classes/javax/swing/JSplitPane.java b/jdk/src/share/classes/javax/swing/JSplitPane.java
index f3baff66492..9700b260f2c 100644
--- a/jdk/src/share/classes/javax/swing/JSplitPane.java
+++ b/jdk/src/share/classes/javax/swing/JSplitPane.java
@@ -246,8 +246,7 @@ public class JSplitPane extends JComponent implements Accessible
* layout, using two buttons for the components.
*/
public JSplitPane() {
- this(JSplitPane.HORIZONTAL_SPLIT,
- UIManager.getBoolean("SplitPane.continuousLayout"),
+ this(JSplitPane.HORIZONTAL_SPLIT, false,
new JButton(UIManager.getString("SplitPane.leftButtonText")),
new JButton(UIManager.getString("SplitPane.rightButtonText")));
}
@@ -264,8 +263,7 @@ public class JSplitPane extends JComponent implements Accessible
*/
@ConstructorProperties({"orientation"})
public JSplitPane(int newOrientation) {
- this(newOrientation,
- UIManager.getBoolean("SplitPane.continuousLayout"));
+ this(newOrientation, false);
}
@@ -309,9 +307,7 @@ public class JSplitPane extends JComponent implements Accessible
public JSplitPane(int newOrientation,
Component newLeftComponent,
Component newRightComponent){
- this(newOrientation,
- UIManager.getBoolean("SplitPane.continuousLayout"),
- newLeftComponent, newRightComponent);
+ this(newOrientation, false, newLeftComponent, newRightComponent);
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf
index 15532781cf2..93839159356 100644
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf
@@ -21276,7 +21276,6 @@
-
From 23a0fee5182e76ddc1444a8d644bfc48f10d6b8b Mon Sep 17 00:00:00 2001
From: Weijun Wang
Date: Thu, 18 Mar 2010 18:26:37 +0800
Subject: [PATCH 050/190] 6829283: HTTP/Negotiate: Autheticator triggered again
when user cancels the first one
Reviewed-by: chegar
---
.../http/spnego/NegotiateCallbackHandler.java | 57 ++++++-----
.../krb5/auto/HttpNegotiateServer.java | 99 +++++++++++++++----
2 files changed, 112 insertions(+), 44 deletions(-)
diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java b/jdk/src/share/classes/sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java
index f2c0f6cc254..1dd442ddfca 100644
--- a/jdk/src/share/classes/sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,43 +45,50 @@ public class NegotiateCallbackHandler implements CallbackHandler {
private String username;
private char[] password;
+ /**
+ * Authenticator asks for username and password in a single prompt,
+ * but CallbackHandler checks one by one. So, no matter which callback
+ * gets handled first, make sure Authenticator is only called once.
+ */
+ private boolean answered;
+
private final HttpCallerInfo hci;
public NegotiateCallbackHandler(HttpCallerInfo hci) {
this.hci = hci;
}
+ private void getAnswer() {
+ if (!answered) {
+ answered = true;
+ PasswordAuthentication passAuth =
+ Authenticator.requestPasswordAuthentication(
+ hci.host, hci.addr, hci.port, hci.protocol,
+ hci.prompt, hci.scheme, hci.url, hci.authType);
+ /**
+ * To be compatible with existing callback handler implementations,
+ * when the underlying Authenticator is canceled, username and
+ * password are assigned null. No exception is thrown.
+ */
+ if (passAuth != null) {
+ username = passAuth.getUserName();
+ password = passAuth.getPassword();
+ }
+ }
+ }
+
public void handle(Callback[] callbacks) throws
UnsupportedCallbackException, IOException {
for (int i=0; i 1) {
+ throw new RuntimeException("Authenticator called twice");
+ }
+ }
+
/**
* Creates and starts an HTTP or proxy server that requires
* Negotiate authentication.
From c0cdafcd43a7047ea0a47086eab9dda432e93c9d Mon Sep 17 00:00:00 2001
From: Valerie Peng
Date: Thu, 18 Mar 2010 17:05:42 -0700
Subject: [PATCH 051/190] 6695485: SignedObject constructor throws
ProviderException if it's called using provider "SunPKCS11-Solaris"
Added checking for RSA key lengths in initSign and initVerify
Reviewed-by: vinnie
---
.../sun/security/pkcs11/P11Signature.java | 84 +++++++++++++++----
.../pkcs11/Signature/TestRSAKeyLength.java | 74 ++++++++++++++++
2 files changed, 140 insertions(+), 18 deletions(-)
create mode 100644 jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java
diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
index 3f7cc908016..b7c7f5f0e7c 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,7 @@ import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.security.*;
-import java.security.interfaces.ECPublicKey;
-
+import java.security.interfaces.*;
import sun.nio.ch.DirectBuffer;
import sun.security.util.*;
@@ -88,7 +87,7 @@ final class P11Signature extends SignatureSpi {
// mechanism id
private final long mechanism;
- // digest algorithm OID, if we do RSA padding ourselves
+ // digest algorithm OID, if we encode RSA signature ourselves
private final ObjectIdentifier digestOID;
// type, one of T_* below
@@ -103,7 +102,7 @@ final class P11Signature extends SignatureSpi {
// associated session, if any
private Session session;
- // mode, on of M_* below
+ // mode, one of M_* below
private int mode;
// flag indicating whether an operation is initialized
@@ -137,6 +136,9 @@ final class P11Signature extends SignatureSpi {
this.token = token;
this.algorithm = algorithm;
this.mechanism = mechanism;
+ byte[] buffer = null;
+ ObjectIdentifier digestOID = null;
+ MessageDigest md = null;
switch ((int)mechanism) {
case (int)CKM_MD2_RSA_PKCS:
case (int)CKM_MD5_RSA_PKCS:
@@ -146,34 +148,25 @@ final class P11Signature extends SignatureSpi {
case (int)CKM_SHA512_RSA_PKCS:
keyAlgorithm = "RSA";
type = T_UPDATE;
- digestOID = null;
buffer = new byte[1];
- md = null;
break;
case (int)CKM_DSA_SHA1:
keyAlgorithm = "DSA";
type = T_UPDATE;
- digestOID = null;
buffer = new byte[1];
- md = null;
break;
case (int)CKM_ECDSA_SHA1:
keyAlgorithm = "EC";
type = T_UPDATE;
- digestOID = null;
buffer = new byte[1];
- md = null;
break;
case (int)CKM_DSA:
keyAlgorithm = "DSA";
- digestOID = null;
if (algorithm.equals("DSA")) {
type = T_DIGEST;
md = MessageDigest.getInstance("SHA-1");
- buffer = null;
} else if (algorithm.equals("RawDSA")) {
type = T_RAW;
- md = null;
buffer = new byte[20];
} else {
throw new ProviderException(algorithm);
@@ -181,10 +174,8 @@ final class P11Signature extends SignatureSpi {
break;
case (int)CKM_ECDSA:
keyAlgorithm = "EC";
- digestOID = null;
if (algorithm.equals("NONEwithECDSA")) {
type = T_RAW;
- md = null;
buffer = new byte[RAW_ECDSA_MAX];
} else {
String digestAlg;
@@ -201,14 +192,12 @@ final class P11Signature extends SignatureSpi {
}
type = T_DIGEST;
md = MessageDigest.getInstance(digestAlg);
- buffer = null;
}
break;
case (int)CKM_RSA_PKCS:
case (int)CKM_RSA_X_509:
keyAlgorithm = "RSA";
type = T_DIGEST;
- buffer = null;
if (algorithm.equals("MD5withRSA")) {
md = MessageDigest.getInstance("MD5");
digestOID = AlgorithmId.MD5_oid;
@@ -234,6 +223,9 @@ final class P11Signature extends SignatureSpi {
default:
throw new ProviderException("Unknown mechanism: " + mechanism);
}
+ this.buffer = buffer;
+ this.digestOID = digestOID;
+ this.md = md;
session = token.getOpSession();
}
@@ -326,9 +318,52 @@ final class P11Signature extends SignatureSpi {
}
}
+ private void checkRSAKeyLength(int len) throws InvalidKeyException {
+ RSAPadding padding;
+ try {
+ padding = RSAPadding.getInstance
+ (RSAPadding.PAD_BLOCKTYPE_1, (len + 7) >> 3);
+ } catch (InvalidAlgorithmParameterException iape) {
+ throw new InvalidKeyException(iape.getMessage());
+ }
+ int maxDataSize = padding.getMaxDataSize();
+ int encodedLength;
+ if (algorithm.equals("MD5withRSA") ||
+ algorithm.equals("MD2withRSA")) {
+ encodedLength = 34;
+ } else if (algorithm.equals("SHA1withRSA")) {
+ encodedLength = 35;
+ } else if (algorithm.equals("SHA256withRSA")) {
+ encodedLength = 51;
+ } else if (algorithm.equals("SHA384withRSA")) {
+ encodedLength = 67;
+ } else if (algorithm.equals("SHA512withRSA")) {
+ encodedLength = 83;
+ } else {
+ throw new ProviderException("Unknown signature algo: " + algorithm);
+ }
+ if (encodedLength > maxDataSize) {
+ throw new InvalidKeyException
+ ("Key is too short for this signature algorithm");
+ }
+ }
+
// see JCA spec
protected void engineInitVerify(PublicKey publicKey)
throws InvalidKeyException {
+ if (publicKey == null) {
+ throw new InvalidKeyException("Key must not be null");
+ }
+ // Need to check RSA key length whenever a new key is set
+ if (keyAlgorithm.equals("RSA") && publicKey != p11Key) {
+ int keyLen;
+ if (publicKey instanceof P11Key) {
+ keyLen = ((P11Key) publicKey).keyLength();
+ } else {
+ keyLen = ((RSAKey) publicKey).getModulus().bitLength();
+ }
+ checkRSAKeyLength(keyLen);
+ }
cancelOperation();
mode = M_VERIFY;
p11Key = P11KeyFactory.convertKey(token, publicKey, keyAlgorithm);
@@ -338,6 +373,19 @@ final class P11Signature extends SignatureSpi {
// see JCA spec
protected void engineInitSign(PrivateKey privateKey)
throws InvalidKeyException {
+ if (privateKey == null) {
+ throw new InvalidKeyException("Key must not be null");
+ }
+ // Need to check RSA key length whenever a new key is set
+ if (keyAlgorithm.equals("RSA") && privateKey != p11Key) {
+ int keyLen;
+ if (privateKey instanceof P11Key) {
+ keyLen = ((P11Key) privateKey).keyLength;
+ } else {
+ keyLen = ((RSAKey) privateKey).getModulus().bitLength();
+ }
+ checkRSAKeyLength(keyLen);
+ }
cancelOperation();
mode = M_SIGN;
p11Key = P11KeyFactory.convertKey(token, privateKey, keyAlgorithm);
diff --git a/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java b/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java
new file mode 100644
index 00000000000..d0c48f07898
--- /dev/null
+++ b/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test %W% %E%
+ * @bug 6695485
+ * @summary Make sure initSign/initVerify() check RSA key lengths
+ * @author Yu-Ching Valerie Peng
+ * @library ..
+ */
+
+import java.security.*;
+
+public class TestRSAKeyLength extends PKCS11Test {
+ public static void main(String[] args) throws Exception {
+ main(new TestRSAKeyLength());
+ }
+ public void main(Provider p) throws Exception {
+ boolean isValidKeyLength[] = { true, true, false, false };
+ String algos[] = { "SHA1withRSA", "SHA256withRSA",
+ "SHA384withRSA", "SHA512withRSA" };
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p);
+ kpg.initialize(512);
+ KeyPair kp = kpg.generateKeyPair();
+ PrivateKey privKey = kp.getPrivate();
+ PublicKey pubKey = kp.getPublic();
+
+ for (int i = 0; i < algos.length; i++) {
+ Signature sig = Signature.getInstance(algos[i], p);
+ System.out.println("Testing RSA signature " + algos[i]);
+ try {
+ sig.initSign(privKey);
+ if (!isValidKeyLength[i]) {
+ throw new Exception("initSign: Expected IKE not thrown!");
+ }
+ } catch (InvalidKeyException ike) {
+ if (isValidKeyLength[i]) {
+ throw new Exception("initSign: Unexpected " + ike);
+ }
+ }
+ try {
+ sig.initVerify(pubKey);
+ if (!isValidKeyLength[i]) {
+ throw new RuntimeException("initVerify: Expected IKE not thrown!");
+ }
+ new SignedObject("Test string for getSignature test.", privKey, sig);
+ } catch (InvalidKeyException ike) {
+ if (isValidKeyLength[i]) {
+ throw new Exception("initSign: Unexpected " + ike);
+ }
+ }
+ }
+ }
+}
From 107e21bdc575484302a050d4699a0fbcda2ba20c Mon Sep 17 00:00:00 2001
From: Valerie Peng
Date: Thu, 18 Mar 2010 17:32:45 -0700
Subject: [PATCH 052/190] 6591117: Poor preformance of PKCS#11 security
provider compared to Sun default provider
Added internal buffering to PKCS11 SecureRandom impl
Reviewed-by: wetmore
---
.../sun/security/pkcs11/P11SecureRandom.java | 69 +++++++++++++++----
1 file changed, 57 insertions(+), 12 deletions(-)
diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java b/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java
index de830226be8..5a3ca53c31d 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package sun.security.pkcs11;
import java.util.*;
-
+import java.io.*;
import java.security.*;
import sun.security.pkcs11.wrapper.*;
@@ -61,9 +61,28 @@ final class P11SecureRandom extends SecureRandomSpi {
// buffer, if mixing is used
private byte[] mixBuffer;
- // bytes remaining in buffer, if mixing is used
+ // bytes remaining in mixBuffer, if mixing is used
private int buffered;
+ /*
+ * we buffer data internally for efficiency but limit the lifetime
+ * to avoid using stale bits.
+ */
+ // lifetime in ms, currently 100 ms (0.1 s)
+ private static final long MAX_IBUFFER_TIME = 100;
+
+ // size of the internal buffer
+ private static final int IBUFFER_SIZE = 32;
+
+ // internal buffer for the random bits
+ private transient byte[] iBuffer = new byte[IBUFFER_SIZE];
+
+ // number of bytes remain in iBuffer
+ private transient int ibuffered = 0;
+
+ // time that data was read into iBuffer
+ private transient long lastRead = 0L;
+
P11SecureRandom(Token token) {
this.token = token;
}
@@ -104,16 +123,29 @@ final class P11SecureRandom extends SecureRandomSpi {
if ((bytes == null) || (bytes.length == 0)) {
return;
}
- Session session = null;
- try {
- session = token.getOpSession();
- token.p11.C_GenerateRandom(session.id(), bytes);
- mix(bytes);
- } catch (PKCS11Exception e) {
- throw new ProviderException("nextBytes() failed", e);
- } finally {
- token.releaseSession(session);
+ if (bytes.length <= IBUFFER_SIZE) {
+ int ofs = 0;
+ synchronized (iBuffer) {
+ while (ofs < bytes.length) {
+ long time = System.currentTimeMillis();
+ // refill the internal buffer if empty or stale
+ if ((ibuffered == 0) ||
+ !(time - lastRead < MAX_IBUFFER_TIME)) {
+ lastRead = time;
+ implNextBytes(iBuffer);
+ ibuffered = IBUFFER_SIZE;
+ }
+ // copy the buffered bytes into 'bytes'
+ while ((ofs < bytes.length) && (ibuffered > 0)) {
+ bytes[ofs++] = iBuffer[IBUFFER_SIZE - ibuffered--];
+ }
+ }
+ }
+ } else {
+ // avoid using the buffer - just fill bytes directly
+ implNextBytes(bytes);
}
+
}
// see JCA spec
@@ -143,4 +175,17 @@ final class P11SecureRandom extends SecureRandomSpi {
}
}
+ // fill up the specified buffer with random bytes, and mix them
+ private void implNextBytes(byte[] bytes) {
+ Session session = null;
+ try {
+ session = token.getOpSession();
+ token.p11.C_GenerateRandom(session.id(), bytes);
+ mix(bytes);
+ } catch (PKCS11Exception e) {
+ throw new ProviderException("nextBytes() failed", e);
+ } finally {
+ token.releaseSession(session);
+ }
+ }
}
From b05376b1087bc262369f1e73cd9e2e020a8f4693 Mon Sep 17 00:00:00 2001
From: Valerie Peng
Date: Thu, 18 Mar 2010 17:56:39 -0700
Subject: [PATCH 053/190] 6837847: PKCS#11 A SecureRandom and a serialization
error following installation of 1.5.0_18
Added a custom readObject method to PKCS11 SecureRandom impl
Reviewed-by: wetmore
---
.../sun/security/pkcs11/P11SecureRandom.java | 9 ++
.../SecureRandom/TestDeserialization.java | 94 +++++++++++++++++++
2 files changed, 103 insertions(+)
create mode 100644 jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java
diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java b/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java
index 5a3ca53c31d..bcf72806ea1 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11SecureRandom.java
@@ -188,4 +188,13 @@ final class P11SecureRandom extends SecureRandomSpi {
token.releaseSession(session);
}
}
+
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ // assign default values to non-null transient fields
+ iBuffer = new byte[IBUFFER_SIZE];
+ ibuffered = 0;
+ lastRead = 0L;
+ }
}
diff --git a/jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java b/jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java
new file mode 100644
index 00000000000..8be5aba9d62
--- /dev/null
+++ b/jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6837847
+ * @summary Ensure a deserialized PKCS#11 SecureRandom is functional.
+ * @library ..
+ */
+
+import java.security.*;
+import java.io.*;
+
+public class TestDeserialization extends PKCS11Test {
+
+ public void main(Provider p) throws Exception {
+ // Skip this test for providers not found by java.security.Security
+ if (Security.getProvider(p.getName()) != p) {
+ System.out.println("Skip test for provider " + p.getName());
+ return;
+ }
+ SecureRandom r;
+ try {
+ r = SecureRandom.getInstance("PKCS11", p);
+ System.out.println("SecureRandom instance " + r);
+ } catch (NoSuchAlgorithmException e) {
+ System.out.println("Provider " + p +
+ " does not support SecureRandom, skipping");
+ e.printStackTrace();
+ return;
+ }
+ r.setSeed(System.currentTimeMillis());
+ byte[] buf = new byte[16];
+ byte[] ser = toByteArray(r);
+ System.out.println("Serialized Len = " + ser.length);
+ SecureRandom r2 = fromByteArray(ser);
+ System.out.println("Deserialized into " + r2);
+ r2.nextBytes(buf);
+ System.out.println("Done");
+ }
+
+ public static void main(String[] args) throws Exception {
+ main(new TestDeserialization());
+ }
+
+ private byte[] toByteArray(SecureRandom r) throws Exception {
+ ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
+ ObjectOutputStream outStream = null;
+ try {
+ outStream = new ObjectOutputStream(out);
+ outStream.writeObject(r);
+ return out.toByteArray();
+ } finally {
+ if (outStream != null) {
+ outStream.close();
+ }
+ }
+ }
+
+ private SecureRandom fromByteArray(byte[] buf) throws Exception {
+ SecureRandom r = null;
+ ByteArrayInputStream is = new ByteArrayInputStream(buf);
+ ObjectInputStream ois = null;
+ try {
+ ois = new ObjectInputStream(is);
+ r = (SecureRandom) ois.readObject();
+ } finally {
+ if (ois != null) {
+ ois.close();
+ }
+ }
+ return r;
+ }
+}
From 6fb9ea72789ede2b60670eba0556dad89e456781 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Fri, 19 Mar 2010 13:07:42 +0000
Subject: [PATCH 054/190] 6935233:
java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java fails with modules
build
Reviewed-by: alanb
---
jdk/test/ProblemList.txt | 3 --
.../AcceptCauseFileDescriptorLeak.java | 39 +++------------
.../AcceptCauseFileDescriptorLeak.sh | 48 +++++++++++++++++++
3 files changed, 54 insertions(+), 36 deletions(-)
create mode 100644 jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index f5ce15187b2..bc30709bc9b 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -643,9 +643,6 @@ java/net/ipv6tests/TcpTest.java generic-all
# Linux i586, fails with unexpected output
java/net/MulticastSocket/NoLoopbackPackets.java linux-i586
-# Times out on windows x64, fails with samevm on solaris 11 i586
-java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java generic-all
-
# Address already in use
java/net/DatagramSocket/DatagramTimeout.java generic-all
diff --git a/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java b/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java
index d5463f00fc5..9c893151bcd 100644
--- a/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java
+++ b/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.java
@@ -22,17 +22,16 @@
*/
/*
- * @test
- * @summary configuring unconnected Socket before passing to implAccept can cause fd leak
- * @bug 6368984
- * @author Edward Wang
+ * Test run from script, AcceptCauseFileDescriptorLeak.sh
+ * author Edward Wang
*/
-import java.io.*;
-import java.net.*;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
public class AcceptCauseFileDescriptorLeak {
- private static final int REPS = 1000;
+ private static final int REPS = 2048;
public static void main(String[] args) throws Exception {
final ServerSocket ss = new ServerSocket(0) {
@@ -60,31 +59,5 @@ public class AcceptCauseFileDescriptorLeak {
}
ss.close();
t.join();
-
- //
- // The threshold 20 below is a little arbitrary. The point here is that
- // the remaining open file descriptors should be constant independent
- // of REPS.
- //
- if (countOpenFD() > 20) {
- throw new RuntimeException("File descriptor leak detected.");
- }
- }
-
-
- /*
- * Actually, this approach to count open file descriptors only
- * works for Solaris/Linux. On Windows platform, this method
- * will simply return zero. So the test will always be passed
- * on Windows, too.
- */
- private static int countOpenFD() {
- File dirOfFD = new File("/proc/self/fd");
- File[] fds = dirOfFD.listFiles();
-
- if (fds != null)
- return fds.length;
- else
- return 0;
}
}
diff --git a/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh b/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh
new file mode 100644
index 00000000000..fe28fc8fa25
--- /dev/null
+++ b/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh
@@ -0,0 +1,48 @@
+#
+# Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+# @test
+# @bug 6368984
+# @summary configuring unconnected Socket before passing to implAccept can cause fd leak
+# @build AcceptCauseFileDescriptorLeak
+# @run shell AcceptCauseFileDescriptorLeak.sh
+
+OS=`uname -s`
+case "$OS" in
+ Windows_* | CYGWIN* )
+ echo "ulimit not on Windows"
+ exit 0
+ ;;
+ * )
+ CLASSPATH=${TESTCLASSES}:${TESTSRC}
+ ;;
+esac
+export CLASSPATH
+
+# hard limit needs to be less than 1024 for this bug
+NOFILES=`ulimit -n -H`
+if [ "$NOFILES" = "unlimited" ] || [ $NOFILES -ge 1024 ]; then
+ ulimit -n 1024
+fi
+
+${TESTJAVA}/bin/java AcceptCauseFileDescriptorLeak
From 235a0d94bdc997dc9ecfdf73ca3a4553253bbe3f Mon Sep 17 00:00:00 2001
From: Kelly O'Hair
Date: Fri, 19 Mar 2010 18:17:49 -0700
Subject: [PATCH 055/190] 6936788: Minor adjustment to top repo test/Makefile,
missing non-zero exit case
Reviewed-by: jjg
---
test/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/Makefile b/test/Makefile
index 0888529a92b..00e532eda8f 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -42,6 +42,7 @@ if [ -d $1 ] ; then \
$(MAKE) -C $1/test $2 ; \
else \
echo "ERROR: File does not exist: $1/test/Makefile"; \
+ exit 1; \
fi; \
else \
echo "WARNING: No testing done, directory does not exist: $1"; \
From 67639e07f3d09446c89bb28acff7ef6da896a7ae Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Mon, 22 Mar 2010 11:55:54 +0000
Subject: [PATCH 056/190] 6632169: HttpClient and HttpsClient should not try to
reverse lookup IP address of a proxy server
Reviewed-by: michaelm
---
.../share/classes/sun/net/www/protocol/https/HttpsClient.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java
index 8c5ee25a959..f04fe98a5c7 100644
--- a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java
+++ b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java
@@ -630,7 +630,7 @@ final class HttpsClient extends HttpClient
if (!needsTunneling()) {
return null;
} else {
- return ((InetSocketAddress)proxy.address()).getHostName();
+ return super.getProxyHostUsed();
}
}
From 5266d0e350576b2b7d89162d204f7b4f4403294a Mon Sep 17 00:00:00 2001
From: Weijun Wang
Date: Tue, 23 Mar 2010 10:41:11 +0800
Subject: [PATCH 057/190] 6586707: NTLM authentication with proxy fails
Reviewed-by: chegar
---
.../www/protocol/http/HttpURLConnection.java | 29 ++++++++++++++++---
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
index ac5eb2d281c..72fe9bafb10 100644
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1258,6 +1258,11 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
doingNTLMp2ndStage = false;
continue;
}
+ } else {
+ inNegotiateProxy = false;
+ doingNTLMp2ndStage = false;
+ if (!isUserProxyAuth)
+ requests.remove("Proxy-Authorization");
}
// cache proxy authentication info
@@ -1303,7 +1308,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
serverAuthentication.getAuthScheme() != NTLM) {
if (serverAuthentication.isAuthorizationStale (raw)) {
/* we can retry with the current credentials */
- disconnectInternal();
+ disconnectWeb();
redirects++;
requests.set(serverAuthentication.getHeaderName(),
serverAuthentication.getHeaderValue(url, method));
@@ -1318,7 +1323,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
currentServerCredentials = serverAuthentication;
if (serverAuthentication != null) {
- disconnectInternal();
+ disconnectWeb();
redirects++; // don't let things loop ad nauseum
setCookieHeader();
continue;
@@ -1327,7 +1332,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
reset ();
/* header not used for ntlm */
if (!serverAuthentication.setHeaders(this, null, raw)) {
- disconnectInternal();
+ disconnectWeb();
throw new IOException ("Authentication failure");
}
doingNTLM2ndStage = false;
@@ -2319,6 +2324,22 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
connected = false;
}
+ /**
+ * Disconnect from the web server at the first 401 error. Do not
+ * disconnect when using a proxy, a good proxy should have already
+ * closed the connection to the web server.
+ */
+ private void disconnectWeb() throws IOException {
+ if (usingProxy()) {
+ responseCode = -1;
+ // clean up, particularly, skip the content part
+ // of a 401 error response
+ reset();
+ } else {
+ disconnectInternal();
+ }
+ }
+
/**
* Disconnect from the server (for internal use)
*/
From 498067c8a3eef42b9c2e627e521e37aa56444379 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Tue, 23 Mar 2010 13:54:36 +0000
Subject: [PATCH 058/190] 6614957: HttpsURLConnection not using the set
SSLSocketFactory for creating all its Sockets 6771432: createSocket() -
smpatch fails using 1.6.0_10 because of "Unconnected sockets not implemented"
6766775: X509 certificate hostname checking is broken in JDK1.6.0_10
All three bugs are interdependent
Reviewed-by: xuelei
---
.../classes/javax/net/SocketFactory.java | 18 +-
.../share/classes/sun/net/NetworkClient.java | 19 +-
.../net/www/protocol/https/HttpsClient.java | 56 +-
.../sun/security/ssl/SSLSocketImpl.java | 5 +
.../HttpsURLConnection/DNSIdentities.java | 879 +++++++++++++++++
.../HttpsCreateSockTest.java | 210 +++++
.../HttpsSocketFacTest.java | 225 +++++
.../IPAddressDNSIdentities.java | 887 ++++++++++++++++++
.../IPAddressIPIdentities.java | 880 +++++++++++++++++
.../HttpsURLConnection/IPIdentities.java | 880 +++++++++++++++++
.../https/HttpsURLConnection/Identities.java | 879 +++++++++++++++++
11 files changed, 4914 insertions(+), 24 deletions(-)
create mode 100644 jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java
create mode 100644 jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java
create mode 100644 jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java
create mode 100644 jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java
create mode 100644 jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java
create mode 100644 jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java
create mode 100644 jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java
diff --git a/jdk/src/share/classes/javax/net/SocketFactory.java b/jdk/src/share/classes/javax/net/SocketFactory.java
index f1f7b53785b..fe43482bf26 100644
--- a/jdk/src/share/classes/javax/net/SocketFactory.java
+++ b/jdk/src/share/classes/javax/net/SocketFactory.java
@@ -27,8 +27,10 @@
package javax.net;
import java.io.IOException;
-import java.net.*;
-
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.UnknownHostException;
/**
* This class creates sockets. It may be subclassed by other factories,
@@ -113,7 +115,17 @@ public abstract class SocketFactory
* @see java.net.Socket#Socket()
*/
public Socket createSocket() throws IOException {
- throw new SocketException("Unconnected sockets not implemented");
+ //
+ // bug 6771432:
+ // The Exception is used by HttpsClient to signal that
+ // unconnected sockets have not been implemented.
+ //
+ UnsupportedOperationException uop = new
+ UnsupportedOperationException();
+ SocketException se = new SocketException(
+ "Unconnected sockets not implemented");
+ se.initCause(uop);
+ throw se;
}
diff --git a/jdk/src/share/classes/sun/net/NetworkClient.java b/jdk/src/share/classes/sun/net/NetworkClient.java
index fd9f405d2a7..779dec50d39 100644
--- a/jdk/src/share/classes/sun/net/NetworkClient.java
+++ b/jdk/src/share/classes/sun/net/NetworkClient.java
@@ -29,7 +29,6 @@ import java.net.Socket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
-import java.net.URL;
import java.net.Proxy;
import java.util.Arrays;
import java.security.AccessController;
@@ -157,10 +156,15 @@ public class NetworkClient {
public Socket run() {
return new Socket(proxy);
}});
- } else
+ } else if (proxy.type() == Proxy.Type.DIRECT) {
+ s = createSocket();
+ } else {
+ // Still connecting through a proxy
+ // server & port will be the proxy address and port
s = new Socket(Proxy.NO_PROXY);
+ }
} else
- s = new Socket();
+ s = createSocket();
// Instance specific timeouts do have priority, that means
// connectTimeout & readTimeout (-1 means not set)
// Then global default timeouts
@@ -182,6 +186,15 @@ public class NetworkClient {
return s;
}
+ /**
+ * The following method, createSocket, is provided to allow the
+ * https client to override it so that it may use its socket factory
+ * to create the socket.
+ */
+ protected Socket createSocket() throws IOException {
+ return new java.net.Socket();
+ }
+
protected InetAddress getLocalAddress() throws IOException {
if (serverSocket == null)
throw new IOException("not connected");
diff --git a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java
index f04fe98a5c7..e2cc3b31335 100644
--- a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java
+++ b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java
@@ -28,39 +28,24 @@ package sun.net.www.protocol.https;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.FileInputStream;
import java.io.PrintStream;
import java.io.BufferedOutputStream;
import java.net.Socket;
+import java.net.SocketException;
import java.net.URL;
import java.net.UnknownHostException;
-import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.CookieHandler;
-import java.net.Authenticator;
-import java.net.PasswordAuthentication;
import java.security.Principal;
-import java.security.KeyStore;
-import java.security.PrivateKey;
import java.security.cert.*;
import java.util.StringTokenizer;
import java.util.Vector;
-import java.util.Collection;
-import java.util.List;
-import java.util.Iterator;
import java.security.AccessController;
import javax.security.auth.x500.X500Principal;
import javax.net.ssl.*;
-import sun.security.x509.X500Name;
-import sun.misc.Regexp;
-import sun.misc.RegexpPool;
-import sun.net.www.HeaderParser;
-import sun.net.www.MessageHeader;
import sun.net.www.http.HttpClient;
import sun.security.action.*;
@@ -125,6 +110,7 @@ final class HttpsClient extends HttpClient
private static final int httpsPortNumber = 443;
/** Returns the default HTTPS port (443) */
+ @Override
protected int getDefaultPort() { return httpsPortNumber; }
private HostnameVerifier hv;
@@ -368,11 +354,39 @@ final class HttpsClient extends HttpClient
return sslSocketFactory;
}
+ /**
+ * The following method, createSocket, is defined in NetworkClient
+ * and overridden here so that the socket facroty is used to create
+ * new sockets.
+ */
+ @Override
+ protected Socket createSocket() throws IOException {
+ try {
+ return sslSocketFactory.createSocket();
+ } catch (SocketException se) {
+ //
+ // bug 6771432
+ // javax.net.SocketFactory throws a SocketException with an
+ // UnsupportedOperationException as its cause to indicate that
+ // unconnected sockets have not been implemented.
+ //
+ Throwable t = se.getCause();
+ if (t != null && t instanceof UnsupportedOperationException) {
+ return super.createSocket();
+ } else {
+ throw se;
+ }
+ }
+ }
+
+
+ @Override
public boolean needsTunneling() {
return (proxy != null && proxy.type() != Proxy.Type.DIRECT
&& proxy.type() != Proxy.Type.SOCKS);
}
+ @Override
public void afterConnect() throws IOException, UnknownHostException {
if (!isCachedConnection()) {
SSLSocket s = null;
@@ -383,6 +397,9 @@ final class HttpsClient extends HttpClient
host, port, true);
} else {
s = (SSLSocket)serverSocket;
+ if (s instanceof SSLSocketImpl) {
+ ((SSLSocketImpl)s).setHost(host);
+ }
}
} catch (IOException ex) {
// If we fail to connect through the tunnel, try it
@@ -451,7 +468,6 @@ final class HttpsClient extends HttpClient
//
// Get authenticated server name, if any
//
- boolean done = false;
String host = url.getHost();
// if IPv6 strip off the "[]"
@@ -467,7 +483,7 @@ final class HttpsClient extends HttpClient
// Use ciphersuite to determine whether Kerberos is present.
if (cipher.startsWith("TLS_KRB5")) {
- if (!checker.match(host, getPeerPrincipal())) {
+ if (!HostnameChecker.match(host, getPeerPrincipal())) {
throw new SSLPeerUnverifiedException("Hostname checker" +
" failed for Kerberos");
}
@@ -514,6 +530,7 @@ final class HttpsClient extends HttpClient
+ url.getHost() + ">");
}
+ @Override
protected void putInKeepAliveCache() {
kac.put(url, sslSocketFactory, this);
}
@@ -521,6 +538,7 @@ final class HttpsClient extends HttpClient
/*
* Close an idle connection to this URL (if it exists in the cache).
*/
+ @Override
public void closeIdleConnection() {
HttpClient http = (HttpClient) kac.get(url, sslSocketFactory);
if (http != null) {
@@ -626,6 +644,7 @@ final class HttpsClient extends HttpClient
* @return the proxy host being used for this client, or null
* if we're not going through a proxy
*/
+ @Override
public String getProxyHostUsed() {
if (!needsTunneling()) {
return null;
@@ -638,6 +657,7 @@ final class HttpsClient extends HttpClient
* @return the proxy port being used for this client. Meaningless
* if getProxyHostUsed() gives null.
*/
+ @Override
public int getProxyPortUsed() {
return (proxy == null || proxy.type() == Proxy.Type.DIRECT ||
proxy.type() == Proxy.Type.SOCKS)? -1:
diff --git a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
index 820954f9613..a31a1950592 100644
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
@@ -1840,6 +1840,11 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
return host;
}
+ // ONLY used by HttpsClient to setup the URI specified hostname
+ synchronized public void setHost(String host) {
+ this.host = host;
+ }
+
/**
* Gets an input stream to read from the peer on the other side.
* Data read from this stream was always integrity protected in
diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java
new file mode 100644
index 00000000000..d8cdb2ea2c9
--- /dev/null
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java
@@ -0,0 +1,879 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
+ * @bug 6766775
+ * @author Xuelei Fan
+ */
+
+import java.net.*;
+import java.util.*;
+import java.io.*;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.KeyFactory;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import java.math.BigInteger;
+
+import sun.security.ssl.SSLSocketImpl;
+
+/*
+ * Certificates and key used in the test.
+ *
+ * TLS server certificate:
+ * server private key:
+ * -----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,D9AE407F6D0E389A
+ *
+ * WPrA7TFol/cQCcp9oHnXWNpYlvRbbIcQj0m+RKT2Iuzfus+DHt3Zadf8nJpKfX2e
+ * h2rnhlzCN9M7djRDooZKDOPCsdBn51Au7HlZF3S3Opgo7D8XFM1a8t1Je4ke14oI
+ * nw6QKYsBblRziPnP2PZ0zvX24nOv7bbY8beynlJHGs00VWSFdoH2DS0aE1p6D+3n
+ * ptJuJ75dVfZFK4X7162APlNXevX8D6PEQpSiRw1rjjGGcnvQ4HdWk3BxDVDcCNJb
+ * Y1aGNRxsjTDvPi3R9Qx2M+W03QzEPx4SR3ZHVskeSJHaetM0TM/w/45Paq4GokXP
+ * ZeTnbEx1xmjkA7h+t4doLL4watx5F6yLsJzu8xB3lt/1EtmkYtLz1t7X4BetPAXz
+ * zS69X/VwhKfsOI3qXBWuL2oHPyhDmT1gcaUQwEPSV6ogHEEQEDXdiUS8heNK13KF
+ * TCQYFkETvV2BLxUhV1hypPzRQ6tUpJiAbD5KmoK2lD9slshG2QtvKQq0/bgkDY5J
+ * LhDHV2dtcZ3kDPkkZXpbcJQvoeH3d09C5sIsuTFo2zgNR6oETHUc5TzP6FY2YYRa
+ * QcK5HcmtsRRiXFm01ac+aMejJUIujjFt84SiKWT/73vC8AmY4tYcJBLjCg4XIxSH
+ * fdDFLL1YZENNO5ivlp8mdiHqcawx+36L7DrEZQ8RZt6cqST5t/+XTdM74s6k81GT
+ * pNsa82P2K2zmIUZ/DL2mKjW1vfRByw1NQFEBkN3vdyZxYfM/JyUzX4hbjXBEkh9Q
+ * QYrcwLKLjis2QzSvK04B3bvRzRb+4ocWiso8ZPAXAIxZFBWDpTMM2A==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICXAIBAAKBgQClrFscN6LdmYktsnm4j9VIpecchBeNaZzGrG358h0fORna03Ie
+ * buxEzHCk3LoAMPagTz1UemFqzFfQCn+VKBg/mtmU8hvIJIh+/p0PPftXUwizIDPU
+ * PxdHFNHN6gjYDnVOr77M0uyvqXpJ38LZrLgkQJCmA1Yq0DAFQCxPq9l0iQIDAQAB
+ * AoGAbqcbg1E1mkR99uOJoNeQYKFOJyGiiXTMnXV1TseC4+PDfQBU7Dax35GcesBi
+ * CtapIpFKKS5D+ozY6b7ZT8ojxuQ/uHLPAvz0WDR3ds4iRF8tyu71Q1ZHcQsJa17y
+ * yO7UbkSSKn/Mp9Rb+/dKqftUGNXVFLqgHBOzN2s3We3bbbECQQDYBPKOg3hkaGHo
+ * OhpHKqtQ6EVkldihG/3i4WejRonelXN+HRh1KrB2HBx0M8D/qAzP1i3rNSlSHer4
+ * 59YRTJnHAkEAxFX/sVYSn07BHv9Zhn6XXct/Cj43z/tKNbzlNbcxqQwQerw3IH51
+ * 8UH2YOA+GD3lXbKp+MytoFLWv8zg4YT/LwJAfqan75Z1R6lLffRS49bIiq8jwE16
+ * rTrUJ+kv8jKxMqc9B3vXkxpsS1M/+4E8bqgAmvpgAb8xcsvHsBd9ErdukQJBAKs2
+ * j67W75BrPjBI34pQ1LEfp56IGWXOrq1kF8IbCjxv3+MYRT6Z6UJFkpRymNPNDjsC
+ * dgUYgITiGJHUGXuw3lMCQHEHqo9ZtXz92yFT+VhsNc29B8m/sqUJdtCcMd/jGpAF
+ * u6GHufjqIZBpQsk63wbwESAPZZ+kk1O1kS5GIRLX608=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 6e:a7:1b:83:51:35:9a:44:7d:f6:e3:89:a0:d7:90:
+ * 60:a1:4e:27:21:a2:89:74:cc:9d:75:75:4e:c7:82:
+ * e3:e3:c3:7d:00:54:ec:36:b1:df:91:9c:7a:c0:62:
+ * 0a:d6:a9:22:91:4a:29:2e:43:fa:8c:d8:e9:be:d9:
+ * 4f:ca:23:c6:e4:3f:b8:72:cf:02:fc:f4:58:34:77:
+ * 76:ce:22:44:5f:2d:ca:ee:f5:43:56:47:71:0b:09:
+ * 6b:5e:f2:c8:ee:d4:6e:44:92:2a:7f:cc:a7:d4:5b:
+ * fb:f7:4a:a9:fb:54:18:d5:d5:14:ba:a0:1c:13:b3:
+ * 37:6b:37:59:ed:db:6d:b1
+ * prime1:
+ * 00:d8:04:f2:8e:83:78:64:68:61:e8:3a:1a:47:2a:
+ * ab:50:e8:45:64:95:d8:a1:1b:fd:e2:e1:67:a3:46:
+ * 89:de:95:73:7e:1d:18:75:2a:b0:76:1c:1c:74:33:
+ * c0:ff:a8:0c:cf:d6:2d:eb:35:29:52:1d:ea:f8:e7:
+ * d6:11:4c:99:c7
+ * prime2:
+ * 00:c4:55:ff:b1:56:12:9f:4e:c1:1e:ff:59:86:7e:
+ * 97:5d:cb:7f:0a:3e:37:cf:fb:4a:35:bc:e5:35:b7:
+ * 31:a9:0c:10:7a:bc:37:20:7e:75:f1:41:f6:60:e0:
+ * 3e:18:3d:e5:5d:b2:a9:f8:cc:ad:a0:52:d6:bf:cc:
+ * e0:e1:84:ff:2f
+ * exponent1:
+ * 7e:a6:a7:ef:96:75:47:a9:4b:7d:f4:52:e3:d6:c8:
+ * 8a:af:23:c0:4d:7a:ad:3a:d4:27:e9:2f:f2:32:b1:
+ * 32:a7:3d:07:7b:d7:93:1a:6c:4b:53:3f:fb:81:3c:
+ * 6e:a8:00:9a:fa:60:01:bf:31:72:cb:c7:b0:17:7d:
+ * 12:b7:6e:91
+ * exponent2:
+ * 00:ab:36:8f:ae:d6:ef:90:6b:3e:30:48:df:8a:50:
+ * d4:b1:1f:a7:9e:88:19:65:ce:ae:ad:64:17:c2:1b:
+ * 0a:3c:6f:df:e3:18:45:3e:99:e9:42:45:92:94:72:
+ * 98:d3:cd:0e:3b:02:76:05:18:80:84:e2:18:91:d4:
+ * 19:7b:b0:de:53
+ * coefficient:
+ * 71:07:aa:8f:59:b5:7c:fd:db:21:53:f9:58:6c:35:
+ * cd:bd:07:c9:bf:b2:a5:09:76:d0:9c:31:df:e3:1a:
+ * 90:05:bb:a1:87:b9:f8:ea:21:90:69:42:c9:3a:df:
+ * 06:f0:11:20:0f:65:9f:a4:93:53:b5:91:2e:46:21:
+ * 12:d7:eb:4f
+ *
+ *
+ * server certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 8 (0x8)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:43:04 2008 GMT
+ * Not After : Aug 25 03:43:04 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Server, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * ED:6E:DB:F4:B5:56:C8:FB:1A:06:61:3F:0F:08:BB:A6:04:D8:16:54
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * DNS:localhost
+ * Signature Algorithm: md5WithRSAEncryption0
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICpDCCAg2gAwIBAgIBCDANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMDRaFw0yODA4MjUwMzQzMDRaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3
+ * ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6
+ * YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS
+ * 7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjczBxMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh
+ * bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAoqVTciHtcvsUj+YaTct8tUh3aTCsKsac
+ * PHhfQ+ObjiXSgxsKYTX7ym/wk/wvlbUcbqLKxsu7qrcJitH+H9heV1hEHEu65Uoi
+ * nRugFruyOrwvAylV8Cm2af7ddilmYJ+sdJA6N2M3xJRxR0G2LFHEXDNEjYReyexn
+ * JqCpf5uZGOo=
+ * -----END CERTIFICATE-----
+ *
+ *
+ * TLS client certificate:
+ * client private key:
+ * ----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,FA2A435CD35A9390
+ *
+ * Z+Y2uaETbsUWIyJUyVu1UV2G4rgFYJyACZT6Tp1KjRtxflSh2kXkJ9MpuXMXA0V4
+ * Yy3fDzPqCL9NJmQAYRlAx/W/+j4F5EyMWDIx8fUxzONRZyoiwF7jLm+KscAfv6Pf
+ * q7ItWOdj3z7IYrwlB8YIGd3F2cDKT3S+lYRk7rKb/qT7itbuHnY4Ardh3yl+MZak
+ * jBp+ELUlRsUqSr1V0LoM+0rCCykarpyfhpxEcqsrl0v9Cyi5uhU50/oKv5zql3SH
+ * l2ImgDjp3batAs8+Bd4NF2aqi0a7Hy44JUHxRm4caZryU/i/D9N1MbuM6882HLat
+ * 5N0G+NaIUfywa8mjwq2D5aiit18HqKA6XeRRYeJ5Dvu9DCO4GeFSwcUFIBMI0L46
+ * 7s114+oDodg57pMgITi+04vmUxvqlN9aiyd7f5Fgd7PeHGeOdbMz1NaJLJaPI9++
+ * NakK8eK9iwT/Gdq0Uap5/CHW7vCT5PO+h3HY0STH0lWStXhdWnFO04zTdywsbSp+
+ * DLpHeFT66shfeUlxR0PsCbG9vPRt/QmGLeYQZITppWo/ylSq4j+pRIuXvuWHdBRN
+ * rTZ8QF4Y7AxQUXVz1j1++s6ZMHTzaK2i9HrhmDs1MbJl+QwWre3Xpv3LvTVz3k5U
+ * wX8kuY1m3STt71QCaRWENq5sRaMImLxZbxc/ivFl9RAzUqo4NCxLod/QgA4iLqtO
+ * ztnlpzwlC/F8HbQ1oqYWwnZAPhzU/cULtstl+Yrws2c2atO323LbPXZqbASySgig
+ * sNpFXQMObdfP6LN23bY+1SvtK7V4NUTNhpdIc6INQAQ=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICWwIBAAKBgQC78EA2rCZUTvSjWgAvaSFvuXo6k+yi9uGOx2PYLxIwmS6w8o/4
+ * Jy0keCiE9wG/jUR53TvSVfPOPLJbIX3v/TNKsaP/xsibuQ98QTWX+ds6BWAFFa9Z
+ * F5KjEK0WHOQHU6+odqJWKpLT+SjgeM9eH0irXBnd4WdDunWN9YKsQ5JEGwIDAQAB
+ * AoGAEbdqNj0wN85hnWyEi/ObJU8UyKTdL9eaF72QGfcF/fLSxfd3vurihIeXOkGW
+ * tpn4lIxYcVGM9CognhqgJpl11jFTQzn1KqZ+NEJRKkCHA4hDabKJbSC9fXHvRwrf
+ * BsFpZqgiNxp3HseUTiwnaUVeyPgMt/jAj5nB5Sib+UyUxrECQQDnNQBiF2aifEg6
+ * zbJOOC7he5CHAdkFxSxWVFVHL6EfXfqdLVkUohMbgZv+XxyIeU2biOExSg49Kds3
+ * FOKgTau1AkEA0Bd1haj6QuCo8I0AXm2WO+MMTZMTvtHD/bGjKNM+fT4I8rKYnQRX
+ * 1acHdqS9Xx2rNJqZgkMmpESIdPR2fc4yjwJALFeM6EMmqvj8/VIf5UJ/Mz14fXwM
+ * PEARfckUxd9LnnFutCBTWlKvKXJVEZb6KO5ixPaegc57Jp3Vbh3yTN44lQJADD/1
+ * SSMDaIB1MYP7a5Oj7m6VQNPRq8AJe5vDcRnOae0G9dKRrVyeFxO4GsHj6/+BHp2j
+ * P8nYMn9eURQ7DXjf/QJAAQzMlWnKGSO8pyTDtnQx3hRMoUkOEhmNq4bQhLkYqtnY
+ * FcqpUQ2qMjW+NiNWk5HnTrMS3L9EdJobMUzaNZLy4w==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 11:b7:6a:36:3d:30:37:ce:61:9d:6c:84:8b:f3:9b:
+ * 25:4f:14:c8:a4:dd:2f:d7:9a:17:bd:90:19:f7:05:
+ * fd:f2:d2:c5:f7:77:be:ea:e2:84:87:97:3a:41:96:
+ * b6:99:f8:94:8c:58:71:51:8c:f4:2a:20:9e:1a:a0:
+ * 26:99:75:d6:31:53:43:39:f5:2a:a6:7e:34:42:51:
+ * 2a:40:87:03:88:43:69:b2:89:6d:20:bd:7d:71:ef:
+ * 47:0a:df:06:c1:69:66:a8:22:37:1a:77:1e:c7:94:
+ * 4e:2c:27:69:45:5e:c8:f8:0c:b7:f8:c0:8f:99:c1:
+ * e5:28:9b:f9:4c:94:c6:b1
+ * prime1:
+ * 00:e7:35:00:62:17:66:a2:7c:48:3a:cd:b2:4e:38:
+ * 2e:e1:7b:90:87:01:d9:05:c5:2c:56:54:55:47:2f:
+ * a1:1f:5d:fa:9d:2d:59:14:a2:13:1b:81:9b:fe:5f:
+ * 1c:88:79:4d:9b:88:e1:31:4a:0e:3d:29:db:37:14:
+ * e2:a0:4d:ab:b5
+ * prime2:
+ * 00:d0:17:75:85:a8:fa:42:e0:a8:f0:8d:00:5e:6d:
+ * 96:3b:e3:0c:4d:93:13:be:d1:c3:fd:b1:a3:28:d3:
+ * 3e:7d:3e:08:f2:b2:98:9d:04:57:d5:a7:07:76:a4:
+ * bd:5f:1d:ab:34:9a:99:82:43:26:a4:44:88:74:f4:
+ * 76:7d:ce:32:8f
+ * exponent1:
+ * 2c:57:8c:e8:43:26:aa:f8:fc:fd:52:1f:e5:42:7f:
+ * 33:3d:78:7d:7c:0c:3c:40:11:7d:c9:14:c5:df:4b:
+ * 9e:71:6e:b4:20:53:5a:52:af:29:72:55:11:96:fa:
+ * 28:ee:62:c4:f6:9e:81:ce:7b:26:9d:d5:6e:1d:f2:
+ * 4c:de:38:95
+ * exponent2:
+ * 0c:3f:f5:49:23:03:68:80:75:31:83:fb:6b:93:a3:
+ * ee:6e:95:40:d3:d1:ab:c0:09:7b:9b:c3:71:19:ce:
+ * 69:ed:06:f5:d2:91:ad:5c:9e:17:13:b8:1a:c1:e3:
+ * eb:ff:81:1e:9d:a3:3f:c9:d8:32:7f:5e:51:14:3b:
+ * 0d:78:df:fd
+ * coefficient:
+ * 01:0c:cc:95:69:ca:19:23:bc:a7:24:c3:b6:74:31:
+ * de:14:4c:a1:49:0e:12:19:8d:ab:86:d0:84:b9:18:
+ * aa:d9:d8:15:ca:a9:51:0d:aa:32:35:be:36:23:56:
+ * 93:91:e7:4e:b3:12:dc:bf:44:74:9a:1b:31:4c:da:
+ * 35:92:f2:e3
+ *
+ * client certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 9 (0x9)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:43:24 2008 GMT
+ * Not After : Aug 25 03:43:24 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Client, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * CD:BB:C8:85:AA:91:BD:FD:1D:BE:CD:67:7C:FF:B3:E9:4C:A8:22:E6
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * DNS:localhost
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICpDCCAg2gAwIBAgIBCTANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMjRaFw0yODA4MjUwMzQzMjRaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas
+ * JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV
+ * 8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq
+ * ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjczBxMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh
+ * bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAm25gJyqW1JznQ1EyOtTGswBVwfgBOf+F
+ * HJuBTcflYQLbTD/AETPQJGvZU9tdhuLtbG3OPhR7vSY8zeAbfM3dbH7QFr3r47Gj
+ * XEH7qM/MX+Z3ifVaC4MeJmrYQkYFSuKeyyKpdRVX4w4nnFHF6OsNASsYrMW6LpxN
+ * cl/epUcHL7E=
+ * -----END CERTIFICATE-----
+ *
+ *
+ *
+ * Trusted CA certificate:
+ * Certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 0 (0x0)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 02:43:36 2008 GMT
+ * Not After : Aug 25 02:43:36 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:cb:c4:38:20:07:be:88:a7:93:b0:a1:43:51:2d:
+ * d7:8e:85:af:54:dd:ad:a2:7b:23:5b:cf:99:13:53:
+ * 99:45:7d:ee:6d:ba:2d:bf:e3:ad:6e:3d:9f:1a:f9:
+ * 03:97:e0:17:55:ae:11:26:57:de:01:29:8e:05:3f:
+ * 21:f7:e7:36:e8:2e:37:d7:48:ac:53:d6:60:0e:c7:
+ * 50:6d:f6:c5:85:f7:8b:a6:c5:91:35:72:3c:94:ee:
+ * f1:17:f0:71:e3:ec:1b:ce:ca:4e:40:42:b0:6d:ee:
+ * 6a:0e:d6:e5:ad:3c:0f:c9:ba:82:4f:78:f8:89:97:
+ * 89:2a:95:12:4c:d8:09:2a:e9
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Subject Key Identifier:
+ * FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * DirName:/C=US/ST=Some-State/L=Some-City/O=Some-Org
+ * serial:00
+ *
+ * X509v3 Basic Constraints:
+ * CA:TRUE
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
+ * gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX
+ * 4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj
+ * 7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G
+ * A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ
+ * hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt
+ * U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw
+ * DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA
+ * ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ
+ * LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P
+ * 6Mvf0r1PNTY2hwTJLJmKtg==
+ * -----END CERTIFICATE---
+ */
+
+
+public class DNSIdentities {
+ static Map cookies;
+ ServerSocket ss;
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+
+ /*
+ * Where do we find the keystores?
+ */
+ static String trusedCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n" +
+ "gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX\n" +
+ "4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj\n" +
+ "7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G\n" +
+ "A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ\n" +
+ "hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt\n" +
+ "U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw\n" +
+ "DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA\n" +
+ "ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ\n" +
+ "LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P\n" +
+ "6Mvf0r1PNTY2hwTJLJmKtg==\n" +
+ "-----END CERTIFICATE-----";
+
+ static String serverCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICpDCCAg2gAwIBAgIBCDANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMDRaFw0yODA4MjUwMzQzMDRaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3\n" +
+ "ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6\n" +
+ "YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS\n" +
+ "7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjczBxMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh\n" +
+ "bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAoqVTciHtcvsUj+YaTct8tUh3aTCsKsac\n" +
+ "PHhfQ+ObjiXSgxsKYTX7ym/wk/wvlbUcbqLKxsu7qrcJitH+H9heV1hEHEu65Uoi\n" +
+ "nRugFruyOrwvAylV8Cm2af7ddilmYJ+sdJA6N2M3xJRxR0G2LFHEXDNEjYReyexn\n" +
+ "JqCpf5uZGOo=\n" +
+ "-----END CERTIFICATE-----";
+
+ static String clientCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICpDCCAg2gAwIBAgIBCTANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMjRaFw0yODA4MjUwMzQzMjRaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas\n" +
+ "JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV\n" +
+ "8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq\n" +
+ "ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjczBxMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh\n" +
+ "bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAm25gJyqW1JznQ1EyOtTGswBVwfgBOf+F\n" +
+ "HJuBTcflYQLbTD/AETPQJGvZU9tdhuLtbG3OPhR7vSY8zeAbfM3dbH7QFr3r47Gj\n" +
+ "XEH7qM/MX+Z3ifVaC4MeJmrYQkYFSuKeyyKpdRVX4w4nnFHF6OsNASsYrMW6LpxN\n" +
+ "cl/epUcHL7E=\n" +
+ "-----END CERTIFICATE-----";
+
+ static byte serverPrivateExponent[] = {
+ (byte)0x6e, (byte)0xa7, (byte)0x1b, (byte)0x83,
+ (byte)0x51, (byte)0x35, (byte)0x9a, (byte)0x44,
+ (byte)0x7d, (byte)0xf6, (byte)0xe3, (byte)0x89,
+ (byte)0xa0, (byte)0xd7, (byte)0x90, (byte)0x60,
+ (byte)0xa1, (byte)0x4e, (byte)0x27, (byte)0x21,
+ (byte)0xa2, (byte)0x89, (byte)0x74, (byte)0xcc,
+ (byte)0x9d, (byte)0x75, (byte)0x75, (byte)0x4e,
+ (byte)0xc7, (byte)0x82, (byte)0xe3, (byte)0xe3,
+ (byte)0xc3, (byte)0x7d, (byte)0x00, (byte)0x54,
+ (byte)0xec, (byte)0x36, (byte)0xb1, (byte)0xdf,
+ (byte)0x91, (byte)0x9c, (byte)0x7a, (byte)0xc0,
+ (byte)0x62, (byte)0x0a, (byte)0xd6, (byte)0xa9,
+ (byte)0x22, (byte)0x91, (byte)0x4a, (byte)0x29,
+ (byte)0x2e, (byte)0x43, (byte)0xfa, (byte)0x8c,
+ (byte)0xd8, (byte)0xe9, (byte)0xbe, (byte)0xd9,
+ (byte)0x4f, (byte)0xca, (byte)0x23, (byte)0xc6,
+ (byte)0xe4, (byte)0x3f, (byte)0xb8, (byte)0x72,
+ (byte)0xcf, (byte)0x02, (byte)0xfc, (byte)0xf4,
+ (byte)0x58, (byte)0x34, (byte)0x77, (byte)0x76,
+ (byte)0xce, (byte)0x22, (byte)0x44, (byte)0x5f,
+ (byte)0x2d, (byte)0xca, (byte)0xee, (byte)0xf5,
+ (byte)0x43, (byte)0x56, (byte)0x47, (byte)0x71,
+ (byte)0x0b, (byte)0x09, (byte)0x6b, (byte)0x5e,
+ (byte)0xf2, (byte)0xc8, (byte)0xee, (byte)0xd4,
+ (byte)0x6e, (byte)0x44, (byte)0x92, (byte)0x2a,
+ (byte)0x7f, (byte)0xcc, (byte)0xa7, (byte)0xd4,
+ (byte)0x5b, (byte)0xfb, (byte)0xf7, (byte)0x4a,
+ (byte)0xa9, (byte)0xfb, (byte)0x54, (byte)0x18,
+ (byte)0xd5, (byte)0xd5, (byte)0x14, (byte)0xba,
+ (byte)0xa0, (byte)0x1c, (byte)0x13, (byte)0xb3,
+ (byte)0x37, (byte)0x6b, (byte)0x37, (byte)0x59,
+ (byte)0xed, (byte)0xdb, (byte)0x6d, (byte)0xb1
+ };
+
+ static byte serverModulus[] = {
+ (byte)0x00,
+ (byte)0xa5, (byte)0xac, (byte)0x5b, (byte)0x1c,
+ (byte)0x37, (byte)0xa2, (byte)0xdd, (byte)0x99,
+ (byte)0x89, (byte)0x2d, (byte)0xb2, (byte)0x79,
+ (byte)0xb8, (byte)0x8f, (byte)0xd5, (byte)0x48,
+ (byte)0xa5, (byte)0xe7, (byte)0x1c, (byte)0x84,
+ (byte)0x17, (byte)0x8d, (byte)0x69, (byte)0x9c,
+ (byte)0xc6, (byte)0xac, (byte)0x6d, (byte)0xf9,
+ (byte)0xf2, (byte)0x1d, (byte)0x1f, (byte)0x39,
+ (byte)0x19, (byte)0xda, (byte)0xd3, (byte)0x72,
+ (byte)0x1e, (byte)0x6e, (byte)0xec, (byte)0x44,
+ (byte)0xcc, (byte)0x70, (byte)0xa4, (byte)0xdc,
+ (byte)0xba, (byte)0x00, (byte)0x30, (byte)0xf6,
+ (byte)0xa0, (byte)0x4f, (byte)0x3d, (byte)0x54,
+ (byte)0x7a, (byte)0x61, (byte)0x6a, (byte)0xcc,
+ (byte)0x57, (byte)0xd0, (byte)0x0a, (byte)0x7f,
+ (byte)0x95, (byte)0x28, (byte)0x18, (byte)0x3f,
+ (byte)0x9a, (byte)0xd9, (byte)0x94, (byte)0xf2,
+ (byte)0x1b, (byte)0xc8, (byte)0x24, (byte)0x88,
+ (byte)0x7e, (byte)0xfe, (byte)0x9d, (byte)0x0f,
+ (byte)0x3d, (byte)0xfb, (byte)0x57, (byte)0x53,
+ (byte)0x08, (byte)0xb3, (byte)0x20, (byte)0x33,
+ (byte)0xd4, (byte)0x3f, (byte)0x17, (byte)0x47,
+ (byte)0x14, (byte)0xd1, (byte)0xcd, (byte)0xea,
+ (byte)0x08, (byte)0xd8, (byte)0x0e, (byte)0x75,
+ (byte)0x4e, (byte)0xaf, (byte)0xbe, (byte)0xcc,
+ (byte)0xd2, (byte)0xec, (byte)0xaf, (byte)0xa9,
+ (byte)0x7a, (byte)0x49, (byte)0xdf, (byte)0xc2,
+ (byte)0xd9, (byte)0xac, (byte)0xb8, (byte)0x24,
+ (byte)0x40, (byte)0x90, (byte)0xa6, (byte)0x03,
+ (byte)0x56, (byte)0x2a, (byte)0xd0, (byte)0x30,
+ (byte)0x05, (byte)0x40, (byte)0x2c, (byte)0x4f,
+ (byte)0xab, (byte)0xd9, (byte)0x74, (byte)0x89
+ };
+
+ static byte clientPrivateExponent[] = {
+ (byte)0x11, (byte)0xb7, (byte)0x6a, (byte)0x36,
+ (byte)0x3d, (byte)0x30, (byte)0x37, (byte)0xce,
+ (byte)0x61, (byte)0x9d, (byte)0x6c, (byte)0x84,
+ (byte)0x8b, (byte)0xf3, (byte)0x9b, (byte)0x25,
+ (byte)0x4f, (byte)0x14, (byte)0xc8, (byte)0xa4,
+ (byte)0xdd, (byte)0x2f, (byte)0xd7, (byte)0x9a,
+ (byte)0x17, (byte)0xbd, (byte)0x90, (byte)0x19,
+ (byte)0xf7, (byte)0x05, (byte)0xfd, (byte)0xf2,
+ (byte)0xd2, (byte)0xc5, (byte)0xf7, (byte)0x77,
+ (byte)0xbe, (byte)0xea, (byte)0xe2, (byte)0x84,
+ (byte)0x87, (byte)0x97, (byte)0x3a, (byte)0x41,
+ (byte)0x96, (byte)0xb6, (byte)0x99, (byte)0xf8,
+ (byte)0x94, (byte)0x8c, (byte)0x58, (byte)0x71,
+ (byte)0x51, (byte)0x8c, (byte)0xf4, (byte)0x2a,
+ (byte)0x20, (byte)0x9e, (byte)0x1a, (byte)0xa0,
+ (byte)0x26, (byte)0x99, (byte)0x75, (byte)0xd6,
+ (byte)0x31, (byte)0x53, (byte)0x43, (byte)0x39,
+ (byte)0xf5, (byte)0x2a, (byte)0xa6, (byte)0x7e,
+ (byte)0x34, (byte)0x42, (byte)0x51, (byte)0x2a,
+ (byte)0x40, (byte)0x87, (byte)0x03, (byte)0x88,
+ (byte)0x43, (byte)0x69, (byte)0xb2, (byte)0x89,
+ (byte)0x6d, (byte)0x20, (byte)0xbd, (byte)0x7d,
+ (byte)0x71, (byte)0xef, (byte)0x47, (byte)0x0a,
+ (byte)0xdf, (byte)0x06, (byte)0xc1, (byte)0x69,
+ (byte)0x66, (byte)0xa8, (byte)0x22, (byte)0x37,
+ (byte)0x1a, (byte)0x77, (byte)0x1e, (byte)0xc7,
+ (byte)0x94, (byte)0x4e, (byte)0x2c, (byte)0x27,
+ (byte)0x69, (byte)0x45, (byte)0x5e, (byte)0xc8,
+ (byte)0xf8, (byte)0x0c, (byte)0xb7, (byte)0xf8,
+ (byte)0xc0, (byte)0x8f, (byte)0x99, (byte)0xc1,
+ (byte)0xe5, (byte)0x28, (byte)0x9b, (byte)0xf9,
+ (byte)0x4c, (byte)0x94, (byte)0xc6, (byte)0xb1
+ };
+
+ static byte clientModulus[] = {
+ (byte)0x00,
+ (byte)0xbb, (byte)0xf0, (byte)0x40, (byte)0x36,
+ (byte)0xac, (byte)0x26, (byte)0x54, (byte)0x4e,
+ (byte)0xf4, (byte)0xa3, (byte)0x5a, (byte)0x00,
+ (byte)0x2f, (byte)0x69, (byte)0x21, (byte)0x6f,
+ (byte)0xb9, (byte)0x7a, (byte)0x3a, (byte)0x93,
+ (byte)0xec, (byte)0xa2, (byte)0xf6, (byte)0xe1,
+ (byte)0x8e, (byte)0xc7, (byte)0x63, (byte)0xd8,
+ (byte)0x2f, (byte)0x12, (byte)0x30, (byte)0x99,
+ (byte)0x2e, (byte)0xb0, (byte)0xf2, (byte)0x8f,
+ (byte)0xf8, (byte)0x27, (byte)0x2d, (byte)0x24,
+ (byte)0x78, (byte)0x28, (byte)0x84, (byte)0xf7,
+ (byte)0x01, (byte)0xbf, (byte)0x8d, (byte)0x44,
+ (byte)0x79, (byte)0xdd, (byte)0x3b, (byte)0xd2,
+ (byte)0x55, (byte)0xf3, (byte)0xce, (byte)0x3c,
+ (byte)0xb2, (byte)0x5b, (byte)0x21, (byte)0x7d,
+ (byte)0xef, (byte)0xfd, (byte)0x33, (byte)0x4a,
+ (byte)0xb1, (byte)0xa3, (byte)0xff, (byte)0xc6,
+ (byte)0xc8, (byte)0x9b, (byte)0xb9, (byte)0x0f,
+ (byte)0x7c, (byte)0x41, (byte)0x35, (byte)0x97,
+ (byte)0xf9, (byte)0xdb, (byte)0x3a, (byte)0x05,
+ (byte)0x60, (byte)0x05, (byte)0x15, (byte)0xaf,
+ (byte)0x59, (byte)0x17, (byte)0x92, (byte)0xa3,
+ (byte)0x10, (byte)0xad, (byte)0x16, (byte)0x1c,
+ (byte)0xe4, (byte)0x07, (byte)0x53, (byte)0xaf,
+ (byte)0xa8, (byte)0x76, (byte)0xa2, (byte)0x56,
+ (byte)0x2a, (byte)0x92, (byte)0xd3, (byte)0xf9,
+ (byte)0x28, (byte)0xe0, (byte)0x78, (byte)0xcf,
+ (byte)0x5e, (byte)0x1f, (byte)0x48, (byte)0xab,
+ (byte)0x5c, (byte)0x19, (byte)0xdd, (byte)0xe1,
+ (byte)0x67, (byte)0x43, (byte)0xba, (byte)0x75,
+ (byte)0x8d, (byte)0xf5, (byte)0x82, (byte)0xac,
+ (byte)0x43, (byte)0x92, (byte)0x44, (byte)0x1b
+ };
+
+ static char passphrase[] = "passphrase".toCharArray();
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+
+ /*
+ * Turn on SSL debugging?
+ */
+ static boolean debug = false;
+
+ private SSLServerSocket sslServerSocket = null;
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, serverCertStr,
+ serverModulus, serverPrivateExponent, passphrase);
+ SSLServerSocketFactory sslssf = context.getServerSocketFactory();
+
+ sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ sslSocket.setNeedClientAuth(true);
+ if (sslSocket instanceof SSLSocketImpl) {
+ ((SSLSocketImpl)sslSocket).trySetHostnameVerification("HTTPS");
+ }
+
+ PrintStream out =
+ new PrintStream(sslSocket.getOutputStream());
+
+ try {
+ // ignore request data
+
+ // send the response
+ out.print("HTTP/1.1 200 OK\r\n");
+ out.print("Content-Type: text/html; charset=iso-8859-1\r\n");
+ out.print("Content-Length: "+ 9 +"\r\n");
+ out.print("\r\n");
+ out.print("Testing\r\n");
+ out.flush();
+ } finally {
+ // close the socket
+ Thread.sleep(2000);
+ System.out.println("Server closing socket");
+ sslSocket.close();
+ serverReady = false;
+ }
+
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
+ clientModulus, clientPrivateExponent, passphrase);
+
+ SSLContext.setDefault(context);
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ HttpsURLConnection http = null;
+
+ /* establish http connection to server */
+ URL url = new URL("https://localhost:" + serverPort+"/");
+ System.out.println("url is "+url.toString());
+
+ http = (HttpsURLConnection)url.openConnection();
+
+ int respCode = http.getResponseCode();
+ System.out.println("respCode = "+respCode);
+
+ http.disconnect();
+ }
+
+ /*
+ * =============================================================
+ * The remainder is just support stuff
+ */
+
+ // use any free port by default
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ public static void main(String args[]) throws Exception {
+ if (debug)
+ System.setProperty("javax.net.debug", "all");
+
+ /*
+ * Start the tests.
+ */
+ new DNSIdentities();
+ }
+
+ Thread clientThread = null;
+ Thread serverThread = null;
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ DNSIdentities() throws Exception {
+ if (separateServerThread) {
+ startServer(true);
+ startClient(false);
+ } else {
+ startClient(true);
+ startServer(false);
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ serverThread.join();
+ } else {
+ clientThread.join();
+ }
+
+ /*
+ * When we get here, the test is pretty much over.
+ *
+ * If the main thread excepted, that propagates back
+ * immediately. If the other thread threw an exception, we
+ * should report back.
+ */
+ if (serverException != null)
+ throw serverException;
+ if (clientException != null)
+ throw clientException;
+ }
+
+ void startServer(boolean newThread) throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ doServerSide();
+ }
+ }
+
+ void startClient(boolean newThread) throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ doClientSide();
+ }
+ }
+
+ // get the ssl context
+ private static SSLContext getSSLContext(String trusedCertStr,
+ String keyCertStr, byte[] modulus,
+ byte[] privateExponent, char[] passphrase) throws Exception {
+
+ // generate certificate from cert string
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+ ByteArrayInputStream is =
+ new ByteArrayInputStream(trusedCertStr.getBytes());
+ Certificate trusedCert = cf.generateCertificate(is);
+ is.close();
+
+ // create a key store
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(null, null);
+
+ // import the trused cert
+ ks.setCertificateEntry("RSA Export Signer", trusedCert);
+
+ if (keyCertStr != null) {
+ // generate the private key.
+ RSAPrivateKeySpec priKeySpec = new RSAPrivateKeySpec(
+ new BigInteger(modulus),
+ new BigInteger(privateExponent));
+ KeyFactory kf = KeyFactory.getInstance("RSA");
+ RSAPrivateKey priKey =
+ (RSAPrivateKey)kf.generatePrivate(priKeySpec);
+
+ // generate certificate chain
+ is = new ByteArrayInputStream(keyCertStr.getBytes());
+ Certificate keyCert = cf.generateCertificate(is);
+ is.close();
+
+ Certificate[] chain = new Certificate[2];
+ chain[0] = keyCert;
+ chain[1] = trusedCert;
+
+ // import the key entry.
+ ks.setKeyEntry("Whatever", priKey, passphrase, chain);
+ }
+
+ // create SSL context
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+ tmf.init(ks);
+
+ SSLContext ctx = SSLContext.getInstance("TLS");
+
+ if (keyCertStr != null) {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, passphrase);
+
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ } else {
+ ctx.init(null, tmf.getTrustManagers(), null);
+ }
+
+ return ctx;
+ }
+
+}
diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java
new file mode 100644
index 00000000000..9d84eee4d00
--- /dev/null
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6771432
+ * @summary createSocket() - smpatch fails using 1.6.0_10 because of "Unconnected sockets not implemented"
+ */
+
+import javax.net.SocketFactory;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocketFactory;
+import java.security.NoSuchAlgorithmException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.URL;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpsConfigurator;
+
+/*
+ * This class tests that the HTTPS protocol handler is using its socket factory for
+ * creating new Sockets. It does this by wrapping the default SSLSocketFactory with
+ * its own socket factory, SimpleSSLSocketFactory, and verifying that when a https
+ * connection is made one of the socket factories createSocket methods, that
+ * actually creates a Socket, is being invoked by the protocol handler.
+ */
+
+public class HttpsCreateSockTest
+{
+ /*
+ * Where do we find the keystores?
+ */
+ static String pathToStores = "../../../../../../etc";
+ static String keyStoreFile = "keystore";
+ static String trustStoreFile = "truststore";
+ static String passwd = "passphrase";
+
+ com.sun.net.httpserver.HttpsServer httpsServer;
+ MyHandler httpHandler;
+
+ public static void main(String[] args) {
+ String keyFilename =
+ System.getProperty("test.src", "./") + "/" + pathToStores +
+ "/" + keyStoreFile;
+ String trustFilename =
+ System.getProperty("test.src", "./") + "/" + pathToStores +
+ "/" + trustStoreFile;
+
+ System.setProperty("javax.net.ssl.keyStore", keyFilename);
+ System.setProperty("javax.net.ssl.keyStorePassword", passwd);
+ System.setProperty("javax.net.ssl.trustStore", trustFilename);
+ System.setProperty("javax.net.ssl.trustStorePassword", passwd);
+
+ new HttpsCreateSockTest();
+ }
+
+ public HttpsCreateSockTest() {
+ try {
+ startHttpsServer();
+ doClient();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ } finally {
+ httpsServer.stop(1);
+ }
+ }
+
+ void doClient() throws IOException {
+ InetSocketAddress address = httpsServer.getAddress();
+
+ URL url = new URL("https://localhost:" + address.getPort() + "/");
+ System.out.println("trying to connect to " + url + "...");
+
+ HttpsURLConnection uc = (HttpsURLConnection) url.openConnection();
+ uc.setHostnameVerifier(new AllHostnameVerifier());
+ if (uc instanceof javax.net.ssl.HttpsURLConnection) {
+ ((javax.net.ssl.HttpsURLConnection) uc).setSSLSocketFactory(new SimpleSSLSocketFactory());
+ System.out.println("Using TestSocketFactory");
+ }
+ uc.connect();
+ System.out.println("CONNECTED " + uc);
+ System.out.println(uc.getResponseMessage());
+ uc.disconnect();
+ }
+
+ /**
+ * Https Server
+ */
+ public void startHttpsServer() throws IOException, NoSuchAlgorithmException {
+ httpsServer = com.sun.net.httpserver.HttpsServer.create(new InetSocketAddress(0), 0);
+ httpsServer.createContext("/", new MyHandler());
+ httpsServer.setHttpsConfigurator(new HttpsConfigurator(SSLContext.getDefault()));
+ httpsServer.start();
+ }
+
+ class MyHandler implements HttpHandler {
+ private String message = "This is a message!";
+
+ @Override
+ public void handle(HttpExchange t) throws IOException {
+ t.sendResponseHeaders(200, message.length());
+ BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(t.getResponseBody(), "ISO8859-1"));
+ writer.write(message, 0, message.length());
+ writer.close();
+ t.close();
+ }
+ }
+
+ /**
+ * Simple wrapper on default SSLSocketFactory
+ */
+ class SimpleSSLSocketFactory extends SSLSocketFactory
+ {
+ /*
+ * true if this factory has been used to create a new Socket, i.e.
+ * one of the SocketFactory methods has been called.
+ */
+ boolean socketCreated = false;
+
+ /*
+ * true if this factory has been used to wrap a Socket, i.e.
+ * the SSLSocketFactory method,
+ * createSocket(Socket, String, int, boolean), has been called.
+ */
+ boolean socketWrapped = false;
+
+ @Override
+ public Socket createSocket(InetAddress host, int port) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(host, port);
+ }
+
+ @Override
+ public Socket createSocket(InetAddress address, int port, InetAddress localAddress,
+ int localPort) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(address, port, localAddress, localPort);
+ }
+
+ @Override
+ public Socket createSocket(String host, int port) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(host, port);
+ }
+
+ @Override
+ public Socket createSocket(String host, int port, InetAddress localHost,
+ int localPort) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(host, port, localHost, localPort);
+ }
+
+ // methods from SSLSocketFactory
+ @Override
+ public Socket createSocket(Socket s, String host, int port,
+ boolean autoClose) throws IOException {
+ socketWrapped = true;
+ return ((SSLSocketFactory) SSLSocketFactory.getDefault()).createSocket
+ (s, host, port, autoClose);
+ }
+
+ @Override
+ public String[] getDefaultCipherSuites() {
+ return ((SSLSocketFactory) SSLSocketFactory.getDefault()).getDefaultCipherSuites();
+ }
+
+ @Override
+ public String[] getSupportedCipherSuites() {
+ return ((SSLSocketFactory) SSLSocketFactory.getDefault()).getSupportedCipherSuites();
+ }
+ }
+
+ class AllHostnameVerifier implements HostnameVerifier
+ {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ }
+}
diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java
new file mode 100644
index 00000000000..647ac67f7c0
--- /dev/null
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6614957
+ * @summary HttpsURLConnection not using the set SSLSocketFactory for creating all its Sockets
+ * @run main/othervm HttpsSocketFacTest
+ */
+
+import javax.net.SocketFactory;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocketFactory;
+import java.security.NoSuchAlgorithmException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.URL;
+import java.io.BufferedWriter;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpsConfigurator;
+
+/*
+ * This class tests that the HTTPS protocol handler is using its socket factory for
+ * creating new Sockets. It does this by wrapping the default SSLSocketFactory with
+ * its own socket factory, SimpleSSLSocketFactory, and verifying that when a https
+ * connection is made one of the socket factories createSocket methods, that
+ * actually creates a Socket, is being invoked by the protocol handler.
+ */
+
+public class HttpsSocketFacTest
+{
+ /*
+ * Where do we find the keystores?
+ */
+ static String pathToStores = "../../../../../../etc";
+ static String keyStoreFile = "keystore";
+ static String trustStoreFile = "truststore";
+ static String passwd = "passphrase";
+
+ com.sun.net.httpserver.HttpsServer httpsServer;
+ MyHandler httpHandler;
+
+ public static void main(String[] args) {
+ String keyFilename =
+ System.getProperty("test.src", "./") + "/" + pathToStores +
+ "/" + keyStoreFile;
+ String trustFilename =
+ System.getProperty("test.src", "./") + "/" + pathToStores +
+ "/" + trustStoreFile;
+
+ System.setProperty("javax.net.ssl.keyStore", keyFilename);
+ System.setProperty("javax.net.ssl.keyStorePassword", passwd);
+ System.setProperty("javax.net.ssl.trustStore", trustFilename);
+ System.setProperty("javax.net.ssl.trustStorePassword", passwd);
+
+ new HttpsSocketFacTest();
+ }
+
+ public HttpsSocketFacTest() {
+ try {
+ startHttpsServer();
+ doClient();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ } finally {
+ httpsServer.stop(1);
+ }
+ }
+
+ void doClient() throws IOException {
+ InetSocketAddress address = httpsServer.getAddress();
+ URL url = new URL("https://localhost:" + address.getPort() + "/test6614957/");
+ System.out.println("trying to connect to " + url + "...");
+
+ HttpsURLConnection uc = (HttpsURLConnection) url.openConnection();
+ SimpleSSLSocketFactory sssf = new SimpleSSLSocketFactory();
+ uc.setSSLSocketFactory(sssf);
+ uc.setHostnameVerifier(new AllHostnameVerifier());
+ InputStream is = uc.getInputStream();
+
+ byte[] ba = new byte[1024];
+ int read = 0;
+ while ((read = is.read(ba)) != -1) {
+ System.out.println(new String(ba, 0, read));
+ }
+
+ System.out.println("SimpleSSLSocketFactory.socketCreated = " + sssf.socketCreated);
+ System.out.println("SimpleSSLSocketFactory.socketWrapped = " + sssf.socketWrapped);
+
+ if (!sssf.socketCreated)
+ throw new RuntimeException("Failed: Socket Factory not being called to create Socket");
+ }
+
+ /**
+ * Https Server
+ */
+ public void startHttpsServer() throws IOException, NoSuchAlgorithmException {
+ httpsServer = com.sun.net.httpserver.HttpsServer.create(new InetSocketAddress(0), 0);
+ httpsServer.createContext("/test6614957/", new MyHandler());
+ httpsServer.setHttpsConfigurator(new HttpsConfigurator(SSLContext.getDefault()));
+ httpsServer.start();
+ }
+
+ class MyHandler implements HttpHandler {
+ private String message = "This is a message!";
+
+ @Override
+ public void handle(HttpExchange t) throws IOException {
+ t.sendResponseHeaders(200, message.length());
+ BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(t.getResponseBody(), "ISO8859-1"));
+ writer.write(message, 0, message.length());
+ writer.close();
+ t.close();
+ }
+ }
+
+ /**
+ * Simple wrapper on default SSLSocketFactory
+ */
+ class SimpleSSLSocketFactory extends SSLSocketFactory
+ {
+ /*
+ * true if this factory has been used to create a new Socket, i.e.
+ * one of the SocketFactory methods has been called.
+ */
+ boolean socketCreated = false;
+
+ /*
+ * true if this factory has been used to wrap a Socket, i.e.
+ * the SSLSocketFactory method,
+ * createSocket(Socket, String, int, boolean), has been called.
+ */
+ boolean socketWrapped = false;
+
+ // methods for SocketFactory
+ @Override
+ public Socket createSocket() throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket();
+ }
+
+ @Override
+ public Socket createSocket(InetAddress host, int port) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(host, port);
+ }
+
+ @Override
+ public Socket createSocket(InetAddress address, int port, InetAddress localAddress,
+ int localPort) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(address, port, localAddress, localPort);
+ }
+
+ @Override
+ public Socket createSocket(String host, int port) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(host, port);
+ }
+
+ @Override
+ public Socket createSocket(String host, int port, InetAddress localHost,
+ int localPort) throws IOException {
+ socketCreated = true;
+ return SocketFactory.getDefault().createSocket(host, port, localHost, localPort);
+ }
+
+ // methods from SSLSocketFactory
+ @Override
+ public Socket createSocket(Socket s, String host, int port,
+ boolean autoClose) throws IOException {
+ socketWrapped = true;
+ return ((SSLSocketFactory) SSLSocketFactory.getDefault()).createSocket
+ (s, host, port, autoClose);
+ }
+
+ @Override
+ public String[] getDefaultCipherSuites() {
+ return ((SSLSocketFactory) SSLSocketFactory.getDefault()).getDefaultCipherSuites();
+ }
+
+ @Override
+ public String[] getSupportedCipherSuites() {
+ return ((SSLSocketFactory) SSLSocketFactory.getDefault()).getSupportedCipherSuites();
+ }
+ }
+
+ class AllHostnameVerifier implements HostnameVerifier
+ {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ }
+}
diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java
new file mode 100644
index 00000000000..c4d48cc1080
--- /dev/null
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java
@@ -0,0 +1,887 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
+ * @bug 6766775
+ * @author Xuelei Fan
+ */
+
+import java.net.*;
+import java.util.*;
+import java.io.*;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.KeyFactory;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import java.math.BigInteger;
+
+import sun.security.ssl.SSLSocketImpl;
+
+/*
+ * Certificates and key used in the test.
+ *
+ * TLS server certificate:
+ * server private key:
+ * -----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,D9AE407F6D0E389A
+ *
+ * WPrA7TFol/cQCcp9oHnXWNpYlvRbbIcQj0m+RKT2Iuzfus+DHt3Zadf8nJpKfX2e
+ * h2rnhlzCN9M7djRDooZKDOPCsdBn51Au7HlZF3S3Opgo7D8XFM1a8t1Je4ke14oI
+ * nw6QKYsBblRziPnP2PZ0zvX24nOv7bbY8beynlJHGs00VWSFdoH2DS0aE1p6D+3n
+ * ptJuJ75dVfZFK4X7162APlNXevX8D6PEQpSiRw1rjjGGcnvQ4HdWk3BxDVDcCNJb
+ * Y1aGNRxsjTDvPi3R9Qx2M+W03QzEPx4SR3ZHVskeSJHaetM0TM/w/45Paq4GokXP
+ * ZeTnbEx1xmjkA7h+t4doLL4watx5F6yLsJzu8xB3lt/1EtmkYtLz1t7X4BetPAXz
+ * zS69X/VwhKfsOI3qXBWuL2oHPyhDmT1gcaUQwEPSV6ogHEEQEDXdiUS8heNK13KF
+ * TCQYFkETvV2BLxUhV1hypPzRQ6tUpJiAbD5KmoK2lD9slshG2QtvKQq0/bgkDY5J
+ * LhDHV2dtcZ3kDPkkZXpbcJQvoeH3d09C5sIsuTFo2zgNR6oETHUc5TzP6FY2YYRa
+ * QcK5HcmtsRRiXFm01ac+aMejJUIujjFt84SiKWT/73vC8AmY4tYcJBLjCg4XIxSH
+ * fdDFLL1YZENNO5ivlp8mdiHqcawx+36L7DrEZQ8RZt6cqST5t/+XTdM74s6k81GT
+ * pNsa82P2K2zmIUZ/DL2mKjW1vfRByw1NQFEBkN3vdyZxYfM/JyUzX4hbjXBEkh9Q
+ * QYrcwLKLjis2QzSvK04B3bvRzRb+4ocWiso8ZPAXAIxZFBWDpTMM2A==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICXAIBAAKBgQClrFscN6LdmYktsnm4j9VIpecchBeNaZzGrG358h0fORna03Ie
+ * buxEzHCk3LoAMPagTz1UemFqzFfQCn+VKBg/mtmU8hvIJIh+/p0PPftXUwizIDPU
+ * PxdHFNHN6gjYDnVOr77M0uyvqXpJ38LZrLgkQJCmA1Yq0DAFQCxPq9l0iQIDAQAB
+ * AoGAbqcbg1E1mkR99uOJoNeQYKFOJyGiiXTMnXV1TseC4+PDfQBU7Dax35GcesBi
+ * CtapIpFKKS5D+ozY6b7ZT8ojxuQ/uHLPAvz0WDR3ds4iRF8tyu71Q1ZHcQsJa17y
+ * yO7UbkSSKn/Mp9Rb+/dKqftUGNXVFLqgHBOzN2s3We3bbbECQQDYBPKOg3hkaGHo
+ * OhpHKqtQ6EVkldihG/3i4WejRonelXN+HRh1KrB2HBx0M8D/qAzP1i3rNSlSHer4
+ * 59YRTJnHAkEAxFX/sVYSn07BHv9Zhn6XXct/Cj43z/tKNbzlNbcxqQwQerw3IH51
+ * 8UH2YOA+GD3lXbKp+MytoFLWv8zg4YT/LwJAfqan75Z1R6lLffRS49bIiq8jwE16
+ * rTrUJ+kv8jKxMqc9B3vXkxpsS1M/+4E8bqgAmvpgAb8xcsvHsBd9ErdukQJBAKs2
+ * j67W75BrPjBI34pQ1LEfp56IGWXOrq1kF8IbCjxv3+MYRT6Z6UJFkpRymNPNDjsC
+ * dgUYgITiGJHUGXuw3lMCQHEHqo9ZtXz92yFT+VhsNc29B8m/sqUJdtCcMd/jGpAF
+ * u6GHufjqIZBpQsk63wbwESAPZZ+kk1O1kS5GIRLX608=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 6e:a7:1b:83:51:35:9a:44:7d:f6:e3:89:a0:d7:90:
+ * 60:a1:4e:27:21:a2:89:74:cc:9d:75:75:4e:c7:82:
+ * e3:e3:c3:7d:00:54:ec:36:b1:df:91:9c:7a:c0:62:
+ * 0a:d6:a9:22:91:4a:29:2e:43:fa:8c:d8:e9:be:d9:
+ * 4f:ca:23:c6:e4:3f:b8:72:cf:02:fc:f4:58:34:77:
+ * 76:ce:22:44:5f:2d:ca:ee:f5:43:56:47:71:0b:09:
+ * 6b:5e:f2:c8:ee:d4:6e:44:92:2a:7f:cc:a7:d4:5b:
+ * fb:f7:4a:a9:fb:54:18:d5:d5:14:ba:a0:1c:13:b3:
+ * 37:6b:37:59:ed:db:6d:b1
+ * prime1:
+ * 00:d8:04:f2:8e:83:78:64:68:61:e8:3a:1a:47:2a:
+ * ab:50:e8:45:64:95:d8:a1:1b:fd:e2:e1:67:a3:46:
+ * 89:de:95:73:7e:1d:18:75:2a:b0:76:1c:1c:74:33:
+ * c0:ff:a8:0c:cf:d6:2d:eb:35:29:52:1d:ea:f8:e7:
+ * d6:11:4c:99:c7
+ * prime2:
+ * 00:c4:55:ff:b1:56:12:9f:4e:c1:1e:ff:59:86:7e:
+ * 97:5d:cb:7f:0a:3e:37:cf:fb:4a:35:bc:e5:35:b7:
+ * 31:a9:0c:10:7a:bc:37:20:7e:75:f1:41:f6:60:e0:
+ * 3e:18:3d:e5:5d:b2:a9:f8:cc:ad:a0:52:d6:bf:cc:
+ * e0:e1:84:ff:2f
+ * exponent1:
+ * 7e:a6:a7:ef:96:75:47:a9:4b:7d:f4:52:e3:d6:c8:
+ * 8a:af:23:c0:4d:7a:ad:3a:d4:27:e9:2f:f2:32:b1:
+ * 32:a7:3d:07:7b:d7:93:1a:6c:4b:53:3f:fb:81:3c:
+ * 6e:a8:00:9a:fa:60:01:bf:31:72:cb:c7:b0:17:7d:
+ * 12:b7:6e:91
+ * exponent2:
+ * 00:ab:36:8f:ae:d6:ef:90:6b:3e:30:48:df:8a:50:
+ * d4:b1:1f:a7:9e:88:19:65:ce:ae:ad:64:17:c2:1b:
+ * 0a:3c:6f:df:e3:18:45:3e:99:e9:42:45:92:94:72:
+ * 98:d3:cd:0e:3b:02:76:05:18:80:84:e2:18:91:d4:
+ * 19:7b:b0:de:53
+ * coefficient:
+ * 71:07:aa:8f:59:b5:7c:fd:db:21:53:f9:58:6c:35:
+ * cd:bd:07:c9:bf:b2:a5:09:76:d0:9c:31:df:e3:1a:
+ * 90:05:bb:a1:87:b9:f8:ea:21:90:69:42:c9:3a:df:
+ * 06:f0:11:20:0f:65:9f:a4:93:53:b5:91:2e:46:21:
+ * 12:d7:eb:4f
+ *
+ *
+ * server certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 8 (0x8)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:43:04 2008 GMT
+ * Not After : Aug 25 03:43:04 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Server, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * ED:6E:DB:F4:B5:56:C8:FB:1A:06:61:3F:0F:08:BB:A6:04:D8:16:54
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * DNS:localhost
+ * Signature Algorithm: md5WithRSAEncryption0
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICpDCCAg2gAwIBAgIBCDANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMDRaFw0yODA4MjUwMzQzMDRaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3
+ * ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6
+ * YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS
+ * 7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjczBxMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh
+ * bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAoqVTciHtcvsUj+YaTct8tUh3aTCsKsac
+ * PHhfQ+ObjiXSgxsKYTX7ym/wk/wvlbUcbqLKxsu7qrcJitH+H9heV1hEHEu65Uoi
+ * nRugFruyOrwvAylV8Cm2af7ddilmYJ+sdJA6N2M3xJRxR0G2LFHEXDNEjYReyexn
+ * JqCpf5uZGOo=
+ * -----END CERTIFICATE-----
+ *
+ *
+ * TLS client certificate:
+ * client private key:
+ * ----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,FA2A435CD35A9390
+ *
+ * Z+Y2uaETbsUWIyJUyVu1UV2G4rgFYJyACZT6Tp1KjRtxflSh2kXkJ9MpuXMXA0V4
+ * Yy3fDzPqCL9NJmQAYRlAx/W/+j4F5EyMWDIx8fUxzONRZyoiwF7jLm+KscAfv6Pf
+ * q7ItWOdj3z7IYrwlB8YIGd3F2cDKT3S+lYRk7rKb/qT7itbuHnY4Ardh3yl+MZak
+ * jBp+ELUlRsUqSr1V0LoM+0rCCykarpyfhpxEcqsrl0v9Cyi5uhU50/oKv5zql3SH
+ * l2ImgDjp3batAs8+Bd4NF2aqi0a7Hy44JUHxRm4caZryU/i/D9N1MbuM6882HLat
+ * 5N0G+NaIUfywa8mjwq2D5aiit18HqKA6XeRRYeJ5Dvu9DCO4GeFSwcUFIBMI0L46
+ * 7s114+oDodg57pMgITi+04vmUxvqlN9aiyd7f5Fgd7PeHGeOdbMz1NaJLJaPI9++
+ * NakK8eK9iwT/Gdq0Uap5/CHW7vCT5PO+h3HY0STH0lWStXhdWnFO04zTdywsbSp+
+ * DLpHeFT66shfeUlxR0PsCbG9vPRt/QmGLeYQZITppWo/ylSq4j+pRIuXvuWHdBRN
+ * rTZ8QF4Y7AxQUXVz1j1++s6ZMHTzaK2i9HrhmDs1MbJl+QwWre3Xpv3LvTVz3k5U
+ * wX8kuY1m3STt71QCaRWENq5sRaMImLxZbxc/ivFl9RAzUqo4NCxLod/QgA4iLqtO
+ * ztnlpzwlC/F8HbQ1oqYWwnZAPhzU/cULtstl+Yrws2c2atO323LbPXZqbASySgig
+ * sNpFXQMObdfP6LN23bY+1SvtK7V4NUTNhpdIc6INQAQ=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICWwIBAAKBgQC78EA2rCZUTvSjWgAvaSFvuXo6k+yi9uGOx2PYLxIwmS6w8o/4
+ * Jy0keCiE9wG/jUR53TvSVfPOPLJbIX3v/TNKsaP/xsibuQ98QTWX+ds6BWAFFa9Z
+ * F5KjEK0WHOQHU6+odqJWKpLT+SjgeM9eH0irXBnd4WdDunWN9YKsQ5JEGwIDAQAB
+ * AoGAEbdqNj0wN85hnWyEi/ObJU8UyKTdL9eaF72QGfcF/fLSxfd3vurihIeXOkGW
+ * tpn4lIxYcVGM9CognhqgJpl11jFTQzn1KqZ+NEJRKkCHA4hDabKJbSC9fXHvRwrf
+ * BsFpZqgiNxp3HseUTiwnaUVeyPgMt/jAj5nB5Sib+UyUxrECQQDnNQBiF2aifEg6
+ * zbJOOC7he5CHAdkFxSxWVFVHL6EfXfqdLVkUohMbgZv+XxyIeU2biOExSg49Kds3
+ * FOKgTau1AkEA0Bd1haj6QuCo8I0AXm2WO+MMTZMTvtHD/bGjKNM+fT4I8rKYnQRX
+ * 1acHdqS9Xx2rNJqZgkMmpESIdPR2fc4yjwJALFeM6EMmqvj8/VIf5UJ/Mz14fXwM
+ * PEARfckUxd9LnnFutCBTWlKvKXJVEZb6KO5ixPaegc57Jp3Vbh3yTN44lQJADD/1
+ * SSMDaIB1MYP7a5Oj7m6VQNPRq8AJe5vDcRnOae0G9dKRrVyeFxO4GsHj6/+BHp2j
+ * P8nYMn9eURQ7DXjf/QJAAQzMlWnKGSO8pyTDtnQx3hRMoUkOEhmNq4bQhLkYqtnY
+ * FcqpUQ2qMjW+NiNWk5HnTrMS3L9EdJobMUzaNZLy4w==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 11:b7:6a:36:3d:30:37:ce:61:9d:6c:84:8b:f3:9b:
+ * 25:4f:14:c8:a4:dd:2f:d7:9a:17:bd:90:19:f7:05:
+ * fd:f2:d2:c5:f7:77:be:ea:e2:84:87:97:3a:41:96:
+ * b6:99:f8:94:8c:58:71:51:8c:f4:2a:20:9e:1a:a0:
+ * 26:99:75:d6:31:53:43:39:f5:2a:a6:7e:34:42:51:
+ * 2a:40:87:03:88:43:69:b2:89:6d:20:bd:7d:71:ef:
+ * 47:0a:df:06:c1:69:66:a8:22:37:1a:77:1e:c7:94:
+ * 4e:2c:27:69:45:5e:c8:f8:0c:b7:f8:c0:8f:99:c1:
+ * e5:28:9b:f9:4c:94:c6:b1
+ * prime1:
+ * 00:e7:35:00:62:17:66:a2:7c:48:3a:cd:b2:4e:38:
+ * 2e:e1:7b:90:87:01:d9:05:c5:2c:56:54:55:47:2f:
+ * a1:1f:5d:fa:9d:2d:59:14:a2:13:1b:81:9b:fe:5f:
+ * 1c:88:79:4d:9b:88:e1:31:4a:0e:3d:29:db:37:14:
+ * e2:a0:4d:ab:b5
+ * prime2:
+ * 00:d0:17:75:85:a8:fa:42:e0:a8:f0:8d:00:5e:6d:
+ * 96:3b:e3:0c:4d:93:13:be:d1:c3:fd:b1:a3:28:d3:
+ * 3e:7d:3e:08:f2:b2:98:9d:04:57:d5:a7:07:76:a4:
+ * bd:5f:1d:ab:34:9a:99:82:43:26:a4:44:88:74:f4:
+ * 76:7d:ce:32:8f
+ * exponent1:
+ * 2c:57:8c:e8:43:26:aa:f8:fc:fd:52:1f:e5:42:7f:
+ * 33:3d:78:7d:7c:0c:3c:40:11:7d:c9:14:c5:df:4b:
+ * 9e:71:6e:b4:20:53:5a:52:af:29:72:55:11:96:fa:
+ * 28:ee:62:c4:f6:9e:81:ce:7b:26:9d:d5:6e:1d:f2:
+ * 4c:de:38:95
+ * exponent2:
+ * 0c:3f:f5:49:23:03:68:80:75:31:83:fb:6b:93:a3:
+ * ee:6e:95:40:d3:d1:ab:c0:09:7b:9b:c3:71:19:ce:
+ * 69:ed:06:f5:d2:91:ad:5c:9e:17:13:b8:1a:c1:e3:
+ * eb:ff:81:1e:9d:a3:3f:c9:d8:32:7f:5e:51:14:3b:
+ * 0d:78:df:fd
+ * coefficient:
+ * 01:0c:cc:95:69:ca:19:23:bc:a7:24:c3:b6:74:31:
+ * de:14:4c:a1:49:0e:12:19:8d:ab:86:d0:84:b9:18:
+ * aa:d9:d8:15:ca:a9:51:0d:aa:32:35:be:36:23:56:
+ * 93:91:e7:4e:b3:12:dc:bf:44:74:9a:1b:31:4c:da:
+ * 35:92:f2:e3
+ *
+ * client certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 9 (0x9)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:43:24 2008 GMT
+ * Not After : Aug 25 03:43:24 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Client, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * CD:BB:C8:85:AA:91:BD:FD:1D:BE:CD:67:7C:FF:B3:E9:4C:A8:22:E6
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * DNS:localhost
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICpDCCAg2gAwIBAgIBCTANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMjRaFw0yODA4MjUwMzQzMjRaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas
+ * JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV
+ * 8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq
+ * ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjczBxMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh
+ * bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAm25gJyqW1JznQ1EyOtTGswBVwfgBOf+F
+ * HJuBTcflYQLbTD/AETPQJGvZU9tdhuLtbG3OPhR7vSY8zeAbfM3dbH7QFr3r47Gj
+ * XEH7qM/MX+Z3ifVaC4MeJmrYQkYFSuKeyyKpdRVX4w4nnFHF6OsNASsYrMW6LpxN
+ * cl/epUcHL7E=
+ * -----END CERTIFICATE-----
+ *
+ *
+ *
+ * Trusted CA certificate:
+ * Certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 0 (0x0)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 02:43:36 2008 GMT
+ * Not After : Aug 25 02:43:36 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:cb:c4:38:20:07:be:88:a7:93:b0:a1:43:51:2d:
+ * d7:8e:85:af:54:dd:ad:a2:7b:23:5b:cf:99:13:53:
+ * 99:45:7d:ee:6d:ba:2d:bf:e3:ad:6e:3d:9f:1a:f9:
+ * 03:97:e0:17:55:ae:11:26:57:de:01:29:8e:05:3f:
+ * 21:f7:e7:36:e8:2e:37:d7:48:ac:53:d6:60:0e:c7:
+ * 50:6d:f6:c5:85:f7:8b:a6:c5:91:35:72:3c:94:ee:
+ * f1:17:f0:71:e3:ec:1b:ce:ca:4e:40:42:b0:6d:ee:
+ * 6a:0e:d6:e5:ad:3c:0f:c9:ba:82:4f:78:f8:89:97:
+ * 89:2a:95:12:4c:d8:09:2a:e9
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Subject Key Identifier:
+ * FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * DirName:/C=US/ST=Some-State/L=Some-City/O=Some-Org
+ * serial:00
+ *
+ * X509v3 Basic Constraints:
+ * CA:TRUE
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
+ * gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX
+ * 4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj
+ * 7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G
+ * A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ
+ * hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt
+ * U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw
+ * DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA
+ * ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ
+ * LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P
+ * 6Mvf0r1PNTY2hwTJLJmKtg==
+ * -----END CERTIFICATE---
+ */
+
+
+public class IPAddressDNSIdentities {
+ static Map cookies;
+ ServerSocket ss;
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+
+ /*
+ * Where do we find the keystores?
+ */
+ static String trusedCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n" +
+ "gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX\n" +
+ "4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj\n" +
+ "7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G\n" +
+ "A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ\n" +
+ "hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt\n" +
+ "U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw\n" +
+ "DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA\n" +
+ "ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ\n" +
+ "LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P\n" +
+ "6Mvf0r1PNTY2hwTJLJmKtg==\n" +
+ "-----END CERTIFICATE-----";
+
+ static String serverCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICpDCCAg2gAwIBAgIBCDANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMDRaFw0yODA4MjUwMzQzMDRaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3\n" +
+ "ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6\n" +
+ "YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS\n" +
+ "7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjczBxMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh\n" +
+ "bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAoqVTciHtcvsUj+YaTct8tUh3aTCsKsac\n" +
+ "PHhfQ+ObjiXSgxsKYTX7ym/wk/wvlbUcbqLKxsu7qrcJitH+H9heV1hEHEu65Uoi\n" +
+ "nRugFruyOrwvAylV8Cm2af7ddilmYJ+sdJA6N2M3xJRxR0G2LFHEXDNEjYReyexn\n" +
+ "JqCpf5uZGOo=\n" +
+ "-----END CERTIFICATE-----";
+
+ static String clientCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICpDCCAg2gAwIBAgIBCTANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzQzMjRaFw0yODA4MjUwMzQzMjRaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas\n" +
+ "JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV\n" +
+ "8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq\n" +
+ "ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjczBxMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAXBgNVHREBAf8EDTALgglsb2Nh\n" +
+ "bGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAm25gJyqW1JznQ1EyOtTGswBVwfgBOf+F\n" +
+ "HJuBTcflYQLbTD/AETPQJGvZU9tdhuLtbG3OPhR7vSY8zeAbfM3dbH7QFr3r47Gj\n" +
+ "XEH7qM/MX+Z3ifVaC4MeJmrYQkYFSuKeyyKpdRVX4w4nnFHF6OsNASsYrMW6LpxN\n" +
+ "cl/epUcHL7E=\n" +
+ "-----END CERTIFICATE-----";
+
+ static byte serverPrivateExponent[] = {
+ (byte)0x6e, (byte)0xa7, (byte)0x1b, (byte)0x83,
+ (byte)0x51, (byte)0x35, (byte)0x9a, (byte)0x44,
+ (byte)0x7d, (byte)0xf6, (byte)0xe3, (byte)0x89,
+ (byte)0xa0, (byte)0xd7, (byte)0x90, (byte)0x60,
+ (byte)0xa1, (byte)0x4e, (byte)0x27, (byte)0x21,
+ (byte)0xa2, (byte)0x89, (byte)0x74, (byte)0xcc,
+ (byte)0x9d, (byte)0x75, (byte)0x75, (byte)0x4e,
+ (byte)0xc7, (byte)0x82, (byte)0xe3, (byte)0xe3,
+ (byte)0xc3, (byte)0x7d, (byte)0x00, (byte)0x54,
+ (byte)0xec, (byte)0x36, (byte)0xb1, (byte)0xdf,
+ (byte)0x91, (byte)0x9c, (byte)0x7a, (byte)0xc0,
+ (byte)0x62, (byte)0x0a, (byte)0xd6, (byte)0xa9,
+ (byte)0x22, (byte)0x91, (byte)0x4a, (byte)0x29,
+ (byte)0x2e, (byte)0x43, (byte)0xfa, (byte)0x8c,
+ (byte)0xd8, (byte)0xe9, (byte)0xbe, (byte)0xd9,
+ (byte)0x4f, (byte)0xca, (byte)0x23, (byte)0xc6,
+ (byte)0xe4, (byte)0x3f, (byte)0xb8, (byte)0x72,
+ (byte)0xcf, (byte)0x02, (byte)0xfc, (byte)0xf4,
+ (byte)0x58, (byte)0x34, (byte)0x77, (byte)0x76,
+ (byte)0xce, (byte)0x22, (byte)0x44, (byte)0x5f,
+ (byte)0x2d, (byte)0xca, (byte)0xee, (byte)0xf5,
+ (byte)0x43, (byte)0x56, (byte)0x47, (byte)0x71,
+ (byte)0x0b, (byte)0x09, (byte)0x6b, (byte)0x5e,
+ (byte)0xf2, (byte)0xc8, (byte)0xee, (byte)0xd4,
+ (byte)0x6e, (byte)0x44, (byte)0x92, (byte)0x2a,
+ (byte)0x7f, (byte)0xcc, (byte)0xa7, (byte)0xd4,
+ (byte)0x5b, (byte)0xfb, (byte)0xf7, (byte)0x4a,
+ (byte)0xa9, (byte)0xfb, (byte)0x54, (byte)0x18,
+ (byte)0xd5, (byte)0xd5, (byte)0x14, (byte)0xba,
+ (byte)0xa0, (byte)0x1c, (byte)0x13, (byte)0xb3,
+ (byte)0x37, (byte)0x6b, (byte)0x37, (byte)0x59,
+ (byte)0xed, (byte)0xdb, (byte)0x6d, (byte)0xb1
+ };
+
+ static byte serverModulus[] = {
+ (byte)0x00,
+ (byte)0xa5, (byte)0xac, (byte)0x5b, (byte)0x1c,
+ (byte)0x37, (byte)0xa2, (byte)0xdd, (byte)0x99,
+ (byte)0x89, (byte)0x2d, (byte)0xb2, (byte)0x79,
+ (byte)0xb8, (byte)0x8f, (byte)0xd5, (byte)0x48,
+ (byte)0xa5, (byte)0xe7, (byte)0x1c, (byte)0x84,
+ (byte)0x17, (byte)0x8d, (byte)0x69, (byte)0x9c,
+ (byte)0xc6, (byte)0xac, (byte)0x6d, (byte)0xf9,
+ (byte)0xf2, (byte)0x1d, (byte)0x1f, (byte)0x39,
+ (byte)0x19, (byte)0xda, (byte)0xd3, (byte)0x72,
+ (byte)0x1e, (byte)0x6e, (byte)0xec, (byte)0x44,
+ (byte)0xcc, (byte)0x70, (byte)0xa4, (byte)0xdc,
+ (byte)0xba, (byte)0x00, (byte)0x30, (byte)0xf6,
+ (byte)0xa0, (byte)0x4f, (byte)0x3d, (byte)0x54,
+ (byte)0x7a, (byte)0x61, (byte)0x6a, (byte)0xcc,
+ (byte)0x57, (byte)0xd0, (byte)0x0a, (byte)0x7f,
+ (byte)0x95, (byte)0x28, (byte)0x18, (byte)0x3f,
+ (byte)0x9a, (byte)0xd9, (byte)0x94, (byte)0xf2,
+ (byte)0x1b, (byte)0xc8, (byte)0x24, (byte)0x88,
+ (byte)0x7e, (byte)0xfe, (byte)0x9d, (byte)0x0f,
+ (byte)0x3d, (byte)0xfb, (byte)0x57, (byte)0x53,
+ (byte)0x08, (byte)0xb3, (byte)0x20, (byte)0x33,
+ (byte)0xd4, (byte)0x3f, (byte)0x17, (byte)0x47,
+ (byte)0x14, (byte)0xd1, (byte)0xcd, (byte)0xea,
+ (byte)0x08, (byte)0xd8, (byte)0x0e, (byte)0x75,
+ (byte)0x4e, (byte)0xaf, (byte)0xbe, (byte)0xcc,
+ (byte)0xd2, (byte)0xec, (byte)0xaf, (byte)0xa9,
+ (byte)0x7a, (byte)0x49, (byte)0xdf, (byte)0xc2,
+ (byte)0xd9, (byte)0xac, (byte)0xb8, (byte)0x24,
+ (byte)0x40, (byte)0x90, (byte)0xa6, (byte)0x03,
+ (byte)0x56, (byte)0x2a, (byte)0xd0, (byte)0x30,
+ (byte)0x05, (byte)0x40, (byte)0x2c, (byte)0x4f,
+ (byte)0xab, (byte)0xd9, (byte)0x74, (byte)0x89
+ };
+
+ static byte clientPrivateExponent[] = {
+ (byte)0x11, (byte)0xb7, (byte)0x6a, (byte)0x36,
+ (byte)0x3d, (byte)0x30, (byte)0x37, (byte)0xce,
+ (byte)0x61, (byte)0x9d, (byte)0x6c, (byte)0x84,
+ (byte)0x8b, (byte)0xf3, (byte)0x9b, (byte)0x25,
+ (byte)0x4f, (byte)0x14, (byte)0xc8, (byte)0xa4,
+ (byte)0xdd, (byte)0x2f, (byte)0xd7, (byte)0x9a,
+ (byte)0x17, (byte)0xbd, (byte)0x90, (byte)0x19,
+ (byte)0xf7, (byte)0x05, (byte)0xfd, (byte)0xf2,
+ (byte)0xd2, (byte)0xc5, (byte)0xf7, (byte)0x77,
+ (byte)0xbe, (byte)0xea, (byte)0xe2, (byte)0x84,
+ (byte)0x87, (byte)0x97, (byte)0x3a, (byte)0x41,
+ (byte)0x96, (byte)0xb6, (byte)0x99, (byte)0xf8,
+ (byte)0x94, (byte)0x8c, (byte)0x58, (byte)0x71,
+ (byte)0x51, (byte)0x8c, (byte)0xf4, (byte)0x2a,
+ (byte)0x20, (byte)0x9e, (byte)0x1a, (byte)0xa0,
+ (byte)0x26, (byte)0x99, (byte)0x75, (byte)0xd6,
+ (byte)0x31, (byte)0x53, (byte)0x43, (byte)0x39,
+ (byte)0xf5, (byte)0x2a, (byte)0xa6, (byte)0x7e,
+ (byte)0x34, (byte)0x42, (byte)0x51, (byte)0x2a,
+ (byte)0x40, (byte)0x87, (byte)0x03, (byte)0x88,
+ (byte)0x43, (byte)0x69, (byte)0xb2, (byte)0x89,
+ (byte)0x6d, (byte)0x20, (byte)0xbd, (byte)0x7d,
+ (byte)0x71, (byte)0xef, (byte)0x47, (byte)0x0a,
+ (byte)0xdf, (byte)0x06, (byte)0xc1, (byte)0x69,
+ (byte)0x66, (byte)0xa8, (byte)0x22, (byte)0x37,
+ (byte)0x1a, (byte)0x77, (byte)0x1e, (byte)0xc7,
+ (byte)0x94, (byte)0x4e, (byte)0x2c, (byte)0x27,
+ (byte)0x69, (byte)0x45, (byte)0x5e, (byte)0xc8,
+ (byte)0xf8, (byte)0x0c, (byte)0xb7, (byte)0xf8,
+ (byte)0xc0, (byte)0x8f, (byte)0x99, (byte)0xc1,
+ (byte)0xe5, (byte)0x28, (byte)0x9b, (byte)0xf9,
+ (byte)0x4c, (byte)0x94, (byte)0xc6, (byte)0xb1
+ };
+
+ static byte clientModulus[] = {
+ (byte)0x00,
+ (byte)0xbb, (byte)0xf0, (byte)0x40, (byte)0x36,
+ (byte)0xac, (byte)0x26, (byte)0x54, (byte)0x4e,
+ (byte)0xf4, (byte)0xa3, (byte)0x5a, (byte)0x00,
+ (byte)0x2f, (byte)0x69, (byte)0x21, (byte)0x6f,
+ (byte)0xb9, (byte)0x7a, (byte)0x3a, (byte)0x93,
+ (byte)0xec, (byte)0xa2, (byte)0xf6, (byte)0xe1,
+ (byte)0x8e, (byte)0xc7, (byte)0x63, (byte)0xd8,
+ (byte)0x2f, (byte)0x12, (byte)0x30, (byte)0x99,
+ (byte)0x2e, (byte)0xb0, (byte)0xf2, (byte)0x8f,
+ (byte)0xf8, (byte)0x27, (byte)0x2d, (byte)0x24,
+ (byte)0x78, (byte)0x28, (byte)0x84, (byte)0xf7,
+ (byte)0x01, (byte)0xbf, (byte)0x8d, (byte)0x44,
+ (byte)0x79, (byte)0xdd, (byte)0x3b, (byte)0xd2,
+ (byte)0x55, (byte)0xf3, (byte)0xce, (byte)0x3c,
+ (byte)0xb2, (byte)0x5b, (byte)0x21, (byte)0x7d,
+ (byte)0xef, (byte)0xfd, (byte)0x33, (byte)0x4a,
+ (byte)0xb1, (byte)0xa3, (byte)0xff, (byte)0xc6,
+ (byte)0xc8, (byte)0x9b, (byte)0xb9, (byte)0x0f,
+ (byte)0x7c, (byte)0x41, (byte)0x35, (byte)0x97,
+ (byte)0xf9, (byte)0xdb, (byte)0x3a, (byte)0x05,
+ (byte)0x60, (byte)0x05, (byte)0x15, (byte)0xaf,
+ (byte)0x59, (byte)0x17, (byte)0x92, (byte)0xa3,
+ (byte)0x10, (byte)0xad, (byte)0x16, (byte)0x1c,
+ (byte)0xe4, (byte)0x07, (byte)0x53, (byte)0xaf,
+ (byte)0xa8, (byte)0x76, (byte)0xa2, (byte)0x56,
+ (byte)0x2a, (byte)0x92, (byte)0xd3, (byte)0xf9,
+ (byte)0x28, (byte)0xe0, (byte)0x78, (byte)0xcf,
+ (byte)0x5e, (byte)0x1f, (byte)0x48, (byte)0xab,
+ (byte)0x5c, (byte)0x19, (byte)0xdd, (byte)0xe1,
+ (byte)0x67, (byte)0x43, (byte)0xba, (byte)0x75,
+ (byte)0x8d, (byte)0xf5, (byte)0x82, (byte)0xac,
+ (byte)0x43, (byte)0x92, (byte)0x44, (byte)0x1b
+ };
+
+ static char passphrase[] = "passphrase".toCharArray();
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+
+ /*
+ * Turn on SSL debugging?
+ */
+ static boolean debug = false;
+
+ private SSLServerSocket sslServerSocket = null;
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, serverCertStr,
+ serverModulus, serverPrivateExponent, passphrase);
+ SSLServerSocketFactory sslssf = context.getServerSocketFactory();
+
+ sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ sslSocket.setNeedClientAuth(true);
+ if (sslSocket instanceof SSLSocketImpl) {
+ ((SSLSocketImpl)sslSocket).trySetHostnameVerification("HTTPS");
+ }
+
+ PrintStream out =
+ new PrintStream(sslSocket.getOutputStream());
+
+ try {
+ // ignore request data
+
+ // send the response
+ out.print("HTTP/1.1 200 OK\r\n");
+ out.print("Content-Type: text/html; charset=iso-8859-1\r\n");
+ out.print("Content-Length: "+ 9 +"\r\n");
+ out.print("\r\n");
+ out.print("Testing\r\n");
+ out.flush();
+ } finally {
+ // close the socket
+ Thread.sleep(2000);
+ System.out.println("Server closing socket");
+ sslSocket.close();
+ serverReady = false;
+ }
+
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
+ clientModulus, clientPrivateExponent, passphrase);
+
+ SSLContext.setDefault(context);
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ HttpsURLConnection http = null;
+
+ /* establish http connection to server */
+ URL url = new URL("https://127.0.0.1:" + serverPort+"/");
+ System.out.println("url is "+url.toString());
+
+ try {
+ http = (HttpsURLConnection)url.openConnection();
+
+ int respCode = http.getResponseCode();
+ System.out.println("respCode = "+respCode);
+
+ throw new Exception("Unexpectly found subject alternative name " +
+ "matching IP address");
+ } catch (SSLHandshakeException sslhe) {
+ // no subject alternative names matching IP address 127.0.0.1 found
+ // that's the expected exception, ignore it.
+ } finally {
+ http.disconnect();
+ }
+ }
+
+ /*
+ * =============================================================
+ * The remainder is just support stuff
+ */
+
+ // use any free port by default
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ public static void main(String args[]) throws Exception {
+ if (debug)
+ System.setProperty("javax.net.debug", "all");
+
+ /*
+ * Start the tests.
+ */
+ new IPAddressDNSIdentities();
+ }
+
+ Thread clientThread = null;
+ Thread serverThread = null;
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ IPAddressDNSIdentities() throws Exception {
+ if (separateServerThread) {
+ startServer(true);
+ startClient(false);
+ } else {
+ startClient(true);
+ startServer(false);
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ serverThread.join();
+ } else {
+ clientThread.join();
+ }
+
+ /*
+ * When we get here, the test is pretty much over.
+ *
+ * If the main thread excepted, that propagates back
+ * immediately. If the other thread threw an exception, we
+ * should report back.
+ */
+ if (serverException != null)
+ throw serverException;
+ if (clientException != null)
+ throw clientException;
+ }
+
+ void startServer(boolean newThread) throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ doServerSide();
+ }
+ }
+
+ void startClient(boolean newThread) throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ doClientSide();
+ }
+ }
+
+ // get the ssl context
+ private static SSLContext getSSLContext(String trusedCertStr,
+ String keyCertStr, byte[] modulus,
+ byte[] privateExponent, char[] passphrase) throws Exception {
+
+ // generate certificate from cert string
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+ ByteArrayInputStream is =
+ new ByteArrayInputStream(trusedCertStr.getBytes());
+ Certificate trusedCert = cf.generateCertificate(is);
+ is.close();
+
+ // create a key store
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(null, null);
+
+ // import the trused cert
+ ks.setCertificateEntry("RSA Export Signer", trusedCert);
+
+ if (keyCertStr != null) {
+ // generate the private key.
+ RSAPrivateKeySpec priKeySpec = new RSAPrivateKeySpec(
+ new BigInteger(modulus),
+ new BigInteger(privateExponent));
+ KeyFactory kf = KeyFactory.getInstance("RSA");
+ RSAPrivateKey priKey =
+ (RSAPrivateKey)kf.generatePrivate(priKeySpec);
+
+ // generate certificate chain
+ is = new ByteArrayInputStream(keyCertStr.getBytes());
+ Certificate keyCert = cf.generateCertificate(is);
+ is.close();
+
+ Certificate[] chain = new Certificate[2];
+ chain[0] = keyCert;
+ chain[1] = trusedCert;
+
+ // import the key entry.
+ ks.setKeyEntry("Whatever", priKey, passphrase, chain);
+ }
+
+ // create SSL context
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+ tmf.init(ks);
+
+ SSLContext ctx = SSLContext.getInstance("TLS");
+
+ if (keyCertStr != null) {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, passphrase);
+
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ } else {
+ ctx.init(null, tmf.getTrustManagers(), null);
+ }
+
+ return ctx;
+ }
+
+}
diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java
new file mode 100644
index 00000000000..4bafaf24b51
--- /dev/null
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java
@@ -0,0 +1,880 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
+ * @bug 6766775
+ * @author Xuelei Fan
+ */
+
+import java.net.*;
+import java.util.*;
+import java.io.*;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.KeyFactory;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import java.math.BigInteger;
+
+import sun.security.ssl.SSLSocketImpl;
+
+/*
+ * Certificates and key used in the test.
+ *
+ * TLS server certificate:
+ * server private key:
+ * -----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,D9AE407F6D0E389A
+ *
+ * WPrA7TFol/cQCcp9oHnXWNpYlvRbbIcQj0m+RKT2Iuzfus+DHt3Zadf8nJpKfX2e
+ * h2rnhlzCN9M7djRDooZKDOPCsdBn51Au7HlZF3S3Opgo7D8XFM1a8t1Je4ke14oI
+ * nw6QKYsBblRziPnP2PZ0zvX24nOv7bbY8beynlJHGs00VWSFdoH2DS0aE1p6D+3n
+ * ptJuJ75dVfZFK4X7162APlNXevX8D6PEQpSiRw1rjjGGcnvQ4HdWk3BxDVDcCNJb
+ * Y1aGNRxsjTDvPi3R9Qx2M+W03QzEPx4SR3ZHVskeSJHaetM0TM/w/45Paq4GokXP
+ * ZeTnbEx1xmjkA7h+t4doLL4watx5F6yLsJzu8xB3lt/1EtmkYtLz1t7X4BetPAXz
+ * zS69X/VwhKfsOI3qXBWuL2oHPyhDmT1gcaUQwEPSV6ogHEEQEDXdiUS8heNK13KF
+ * TCQYFkETvV2BLxUhV1hypPzRQ6tUpJiAbD5KmoK2lD9slshG2QtvKQq0/bgkDY5J
+ * LhDHV2dtcZ3kDPkkZXpbcJQvoeH3d09C5sIsuTFo2zgNR6oETHUc5TzP6FY2YYRa
+ * QcK5HcmtsRRiXFm01ac+aMejJUIujjFt84SiKWT/73vC8AmY4tYcJBLjCg4XIxSH
+ * fdDFLL1YZENNO5ivlp8mdiHqcawx+36L7DrEZQ8RZt6cqST5t/+XTdM74s6k81GT
+ * pNsa82P2K2zmIUZ/DL2mKjW1vfRByw1NQFEBkN3vdyZxYfM/JyUzX4hbjXBEkh9Q
+ * QYrcwLKLjis2QzSvK04B3bvRzRb+4ocWiso8ZPAXAIxZFBWDpTMM2A==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICXAIBAAKBgQClrFscN6LdmYktsnm4j9VIpecchBeNaZzGrG358h0fORna03Ie
+ * buxEzHCk3LoAMPagTz1UemFqzFfQCn+VKBg/mtmU8hvIJIh+/p0PPftXUwizIDPU
+ * PxdHFNHN6gjYDnVOr77M0uyvqXpJ38LZrLgkQJCmA1Yq0DAFQCxPq9l0iQIDAQAB
+ * AoGAbqcbg1E1mkR99uOJoNeQYKFOJyGiiXTMnXV1TseC4+PDfQBU7Dax35GcesBi
+ * CtapIpFKKS5D+ozY6b7ZT8ojxuQ/uHLPAvz0WDR3ds4iRF8tyu71Q1ZHcQsJa17y
+ * yO7UbkSSKn/Mp9Rb+/dKqftUGNXVFLqgHBOzN2s3We3bbbECQQDYBPKOg3hkaGHo
+ * OhpHKqtQ6EVkldihG/3i4WejRonelXN+HRh1KrB2HBx0M8D/qAzP1i3rNSlSHer4
+ * 59YRTJnHAkEAxFX/sVYSn07BHv9Zhn6XXct/Cj43z/tKNbzlNbcxqQwQerw3IH51
+ * 8UH2YOA+GD3lXbKp+MytoFLWv8zg4YT/LwJAfqan75Z1R6lLffRS49bIiq8jwE16
+ * rTrUJ+kv8jKxMqc9B3vXkxpsS1M/+4E8bqgAmvpgAb8xcsvHsBd9ErdukQJBAKs2
+ * j67W75BrPjBI34pQ1LEfp56IGWXOrq1kF8IbCjxv3+MYRT6Z6UJFkpRymNPNDjsC
+ * dgUYgITiGJHUGXuw3lMCQHEHqo9ZtXz92yFT+VhsNc29B8m/sqUJdtCcMd/jGpAF
+ * u6GHufjqIZBpQsk63wbwESAPZZ+kk1O1kS5GIRLX608=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 6e:a7:1b:83:51:35:9a:44:7d:f6:e3:89:a0:d7:90:
+ * 60:a1:4e:27:21:a2:89:74:cc:9d:75:75:4e:c7:82:
+ * e3:e3:c3:7d:00:54:ec:36:b1:df:91:9c:7a:c0:62:
+ * 0a:d6:a9:22:91:4a:29:2e:43:fa:8c:d8:e9:be:d9:
+ * 4f:ca:23:c6:e4:3f:b8:72:cf:02:fc:f4:58:34:77:
+ * 76:ce:22:44:5f:2d:ca:ee:f5:43:56:47:71:0b:09:
+ * 6b:5e:f2:c8:ee:d4:6e:44:92:2a:7f:cc:a7:d4:5b:
+ * fb:f7:4a:a9:fb:54:18:d5:d5:14:ba:a0:1c:13:b3:
+ * 37:6b:37:59:ed:db:6d:b1
+ * prime1:
+ * 00:d8:04:f2:8e:83:78:64:68:61:e8:3a:1a:47:2a:
+ * ab:50:e8:45:64:95:d8:a1:1b:fd:e2:e1:67:a3:46:
+ * 89:de:95:73:7e:1d:18:75:2a:b0:76:1c:1c:74:33:
+ * c0:ff:a8:0c:cf:d6:2d:eb:35:29:52:1d:ea:f8:e7:
+ * d6:11:4c:99:c7
+ * prime2:
+ * 00:c4:55:ff:b1:56:12:9f:4e:c1:1e:ff:59:86:7e:
+ * 97:5d:cb:7f:0a:3e:37:cf:fb:4a:35:bc:e5:35:b7:
+ * 31:a9:0c:10:7a:bc:37:20:7e:75:f1:41:f6:60:e0:
+ * 3e:18:3d:e5:5d:b2:a9:f8:cc:ad:a0:52:d6:bf:cc:
+ * e0:e1:84:ff:2f
+ * exponent1:
+ * 7e:a6:a7:ef:96:75:47:a9:4b:7d:f4:52:e3:d6:c8:
+ * 8a:af:23:c0:4d:7a:ad:3a:d4:27:e9:2f:f2:32:b1:
+ * 32:a7:3d:07:7b:d7:93:1a:6c:4b:53:3f:fb:81:3c:
+ * 6e:a8:00:9a:fa:60:01:bf:31:72:cb:c7:b0:17:7d:
+ * 12:b7:6e:91
+ * exponent2:
+ * 00:ab:36:8f:ae:d6:ef:90:6b:3e:30:48:df:8a:50:
+ * d4:b1:1f:a7:9e:88:19:65:ce:ae:ad:64:17:c2:1b:
+ * 0a:3c:6f:df:e3:18:45:3e:99:e9:42:45:92:94:72:
+ * 98:d3:cd:0e:3b:02:76:05:18:80:84:e2:18:91:d4:
+ * 19:7b:b0:de:53
+ * coefficient:
+ * 71:07:aa:8f:59:b5:7c:fd:db:21:53:f9:58:6c:35:
+ * cd:bd:07:c9:bf:b2:a5:09:76:d0:9c:31:df:e3:1a:
+ * 90:05:bb:a1:87:b9:f8:ea:21:90:69:42:c9:3a:df:
+ * 06:f0:11:20:0f:65:9f:a4:93:53:b5:91:2e:46:21:
+ * 12:d7:eb:4f
+ *
+ *
+ * server certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 7 (0x7)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:27:57 2008 GMT
+ * Not After : Aug 25 03:27:57 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Server, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * ED:6E:DB:F4:B5:56:C8:FB:1A:06:61:3F:0F:08:BB:A6:04:D8:16:54
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * IP Address:127.0.0.1
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICnzCCAgigAwIBAgIBBzANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3NTdaFw0yODA4MjUwMzI3NTdaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3
+ * ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6
+ * YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS
+ * 7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjbjBsMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB
+ * MA0GCSqGSIb3DQEBBAUAA4GBAFJjItCtCBZcjD69wdqfIbKmRFa6eJAjR6LcoDva
+ * cKC/sDOLelpspiZ66Zb0Xdv5qQ7QrfOXt3K8QqJKRMdZLF9WfUfy0gJDM32ub91h
+ * pu+TmcGPs+6RdrAQcuvU1ZDV9X8SMj7BtKaim4d5sqFw1npncKiA5xFn8vOYwdun
+ * nZif
+ * -----END CERTIFICATE-----
+ *
+ *
+ * TLS client certificate:
+ * client private key:
+ * ----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,FA2A435CD35A9390
+ *
+ * Z+Y2uaETbsUWIyJUyVu1UV2G4rgFYJyACZT6Tp1KjRtxflSh2kXkJ9MpuXMXA0V4
+ * Yy3fDzPqCL9NJmQAYRlAx/W/+j4F5EyMWDIx8fUxzONRZyoiwF7jLm+KscAfv6Pf
+ * q7ItWOdj3z7IYrwlB8YIGd3F2cDKT3S+lYRk7rKb/qT7itbuHnY4Ardh3yl+MZak
+ * jBp+ELUlRsUqSr1V0LoM+0rCCykarpyfhpxEcqsrl0v9Cyi5uhU50/oKv5zql3SH
+ * l2ImgDjp3batAs8+Bd4NF2aqi0a7Hy44JUHxRm4caZryU/i/D9N1MbuM6882HLat
+ * 5N0G+NaIUfywa8mjwq2D5aiit18HqKA6XeRRYeJ5Dvu9DCO4GeFSwcUFIBMI0L46
+ * 7s114+oDodg57pMgITi+04vmUxvqlN9aiyd7f5Fgd7PeHGeOdbMz1NaJLJaPI9++
+ * NakK8eK9iwT/Gdq0Uap5/CHW7vCT5PO+h3HY0STH0lWStXhdWnFO04zTdywsbSp+
+ * DLpHeFT66shfeUlxR0PsCbG9vPRt/QmGLeYQZITppWo/ylSq4j+pRIuXvuWHdBRN
+ * rTZ8QF4Y7AxQUXVz1j1++s6ZMHTzaK2i9HrhmDs1MbJl+QwWre3Xpv3LvTVz3k5U
+ * wX8kuY1m3STt71QCaRWENq5sRaMImLxZbxc/ivFl9RAzUqo4NCxLod/QgA4iLqtO
+ * ztnlpzwlC/F8HbQ1oqYWwnZAPhzU/cULtstl+Yrws2c2atO323LbPXZqbASySgig
+ * sNpFXQMObdfP6LN23bY+1SvtK7V4NUTNhpdIc6INQAQ=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICWwIBAAKBgQC78EA2rCZUTvSjWgAvaSFvuXo6k+yi9uGOx2PYLxIwmS6w8o/4
+ * Jy0keCiE9wG/jUR53TvSVfPOPLJbIX3v/TNKsaP/xsibuQ98QTWX+ds6BWAFFa9Z
+ * F5KjEK0WHOQHU6+odqJWKpLT+SjgeM9eH0irXBnd4WdDunWN9YKsQ5JEGwIDAQAB
+ * AoGAEbdqNj0wN85hnWyEi/ObJU8UyKTdL9eaF72QGfcF/fLSxfd3vurihIeXOkGW
+ * tpn4lIxYcVGM9CognhqgJpl11jFTQzn1KqZ+NEJRKkCHA4hDabKJbSC9fXHvRwrf
+ * BsFpZqgiNxp3HseUTiwnaUVeyPgMt/jAj5nB5Sib+UyUxrECQQDnNQBiF2aifEg6
+ * zbJOOC7he5CHAdkFxSxWVFVHL6EfXfqdLVkUohMbgZv+XxyIeU2biOExSg49Kds3
+ * FOKgTau1AkEA0Bd1haj6QuCo8I0AXm2WO+MMTZMTvtHD/bGjKNM+fT4I8rKYnQRX
+ * 1acHdqS9Xx2rNJqZgkMmpESIdPR2fc4yjwJALFeM6EMmqvj8/VIf5UJ/Mz14fXwM
+ * PEARfckUxd9LnnFutCBTWlKvKXJVEZb6KO5ixPaegc57Jp3Vbh3yTN44lQJADD/1
+ * SSMDaIB1MYP7a5Oj7m6VQNPRq8AJe5vDcRnOae0G9dKRrVyeFxO4GsHj6/+BHp2j
+ * P8nYMn9eURQ7DXjf/QJAAQzMlWnKGSO8pyTDtnQx3hRMoUkOEhmNq4bQhLkYqtnY
+ * FcqpUQ2qMjW+NiNWk5HnTrMS3L9EdJobMUzaNZLy4w==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 11:b7:6a:36:3d:30:37:ce:61:9d:6c:84:8b:f3:9b:
+ * 25:4f:14:c8:a4:dd:2f:d7:9a:17:bd:90:19:f7:05:
+ * fd:f2:d2:c5:f7:77:be:ea:e2:84:87:97:3a:41:96:
+ * b6:99:f8:94:8c:58:71:51:8c:f4:2a:20:9e:1a:a0:
+ * 26:99:75:d6:31:53:43:39:f5:2a:a6:7e:34:42:51:
+ * 2a:40:87:03:88:43:69:b2:89:6d:20:bd:7d:71:ef:
+ * 47:0a:df:06:c1:69:66:a8:22:37:1a:77:1e:c7:94:
+ * 4e:2c:27:69:45:5e:c8:f8:0c:b7:f8:c0:8f:99:c1:
+ * e5:28:9b:f9:4c:94:c6:b1
+ * prime1:
+ * 00:e7:35:00:62:17:66:a2:7c:48:3a:cd:b2:4e:38:
+ * 2e:e1:7b:90:87:01:d9:05:c5:2c:56:54:55:47:2f:
+ * a1:1f:5d:fa:9d:2d:59:14:a2:13:1b:81:9b:fe:5f:
+ * 1c:88:79:4d:9b:88:e1:31:4a:0e:3d:29:db:37:14:
+ * e2:a0:4d:ab:b5
+ * prime2:
+ * 00:d0:17:75:85:a8:fa:42:e0:a8:f0:8d:00:5e:6d:
+ * 96:3b:e3:0c:4d:93:13:be:d1:c3:fd:b1:a3:28:d3:
+ * 3e:7d:3e:08:f2:b2:98:9d:04:57:d5:a7:07:76:a4:
+ * bd:5f:1d:ab:34:9a:99:82:43:26:a4:44:88:74:f4:
+ * 76:7d:ce:32:8f
+ * exponent1:
+ * 2c:57:8c:e8:43:26:aa:f8:fc:fd:52:1f:e5:42:7f:
+ * 33:3d:78:7d:7c:0c:3c:40:11:7d:c9:14:c5:df:4b:
+ * 9e:71:6e:b4:20:53:5a:52:af:29:72:55:11:96:fa:
+ * 28:ee:62:c4:f6:9e:81:ce:7b:26:9d:d5:6e:1d:f2:
+ * 4c:de:38:95
+ * exponent2:
+ * 0c:3f:f5:49:23:03:68:80:75:31:83:fb:6b:93:a3:
+ * ee:6e:95:40:d3:d1:ab:c0:09:7b:9b:c3:71:19:ce:
+ * 69:ed:06:f5:d2:91:ad:5c:9e:17:13:b8:1a:c1:e3:
+ * eb:ff:81:1e:9d:a3:3f:c9:d8:32:7f:5e:51:14:3b:
+ * 0d:78:df:fd
+ * coefficient:
+ * 01:0c:cc:95:69:ca:19:23:bc:a7:24:c3:b6:74:31:
+ * de:14:4c:a1:49:0e:12:19:8d:ab:86:d0:84:b9:18:
+ * aa:d9:d8:15:ca:a9:51:0d:aa:32:35:be:36:23:56:
+ * 93:91:e7:4e:b3:12:dc:bf:44:74:9a:1b:31:4c:da:
+ * 35:92:f2:e3
+ *
+ * client certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 6 (0x6)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:27:34 2008 GMT
+ * Not After : Aug 25 03:27:34 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Client, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * CD:BB:C8:85:AA:91:BD:FD:1D:BE:CD:67:7C:FF:B3:E9:4C:A8:22:E6
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * IP Address:127.0.0.1
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICnzCCAgigAwIBAgIBBjANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3MzRaFw0yODA4MjUwMzI3MzRaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas
+ * JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV
+ * 8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq
+ * ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjbjBsMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB
+ * MA0GCSqGSIb3DQEBBAUAA4GBACjj9PS+W6XOF7toFMwMOv/AemZeBOpcEF1Ei1Hx
+ * HjvB6EOHkMY8tFm5OPzkiWiK3+s3awpSW0jWdzMYwrQJ3/klMsPDpI7PEuirqwHP
+ * i5Wyl/vk7jmfWVcBO9MVhPUo4BYl4vS9aj6JA5QbkbkB95LOgT/BowY0WmHeVsXC
+ * I9aw
+ * -----END CERTIFICATE-----
+ *
+ *
+ *
+ * Trusted CA certificate:
+ * Certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 0 (0x0)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 02:43:36 2008 GMT
+ * Not After : Aug 25 02:43:36 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:cb:c4:38:20:07:be:88:a7:93:b0:a1:43:51:2d:
+ * d7:8e:85:af:54:dd:ad:a2:7b:23:5b:cf:99:13:53:
+ * 99:45:7d:ee:6d:ba:2d:bf:e3:ad:6e:3d:9f:1a:f9:
+ * 03:97:e0:17:55:ae:11:26:57:de:01:29:8e:05:3f:
+ * 21:f7:e7:36:e8:2e:37:d7:48:ac:53:d6:60:0e:c7:
+ * 50:6d:f6:c5:85:f7:8b:a6:c5:91:35:72:3c:94:ee:
+ * f1:17:f0:71:e3:ec:1b:ce:ca:4e:40:42:b0:6d:ee:
+ * 6a:0e:d6:e5:ad:3c:0f:c9:ba:82:4f:78:f8:89:97:
+ * 89:2a:95:12:4c:d8:09:2a:e9
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Subject Key Identifier:
+ * FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * DirName:/C=US/ST=Some-State/L=Some-City/O=Some-Org
+ * serial:00
+ *
+ * X509v3 Basic Constraints:
+ * CA:TRUE
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
+ * gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX
+ * 4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj
+ * 7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G
+ * A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ
+ * hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt
+ * U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw
+ * DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA
+ * ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ
+ * LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P
+ * 6Mvf0r1PNTY2hwTJLJmKtg==
+ * -----END CERTIFICATE---
+ */
+
+
+public class IPAddressIPIdentities {
+ static Map cookies;
+ ServerSocket ss;
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+
+ /*
+ * Where do we find the keystores?
+ */
+ static String trusedCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n" +
+ "gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX\n" +
+ "4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj\n" +
+ "7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G\n" +
+ "A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ\n" +
+ "hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt\n" +
+ "U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw\n" +
+ "DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA\n" +
+ "ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ\n" +
+ "LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P\n" +
+ "6Mvf0r1PNTY2hwTJLJmKtg==\n" +
+ "-----END CERTIFICATE-----";
+
+ static String serverCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICnzCCAgigAwIBAgIBBzANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3NTdaFw0yODA4MjUwMzI3NTdaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3\n" +
+ "ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6\n" +
+ "YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS\n" +
+ "7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjbjBsMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB\n" +
+ "MA0GCSqGSIb3DQEBBAUAA4GBAFJjItCtCBZcjD69wdqfIbKmRFa6eJAjR6LcoDva\n" +
+ "cKC/sDOLelpspiZ66Zb0Xdv5qQ7QrfOXt3K8QqJKRMdZLF9WfUfy0gJDM32ub91h\n" +
+ "pu+TmcGPs+6RdrAQcuvU1ZDV9X8SMj7BtKaim4d5sqFw1npncKiA5xFn8vOYwdun\n" +
+ "nZif\n" +
+ "-----END CERTIFICATE-----";
+
+ static String clientCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICnzCCAgigAwIBAgIBBjANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3MzRaFw0yODA4MjUwMzI3MzRaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas\n" +
+ "JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV\n" +
+ "8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq\n" +
+ "ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjbjBsMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB\n" +
+ "MA0GCSqGSIb3DQEBBAUAA4GBACjj9PS+W6XOF7toFMwMOv/AemZeBOpcEF1Ei1Hx\n" +
+ "HjvB6EOHkMY8tFm5OPzkiWiK3+s3awpSW0jWdzMYwrQJ3/klMsPDpI7PEuirqwHP\n" +
+ "i5Wyl/vk7jmfWVcBO9MVhPUo4BYl4vS9aj6JA5QbkbkB95LOgT/BowY0WmHeVsXC\n" +
+ "I9aw\n" +
+ "-----END CERTIFICATE-----";
+
+
+ static byte serverPrivateExponent[] = {
+ (byte)0x6e, (byte)0xa7, (byte)0x1b, (byte)0x83,
+ (byte)0x51, (byte)0x35, (byte)0x9a, (byte)0x44,
+ (byte)0x7d, (byte)0xf6, (byte)0xe3, (byte)0x89,
+ (byte)0xa0, (byte)0xd7, (byte)0x90, (byte)0x60,
+ (byte)0xa1, (byte)0x4e, (byte)0x27, (byte)0x21,
+ (byte)0xa2, (byte)0x89, (byte)0x74, (byte)0xcc,
+ (byte)0x9d, (byte)0x75, (byte)0x75, (byte)0x4e,
+ (byte)0xc7, (byte)0x82, (byte)0xe3, (byte)0xe3,
+ (byte)0xc3, (byte)0x7d, (byte)0x00, (byte)0x54,
+ (byte)0xec, (byte)0x36, (byte)0xb1, (byte)0xdf,
+ (byte)0x91, (byte)0x9c, (byte)0x7a, (byte)0xc0,
+ (byte)0x62, (byte)0x0a, (byte)0xd6, (byte)0xa9,
+ (byte)0x22, (byte)0x91, (byte)0x4a, (byte)0x29,
+ (byte)0x2e, (byte)0x43, (byte)0xfa, (byte)0x8c,
+ (byte)0xd8, (byte)0xe9, (byte)0xbe, (byte)0xd9,
+ (byte)0x4f, (byte)0xca, (byte)0x23, (byte)0xc6,
+ (byte)0xe4, (byte)0x3f, (byte)0xb8, (byte)0x72,
+ (byte)0xcf, (byte)0x02, (byte)0xfc, (byte)0xf4,
+ (byte)0x58, (byte)0x34, (byte)0x77, (byte)0x76,
+ (byte)0xce, (byte)0x22, (byte)0x44, (byte)0x5f,
+ (byte)0x2d, (byte)0xca, (byte)0xee, (byte)0xf5,
+ (byte)0x43, (byte)0x56, (byte)0x47, (byte)0x71,
+ (byte)0x0b, (byte)0x09, (byte)0x6b, (byte)0x5e,
+ (byte)0xf2, (byte)0xc8, (byte)0xee, (byte)0xd4,
+ (byte)0x6e, (byte)0x44, (byte)0x92, (byte)0x2a,
+ (byte)0x7f, (byte)0xcc, (byte)0xa7, (byte)0xd4,
+ (byte)0x5b, (byte)0xfb, (byte)0xf7, (byte)0x4a,
+ (byte)0xa9, (byte)0xfb, (byte)0x54, (byte)0x18,
+ (byte)0xd5, (byte)0xd5, (byte)0x14, (byte)0xba,
+ (byte)0xa0, (byte)0x1c, (byte)0x13, (byte)0xb3,
+ (byte)0x37, (byte)0x6b, (byte)0x37, (byte)0x59,
+ (byte)0xed, (byte)0xdb, (byte)0x6d, (byte)0xb1
+ };
+
+ static byte serverModulus[] = {
+ (byte)0x00,
+ (byte)0xa5, (byte)0xac, (byte)0x5b, (byte)0x1c,
+ (byte)0x37, (byte)0xa2, (byte)0xdd, (byte)0x99,
+ (byte)0x89, (byte)0x2d, (byte)0xb2, (byte)0x79,
+ (byte)0xb8, (byte)0x8f, (byte)0xd5, (byte)0x48,
+ (byte)0xa5, (byte)0xe7, (byte)0x1c, (byte)0x84,
+ (byte)0x17, (byte)0x8d, (byte)0x69, (byte)0x9c,
+ (byte)0xc6, (byte)0xac, (byte)0x6d, (byte)0xf9,
+ (byte)0xf2, (byte)0x1d, (byte)0x1f, (byte)0x39,
+ (byte)0x19, (byte)0xda, (byte)0xd3, (byte)0x72,
+ (byte)0x1e, (byte)0x6e, (byte)0xec, (byte)0x44,
+ (byte)0xcc, (byte)0x70, (byte)0xa4, (byte)0xdc,
+ (byte)0xba, (byte)0x00, (byte)0x30, (byte)0xf6,
+ (byte)0xa0, (byte)0x4f, (byte)0x3d, (byte)0x54,
+ (byte)0x7a, (byte)0x61, (byte)0x6a, (byte)0xcc,
+ (byte)0x57, (byte)0xd0, (byte)0x0a, (byte)0x7f,
+ (byte)0x95, (byte)0x28, (byte)0x18, (byte)0x3f,
+ (byte)0x9a, (byte)0xd9, (byte)0x94, (byte)0xf2,
+ (byte)0x1b, (byte)0xc8, (byte)0x24, (byte)0x88,
+ (byte)0x7e, (byte)0xfe, (byte)0x9d, (byte)0x0f,
+ (byte)0x3d, (byte)0xfb, (byte)0x57, (byte)0x53,
+ (byte)0x08, (byte)0xb3, (byte)0x20, (byte)0x33,
+ (byte)0xd4, (byte)0x3f, (byte)0x17, (byte)0x47,
+ (byte)0x14, (byte)0xd1, (byte)0xcd, (byte)0xea,
+ (byte)0x08, (byte)0xd8, (byte)0x0e, (byte)0x75,
+ (byte)0x4e, (byte)0xaf, (byte)0xbe, (byte)0xcc,
+ (byte)0xd2, (byte)0xec, (byte)0xaf, (byte)0xa9,
+ (byte)0x7a, (byte)0x49, (byte)0xdf, (byte)0xc2,
+ (byte)0xd9, (byte)0xac, (byte)0xb8, (byte)0x24,
+ (byte)0x40, (byte)0x90, (byte)0xa6, (byte)0x03,
+ (byte)0x56, (byte)0x2a, (byte)0xd0, (byte)0x30,
+ (byte)0x05, (byte)0x40, (byte)0x2c, (byte)0x4f,
+ (byte)0xab, (byte)0xd9, (byte)0x74, (byte)0x89
+ };
+
+ static byte clientPrivateExponent[] = {
+ (byte)0x11, (byte)0xb7, (byte)0x6a, (byte)0x36,
+ (byte)0x3d, (byte)0x30, (byte)0x37, (byte)0xce,
+ (byte)0x61, (byte)0x9d, (byte)0x6c, (byte)0x84,
+ (byte)0x8b, (byte)0xf3, (byte)0x9b, (byte)0x25,
+ (byte)0x4f, (byte)0x14, (byte)0xc8, (byte)0xa4,
+ (byte)0xdd, (byte)0x2f, (byte)0xd7, (byte)0x9a,
+ (byte)0x17, (byte)0xbd, (byte)0x90, (byte)0x19,
+ (byte)0xf7, (byte)0x05, (byte)0xfd, (byte)0xf2,
+ (byte)0xd2, (byte)0xc5, (byte)0xf7, (byte)0x77,
+ (byte)0xbe, (byte)0xea, (byte)0xe2, (byte)0x84,
+ (byte)0x87, (byte)0x97, (byte)0x3a, (byte)0x41,
+ (byte)0x96, (byte)0xb6, (byte)0x99, (byte)0xf8,
+ (byte)0x94, (byte)0x8c, (byte)0x58, (byte)0x71,
+ (byte)0x51, (byte)0x8c, (byte)0xf4, (byte)0x2a,
+ (byte)0x20, (byte)0x9e, (byte)0x1a, (byte)0xa0,
+ (byte)0x26, (byte)0x99, (byte)0x75, (byte)0xd6,
+ (byte)0x31, (byte)0x53, (byte)0x43, (byte)0x39,
+ (byte)0xf5, (byte)0x2a, (byte)0xa6, (byte)0x7e,
+ (byte)0x34, (byte)0x42, (byte)0x51, (byte)0x2a,
+ (byte)0x40, (byte)0x87, (byte)0x03, (byte)0x88,
+ (byte)0x43, (byte)0x69, (byte)0xb2, (byte)0x89,
+ (byte)0x6d, (byte)0x20, (byte)0xbd, (byte)0x7d,
+ (byte)0x71, (byte)0xef, (byte)0x47, (byte)0x0a,
+ (byte)0xdf, (byte)0x06, (byte)0xc1, (byte)0x69,
+ (byte)0x66, (byte)0xa8, (byte)0x22, (byte)0x37,
+ (byte)0x1a, (byte)0x77, (byte)0x1e, (byte)0xc7,
+ (byte)0x94, (byte)0x4e, (byte)0x2c, (byte)0x27,
+ (byte)0x69, (byte)0x45, (byte)0x5e, (byte)0xc8,
+ (byte)0xf8, (byte)0x0c, (byte)0xb7, (byte)0xf8,
+ (byte)0xc0, (byte)0x8f, (byte)0x99, (byte)0xc1,
+ (byte)0xe5, (byte)0x28, (byte)0x9b, (byte)0xf9,
+ (byte)0x4c, (byte)0x94, (byte)0xc6, (byte)0xb1
+ };
+
+ static byte clientModulus[] = {
+ (byte)0x00,
+ (byte)0xbb, (byte)0xf0, (byte)0x40, (byte)0x36,
+ (byte)0xac, (byte)0x26, (byte)0x54, (byte)0x4e,
+ (byte)0xf4, (byte)0xa3, (byte)0x5a, (byte)0x00,
+ (byte)0x2f, (byte)0x69, (byte)0x21, (byte)0x6f,
+ (byte)0xb9, (byte)0x7a, (byte)0x3a, (byte)0x93,
+ (byte)0xec, (byte)0xa2, (byte)0xf6, (byte)0xe1,
+ (byte)0x8e, (byte)0xc7, (byte)0x63, (byte)0xd8,
+ (byte)0x2f, (byte)0x12, (byte)0x30, (byte)0x99,
+ (byte)0x2e, (byte)0xb0, (byte)0xf2, (byte)0x8f,
+ (byte)0xf8, (byte)0x27, (byte)0x2d, (byte)0x24,
+ (byte)0x78, (byte)0x28, (byte)0x84, (byte)0xf7,
+ (byte)0x01, (byte)0xbf, (byte)0x8d, (byte)0x44,
+ (byte)0x79, (byte)0xdd, (byte)0x3b, (byte)0xd2,
+ (byte)0x55, (byte)0xf3, (byte)0xce, (byte)0x3c,
+ (byte)0xb2, (byte)0x5b, (byte)0x21, (byte)0x7d,
+ (byte)0xef, (byte)0xfd, (byte)0x33, (byte)0x4a,
+ (byte)0xb1, (byte)0xa3, (byte)0xff, (byte)0xc6,
+ (byte)0xc8, (byte)0x9b, (byte)0xb9, (byte)0x0f,
+ (byte)0x7c, (byte)0x41, (byte)0x35, (byte)0x97,
+ (byte)0xf9, (byte)0xdb, (byte)0x3a, (byte)0x05,
+ (byte)0x60, (byte)0x05, (byte)0x15, (byte)0xaf,
+ (byte)0x59, (byte)0x17, (byte)0x92, (byte)0xa3,
+ (byte)0x10, (byte)0xad, (byte)0x16, (byte)0x1c,
+ (byte)0xe4, (byte)0x07, (byte)0x53, (byte)0xaf,
+ (byte)0xa8, (byte)0x76, (byte)0xa2, (byte)0x56,
+ (byte)0x2a, (byte)0x92, (byte)0xd3, (byte)0xf9,
+ (byte)0x28, (byte)0xe0, (byte)0x78, (byte)0xcf,
+ (byte)0x5e, (byte)0x1f, (byte)0x48, (byte)0xab,
+ (byte)0x5c, (byte)0x19, (byte)0xdd, (byte)0xe1,
+ (byte)0x67, (byte)0x43, (byte)0xba, (byte)0x75,
+ (byte)0x8d, (byte)0xf5, (byte)0x82, (byte)0xac,
+ (byte)0x43, (byte)0x92, (byte)0x44, (byte)0x1b
+ };
+
+ static char passphrase[] = "passphrase".toCharArray();
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+
+ /*
+ * Turn on SSL debugging?
+ */
+ static boolean debug = false;
+
+ private SSLServerSocket sslServerSocket = null;
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, serverCertStr,
+ serverModulus, serverPrivateExponent, passphrase);
+ SSLServerSocketFactory sslssf = context.getServerSocketFactory();
+
+ sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ sslSocket.setNeedClientAuth(true);
+ if (sslSocket instanceof SSLSocketImpl) {
+ ((SSLSocketImpl)sslSocket).trySetHostnameVerification("HTTPS");
+ }
+
+ PrintStream out =
+ new PrintStream(sslSocket.getOutputStream());
+
+ try {
+ // ignore request data
+
+ // send the response
+ out.print("HTTP/1.1 200 OK\r\n");
+ out.print("Content-Type: text/html; charset=iso-8859-1\r\n");
+ out.print("Content-Length: "+ 9 +"\r\n");
+ out.print("\r\n");
+ out.print("Testing\r\n");
+ out.flush();
+ } finally {
+ // close the socket
+ Thread.sleep(2000);
+ System.out.println("Server closing socket");
+ sslSocket.close();
+ serverReady = false;
+ }
+
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
+ clientModulus, clientPrivateExponent, passphrase);
+
+ SSLContext.setDefault(context);
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ HttpsURLConnection http = null;
+
+ /* establish http connection to server */
+ URL url = new URL("https://127.0.0.1:" + serverPort+"/");
+ System.out.println("url is "+url.toString());
+
+ http = (HttpsURLConnection)url.openConnection();
+
+ int respCode = http.getResponseCode();
+ System.out.println("respCode = "+respCode);
+
+ http.disconnect();
+ }
+
+ /*
+ * =============================================================
+ * The remainder is just support stuff
+ */
+
+ // use any free port by default
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ public static void main(String args[]) throws Exception {
+ if (debug)
+ System.setProperty("javax.net.debug", "all");
+
+ /*
+ * Start the tests.
+ */
+ new IPAddressIPIdentities();
+ }
+
+ Thread clientThread = null;
+ Thread serverThread = null;
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ IPAddressIPIdentities() throws Exception {
+ if (separateServerThread) {
+ startServer(true);
+ startClient(false);
+ } else {
+ startClient(true);
+ startServer(false);
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ serverThread.join();
+ } else {
+ clientThread.join();
+ }
+
+ /*
+ * When we get here, the test is pretty much over.
+ *
+ * If the main thread excepted, that propagates back
+ * immediately. If the other thread threw an exception, we
+ * should report back.
+ */
+ if (serverException != null)
+ throw serverException;
+ if (clientException != null)
+ throw clientException;
+ }
+
+ void startServer(boolean newThread) throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ doServerSide();
+ }
+ }
+
+ void startClient(boolean newThread) throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ doClientSide();
+ }
+ }
+
+ // get the ssl context
+ private static SSLContext getSSLContext(String trusedCertStr,
+ String keyCertStr, byte[] modulus,
+ byte[] privateExponent, char[] passphrase) throws Exception {
+
+ // generate certificate from cert string
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+ ByteArrayInputStream is =
+ new ByteArrayInputStream(trusedCertStr.getBytes());
+ Certificate trusedCert = cf.generateCertificate(is);
+ is.close();
+
+ // create a key store
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(null, null);
+
+ // import the trused cert
+ ks.setCertificateEntry("RSA Export Signer", trusedCert);
+
+ if (keyCertStr != null) {
+ // generate the private key.
+ RSAPrivateKeySpec priKeySpec = new RSAPrivateKeySpec(
+ new BigInteger(modulus),
+ new BigInteger(privateExponent));
+ KeyFactory kf = KeyFactory.getInstance("RSA");
+ RSAPrivateKey priKey =
+ (RSAPrivateKey)kf.generatePrivate(priKeySpec);
+
+ // generate certificate chain
+ is = new ByteArrayInputStream(keyCertStr.getBytes());
+ Certificate keyCert = cf.generateCertificate(is);
+ is.close();
+
+ Certificate[] chain = new Certificate[2];
+ chain[0] = keyCert;
+ chain[1] = trusedCert;
+
+ // import the key entry.
+ ks.setKeyEntry("Whatever", priKey, passphrase, chain);
+ }
+
+ // create SSL context
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+ tmf.init(ks);
+
+ SSLContext ctx = SSLContext.getInstance("TLS");
+
+ if (keyCertStr != null) {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, passphrase);
+
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ } else {
+ ctx.init(null, tmf.getTrustManagers(), null);
+ }
+
+ return ctx;
+ }
+
+}
diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java
new file mode 100644
index 00000000000..7e1d48fdfb1
--- /dev/null
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java
@@ -0,0 +1,880 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
+ * @bug 6766775
+ * @author Xuelei Fan
+ */
+
+import java.net.*;
+import java.util.*;
+import java.io.*;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.KeyFactory;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import java.math.BigInteger;
+
+import sun.security.ssl.SSLSocketImpl;
+
+/*
+ * Certificates and key used in the test.
+ *
+ * TLS server certificate:
+ * server private key:
+ * -----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,D9AE407F6D0E389A
+ *
+ * WPrA7TFol/cQCcp9oHnXWNpYlvRbbIcQj0m+RKT2Iuzfus+DHt3Zadf8nJpKfX2e
+ * h2rnhlzCN9M7djRDooZKDOPCsdBn51Au7HlZF3S3Opgo7D8XFM1a8t1Je4ke14oI
+ * nw6QKYsBblRziPnP2PZ0zvX24nOv7bbY8beynlJHGs00VWSFdoH2DS0aE1p6D+3n
+ * ptJuJ75dVfZFK4X7162APlNXevX8D6PEQpSiRw1rjjGGcnvQ4HdWk3BxDVDcCNJb
+ * Y1aGNRxsjTDvPi3R9Qx2M+W03QzEPx4SR3ZHVskeSJHaetM0TM/w/45Paq4GokXP
+ * ZeTnbEx1xmjkA7h+t4doLL4watx5F6yLsJzu8xB3lt/1EtmkYtLz1t7X4BetPAXz
+ * zS69X/VwhKfsOI3qXBWuL2oHPyhDmT1gcaUQwEPSV6ogHEEQEDXdiUS8heNK13KF
+ * TCQYFkETvV2BLxUhV1hypPzRQ6tUpJiAbD5KmoK2lD9slshG2QtvKQq0/bgkDY5J
+ * LhDHV2dtcZ3kDPkkZXpbcJQvoeH3d09C5sIsuTFo2zgNR6oETHUc5TzP6FY2YYRa
+ * QcK5HcmtsRRiXFm01ac+aMejJUIujjFt84SiKWT/73vC8AmY4tYcJBLjCg4XIxSH
+ * fdDFLL1YZENNO5ivlp8mdiHqcawx+36L7DrEZQ8RZt6cqST5t/+XTdM74s6k81GT
+ * pNsa82P2K2zmIUZ/DL2mKjW1vfRByw1NQFEBkN3vdyZxYfM/JyUzX4hbjXBEkh9Q
+ * QYrcwLKLjis2QzSvK04B3bvRzRb+4ocWiso8ZPAXAIxZFBWDpTMM2A==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICXAIBAAKBgQClrFscN6LdmYktsnm4j9VIpecchBeNaZzGrG358h0fORna03Ie
+ * buxEzHCk3LoAMPagTz1UemFqzFfQCn+VKBg/mtmU8hvIJIh+/p0PPftXUwizIDPU
+ * PxdHFNHN6gjYDnVOr77M0uyvqXpJ38LZrLgkQJCmA1Yq0DAFQCxPq9l0iQIDAQAB
+ * AoGAbqcbg1E1mkR99uOJoNeQYKFOJyGiiXTMnXV1TseC4+PDfQBU7Dax35GcesBi
+ * CtapIpFKKS5D+ozY6b7ZT8ojxuQ/uHLPAvz0WDR3ds4iRF8tyu71Q1ZHcQsJa17y
+ * yO7UbkSSKn/Mp9Rb+/dKqftUGNXVFLqgHBOzN2s3We3bbbECQQDYBPKOg3hkaGHo
+ * OhpHKqtQ6EVkldihG/3i4WejRonelXN+HRh1KrB2HBx0M8D/qAzP1i3rNSlSHer4
+ * 59YRTJnHAkEAxFX/sVYSn07BHv9Zhn6XXct/Cj43z/tKNbzlNbcxqQwQerw3IH51
+ * 8UH2YOA+GD3lXbKp+MytoFLWv8zg4YT/LwJAfqan75Z1R6lLffRS49bIiq8jwE16
+ * rTrUJ+kv8jKxMqc9B3vXkxpsS1M/+4E8bqgAmvpgAb8xcsvHsBd9ErdukQJBAKs2
+ * j67W75BrPjBI34pQ1LEfp56IGWXOrq1kF8IbCjxv3+MYRT6Z6UJFkpRymNPNDjsC
+ * dgUYgITiGJHUGXuw3lMCQHEHqo9ZtXz92yFT+VhsNc29B8m/sqUJdtCcMd/jGpAF
+ * u6GHufjqIZBpQsk63wbwESAPZZ+kk1O1kS5GIRLX608=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 6e:a7:1b:83:51:35:9a:44:7d:f6:e3:89:a0:d7:90:
+ * 60:a1:4e:27:21:a2:89:74:cc:9d:75:75:4e:c7:82:
+ * e3:e3:c3:7d:00:54:ec:36:b1:df:91:9c:7a:c0:62:
+ * 0a:d6:a9:22:91:4a:29:2e:43:fa:8c:d8:e9:be:d9:
+ * 4f:ca:23:c6:e4:3f:b8:72:cf:02:fc:f4:58:34:77:
+ * 76:ce:22:44:5f:2d:ca:ee:f5:43:56:47:71:0b:09:
+ * 6b:5e:f2:c8:ee:d4:6e:44:92:2a:7f:cc:a7:d4:5b:
+ * fb:f7:4a:a9:fb:54:18:d5:d5:14:ba:a0:1c:13:b3:
+ * 37:6b:37:59:ed:db:6d:b1
+ * prime1:
+ * 00:d8:04:f2:8e:83:78:64:68:61:e8:3a:1a:47:2a:
+ * ab:50:e8:45:64:95:d8:a1:1b:fd:e2:e1:67:a3:46:
+ * 89:de:95:73:7e:1d:18:75:2a:b0:76:1c:1c:74:33:
+ * c0:ff:a8:0c:cf:d6:2d:eb:35:29:52:1d:ea:f8:e7:
+ * d6:11:4c:99:c7
+ * prime2:
+ * 00:c4:55:ff:b1:56:12:9f:4e:c1:1e:ff:59:86:7e:
+ * 97:5d:cb:7f:0a:3e:37:cf:fb:4a:35:bc:e5:35:b7:
+ * 31:a9:0c:10:7a:bc:37:20:7e:75:f1:41:f6:60:e0:
+ * 3e:18:3d:e5:5d:b2:a9:f8:cc:ad:a0:52:d6:bf:cc:
+ * e0:e1:84:ff:2f
+ * exponent1:
+ * 7e:a6:a7:ef:96:75:47:a9:4b:7d:f4:52:e3:d6:c8:
+ * 8a:af:23:c0:4d:7a:ad:3a:d4:27:e9:2f:f2:32:b1:
+ * 32:a7:3d:07:7b:d7:93:1a:6c:4b:53:3f:fb:81:3c:
+ * 6e:a8:00:9a:fa:60:01:bf:31:72:cb:c7:b0:17:7d:
+ * 12:b7:6e:91
+ * exponent2:
+ * 00:ab:36:8f:ae:d6:ef:90:6b:3e:30:48:df:8a:50:
+ * d4:b1:1f:a7:9e:88:19:65:ce:ae:ad:64:17:c2:1b:
+ * 0a:3c:6f:df:e3:18:45:3e:99:e9:42:45:92:94:72:
+ * 98:d3:cd:0e:3b:02:76:05:18:80:84:e2:18:91:d4:
+ * 19:7b:b0:de:53
+ * coefficient:
+ * 71:07:aa:8f:59:b5:7c:fd:db:21:53:f9:58:6c:35:
+ * cd:bd:07:c9:bf:b2:a5:09:76:d0:9c:31:df:e3:1a:
+ * 90:05:bb:a1:87:b9:f8:ea:21:90:69:42:c9:3a:df:
+ * 06:f0:11:20:0f:65:9f:a4:93:53:b5:91:2e:46:21:
+ * 12:d7:eb:4f
+ *
+ *
+ * server certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 7 (0x7)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:27:57 2008 GMT
+ * Not After : Aug 25 03:27:57 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Server, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * ED:6E:DB:F4:B5:56:C8:FB:1A:06:61:3F:0F:08:BB:A6:04:D8:16:54
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * IP Address:127.0.0.1
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICnzCCAgigAwIBAgIBBzANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3NTdaFw0yODA4MjUwMzI3NTdaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3
+ * ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6
+ * YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS
+ * 7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjbjBsMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB
+ * MA0GCSqGSIb3DQEBBAUAA4GBAFJjItCtCBZcjD69wdqfIbKmRFa6eJAjR6LcoDva
+ * cKC/sDOLelpspiZ66Zb0Xdv5qQ7QrfOXt3K8QqJKRMdZLF9WfUfy0gJDM32ub91h
+ * pu+TmcGPs+6RdrAQcuvU1ZDV9X8SMj7BtKaim4d5sqFw1npncKiA5xFn8vOYwdun
+ * nZif
+ * -----END CERTIFICATE-----
+ *
+ *
+ * TLS client certificate:
+ * client private key:
+ * ----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,FA2A435CD35A9390
+ *
+ * Z+Y2uaETbsUWIyJUyVu1UV2G4rgFYJyACZT6Tp1KjRtxflSh2kXkJ9MpuXMXA0V4
+ * Yy3fDzPqCL9NJmQAYRlAx/W/+j4F5EyMWDIx8fUxzONRZyoiwF7jLm+KscAfv6Pf
+ * q7ItWOdj3z7IYrwlB8YIGd3F2cDKT3S+lYRk7rKb/qT7itbuHnY4Ardh3yl+MZak
+ * jBp+ELUlRsUqSr1V0LoM+0rCCykarpyfhpxEcqsrl0v9Cyi5uhU50/oKv5zql3SH
+ * l2ImgDjp3batAs8+Bd4NF2aqi0a7Hy44JUHxRm4caZryU/i/D9N1MbuM6882HLat
+ * 5N0G+NaIUfywa8mjwq2D5aiit18HqKA6XeRRYeJ5Dvu9DCO4GeFSwcUFIBMI0L46
+ * 7s114+oDodg57pMgITi+04vmUxvqlN9aiyd7f5Fgd7PeHGeOdbMz1NaJLJaPI9++
+ * NakK8eK9iwT/Gdq0Uap5/CHW7vCT5PO+h3HY0STH0lWStXhdWnFO04zTdywsbSp+
+ * DLpHeFT66shfeUlxR0PsCbG9vPRt/QmGLeYQZITppWo/ylSq4j+pRIuXvuWHdBRN
+ * rTZ8QF4Y7AxQUXVz1j1++s6ZMHTzaK2i9HrhmDs1MbJl+QwWre3Xpv3LvTVz3k5U
+ * wX8kuY1m3STt71QCaRWENq5sRaMImLxZbxc/ivFl9RAzUqo4NCxLod/QgA4iLqtO
+ * ztnlpzwlC/F8HbQ1oqYWwnZAPhzU/cULtstl+Yrws2c2atO323LbPXZqbASySgig
+ * sNpFXQMObdfP6LN23bY+1SvtK7V4NUTNhpdIc6INQAQ=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICWwIBAAKBgQC78EA2rCZUTvSjWgAvaSFvuXo6k+yi9uGOx2PYLxIwmS6w8o/4
+ * Jy0keCiE9wG/jUR53TvSVfPOPLJbIX3v/TNKsaP/xsibuQ98QTWX+ds6BWAFFa9Z
+ * F5KjEK0WHOQHU6+odqJWKpLT+SjgeM9eH0irXBnd4WdDunWN9YKsQ5JEGwIDAQAB
+ * AoGAEbdqNj0wN85hnWyEi/ObJU8UyKTdL9eaF72QGfcF/fLSxfd3vurihIeXOkGW
+ * tpn4lIxYcVGM9CognhqgJpl11jFTQzn1KqZ+NEJRKkCHA4hDabKJbSC9fXHvRwrf
+ * BsFpZqgiNxp3HseUTiwnaUVeyPgMt/jAj5nB5Sib+UyUxrECQQDnNQBiF2aifEg6
+ * zbJOOC7he5CHAdkFxSxWVFVHL6EfXfqdLVkUohMbgZv+XxyIeU2biOExSg49Kds3
+ * FOKgTau1AkEA0Bd1haj6QuCo8I0AXm2WO+MMTZMTvtHD/bGjKNM+fT4I8rKYnQRX
+ * 1acHdqS9Xx2rNJqZgkMmpESIdPR2fc4yjwJALFeM6EMmqvj8/VIf5UJ/Mz14fXwM
+ * PEARfckUxd9LnnFutCBTWlKvKXJVEZb6KO5ixPaegc57Jp3Vbh3yTN44lQJADD/1
+ * SSMDaIB1MYP7a5Oj7m6VQNPRq8AJe5vDcRnOae0G9dKRrVyeFxO4GsHj6/+BHp2j
+ * P8nYMn9eURQ7DXjf/QJAAQzMlWnKGSO8pyTDtnQx3hRMoUkOEhmNq4bQhLkYqtnY
+ * FcqpUQ2qMjW+NiNWk5HnTrMS3L9EdJobMUzaNZLy4w==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 11:b7:6a:36:3d:30:37:ce:61:9d:6c:84:8b:f3:9b:
+ * 25:4f:14:c8:a4:dd:2f:d7:9a:17:bd:90:19:f7:05:
+ * fd:f2:d2:c5:f7:77:be:ea:e2:84:87:97:3a:41:96:
+ * b6:99:f8:94:8c:58:71:51:8c:f4:2a:20:9e:1a:a0:
+ * 26:99:75:d6:31:53:43:39:f5:2a:a6:7e:34:42:51:
+ * 2a:40:87:03:88:43:69:b2:89:6d:20:bd:7d:71:ef:
+ * 47:0a:df:06:c1:69:66:a8:22:37:1a:77:1e:c7:94:
+ * 4e:2c:27:69:45:5e:c8:f8:0c:b7:f8:c0:8f:99:c1:
+ * e5:28:9b:f9:4c:94:c6:b1
+ * prime1:
+ * 00:e7:35:00:62:17:66:a2:7c:48:3a:cd:b2:4e:38:
+ * 2e:e1:7b:90:87:01:d9:05:c5:2c:56:54:55:47:2f:
+ * a1:1f:5d:fa:9d:2d:59:14:a2:13:1b:81:9b:fe:5f:
+ * 1c:88:79:4d:9b:88:e1:31:4a:0e:3d:29:db:37:14:
+ * e2:a0:4d:ab:b5
+ * prime2:
+ * 00:d0:17:75:85:a8:fa:42:e0:a8:f0:8d:00:5e:6d:
+ * 96:3b:e3:0c:4d:93:13:be:d1:c3:fd:b1:a3:28:d3:
+ * 3e:7d:3e:08:f2:b2:98:9d:04:57:d5:a7:07:76:a4:
+ * bd:5f:1d:ab:34:9a:99:82:43:26:a4:44:88:74:f4:
+ * 76:7d:ce:32:8f
+ * exponent1:
+ * 2c:57:8c:e8:43:26:aa:f8:fc:fd:52:1f:e5:42:7f:
+ * 33:3d:78:7d:7c:0c:3c:40:11:7d:c9:14:c5:df:4b:
+ * 9e:71:6e:b4:20:53:5a:52:af:29:72:55:11:96:fa:
+ * 28:ee:62:c4:f6:9e:81:ce:7b:26:9d:d5:6e:1d:f2:
+ * 4c:de:38:95
+ * exponent2:
+ * 0c:3f:f5:49:23:03:68:80:75:31:83:fb:6b:93:a3:
+ * ee:6e:95:40:d3:d1:ab:c0:09:7b:9b:c3:71:19:ce:
+ * 69:ed:06:f5:d2:91:ad:5c:9e:17:13:b8:1a:c1:e3:
+ * eb:ff:81:1e:9d:a3:3f:c9:d8:32:7f:5e:51:14:3b:
+ * 0d:78:df:fd
+ * coefficient:
+ * 01:0c:cc:95:69:ca:19:23:bc:a7:24:c3:b6:74:31:
+ * de:14:4c:a1:49:0e:12:19:8d:ab:86:d0:84:b9:18:
+ * aa:d9:d8:15:ca:a9:51:0d:aa:32:35:be:36:23:56:
+ * 93:91:e7:4e:b3:12:dc:bf:44:74:9a:1b:31:4c:da:
+ * 35:92:f2:e3
+ *
+ * client certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 6 (0x6)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:27:34 2008 GMT
+ * Not After : Aug 25 03:27:34 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Client, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * CD:BB:C8:85:AA:91:BD:FD:1D:BE:CD:67:7C:FF:B3:E9:4C:A8:22:E6
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * IP Address:127.0.0.1
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICnzCCAgigAwIBAgIBBjANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3MzRaFw0yODA4MjUwMzI3MzRaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas
+ * JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV
+ * 8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq
+ * ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjbjBsMAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB
+ * MA0GCSqGSIb3DQEBBAUAA4GBACjj9PS+W6XOF7toFMwMOv/AemZeBOpcEF1Ei1Hx
+ * HjvB6EOHkMY8tFm5OPzkiWiK3+s3awpSW0jWdzMYwrQJ3/klMsPDpI7PEuirqwHP
+ * i5Wyl/vk7jmfWVcBO9MVhPUo4BYl4vS9aj6JA5QbkbkB95LOgT/BowY0WmHeVsXC
+ * I9aw
+ * -----END CERTIFICATE-----
+ *
+ *
+ *
+ * Trusted CA certificate:
+ * Certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 0 (0x0)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 02:43:36 2008 GMT
+ * Not After : Aug 25 02:43:36 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:cb:c4:38:20:07:be:88:a7:93:b0:a1:43:51:2d:
+ * d7:8e:85:af:54:dd:ad:a2:7b:23:5b:cf:99:13:53:
+ * 99:45:7d:ee:6d:ba:2d:bf:e3:ad:6e:3d:9f:1a:f9:
+ * 03:97:e0:17:55:ae:11:26:57:de:01:29:8e:05:3f:
+ * 21:f7:e7:36:e8:2e:37:d7:48:ac:53:d6:60:0e:c7:
+ * 50:6d:f6:c5:85:f7:8b:a6:c5:91:35:72:3c:94:ee:
+ * f1:17:f0:71:e3:ec:1b:ce:ca:4e:40:42:b0:6d:ee:
+ * 6a:0e:d6:e5:ad:3c:0f:c9:ba:82:4f:78:f8:89:97:
+ * 89:2a:95:12:4c:d8:09:2a:e9
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Subject Key Identifier:
+ * FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * DirName:/C=US/ST=Some-State/L=Some-City/O=Some-Org
+ * serial:00
+ *
+ * X509v3 Basic Constraints:
+ * CA:TRUE
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
+ * gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX
+ * 4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj
+ * 7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G
+ * A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ
+ * hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt
+ * U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw
+ * DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA
+ * ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ
+ * LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P
+ * 6Mvf0r1PNTY2hwTJLJmKtg==
+ * -----END CERTIFICATE---
+ */
+
+
+public class IPIdentities {
+ static Map cookies;
+ ServerSocket ss;
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+
+ /*
+ * Where do we find the keystores?
+ */
+ static String trusedCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n" +
+ "gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX\n" +
+ "4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj\n" +
+ "7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G\n" +
+ "A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ\n" +
+ "hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt\n" +
+ "U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw\n" +
+ "DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA\n" +
+ "ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ\n" +
+ "LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P\n" +
+ "6Mvf0r1PNTY2hwTJLJmKtg==\n" +
+ "-----END CERTIFICATE-----";
+
+ static String serverCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICnzCCAgigAwIBAgIBBzANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3NTdaFw0yODA4MjUwMzI3NTdaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3\n" +
+ "ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6\n" +
+ "YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS\n" +
+ "7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjbjBsMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB\n" +
+ "MA0GCSqGSIb3DQEBBAUAA4GBAFJjItCtCBZcjD69wdqfIbKmRFa6eJAjR6LcoDva\n" +
+ "cKC/sDOLelpspiZ66Zb0Xdv5qQ7QrfOXt3K8QqJKRMdZLF9WfUfy0gJDM32ub91h\n" +
+ "pu+TmcGPs+6RdrAQcuvU1ZDV9X8SMj7BtKaim4d5sqFw1npncKiA5xFn8vOYwdun\n" +
+ "nZif\n" +
+ "-----END CERTIFICATE-----";
+
+ static String clientCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICnzCCAgigAwIBAgIBBjANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzI3MzRaFw0yODA4MjUwMzI3MzRaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas\n" +
+ "JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV\n" +
+ "8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq\n" +
+ "ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjbjBsMAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDASBgNVHREBAf8ECDAGhwR/AAAB\n" +
+ "MA0GCSqGSIb3DQEBBAUAA4GBACjj9PS+W6XOF7toFMwMOv/AemZeBOpcEF1Ei1Hx\n" +
+ "HjvB6EOHkMY8tFm5OPzkiWiK3+s3awpSW0jWdzMYwrQJ3/klMsPDpI7PEuirqwHP\n" +
+ "i5Wyl/vk7jmfWVcBO9MVhPUo4BYl4vS9aj6JA5QbkbkB95LOgT/BowY0WmHeVsXC\n" +
+ "I9aw\n" +
+ "-----END CERTIFICATE-----";
+
+
+ static byte serverPrivateExponent[] = {
+ (byte)0x6e, (byte)0xa7, (byte)0x1b, (byte)0x83,
+ (byte)0x51, (byte)0x35, (byte)0x9a, (byte)0x44,
+ (byte)0x7d, (byte)0xf6, (byte)0xe3, (byte)0x89,
+ (byte)0xa0, (byte)0xd7, (byte)0x90, (byte)0x60,
+ (byte)0xa1, (byte)0x4e, (byte)0x27, (byte)0x21,
+ (byte)0xa2, (byte)0x89, (byte)0x74, (byte)0xcc,
+ (byte)0x9d, (byte)0x75, (byte)0x75, (byte)0x4e,
+ (byte)0xc7, (byte)0x82, (byte)0xe3, (byte)0xe3,
+ (byte)0xc3, (byte)0x7d, (byte)0x00, (byte)0x54,
+ (byte)0xec, (byte)0x36, (byte)0xb1, (byte)0xdf,
+ (byte)0x91, (byte)0x9c, (byte)0x7a, (byte)0xc0,
+ (byte)0x62, (byte)0x0a, (byte)0xd6, (byte)0xa9,
+ (byte)0x22, (byte)0x91, (byte)0x4a, (byte)0x29,
+ (byte)0x2e, (byte)0x43, (byte)0xfa, (byte)0x8c,
+ (byte)0xd8, (byte)0xe9, (byte)0xbe, (byte)0xd9,
+ (byte)0x4f, (byte)0xca, (byte)0x23, (byte)0xc6,
+ (byte)0xe4, (byte)0x3f, (byte)0xb8, (byte)0x72,
+ (byte)0xcf, (byte)0x02, (byte)0xfc, (byte)0xf4,
+ (byte)0x58, (byte)0x34, (byte)0x77, (byte)0x76,
+ (byte)0xce, (byte)0x22, (byte)0x44, (byte)0x5f,
+ (byte)0x2d, (byte)0xca, (byte)0xee, (byte)0xf5,
+ (byte)0x43, (byte)0x56, (byte)0x47, (byte)0x71,
+ (byte)0x0b, (byte)0x09, (byte)0x6b, (byte)0x5e,
+ (byte)0xf2, (byte)0xc8, (byte)0xee, (byte)0xd4,
+ (byte)0x6e, (byte)0x44, (byte)0x92, (byte)0x2a,
+ (byte)0x7f, (byte)0xcc, (byte)0xa7, (byte)0xd4,
+ (byte)0x5b, (byte)0xfb, (byte)0xf7, (byte)0x4a,
+ (byte)0xa9, (byte)0xfb, (byte)0x54, (byte)0x18,
+ (byte)0xd5, (byte)0xd5, (byte)0x14, (byte)0xba,
+ (byte)0xa0, (byte)0x1c, (byte)0x13, (byte)0xb3,
+ (byte)0x37, (byte)0x6b, (byte)0x37, (byte)0x59,
+ (byte)0xed, (byte)0xdb, (byte)0x6d, (byte)0xb1
+ };
+
+ static byte serverModulus[] = {
+ (byte)0x00,
+ (byte)0xa5, (byte)0xac, (byte)0x5b, (byte)0x1c,
+ (byte)0x37, (byte)0xa2, (byte)0xdd, (byte)0x99,
+ (byte)0x89, (byte)0x2d, (byte)0xb2, (byte)0x79,
+ (byte)0xb8, (byte)0x8f, (byte)0xd5, (byte)0x48,
+ (byte)0xa5, (byte)0xe7, (byte)0x1c, (byte)0x84,
+ (byte)0x17, (byte)0x8d, (byte)0x69, (byte)0x9c,
+ (byte)0xc6, (byte)0xac, (byte)0x6d, (byte)0xf9,
+ (byte)0xf2, (byte)0x1d, (byte)0x1f, (byte)0x39,
+ (byte)0x19, (byte)0xda, (byte)0xd3, (byte)0x72,
+ (byte)0x1e, (byte)0x6e, (byte)0xec, (byte)0x44,
+ (byte)0xcc, (byte)0x70, (byte)0xa4, (byte)0xdc,
+ (byte)0xba, (byte)0x00, (byte)0x30, (byte)0xf6,
+ (byte)0xa0, (byte)0x4f, (byte)0x3d, (byte)0x54,
+ (byte)0x7a, (byte)0x61, (byte)0x6a, (byte)0xcc,
+ (byte)0x57, (byte)0xd0, (byte)0x0a, (byte)0x7f,
+ (byte)0x95, (byte)0x28, (byte)0x18, (byte)0x3f,
+ (byte)0x9a, (byte)0xd9, (byte)0x94, (byte)0xf2,
+ (byte)0x1b, (byte)0xc8, (byte)0x24, (byte)0x88,
+ (byte)0x7e, (byte)0xfe, (byte)0x9d, (byte)0x0f,
+ (byte)0x3d, (byte)0xfb, (byte)0x57, (byte)0x53,
+ (byte)0x08, (byte)0xb3, (byte)0x20, (byte)0x33,
+ (byte)0xd4, (byte)0x3f, (byte)0x17, (byte)0x47,
+ (byte)0x14, (byte)0xd1, (byte)0xcd, (byte)0xea,
+ (byte)0x08, (byte)0xd8, (byte)0x0e, (byte)0x75,
+ (byte)0x4e, (byte)0xaf, (byte)0xbe, (byte)0xcc,
+ (byte)0xd2, (byte)0xec, (byte)0xaf, (byte)0xa9,
+ (byte)0x7a, (byte)0x49, (byte)0xdf, (byte)0xc2,
+ (byte)0xd9, (byte)0xac, (byte)0xb8, (byte)0x24,
+ (byte)0x40, (byte)0x90, (byte)0xa6, (byte)0x03,
+ (byte)0x56, (byte)0x2a, (byte)0xd0, (byte)0x30,
+ (byte)0x05, (byte)0x40, (byte)0x2c, (byte)0x4f,
+ (byte)0xab, (byte)0xd9, (byte)0x74, (byte)0x89
+ };
+
+ static byte clientPrivateExponent[] = {
+ (byte)0x11, (byte)0xb7, (byte)0x6a, (byte)0x36,
+ (byte)0x3d, (byte)0x30, (byte)0x37, (byte)0xce,
+ (byte)0x61, (byte)0x9d, (byte)0x6c, (byte)0x84,
+ (byte)0x8b, (byte)0xf3, (byte)0x9b, (byte)0x25,
+ (byte)0x4f, (byte)0x14, (byte)0xc8, (byte)0xa4,
+ (byte)0xdd, (byte)0x2f, (byte)0xd7, (byte)0x9a,
+ (byte)0x17, (byte)0xbd, (byte)0x90, (byte)0x19,
+ (byte)0xf7, (byte)0x05, (byte)0xfd, (byte)0xf2,
+ (byte)0xd2, (byte)0xc5, (byte)0xf7, (byte)0x77,
+ (byte)0xbe, (byte)0xea, (byte)0xe2, (byte)0x84,
+ (byte)0x87, (byte)0x97, (byte)0x3a, (byte)0x41,
+ (byte)0x96, (byte)0xb6, (byte)0x99, (byte)0xf8,
+ (byte)0x94, (byte)0x8c, (byte)0x58, (byte)0x71,
+ (byte)0x51, (byte)0x8c, (byte)0xf4, (byte)0x2a,
+ (byte)0x20, (byte)0x9e, (byte)0x1a, (byte)0xa0,
+ (byte)0x26, (byte)0x99, (byte)0x75, (byte)0xd6,
+ (byte)0x31, (byte)0x53, (byte)0x43, (byte)0x39,
+ (byte)0xf5, (byte)0x2a, (byte)0xa6, (byte)0x7e,
+ (byte)0x34, (byte)0x42, (byte)0x51, (byte)0x2a,
+ (byte)0x40, (byte)0x87, (byte)0x03, (byte)0x88,
+ (byte)0x43, (byte)0x69, (byte)0xb2, (byte)0x89,
+ (byte)0x6d, (byte)0x20, (byte)0xbd, (byte)0x7d,
+ (byte)0x71, (byte)0xef, (byte)0x47, (byte)0x0a,
+ (byte)0xdf, (byte)0x06, (byte)0xc1, (byte)0x69,
+ (byte)0x66, (byte)0xa8, (byte)0x22, (byte)0x37,
+ (byte)0x1a, (byte)0x77, (byte)0x1e, (byte)0xc7,
+ (byte)0x94, (byte)0x4e, (byte)0x2c, (byte)0x27,
+ (byte)0x69, (byte)0x45, (byte)0x5e, (byte)0xc8,
+ (byte)0xf8, (byte)0x0c, (byte)0xb7, (byte)0xf8,
+ (byte)0xc0, (byte)0x8f, (byte)0x99, (byte)0xc1,
+ (byte)0xe5, (byte)0x28, (byte)0x9b, (byte)0xf9,
+ (byte)0x4c, (byte)0x94, (byte)0xc6, (byte)0xb1
+ };
+
+ static byte clientModulus[] = {
+ (byte)0x00,
+ (byte)0xbb, (byte)0xf0, (byte)0x40, (byte)0x36,
+ (byte)0xac, (byte)0x26, (byte)0x54, (byte)0x4e,
+ (byte)0xf4, (byte)0xa3, (byte)0x5a, (byte)0x00,
+ (byte)0x2f, (byte)0x69, (byte)0x21, (byte)0x6f,
+ (byte)0xb9, (byte)0x7a, (byte)0x3a, (byte)0x93,
+ (byte)0xec, (byte)0xa2, (byte)0xf6, (byte)0xe1,
+ (byte)0x8e, (byte)0xc7, (byte)0x63, (byte)0xd8,
+ (byte)0x2f, (byte)0x12, (byte)0x30, (byte)0x99,
+ (byte)0x2e, (byte)0xb0, (byte)0xf2, (byte)0x8f,
+ (byte)0xf8, (byte)0x27, (byte)0x2d, (byte)0x24,
+ (byte)0x78, (byte)0x28, (byte)0x84, (byte)0xf7,
+ (byte)0x01, (byte)0xbf, (byte)0x8d, (byte)0x44,
+ (byte)0x79, (byte)0xdd, (byte)0x3b, (byte)0xd2,
+ (byte)0x55, (byte)0xf3, (byte)0xce, (byte)0x3c,
+ (byte)0xb2, (byte)0x5b, (byte)0x21, (byte)0x7d,
+ (byte)0xef, (byte)0xfd, (byte)0x33, (byte)0x4a,
+ (byte)0xb1, (byte)0xa3, (byte)0xff, (byte)0xc6,
+ (byte)0xc8, (byte)0x9b, (byte)0xb9, (byte)0x0f,
+ (byte)0x7c, (byte)0x41, (byte)0x35, (byte)0x97,
+ (byte)0xf9, (byte)0xdb, (byte)0x3a, (byte)0x05,
+ (byte)0x60, (byte)0x05, (byte)0x15, (byte)0xaf,
+ (byte)0x59, (byte)0x17, (byte)0x92, (byte)0xa3,
+ (byte)0x10, (byte)0xad, (byte)0x16, (byte)0x1c,
+ (byte)0xe4, (byte)0x07, (byte)0x53, (byte)0xaf,
+ (byte)0xa8, (byte)0x76, (byte)0xa2, (byte)0x56,
+ (byte)0x2a, (byte)0x92, (byte)0xd3, (byte)0xf9,
+ (byte)0x28, (byte)0xe0, (byte)0x78, (byte)0xcf,
+ (byte)0x5e, (byte)0x1f, (byte)0x48, (byte)0xab,
+ (byte)0x5c, (byte)0x19, (byte)0xdd, (byte)0xe1,
+ (byte)0x67, (byte)0x43, (byte)0xba, (byte)0x75,
+ (byte)0x8d, (byte)0xf5, (byte)0x82, (byte)0xac,
+ (byte)0x43, (byte)0x92, (byte)0x44, (byte)0x1b
+ };
+
+ static char passphrase[] = "passphrase".toCharArray();
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+
+ /*
+ * Turn on SSL debugging?
+ */
+ static boolean debug = false;
+
+ private SSLServerSocket sslServerSocket = null;
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, serverCertStr,
+ serverModulus, serverPrivateExponent, passphrase);
+ SSLServerSocketFactory sslssf = context.getServerSocketFactory();
+
+ sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ sslSocket.setNeedClientAuth(true);
+ if (sslSocket instanceof SSLSocketImpl) {
+ ((SSLSocketImpl)sslSocket).trySetHostnameVerification("HTTPS");
+ }
+
+ PrintStream out =
+ new PrintStream(sslSocket.getOutputStream());
+
+ try {
+ // ignore request data
+
+ // send the response
+ out.print("HTTP/1.1 200 OK\r\n");
+ out.print("Content-Type: text/html; charset=iso-8859-1\r\n");
+ out.print("Content-Length: "+ 9 +"\r\n");
+ out.print("\r\n");
+ out.print("Testing\r\n");
+ out.flush();
+ } finally {
+ // close the socket
+ Thread.sleep(2000);
+ System.out.println("Server closing socket");
+ sslSocket.close();
+ serverReady = false;
+ }
+
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
+ clientModulus, clientPrivateExponent, passphrase);
+
+ SSLContext.setDefault(context);
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ HttpsURLConnection http = null;
+
+ /* establish http connection to server */
+ URL url = new URL("https://localhost:" + serverPort+"/");
+ System.out.println("url is "+url.toString());
+
+ http = (HttpsURLConnection)url.openConnection();
+
+ int respCode = http.getResponseCode();
+ System.out.println("respCode = "+respCode);
+
+ http.disconnect();
+ }
+
+ /*
+ * =============================================================
+ * The remainder is just support stuff
+ */
+
+ // use any free port by default
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ public static void main(String args[]) throws Exception {
+ if (debug)
+ System.setProperty("javax.net.debug", "all");
+
+ /*
+ * Start the tests.
+ */
+ new IPIdentities();
+ }
+
+ Thread clientThread = null;
+ Thread serverThread = null;
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ IPIdentities() throws Exception {
+ if (separateServerThread) {
+ startServer(true);
+ startClient(false);
+ } else {
+ startClient(true);
+ startServer(false);
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ serverThread.join();
+ } else {
+ clientThread.join();
+ }
+
+ /*
+ * When we get here, the test is pretty much over.
+ *
+ * If the main thread excepted, that propagates back
+ * immediately. If the other thread threw an exception, we
+ * should report back.
+ */
+ if (serverException != null)
+ throw serverException;
+ if (clientException != null)
+ throw clientException;
+ }
+
+ void startServer(boolean newThread) throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ doServerSide();
+ }
+ }
+
+ void startClient(boolean newThread) throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ doClientSide();
+ }
+ }
+
+ // get the ssl context
+ private static SSLContext getSSLContext(String trusedCertStr,
+ String keyCertStr, byte[] modulus,
+ byte[] privateExponent, char[] passphrase) throws Exception {
+
+ // generate certificate from cert string
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+ ByteArrayInputStream is =
+ new ByteArrayInputStream(trusedCertStr.getBytes());
+ Certificate trusedCert = cf.generateCertificate(is);
+ is.close();
+
+ // create a key store
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(null, null);
+
+ // import the trused cert
+ ks.setCertificateEntry("RSA Export Signer", trusedCert);
+
+ if (keyCertStr != null) {
+ // generate the private key.
+ RSAPrivateKeySpec priKeySpec = new RSAPrivateKeySpec(
+ new BigInteger(modulus),
+ new BigInteger(privateExponent));
+ KeyFactory kf = KeyFactory.getInstance("RSA");
+ RSAPrivateKey priKey =
+ (RSAPrivateKey)kf.generatePrivate(priKeySpec);
+
+ // generate certificate chain
+ is = new ByteArrayInputStream(keyCertStr.getBytes());
+ Certificate keyCert = cf.generateCertificate(is);
+ is.close();
+
+ Certificate[] chain = new Certificate[2];
+ chain[0] = keyCert;
+ chain[1] = trusedCert;
+
+ // import the key entry.
+ ks.setKeyEntry("Whatever", priKey, passphrase, chain);
+ }
+
+ // create SSL context
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+ tmf.init(ks);
+
+ SSLContext ctx = SSLContext.getInstance("TLS");
+
+ if (keyCertStr != null) {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, passphrase);
+
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ } else {
+ ctx.init(null, tmf.getTrustManagers(), null);
+ }
+
+ return ctx;
+ }
+
+}
diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java
new file mode 100644
index 00000000000..0bde45f909d
--- /dev/null
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java
@@ -0,0 +1,879 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
+ * @bug 6766775
+ * @author Xuelei Fan
+ */
+
+import java.net.*;
+import java.util.*;
+import java.io.*;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.KeyFactory;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import java.math.BigInteger;
+
+import sun.security.ssl.SSLSocketImpl;
+
+/*
+ * Certificates and key used in the test.
+ *
+ * TLS server certificate:
+ * server private key:
+ * -----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,D9AE407F6D0E389A
+ *
+ * WPrA7TFol/cQCcp9oHnXWNpYlvRbbIcQj0m+RKT2Iuzfus+DHt3Zadf8nJpKfX2e
+ * h2rnhlzCN9M7djRDooZKDOPCsdBn51Au7HlZF3S3Opgo7D8XFM1a8t1Je4ke14oI
+ * nw6QKYsBblRziPnP2PZ0zvX24nOv7bbY8beynlJHGs00VWSFdoH2DS0aE1p6D+3n
+ * ptJuJ75dVfZFK4X7162APlNXevX8D6PEQpSiRw1rjjGGcnvQ4HdWk3BxDVDcCNJb
+ * Y1aGNRxsjTDvPi3R9Qx2M+W03QzEPx4SR3ZHVskeSJHaetM0TM/w/45Paq4GokXP
+ * ZeTnbEx1xmjkA7h+t4doLL4watx5F6yLsJzu8xB3lt/1EtmkYtLz1t7X4BetPAXz
+ * zS69X/VwhKfsOI3qXBWuL2oHPyhDmT1gcaUQwEPSV6ogHEEQEDXdiUS8heNK13KF
+ * TCQYFkETvV2BLxUhV1hypPzRQ6tUpJiAbD5KmoK2lD9slshG2QtvKQq0/bgkDY5J
+ * LhDHV2dtcZ3kDPkkZXpbcJQvoeH3d09C5sIsuTFo2zgNR6oETHUc5TzP6FY2YYRa
+ * QcK5HcmtsRRiXFm01ac+aMejJUIujjFt84SiKWT/73vC8AmY4tYcJBLjCg4XIxSH
+ * fdDFLL1YZENNO5ivlp8mdiHqcawx+36L7DrEZQ8RZt6cqST5t/+XTdM74s6k81GT
+ * pNsa82P2K2zmIUZ/DL2mKjW1vfRByw1NQFEBkN3vdyZxYfM/JyUzX4hbjXBEkh9Q
+ * QYrcwLKLjis2QzSvK04B3bvRzRb+4ocWiso8ZPAXAIxZFBWDpTMM2A==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICXAIBAAKBgQClrFscN6LdmYktsnm4j9VIpecchBeNaZzGrG358h0fORna03Ie
+ * buxEzHCk3LoAMPagTz1UemFqzFfQCn+VKBg/mtmU8hvIJIh+/p0PPftXUwizIDPU
+ * PxdHFNHN6gjYDnVOr77M0uyvqXpJ38LZrLgkQJCmA1Yq0DAFQCxPq9l0iQIDAQAB
+ * AoGAbqcbg1E1mkR99uOJoNeQYKFOJyGiiXTMnXV1TseC4+PDfQBU7Dax35GcesBi
+ * CtapIpFKKS5D+ozY6b7ZT8ojxuQ/uHLPAvz0WDR3ds4iRF8tyu71Q1ZHcQsJa17y
+ * yO7UbkSSKn/Mp9Rb+/dKqftUGNXVFLqgHBOzN2s3We3bbbECQQDYBPKOg3hkaGHo
+ * OhpHKqtQ6EVkldihG/3i4WejRonelXN+HRh1KrB2HBx0M8D/qAzP1i3rNSlSHer4
+ * 59YRTJnHAkEAxFX/sVYSn07BHv9Zhn6XXct/Cj43z/tKNbzlNbcxqQwQerw3IH51
+ * 8UH2YOA+GD3lXbKp+MytoFLWv8zg4YT/LwJAfqan75Z1R6lLffRS49bIiq8jwE16
+ * rTrUJ+kv8jKxMqc9B3vXkxpsS1M/+4E8bqgAmvpgAb8xcsvHsBd9ErdukQJBAKs2
+ * j67W75BrPjBI34pQ1LEfp56IGWXOrq1kF8IbCjxv3+MYRT6Z6UJFkpRymNPNDjsC
+ * dgUYgITiGJHUGXuw3lMCQHEHqo9ZtXz92yFT+VhsNc29B8m/sqUJdtCcMd/jGpAF
+ * u6GHufjqIZBpQsk63wbwESAPZZ+kk1O1kS5GIRLX608=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 6e:a7:1b:83:51:35:9a:44:7d:f6:e3:89:a0:d7:90:
+ * 60:a1:4e:27:21:a2:89:74:cc:9d:75:75:4e:c7:82:
+ * e3:e3:c3:7d:00:54:ec:36:b1:df:91:9c:7a:c0:62:
+ * 0a:d6:a9:22:91:4a:29:2e:43:fa:8c:d8:e9:be:d9:
+ * 4f:ca:23:c6:e4:3f:b8:72:cf:02:fc:f4:58:34:77:
+ * 76:ce:22:44:5f:2d:ca:ee:f5:43:56:47:71:0b:09:
+ * 6b:5e:f2:c8:ee:d4:6e:44:92:2a:7f:cc:a7:d4:5b:
+ * fb:f7:4a:a9:fb:54:18:d5:d5:14:ba:a0:1c:13:b3:
+ * 37:6b:37:59:ed:db:6d:b1
+ * prime1:
+ * 00:d8:04:f2:8e:83:78:64:68:61:e8:3a:1a:47:2a:
+ * ab:50:e8:45:64:95:d8:a1:1b:fd:e2:e1:67:a3:46:
+ * 89:de:95:73:7e:1d:18:75:2a:b0:76:1c:1c:74:33:
+ * c0:ff:a8:0c:cf:d6:2d:eb:35:29:52:1d:ea:f8:e7:
+ * d6:11:4c:99:c7
+ * prime2:
+ * 00:c4:55:ff:b1:56:12:9f:4e:c1:1e:ff:59:86:7e:
+ * 97:5d:cb:7f:0a:3e:37:cf:fb:4a:35:bc:e5:35:b7:
+ * 31:a9:0c:10:7a:bc:37:20:7e:75:f1:41:f6:60:e0:
+ * 3e:18:3d:e5:5d:b2:a9:f8:cc:ad:a0:52:d6:bf:cc:
+ * e0:e1:84:ff:2f
+ * exponent1:
+ * 7e:a6:a7:ef:96:75:47:a9:4b:7d:f4:52:e3:d6:c8:
+ * 8a:af:23:c0:4d:7a:ad:3a:d4:27:e9:2f:f2:32:b1:
+ * 32:a7:3d:07:7b:d7:93:1a:6c:4b:53:3f:fb:81:3c:
+ * 6e:a8:00:9a:fa:60:01:bf:31:72:cb:c7:b0:17:7d:
+ * 12:b7:6e:91
+ * exponent2:
+ * 00:ab:36:8f:ae:d6:ef:90:6b:3e:30:48:df:8a:50:
+ * d4:b1:1f:a7:9e:88:19:65:ce:ae:ad:64:17:c2:1b:
+ * 0a:3c:6f:df:e3:18:45:3e:99:e9:42:45:92:94:72:
+ * 98:d3:cd:0e:3b:02:76:05:18:80:84:e2:18:91:d4:
+ * 19:7b:b0:de:53
+ * coefficient:
+ * 71:07:aa:8f:59:b5:7c:fd:db:21:53:f9:58:6c:35:
+ * cd:bd:07:c9:bf:b2:a5:09:76:d0:9c:31:df:e3:1a:
+ * 90:05:bb:a1:87:b9:f8:ea:21:90:69:42:c9:3a:df:
+ * 06:f0:11:20:0f:65:9f:a4:93:53:b5:91:2e:46:21:
+ * 12:d7:eb:4f
+ *
+ *
+ * server certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 4 (0x4)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:21:16 2008 GMT
+ * Not After : Aug 25 03:21:16 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Server, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:a5:ac:5b:1c:37:a2:dd:99:89:2d:b2:79:b8:8f:
+ * d5:48:a5:e7:1c:84:17:8d:69:9c:c6:ac:6d:f9:f2:
+ * 1d:1f:39:19:da:d3:72:1e:6e:ec:44:cc:70:a4:dc:
+ * ba:00:30:f6:a0:4f:3d:54:7a:61:6a:cc:57:d0:0a:
+ * 7f:95:28:18:3f:9a:d9:94:f2:1b:c8:24:88:7e:fe:
+ * 9d:0f:3d:fb:57:53:08:b3:20:33:d4:3f:17:47:14:
+ * d1:cd:ea:08:d8:0e:75:4e:af:be:cc:d2:ec:af:a9:
+ * 7a:49:df:c2:d9:ac:b8:24:40:90:a6:03:56:2a:d0:
+ * 30:05:40:2c:4f:ab:d9:74:89
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * ED:6E:DB:F4:B5:56:C8:FB:1A:06:61:3F:0F:08:BB:A6:04:D8:16:54
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * IP Address:127.0.0.1, DNS:localhost
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICqjCCAhOgAwIBAgIBBDANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzIxMTZaFw0yODA4MjUwMzIxMTZaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3
+ * ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6
+ * YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS
+ * 7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjeTB3MAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAdBgNVHREBAf8EEzARhwR/AAAB
+ * gglsb2NhbGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAWTrftGaL73lKLgRTrChGR+F6
+ * //qvs0OM94IOKVeHz36NO49cMJmhJSbKdiGIkppBgpLIBoWxZlN9NOO9oSXFYZsZ
+ * rHaAe9/lWMtQM7XpjqjhWVhB5VPvWFbkorQFMtRYLf7pkonGPFq8GOO1s0TKhogC
+ * jtYCdzlrU4v+om/J3H8=
+ * -----END CERTIFICATE-----
+ *
+ *
+ * TLS client certificate:
+ * client private key:
+ * ----BEGIN RSA PRIVATE KEY-----
+ * Proc-Type: 4,ENCRYPTED
+ * DEK-Info: DES-EDE3-CBC,FA2A435CD35A9390
+ *
+ * Z+Y2uaETbsUWIyJUyVu1UV2G4rgFYJyACZT6Tp1KjRtxflSh2kXkJ9MpuXMXA0V4
+ * Yy3fDzPqCL9NJmQAYRlAx/W/+j4F5EyMWDIx8fUxzONRZyoiwF7jLm+KscAfv6Pf
+ * q7ItWOdj3z7IYrwlB8YIGd3F2cDKT3S+lYRk7rKb/qT7itbuHnY4Ardh3yl+MZak
+ * jBp+ELUlRsUqSr1V0LoM+0rCCykarpyfhpxEcqsrl0v9Cyi5uhU50/oKv5zql3SH
+ * l2ImgDjp3batAs8+Bd4NF2aqi0a7Hy44JUHxRm4caZryU/i/D9N1MbuM6882HLat
+ * 5N0G+NaIUfywa8mjwq2D5aiit18HqKA6XeRRYeJ5Dvu9DCO4GeFSwcUFIBMI0L46
+ * 7s114+oDodg57pMgITi+04vmUxvqlN9aiyd7f5Fgd7PeHGeOdbMz1NaJLJaPI9++
+ * NakK8eK9iwT/Gdq0Uap5/CHW7vCT5PO+h3HY0STH0lWStXhdWnFO04zTdywsbSp+
+ * DLpHeFT66shfeUlxR0PsCbG9vPRt/QmGLeYQZITppWo/ylSq4j+pRIuXvuWHdBRN
+ * rTZ8QF4Y7AxQUXVz1j1++s6ZMHTzaK2i9HrhmDs1MbJl+QwWre3Xpv3LvTVz3k5U
+ * wX8kuY1m3STt71QCaRWENq5sRaMImLxZbxc/ivFl9RAzUqo4NCxLod/QgA4iLqtO
+ * ztnlpzwlC/F8HbQ1oqYWwnZAPhzU/cULtstl+Yrws2c2atO323LbPXZqbASySgig
+ * sNpFXQMObdfP6LN23bY+1SvtK7V4NUTNhpdIc6INQAQ=
+ * -----END RSA PRIVATE KEY-----
+ *
+ * -----BEGIN RSA PRIVATE KEY-----
+ * MIICWwIBAAKBgQC78EA2rCZUTvSjWgAvaSFvuXo6k+yi9uGOx2PYLxIwmS6w8o/4
+ * Jy0keCiE9wG/jUR53TvSVfPOPLJbIX3v/TNKsaP/xsibuQ98QTWX+ds6BWAFFa9Z
+ * F5KjEK0WHOQHU6+odqJWKpLT+SjgeM9eH0irXBnd4WdDunWN9YKsQ5JEGwIDAQAB
+ * AoGAEbdqNj0wN85hnWyEi/ObJU8UyKTdL9eaF72QGfcF/fLSxfd3vurihIeXOkGW
+ * tpn4lIxYcVGM9CognhqgJpl11jFTQzn1KqZ+NEJRKkCHA4hDabKJbSC9fXHvRwrf
+ * BsFpZqgiNxp3HseUTiwnaUVeyPgMt/jAj5nB5Sib+UyUxrECQQDnNQBiF2aifEg6
+ * zbJOOC7he5CHAdkFxSxWVFVHL6EfXfqdLVkUohMbgZv+XxyIeU2biOExSg49Kds3
+ * FOKgTau1AkEA0Bd1haj6QuCo8I0AXm2WO+MMTZMTvtHD/bGjKNM+fT4I8rKYnQRX
+ * 1acHdqS9Xx2rNJqZgkMmpESIdPR2fc4yjwJALFeM6EMmqvj8/VIf5UJ/Mz14fXwM
+ * PEARfckUxd9LnnFutCBTWlKvKXJVEZb6KO5ixPaegc57Jp3Vbh3yTN44lQJADD/1
+ * SSMDaIB1MYP7a5Oj7m6VQNPRq8AJe5vDcRnOae0G9dKRrVyeFxO4GsHj6/+BHp2j
+ * P8nYMn9eURQ7DXjf/QJAAQzMlWnKGSO8pyTDtnQx3hRMoUkOEhmNq4bQhLkYqtnY
+ * FcqpUQ2qMjW+NiNWk5HnTrMS3L9EdJobMUzaNZLy4w==
+ * -----END RSA PRIVATE KEY-----
+ *
+ * Private-Key: (1024 bit)
+ * modulus:
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * publicExponent: 65537 (0x10001)
+ * privateExponent:
+ * 11:b7:6a:36:3d:30:37:ce:61:9d:6c:84:8b:f3:9b:
+ * 25:4f:14:c8:a4:dd:2f:d7:9a:17:bd:90:19:f7:05:
+ * fd:f2:d2:c5:f7:77:be:ea:e2:84:87:97:3a:41:96:
+ * b6:99:f8:94:8c:58:71:51:8c:f4:2a:20:9e:1a:a0:
+ * 26:99:75:d6:31:53:43:39:f5:2a:a6:7e:34:42:51:
+ * 2a:40:87:03:88:43:69:b2:89:6d:20:bd:7d:71:ef:
+ * 47:0a:df:06:c1:69:66:a8:22:37:1a:77:1e:c7:94:
+ * 4e:2c:27:69:45:5e:c8:f8:0c:b7:f8:c0:8f:99:c1:
+ * e5:28:9b:f9:4c:94:c6:b1
+ * prime1:
+ * 00:e7:35:00:62:17:66:a2:7c:48:3a:cd:b2:4e:38:
+ * 2e:e1:7b:90:87:01:d9:05:c5:2c:56:54:55:47:2f:
+ * a1:1f:5d:fa:9d:2d:59:14:a2:13:1b:81:9b:fe:5f:
+ * 1c:88:79:4d:9b:88:e1:31:4a:0e:3d:29:db:37:14:
+ * e2:a0:4d:ab:b5
+ * prime2:
+ * 00:d0:17:75:85:a8:fa:42:e0:a8:f0:8d:00:5e:6d:
+ * 96:3b:e3:0c:4d:93:13:be:d1:c3:fd:b1:a3:28:d3:
+ * 3e:7d:3e:08:f2:b2:98:9d:04:57:d5:a7:07:76:a4:
+ * bd:5f:1d:ab:34:9a:99:82:43:26:a4:44:88:74:f4:
+ * 76:7d:ce:32:8f
+ * exponent1:
+ * 2c:57:8c:e8:43:26:aa:f8:fc:fd:52:1f:e5:42:7f:
+ * 33:3d:78:7d:7c:0c:3c:40:11:7d:c9:14:c5:df:4b:
+ * 9e:71:6e:b4:20:53:5a:52:af:29:72:55:11:96:fa:
+ * 28:ee:62:c4:f6:9e:81:ce:7b:26:9d:d5:6e:1d:f2:
+ * 4c:de:38:95
+ * exponent2:
+ * 0c:3f:f5:49:23:03:68:80:75:31:83:fb:6b:93:a3:
+ * ee:6e:95:40:d3:d1:ab:c0:09:7b:9b:c3:71:19:ce:
+ * 69:ed:06:f5:d2:91:ad:5c:9e:17:13:b8:1a:c1:e3:
+ * eb:ff:81:1e:9d:a3:3f:c9:d8:32:7f:5e:51:14:3b:
+ * 0d:78:df:fd
+ * coefficient:
+ * 01:0c:cc:95:69:ca:19:23:bc:a7:24:c3:b6:74:31:
+ * de:14:4c:a1:49:0e:12:19:8d:ab:86:d0:84:b9:18:
+ * aa:d9:d8:15:ca:a9:51:0d:aa:32:35:be:36:23:56:
+ * 93:91:e7:4e:b3:12:dc:bf:44:74:9a:1b:31:4c:da:
+ * 35:92:f2:e3
+ *
+ * client certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 5 (0x5)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 03:22:10 2008 GMT
+ * Not After : Aug 25 03:22:10 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org, OU=SSL-Client, CN=localhost
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:bb:f0:40:36:ac:26:54:4e:f4:a3:5a:00:2f:69:
+ * 21:6f:b9:7a:3a:93:ec:a2:f6:e1:8e:c7:63:d8:2f:
+ * 12:30:99:2e:b0:f2:8f:f8:27:2d:24:78:28:84:f7:
+ * 01:bf:8d:44:79:dd:3b:d2:55:f3:ce:3c:b2:5b:21:
+ * 7d:ef:fd:33:4a:b1:a3:ff:c6:c8:9b:b9:0f:7c:41:
+ * 35:97:f9:db:3a:05:60:05:15:af:59:17:92:a3:10:
+ * ad:16:1c:e4:07:53:af:a8:76:a2:56:2a:92:d3:f9:
+ * 28:e0:78:cf:5e:1f:48:ab:5c:19:dd:e1:67:43:ba:
+ * 75:8d:f5:82:ac:43:92:44:1b
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Basic Constraints:
+ * CA:FALSE
+ * X509v3 Key Usage:
+ * Digital Signature, Non Repudiation, Key Encipherment
+ * X509v3 Subject Key Identifier:
+ * CD:BB:C8:85:AA:91:BD:FD:1D:BE:CD:67:7C:FF:B3:E9:4C:A8:22:E6
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ *
+ * X509v3 Subject Alternative Name: critical
+ * IP Address:127.0.0.1, DNS:localhost
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICqjCCAhOgAwIBAgIBBTANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMzIyMTBaFw0yODA4MjUwMzIyMTBaMHIxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD
+ * VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas
+ * JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV
+ * 8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq
+ * ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjeTB3MAkGA1UdEwQCMAAw
+ * CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV
+ * HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAdBgNVHREBAf8EEzARhwR/AAAB
+ * gglsb2NhbGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAwDc4f13abs9ZeEkrl5WV2Z74
+ * BlmBhXu8ExtAvoF9q6Ug6xV1MDpxbD124KfUHHL0kNMhMB1WIpC0kOnQBxziNpfS
+ * 7u6GOc3tWLSxw/sHoJGCefnRBllLZOoQuSBrWB8qgilL6HRmZ4UqDcXu4UCaLBZ0
+ * KGDT5ASEN6Lq2GtiP4Y=
+ * -----END CERTIFICATE-----
+ *
+ *
+ *
+ * Trusted CA certificate:
+ * Certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 0 (0x0)
+ * Signature Algorithm: md5WithRSAEncryption
+ * Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Validity
+ * Not Before: Dec 8 02:43:36 2008 GMT
+ * Not After : Aug 25 02:43:36 2028 GMT
+ * Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org
+ * Subject Public Key Info:
+ * Public Key Algorithm: rsaEncryption
+ * RSA Public Key: (1024 bit)
+ * Modulus (1024 bit):
+ * 00:cb:c4:38:20:07:be:88:a7:93:b0:a1:43:51:2d:
+ * d7:8e:85:af:54:dd:ad:a2:7b:23:5b:cf:99:13:53:
+ * 99:45:7d:ee:6d:ba:2d:bf:e3:ad:6e:3d:9f:1a:f9:
+ * 03:97:e0:17:55:ae:11:26:57:de:01:29:8e:05:3f:
+ * 21:f7:e7:36:e8:2e:37:d7:48:ac:53:d6:60:0e:c7:
+ * 50:6d:f6:c5:85:f7:8b:a6:c5:91:35:72:3c:94:ee:
+ * f1:17:f0:71:e3:ec:1b:ce:ca:4e:40:42:b0:6d:ee:
+ * 6a:0e:d6:e5:ad:3c:0f:c9:ba:82:4f:78:f8:89:97:
+ * 89:2a:95:12:4c:d8:09:2a:e9
+ * Exponent: 65537 (0x10001)
+ * X509v3 extensions:
+ * X509v3 Subject Key Identifier:
+ * FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * X509v3 Authority Key Identifier:
+ * keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14
+ * DirName:/C=US/ST=Some-State/L=Some-City/O=Some-Org
+ * serial:00
+ *
+ * X509v3 Basic Constraints:
+ * CA:TRUE
+ * Signature Algorithm: md5WithRSAEncryption
+ *
+ * -----BEGIN CERTIFICATE-----
+ * MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET
+ * MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK
+ * EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ
+ * BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp
+ * dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
+ * gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX
+ * 4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj
+ * 7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G
+ * A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ
+ * hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt
+ * U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw
+ * DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA
+ * ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ
+ * LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P
+ * 6Mvf0r1PNTY2hwTJLJmKtg==
+ * -----END CERTIFICATE---
+ */
+
+
+public class Identities {
+ static Map cookies;
+ ServerSocket ss;
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+
+ /*
+ * Where do we find the keystores?
+ */
+ static String trusedCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n" +
+ "gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX\n" +
+ "4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj\n" +
+ "7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G\n" +
+ "A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ\n" +
+ "hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt\n" +
+ "U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw\n" +
+ "DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA\n" +
+ "ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ\n" +
+ "LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P\n" +
+ "6Mvf0r1PNTY2hwTJLJmKtg==\n" +
+ "-----END CERTIFICATE-----";
+
+ static String serverCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICqjCCAhOgAwIBAgIBBDANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzIxMTZaFw0yODA4MjUwMzIxMTZaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtU2VydmVyMRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKWsWxw3\n" +
+ "ot2ZiS2yebiP1Uil5xyEF41pnMasbfnyHR85GdrTch5u7ETMcKTcugAw9qBPPVR6\n" +
+ "YWrMV9AKf5UoGD+a2ZTyG8gkiH7+nQ89+1dTCLMgM9Q/F0cU0c3qCNgOdU6vvszS\n" +
+ "7K+peknfwtmsuCRAkKYDVirQMAVALE+r2XSJAgMBAAGjeTB3MAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTtbtv0tVbI+xoGYT8PCLumBNgWVDAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAdBgNVHREBAf8EEzARhwR/AAAB\n" +
+ "gglsb2NhbGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAWTrftGaL73lKLgRTrChGR+F6\n" +
+ "//qvs0OM94IOKVeHz36NO49cMJmhJSbKdiGIkppBgpLIBoWxZlN9NOO9oSXFYZsZ\n" +
+ "rHaAe9/lWMtQM7XpjqjhWVhB5VPvWFbkorQFMtRYLf7pkonGPFq8GOO1s0TKhogC\n" +
+ "jtYCdzlrU4v+om/J3H8=\n" +
+ "-----END CERTIFICATE-----";
+
+ static String clientCertStr =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICqjCCAhOgAwIBAgIBBTANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" +
+ "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" +
+ "EwhTb21lLU9yZzAeFw0wODEyMDgwMzIyMTBaFw0yODA4MjUwMzIyMTBaMHIxCzAJ\n" +
+ "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" +
+ "dHkxETAPBgNVBAoTCFNvbWUtT3JnMRMwEQYDVQQLEwpTU0wtQ2xpZW50MRIwEAYD\n" +
+ "VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALvwQDas\n" +
+ "JlRO9KNaAC9pIW+5ejqT7KL24Y7HY9gvEjCZLrDyj/gnLSR4KIT3Ab+NRHndO9JV\n" +
+ "8848slshfe/9M0qxo//GyJu5D3xBNZf52zoFYAUVr1kXkqMQrRYc5AdTr6h2olYq\n" +
+ "ktP5KOB4z14fSKtcGd3hZ0O6dY31gqxDkkQbAgMBAAGjeTB3MAkGA1UdEwQCMAAw\n" +
+ "CwYDVR0PBAQDAgXgMB0GA1UdDgQWBBTNu8iFqpG9/R2+zWd8/7PpTKgi5jAfBgNV\n" +
+ "HSMEGDAWgBT6uVG/TOfZhpgz+efLHvEzSfeoFDAdBgNVHREBAf8EEzARhwR/AAAB\n" +
+ "gglsb2NhbGhvc3QwDQYJKoZIhvcNAQEEBQADgYEAwDc4f13abs9ZeEkrl5WV2Z74\n" +
+ "BlmBhXu8ExtAvoF9q6Ug6xV1MDpxbD124KfUHHL0kNMhMB1WIpC0kOnQBxziNpfS\n" +
+ "7u6GOc3tWLSxw/sHoJGCefnRBllLZOoQuSBrWB8qgilL6HRmZ4UqDcXu4UCaLBZ0\n" +
+ "KGDT5ASEN6Lq2GtiP4Y=\n" +
+ "-----END CERTIFICATE-----";
+
+ static byte serverPrivateExponent[] = {
+ (byte)0x6e, (byte)0xa7, (byte)0x1b, (byte)0x83,
+ (byte)0x51, (byte)0x35, (byte)0x9a, (byte)0x44,
+ (byte)0x7d, (byte)0xf6, (byte)0xe3, (byte)0x89,
+ (byte)0xa0, (byte)0xd7, (byte)0x90, (byte)0x60,
+ (byte)0xa1, (byte)0x4e, (byte)0x27, (byte)0x21,
+ (byte)0xa2, (byte)0x89, (byte)0x74, (byte)0xcc,
+ (byte)0x9d, (byte)0x75, (byte)0x75, (byte)0x4e,
+ (byte)0xc7, (byte)0x82, (byte)0xe3, (byte)0xe3,
+ (byte)0xc3, (byte)0x7d, (byte)0x00, (byte)0x54,
+ (byte)0xec, (byte)0x36, (byte)0xb1, (byte)0xdf,
+ (byte)0x91, (byte)0x9c, (byte)0x7a, (byte)0xc0,
+ (byte)0x62, (byte)0x0a, (byte)0xd6, (byte)0xa9,
+ (byte)0x22, (byte)0x91, (byte)0x4a, (byte)0x29,
+ (byte)0x2e, (byte)0x43, (byte)0xfa, (byte)0x8c,
+ (byte)0xd8, (byte)0xe9, (byte)0xbe, (byte)0xd9,
+ (byte)0x4f, (byte)0xca, (byte)0x23, (byte)0xc6,
+ (byte)0xe4, (byte)0x3f, (byte)0xb8, (byte)0x72,
+ (byte)0xcf, (byte)0x02, (byte)0xfc, (byte)0xf4,
+ (byte)0x58, (byte)0x34, (byte)0x77, (byte)0x76,
+ (byte)0xce, (byte)0x22, (byte)0x44, (byte)0x5f,
+ (byte)0x2d, (byte)0xca, (byte)0xee, (byte)0xf5,
+ (byte)0x43, (byte)0x56, (byte)0x47, (byte)0x71,
+ (byte)0x0b, (byte)0x09, (byte)0x6b, (byte)0x5e,
+ (byte)0xf2, (byte)0xc8, (byte)0xee, (byte)0xd4,
+ (byte)0x6e, (byte)0x44, (byte)0x92, (byte)0x2a,
+ (byte)0x7f, (byte)0xcc, (byte)0xa7, (byte)0xd4,
+ (byte)0x5b, (byte)0xfb, (byte)0xf7, (byte)0x4a,
+ (byte)0xa9, (byte)0xfb, (byte)0x54, (byte)0x18,
+ (byte)0xd5, (byte)0xd5, (byte)0x14, (byte)0xba,
+ (byte)0xa0, (byte)0x1c, (byte)0x13, (byte)0xb3,
+ (byte)0x37, (byte)0x6b, (byte)0x37, (byte)0x59,
+ (byte)0xed, (byte)0xdb, (byte)0x6d, (byte)0xb1
+ };
+
+ static byte serverModulus[] = {
+ (byte)0x00,
+ (byte)0xa5, (byte)0xac, (byte)0x5b, (byte)0x1c,
+ (byte)0x37, (byte)0xa2, (byte)0xdd, (byte)0x99,
+ (byte)0x89, (byte)0x2d, (byte)0xb2, (byte)0x79,
+ (byte)0xb8, (byte)0x8f, (byte)0xd5, (byte)0x48,
+ (byte)0xa5, (byte)0xe7, (byte)0x1c, (byte)0x84,
+ (byte)0x17, (byte)0x8d, (byte)0x69, (byte)0x9c,
+ (byte)0xc6, (byte)0xac, (byte)0x6d, (byte)0xf9,
+ (byte)0xf2, (byte)0x1d, (byte)0x1f, (byte)0x39,
+ (byte)0x19, (byte)0xda, (byte)0xd3, (byte)0x72,
+ (byte)0x1e, (byte)0x6e, (byte)0xec, (byte)0x44,
+ (byte)0xcc, (byte)0x70, (byte)0xa4, (byte)0xdc,
+ (byte)0xba, (byte)0x00, (byte)0x30, (byte)0xf6,
+ (byte)0xa0, (byte)0x4f, (byte)0x3d, (byte)0x54,
+ (byte)0x7a, (byte)0x61, (byte)0x6a, (byte)0xcc,
+ (byte)0x57, (byte)0xd0, (byte)0x0a, (byte)0x7f,
+ (byte)0x95, (byte)0x28, (byte)0x18, (byte)0x3f,
+ (byte)0x9a, (byte)0xd9, (byte)0x94, (byte)0xf2,
+ (byte)0x1b, (byte)0xc8, (byte)0x24, (byte)0x88,
+ (byte)0x7e, (byte)0xfe, (byte)0x9d, (byte)0x0f,
+ (byte)0x3d, (byte)0xfb, (byte)0x57, (byte)0x53,
+ (byte)0x08, (byte)0xb3, (byte)0x20, (byte)0x33,
+ (byte)0xd4, (byte)0x3f, (byte)0x17, (byte)0x47,
+ (byte)0x14, (byte)0xd1, (byte)0xcd, (byte)0xea,
+ (byte)0x08, (byte)0xd8, (byte)0x0e, (byte)0x75,
+ (byte)0x4e, (byte)0xaf, (byte)0xbe, (byte)0xcc,
+ (byte)0xd2, (byte)0xec, (byte)0xaf, (byte)0xa9,
+ (byte)0x7a, (byte)0x49, (byte)0xdf, (byte)0xc2,
+ (byte)0xd9, (byte)0xac, (byte)0xb8, (byte)0x24,
+ (byte)0x40, (byte)0x90, (byte)0xa6, (byte)0x03,
+ (byte)0x56, (byte)0x2a, (byte)0xd0, (byte)0x30,
+ (byte)0x05, (byte)0x40, (byte)0x2c, (byte)0x4f,
+ (byte)0xab, (byte)0xd9, (byte)0x74, (byte)0x89
+ };
+
+ static byte clientPrivateExponent[] = {
+ (byte)0x11, (byte)0xb7, (byte)0x6a, (byte)0x36,
+ (byte)0x3d, (byte)0x30, (byte)0x37, (byte)0xce,
+ (byte)0x61, (byte)0x9d, (byte)0x6c, (byte)0x84,
+ (byte)0x8b, (byte)0xf3, (byte)0x9b, (byte)0x25,
+ (byte)0x4f, (byte)0x14, (byte)0xc8, (byte)0xa4,
+ (byte)0xdd, (byte)0x2f, (byte)0xd7, (byte)0x9a,
+ (byte)0x17, (byte)0xbd, (byte)0x90, (byte)0x19,
+ (byte)0xf7, (byte)0x05, (byte)0xfd, (byte)0xf2,
+ (byte)0xd2, (byte)0xc5, (byte)0xf7, (byte)0x77,
+ (byte)0xbe, (byte)0xea, (byte)0xe2, (byte)0x84,
+ (byte)0x87, (byte)0x97, (byte)0x3a, (byte)0x41,
+ (byte)0x96, (byte)0xb6, (byte)0x99, (byte)0xf8,
+ (byte)0x94, (byte)0x8c, (byte)0x58, (byte)0x71,
+ (byte)0x51, (byte)0x8c, (byte)0xf4, (byte)0x2a,
+ (byte)0x20, (byte)0x9e, (byte)0x1a, (byte)0xa0,
+ (byte)0x26, (byte)0x99, (byte)0x75, (byte)0xd6,
+ (byte)0x31, (byte)0x53, (byte)0x43, (byte)0x39,
+ (byte)0xf5, (byte)0x2a, (byte)0xa6, (byte)0x7e,
+ (byte)0x34, (byte)0x42, (byte)0x51, (byte)0x2a,
+ (byte)0x40, (byte)0x87, (byte)0x03, (byte)0x88,
+ (byte)0x43, (byte)0x69, (byte)0xb2, (byte)0x89,
+ (byte)0x6d, (byte)0x20, (byte)0xbd, (byte)0x7d,
+ (byte)0x71, (byte)0xef, (byte)0x47, (byte)0x0a,
+ (byte)0xdf, (byte)0x06, (byte)0xc1, (byte)0x69,
+ (byte)0x66, (byte)0xa8, (byte)0x22, (byte)0x37,
+ (byte)0x1a, (byte)0x77, (byte)0x1e, (byte)0xc7,
+ (byte)0x94, (byte)0x4e, (byte)0x2c, (byte)0x27,
+ (byte)0x69, (byte)0x45, (byte)0x5e, (byte)0xc8,
+ (byte)0xf8, (byte)0x0c, (byte)0xb7, (byte)0xf8,
+ (byte)0xc0, (byte)0x8f, (byte)0x99, (byte)0xc1,
+ (byte)0xe5, (byte)0x28, (byte)0x9b, (byte)0xf9,
+ (byte)0x4c, (byte)0x94, (byte)0xc6, (byte)0xb1
+ };
+
+ static byte clientModulus[] = {
+ (byte)0x00,
+ (byte)0xbb, (byte)0xf0, (byte)0x40, (byte)0x36,
+ (byte)0xac, (byte)0x26, (byte)0x54, (byte)0x4e,
+ (byte)0xf4, (byte)0xa3, (byte)0x5a, (byte)0x00,
+ (byte)0x2f, (byte)0x69, (byte)0x21, (byte)0x6f,
+ (byte)0xb9, (byte)0x7a, (byte)0x3a, (byte)0x93,
+ (byte)0xec, (byte)0xa2, (byte)0xf6, (byte)0xe1,
+ (byte)0x8e, (byte)0xc7, (byte)0x63, (byte)0xd8,
+ (byte)0x2f, (byte)0x12, (byte)0x30, (byte)0x99,
+ (byte)0x2e, (byte)0xb0, (byte)0xf2, (byte)0x8f,
+ (byte)0xf8, (byte)0x27, (byte)0x2d, (byte)0x24,
+ (byte)0x78, (byte)0x28, (byte)0x84, (byte)0xf7,
+ (byte)0x01, (byte)0xbf, (byte)0x8d, (byte)0x44,
+ (byte)0x79, (byte)0xdd, (byte)0x3b, (byte)0xd2,
+ (byte)0x55, (byte)0xf3, (byte)0xce, (byte)0x3c,
+ (byte)0xb2, (byte)0x5b, (byte)0x21, (byte)0x7d,
+ (byte)0xef, (byte)0xfd, (byte)0x33, (byte)0x4a,
+ (byte)0xb1, (byte)0xa3, (byte)0xff, (byte)0xc6,
+ (byte)0xc8, (byte)0x9b, (byte)0xb9, (byte)0x0f,
+ (byte)0x7c, (byte)0x41, (byte)0x35, (byte)0x97,
+ (byte)0xf9, (byte)0xdb, (byte)0x3a, (byte)0x05,
+ (byte)0x60, (byte)0x05, (byte)0x15, (byte)0xaf,
+ (byte)0x59, (byte)0x17, (byte)0x92, (byte)0xa3,
+ (byte)0x10, (byte)0xad, (byte)0x16, (byte)0x1c,
+ (byte)0xe4, (byte)0x07, (byte)0x53, (byte)0xaf,
+ (byte)0xa8, (byte)0x76, (byte)0xa2, (byte)0x56,
+ (byte)0x2a, (byte)0x92, (byte)0xd3, (byte)0xf9,
+ (byte)0x28, (byte)0xe0, (byte)0x78, (byte)0xcf,
+ (byte)0x5e, (byte)0x1f, (byte)0x48, (byte)0xab,
+ (byte)0x5c, (byte)0x19, (byte)0xdd, (byte)0xe1,
+ (byte)0x67, (byte)0x43, (byte)0xba, (byte)0x75,
+ (byte)0x8d, (byte)0xf5, (byte)0x82, (byte)0xac,
+ (byte)0x43, (byte)0x92, (byte)0x44, (byte)0x1b
+ };
+
+ static char passphrase[] = "passphrase".toCharArray();
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+
+ /*
+ * Turn on SSL debugging?
+ */
+ static boolean debug = false;
+
+ private SSLServerSocket sslServerSocket = null;
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, serverCertStr,
+ serverModulus, serverPrivateExponent, passphrase);
+ SSLServerSocketFactory sslssf = context.getServerSocketFactory();
+
+ sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ sslSocket.setNeedClientAuth(true);
+ if (sslSocket instanceof SSLSocketImpl) {
+ ((SSLSocketImpl)sslSocket).trySetHostnameVerification("HTTPS");
+ }
+
+ PrintStream out =
+ new PrintStream(sslSocket.getOutputStream());
+
+ try {
+ // ignore request data
+
+ // send the response
+ out.print("HTTP/1.1 200 OK\r\n");
+ out.print("Content-Type: text/html; charset=iso-8859-1\r\n");
+ out.print("Content-Length: "+ 9 +"\r\n");
+ out.print("\r\n");
+ out.print("Testing\r\n");
+ out.flush();
+ } finally {
+ // close the socket
+ Thread.sleep(2000);
+ System.out.println("Server closing socket");
+ sslSocket.close();
+ serverReady = false;
+ }
+
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide() throws Exception {
+ SSLContext context = getSSLContext(trusedCertStr, clientCertStr,
+ clientModulus, clientPrivateExponent, passphrase);
+
+ SSLContext.setDefault(context);
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ HttpsURLConnection http = null;
+
+ /* establish http connection to server */
+ URL url = new URL("https://localhost:" + serverPort+"/");
+ System.out.println("url is "+url.toString());
+
+ http = (HttpsURLConnection)url.openConnection();
+
+ int respCode = http.getResponseCode();
+ System.out.println("respCode = "+respCode);
+
+ http.disconnect();
+ }
+
+ /*
+ * =============================================================
+ * The remainder is just support stuff
+ */
+
+ // use any free port by default
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ public static void main(String args[]) throws Exception {
+ if (debug)
+ System.setProperty("javax.net.debug", "all");
+
+ /*
+ * Start the tests.
+ */
+ new Identities();
+ }
+
+ Thread clientThread = null;
+ Thread serverThread = null;
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ Identities() throws Exception {
+ if (separateServerThread) {
+ startServer(true);
+ startClient(false);
+ } else {
+ startClient(true);
+ startServer(false);
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ serverThread.join();
+ } else {
+ clientThread.join();
+ }
+
+ /*
+ * When we get here, the test is pretty much over.
+ *
+ * If the main thread excepted, that propagates back
+ * immediately. If the other thread threw an exception, we
+ * should report back.
+ */
+ if (serverException != null)
+ throw serverException;
+ if (clientException != null)
+ throw clientException;
+ }
+
+ void startServer(boolean newThread) throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ doServerSide();
+ }
+ }
+
+ void startClient(boolean newThread) throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ doClientSide();
+ }
+ }
+
+ // get the ssl context
+ private static SSLContext getSSLContext(String trusedCertStr,
+ String keyCertStr, byte[] modulus,
+ byte[] privateExponent, char[] passphrase) throws Exception {
+
+ // generate certificate from cert string
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+ ByteArrayInputStream is =
+ new ByteArrayInputStream(trusedCertStr.getBytes());
+ Certificate trusedCert = cf.generateCertificate(is);
+ is.close();
+
+ // create a key store
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(null, null);
+
+ // import the trused cert
+ ks.setCertificateEntry("RSA Export Signer", trusedCert);
+
+ if (keyCertStr != null) {
+ // generate the private key.
+ RSAPrivateKeySpec priKeySpec = new RSAPrivateKeySpec(
+ new BigInteger(modulus),
+ new BigInteger(privateExponent));
+ KeyFactory kf = KeyFactory.getInstance("RSA");
+ RSAPrivateKey priKey =
+ (RSAPrivateKey)kf.generatePrivate(priKeySpec);
+
+ // generate certificate chain
+ is = new ByteArrayInputStream(keyCertStr.getBytes());
+ Certificate keyCert = cf.generateCertificate(is);
+ is.close();
+
+ Certificate[] chain = new Certificate[2];
+ chain[0] = keyCert;
+ chain[1] = trusedCert;
+
+ // import the key entry.
+ ks.setKeyEntry("Whatever", priKey, passphrase, chain);
+ }
+
+ // create SSL context
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+ tmf.init(ks);
+
+ SSLContext ctx = SSLContext.getInstance("TLS");
+
+ if (keyCertStr != null) {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, passphrase);
+
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ } else {
+ ctx.init(null, tmf.getTrustManagers(), null);
+ }
+
+ return ctx;
+ }
+
+}
From 624b674ca3f58621163e2dca9b229b85671429fc Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons
Date: Tue, 23 Mar 2010 18:05:54 -0700
Subject: [PATCH 059/190] 6937244: sqe ws7 tools javap/javap_t10a fail jdk7 b80
used output of javap is changed
Reviewed-by: darcy
---
.../com/sun/tools/javap/ClassWriter.java | 24 ++---
.../test/tools/javap/6937244/T6937244.java | 57 ++++++++++++
.../test/tools/javap/6937244/T6937244A.java | 90 +++++++++++++++++++
3 files changed, 159 insertions(+), 12 deletions(-)
create mode 100644 langtools/test/tools/javap/6937244/T6937244.java
create mode 100644 langtools/test/tools/javap/6937244/T6937244A.java
diff --git a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
index 3016583a482..dd02e64e040 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
@@ -225,15 +225,15 @@ public class ClassWriter extends BasicWriter {
writeModifiers(flags.getFieldModifiers());
Signature_attribute sigAttr = getSignature(f.attributes);
if (sigAttr == null)
- print(getFieldType(f.descriptor));
+ print(getJavaFieldType(f.descriptor));
else {
try {
Type t = sigAttr.getParsedSignature().getType(constant_pool);
- print(t);
+ print(getJavaName(t.toString()));
} catch (ConstantPoolException e) {
// report error?
// fall back on non-generic descriptor
- print(getFieldType(f.descriptor));
+ print(getJavaFieldType(f.descriptor));
}
}
print(" ");
@@ -314,14 +314,14 @@ public class ClassWriter extends BasicWriter {
}
if (getName(m).equals("")) {
print(getJavaName(classFile));
- print(getParameterTypes(d, flags));
+ print(getJavaParameterTypes(d, flags));
} else if (getName(m).equals("")) {
print("{}");
} else {
- print(getReturnType(d));
+ print(getJavaReturnType(d));
print(" ");
print(getName(m));
- print(getParameterTypes(d, flags));
+ print(getJavaParameterTypes(d, flags));
}
Attribute e_attr = m.attributes.get(Attribute.Exceptions);
@@ -460,9 +460,9 @@ public class ClassWriter extends BasicWriter {
}
}
- String getFieldType(Descriptor d) {
+ String getJavaFieldType(Descriptor d) {
try {
- return d.getFieldType(constant_pool);
+ return getJavaName(d.getFieldType(constant_pool));
} catch (ConstantPoolException e) {
return report(e);
} catch (DescriptorException e) {
@@ -470,9 +470,9 @@ public class ClassWriter extends BasicWriter {
}
}
- String getReturnType(Descriptor d) {
+ String getJavaReturnType(Descriptor d) {
try {
- return d.getReturnType(constant_pool);
+ return getJavaName(d.getReturnType(constant_pool));
} catch (ConstantPoolException e) {
return report(e);
} catch (DescriptorException e) {
@@ -480,9 +480,9 @@ public class ClassWriter extends BasicWriter {
}
}
- String getParameterTypes(Descriptor d, AccessFlags flags) {
+ String getJavaParameterTypes(Descriptor d, AccessFlags flags) {
try {
- return adjustVarargs(flags, d.getParameterTypes(constant_pool));
+ return getJavaName(adjustVarargs(flags, d.getParameterTypes(constant_pool)));
} catch (ConstantPoolException e) {
return report(e);
} catch (DescriptorException e) {
diff --git a/langtools/test/tools/javap/6937244/T6937244.java b/langtools/test/tools/javap/6937244/T6937244.java
new file mode 100644
index 00000000000..737b53b855e
--- /dev/null
+++ b/langtools/test/tools/javap/6937244/T6937244.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6937244
+ * @summary fields display with JVMS names, not Java names
+ */
+
+import java.io.*;
+
+public class T6937244 {
+ public static void main(String[] args) throws Exception {
+ new T6937244().run();
+ }
+
+ void run() throws Exception {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ String[] args = { "java.lang.String" };
+ int rc = com.sun.tools.javap.Main.run(args, pw);
+ pw.close();
+ String out = sw.toString();
+ System.err.println(out);
+ if (rc != 0)
+ throw new Exception("unexpected exit from javap: " + rc);
+ for (String line: out.split("[\r\n]+")) {
+ if (line.contains("CASE_INSENSITIVE_ORDER")) {
+ if (line.matches("\\s*\\Qpublic static final java.util.Comparator CASE_INSENSITIVE_ORDER;\\E\\s*"))
+ return;
+ throw new Exception("declaration not shown as expected");
+ }
+ }
+ throw new Exception("declaration of CASE_INSENSITIVE_ORDER not found");
+ }
+}
+
diff --git a/langtools/test/tools/javap/6937244/T6937244A.java b/langtools/test/tools/javap/6937244/T6937244A.java
new file mode 100644
index 00000000000..5ad70142f7b
--- /dev/null
+++ b/langtools/test/tools/javap/6937244/T6937244A.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6937244
+ * @summary fields display with JVMS names, not Java names
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class T6937244A {
+ public static void main(String[] args) throws Exception {
+ new T6937244A().run();
+ }
+
+ void run() throws Exception {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ String[] args = { "Test" };
+ int rc = com.sun.tools.javap.Main.run(args, pw);
+ pw.close();
+ String out = sw.toString();
+ System.err.println(out);
+ if (rc != 0)
+ throw new Exception("unexpected exit from javap: " + rc);
+
+ int count = 0;
+
+ for (String line: out.split("[\r\n]+")) {
+ if (line.contains("extends")) {
+ verify(line, "extends java.lang.Object implements java.util.List");
+ count++;
+ }
+
+ if (line.contains("field")) {
+ verify(line, "java.util.List field");
+ count++;
+ }
+
+ if (line.contains("method")) {
+ verify(line, "java.util.List method(java.util.List) throws java.lang.Exception");
+ count++;
+ }
+ }
+
+ // final backstop check
+ if (out.contains("/"))
+ throw new Exception("unexpected \"/\" in output");
+
+ if (count != 3)
+ throw new Exception("wrong number of matches found: " + count);
+ }
+
+ void verify(String line, String expect) throws Exception {
+ if (!line.contains(expect)) {
+ System.err.println("line: " + line);
+ System.err.println("expect: " + expect);
+ throw new Exception("expected string not found in line");
+ }
+ }
+}
+
+
+abstract class Test implements List {
+ public List field;
+ public List method(List arg) throws Exception { return null; }
+}
+
From 4212e786d4c37ef0a9f9fdf5f27d002a7eb28724 Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty"
Date: Tue, 23 Mar 2010 19:03:26 -0700
Subject: [PATCH 060/190] 6915365: 3/4 assert(false,"Unsupported VMGlobal
Type") at management.cpp:1540
Remove exception throw to decouple JDK and HotSpot additions of known types.
Reviewed-by: mchung
---
jdk/src/share/native/sun/management/Flag.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/jdk/src/share/native/sun/management/Flag.c b/jdk/src/share/native/sun/management/Flag.c
index e488d13e8f6..5c803dc0f77 100644
--- a/jdk/src/share/native/sun/management/Flag.c
+++ b/jdk/src/share/native/sun/management/Flag.c
@@ -133,11 +133,8 @@ Java_sun_management_Flag_getFlags
globals[i].value.j);
break;
default:
- // unsupported type
- sprintf(errmsg, "Unsupported VMGlobal Type %d", globals[i].type);
- JNU_ThrowInternalError(env, errmsg);
- free(globals);
- return 0;
+ // ignore unsupported type
+ continue;
}
switch (globals[i].origin) {
case JMM_VMGLOBAL_ORIGIN_DEFAULT:
From af4ae14e2aca1fb61719c328a2487babcd43edcb Mon Sep 17 00:00:00 2001
From: Pavel Porvatov
Date: Wed, 24 Mar 2010 15:14:16 +0300
Subject: [PATCH 061/190] 6922214: SynthTextPaneUI.installUI() doesn't install
the default caret and highlighter
Reviewed-by: alexp
---
jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java
index 0a035fc4636..7d564eeccb5 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java
@@ -762,7 +762,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* component's background color to be painted.
*
* Installs the default caret and highlighter into the
- * associated component.
+ * associated component. These properties are only set if their
+ * current value is either {@code null} or an instance of
+ * {@link UIResource}.
*
* Attaches to the editor and model. If there is no
* model, a default one is created.
From 8ef8d879e45ba0dbf40637f30e85f19a33667522 Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons
Date: Wed, 24 Mar 2010 12:18:17 -0700
Subject: [PATCH 062/190] 6937318: jdk7 b86: javah and javah -help is no
output for these commands
Reviewed-by: darcy
---
.../com/sun/tools/javah/JavahTask.java | 13 ++----
langtools/test/tools/javah/T6893943.java | 46 +++++++++++++------
2 files changed, 37 insertions(+), 22 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java
index 15a50e73781..b585f9bbbbb 100644
--- a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java
+++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java
@@ -318,12 +318,6 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
int run(String[] args) {
try {
handleOptions(args);
- if (classes == null || classes.size() == 0) {
- if (help || version || fullVersion)
- return 0;
- else
- return 1;
- }
boolean ok = run();
return ok ? 0 : 1;
} catch (BadArgs e) {
@@ -355,7 +349,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
fileManager = getDefaultFileManager(diagnosticListener, log);
Iterator iter = args.iterator();
- boolean noArgs = !iter.hasNext();
+ noArgs = !iter.hasNext();
while (iter.hasNext()) {
String arg = iter.next();
@@ -416,9 +410,9 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
Util util = new Util(log, diagnosticListener);
- if (help) {
+ if (noArgs || help) {
showHelp();
- return true;
+ return help; // treat noArgs as an error for purposes of exit code
}
if (version || fullVersion) {
@@ -636,6 +630,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
String usercp;
List classes;
boolean verbose;
+ boolean noArgs;
boolean help;
boolean trace;
boolean version;
diff --git a/langtools/test/tools/javah/T6893943.java b/langtools/test/tools/javah/T6893943.java
index cd00e8fb007..bef2d29c336 100644
--- a/langtools/test/tools/javah/T6893943.java
+++ b/langtools/test/tools/javah/T6893943.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6893943
+ * @bug 6893943 6937318
* @summary exit code from javah with no args is 0
*/
@@ -31,22 +31,32 @@ import java.io.*;
import java.util.*;
public class T6893943 {
+ static final String[] NO_ARGS = { };
+ static final String[] HELP = { "-help" };
+ static final String NEWLINE = System.getProperty("line.separator");
+
public static void main(String... args) throws Exception {
new T6893943().run();
}
void run() throws Exception {
- testSimpleAPI();
- testCommand();
+ testSimpleAPI(NO_ARGS, 1);
+ testSimpleAPI(HELP, 0);
+ testCommand(NO_ARGS, 1);
+ testCommand(HELP, 0);
}
- void testSimpleAPI() throws Exception {
- PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.err));
- int rc = com.sun.tools.javah.Main.run(new String[] { }, pw);
- expect("testSimpleAPI", rc, 1);
+ void testSimpleAPI(String[] args, int expect_rc) throws Exception {
+ System.err.println("Test simple api: " + Arrays.asList(args));
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ int rc = com.sun.tools.javah.Main.run(args, pw);
+ pw.close();
+ expect("testSimpleAPI", sw.toString(), rc, expect_rc);
}
- void testCommand() throws Exception {
+ void testCommand(String[] args, int expect_rc) throws Exception {
+ System.err.println("Test command: " + Arrays.asList(args));
File javaHome = new File(System.getProperty("java.home"));
if (javaHome.getName().equals("jre"))
javaHome = javaHome.getParentFile();
@@ -54,22 +64,32 @@ public class T6893943 {
List command = new ArrayList();
command.add(new File(new File(javaHome, "bin"), "javah").getPath());
command.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
+ command.addAll(Arrays.asList(args));
//System.err.println("command: " + command);
ProcessBuilder pb = new ProcessBuilder(command);
pb.redirectErrorStream(true);
Process p = pb.start();
p.getOutputStream().close();
+ StringWriter sw = new StringWriter();
String line;
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = in.readLine()) != null)
- System.err.println("javah: " + line);
+ sw.write(line + NEWLINE);
int rc = p.waitFor();
- expect("testCommand", rc, 1);
+ expect("testCommand", sw.toString(), rc, expect_rc);
}
- void expect(String name, int actual, int expect) throws Exception {
- if (actual != expect)
- throw new Exception(name + ": unexpected exit: " + actual + ", expected: " + expect);
+ void expect(String name, String out, int actual_rc, int expect_rc) throws Exception {
+ if (out.isEmpty())
+ throw new Exception("No output from javah");
+
+ if (!out.startsWith("Usage:")) {
+ System.err.println(out);
+ throw new Exception("Unexpected output from javah");
+ }
+
+ if (actual_rc != expect_rc)
+ throw new Exception(name + ": unexpected exit: " + actual_rc + ", expected: " + expect_rc);
}
}
From 04194bfc9a6d5aabaa349a704c405a28411a311e Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Wed, 24 Mar 2010 17:02:35 -0700
Subject: [PATCH 063/190] 6937417: javac -Xprint returns
IndexOutOfBoundsException
Reviewed-by: jjg
---
.../javac/processing/PrintingProcessor.java | 19 ++++++-----
.../model/util/elements/VacuousEnum.java | 33 +++++++++++++++++++
2 files changed, 43 insertions(+), 9 deletions(-)
create mode 100644 langtools/test/tools/javac/processing/model/util/elements/VacuousEnum.java
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java b/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java
index 963f26020d3..f3a7b53fa7b 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java
@@ -229,23 +229,24 @@ public class PrintingProcessor extends AbstractProcessor {
if (kind == ENUM) {
List enclosedElements =
new ArrayList(e.getEnclosedElements());
+ // Handle any enum constants specially before other entities.
List enumConstants = new ArrayList();
for(Element element : enclosedElements) {
if (element.getKind() == ENUM_CONSTANT)
enumConstants.add(element);
}
+ if (!enumConstants.isEmpty()) {
+ int i;
+ for(i = 0; i < enumConstants.size()-1; i++) {
+ this.visit(enumConstants.get(i), true);
+ writer.print(",");
+ }
+ this.visit(enumConstants.get(i), true);
+ writer.println(";\n");
- int i;
- for(i = 0; i < enumConstants.size()-1; i++) {
- this.visit(enumConstants.get(i), true);
- writer.print(",");
- }
- if (i >= 0 ) {
- this.visit(enumConstants.get(i), true);
- writer.print(";");
+ enclosedElements.removeAll(enumConstants);
}
- enclosedElements.removeAll(enumConstants);
for(Element element : enclosedElements)
this.visit(element);
} else {
diff --git a/langtools/test/tools/javac/processing/model/util/elements/VacuousEnum.java b/langtools/test/tools/javac/processing/model/util/elements/VacuousEnum.java
new file mode 100644
index 00000000000..2e521d6d672
--- /dev/null
+++ b/langtools/test/tools/javac/processing/model/util/elements/VacuousEnum.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6937417
+ * @summary Test -Xprint on enum type with no constants
+ * @author Joseph D. Darcy
+ * @compile -Xprint VacuousEnum.java
+ */
+public enum VacuousEnum {
+ // But alas, no enum constants!
+}
From 512e4f93a37136a461177d330ec4fec6e3cc300e Mon Sep 17 00:00:00 2001
From: Weijun Wang
Date: Thu, 25 Mar 2010 12:07:42 +0800
Subject: [PATCH 064/190] 6813340: X509Factory should not depend on
is.available()==0
Reviewed-by: xuelei
---
.../sun/security/provider/X509Factory.java | 553 ++++++++----------
.../classes/sun/security/tools/KeyTool.java | 68 +--
.../cert/CertificateFactory/ReturnStream.java | 64 ++
.../cert/CertificateFactory/SlowStream.java | 51 ++
.../cert/CertificateFactory/slowstream.sh | 50 ++
5 files changed, 421 insertions(+), 365 deletions(-)
create mode 100644 jdk/test/java/security/cert/CertificateFactory/ReturnStream.java
create mode 100644 jdk/test/java/security/cert/CertificateFactory/SlowStream.java
create mode 100644 jdk/test/java/security/cert/CertificateFactory/slowstream.sh
diff --git a/jdk/src/share/classes/sun/security/provider/X509Factory.java b/jdk/src/share/classes/sun/security/provider/X509Factory.java
index ce0d120ae8d..ceaf3c970b9 100644
--- a/jdk/src/share/classes/sun/security/provider/X509Factory.java
+++ b/jdk/src/share/classes/sun/security/provider/X509Factory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1998-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
package sun.security.provider;
import java.io.*;
-import java.util.Collection;
import java.util.*;
import java.security.cert.*;
import sun.security.x509.X509CertImpl;
@@ -37,6 +36,7 @@ import sun.security.provider.certpath.X509CertificatePair;
import sun.security.util.DerValue;
import sun.security.util.Cache;
import sun.misc.BASE64Decoder;
+import sun.security.pkcs.ParsingException;
/**
* This class defines a certificate factory for X.509 v3 certificates &
@@ -62,10 +62,6 @@ public class X509Factory extends CertificateFactorySpi {
public static final String BEGIN_CERT = "-----BEGIN CERTIFICATE-----";
public static final String END_CERT = "-----END CERTIFICATE-----";
- private static final int defaultExpectedLineLength = 80;
-
- private static final char[] endBoundary = "-----END".toCharArray();
-
private static final int ENC_MAX_LENGTH = 4096 * 1024; // 4 MB MAX
private static final Cache certCache = Cache.newSoftMemoryCache(750);
@@ -92,13 +88,7 @@ public class X509Factory extends CertificateFactorySpi {
throw new CertificateException("Missing input stream");
}
try {
- if (is.markSupported() == false) {
- // consume the entire input stream
- byte[] totalBytes;
- totalBytes = getTotalBytes(new BufferedInputStream(is));
- is = new ByteArrayInputStream(totalBytes);
- }
- byte[] encoding = readSequence(is);
+ byte[] encoding = readOneBlock(is);
if (encoding != null) {
X509CertImpl cert = (X509CertImpl)getFromCache(certCache, encoding);
if (cert != null) {
@@ -108,19 +98,7 @@ public class X509Factory extends CertificateFactorySpi {
addToCache(certCache, cert.getEncodedInternal(), cert);
return cert;
} else {
- X509CertImpl cert;
- // determine if binary or Base64 encoding. If Base64 encoding,
- // the certificate must be bounded at the beginning by
- // "-----BEGIN".
- if (isBase64(is)) {
- // Base64
- byte[] data = base64_to_binary(is);
- cert = new X509CertImpl(data);
- } else {
- // binary
- cert = new X509CertImpl(new DerValue(is));
- }
- return intern(cert);
+ throw new IOException("Empty input");
}
} catch (IOException ioe) {
throw (CertificateException)new CertificateException
@@ -128,74 +106,22 @@ public class X509Factory extends CertificateFactorySpi {
}
}
- /**
- * Read a DER SEQUENCE from an InputStream and return the encoding.
- * If data does not represent a SEQUENCE, it uses indefinite length
- * encoding, or is longer than ENC_MAX_LENGTH, the stream is reset
- * and this method returns null.
- */
- private static byte[] readSequence(InputStream in) throws IOException {
- in.mark(ENC_MAX_LENGTH);
- byte[] b = new byte[4];
- int i = readFully(in, b, 0, b.length);
- if ((i != b.length) || (b[0] != 0x30)) { // first byte must be SEQUENCE
- in.reset();
- return null;
- }
- i = b[1] & 0xff;
- int totalLength;
- if (i < 0x80) {
- int valueLength = i;
- totalLength = valueLength + 2;
- } else if (i == 0x81) {
- int valueLength = b[2] & 0xff;
- totalLength = valueLength + 3;
- } else if (i == 0x82) {
- int valueLength = ((b[2] & 0xff) << 8) | (b[3] & 0xff);
- totalLength = valueLength + 4;
- } else { // ignore longer length forms
- in.reset();
- return null;
- }
- if (totalLength > ENC_MAX_LENGTH) {
- in.reset();
- return null;
- }
- byte[] encoding = new byte[totalLength];
- if( totalLength < b.length ) {
- in.reset();
- i = readFully(in, encoding, 0, totalLength);
- if( i != totalLength ) {
- in.reset();
- return null;
- }
- } else {
- System.arraycopy(b, 0, encoding, 0, b.length);
- int n = totalLength - b.length;
- i = readFully(in, encoding, b.length, n);
- if (i != n) {
- in.reset();
- return null;
- }
- }
- return encoding;
- }
-
/**
* Read from the stream until length bytes have been read or EOF has
* been reached. Return the number of bytes actually read.
*/
- private static int readFully(InputStream in, byte[] buffer, int offset,
+ private static int readFully(InputStream in, ByteArrayOutputStream bout,
int length) throws IOException {
int read = 0;
+ byte[] buffer = new byte[2048];
while (length > 0) {
- int n = in.read(buffer, offset, length);
+ int n = in.read(buffer, 0, length<2048?length:2048);
if (n <= 0) {
break;
}
+ bout.write(buffer, 0, n);
read += n;
length -= n;
- offset += n;
}
return read;
}
@@ -309,21 +235,11 @@ public class X509Factory extends CertificateFactorySpi {
throw new CertificateException("Missing input stream");
}
try {
- if (inStream.markSupported() == false) {
- // consume the entire input stream
- byte[] totalBytes;
- totalBytes = getTotalBytes(new BufferedInputStream(inStream));
- inStream = new ByteArrayInputStream(totalBytes);
- }
- // determine if binary or Base64 encoding. If Base64 encoding,
- // each certificate must be bounded at the beginning by
- // "-----BEGIN".
- if (isBase64(inStream)) {
- // Base64
- byte[] data = base64_to_binary(inStream);
- return new X509CertPath(new ByteArrayInputStream(data));
+ byte[] encoding = readOneBlock(inStream);
+ if (encoding != null) {
+ return new X509CertPath(new ByteArrayInputStream(encoding));
} else {
- return new X509CertPath(inStream);
+ throw new IOException("Empty input");
}
} catch (IOException ioe) {
throw new CertificateException(ioe.getMessage());
@@ -350,21 +266,11 @@ public class X509Factory extends CertificateFactorySpi {
throw new CertificateException("Missing input stream");
}
try {
- if (inStream.markSupported() == false) {
- // consume the entire input stream
- byte[] totalBytes;
- totalBytes = getTotalBytes(new BufferedInputStream(inStream));
- inStream = new ByteArrayInputStream(totalBytes);
- }
- // determine if binary or Base64 encoding. If Base64 encoding,
- // each certificate must be bounded at the beginning by
- // "-----BEGIN".
- if (isBase64(inStream)) {
- // Base64
- byte[] data = base64_to_binary(inStream);
+ byte[] data = readOneBlock(inStream);
+ if (data != null) {
return new X509CertPath(new ByteArrayInputStream(data), encoding);
} else {
- return(new X509CertPath(inStream, encoding));
+ throw new IOException("Empty input");
}
} catch (IOException ioe) {
throw new CertificateException(ioe.getMessage());
@@ -426,11 +332,6 @@ public class X509Factory extends CertificateFactorySpi {
throw new CertificateException("Missing input stream");
}
try {
- if (is.markSupported() == false) {
- // consume the entire input stream
- is = new ByteArrayInputStream
- (getTotalBytes(new BufferedInputStream(is)));
- }
return parseX509orPKCS7Cert(is);
} catch (IOException ioe) {
throw new CertificateException(ioe);
@@ -458,13 +359,7 @@ public class X509Factory extends CertificateFactorySpi {
throw new CRLException("Missing input stream");
}
try {
- if (is.markSupported() == false) {
- // consume the entire input stream
- byte[] totalBytes;
- totalBytes = getTotalBytes(new BufferedInputStream(is));
- is = new ByteArrayInputStream(totalBytes);
- }
- byte[] encoding = readSequence(is);
+ byte[] encoding = readOneBlock(is);
if (encoding != null) {
X509CRLImpl crl = (X509CRLImpl)getFromCache(crlCache, encoding);
if (crl != null) {
@@ -474,19 +369,7 @@ public class X509Factory extends CertificateFactorySpi {
addToCache(crlCache, crl.getEncodedInternal(), crl);
return crl;
} else {
- X509CRLImpl crl;
- // determine if binary or Base64 encoding. If Base64 encoding,
- // the CRL must be bounded at the beginning by
- // "-----BEGIN".
- if (isBase64(is)) {
- // Base64
- byte[] data = base64_to_binary(is);
- crl = new X509CRLImpl(data);
- } else {
- // binary
- crl = new X509CRLImpl(new DerValue(is));
- }
- return intern(crl);
+ throw new IOException("Empty input");
}
} catch (IOException ioe) {
throw new CRLException(ioe.getMessage());
@@ -504,19 +387,13 @@ public class X509Factory extends CertificateFactorySpi {
*
* @exception CRLException on parsing errors.
*/
- public Collection extends java.security.cert.CRL> engineGenerateCRLs(InputStream
-is)
- throws CRLException
+ public Collection extends java.security.cert.CRL> engineGenerateCRLs(
+ InputStream is) throws CRLException
{
if (is == null) {
throw new CRLException("Missing input stream");
}
try {
- if (is.markSupported() == false) {
- // consume the entire input stream
- is = new ByteArrayInputStream
- (getTotalBytes(new BufferedInputStream(is)));
- }
return parseX509orPKCS7CRL(is);
} catch (IOException ioe) {
throw new CRLException(ioe.getMessage());
@@ -533,42 +410,25 @@ is)
throws CertificateException, IOException
{
Collection coll = new ArrayList();
- boolean first = true;
- while (is.available() != 0) {
- // determine if binary or Base64 encoding. If Base64 encoding,
- // each certificate must be bounded at the beginning by
- // "-----BEGIN".
- InputStream is2 = is;
- if (isBase64(is2)) {
- // Base64
- is2 = new ByteArrayInputStream(base64_to_binary(is2));
+ byte[] data = readOneBlock(is);
+ if (data == null) {
+ return new ArrayList(0);
+ }
+ try {
+ PKCS7 pkcs7 = new PKCS7(data);
+ X509Certificate[] certs = pkcs7.getCertificates();
+ // certs are optional in PKCS #7
+ if (certs != null) {
+ return Arrays.asList(certs);
+ } else {
+ // no crls provided
+ return new ArrayList(0);
}
- if (first)
- is2.mark(is2.available());
- try {
- // treat as X.509 cert
- coll.add(intern(new X509CertImpl(new DerValue(is2))));
- } catch (CertificateException e) {
- Throwable cause = e.getCause();
- // only treat as PKCS#7 if this is the first cert parsed
- // and the root cause of the decoding failure is an IOException
- if (first && cause != null && (cause instanceof IOException)) {
- // treat as PKCS#7
- is2.reset();
- PKCS7 pkcs7 = new PKCS7(is2);
- X509Certificate[] certs = pkcs7.getCertificates();
- // certs are optional in PKCS #7
- if (certs != null) {
- return Arrays.asList(certs);
- } else {
- // no certs provided
- return new ArrayList(0);
- }
- } else {
- throw e;
- }
+ } catch (ParsingException e) {
+ while (data != null) {
+ coll.add(new X509CertImpl(data));
+ data = readOneBlock(is);
}
- first = false;
}
return coll;
}
@@ -583,162 +443,215 @@ is)
throws CRLException, IOException
{
Collection coll = new ArrayList();
- boolean first = true;
- while (is.available() != 0) {
- // determine if binary or Base64 encoding. If Base64 encoding,
- // the CRL must be bounded at the beginning by
- // "-----BEGIN".
- InputStream is2 = is;
- if (isBase64(is)) {
- // Base64
- is2 = new ByteArrayInputStream(base64_to_binary(is2));
+ byte[] data = readOneBlock(is);
+ if (data == null) {
+ return new ArrayList(0);
+ }
+ try {
+ PKCS7 pkcs7 = new PKCS7(data);
+ X509CRL[] crls = pkcs7.getCRLs();
+ // CRLs are optional in PKCS #7
+ if (crls != null) {
+ return Arrays.asList(crls);
+ } else {
+ // no crls provided
+ return new ArrayList(0);
}
- if (first)
- is2.mark(is2.available());
- try {
- // treat as X.509 CRL
- coll.add(new X509CRLImpl(is2));
- } catch (CRLException e) {
- // only treat as PKCS#7 if this is the first CRL parsed
- if (first) {
- is2.reset();
- PKCS7 pkcs7 = new PKCS7(is2);
- X509CRL[] crls = pkcs7.getCRLs();
- // CRLs are optional in PKCS #7
- if (crls != null) {
- return Arrays.asList(crls);
- } else {
- // no crls provided
- return new ArrayList(0);
- }
- }
+ } catch (ParsingException e) {
+ while (data != null) {
+ coll.add(new X509CRLImpl(data));
+ data = readOneBlock(is);
}
- first = false;
}
return coll;
}
- /*
- * Converts a Base64-encoded X.509 certificate or X.509 CRL or PKCS#7 data
- * to binary encoding.
- * In all cases, the data must be bounded at the beginning by
- * "-----BEGIN", and must be bounded at the end by "-----END".
- */
- private byte[] base64_to_binary(InputStream is)
- throws IOException
- {
- long len = 0; // total length of base64 encoding, including boundaries
-
- is.mark(is.available());
-
- BufferedInputStream bufin = new BufferedInputStream(is);
- BufferedReader br =
- new BufferedReader(new InputStreamReader(bufin, "ASCII"));
-
- // First read all of the data that is found between
- // the "-----BEGIN" and "-----END" boundaries into a buffer.
- String temp;
- while (true) {
- temp=readLine(br);
- if (temp == null) {
- throw new IOException("Unsupported encoding");
- }
- len += temp.length();
- if (temp.startsWith("-----BEGIN")) {
- break;
- }
- }
- StringBuffer strBuf = new StringBuffer();
- while ((temp=readLine(br))!=null && !temp.startsWith("-----END")) {
- strBuf.append(temp);
- }
- if (temp == null) {
- throw new IOException("Unsupported encoding");
- } else {
- len += temp.length();
- }
-
- // consume only as much as was needed
- len += strBuf.length();
- is.reset();
- is.skip(len);
-
- // Now, that data is supposed to be a single X.509 certificate or
- // X.509 CRL or PKCS#7 formatted data... Base64 encoded.
- // Decode into binary and return the result.
- BASE64Decoder decoder = new BASE64Decoder();
- return decoder.decodeBuffer(strBuf.toString());
- }
-
- /*
- * Reads the entire input stream into a byte array.
- */
- private byte[] getTotalBytes(InputStream is) throws IOException {
- byte[] buffer = new byte[8192];
- ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
- int n;
- baos.reset();
- while ((n = is.read(buffer, 0, buffer.length)) != -1) {
- baos.write(buffer, 0, n);
- }
- return baos.toByteArray();
- }
-
- /*
- * Determines if input is binary or Base64 encoded.
- */
- private boolean isBase64(InputStream is) throws IOException {
- if (is.available() >= 1) {
- is.mark(1);
- int c1 = is.read();
- is.reset();
- if (c1 != DerValue.tag_Sequence) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-
- /*
- * Read a line of text. A line is considered to be terminated by any one
- * of a line feed ('\n'), a carriage return ('\r'), a carriage return
- * followed immediately by a linefeed, or an end-of-certificate marker.
+ /**
+ * Returns an ASN.1 SEQUENCE from a stream, which might be a BER-encoded
+ * binary block or a PEM-style BASE64-encoded ASCII data. In the latter
+ * case, it's de-BASE64'ed before return.
*
- * @return A String containing the contents of the line, including
- * any line-termination characters, or null if the end of the
- * stream has been reached.
+ * After the reading, the input stream pointer is after the BER block, or
+ * after the newline character after the -----END SOMETHING----- line.
+ *
+ * @param is the InputStream
+ * @returns byte block or null if end of stream
+ * @throws IOException If any parsing error
*/
- private String readLine(BufferedReader br) throws IOException {
- int c;
- int i = 0;
- boolean isMatch = true;
- boolean matched = false;
- StringBuffer sb = new StringBuffer(defaultExpectedLineLength);
- do {
- c = br.read();
- if (isMatch && (i < endBoundary.length)) {
- isMatch = ((char)c != endBoundary[i++]) ? false : true;
- }
- if (!matched)
- matched = (isMatch && (i == endBoundary.length));
- sb.append((char)c);
- } while ((c != -1) && (c != '\n') && (c != '\r'));
+ private static byte[] readOneBlock(InputStream is) throws IOException {
- if (!matched && c == -1) {
+ // The first character of a BLOCK.
+ int c = is.read();
+ if (c == -1) {
return null;
}
- if (c == '\r') {
- br.mark(1);
- int c2 = br.read();
- if (c2 == '\n') {
- sb.append((char)c);
- } else {
- br.reset();
+ if (c == DerValue.tag_Sequence) {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream(2048);
+ bout.write(c);
+ readBERInternal(is, bout, c);
+ return bout.toByteArray();
+ } else {
+ // Read BASE64 encoded data, might skip info at the beginning
+ char[] data = new char[2048];
+ int pos = 0;
+
+ // Step 1: Read until header is found
+ int hyphen = (c=='-') ? 1: 0; // count of consequent hyphens
+ int last = (c=='-') ? -1: c; // the char before hyphen
+ while (true) {
+ int next = is.read();
+ if (next == -1) {
+ // We accept useless data after the last block,
+ // say, empty lines.
+ return null;
+ }
+ if (next == '-') {
+ hyphen++;
+ } else {
+ hyphen = 0;
+ last = next;
+ }
+ if (hyphen == 5 && (last==-1 || last=='\r' || last=='\n')) {
+ break;
+ }
+ }
+
+ // Step 2: Read the rest of header, determine the line end
+ int end;
+ while (true) {
+ int next = is.read();
+ if (next == -1) {
+ throw new IOException("Incomplete data");
+ }
+ if (next == '\n') {
+ end = '\n';
+ break;
+ }
+ if (next == '\r') {
+ next = is.read();
+ if (next == -1) {
+ throw new IOException("Incomplete data");
+ }
+ if (next == '\n') {
+ end = '\n';
+ } else {
+ end = '\r';
+ data[pos++] = (char)next;
+ }
+ break;
+ }
+ }
+
+ // Step 3: Read the data
+ while (true) {
+ int next = is.read();
+ if (next == -1) {
+ throw new IOException("Incomplete data");
+ }
+ if (next != '-') {
+ data[pos++] = (char)next;
+ if (pos >= data.length) {
+ data = Arrays.copyOf(data, data.length+1024);
+ }
+ } else {
+ break;
+ }
+ }
+
+ // Step 4: Consume the footer
+ while (true) {
+ int next = is.read();
+ // Add next == '\n' for maximum safety, in case endline
+ // is not consistent.
+ if (next == -1 || next == end || next == '\n') {
+ break;
+ }
+ }
+
+ BASE64Decoder decoder = new BASE64Decoder();
+ return decoder.decodeBuffer(new String(data, 0, pos));
+ }
+ }
+
+ /**
+ * Read one BER data block. This method is aware of indefinite-length BER
+ * encoding and will read all of the sub-sections in a recursive way
+ *
+ * @param is Read from this InputStream
+ * @param bout Write into this OutputStream
+ * @param tag Tag already read (-1 mean not read)
+ * @returns The current tag, used to check EOC in indefinite-length BER
+ * @throws IOException Any parsing error
+ */
+ private static int readBERInternal(InputStream is,
+ ByteArrayOutputStream bout, int tag) throws IOException {
+
+ if (tag == -1) { // Not read before the call, read now
+ tag = is.read();
+ if (tag == -1) {
+ throw new IOException("BER/DER tag info absent");
+ }
+ if ((tag & 0x1f) == 0x1f) {
+ throw new IOException("Multi octets tag not supported");
+ }
+ bout.write(tag);
+ }
+
+ int n = is.read();
+ if (n == -1) {
+ throw new IOException("BER/DER length info ansent");
+ }
+ bout.write(n);
+
+ int length;
+
+ if (n == 0x80) { // Indefinite-length encoding
+ if ((tag & 0x20) != 0x20) {
+ throw new IOException(
+ "Non constructed encoding must have definite length");
+ }
+ while (true) {
+ int subTag = readBERInternal(is, bout, -1);
+ if (subTag == 0) { // EOC, end of indefinite-length section
+ break;
+ }
+ }
+ } else {
+ if (n < 0x80) {
+ length = n;
+ } else if (n == 0x81) {
+ length = is.read();
+ if (length == -1) {
+ throw new IOException("Incomplete BER/DER length info");
+ }
+ bout.write(length);
+ } else if (n == 0x82) {
+ int highByte = is.read();
+ int lowByte = is.read();
+ if (lowByte == -1) {
+ throw new IOException("Incomplete BER/DER length info");
+ }
+ bout.write(highByte);
+ bout.write(lowByte);
+ length = (highByte << 8) | lowByte;
+ } else if (n == 0x83) {
+ int highByte = is.read();
+ int midByte = is.read();
+ int lowByte = is.read();
+ if (lowByte == -1) {
+ throw new IOException("Incomplete BER/DER length info");
+ }
+ bout.write(highByte);
+ bout.write(midByte);
+ bout.write(lowByte);
+ length = (highByte << 16) | (midByte << 8) | lowByte;
+ } else { // ignore longer length forms
+ throw new IOException("Invalid BER/DER data (too huge?)");
+ }
+ if (readFully(is, bout, length) != length) {
+ throw new IOException("Incomplete BER/DER data");
}
}
- return sb.toString();
+ return tag;
}
}
diff --git a/jdk/src/share/classes/sun/security/tools/KeyTool.java b/jdk/src/share/classes/sun/security/tools/KeyTool.java
index d3031ad77f0..3f6eca93218 100644
--- a/jdk/src/share/classes/sun/security/tools/KeyTool.java
+++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java
@@ -977,46 +977,35 @@ public final class KeyTool {
if (filename != null) {
inStream = new FileInputStream(filename);
}
- // Read the full stream before feeding to X509Factory,
- // otherwise, keytool -gencert | keytool -importcert
- // might not work properly, since -gencert is slow
- // and there's no data in the pipe at the beginning.
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ String importAlias = (alias!=null)?alias:keyAlias;
try {
- byte[] b = new byte[4096];
- while (true) {
- int len = inStream.read(b);
- if (len < 0) break;
- bout.write(b, 0, len);
+ if (keyStore.entryInstanceOf(
+ importAlias, KeyStore.PrivateKeyEntry.class)) {
+ kssave = installReply(importAlias, inStream);
+ if (kssave) {
+ System.err.println(rb.getString
+ ("Certificate reply was installed in keystore"));
+ } else {
+ System.err.println(rb.getString
+ ("Certificate reply was not installed in keystore"));
+ }
+ } else if (!keyStore.containsAlias(importAlias) ||
+ keyStore.entryInstanceOf(importAlias,
+ KeyStore.TrustedCertificateEntry.class)) {
+ kssave = addTrustedCert(importAlias, inStream);
+ if (kssave) {
+ System.err.println(rb.getString
+ ("Certificate was added to keystore"));
+ } else {
+ System.err.println(rb.getString
+ ("Certificate was not added to keystore"));
+ }
}
} finally {
if (inStream != System.in) {
inStream.close();
}
}
- inStream = new ByteArrayInputStream(bout.toByteArray());
- String importAlias = (alias!=null)?alias:keyAlias;
- if (keyStore.entryInstanceOf(importAlias, KeyStore.PrivateKeyEntry.class)) {
- kssave = installReply(importAlias, inStream);
- if (kssave) {
- System.err.println(rb.getString
- ("Certificate reply was installed in keystore"));
- } else {
- System.err.println(rb.getString
- ("Certificate reply was not installed in keystore"));
- }
- } else if (!keyStore.containsAlias(importAlias) ||
- keyStore.entryInstanceOf(importAlias,
- KeyStore.TrustedCertificateEntry.class)) {
- kssave = addTrustedCert(importAlias, inStream);
- if (kssave) {
- System.err.println(rb.getString
- ("Certificate was added to keystore"));
- } else {
- System.err.println(rb.getString
- ("Certificate was not added to keystore"));
- }
- }
} else if (command == IMPORTKEYSTORE) {
doImportKeyStore();
kssave = true;
@@ -2149,18 +2138,7 @@ public final class KeyTool {
inStream = new FileInputStream(filename);
}
try {
- // Read the full stream before feeding to X509Factory,
- // otherwise, keytool -gencert | keytool -printcert
- // might not work properly, since -gencert is slow
- // and there's no data in the pipe at the beginning.
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- byte[] b = new byte[4096];
- while (true) {
- int len = inStream.read(b);
- if (len < 0) break;
- bout.write(b, 0, len);
- }
- printCertFromStream(new ByteArrayInputStream(bout.toByteArray()), out);
+ printCertFromStream(inStream, out);
} finally {
if (inStream != System.in) {
inStream.close();
diff --git a/jdk/test/java/security/cert/CertificateFactory/ReturnStream.java b/jdk/test/java/security/cert/CertificateFactory/ReturnStream.java
new file mode 100644
index 00000000000..9d0bfd7fbeb
--- /dev/null
+++ b/jdk/test/java/security/cert/CertificateFactory/ReturnStream.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6813340
+ * @summary X509Factory should not depend on is.available()==0
+ */
+import java.io.*;
+import java.security.cert.*;
+
+/**
+ * Tests ol'Mac style file, end witha single '\r'
+ */
+public class ReturnStream {
+
+ public static void main(String[] args) throws Exception {
+ FileInputStream fin = new FileInputStream(new File(new File(
+ System.getProperty("test.src", "."), "openssl"), "pem"));
+ byte[] buffer = new byte[4096];
+ int size = 0;
+ while (true) {
+ int len = fin.read(buffer, size, 4096-size);
+ if (len < 0) break;
+ size += len;
+ }
+ fin.close();
+
+ // Make a copy
+ System.arraycopy(buffer, 0, buffer, size, size);
+ size += size;
+
+ // Create a ol'Mac style file.
+ for (int i=0; i
Date: Thu, 25 Mar 2010 09:38:56 +0000
Subject: [PATCH 065/190] 6937703: java/net regression test issues with samevm
Reviewed-by: alanb
---
jdk/test/ProblemList.txt | 7 ----
jdk/test/java/net/ProxySelector/B6737819.java | 6 +++
.../net/ResponseCache/ResponseCacheTest.java | 12 ++++--
.../net/ResponseCache/getResponseCode.java | 13 +++---
jdk/test/java/net/URL/TestIPv6Addresses.java | 4 ++
.../java/net/URLClassLoader/HttpTest.java | 13 +++++-
jdk/test/java/net/URLConnection/B5052093.java | 40 ++++++++++++-------
.../contentHandler/UserContentHandler.java | 12 +++++-
8 files changed, 72 insertions(+), 35 deletions(-)
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index bc30709bc9b..12d997ca62b 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -684,8 +684,6 @@ java/net/SocketInputStream/SocketClosedException.java generic-all
java/net/SocketInputStream/SocketTimeout.java generic-all
# Linux i586, address already in use or timeout, samevm issues
-java/net/URLConnection/B5052093.java generic-all
-java/net/URLConnection/contentHandler/UserContentHandler.java generic-all
java/net/URLConnection/DisconnectAfterEOF.java generic-all
java/net/URLConnection/HandleContentTypeWithAttrs.java generic-all
java/net/URLConnection/Responses.java generic-all
@@ -696,8 +694,6 @@ java/net/URLConnection/ZeroContentLength.java generic-all
java/net/ResponseCache/B6181108.java generic-all
java/net/ResponseCache/ResponseCacheTest.java generic-all
java/net/URL/GetContent.java generic-all
-java/net/URL/TestIPv6Addresses.java generic-all
-java/net/URLClassLoader/HttpTest.java generic-all
java/net/URLConnection/HttpContinueStackOverflow.java generic-all
java/net/URLConnection/Redirect307Test.java generic-all
java/net/URLConnection/RedirectLimit.java generic-all
@@ -726,9 +722,6 @@ sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java generic-all
# Connection refused, windows samevm
sun/net/www/protocol/http/DigestTest.java generic-all
-# Fails on Fedora 9 32bit & 64bit & Solaris 10, wrong proxy for http://localhost/index.html
-java/net/ProxySelector/B6737819.java generic-all
-
############################################################################
# jdk_nio
diff --git a/jdk/test/java/net/ProxySelector/B6737819.java b/jdk/test/java/net/ProxySelector/B6737819.java
index 360f1ae4aef..6e8eb553244 100644
--- a/jdk/test/java/net/ProxySelector/B6737819.java
+++ b/jdk/test/java/net/ProxySelector/B6737819.java
@@ -23,9 +23,15 @@
/*
* @test
* @bug 6737819
+ * @run main/othervm B6737819
* @summary sun.misc.net.DefaultProxySelector doesn't use proxy setting to localhost
*/
+/* Run in othervm mode since the test sets HTTP proxy system properties that
+ * are read once and cached by the protocol handler. A previous test using the
+ * HTTP handler may run and these system properties may be ignored for this test.
+ */
+
import java.net.ProxySelector;
import java.net.Proxy;
import java.net.URI;
diff --git a/jdk/test/java/net/ResponseCache/ResponseCacheTest.java b/jdk/test/java/net/ResponseCache/ResponseCacheTest.java
index f2486883e75..95ddceb07d3 100644
--- a/jdk/test/java/net/ResponseCache/ResponseCacheTest.java
+++ b/jdk/test/java/net/ResponseCache/ResponseCacheTest.java
@@ -150,10 +150,14 @@ static class NameVerifier implements HostnameVerifier {
}
}
public static void main(String args[]) throws Exception {
- ResponseCache.setDefault(new MyResponseCache());
- FNPrefix = System.getProperty("test.src", ".")+"/";
- OutFNPrefix = System.getProperty("test.scratch", ".")+"/";
- new ResponseCacheTest();
+ try {
+ ResponseCache.setDefault(new MyResponseCache());
+ FNPrefix = System.getProperty("test.src", ".")+"/";
+ OutFNPrefix = System.getProperty("test.scratch", ".")+"/";
+ new ResponseCacheTest();
+ } finally{
+ ResponseCache.setDefault(null);
+ }
}
static class MyResponseCache extends ResponseCache {
diff --git a/jdk/test/java/net/ResponseCache/getResponseCode.java b/jdk/test/java/net/ResponseCache/getResponseCode.java
index a05f81b149c..b25cf2869e0 100644
--- a/jdk/test/java/net/ResponseCache/getResponseCode.java
+++ b/jdk/test/java/net/ResponseCache/getResponseCode.java
@@ -30,8 +30,7 @@
import java.net.*;
import java.util.*;
import java.io.*;
-import java.nio.*;
-import sun.net.www.ParseUtil;
+
/**
* Request should get serviced by the cache handler. Response get
@@ -52,9 +51,13 @@ public class getResponseCode {
}
}
public static void main(String args[]) throws Exception {
- ResponseCache.setDefault(new MyResponseCache());
- FNPrefix = System.getProperty("test.src", ".")+"/";
- new getResponseCode();
+ try {
+ ResponseCache.setDefault(new MyResponseCache());
+ FNPrefix = System.getProperty("test.src", ".")+"/";
+ new getResponseCode();
+ } finally{
+ ResponseCache.setDefault(null);
+ }
}
static class MyResponseCache extends ResponseCache {
diff --git a/jdk/test/java/net/URL/TestIPv6Addresses.java b/jdk/test/java/net/URL/TestIPv6Addresses.java
index adb43f65e92..44f9d0283c6 100644
--- a/jdk/test/java/net/URL/TestIPv6Addresses.java
+++ b/jdk/test/java/net/URL/TestIPv6Addresses.java
@@ -23,8 +23,12 @@
/* @test
* @bug 4451522 4460484
+ * @run main/othervm TestIPv6Addresses
* @summary URI and URL getHost() methods don't comform to RFC 2732
*/
+
+// Run in othervm because the tests sets a SecurityManager
+
import java.net.*;
public class TestIPv6Addresses {
diff --git a/jdk/test/java/net/URLClassLoader/HttpTest.java b/jdk/test/java/net/URLClassLoader/HttpTest.java
index e04331f0123..c7935b20a94 100644
--- a/jdk/test/java/net/URLClassLoader/HttpTest.java
+++ b/jdk/test/java/net/URLClassLoader/HttpTest.java
@@ -56,9 +56,9 @@ public class HttpTest {
}
public void run() {
+ InputStream in = null;
try {
-
- InputStream in = s.getInputStream();
+ in = s.getInputStream();
for (;;) {
// read entire request from client
@@ -111,6 +111,9 @@ public class HttpTest {
} // for
} catch (Exception e) {
+ unexpected(e);
+ } finally {
+ if (in != null) { try {in.close(); } catch(IOException e) {unexpected(e);} }
}
}
}
@@ -131,6 +134,11 @@ public class HttpTest {
}
}
+ void unexpected(Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+
public static HttpServer create() throws Exception {
if (svr != null)
return svr;
@@ -211,6 +219,7 @@ public class HttpTest {
// one GET request
svr.counters().reset();
InputStream in = cl.getResourceAsStream("foo2.gif");
+ in.close();
System.out.println(svr.counters());
if (svr.counters().getCount() > 1) {
failed = true;
diff --git a/jdk/test/java/net/URLConnection/B5052093.java b/jdk/test/java/net/URLConnection/B5052093.java
index c1add42c89a..6d14b131196 100644
--- a/jdk/test/java/net/URLConnection/B5052093.java
+++ b/jdk/test/java/net/URLConnection/B5052093.java
@@ -1,12 +1,10 @@
/*
- * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
+ * 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
@@ -66,17 +64,29 @@ public class B5052093 implements HttpCallback {
public static void main(String[] args) throws Exception {
server = new HttpServer(new B5052093(), 1, 10, 0);
- URL url = new URL("http://localhost:"+server.getLocalPort()+"/foo");
- URLConnection conn = url.openConnection();
- int i = conn.getContentLength();
- long l = conn.getContentLengthLong();
- if (i != -1 || l != testSize)
- throw new RuntimeException("Wrong content-length from http");
+ try {
+ URL url = new URL("http://localhost:"+server.getLocalPort()+"/foo");
+ URLConnection conn = url.openConnection();
+ int i = conn.getContentLength();
+ long l = conn.getContentLengthLong();
+ if (i != -1 || l != testSize) {
+ System.out.println("conn.getContentLength = " + i);
+ System.out.println("conn.getContentLengthLong = " + l);
+ System.out.println("testSize = " + testSize);
+ throw new RuntimeException("Wrong content-length from http");
+ }
- URLConnection fu = new LargeFileURLConnection(new LargeFile());
- i = fu.getContentLength();
- l = fu.getContentLengthLong();
- if (i != -1 || l != testSize)
- throw new RuntimeException("Wrong content-length from file");
+ URLConnection fu = new LargeFileURLConnection(new LargeFile());
+ i = fu.getContentLength();
+ l = fu.getContentLengthLong();
+ if (i != -1 || l != testSize) {
+ System.out.println("fu.getContentLength = " + i);
+ System.out.println("fu.getContentLengthLong = " + l);
+ System.out.println("testSize = " + testSize);
+ throw new RuntimeException("Wrong content-length from file");
+ }
+ } finally {
+ server.terminate();
+ }
}
}
diff --git a/jdk/test/java/net/URLConnection/contentHandler/UserContentHandler.java b/jdk/test/java/net/URLConnection/contentHandler/UserContentHandler.java
index 0a571d45b7d..2f4d5f621f0 100644
--- a/jdk/test/java/net/URLConnection/contentHandler/UserContentHandler.java
+++ b/jdk/test/java/net/URLConnection/contentHandler/UserContentHandler.java
@@ -25,8 +25,16 @@
* @bug 4191147
* @summary 1.2beta4 does not load user defined content handlers
* @build UserContentHandler
- * @run main UserContentHandler
+ * @run main/othervm UserContentHandler
*/
+
+/* Run in othervm mode since the test sets a system property, java.content.handler.pkgs,
+ * that prepends a specific package prefix defining a text/plain content
+ * handler. If other URLConnection tests run before this one they might trigger
+ * the Sun implementation text/plain content handler in sun.net.www.content
+ * to be loaded and cached, this will break this test.
+ */
+
import java.net.*;
import java.io.*;
import java.util.*;
@@ -55,7 +63,7 @@ public class UserContentHandler implements Runnable {
// don't close the connection immediately as otherwise
// the http headers may not have been received and the
// http client will re-connect.
- Thread.currentThread().sleep(2000);
+ Thread.sleep(2000);
s.close();
From 9759f199ccce19a49ad1eecccd853affc7a80075 Mon Sep 17 00:00:00 2001
From: Kelly O'Hair
Date: Fri, 26 Mar 2010 22:37:04 -0700
Subject: [PATCH 066/190] 6938326: Use of "ant -diagnostics" a problem with ant
1.8.0, exit code 1 now
Reviewed-by: jjg
---
langtools/make/Makefile | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/langtools/make/Makefile b/langtools/make/Makefile
index 0b6e779fba3..7657b8110e4 100644
--- a/langtools/make/Makefile
+++ b/langtools/make/Makefile
@@ -188,10 +188,16 @@ clobber: clean
# All ant targets of interest
ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
+# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1)
+$(OUTPUTDIR)/build/ant-diagnostics.log:
+ @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
+ @$(RM) $@
+ $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \
+ $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@
+
# Create a make target for each
-$(ANT_TARGETS):
+$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log
@ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
- $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $(OUTPUTDIR)/build/ant-diagnostics.log
$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
#-------------------------------------------------------------------
From 0f50eeb222752b2f83490569c586550bf106d0ea Mon Sep 17 00:00:00 2001
From: Xue-Lei Andrew Fan
Date: Mon, 29 Mar 2010 13:27:25 +0800
Subject: [PATCH 067/190] 6693917: regression tests need to update for
supporting ECC on solaris 11
Reviewed-by: weijun
---
jdk/test/sun/security/ssl/etc/keystore | Bin 2576 -> 4605 bytes
jdk/test/sun/security/ssl/etc/truststore | Bin 1462 -> 2489 bytes
.../ciphersuites/CheckCipherSuites.java | 81 +++++++++++++++++-
3 files changed, 78 insertions(+), 3 deletions(-)
diff --git a/jdk/test/sun/security/ssl/etc/keystore b/jdk/test/sun/security/ssl/etc/keystore
index 0c95f22d640eefdd004990f063c8dcf5927d8a00..2eb1993f3aff3d996d7970001765fc3e8fb8d1f7 100644
GIT binary patch
delta 1459
zcmaizdrZ?;6vuzRUwawMs%RdtOI-vSnz=e6x%|GD5F+DO!^RU
zI+2#v2_hge4f04;1c!pPL_p+`!6bmLXa%MMg$eRfs{0AL&1`0WoaBCU&b|4b^Ep>Z
zH8V+XO>a#Q1R+?US4oYibgn=W8=EBDBM|c;2wv`dbwGsWv_M`0D1^Cg1Q>-~kp(b}
zhfsNzq@T8M3RhKKp*@>nB?_tWJQjq1x$O0Wl`JIPw>W2SW)uWo6LTAQm^-CuE{Dj}~SgHsKB
z82T+|oMmO{+7Y$G5GTOj6uTh%lCCh_Le=iqBIx0N_v<*ENVn~qXl~KfiPrD`Myyb;
z#yrCie#Z(fz>e@Gpnxx6u@fOeMon0Fj*&eChy)AQRKFG<6b3P@d6>inqXhK;EM%|%
z-~dmsnhUtx5E_}o0&EuhgH%6(W2OFJ;fKozOqetC3J!*GYzVD<(wL&Wa<^l=p0y7H%t8*wm%@7$oj^C@Uk}46)&CXne>rg
zbo?wqci-WO&l5bdWYeMo=$c3Ny=eYO?IzLVREfJ$mR#to*!A$;@ub`AKJQ9J(QZRqSgG2NYE69>
z>Yb(G9w1?!k-rEc2Y>>J!w7br$00C+;2~vk^DrP2h}iH`C&<`7;&Bkzs&2K|x)j*c
z$TJAJfX%_+VF=l)Ss1|&@_!H>G!{8pu2j8izG;!~O=q0mH{wW-*5)0q+Y#th7>KXg
zn++^IOPyr6yHmPBH?golt^sltn1}6;-Fy_qA-Lzj?!BO()+p7jaId5^wrN%7tGMen
zX#)QqLx>I7L!e-JCK?Jt@`HW~nDs4HpqBq?3c|_dkdVr2?Lmv8vU1D(7j3T7!e8wR
zU}jKtJR@Zw0i6Qns_Gw_zmF>qdvq)P=u%~F%m$Mw!^HH+SsXh2j2qFvIc~uG-n3Ts
z^g+zczd2Z894Huv1mwTW&Nkxs2>>?m`uK-97=ZV3woF|=$4=VXBnU7x;7Y=2H*Tin
zCq*0@+0SsS(8bEm#WVXKC!K0|VUp|;>A`8lYf2+!Wfo9hWZ2)2jOcCR)s)5zzOnS5
zXt^9+>)bcUaFt}OPqpcUgZym6@n;o7oGys1d!fAN^sOE^@nfk>rgBogo;gtAF!!^fO20ee@
z+J#>EiCakH`md+7k$}njBhb~oAOg-wk}dI=%sW>VR=@6cWzK#4PBGGD!+0bTPj62=
zf5(JQCYH7Q(zj|lFUrBZV#s<>TY^>|v@GgcKZo9n+o;t)j_hx^q4N=<#={4fS9o-w
PmGP6cw$CZ=la=9&3ILTD
B5!?U(
diff --git a/jdk/test/sun/security/ssl/etc/truststore b/jdk/test/sun/security/ssl/etc/truststore
index 1e140ddd2e140b18251cccc44e1a10ffabc3a14b..65a140d773206daf836779d70a5df75b51a5cd91 100644
GIT binary patch
delta 689
zcmdnSy;C^&-`jt085kItfS3hL^QV;N=2jLJC#K~Wr6#9jFfcHx>-dB$V_=QYGc~XT
zDitzlV&XGsVk~E35m%#Oj2+~bGKTSeO*y#oy+~qD*4@OrQ*YgVV=&$6D$+
znV1SG?imCZ#WT4<_c>30o|z
z@a6e-(Cz2?Bm-ra4}n@bixU{56})-if_gzlLRJnZT->&K#0Yn7!5?yr1;y8lgH~nrv8DUZQEW8
zJ#74}vi~CA`lowRKTde{h)II&tWrv^mhL}+(qf~t^&Tg~ukgO*J$U+c{AMfWOeW!5
X9uZb=G6Rm?xzq82rG>|F_1&8QDx?V2
delta 47
zcmdlfyp5aZ-`jt085kItKzOqolQHvVC-xL3;hQY;#5&*HcYS4FKfyUYa`~~HHUNyE
B5#ay;
diff --git a/jdk/test/sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java b/jdk/test/sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java
index 12a41475803..8156cf28cd6 100644
--- a/jdk/test/sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java
+++ b/jdk/test/sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,9 +40,21 @@ public class CheckCipherSuites {
"SSL_RSA_WITH_RC4_128_MD5",
"SSL_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
"SSL_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
"SSL_RSA_WITH_DES_CBC_SHA",
@@ -59,11 +71,27 @@ public class CheckCipherSuites {
"SSL_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_AES_128_CBC_SHA",
"TLS_RSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA",
"SSL_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
"SSL_RSA_WITH_DES_CBC_SHA",
@@ -81,9 +109,21 @@ public class CheckCipherSuites {
"SSL_RSA_WITH_RC4_128_MD5",
"SSL_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
"SSL_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
"SSL_RSA_WITH_DES_CBC_SHA",
@@ -93,14 +133,23 @@ public class CheckCipherSuites {
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
+
"SSL_RSA_WITH_NULL_MD5",
"SSL_RSA_WITH_NULL_SHA",
+ "TLS_ECDH_ECDSA_WITH_NULL_SHA",
+ "TLS_ECDH_RSA_WITH_NULL_SHA",
+ "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
+ "TLS_ECDHE_RSA_WITH_NULL_SHA",
"SSL_DH_anon_WITH_RC4_128_MD5",
"TLS_DH_anon_WITH_AES_128_CBC_SHA",
"SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
"SSL_DH_anon_WITH_DES_CBC_SHA",
+ "TLS_ECDH_anon_WITH_RC4_128_SHA",
+ "TLS_ECDH_anon_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA",
"SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
"SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
+ "TLS_ECDH_anon_WITH_NULL_SHA",
"TLS_KRB5_WITH_RC4_128_SHA",
"TLS_KRB5_WITH_RC4_128_MD5",
"TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
@@ -110,7 +159,7 @@ public class CheckCipherSuites {
"TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
"TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
"TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
- "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5"
+ "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",
};
// supported ciphersuites using unlimited JCE policy jurisdiction files
@@ -120,11 +169,27 @@ public class CheckCipherSuites {
"SSL_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_AES_128_CBC_SHA",
"TLS_RSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
+ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA",
"SSL_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
+ "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
"SSL_RSA_WITH_DES_CBC_SHA",
@@ -134,15 +199,25 @@ public class CheckCipherSuites {
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
+
"SSL_RSA_WITH_NULL_MD5",
"SSL_RSA_WITH_NULL_SHA",
+ "TLS_ECDH_ECDSA_WITH_NULL_SHA",
+ "TLS_ECDH_RSA_WITH_NULL_SHA",
+ "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
+ "TLS_ECDHE_RSA_WITH_NULL_SHA",
"SSL_DH_anon_WITH_RC4_128_MD5",
"TLS_DH_anon_WITH_AES_128_CBC_SHA",
"TLS_DH_anon_WITH_AES_256_CBC_SHA",
"SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
"SSL_DH_anon_WITH_DES_CBC_SHA",
+ "TLS_ECDH_anon_WITH_RC4_128_SHA",
+ "TLS_ECDH_anon_WITH_AES_128_CBC_SHA",
+ "TLS_ECDH_anon_WITH_AES_256_CBC_SHA",
+ "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA",
"SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
"SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
+ "TLS_ECDH_anon_WITH_NULL_SHA",
"TLS_KRB5_WITH_RC4_128_SHA",
"TLS_KRB5_WITH_RC4_128_MD5",
"TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
@@ -152,7 +227,7 @@ public class CheckCipherSuites {
"TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
"TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
"TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
- "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5"
+ "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",
};
private static void showSuites(String[] suites) {
From a44958558ea313801f6964208c55d45f72c1c818 Mon Sep 17 00:00:00 2001
From: Yuka Kamiya
Date: Tue, 30 Mar 2010 18:35:47 +0900
Subject: [PATCH 068/190] 6939021: (tz) Support tzdata2010g
Reviewed-by: okutsu
---
jdk/make/sun/javazic/tzdata/VERSION | 2 +-
jdk/make/sun/javazic/tzdata/antarctica | 63 ++++++++++++++-
jdk/make/sun/javazic/tzdata/asia | 80 +++++++++++--------
jdk/make/sun/javazic/tzdata/australasia | 2 +-
jdk/make/sun/javazic/tzdata/europe | 10 ++-
jdk/make/sun/javazic/tzdata/zone.tab | 7 +-
.../sun/util/resources/TimeZoneNames.java | 5 +-
7 files changed, 124 insertions(+), 45 deletions(-)
diff --git a/jdk/make/sun/javazic/tzdata/VERSION b/jdk/make/sun/javazic/tzdata/VERSION
index 4f195ed78fc..5575f59019b 100644
--- a/jdk/make/sun/javazic/tzdata/VERSION
+++ b/jdk/make/sun/javazic/tzdata/VERSION
@@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
-tzdata2010e
+tzdata2010g
diff --git a/jdk/make/sun/javazic/tzdata/antarctica b/jdk/make/sun/javazic/tzdata/antarctica
index bd5cd134765..4192486fa42 100644
--- a/jdk/make/sun/javazic/tzdata/antarctica
+++ b/jdk/make/sun/javazic/tzdata/antarctica
@@ -79,6 +79,33 @@ Rule ChileAQ 1999 only - Apr 4 3:00u 0 -
Rule ChileAQ 1999 max - Oct Sun>=9 4:00u 1:00 S
Rule ChileAQ 2000 max - Mar Sun>=9 3:00u 0 -
+# These rules are stolen from the `australasia' file.
+Rule AusAQ 1917 only - Jan 1 0:01 1:00 -
+Rule AusAQ 1917 only - Mar 25 2:00 0 -
+Rule AusAQ 1942 only - Jan 1 2:00 1:00 -
+Rule AusAQ 1942 only - Mar 29 2:00 0 -
+Rule AusAQ 1942 only - Sep 27 2:00 1:00 -
+Rule AusAQ 1943 1944 - Mar lastSun 2:00 0 -
+Rule AusAQ 1943 only - Oct 3 2:00 1:00 -
+Rule ATAQ 1967 only - Oct Sun>=1 2:00s 1:00 -
+Rule ATAQ 1968 only - Mar lastSun 2:00s 0 -
+Rule ATAQ 1968 1985 - Oct lastSun 2:00s 1:00 -
+Rule ATAQ 1969 1971 - Mar Sun>=8 2:00s 0 -
+Rule ATAQ 1972 only - Feb lastSun 2:00s 0 -
+Rule ATAQ 1973 1981 - Mar Sun>=1 2:00s 0 -
+Rule ATAQ 1982 1983 - Mar lastSun 2:00s 0 -
+Rule ATAQ 1984 1986 - Mar Sun>=1 2:00s 0 -
+Rule ATAQ 1986 only - Oct Sun>=15 2:00s 1:00 -
+Rule ATAQ 1987 1990 - Mar Sun>=15 2:00s 0 -
+Rule ATAQ 1987 only - Oct Sun>=22 2:00s 1:00 -
+Rule ATAQ 1988 1990 - Oct lastSun 2:00s 1:00 -
+Rule ATAQ 1991 1999 - Oct Sun>=1 2:00s 1:00 -
+Rule ATAQ 1991 2005 - Mar lastSun 2:00s 0 -
+Rule ATAQ 2000 only - Aug lastSun 2:00s 1:00 -
+Rule ATAQ 2001 max - Oct Sun>=1 2:00s 1:00 -
+Rule ATAQ 2006 only - Apr Sun>=1 2:00s 0 -
+Rule ATAQ 2007 only - Mar lastSun 2:00s 0 -
+Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 -
# Argentina - year-round bases
# Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@@ -120,20 +147,52 @@ Rule ChileAQ 2000 max - Mar Sun>=9 3:00u 0 -
# http://www.timeanddate.com/news/time/antarctica-new-times.html
#
+# From Steffen Thorsen (2010-03-10):
+# We got these changes from the Australian Antarctic Division:
+# - Macquarie Island will stay on UTC+11 for winter and therefore not
+# switch back from daylight savings time when other parts of Australia do
+# on 4 April.
+#
+# - Casey station reverted to its normal time of UTC+8 on 5 March 2010.
+# The change to UTC+11 is being considered as a regular summer thing but
+# has not been decided yet.
+#
+# - Davis station will revert to its normal time of UTC+7 at 10 March 2010
+# 20:00 UTC.
+#
+# - Mawson station stays on UTC+5.
+#
+# In addition to the Rule changes for Casey/Davis, it means that Macquarie
+# will no longer be like Hobart and will have to have its own Zone created.
+#
+# Background:
+#
+# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
+#
+
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Antarctica/Casey 0 - zzz 1969
8:00 - WST 2009 Oct 18 2:00
# Western (Aus) Standard Time
- 11:00 - CAST # Casey Time
+ 11:00 - CAST 2010 Mar 5 2:00
+ # Casey Time
+ 8:00 - WST
Zone Antarctica/Davis 0 - zzz 1957 Jan 13
7:00 - DAVT 1964 Nov # Davis Time
0 - zzz 1969 Feb
7:00 - DAVT 2009 Oct 18 2:00
- 5:00 - DAVT
+ 5:00 - DAVT 2010 Mar 10 20:00u
+ 7:00 - DAVT
Zone Antarctica/Mawson 0 - zzz 1954 Feb 13
6:00 - MAWT 2009 Oct 18 2:00
# Mawson Time
5:00 - MAWT
+Zone Antarctica/Macquarie 0 - zzz 1911
+ 10:00 - EST 1916 Oct 1 2:00
+ 10:00 1:00 EST 1917 Feb
+ 10:00 AusAQ EST 1967
+ 10:00 ATAQ EST 2010 Apr 4 3:00
+ 11:00 - MIST # Macquarie Island Time
# References:
#
# Casey Weather (1998-02-26)
diff --git a/jdk/make/sun/javazic/tzdata/asia b/jdk/make/sun/javazic/tzdata/asia
index ae6d3b94524..54051000939 100644
--- a/jdk/make/sun/javazic/tzdata/asia
+++ b/jdk/make/sun/javazic/tzdata/asia
@@ -236,42 +236,20 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # Al Manamah
# 2010 midnight. The decision came at a cabinet meeting at the Prime
# Minister's Office last night..."
-# From Danvin Ruangchan (2009-12-24):
-# ...the news mentions DST will be turned off again 7 months after March
-# 31st on Oct 31, 2010.
-
-# From Arthur David Olson (2009-12-26):
-# Indeed, "The government will advance again the Banglasdesh Standard
-# Time by one one hour on March 31 next year by enforcing the Daylight
-# Saving Time (DST) for seven months. It will continue till October 31
-# until further notice." I take that last sentence as the
-# establishment of a rule.
-
-# From Nobutomo Nakano (2010-02-19):
-# We received a report from Bangladesh saying that the start/end of
-# Bangladesh DST is incorrect. Currently we have only the Bengali version
-# of the official mail from BTRC which describes the following:
-#
-# "From 2010 each year when local standard time is about to reach
-# March 31 at 10:59:00 PM clocks are turned forward 1 hour (11:59:00 PM)
-# and when local daylight time is about to October 31 at 11:59:00 PM
-# clocks are turned backward 1 hour (10:59:00 PM)."
-#
-# So, DST will start/end 1 minute earlier.
-
-# From Arthur David Olson (2010-03-03):
-# The file
-#
-# http://www.cabinet.gov/bd/file_upload/news_events/en_169.pdf
+# From Alexander Krivenyshev (2010-03-22):
+# According to Bangladesh newspaper "The Daily Star,"
+# Cabinet cancels Daylight Saving Time
+#
+# http://www.thedailystar.net/newDesign/latest_news.php?nid=22817
+#
+# or
+#
+# http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html
#
-# is in Bengali; it does contain two "31"s as well as two "11.59"s and a "10.59"
-# which is consistent with the information provided by Nobutomo Nakano.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Dhaka 2009 only - Jun 19 23:00 1:00 S
Rule Dhaka 2009 only - Dec 31 23:59 0 -
-Rule Dhaka 2010 max - Mar 31 22:59 1:00 S
-Rule Dhaka 2010 max - Oct 31 23:59 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Dhaka 6:01:40 - LMT 1890
@@ -2151,6 +2129,32 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
#
+# From Alexander Krivenyshev (2010-03-19):
+# According to Voice of Palestine DST will last for 191 days, from March
+# 26, 2010 till "the last Sunday before the tenth day of Tishri
+# (October), each year" (October 03, 2010?)
+#
+#
+# http://palvoice.org/forums/showthread.php?t=245697
+#
+# (in Arabic)
+# or
+#
+# http://www.worldtimezone.com/dst_news/dst_news_westbank03.html
+#
+
+# From Steffen Thorsen (2010-03-24):
+# ...Ma'an News Agency reports that Hamas cabinet has decided it will
+# start one day later, at 12:01am. Not sure if they really mean 12:01am or
+# noon though:
+#
+#
+# http://www.maannews.net/eng/ViewDetails.aspx?ID=271178
+#
+# (Ma'an News Agency)
+# "At 12:01am Friday, clocks in Israel and the West Bank will change to
+# 1:01am, while Gaza clocks will change at 12:01am Saturday morning."
+
# The rules for Egypt are stolen from the `africa' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -2168,7 +2172,8 @@ Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S
Rule Palestine 2006 only - Sep 22 0:00 0 -
Rule Palestine 2007 only - Sep Thu>=8 2:00 0 -
Rule Palestine 2008 only - Aug lastFri 2:00 0 -
-Rule Palestine 2009 max - Mar lastFri 0:00 1:00 S
+Rule Palestine 2009 only - Mar lastFri 0:00 1:00 S
+Rule Palestine 2010 max - Mar lastSat 0:01 1:00 S
Rule Palestine 2009 max - Sep Fri>=1 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -2460,9 +2465,18 @@ Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
# Thursday of the month or the start of the last Friday of the month or
# something else. For now, use the start of the last Friday.
+# From Steffen Thorsen (2010-03-17):
+# The "Syrian News Station" reported on 2010-03-16 that the Council of
+# Ministers has decided that Syria will start DST on midnight Thursday
+# 2010-04-01: (midnight between Thursday and Friday):
+#
+# http://sns.sy/sns/?path=news/read/11421 (Arabic)
+#
+
Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
Rule Syria 2008 only - Nov 1 0:00 0 -
-Rule Syria 2009 max - Mar lastFri 0:00 1:00 S
+Rule Syria 2009 only - Mar lastFri 0:00 1:00 S
+Rule Syria 2010 max - Apr Fri>=1 0:00 1:00 S
Rule Syria 2009 max - Oct lastFri 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
diff --git a/jdk/make/sun/javazic/tzdata/australasia b/jdk/make/sun/javazic/tzdata/australasia
index 9f4e4818af3..9165c4aedec 100644
--- a/jdk/make/sun/javazic/tzdata/australasia
+++ b/jdk/make/sun/javazic/tzdata/australasia
@@ -512,7 +512,7 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5
Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5
-11:26:56 - LMT 1911
-11:30 - SAMT 1950 # Samoa Time
- -11:00 - WST 2010 Oct 24
+ -11:00 - WST 2010 Sep 26
-11:00 1:00 WSDT 2011 Apr 3
-11:00 - WST
diff --git a/jdk/make/sun/javazic/tzdata/europe b/jdk/make/sun/javazic/tzdata/europe
index 9235c7e1697..6404369bf61 100644
--- a/jdk/make/sun/javazic/tzdata/europe
+++ b/jdk/make/sun/javazic/tzdata/europe
@@ -2063,7 +2063,9 @@ Zone Europe/Samara 3:20:36 - LMT 1919 Jul 1 2:00
3:00 Russia KUY%sT 1991 Mar 31 2:00s
2:00 Russia KUY%sT 1991 Sep 29 2:00s
3:00 - KUYT 1991 Oct 20 3:00
- 4:00 Russia SAM%sT # Samara Time
+ 4:00 Russia SAM%sT 2010 Mar 28 2:00s # Samara Time
+ 3:00 Russia SAM%sT
+
#
# From Oscar van Vlijmen (2001-08-25): [This region consists of]
# Respublika Bashkortostan, Komi-Permyatskij avtonomnyj okrug,
@@ -2216,7 +2218,8 @@ Zone Asia/Kamchatka 10:34:36 - LMT 1922 Nov 10
11:00 - PETT 1930 Jun 21 # P-K Time
12:00 Russia PET%sT 1991 Mar 31 2:00s
11:00 Russia PET%sT 1992 Jan 19 2:00s
- 12:00 Russia PET%sT
+ 12:00 Russia PET%sT 2010 Mar 28 2:00s
+ 11:00 Russia PET%sT
#
# Chukotskij avtonomnyj okrug
Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
@@ -2224,7 +2227,8 @@ Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
13:00 Russia ANA%sT 1982 Apr 1 0:00s
12:00 Russia ANA%sT 1991 Mar 31 2:00s
11:00 Russia ANA%sT 1992 Jan 19 2:00s
- 12:00 Russia ANA%sT
+ 12:00 Russia ANA%sT 2010 Mar 28 2:00s
+ 11:00 Russia ANA%sT
# Serbia
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
diff --git a/jdk/make/sun/javazic/tzdata/zone.tab b/jdk/make/sun/javazic/tzdata/zone.tab
index e4bc3450c76..abbdbaa8e70 100644
--- a/jdk/make/sun/javazic/tzdata/zone.tab
+++ b/jdk/make/sun/javazic/tzdata/zone.tab
@@ -66,6 +66,7 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
AQ -7824+10654 Antarctica/Vostok Vostok Station, S Magnetic Pole
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
+AQ -5430+15857 Antarctica/Macquarie Macquarie Island Station, Macquarie Island
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF)
AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN)
@@ -351,7 +352,7 @@ RS +4450+02030 Europe/Belgrade
RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea
-RU +5312+05009 Europe/Samara Moscow+01 - Samara, Udmurtia
+RU +5312+05009 Europe/Samara Moscow - Samara, Udmurtia
RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
@@ -362,8 +363,8 @@ RU +6200+12940 Asia/Yakutsk Moscow+06 - Lena River
RU +4310+13156 Asia/Vladivostok Moscow+07 - Amur River
RU +4658+14242 Asia/Sakhalin Moscow+07 - Sakhalin Island
RU +5934+15048 Asia/Magadan Moscow+08 - Magadan
-RU +5301+15839 Asia/Kamchatka Moscow+09 - Kamchatka
-RU +6445+17729 Asia/Anadyr Moscow+10 - Bering Sea
+RU +5301+15839 Asia/Kamchatka Moscow+08 - Kamchatka
+RU +6445+17729 Asia/Anadyr Moscow+08 - Bering Sea
RW -0157+03004 Africa/Kigali
SA +2438+04643 Asia/Riyadh
SB -0932+16012 Pacific/Guadalcanal
diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java
index a347db8ccc1..74ccc66449b 100644
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java
@@ -446,12 +446,13 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"America/Winnipeg", CST},
{"America/Yakutat", AKST},
{"America/Yellowknife", MST},
- {"Antarctica/Casey", new String[] {"Casey Time", "CAST",
- "Casey Summer Time", "CAST"}},
+ {"Antarctica/Casey", WST_AUS},
{"Antarctica/Davis", new String[] {"Davis Time", "DAVT",
"Davis Summer Time", "DAVST"}},
{"Antarctica/DumontDUrville", new String[] {"Dumont-d'Urville Time", "DDUT",
"Dumont-d'Urville Summer Time", "DDUST"}},
+ {"Antarctica/Macquarie", new String[] {"Macquarie Island Time", "MIST",
+ "Macquarie Island Summer Time", "MIST"}},
{"Antarctica/Mawson", new String[] {"Mawson Time", "MAWT",
"Mawson Summer Time", "MAWST"}},
{"Antarctica/McMurdo", NZST},
From da8ef7e433344552b53e990b365df0afab1454ee Mon Sep 17 00:00:00 2001
From: Yuka Kamiya
Date: Tue, 30 Mar 2010 21:16:41 +0900
Subject: [PATCH 069/190] 6907881: Different undesired behavior for entering
Asian characters in Windows IME starting with Java 6.0
Reviewed-by: okutsu
---
jdk/src/windows/native/sun/windows/awt_Component.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.cpp b/jdk/src/windows/native/sun/windows/awt_Component.cpp
index d98f241a145..0557c6d7ea7 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3707,8 +3707,7 @@ void AwtComponent::SetCompositionWindow(RECT& r)
if (hIMC == NULL) {
return;
}
- COMPOSITIONFORM cf = {CFS_POINT, {0, r.bottom}, NULL};
- // Place the composition window right below the client Window
+ COMPOSITIONFORM cf = {CFS_DEFAULT, {0, 0}, {0, 0, 0, 0}};
ImmSetCompositionWindow(hIMC, &cf);
}
From 972acdab816f00cd4f38e1e8d829888329cd8295 Mon Sep 17 00:00:00 2001
From: Antonios Printezis
Date: Tue, 30 Mar 2010 15:36:55 -0400
Subject: [PATCH 070/190] 6937160: G1: should observe GCTimeRatio
Remove the G1GCPercent parameter, that specifies the desired GC overhead percentage in G1, and observe the GCTimeRatio parameter instead.
Reviewed-by: jmasa, johnc
---
.../vm/gc_implementation/g1/g1CollectorPolicy.cpp | 11 +++++++++--
.../vm/gc_implementation/g1/g1CollectorPolicy.hpp | 2 ++
.../src/share/vm/gc_implementation/g1/g1_globals.hpp | 3 ---
hotspot/src/share/vm/runtime/arguments.cpp | 10 ++++++++++
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index 32d707a281e..287324609fb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -198,7 +198,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_recorded_survivor_regions(0),
_recorded_survivor_head(NULL),
_recorded_survivor_tail(NULL),
- _survivors_age_table(true)
+ _survivors_age_table(true),
+
+ _gc_overhead_perc(0.0)
{
// Set up the region size and associated fields. Given that the
@@ -275,6 +277,11 @@ G1CollectorPolicy::G1CollectorPolicy() :
// calculate_young_list_target_config during initialization
_max_survivor_regions = G1FixedSurvivorSpaceSize / HeapRegion::GrainBytes;
+ assert(GCTimeRatio > 0,
+ "we should have set it to a default value set_g1_gc_flags() "
+ "if a user set it to 0");
+ _gc_overhead_perc = 100.0 * (1.0 / (1.0 + GCTimeRatio));
+
initialize_all();
}
@@ -2288,7 +2295,7 @@ G1CollectorPolicy::conservative_avg_survival_fraction_work(double avg,
}
size_t G1CollectorPolicy::expansion_amount() {
- if ((int)(recent_avg_pause_time_ratio() * 100.0) > G1GCPercent) {
+ if ((recent_avg_pause_time_ratio() * 100.0) > _gc_overhead_perc) {
// We will double the existing space, or take
// G1ExpandByPercentOfAvailable % of the available expansion
// space, whichever is smaller, bounded below by a minimum
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index 2b9eb83f074..2be5ba9cf7b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -215,6 +215,8 @@ protected:
SurvRateGroup* _survivor_surv_rate_group;
// add here any more surv rate groups
+ double _gc_overhead_perc;
+
bool during_marking() {
return _during_marking;
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
index d2363ad6705..a72268a6ef2 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
@@ -40,9 +40,6 @@
develop(bool, G1Gen, true, \
"If true, it will enable the generational G1") \
\
- develop(intx, G1GCPercent, 10, \
- "The desired percent time spent on GC") \
- \
develop(intx, G1PolicyVerbose, 0, \
"The verbosity level on G1 policy decisions") \
\
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index e5f2862a8e4..7984761451c 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -1353,6 +1353,16 @@ void Arguments::set_g1_gc_flags() {
MarkStackSize / K, MarkStackSizeMax / K);
tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
}
+
+ if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
+ // In G1, we want the default GC overhead goal to be higher than
+ // say in PS. So we set it here to 10%. Otherwise the heap might
+ // be expanded more aggressively than we would like it to. In
+ // fact, even 10% seems to not be high enough in some cases
+ // (especially small GC stress tests that the main thing they do
+ // is allocation). We might consider increase it further.
+ FLAG_SET_DEFAULT(GCTimeRatio, 9);
+ }
}
void Arguments::set_heap_size() {
From f5197d0d363be3c934b8eeb8acb4d9884f59aabc Mon Sep 17 00:00:00 2001
From: Jon Masamitsu
Date: Tue, 13 Apr 2010 13:52:10 -0700
Subject: [PATCH 071/190] 6858496: Clear all SoftReferences before an
out-of-memory due to GC overhead limit
Ensure a full GC that clears SoftReferences before throwing an out-of-memory
Reviewed-by: ysr, jcoomes
---
.../cmsCollectorPolicy.hpp | 5 +-
.../concurrentMarkSweepGeneration.cpp | 71 +++-----
.../concurrentMarkSweepGeneration.hpp | 6 +-
.../gc_implementation/g1/g1CollectedHeap.cpp | 17 +-
.../vm/gc_implementation/g1/g1MarkSweep.cpp | 9 +-
.../includeDB_gc_parallelScavenge | 8 +-
.../vm/gc_implementation/includeDB_gc_serial | 3 +-
.../parNew/parNewGeneration.cpp | 6 +-
.../parallelScavenge/parallelScavengeHeap.cpp | 104 ++++++------
.../parallelScavenge/parallelScavengeHeap.hpp | 9 +-
.../parallelScavenge/psAdaptiveSizePolicy.cpp | 116 +++-----------
.../parallelScavenge/psAdaptiveSizePolicy.hpp | 6 +-
.../psGCAdaptivePolicyCounters.cpp | 12 +-
.../psGCAdaptivePolicyCounters.hpp | 14 +-
.../parallelScavenge/psMarkSweep.cpp | 54 +++----
.../parallelScavenge/psParallelCompact.cpp | 52 +++---
.../parallelScavenge/psScavenge.cpp | 45 +++---
.../shared/adaptiveSizePolicy.cpp | 151 +++++++++++++++++-
.../shared/adaptiveSizePolicy.hpp | 49 +++---
.../shared/vmGCOperations.hpp | 15 +-
.../share/vm/gc_interface/collectedHeap.hpp | 6 +-
.../src/share/vm/memory/collectorPolicy.cpp | 63 +++++---
.../src/share/vm/memory/collectorPolicy.hpp | 56 +++++--
.../src/share/vm/memory/defNewGeneration.cpp | 6 +-
.../src/share/vm/memory/genCollectedHeap.cpp | 14 +-
hotspot/src/share/vm/memory/genMarkSweep.cpp | 10 +-
26 files changed, 543 insertions(+), 364 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
index 1fe98442b60..3f3e187ceff 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2007-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,10 @@ class ConcurrentMarkSweepPolicy : public TwoGenerationCollectorPolicy {
ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return this; }
void initialize_gc_policy_counters();
-#if 1
+
virtual void initialize_size_policy(size_t init_eden_size,
size_t init_promo_size,
size_t init_survivor_size);
-#endif
// Returns true if the incremental mode is enabled.
virtual bool has_soft_ended_eden();
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index 9ed32074822..e96bbae4306 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1815,8 +1815,19 @@ NOT_PRODUCT(
do_compaction_work(clear_all_soft_refs);
// Has the GC time limit been exceeded?
- check_gc_time_limit();
-
+ DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration();
+ size_t max_eden_size = young_gen->max_capacity() -
+ young_gen->to()->capacity() -
+ young_gen->from()->capacity();
+ GenCollectedHeap* gch = GenCollectedHeap::heap();
+ GCCause::Cause gc_cause = gch->gc_cause();
+ size_policy()->check_gc_overhead_limit(_young_gen->used(),
+ young_gen->eden()->used(),
+ _cmsGen->max_capacity(),
+ max_eden_size,
+ full,
+ gc_cause,
+ gch->collector_policy());
} else {
do_mark_sweep_work(clear_all_soft_refs, first_state,
should_start_over);
@@ -1828,55 +1839,6 @@ NOT_PRODUCT(
return;
}
-void CMSCollector::check_gc_time_limit() {
-
- // Ignore explicit GC's. Exiting here does not set the flag and
- // does not reset the count. Updating of the averages for system
- // GC's is still controlled by UseAdaptiveSizePolicyWithSystemGC.
- GCCause::Cause gc_cause = GenCollectedHeap::heap()->gc_cause();
- if (GCCause::is_user_requested_gc(gc_cause) ||
- GCCause::is_serviceability_requested_gc(gc_cause)) {
- return;
- }
-
- // Calculate the fraction of the CMS generation was freed during
- // the last collection.
- // Only consider the STW compacting cost for now.
- //
- // Note that the gc time limit test only works for the collections
- // of the young gen + tenured gen and not for collections of the
- // permanent gen. That is because the calculation of the space
- // freed by the collection is the free space in the young gen +
- // tenured gen.
-
- double fraction_free =
- ((double)_cmsGen->free())/((double)_cmsGen->max_capacity());
- if ((100.0 * size_policy()->compacting_gc_cost()) >
- ((double) GCTimeLimit) &&
- ((fraction_free * 100) < GCHeapFreeLimit)) {
- size_policy()->inc_gc_time_limit_count();
- if (UseGCOverheadLimit &&
- (size_policy()->gc_time_limit_count() >
- AdaptiveSizePolicyGCTimeLimitThreshold)) {
- size_policy()->set_gc_time_limit_exceeded(true);
- // Avoid consecutive OOM due to the gc time limit by resetting
- // the counter.
- size_policy()->reset_gc_time_limit_count();
- if (PrintGCDetails) {
- gclog_or_tty->print_cr(" GC is exceeding overhead limit "
- "of %d%%", GCTimeLimit);
- }
- } else {
- if (PrintGCDetails) {
- gclog_or_tty->print_cr(" GC would exceed overhead limit "
- "of %d%%", GCTimeLimit);
- }
- }
- } else {
- size_policy()->reset_gc_time_limit_count();
- }
-}
-
// Resize the perm generation and the tenured generation
// after obtaining the free list locks for the
// two generations.
@@ -6182,6 +6144,11 @@ void CMSCollector::reset(bool asynch) {
}
curAddr = chunk.end();
}
+ // A successful mostly concurrent collection has been done.
+ // Because only the full (i.e., concurrent mode failure) collections
+ // are being measured for gc overhead limits, clean the "near" flag
+ // and count.
+ sp->reset_gc_overhead_limit_count();
_collectorState = Idling;
} else {
// already have the lock
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index 18164a58b4e..5536b7f00bd 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -570,10 +570,6 @@ class CMSCollector: public CHeapObj {
ConcurrentMarkSweepPolicy* _collector_policy;
ConcurrentMarkSweepPolicy* collector_policy() { return _collector_policy; }
- // Check whether the gc time limit has been
- // exceeded and set the size policy flag
- // appropriately.
- void check_gc_time_limit();
// XXX Move these to CMSStats ??? FIX ME !!!
elapsedTimer _inter_sweep_timer; // time between sweeps
elapsedTimer _intra_sweep_timer; // time _in_ sweeps
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 1734fe0bafc..b46616fcd06 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -920,13 +920,19 @@ void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs,
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread");
+ const bool do_clear_all_soft_refs = clear_all_soft_refs ||
+ collector_policy()->should_clear_all_soft_refs();
+
+ ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
+
{
IsGCActiveMark x;
// Timing
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
- TraceTime t(full ? "Full GC (System.gc())" : "Full GC", PrintGC, true, gclog_or_tty);
+ TraceTime t(full ? "Full GC (System.gc())" : "Full GC",
+ PrintGC, true, gclog_or_tty);
TraceMemoryManagerStats tms(true /* fullGC */);
@@ -985,12 +991,12 @@ void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs,
ReferenceProcessorIsAliveMutator rp_is_alive_null(ref_processor(), NULL);
ref_processor()->enable_discovery();
- ref_processor()->setup_policy(clear_all_soft_refs);
+ ref_processor()->setup_policy(do_clear_all_soft_refs);
// Do collection work
{
HandleMark hm; // Discard invalid handles created during gc
- G1MarkSweep::invoke_at_safepoint(ref_processor(), clear_all_soft_refs);
+ G1MarkSweep::invoke_at_safepoint(ref_processor(), do_clear_all_soft_refs);
}
// Because freeing humongous regions may have added some unclean
// regions, it is necessary to tear down again before rebuilding.
@@ -1208,6 +1214,9 @@ G1CollectedHeap::satisfy_failed_allocation(size_t word_size) {
return result;
}
+ assert(!collector_policy()->should_clear_all_soft_refs(),
+ "Flag should have been handled and cleared prior to this point");
+
// What else? We might try synchronous finalization later. If the total
// space available is large enough for the allocation, then a more
// complete compaction phase than we've tried so far might be
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp
index a874bcac557..af54d584da9 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,12 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp,
bool clear_all_softrefs) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
+ SharedHeap* sh = SharedHeap::heap();
+#ifdef ASSERT
+ if (sh->collector_policy()->should_clear_all_soft_refs()) {
+ assert(clear_all_softrefs, "Policy should have been checked earler");
+ }
+#endif
// hook up weak ref data so it can be used during Mark-Sweep
assert(GenMarkSweep::ref_processor() == NULL, "no stomping");
assert(rp != NULL, "should be non-NULL");
@@ -44,7 +50,6 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp,
// Increment the invocation count for the permanent generation, since it is
// implicitly collected whenever we do a full mark sweep collection.
- SharedHeap* sh = SharedHeap::heap();
sh->perm_gen()->stat_record()->invocations++;
bool marked_for_unloading = false;
diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge b/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge
index e787c2a5a6d..ef2fa4285d0 100644
--- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge
+++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge
@@ -1,5 +1,5 @@
//
-// Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+// Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -161,8 +161,10 @@ parMarkBitMap.cpp psParallelCompact.hpp
parMarkBitMap.hpp bitMap.inline.hpp
parMarkBitMap.hpp psVirtualspace.hpp
+psAdaptiveSizePolicy.cpp collectorPolicy.hpp
psAdaptiveSizePolicy.cpp gcPolicyCounters.hpp
psAdaptiveSizePolicy.cpp gcCause.hpp
+psAdaptiveSizePolicy.cpp generationSizer.hpp
psAdaptiveSizePolicy.cpp psAdaptiveSizePolicy.hpp
psAdaptiveSizePolicy.cpp psGCAdaptivePolicyCounters.hpp
psAdaptiveSizePolicy.cpp psScavenge.hpp
@@ -215,6 +217,7 @@ psMarkSweep.cpp events.hpp
psMarkSweep.cpp fprofiler.hpp
psMarkSweep.cpp gcCause.hpp
psMarkSweep.cpp gcLocker.inline.hpp
+psMarkSweep.cpp generationSizer.hpp
psMarkSweep.cpp isGCActiveMark.hpp
psMarkSweep.cpp oop.inline.hpp
psMarkSweep.cpp memoryService.hpp
@@ -256,6 +259,7 @@ psParallelCompact.cpp fprofiler.hpp
psParallelCompact.cpp gcCause.hpp
psParallelCompact.cpp gcLocker.inline.hpp
psParallelCompact.cpp gcTaskManager.hpp
+psParallelCompact.cpp generationSizer.hpp
psParallelCompact.cpp isGCActiveMark.hpp
psParallelCompact.cpp management.hpp
psParallelCompact.cpp memoryService.hpp
@@ -344,10 +348,12 @@ psPromotionLAB.hpp objectStartArray.hpp
psScavenge.cpp psAdaptiveSizePolicy.hpp
psScavenge.cpp biasedLocking.hpp
psScavenge.cpp cardTableExtension.hpp
+psScavenge.cpp collectorPolicy.hpp
psScavenge.cpp fprofiler.hpp
psScavenge.cpp gcCause.hpp
psScavenge.cpp gcLocker.inline.hpp
psScavenge.cpp gcTaskManager.hpp
+psScavenge.cpp generationSizer.hpp
psScavenge.cpp handles.inline.hpp
psScavenge.cpp isGCActiveMark.hpp
psScavenge.cpp oop.inline.hpp
diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_serial b/hotspot/src/share/vm/gc_implementation/includeDB_gc_serial
index 60e41874d43..e48bae597c9 100644
--- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_serial
+++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_serial
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
+// Copyright 2007-2010 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@ adaptiveSizePolicy.hpp allocation.hpp
adaptiveSizePolicy.hpp universe.hpp
adaptiveSizePolicy.cpp adaptiveSizePolicy.hpp
+adaptiveSizePolicy.cpp collectorPolicy.hpp
adaptiveSizePolicy.cpp gcCause.hpp
adaptiveSizePolicy.cpp ostream.hpp
adaptiveSizePolicy.cpp timer.hpp
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index 07f759c9457..5db3494cdbe 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -892,6 +892,10 @@ void ParNewGeneration::collect(bool full,
}
swap_spaces();
+ // A successful scavenge should restart the GC time limit count which is
+ // for full GC's.
+ size_policy->reset_gc_overhead_limit_count();
+
assert(to()->is_empty(), "to space should be empty now");
} else {
assert(HandlePromotionFailure,
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
index 9fe57121f14..68c16464869 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,15 +54,16 @@ jint ParallelScavengeHeap::initialize() {
CollectedHeap::pre_initialize();
// Cannot be initialized until after the flags are parsed
- GenerationSizer flag_parser;
+ // GenerationSizer flag_parser;
+ _collector_policy = new GenerationSizer();
- size_t yg_min_size = flag_parser.min_young_gen_size();
- size_t yg_max_size = flag_parser.max_young_gen_size();
- size_t og_min_size = flag_parser.min_old_gen_size();
- size_t og_max_size = flag_parser.max_old_gen_size();
+ size_t yg_min_size = _collector_policy->min_young_gen_size();
+ size_t yg_max_size = _collector_policy->max_young_gen_size();
+ size_t og_min_size = _collector_policy->min_old_gen_size();
+ size_t og_max_size = _collector_policy->max_old_gen_size();
// Why isn't there a min_perm_gen_size()?
- size_t pg_min_size = flag_parser.perm_gen_size();
- size_t pg_max_size = flag_parser.max_perm_gen_size();
+ size_t pg_min_size = _collector_policy->perm_gen_size();
+ size_t pg_max_size = _collector_policy->max_perm_gen_size();
trace_gen_sizes("ps heap raw",
pg_min_size, pg_max_size,
@@ -89,12 +90,14 @@ jint ParallelScavengeHeap::initialize() {
// move to the common code.
yg_min_size = align_size_up(yg_min_size, yg_align);
yg_max_size = align_size_up(yg_max_size, yg_align);
- size_t yg_cur_size = align_size_up(flag_parser.young_gen_size(), yg_align);
+ size_t yg_cur_size =
+ align_size_up(_collector_policy->young_gen_size(), yg_align);
yg_cur_size = MAX2(yg_cur_size, yg_min_size);
og_min_size = align_size_up(og_min_size, og_align);
og_max_size = align_size_up(og_max_size, og_align);
- size_t og_cur_size = align_size_up(flag_parser.old_gen_size(), og_align);
+ size_t og_cur_size =
+ align_size_up(_collector_policy->old_gen_size(), og_align);
og_cur_size = MAX2(og_cur_size, og_min_size);
pg_min_size = align_size_up(pg_min_size, pg_align);
@@ -355,6 +358,11 @@ HeapWord* ParallelScavengeHeap::mem_allocate(
assert(Thread::current() != (Thread*)VMThread::vm_thread(), "should not be in vm thread");
assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock");
+ // In general gc_overhead_limit_was_exceeded should be false so
+ // set it so here and reset it to true only if the gc time
+ // limit is being exceeded as checked below.
+ *gc_overhead_limit_was_exceeded = false;
+
HeapWord* result = young_gen()->allocate(size, is_tlab);
uint loop_count = 0;
@@ -428,24 +436,6 @@ HeapWord* ParallelScavengeHeap::mem_allocate(
if (result == NULL) {
- // Exit the loop if if the gc time limit has been exceeded.
- // The allocation must have failed above (result must be NULL),
- // and the most recent collection must have exceeded the
- // gc time limit. Exit the loop so that an out-of-memory
- // will be thrown (returning a NULL will do that), but
- // clear gc_time_limit_exceeded so that the next collection
- // will succeeded if the applications decides to handle the
- // out-of-memory and tries to go on.
- *gc_overhead_limit_was_exceeded = size_policy()->gc_time_limit_exceeded();
- if (size_policy()->gc_time_limit_exceeded()) {
- size_policy()->set_gc_time_limit_exceeded(false);
- if (PrintGCDetails && Verbose) {
- gclog_or_tty->print_cr("ParallelScavengeHeap::mem_allocate: "
- "return NULL because gc_time_limit_exceeded is set");
- }
- return NULL;
- }
-
// Generate a VM operation
VM_ParallelGCFailedAllocation op(size, is_tlab, gc_count);
VMThread::execute(&op);
@@ -463,16 +453,34 @@ HeapWord* ParallelScavengeHeap::mem_allocate(
assert(op.result() == NULL, "must be NULL if gc_locked() is true");
continue; // retry and/or stall as necessary
}
- // If a NULL result is being returned, an out-of-memory
- // will be thrown now. Clear the gc_time_limit_exceeded
- // flag to avoid the following situation.
- // gc_time_limit_exceeded is set during a collection
- // the collection fails to return enough space and an OOM is thrown
- // the next GC is skipped because the gc_time_limit_exceeded
- // flag is set and another OOM is thrown
- if (op.result() == NULL) {
- size_policy()->set_gc_time_limit_exceeded(false);
+
+ // Exit the loop if the gc time limit has been exceeded.
+ // The allocation must have failed above ("result" guarding
+ // this path is NULL) and the most recent collection has exceeded the
+ // gc overhead limit (although enough may have been collected to
+ // satisfy the allocation). Exit the loop so that an out-of-memory
+ // will be thrown (return a NULL ignoring the contents of
+ // op.result()),
+ // but clear gc_overhead_limit_exceeded so that the next collection
+ // starts with a clean slate (i.e., forgets about previous overhead
+ // excesses). Fill op.result() with a filler object so that the
+ // heap remains parsable.
+ const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded();
+ const bool softrefs_clear = collector_policy()->all_soft_refs_clear();
+ assert(!limit_exceeded || softrefs_clear, "Should have been cleared");
+ if (limit_exceeded && softrefs_clear) {
+ *gc_overhead_limit_was_exceeded = true;
+ size_policy()->set_gc_overhead_limit_exceeded(false);
+ if (PrintGCDetails && Verbose) {
+ gclog_or_tty->print_cr("ParallelScavengeHeap::mem_allocate: "
+ "return NULL because gc_overhead_limit_exceeded is set");
+ }
+ if (op.result() != NULL) {
+ CollectedHeap::fill_with_object(op.result(), size);
+ }
+ return NULL;
}
+
return op.result();
}
}
@@ -613,14 +621,15 @@ HeapWord* ParallelScavengeHeap::permanent_mem_allocate(size_t size) {
// and the most recent collection must have exceeded the
// gc time limit. Exit the loop so that an out-of-memory
// will be thrown (returning a NULL will do that), but
- // clear gc_time_limit_exceeded so that the next collection
+ // clear gc_overhead_limit_exceeded so that the next collection
// will succeeded if the applications decides to handle the
// out-of-memory and tries to go on.
- if (size_policy()->gc_time_limit_exceeded()) {
- size_policy()->set_gc_time_limit_exceeded(false);
+ const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded();
+ if (limit_exceeded) {
+ size_policy()->set_gc_overhead_limit_exceeded(false);
if (PrintGCDetails && Verbose) {
- gclog_or_tty->print_cr("ParallelScavengeHeap::permanent_mem_allocate: "
- "return NULL because gc_time_limit_exceeded is set");
+ gclog_or_tty->print_cr("ParallelScavengeHeap::permanent_mem_allocate:"
+ " return NULL because gc_overhead_limit_exceeded is set");
}
assert(result == NULL, "Allocation did not fail");
return NULL;
@@ -643,14 +652,15 @@ HeapWord* ParallelScavengeHeap::permanent_mem_allocate(size_t size) {
continue; // retry and/or stall as necessary
}
// If a NULL results is being returned, an out-of-memory
- // will be thrown now. Clear the gc_time_limit_exceeded
+ // will be thrown now. Clear the gc_overhead_limit_exceeded
// flag to avoid the following situation.
- // gc_time_limit_exceeded is set during a collection
+ // gc_overhead_limit_exceeded is set during a collection
// the collection fails to return enough space and an OOM is thrown
- // the next GC is skipped because the gc_time_limit_exceeded
- // flag is set and another OOM is thrown
+ // a subsequent GC prematurely throws an out-of-memory because
+ // the gc_overhead_limit_exceeded counts did not start
+ // again from 0.
if (op.result() == NULL) {
- size_policy()->set_gc_time_limit_exceeded(false);
+ size_policy()->reset_gc_overhead_limit_count();
}
return op.result();
}
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
index 46fdcc53348..381a4fab34b 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
class AdjoiningGenerations;
class GCTaskManager;
class PSAdaptiveSizePolicy;
+class GenerationSizer;
+class CollectorPolicy;
class ParallelScavengeHeap : public CollectedHeap {
friend class VMStructs;
@@ -43,6 +45,8 @@ class ParallelScavengeHeap : public CollectedHeap {
size_t _young_gen_alignment;
size_t _old_gen_alignment;
+ GenerationSizer* _collector_policy;
+
inline size_t set_alignment(size_t& var, size_t val);
// Collection of generations that are adjacent in the
@@ -72,6 +76,9 @@ class ParallelScavengeHeap : public CollectedHeap {
return CollectedHeap::ParallelScavengeHeap;
}
+CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
+ // GenerationSizer* collector_policy() const { return _collector_policy; }
+
static PSYoungGen* young_gen() { return _young_gen; }
static PSOldGen* old_gen() { return _old_gen; }
static PSPermGen* perm_gen() { return _perm_gen; }
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp
index 44629831ffe..4061fd8234f 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -184,18 +184,19 @@ void PSAdaptiveSizePolicy::clear_generation_free_space_flags() {
set_change_young_gen_for_maj_pauses(0);
}
-
// If this is not a full GC, only test and modify the young generation.
-void PSAdaptiveSizePolicy::compute_generation_free_space(size_t young_live,
- size_t eden_live,
- size_t old_live,
- size_t perm_live,
- size_t cur_eden,
- size_t max_old_gen_size,
- size_t max_eden_size,
- bool is_full_gc,
- GCCause::Cause gc_cause) {
+void PSAdaptiveSizePolicy::compute_generation_free_space(
+ size_t young_live,
+ size_t eden_live,
+ size_t old_live,
+ size_t perm_live,
+ size_t cur_eden,
+ size_t max_old_gen_size,
+ size_t max_eden_size,
+ bool is_full_gc,
+ GCCause::Cause gc_cause,
+ CollectorPolicy* collector_policy) {
// Update statistics
// Time statistics are updated as we go, update footprint stats here
@@ -380,91 +381,16 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(size_t young_live,
// Is too much time being spent in GC?
// Is the heap trying to grow beyond it's limits?
- const size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average());
+ const size_t free_in_old_gen =
+ (size_t)(max_old_gen_size - avg_old_live()->average());
if (desired_promo_size > free_in_old_gen && desired_eden_size > eden_limit) {
-
- // eden_limit is the upper limit on the size of eden based on
- // the maximum size of the young generation and the sizes
- // of the survivor space.
- // The question being asked is whether the gc costs are high
- // and the space being recovered by a collection is low.
- // free_in_young_gen is the free space in the young generation
- // after a collection and promo_live is the free space in the old
- // generation after a collection.
- //
- // Use the minimum of the current value of the live in the
- // young gen or the average of the live in the young gen.
- // If the current value drops quickly, that should be taken
- // into account (i.e., don't trigger if the amount of free
- // space has suddenly jumped up). If the current is much
- // higher than the average, use the average since it represents
- // the longer term behavor.
- const size_t live_in_eden = MIN2(eden_live, (size_t) avg_eden_live()->average());
- const size_t free_in_eden = eden_limit > live_in_eden ?
- eden_limit - live_in_eden : 0;
- const size_t total_free_limit = free_in_old_gen + free_in_eden;
- const size_t total_mem = max_old_gen_size + max_eden_size;
- const double mem_free_limit = total_mem * (GCHeapFreeLimit/100.0);
- if (PrintAdaptiveSizePolicy && (Verbose ||
- (total_free_limit < (size_t) mem_free_limit))) {
- gclog_or_tty->print_cr(
- "PSAdaptiveSizePolicy::compute_generation_free_space limits:"
- " promo_limit: " SIZE_FORMAT
- " eden_limit: " SIZE_FORMAT
- " total_free_limit: " SIZE_FORMAT
- " max_old_gen_size: " SIZE_FORMAT
- " max_eden_size: " SIZE_FORMAT
- " mem_free_limit: " SIZE_FORMAT,
- promo_limit, eden_limit, total_free_limit,
- max_old_gen_size, max_eden_size,
- (size_t) mem_free_limit);
- }
-
- if (is_full_gc) {
- if (gc_cost() > gc_cost_limit &&
- total_free_limit < (size_t) mem_free_limit) {
- // Collections, on average, are taking too much time, and
- // gc_cost() > gc_cost_limit
- // we have too little space available after a full gc.
- // total_free_limit < mem_free_limit
- // where
- // total_free_limit is the free space available in
- // both generations
- // total_mem is the total space available for allocation
- // in both generations (survivor spaces are not included
- // just as they are not included in eden_limit).
- // mem_free_limit is a fraction of total_mem judged to be an
- // acceptable amount that is still unused.
- // The heap can ask for the value of this variable when deciding
- // whether to thrown an OutOfMemory error.
- // Note that the gc time limit test only works for the collections
- // of the young gen + tenured gen and not for collections of the
- // permanent gen. That is because the calculation of the space
- // freed by the collection is the free space in the young gen +
- // tenured gen.
- // Ignore explicit GC's. Ignoring explicit GC's at this level
- // is the equivalent of the GC did not happen as far as the
- // overhead calculation is concerted (i.e., the flag is not set
- // and the count is not affected). Also the average will not
- // have been updated unless UseAdaptiveSizePolicyWithSystemGC is on.
- if (!GCCause::is_user_requested_gc(gc_cause) &&
- !GCCause::is_serviceability_requested_gc(gc_cause)) {
- inc_gc_time_limit_count();
- if (UseGCOverheadLimit &&
- (gc_time_limit_count() > AdaptiveSizePolicyGCTimeLimitThreshold)){
- // All conditions have been met for throwing an out-of-memory
- _gc_time_limit_exceeded = true;
- // Avoid consecutive OOM due to the gc time limit by resetting
- // the counter.
- reset_gc_time_limit_count();
- }
- _print_gc_time_limit_would_be_exceeded = true;
- }
- } else {
- // Did not exceed overhead limits
- reset_gc_time_limit_count();
- }
- }
+ check_gc_overhead_limit(young_live,
+ eden_live,
+ max_old_gen_size,
+ max_eden_size,
+ is_full_gc,
+ gc_cause,
+ collector_policy);
}
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp
index d6e002e3d9e..b2ab7474da1 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
// Forward decls
class elapsedTimer;
+class GenerationSizer;
class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
friend class PSGCAdaptivePolicyCounters;
@@ -340,7 +341,8 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
size_t max_old_gen_size,
size_t max_eden_size,
bool is_full_gc,
- GCCause::Cause gc_cause);
+ GCCause::Cause gc_cause,
+ CollectorPolicy* collector_policy);
// Calculates new survivor space size; returns a new tenuring threshold
// value. Stores new survivor size in _survivor_size.
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.cpp
index 26345dbc924..c887379333d 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -117,11 +117,13 @@ PSGCAdaptivePolicyCounters::PSGCAdaptivePolicyCounters(const char* name_arg,
PerfData::U_Bytes, (jlong) ps_size_policy()->avg_base_footprint()->average(), CHECK);
cname = PerfDataManager::counter_name(name_space(), "gcTimeLimitExceeded");
- _gc_time_limit_exceeded = PerfDataManager::create_variable(SUN_GC, cname,
- PerfData::U_Events, ps_size_policy()->gc_time_limit_exceeded(), CHECK);
+ _gc_overhead_limit_exceeded_counter =
+ PerfDataManager::create_variable(SUN_GC, cname,
+ PerfData::U_Events, ps_size_policy()->gc_overhead_limit_exceeded(), CHECK);
cname = PerfDataManager::counter_name(name_space(), "liveAtLastFullGc");
- _live_at_last_full_gc = PerfDataManager::create_variable(SUN_GC, cname,
+ _live_at_last_full_gc_counter =
+ PerfDataManager::create_variable(SUN_GC, cname,
PerfData::U_Bytes, ps_size_policy()->live_at_last_full_gc(), CHECK);
cname = PerfDataManager::counter_name(name_space(), "majorPauseOldSlope");
@@ -189,6 +191,8 @@ void PSGCAdaptivePolicyCounters::update_counters_from_policy() {
update_minor_pause_old_slope();
update_major_pause_young_slope();
update_minor_collection_slope_counter();
+ update_gc_overhead_limit_exceeded_counter();
+ update_live_at_last_full_gc_counter();
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp
index 60b89a51c08..a7270371ab4 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,8 +44,8 @@ class PSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {
PerfVariable* _live_space;
PerfVariable* _free_space;
PerfVariable* _avg_base_footprint;
- PerfVariable* _gc_time_limit_exceeded;
- PerfVariable* _live_at_last_full_gc;
+ PerfVariable* _gc_overhead_limit_exceeded_counter;
+ PerfVariable* _live_at_last_full_gc_counter;
PerfVariable* _old_capacity;
PerfVariable* _boundary_moved;
@@ -169,6 +169,14 @@ class PSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {
(jlong)(ps_size_policy()->major_pause_young_slope() * 1000)
);
}
+ inline void update_gc_overhead_limit_exceeded_counter() {
+ _gc_overhead_limit_exceeded_counter->set_value(
+ (jlong) ps_size_policy()->gc_overhead_limit_exceeded());
+ }
+ inline void update_live_at_last_full_gc_counter() {
+ _live_at_last_full_gc_counter->set_value(
+ (jlong)(ps_size_policy()->live_at_last_full_gc()));
+ }
inline void update_scavenge_skipped(int cause) {
_scavenge_skipped->set_value(cause);
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
index fcf6eb6ed90..88774e525ed 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,12 @@ void PSMarkSweep::initialize() {
//
// Note that this method should only be called from the vm_thread while
// at a safepoint!
+//
+// Note that the all_soft_refs_clear flag in the collector policy
+// may be true because this method can be called without intervening
+// activity. For example when the heap space is tight and full measure
+// are being taken to free space.
+
void PSMarkSweep::invoke(bool maximum_heap_compaction) {
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
@@ -54,24 +60,18 @@ void PSMarkSweep::invoke(bool maximum_heap_compaction) {
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
GCCause::Cause gc_cause = heap->gc_cause();
PSAdaptiveSizePolicy* policy = heap->size_policy();
+ IsGCActiveMark mark;
- // Before each allocation/collection attempt, find out from the
- // policy object if GCs are, on the whole, taking too long. If so,
- // bail out without attempting a collection. The exceptions are
- // for explicitly requested GC's.
- if (!policy->gc_time_limit_exceeded() ||
- GCCause::is_user_requested_gc(gc_cause) ||
- GCCause::is_serviceability_requested_gc(gc_cause)) {
- IsGCActiveMark mark;
-
- if (ScavengeBeforeFullGC) {
- PSScavenge::invoke_no_policy();
- }
-
- int count = (maximum_heap_compaction)?1:MarkSweepAlwaysCompactCount;
- IntFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);
- PSMarkSweep::invoke_no_policy(maximum_heap_compaction);
+ if (ScavengeBeforeFullGC) {
+ PSScavenge::invoke_no_policy();
}
+
+ const bool clear_all_soft_refs =
+ heap->collector_policy()->should_clear_all_soft_refs();
+
+ int count = (maximum_heap_compaction)?1:MarkSweepAlwaysCompactCount;
+ IntFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);
+ PSMarkSweep::invoke_no_policy(clear_all_soft_refs || maximum_heap_compaction);
}
// This method contains no policy. You should probably
@@ -89,6 +89,10 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
PSAdaptiveSizePolicy* size_policy = heap->size_policy();
+ // The scope of casr should end after code that can change
+ // CollectorPolicy::_should_clear_all_soft_refs.
+ ClearedAllSoftRefs casr(clear_all_softrefs, heap->collector_policy());
+
PSYoungGen* young_gen = heap->young_gen();
PSOldGen* old_gen = heap->old_gen();
PSPermGen* perm_gen = heap->perm_gen();
@@ -275,7 +279,8 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
old_gen->max_gen_size(),
max_eden_size,
true /* full gc*/,
- gc_cause);
+ gc_cause,
+ heap->collector_policy());
heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes());
@@ -326,19 +331,6 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
// Track memory usage and detect low memory
MemoryService::track_memory_usage();
heap->update_counters();
-
- if (PrintGCDetails) {
- if (size_policy->print_gc_time_limit_would_be_exceeded()) {
- if (size_policy->gc_time_limit_exceeded()) {
- gclog_or_tty->print_cr(" GC time is exceeding GCTimeLimit "
- "of %d%%", GCTimeLimit);
- } else {
- gclog_or_tty->print_cr(" GC time would exceed GCTimeLimit "
- "of %d%%", GCTimeLimit);
- }
- }
- size_policy->set_print_gc_time_limit_would_be_exceeded(false);
- }
}
if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
index e7a973deb23..d3eba4d3bb4 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1923,31 +1923,32 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm,
//
// Note that this method should only be called from the vm_thread while at a
// safepoint.
+//
+// Note that the all_soft_refs_clear flag in the collector policy
+// may be true because this method can be called without intervening
+// activity. For example when the heap space is tight and full measure
+// are being taken to free space.
void PSParallelCompact::invoke(bool maximum_heap_compaction) {
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == (Thread*)VMThread::vm_thread(),
"should be in vm thread");
+
ParallelScavengeHeap* heap = gc_heap();
GCCause::Cause gc_cause = heap->gc_cause();
assert(!heap->is_gc_active(), "not reentrant");
PSAdaptiveSizePolicy* policy = heap->size_policy();
+ IsGCActiveMark mark;
- // Before each allocation/collection attempt, find out from the
- // policy object if GCs are, on the whole, taking too long. If so,
- // bail out without attempting a collection. The exceptions are
- // for explicitly requested GC's.
- if (!policy->gc_time_limit_exceeded() ||
- GCCause::is_user_requested_gc(gc_cause) ||
- GCCause::is_serviceability_requested_gc(gc_cause)) {
- IsGCActiveMark mark;
-
- if (ScavengeBeforeFullGC) {
- PSScavenge::invoke_no_policy();
- }
-
- PSParallelCompact::invoke_no_policy(maximum_heap_compaction);
+ if (ScavengeBeforeFullGC) {
+ PSScavenge::invoke_no_policy();
}
+
+ const bool clear_all_soft_refs =
+ heap->collector_policy()->should_clear_all_soft_refs();
+
+ PSParallelCompact::invoke_no_policy(clear_all_soft_refs ||
+ maximum_heap_compaction);
}
bool ParallelCompactData::region_contains(size_t region_index, HeapWord* addr) {
@@ -1976,6 +1977,11 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
PSPermGen* perm_gen = heap->perm_gen();
PSAdaptiveSizePolicy* size_policy = heap->size_policy();
+ // The scope of casr should end after code that can change
+ // CollectorPolicy::_should_clear_all_soft_refs.
+ ClearedAllSoftRefs casr(maximum_heap_compaction,
+ heap->collector_policy());
+
if (ZapUnusedHeapArea) {
// Save information needed to minimize mangling
heap->record_gen_tops_before_GC();
@@ -2109,7 +2115,8 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
old_gen->max_gen_size(),
max_eden_size,
true /* full gc*/,
- gc_cause);
+ gc_cause,
+ heap->collector_policy());
heap->resize_old_gen(
size_policy->calculated_old_free_size_in_bytes());
@@ -2157,19 +2164,6 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
// Track memory usage and detect low memory
MemoryService::track_memory_usage();
heap->update_counters();
-
- if (PrintGCDetails) {
- if (size_policy->print_gc_time_limit_would_be_exceeded()) {
- if (size_policy->gc_time_limit_exceeded()) {
- gclog_or_tty->print_cr(" GC time is exceeding GCTimeLimit "
- "of %d%%", GCTimeLimit);
- } else {
- gclog_or_tty->print_cr(" GC time would exceed GCTimeLimit "
- "of %d%%", GCTimeLimit);
- }
- }
- size_policy->set_print_gc_time_limit_would_be_exceeded(false);
- }
}
if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
index e25ef657358..5240da0a029 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -187,8 +187,7 @@ void PSRefProcTaskExecutor::execute(EnqueueTask& task)
//
// Note that this method should only be called from the vm_thread while
// at a safepoint!
-void PSScavenge::invoke()
-{
+void PSScavenge::invoke() {
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
assert(!Universe::heap()->is_gc_active(), "not reentrant");
@@ -197,29 +196,25 @@ void PSScavenge::invoke()
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
PSAdaptiveSizePolicy* policy = heap->size_policy();
+ IsGCActiveMark mark;
- // Before each allocation/collection attempt, find out from the
- // policy object if GCs are, on the whole, taking too long. If so,
- // bail out without attempting a collection.
- if (!policy->gc_time_limit_exceeded()) {
- IsGCActiveMark mark;
+ bool scavenge_was_done = PSScavenge::invoke_no_policy();
- bool scavenge_was_done = PSScavenge::invoke_no_policy();
-
- PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
+ PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
+ if (UsePerfData)
+ counters->update_full_follows_scavenge(0);
+ if (!scavenge_was_done ||
+ policy->should_full_GC(heap->old_gen()->free_in_bytes())) {
if (UsePerfData)
- counters->update_full_follows_scavenge(0);
- if (!scavenge_was_done ||
- policy->should_full_GC(heap->old_gen()->free_in_bytes())) {
- if (UsePerfData)
- counters->update_full_follows_scavenge(full_follows_scavenge);
+ counters->update_full_follows_scavenge(full_follows_scavenge);
+ GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy);
+ CollectorPolicy* cp = heap->collector_policy();
+ const bool clear_all_softrefs = cp->should_clear_all_soft_refs();
- GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy);
- if (UseParallelOldGC) {
- PSParallelCompact::invoke_no_policy(false);
- } else {
- PSMarkSweep::invoke_no_policy(false);
- }
+ if (UseParallelOldGC) {
+ PSParallelCompact::invoke_no_policy(clear_all_softrefs);
+ } else {
+ PSMarkSweep::invoke_no_policy(clear_all_softrefs);
}
}
}
@@ -447,6 +442,9 @@ bool PSScavenge::invoke_no_policy() {
size_t promoted = old_gen->used_in_bytes() - old_gen_used_before;
size_policy->update_averages(_survivor_overflow, survived, promoted);
+ // A successful scavenge should restart the GC time limit count which is
+ // for full GC's.
+ size_policy->reset_gc_overhead_limit_count();
if (UseAdaptiveSizePolicy) {
// Calculate the new survivor size and tenuring threshold
@@ -523,7 +521,8 @@ bool PSScavenge::invoke_no_policy() {
old_gen->max_gen_size(),
max_eden_size,
false /* full gc*/,
- gc_cause);
+ gc_cause,
+ heap->collector_policy());
}
// Resize the young generation at every collection
diff --git a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp
index acaa33818a4..f88d5bb02b4 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2004-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,13 +44,15 @@ AdaptiveSizePolicy::AdaptiveSizePolicy(size_t init_eden_size,
_survivor_size(init_survivor_size),
_gc_pause_goal_sec(gc_pause_goal_sec),
_throughput_goal(1.0 - double(1.0 / (1.0 + (double) gc_cost_ratio))),
- _gc_time_limit_exceeded(false),
- _print_gc_time_limit_would_be_exceeded(false),
- _gc_time_limit_count(0),
+ _gc_overhead_limit_exceeded(false),
+ _print_gc_overhead_limit_would_be_exceeded(false),
+ _gc_overhead_limit_count(0),
_latest_minor_mutator_interval_seconds(0),
_threshold_tolerance_percent(1.0 + ThresholdTolerance/100.0),
_young_gen_change_for_minor_throughput(0),
_old_gen_change_for_major_throughput(0) {
+ assert(AdaptiveSizePolicyGCTimeLimitThreshold > 0,
+ "No opportunity to clear SoftReferences before GC overhead limit");
_avg_minor_pause =
new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding);
_avg_minor_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
@@ -278,6 +280,147 @@ void AdaptiveSizePolicy::clear_generation_free_space_flags() {
set_decide_at_full_gc(0);
}
+void AdaptiveSizePolicy::check_gc_overhead_limit(
+ size_t young_live,
+ size_t eden_live,
+ size_t max_old_gen_size,
+ size_t max_eden_size,
+ bool is_full_gc,
+ GCCause::Cause gc_cause,
+ CollectorPolicy* collector_policy) {
+
+ // Ignore explicit GC's. Exiting here does not set the flag and
+ // does not reset the count. Updating of the averages for system
+ // GC's is still controlled by UseAdaptiveSizePolicyWithSystemGC.
+ if (GCCause::is_user_requested_gc(gc_cause) ||
+ GCCause::is_serviceability_requested_gc(gc_cause)) {
+ return;
+ }
+ // eden_limit is the upper limit on the size of eden based on
+ // the maximum size of the young generation and the sizes
+ // of the survivor space.
+ // The question being asked is whether the gc costs are high
+ // and the space being recovered by a collection is low.
+ // free_in_young_gen is the free space in the young generation
+ // after a collection and promo_live is the free space in the old
+ // generation after a collection.
+ //
+ // Use the minimum of the current value of the live in the
+ // young gen or the average of the live in the young gen.
+ // If the current value drops quickly, that should be taken
+ // into account (i.e., don't trigger if the amount of free
+ // space has suddenly jumped up). If the current is much
+ // higher than the average, use the average since it represents
+ // the longer term behavor.
+ const size_t live_in_eden =
+ MIN2(eden_live, (size_t) avg_eden_live()->average());
+ const size_t free_in_eden = max_eden_size > live_in_eden ?
+ max_eden_size - live_in_eden : 0;
+ const size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average());
+ const size_t total_free_limit = free_in_old_gen + free_in_eden;
+ const size_t total_mem = max_old_gen_size + max_eden_size;
+ const double mem_free_limit = total_mem * (GCHeapFreeLimit/100.0);
+ const double mem_free_old_limit = max_old_gen_size * (GCHeapFreeLimit/100.0);
+ const double mem_free_eden_limit = max_eden_size * (GCHeapFreeLimit/100.0);
+ const double gc_cost_limit = GCTimeLimit/100.0;
+ size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average());
+ // But don't force a promo size below the current promo size. Otherwise,
+ // the promo size will shrink for no good reason.
+ promo_limit = MAX2(promo_limit, _promo_size);
+
+
+ if (PrintAdaptiveSizePolicy && (Verbose ||
+ (free_in_old_gen < (size_t) mem_free_old_limit &&
+ free_in_eden < (size_t) mem_free_eden_limit))) {
+ gclog_or_tty->print_cr(
+ "PSAdaptiveSizePolicy::compute_generation_free_space limits:"
+ " promo_limit: " SIZE_FORMAT
+ " max_eden_size: " SIZE_FORMAT
+ " total_free_limit: " SIZE_FORMAT
+ " max_old_gen_size: " SIZE_FORMAT
+ " max_eden_size: " SIZE_FORMAT
+ " mem_free_limit: " SIZE_FORMAT,
+ promo_limit, max_eden_size, total_free_limit,
+ max_old_gen_size, max_eden_size,
+ (size_t) mem_free_limit);
+ }
+
+ bool print_gc_overhead_limit_would_be_exceeded = false;
+ if (is_full_gc) {
+ if (gc_cost() > gc_cost_limit &&
+ free_in_old_gen < (size_t) mem_free_old_limit &&
+ free_in_eden < (size_t) mem_free_eden_limit) {
+ // Collections, on average, are taking too much time, and
+ // gc_cost() > gc_cost_limit
+ // we have too little space available after a full gc.
+ // total_free_limit < mem_free_limit
+ // where
+ // total_free_limit is the free space available in
+ // both generations
+ // total_mem is the total space available for allocation
+ // in both generations (survivor spaces are not included
+ // just as they are not included in eden_limit).
+ // mem_free_limit is a fraction of total_mem judged to be an
+ // acceptable amount that is still unused.
+ // The heap can ask for the value of this variable when deciding
+ // whether to thrown an OutOfMemory error.
+ // Note that the gc time limit test only works for the collections
+ // of the young gen + tenured gen and not for collections of the
+ // permanent gen. That is because the calculation of the space
+ // freed by the collection is the free space in the young gen +
+ // tenured gen.
+ // At this point the GC overhead limit is being exceeded.
+ inc_gc_overhead_limit_count();
+ if (UseGCOverheadLimit) {
+ if (gc_overhead_limit_count() >=
+ AdaptiveSizePolicyGCTimeLimitThreshold){
+ // All conditions have been met for throwing an out-of-memory
+ set_gc_overhead_limit_exceeded(true);
+ // Avoid consecutive OOM due to the gc time limit by resetting
+ // the counter.
+ reset_gc_overhead_limit_count();
+ } else {
+ // The required consecutive collections which exceed the
+ // GC time limit may or may not have been reached. We
+ // are approaching that condition and so as not to
+ // throw an out-of-memory before all SoftRef's have been
+ // cleared, set _should_clear_all_soft_refs in CollectorPolicy.
+ // The clearing will be done on the next GC.
+ bool near_limit = gc_overhead_limit_near();
+ if (near_limit) {
+ collector_policy->set_should_clear_all_soft_refs(true);
+ if (PrintGCDetails && Verbose) {
+ gclog_or_tty->print_cr(" Nearing GC overhead limit, "
+ "will be clearing all SoftReference");
+ }
+ }
+ }
+ }
+ // Set this even when the overhead limit will not
+ // cause an out-of-memory. Diagnostic message indicating
+ // that the overhead limit is being exceeded is sometimes
+ // printed.
+ print_gc_overhead_limit_would_be_exceeded = true;
+
+ } else {
+ // Did not exceed overhead limits
+ reset_gc_overhead_limit_count();
+ }
+ }
+
+ if (UseGCOverheadLimit && PrintGCDetails && Verbose) {
+ if (gc_overhead_limit_exceeded()) {
+ gclog_or_tty->print_cr(" GC is exceeding overhead limit "
+ "of %d%%", GCTimeLimit);
+ reset_gc_overhead_limit_count();
+ } else if (print_gc_overhead_limit_would_be_exceeded) {
+ assert(gc_overhead_limit_count() > 0, "Should not be printing");
+ gclog_or_tty->print_cr(" GC would exceed overhead limit "
+ "of %d%% %d consecutive time(s)",
+ GCTimeLimit, gc_overhead_limit_count());
+ }
+ }
+}
// Printing
bool AdaptiveSizePolicy::print_adaptive_size_policy_on(outputStream* st) const {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp
index d07dcf1a388..933d95c2437 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2004-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
// Forward decls
class elapsedTimer;
+class CollectorPolicy;
class AdaptiveSizePolicy : public CHeapObj {
friend class GCAdaptivePolicyCounters;
@@ -75,13 +76,16 @@ class AdaptiveSizePolicy : public CHeapObj {
// This is a hint for the heap: we've detected that gc times
// are taking longer than GCTimeLimit allows.
- bool _gc_time_limit_exceeded;
- // Use for diagnostics only. If UseGCTimeLimit is false,
+ bool _gc_overhead_limit_exceeded;
+ // Use for diagnostics only. If UseGCOverheadLimit is false,
// this variable is still set.
- bool _print_gc_time_limit_would_be_exceeded;
+ bool _print_gc_overhead_limit_would_be_exceeded;
// Count of consecutive GC that have exceeded the
// GC time limit criterion.
- uint _gc_time_limit_count;
+ uint _gc_overhead_limit_count;
+ // This flag signals that GCTimeLimit is being exceeded
+ // but may not have done so for the required number of consequetive
+ // collections.
// Minor collection timers used to determine both
// pause and interval times for collections.
@@ -406,22 +410,21 @@ class AdaptiveSizePolicy : public CHeapObj {
// Most heaps will choose to throw an OutOfMemoryError when
// this occurs but it is up to the heap to request this information
// of the policy
- bool gc_time_limit_exceeded() {
- return _gc_time_limit_exceeded;
+ bool gc_overhead_limit_exceeded() {
+ return _gc_overhead_limit_exceeded;
}
- void set_gc_time_limit_exceeded(bool v) {
- _gc_time_limit_exceeded = v;
- }
- bool print_gc_time_limit_would_be_exceeded() {
- return _print_gc_time_limit_would_be_exceeded;
- }
- void set_print_gc_time_limit_would_be_exceeded(bool v) {
- _print_gc_time_limit_would_be_exceeded = v;
+ void set_gc_overhead_limit_exceeded(bool v) {
+ _gc_overhead_limit_exceeded = v;
}
- uint gc_time_limit_count() { return _gc_time_limit_count; }
- void reset_gc_time_limit_count() { _gc_time_limit_count = 0; }
- void inc_gc_time_limit_count() { _gc_time_limit_count++; }
+ // Tests conditions indicate the GC overhead limit is being approached.
+ bool gc_overhead_limit_near() {
+ return gc_overhead_limit_count() >=
+ (AdaptiveSizePolicyGCTimeLimitThreshold - 1);
+ }
+ uint gc_overhead_limit_count() { return _gc_overhead_limit_count; }
+ void reset_gc_overhead_limit_count() { _gc_overhead_limit_count = 0; }
+ void inc_gc_overhead_limit_count() { _gc_overhead_limit_count++; }
// accessors for flags recording the decisions to resize the
// generations to meet the pause goal.
@@ -436,6 +439,16 @@ class AdaptiveSizePolicy : public CHeapObj {
int decide_at_full_gc() { return _decide_at_full_gc; }
void set_decide_at_full_gc(int v) { _decide_at_full_gc = v; }
+ // Check the conditions for an out-of-memory due to excessive GC time.
+ // Set _gc_overhead_limit_exceeded if all the conditions have been met.
+ void check_gc_overhead_limit(size_t young_live,
+ size_t eden_live,
+ size_t max_old_gen_size,
+ size_t max_eden_size,
+ bool is_full_gc,
+ GCCause::Cause gc_cause,
+ CollectorPolicy* collector_policy);
+
// Printing support
virtual bool print_adaptive_size_policy_on(outputStream* st) const;
bool print_adaptive_size_policy_on(outputStream* st, int
diff --git a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.hpp b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.hpp
index 6ff704fdf18..4aa5c633ae7 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -89,8 +89,19 @@ class VM_GC_Operation: public VM_Operation {
if (full) {
_full_gc_count_before = full_gc_count_before;
}
+ // In ParallelScavengeHeap::mem_allocate() collections can be
+ // executed within a loop and _all_soft_refs_clear can be set
+ // true after they have been cleared by a collection and another
+ // collection started so that _all_soft_refs_clear can be true
+ // when this collection is started. Don't assert that
+ // _all_soft_refs_clear have to be false here even though
+ // mutators have run. Soft refs will be cleared again in this
+ // collection.
+ }
+ ~VM_GC_Operation() {
+ CollectedHeap* ch = Universe::heap();
+ ch->collector_policy()->set_all_soft_refs_clear(false);
}
- ~VM_GC_Operation() {}
// Acquire the reference synchronization lock
virtual bool doit_prologue();
diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
index 2bc210a4717..5bebe7e93a7 100644
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ class BarrierSet;
class ThreadClosure;
class AdaptiveSizePolicy;
class Thread;
+class CollectorPolicy;
//
// CollectedHeap
@@ -506,6 +507,9 @@ class CollectedHeap : public CHeapObj {
// Return the AdaptiveSizePolicy for the heap.
virtual AdaptiveSizePolicy* size_policy() = 0;
+ // Return the CollectorPolicy for the heap
+ virtual CollectorPolicy* collector_policy() const = 0;
+
// Iterate over all the ref-containing fields of all objects, calling
// "cl.do_oop" on each. This includes objects in permanent memory.
virtual void oop_iterate(OopClosure* cl) = 0;
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp
index ebb886fbad8..b903ab29843 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,11 @@ void CollectorPolicy::initialize_perm_generation(PermGen::Name pgnm) {
}
}
+bool CollectorPolicy::use_should_clear_all_soft_refs(bool v) {
+ bool result = _should_clear_all_soft_refs;
+ set_should_clear_all_soft_refs(false);
+ return result;
+}
GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap,
int max_covered_regions) {
@@ -126,6 +131,17 @@ GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap,
}
}
+void CollectorPolicy::cleared_all_soft_refs() {
+ // If near gc overhear limit, continue to clear SoftRefs. SoftRefs may
+ // have been cleared in the last collection but if the gc overhear
+ // limit continues to be near, SoftRefs should still be cleared.
+ if (size_policy() != NULL) {
+ _should_clear_all_soft_refs = size_policy()->gc_overhead_limit_near();
+ }
+ _all_soft_refs_clear = true;
+}
+
+
// GenCollectorPolicy methods.
size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) {
@@ -489,6 +505,12 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
debug_only(gch->check_for_valid_allocation_state());
assert(gch->no_gc_in_progress(), "Allocation during gc not allowed");
+
+ // In general gc_overhead_limit_was_exceeded should be false so
+ // set it so here and reset it to true only if the gc time
+ // limit is being exceeded as checked below.
+ *gc_overhead_limit_was_exceeded = false;
+
HeapWord* result = NULL;
// Loop until the allocation is satisified,
@@ -524,12 +546,6 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
return result;
}
- // There are NULL's returned for different circumstances below.
- // In general gc_overhead_limit_was_exceeded should be false so
- // set it so here and reset it to true only if the gc time
- // limit is being exceeded as checked below.
- *gc_overhead_limit_was_exceeded = false;
-
if (GC_locker::is_active_and_needs_gc()) {
if (is_tlab) {
return NULL; // Caller will retry allocating individual object
@@ -568,18 +584,6 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
gc_count_before = Universe::heap()->total_collections();
}
- // Allocation has failed and a collection is about
- // to be done. If the gc time limit was exceeded the
- // last time a collection was done, return NULL so
- // that an out-of-memory will be thrown. Clear
- // gc_time_limit_exceeded so that subsequent attempts
- // at a collection will be made.
- if (size_policy()->gc_time_limit_exceeded()) {
- *gc_overhead_limit_was_exceeded = true;
- size_policy()->set_gc_time_limit_exceeded(false);
- return NULL;
- }
-
VM_GenCollectForAllocation op(size,
is_tlab,
gc_count_before);
@@ -590,6 +594,24 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
assert(result == NULL, "must be NULL if gc_locked() is true");
continue; // retry and/or stall as necessary
}
+
+ // Allocation has failed and a collection
+ // has been done. If the gc time limit was exceeded the
+ // this time, return NULL so that an out-of-memory
+ // will be thrown. Clear gc_overhead_limit_exceeded
+ // so that the overhead exceeded does not persist.
+
+ const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded();
+ const bool softrefs_clear = all_soft_refs_clear();
+ assert(!limit_exceeded || softrefs_clear, "Should have been cleared");
+ if (limit_exceeded && softrefs_clear) {
+ *gc_overhead_limit_was_exceeded = true;
+ size_policy()->set_gc_overhead_limit_exceeded(false);
+ if (op.result() != NULL) {
+ CollectedHeap::fill_with_object(op.result(), size);
+ }
+ return NULL;
+ }
assert(result == NULL || gch->is_in_reserved(result),
"result not in heap");
return result;
@@ -688,6 +710,9 @@ HeapWord* GenCollectorPolicy::satisfy_failed_allocation(size_t size,
return result;
}
+ assert(!should_clear_all_soft_refs(),
+ "Flag should have been handled and cleared prior to this point");
+
// What else? We might try synchronous finalization later. If the total
// space available is large enough for the allocation, then a more
// complete compaction phase than we've tried so far might be
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp
index 2bc7d45524d..96d32840179 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,12 +69,28 @@ class CollectorPolicy : public CHeapObj {
size_t _min_alignment;
size_t _max_alignment;
+ // The sizing of the heap are controlled by a sizing policy.
+ AdaptiveSizePolicy* _size_policy;
+
+ // Set to true when policy wants soft refs cleared.
+ // Reset to false by gc after it clears all soft refs.
+ bool _should_clear_all_soft_refs;
+ // Set to true by the GC if the just-completed gc cleared all
+ // softrefs. This is set to true whenever a gc clears all softrefs, and
+ // set to false each time gc returns to the mutator. For example, in the
+ // ParallelScavengeHeap case the latter would be done toward the end of
+ // mem_allocate() where it returns op.result()
+ bool _all_soft_refs_clear;
+
CollectorPolicy() :
_min_alignment(1),
_max_alignment(1),
_initial_heap_byte_size(0),
_max_heap_byte_size(0),
- _min_heap_byte_size(0)
+ _min_heap_byte_size(0),
+ _size_policy(NULL),
+ _should_clear_all_soft_refs(false),
+ _all_soft_refs_clear(false)
{}
public:
@@ -98,6 +114,19 @@ class CollectorPolicy : public CHeapObj {
G1CollectorPolicyKind
};
+ AdaptiveSizePolicy* size_policy() { return _size_policy; }
+ bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
+ void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
+ // Returns the current value of _should_clear_all_soft_refs.
+ // _should_clear_all_soft_refs is set to false as a side effect.
+ bool use_should_clear_all_soft_refs(bool v);
+ bool all_soft_refs_clear() { return _all_soft_refs_clear; }
+ void set_all_soft_refs_clear(bool v) { _all_soft_refs_clear = v; }
+
+ // Called by the GC after Soft Refs have been cleared to indicate
+ // that the request in _should_clear_all_soft_refs has been fulfilled.
+ void cleared_all_soft_refs();
+
// Identification methods.
virtual GenCollectorPolicy* as_generation_policy() { return NULL; }
virtual TwoGenerationCollectorPolicy* as_two_generation_policy() { return NULL; }
@@ -165,6 +194,22 @@ class CollectorPolicy : public CHeapObj {
};
+class ClearedAllSoftRefs : public StackObj {
+ bool _clear_all_soft_refs;
+ CollectorPolicy* _collector_policy;
+ public:
+ ClearedAllSoftRefs(bool clear_all_soft_refs,
+ CollectorPolicy* collector_policy) :
+ _clear_all_soft_refs(clear_all_soft_refs),
+ _collector_policy(collector_policy) {}
+
+ ~ClearedAllSoftRefs() {
+ if (_clear_all_soft_refs) {
+ _collector_policy->cleared_all_soft_refs();
+ }
+ }
+};
+
class GenCollectorPolicy : public CollectorPolicy {
protected:
size_t _min_gen0_size;
@@ -173,10 +218,6 @@ class GenCollectorPolicy : public CollectorPolicy {
GenerationSpec **_generations;
- // The sizing of the different generations in the heap are controlled
- // by a sizing policy.
- AdaptiveSizePolicy* _size_policy;
-
// Return true if an allocation should be attempted in the older
// generation if it fails in the younger generation. Return
// false, otherwise.
@@ -236,14 +277,11 @@ class GenCollectorPolicy : public CollectorPolicy {
virtual size_t large_typearray_limit();
// Adaptive size policy
- AdaptiveSizePolicy* size_policy() { return _size_policy; }
virtual void initialize_size_policy(size_t init_eden_size,
size_t init_promo_size,
size_t init_survivor_size);
-
};
-
// All of hotspot's current collectors are subtypes of this
// class. Currently, these collectors all use the same gen[0],
// but have different gen[1] types. If we add another subtype
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp
index 875cf00817b..be3b75352cf 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -594,6 +594,10 @@ void DefNewGeneration::collect(bool full,
_tenuring_threshold =
age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
+ // A successful scavenge should restart the GC time limit count which is
+ // for full GC's.
+ AdaptiveSizePolicy* size_policy = gch->gen_policy()->size_policy();
+ size_policy->reset_gc_overhead_limit_count();
if (PrintGC && !PrintGCDetails) {
gch->print_heap_change(gch_prev_used);
}
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index f85fe142156..a0549f27c71 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -428,7 +428,8 @@ void GenCollectedHeap::do_collection(bool full,
assert(my_thread->is_VM_thread() ||
my_thread->is_ConcurrentGC_thread(),
"incorrect thread type capability");
- assert(Heap_lock->is_locked(), "the requesting thread should have the Heap_lock");
+ assert(Heap_lock->is_locked(),
+ "the requesting thread should have the Heap_lock");
guarantee(!is_gc_active(), "collection is not reentrant");
assert(max_level < n_gens(), "sanity check");
@@ -436,6 +437,11 @@ void GenCollectedHeap::do_collection(bool full,
return; // GC is disabled (e.g. JNI GetXXXCritical operation)
}
+ const bool do_clear_all_soft_refs = clear_all_soft_refs ||
+ collector_policy()->should_clear_all_soft_refs();
+
+ ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
+
const size_t perm_prev_used = perm_gen()->used();
if (PrintHeapAtGC) {
@@ -560,11 +566,11 @@ void GenCollectedHeap::do_collection(bool full,
if (rp->discovery_is_atomic()) {
rp->verify_no_references_recorded();
rp->enable_discovery();
- rp->setup_policy(clear_all_soft_refs);
+ rp->setup_policy(do_clear_all_soft_refs);
} else {
// collect() below will enable discovery as appropriate
}
- _gens[i]->collect(full, clear_all_soft_refs, size, is_tlab);
+ _gens[i]->collect(full, do_clear_all_soft_refs, size, is_tlab);
if (!rp->enqueuing_is_done()) {
rp->enqueue_discovered_references();
} else {
diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp
index 290141c4ff7..88c2ca0e636 100644
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,13 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
bool clear_all_softrefs) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
+ GenCollectedHeap* gch = GenCollectedHeap::heap();
+#ifdef ASSERT
+ if (gch->collector_policy()->should_clear_all_soft_refs()) {
+ assert(clear_all_softrefs, "Policy should have been checked earlier");
+ }
+#endif
+
// hook up weak ref data so it can be used during Mark-Sweep
assert(ref_processor() == NULL, "no stomping");
assert(rp != NULL, "should be non-NULL");
@@ -44,7 +51,6 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
// Increment the invocation count for the permanent generation, since it is
// implicitly collected whenever we do a full mark sweep collection.
- GenCollectedHeap* gch = GenCollectedHeap::heap();
gch->perm_gen()->stat_record()->invocations++;
// Capture heap size before collection for printing.
From 9b4fc8fc235e11a577c6ac7578ab6cfe5251014f Mon Sep 17 00:00:00 2001
From: Antonios Printezis
Date: Tue, 30 Mar 2010 15:43:03 -0400
Subject: [PATCH 072/190] 6937142: G1: improvements to debugging output (S-M)
Various fixes to the G1 debugging output.
Reviewed-by: johnc, iveresov
---
.../gc_implementation/g1/concurrentMark.cpp | 138 +++++++++---------
.../gc_implementation/g1/concurrentMark.hpp | 23 ++-
.../gc_implementation/g1/g1CollectedHeap.cpp | 9 +-
.../g1/g1CollectorPolicy.cpp | 9 +-
.../vm/gc_implementation/g1/heapRegion.cpp | 42 ++++--
5 files changed, 133 insertions(+), 88 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index fd7595d3525..d26f47c248f 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -767,7 +767,8 @@ void ConcurrentMark::checkpointRootsInitialPre() {
_has_aborted = false;
if (G1PrintReachableAtInitialMark) {
- print_reachable(true, "before");
+ print_reachable("at-cycle-start",
+ true /* use_prev_marking */, true /* all */);
}
// Initialise marking structures. This has to be done in a STW phase.
@@ -1979,19 +1980,21 @@ void ConcurrentMark::checkpointRootsFinalWork() {
#ifndef PRODUCT
-class ReachablePrinterOopClosure: public OopClosure {
+class PrintReachableOopClosure: public OopClosure {
private:
G1CollectedHeap* _g1h;
CMBitMapRO* _bitmap;
outputStream* _out;
bool _use_prev_marking;
+ bool _all;
public:
- ReachablePrinterOopClosure(CMBitMapRO* bitmap,
- outputStream* out,
- bool use_prev_marking) :
+ PrintReachableOopClosure(CMBitMapRO* bitmap,
+ outputStream* out,
+ bool use_prev_marking,
+ bool all) :
_g1h(G1CollectedHeap::heap()),
- _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
+ _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking), _all(all) { }
void do_oop(narrowOop* p) { do_oop_work(p); }
void do_oop( oop* p) { do_oop_work(p); }
@@ -2001,9 +2004,11 @@ public:
const char* str = NULL;
const char* str2 = "";
- if (!_g1h->is_in_g1_reserved(obj))
- str = "outside G1 reserved";
- else {
+ if (obj == NULL) {
+ str = "";
+ } else if (!_g1h->is_in_g1_reserved(obj)) {
+ str = " O";
+ } else {
HeapRegion* hr = _g1h->heap_region_containing(obj);
guarantee(hr != NULL, "invariant");
bool over_tams = false;
@@ -2012,74 +2017,67 @@ public:
} else {
over_tams = hr->obj_allocated_since_next_marking(obj);
}
+ bool marked = _bitmap->isMarked((HeapWord*) obj);
if (over_tams) {
- str = "over TAMS";
- if (_bitmap->isMarked((HeapWord*) obj)) {
+ str = " >";
+ if (marked) {
str2 = " AND MARKED";
}
- } else if (_bitmap->isMarked((HeapWord*) obj)) {
- str = "marked";
+ } else if (marked) {
+ str = " M";
} else {
- str = "#### NOT MARKED ####";
+ str = " NOT";
}
}
- _out->print_cr(" "PTR_FORMAT" contains "PTR_FORMAT" %s%s",
+ _out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s",
p, (void*) obj, str, str2);
}
};
-class ReachablePrinterClosure: public BitMapClosure {
+class PrintReachableObjectClosure : public ObjectClosure {
private:
CMBitMapRO* _bitmap;
outputStream* _out;
bool _use_prev_marking;
+ bool _all;
+ HeapRegion* _hr;
public:
- ReachablePrinterClosure(CMBitMapRO* bitmap,
- outputStream* out,
- bool use_prev_marking) :
- _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
-
- bool do_bit(size_t offset) {
- HeapWord* addr = _bitmap->offsetToHeapWord(offset);
- ReachablePrinterOopClosure oopCl(_bitmap, _out, _use_prev_marking);
-
- _out->print_cr(" obj "PTR_FORMAT", offset %10d (marked)", addr, offset);
- oop(addr)->oop_iterate(&oopCl);
- _out->print_cr("");
-
- return true;
- }
-};
-
-class ObjInRegionReachablePrinterClosure : public ObjectClosure {
-private:
- CMBitMapRO* _bitmap;
- outputStream* _out;
- bool _use_prev_marking;
-
-public:
- ObjInRegionReachablePrinterClosure(CMBitMapRO* bitmap,
- outputStream* out,
- bool use_prev_marking) :
- _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
+ PrintReachableObjectClosure(CMBitMapRO* bitmap,
+ outputStream* out,
+ bool use_prev_marking,
+ bool all,
+ HeapRegion* hr) :
+ _bitmap(bitmap), _out(out),
+ _use_prev_marking(use_prev_marking), _all(all), _hr(hr) { }
void do_object(oop o) {
- ReachablePrinterOopClosure oopCl(_bitmap, _out, _use_prev_marking);
+ bool over_tams;
+ if (_use_prev_marking) {
+ over_tams = _hr->obj_allocated_since_prev_marking(o);
+ } else {
+ over_tams = _hr->obj_allocated_since_next_marking(o);
+ }
+ bool marked = _bitmap->isMarked((HeapWord*) o);
+ bool print_it = _all || over_tams || marked;
- _out->print_cr(" obj "PTR_FORMAT" (over TAMS)", (void*) o);
- o->oop_iterate(&oopCl);
- _out->print_cr("");
+ if (print_it) {
+ _out->print_cr(" "PTR_FORMAT"%s",
+ o, (over_tams) ? " >" : (marked) ? " M" : "");
+ PrintReachableOopClosure oopCl(_bitmap, _out, _use_prev_marking, _all);
+ o->oop_iterate(&oopCl);
+ }
}
};
-class RegionReachablePrinterClosure : public HeapRegionClosure {
+class PrintReachableRegionClosure : public HeapRegionClosure {
private:
CMBitMapRO* _bitmap;
outputStream* _out;
bool _use_prev_marking;
+ bool _all;
public:
bool doHeapRegion(HeapRegion* hr) {
@@ -2094,22 +2092,35 @@ public:
}
_out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" "
"TAMS: "PTR_FORMAT, b, e, t, p);
- _out->print_cr("");
+ _out->cr();
- ObjInRegionReachablePrinterClosure ocl(_bitmap, _out, _use_prev_marking);
- hr->object_iterate_mem_careful(MemRegion(p, t), &ocl);
+ HeapWord* from = b;
+ HeapWord* to = t;
+
+ if (to > from) {
+ _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to);
+ _out->cr();
+ PrintReachableObjectClosure ocl(_bitmap, _out,
+ _use_prev_marking, _all, hr);
+ hr->object_iterate_mem_careful(MemRegion(from, to), &ocl);
+ _out->cr();
+ }
return false;
}
- RegionReachablePrinterClosure(CMBitMapRO* bitmap,
- outputStream* out,
- bool use_prev_marking) :
- _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking) { }
+ PrintReachableRegionClosure(CMBitMapRO* bitmap,
+ outputStream* out,
+ bool use_prev_marking,
+ bool all) :
+ _bitmap(bitmap), _out(out), _use_prev_marking(use_prev_marking), _all(all) { }
};
-void ConcurrentMark::print_reachable(bool use_prev_marking, const char* str) {
- gclog_or_tty->print_cr("== Doing reachable object dump... ");
+void ConcurrentMark::print_reachable(const char* str,
+ bool use_prev_marking,
+ bool all) {
+ gclog_or_tty->cr();
+ gclog_or_tty->print_cr("== Doing heap dump... ");
if (G1PrintReachableBaseFile == NULL) {
gclog_or_tty->print_cr(" #### error: no base file defined");
@@ -2144,19 +2155,14 @@ void ConcurrentMark::print_reachable(bool use_prev_marking, const char* str) {
out->print_cr("-- USING %s", (use_prev_marking) ? "PTAMS" : "NTAMS");
out->cr();
- RegionReachablePrinterClosure rcl(bitmap, out, use_prev_marking);
- out->print_cr("--- ITERATING OVER REGIONS WITH TAMS < TOP");
+ out->print_cr("--- ITERATING OVER REGIONS");
out->cr();
+ PrintReachableRegionClosure rcl(bitmap, out, use_prev_marking, all);
_g1h->heap_region_iterate(&rcl);
out->cr();
- ReachablePrinterClosure cl(bitmap, out, use_prev_marking);
- out->print_cr("--- ITERATING OVER MARKED OBJECTS ON THE BITMAP");
- out->cr();
- bitmap->iterate(&cl);
- out->cr();
-
gclog_or_tty->print_cr(" done");
+ gclog_or_tty->flush();
}
#endif // PRODUCT
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
index 3326b2693f1..28f8c2a7e8a 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
@@ -652,11 +652,24 @@ public:
// we do nothing.
void markAndGrayObjectIfNecessary(oop p);
- // This iterates over the marking bitmap (either prev or next) and
- // prints out all objects that are marked on the bitmap and indicates
- // whether what they point to is also marked or not. It also iterates
- // the objects over TAMS (either prev or next).
- void print_reachable(bool use_prev_marking, const char* str);
+ // It iterates over the heap and for each object it comes across it
+ // will dump the contents of its reference fields, as well as
+ // liveness information for the object and its referents. The dump
+ // will be written to a file with the following name:
+ // G1PrintReachableBaseFile + "." + str. use_prev_marking decides
+ // whether the prev (use_prev_marking == true) or next
+ // (use_prev_marking == false) marking information will be used to
+ // determine the liveness of each object / referent. If all is true,
+ // all objects in the heap will be dumped, otherwise only the live
+ // ones. In the dump the following symbols / abbreviations are used:
+ // M : an explicitly live object (its bitmap bit is set)
+ // > : an implicitly live object (over tams)
+ // O : an object outside the G1 heap (typically: in the perm gen)
+ // NOT : a reference field whose referent is not live
+ // AND MARKED : indicates that an object is both explicitly and
+ // implicitly live (it should be one or the other, not both)
+ void print_reachable(const char* str,
+ bool use_prev_marking, bool all) PRODUCT_RETURN;
// Clear the next marking bitmap (will be called concurrently).
void clearNextBitmap();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index b46616fcd06..1b56eae5245 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -2397,8 +2397,8 @@ void G1CollectedHeap::verify(bool allow_dirty,
print_on(gclog_or_tty, true /* extended */);
gclog_or_tty->print_cr("");
if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) {
- concurrent_mark()->print_reachable(use_prev_marking,
- "failed-verification");
+ concurrent_mark()->print_reachable("at-verification-failure",
+ use_prev_marking, false /* all */);
}
gclog_or_tty->flush();
}
@@ -3118,6 +3118,11 @@ void G1CollectedHeap::get_gc_alloc_regions() {
} else {
// the region was retained from the last collection
++_gc_alloc_region_counts[ap];
+ if (G1PrintHeapRegions) {
+ gclog_or_tty->print_cr("new alloc region %d:["PTR_FORMAT", "PTR_FORMAT"], "
+ "top "PTR_FORMAT,
+ alloc_region->hrs_index(), alloc_region->bottom(), alloc_region->end(), alloc_region->top());
+ }
}
if (alloc_region != NULL) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index a6429a73808..19e22d78b73 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -2942,10 +2942,11 @@ record_concurrent_mark_cleanup_end(size_t freed_bytes,
void G1CollectorPolicy::
add_to_collection_set(HeapRegion* hr) {
if (G1PrintHeapRegions) {
- gclog_or_tty->print_cr("added region to cset %d:["PTR_FORMAT", "PTR_FORMAT"], "
- "top "PTR_FORMAT", young %s",
- hr->hrs_index(), hr->bottom(), hr->end(),
- hr->top(), (hr->is_young()) ? "YES" : "NO");
+ gclog_or_tty->print_cr("added region to cset "
+ "%d:["PTR_FORMAT", "PTR_FORMAT"], "
+ "top "PTR_FORMAT", %s",
+ hr->hrs_index(), hr->bottom(), hr->end(),
+ hr->top(), hr->is_young() ? "YOUNG" : "NOT_YOUNG");
}
if (_g1->mark_in_progress())
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 8afaee40a85..2fa9f702aa9 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -75,6 +75,16 @@ public:
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
virtual void do_oop( oop* p) { do_oop_work(p); }
+ void print_object(outputStream* out, oop obj) {
+#ifdef PRODUCT
+ klassOop k = obj->klass();
+ const char* class_name = instanceKlass::cast(k)->external_name();
+ out->print_cr("class name %s", class_name);
+#else // PRODUCT
+ obj->print_on(out);
+#endif // PRODUCT
+ }
+
template void do_oop_work(T* p) {
assert(_containing_obj != NULL, "Precondition");
assert(!_g1h->is_obj_dead_cond(_containing_obj, _use_prev_marking),
@@ -90,21 +100,29 @@ public:
gclog_or_tty->print_cr("----------");
}
if (!_g1h->is_in_closed_subset(obj)) {
+ HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
gclog_or_tty->print_cr("Field "PTR_FORMAT
- " of live obj "PTR_FORMAT
- " points to obj "PTR_FORMAT
- " not in the heap.",
- p, (void*) _containing_obj, (void*) obj);
+ " of live obj "PTR_FORMAT" in region "
+ "["PTR_FORMAT", "PTR_FORMAT")",
+ p, (void*) _containing_obj,
+ from->bottom(), from->end());
+ print_object(gclog_or_tty, _containing_obj);
+ gclog_or_tty->print_cr("points to obj "PTR_FORMAT" not in the heap",
+ (void*) obj);
} else {
+ HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
+ HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
gclog_or_tty->print_cr("Field "PTR_FORMAT
- " of live obj "PTR_FORMAT
- " points to dead obj "PTR_FORMAT".",
- p, (void*) _containing_obj, (void*) obj);
+ " of live obj "PTR_FORMAT" in region "
+ "["PTR_FORMAT", "PTR_FORMAT")",
+ p, (void*) _containing_obj,
+ from->bottom(), from->end());
+ print_object(gclog_or_tty, _containing_obj);
+ gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region "
+ "["PTR_FORMAT", "PTR_FORMAT")",
+ (void*) obj, to->bottom(), to->end());
+ print_object(gclog_or_tty, obj);
}
- gclog_or_tty->print_cr("Live obj:");
- _containing_obj->print_on(gclog_or_tty);
- gclog_or_tty->print_cr("Bad referent:");
- obj->print_on(gclog_or_tty);
gclog_or_tty->print_cr("----------");
_failures = true;
failed = true;
@@ -723,6 +741,8 @@ void HeapRegion::print_on(outputStream* st) const {
else
st->print(" ");
st->print(" %5d", _gc_time_stamp);
+ st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT,
+ prev_top_at_mark_start(), next_top_at_mark_start());
G1OffsetTableContigSpace::print_on(st);
}
From 0020f5af66c4946222970da9925822c8eec02522 Mon Sep 17 00:00:00 2001
From: Xueming Shen
Date: Tue, 30 Mar 2010 19:10:47 -0700
Subject: [PATCH 073/190] 6902790: Converting/displaying HKSCs characters issue
on Vista and Windows7 6911753: NSN wants to add Big5 HKSCS-2004 support
Support HKSCS2008 in Big5_HKSCS and MS950_HKSCS
Reviewed-by: okutsu
---
jdk/make/sun/nio/cs/FILES_java.gmk | 10 +-
jdk/make/sun/nio/cs/Makefile | 4 +-
jdk/make/tools/CharsetMapping/Big5.c2b | 8 +
jdk/make/tools/CharsetMapping/Big5.map | 13837 ++++++++++++++++
jdk/make/tools/CharsetMapping/Big5.nr | 5 +
jdk/make/tools/CharsetMapping/HKSCS2001.c2b | 2187 +++
jdk/make/tools/CharsetMapping/HKSCS2001.map | 4821 ++++++
jdk/make/tools/CharsetMapping/HKSCS2008.c2b | 4969 ++++++
jdk/make/tools/CharsetMapping/HKSCS2008.map | 5019 ++++++
jdk/make/tools/CharsetMapping/HKSCS_XP.c2b | 529 +
jdk/make/tools/CharsetMapping/HKSCS_XP.map | 4704 ++++++
jdk/make/tools/CharsetMapping/dbcs | 1 +
.../{GenerateDBCS.java => DBCS.java} | 125 +-
.../build/tools/charsetmapping/EUC_TW.java | 177 +
.../tools/charsetmapping/GenerateEUC_TW.java | 246 -
.../tools/charsetmapping/GenerateMapping.java | 95 -
.../src/build/tools/charsetmapping/HKSCS.java | 190 +
.../{CharsetMapping.java => JIS0213.java} | 165 +-
.../src/build/tools/charsetmapping/Main.java | 18 +-
.../{GenerateSBCS.java => SBCS.java} | 24 +-
.../src/build/tools/charsetmapping/Utils.java | 221 +
jdk/src/share/classes/sun/awt/HKSCS.java | 2 +-
.../share/classes/sun/io/ByteToCharBig5.java | 12 +-
.../classes/sun/io/ByteToCharBig5_HKSCS.java | 23 +-
.../sun/io/ByteToCharBig5_Solaris.java | 48 +-
.../share/classes/sun/io/ByteToCharHKSCS.java | 48 -
.../classes/sun/io/ByteToCharHKSCS_2001.java | 48 -
.../classes/sun/io/ByteToCharMS950_HKSCS.java | 22 +-
.../share/classes/sun/io/CharToByteBig5.java | 10 +-
.../classes/sun/io/CharToByteBig5_HKSCS.java | 13 +-
.../sun/io/CharToByteBig5_Solaris.java | 43 +-
.../share/classes/sun/io/CharToByteHKSCS.java | 48 -
.../classes/sun/io/CharToByteHKSCS_2001.java | 48 -
.../classes/sun/io/CharToByteMS950_HKSCS.java | 14 +-
.../share/classes/sun/nio/cs/ext/Big5.java | 5508 ------
.../classes/sun/nio/cs/ext/Big5_HKSCS.java | 40 +-
.../sun/nio/cs/ext/Big5_HKSCS_2001.java | 85 +
.../classes/sun/nio/cs/ext/Big5_Solaris.java | 133 +-
.../sun/nio/cs/ext/ExtendedCharsets.java | 17 +-
.../share/classes/sun/nio/cs/ext/HKSCS.java | 5861 +------
.../classes/sun/nio/cs/ext/HKSCS_2001.java | 7827 ---------
.../classes/sun/nio/cs/ext/MS950_HKSCS.java | 44 +-
.../sun/nio/cs/ext/MS950_HKSCS_XP.java | 102 +
.../fontconfigs/solaris.fontconfig.properties | 2 +-
.../solaris/native/java/lang/java_props_md.c | 30 +-
.../sun/awt/windows/fontconfig.properties | 6 +
.../windows/native/java/lang/java_props_md.c | 19 +-
.../Charset/NIOCharsetAvailabilityTest.java | 4 +-
.../charset/Charset/RegisteredCharsets.java | 3 +-
49 files changed, 37535 insertions(+), 19880 deletions(-)
create mode 100644 jdk/make/tools/CharsetMapping/Big5.c2b
create mode 100644 jdk/make/tools/CharsetMapping/Big5.map
create mode 100644 jdk/make/tools/CharsetMapping/Big5.nr
create mode 100644 jdk/make/tools/CharsetMapping/HKSCS2001.c2b
create mode 100644 jdk/make/tools/CharsetMapping/HKSCS2001.map
create mode 100644 jdk/make/tools/CharsetMapping/HKSCS2008.c2b
create mode 100644 jdk/make/tools/CharsetMapping/HKSCS2008.map
create mode 100644 jdk/make/tools/CharsetMapping/HKSCS_XP.c2b
create mode 100644 jdk/make/tools/CharsetMapping/HKSCS_XP.map
rename jdk/make/tools/src/build/tools/charsetmapping/{GenerateDBCS.java => DBCS.java} (70%)
create mode 100644 jdk/make/tools/src/build/tools/charsetmapping/EUC_TW.java
delete mode 100644 jdk/make/tools/src/build/tools/charsetmapping/GenerateEUC_TW.java
delete mode 100644 jdk/make/tools/src/build/tools/charsetmapping/GenerateMapping.java
create mode 100644 jdk/make/tools/src/build/tools/charsetmapping/HKSCS.java
rename jdk/make/tools/src/build/tools/charsetmapping/{CharsetMapping.java => JIS0213.java} (63%)
rename jdk/make/tools/src/build/tools/charsetmapping/{GenerateSBCS.java => SBCS.java} (93%)
create mode 100644 jdk/make/tools/src/build/tools/charsetmapping/Utils.java
delete mode 100644 jdk/src/share/classes/sun/io/ByteToCharHKSCS.java
delete mode 100644 jdk/src/share/classes/sun/io/ByteToCharHKSCS_2001.java
delete mode 100644 jdk/src/share/classes/sun/io/CharToByteHKSCS.java
delete mode 100644 jdk/src/share/classes/sun/io/CharToByteHKSCS_2001.java
delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/Big5.java
create mode 100644 jdk/src/share/classes/sun/nio/cs/ext/Big5_HKSCS_2001.java
delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/HKSCS_2001.java
create mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MS950_HKSCS_XP.java
diff --git a/jdk/make/sun/nio/cs/FILES_java.gmk b/jdk/make/sun/nio/cs/FILES_java.gmk
index 7fdcd2736da..534b89ad111 100644
--- a/jdk/make/sun/nio/cs/FILES_java.gmk
+++ b/jdk/make/sun/nio/cs/FILES_java.gmk
@@ -42,8 +42,6 @@ FILES_src = \
sun/io/ByteToCharBig5_Solaris.java \
sun/io/ByteToCharBig5_HKSCS.java \
sun/io/ByteToCharMS950_HKSCS.java \
- sun/io/ByteToCharHKSCS.java \
- sun/io/ByteToCharHKSCS_2001.java \
sun/io/ByteToCharGB18030.java \
sun/io/ByteToCharGB18030DB.java \
sun/io/ByteToCharCp037.java \
@@ -173,8 +171,6 @@ FILES_src = \
sun/io/CharToByteBig5.java \
sun/io/CharToByteBig5_Solaris.java \
sun/io/CharToByteBig5_HKSCS.java \
- sun/io/CharToByteHKSCS.java \
- sun/io/CharToByteHKSCS_2001.java \
sun/io/CharToByteMS950_HKSCS.java \
sun/io/CharToByteGB18030.java \
sun/io/CharToByteCp037.java \
@@ -374,6 +370,9 @@ FILES_gen_extcs = \
sun/nio/cs/ext/MacUkraine.java \
sun/nio/cs/ext/TIS_620.java \
sun/nio/cs/ext/EUC_TWMapping.java \
+ sun/nio/cs/ext/HKSCSMapping.java \
+ sun/nio/cs/ext/HKSCS2001Mapping.java \
+ sun/nio/cs/ext/HKSCS_XPMapping.java \
sun/nio/cs/ext/IBM1381.java \
sun/nio/cs/ext/IBM1383.java \
sun/nio/cs/ext/IBM930.java \
@@ -394,7 +393,8 @@ FILES_gen_extcs = \
sun/nio/cs/ext/MS936.java \
sun/nio/cs/ext/MS949.java \
sun/nio/cs/ext/MS950.java \
- sun/nio/cs/ext/GBK.java
+ sun/nio/cs/ext/GBK.java \
+ sun/nio/cs/ext/Big5.java
FILES_java = $(FILES_src) $(FILES_gen_extcs)
diff --git a/jdk/make/sun/nio/cs/Makefile b/jdk/make/sun/nio/cs/Makefile
index c2e9c0b8ef2..23b738beda5 100644
--- a/jdk/make/sun/nio/cs/Makefile
+++ b/jdk/make/sun/nio/cs/Makefile
@@ -93,7 +93,9 @@ $(FILES_genout_extcs): \
$(MKDIR) -p $(GENCSEXT)
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \
- $(GENCSSRCDIR)/GenerateEUC_TW.java
+ $(GENCSSRCDIR)/EUC_TW.java
+ $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) hkscs \
+ $(GENCSSRCDIR)/HKSCS.java
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs
$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
diff --git a/jdk/make/tools/CharsetMapping/Big5.c2b b/jdk/make/tools/CharsetMapping/Big5.c2b
new file mode 100644
index 00000000000..a4ed3176312
--- /dev/null
+++ b/jdk/make/tools/CharsetMapping/Big5.c2b
@@ -0,0 +1,8 @@
+#Add the following 5 characters which are duplicated
+#or have conflicts with other characters.
+0xA1C4 0xFF3F #REGWARN Fallback 0xA1C4 SPACING UNDERSCORE
+0xA2AC 0x2571 #REGWARN Fallback 0xA2AC LT DIAG UP RIGHT TO LOW LEFT
+0xA2AD 0x2572 #REGWARN Fallback 0xA2AD LT DIAG UP LEFT TO LOW RIGHT
+0xA451 0x5341 #REGWARN Fallback 0xA451 HANGZHOU NUMERAL TEN
+0xA4CA 0x5345 #REGWARN Fallback 0xA4CA HANGZHOU NUMERAL THIRTY
+#
diff --git a/jdk/make/tools/CharsetMapping/Big5.map b/jdk/make/tools/CharsetMapping/Big5.map
new file mode 100644
index 00000000000..dcfa244c310
--- /dev/null
+++ b/jdk/make/tools/CharsetMapping/Big5.map
@@ -0,0 +1,13837 @@
+# From Big5.b2c
+# Added sb
+# Added Big5.b2c-irreversible
+#
+0x00 0x0000
+0x01 0x0001
+0x02 0x0002
+0x03 0x0003
+0x04 0x0004
+0x05 0x0005
+0x06 0x0006
+0x07 0x0007
+0x08 0x0008
+0x09 0x0009
+0x0a 0x000a
+0x0b 0x000b
+0x0c 0x000c
+0x0d 0x000d
+0x0e 0x000e
+0x0f 0x000f
+0x10 0x0010
+0x11 0x0011
+0x12 0x0012
+0x13 0x0013
+0x14 0x0014
+0x15 0x0015
+0x16 0x0016
+0x17 0x0017
+0x18 0x0018
+0x19 0x0019
+0x1a 0x001a
+0x1b 0x001b
+0x1c 0x001c
+0x1d 0x001d
+0x1e 0x001e
+0x1f 0x001f
+0x20 0x0020 # SPACE
+0x21 0x0021 # EXCLAMATION MARK
+0x22 0x0022 # QUOTATION MARK
+0x23 0x0023 # NUMBER SIGN
+0x24 0x0024 # DOLLAR SIGN
+0x25 0x0025 # PERCENT SIGN
+0x26 0x0026 # AMPERSAND
+0x27 0x0027 # APOSTROPHE
+0x28 0x0028 # LEFT PARENTHESIS
+0x29 0x0029 # RIGHT PARENTHESIS
+0x2A 0x002A # ASTERISK
+0x2B 0x002B # PLUS SIGN
+0x2C 0x002C # COMMA
+0x2D 0x002D # HYPHEN-MINUS
+0x2E 0x002E # FULL STOP
+0x2F 0x002F # SOLIDUS
+0x30 0x0030 # DIGIT ZERO
+0x31 0x0031 # DIGIT ONE
+0x32 0x0032 # DIGIT TWO
+0x33 0x0033 # DIGIT THREE
+0x34 0x0034 # DIGIT FOUR
+0x35 0x0035 # DIGIT FIVE
+0x36 0x0036 # DIGIT SIX
+0x37 0x0037 # DIGIT SEVEN
+0x38 0x0038 # DIGIT EIGHT
+0x39 0x0039 # DIGIT NINE
+0x3A 0x003A # COLON
+0x3B 0x003B # SEMICOLON
+0x3C 0x003C # LESS-THAN SIGN
+0x3D 0x003D # EQUALS SIGN
+0x3E 0x003E # GREATER-THAN SIGN
+0x3F 0x003F # QUESTION MARK
+0x40 0x0040 # COMMERCIAL AT
+0x41 0x0041 # LATIN CAPITAL LETTER A
+0x42 0x0042 # LATIN CAPITAL LETTER B
+0x43 0x0043 # LATIN CAPITAL LETTER C
+0x44 0x0044 # LATIN CAPITAL LETTER D
+0x45 0x0045 # LATIN CAPITAL LETTER E
+0x46 0x0046 # LATIN CAPITAL LETTER F
+0x47 0x0047 # LATIN CAPITAL LETTER G
+0x48 0x0048 # LATIN CAPITAL LETTER H
+0x49 0x0049 # LATIN CAPITAL LETTER I
+0x4A 0x004A # LATIN CAPITAL LETTER J
+0x4B 0x004B # LATIN CAPITAL LETTER K
+0x4C 0x004C # LATIN CAPITAL LETTER L
+0x4D 0x004D # LATIN CAPITAL LETTER M
+0x4E 0x004E # LATIN CAPITAL LETTER N
+0x4F 0x004F # LATIN CAPITAL LETTER O
+0x50 0x0050 # LATIN CAPITAL LETTER P
+0x51 0x0051 # LATIN CAPITAL LETTER Q
+0x52 0x0052 # LATIN CAPITAL LETTER R
+0x53 0x0053 # LATIN CAPITAL LETTER S
+0x54 0x0054 # LATIN CAPITAL LETTER T
+0x55 0x0055 # LATIN CAPITAL LETTER U
+0x56 0x0056 # LATIN CAPITAL LETTER V
+0x57 0x0057 # LATIN CAPITAL LETTER W
+0x58 0x0058 # LATIN CAPITAL LETTER X
+0x59 0x0059 # LATIN CAPITAL LETTER Y
+0x5A 0x005A # LATIN CAPITAL LETTER Z
+0x5B 0x005B # LEFT SQUARE BRACKET
+0x5C 0x005C # WON SIGN
+0x5D 0x005D # RIGHT SQUARE BRACKET
+0x5E 0x005E # CIRCUMFLEX ACCENT
+0x5F 0x005F # LOW LINE
+0x60 0x0060 # GRAVE ACCENT
+0x61 0x0061 # LATIN SMALL LETTER A
+0x62 0x0062 # LATIN SMALL LETTER B
+0x63 0x0063 # LATIN SMALL LETTER C
+0x64 0x0064 # LATIN SMALL LETTER D
+0x65 0x0065 # LATIN SMALL LETTER E
+0x66 0x0066 # LATIN SMALL LETTER F
+0x67 0x0067 # LATIN SMALL LETTER G
+0x68 0x0068 # LATIN SMALL LETTER H
+0x69 0x0069 # LATIN SMALL LETTER I
+0x6A 0x006A # LATIN SMALL LETTER J
+0x6B 0x006B # LATIN SMALL LETTER K
+0x6C 0x006C # LATIN SMALL LETTER L
+0x6D 0x006D # LATIN SMALL LETTER M
+0x6E 0x006E # LATIN SMALL LETTER N
+0x6F 0x006F # LATIN SMALL LETTER O
+0x70 0x0070 # LATIN SMALL LETTER P
+0x71 0x0071 # LATIN SMALL LETTER Q
+0x72 0x0072 # LATIN SMALL LETTER R
+0x73 0x0073 # LATIN SMALL LETTER S
+0x74 0x0074 # LATIN SMALL LETTER T
+0x75 0x0075 # LATIN SMALL LETTER U
+0x76 0x0076 # LATIN SMALL LETTER V
+0x77 0x0077 # LATIN SMALL LETTER W
+0x78 0x0078 # LATIN SMALL LETTER X
+0x79 0x0079 # LATIN SMALL LETTER Y
+0x7A 0x007A # LATIN SMALL LETTER Z
+0x7B 0x007B # LEFT CURLY BRACKET
+0x7C 0x007C # VERTICAL LINE
+0x7D 0x007D # RIGHT CURLY BRACKET
+0x7E 0x007E # TILDE
+0x7F 0x007F
+#
+0xA140 0x3000 # IDEOGRAPHIC SPACE
+0xA141 0xFF0C # FULLWIDTH COMMA
+0xA142 0x3001 # IDEOGRAPHIC COMMA
+0xA143 0x3002 # IDEOGRAPHIC FULL STOP
+0xA144 0xFF0E # FULLWIDTH FULL STOP
+0xA145 0x2022 # BULLET
+0xA146 0xFF1B # FULLWIDTH SEMICOLON
+0xA147 0xFF1A # FULLWIDTH COLON
+0xA148 0xFF1F # FULLWIDTH QUESTION MARK
+0xA149 0xFF01 # FULLWIDTH EXCLAMATION MARK
+0xA14A 0xFE30 # PRESENTATION FORM FOR VERTICAL TWO DOT LEADER
+0xA14B 0x2026 # HORIZONTAL ELLIPSIS
+0xA14C 0x2025 # TWO DOT LEADER
+0xA14D 0xFE50 # SMALL COMMA
+0xA14E 0xFF64 # HALFWIDTH IDEOGRAPHIC COMMA
+0xA14F 0xFE52 # SMALL FULL STOP
+0xA150 0x00B7 # MIDDLE DOT
+0xA151 0xFE54 # SMALL SEMICOLON
+0xA152 0xFE55 # SMALL COLON
+0xA153 0xFE56 # SMALL QUESTION MARK
+0xA154 0xFE57 # SMALL EXCLAMATION MARK
+0xA155 0xFF5C # FULLWIDTH VERTICAL BAR
+0xA156 0x2013 # EN DASH
+0xA157 0xFE31 # PRESENTATION FORM FOR VERTICAL EM DASH
+0xA158 0x2014 # EM DASH
+0xA159 0xFE33 # PRESENTATION FORM FOR VERTICAL LOW LINE
+0xA15B 0xFE34 # PRESENTATION FORM FOR VERTICAL WAVY LOW LINE
+0xA15C 0xFE4F # WAVY LOW LINE
+0xA15D 0xFF08 # FULLWIDTH LEFT PARENTHESIS
+0xA15E 0xFF09 # FULLWIDTH RIGHT PARENTHESIS
+0xA15F 0xFE35 # PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS
+0xA160 0xFE36 # PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS
+0xA161 0xFF5B # FULLWIDTH LEFT CURLY BRACKET
+0xA162 0xFF5D # FULLWIDTH RIGHT CURLY BRACKET
+0xA163 0xFE37 # PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET
+0xA164 0xFE38 # PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET
+0xA165 0x3014 # LEFT TORTOISE SHELL BRACKET
+0xA166 0x3015 # RIGHT TORTOISE SHELL BRACKET
+0xA167 0xFE39 # PRESENTATION FORM FOR VERTICAL LEFT TORTOISE SHELL BRACKET
+0xA168 0xFE3A # PRESENTATION FORM FOR VERTICAL RIGHT TORTOISE SHELL BRACKET
+0xA169 0x3010 # LEFT BLACK LENTICULAR BRACKET
+0xA16A 0x3011 # RIGHT BLACK LENTICULAR BRACKET
+0xA16B 0xFE3B # PRESENTATION FORM FOR VERTICAL LEFT BLACK LENTICULAR BRACKET
+0xA16C 0xFE3C # PRESENTATION FORM FOR VERTICAL RIGHT BLACK LENTICULAR BRACKET
+0xA16D 0x300A # LEFT DOUBLE ANGLE BRACKET
+0xA16E 0x300B # RIGHT DOUBLE ANGLE BRACKET
+0xA16F 0xFE3D # PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET
+0xA170 0xFE3E # PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET
+0xA171 0x3008 # LEFT ANGLE BRACKET
+0xA172 0x3009 # RIGHT ANGLE BRACKET
+0xA173 0xFE3F # PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET
+0xA174 0xFE40 # PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET
+0xA175 0x300C # LEFT CORNER BRACKET
+0xA176 0x300D # RIGHT CORNER BRACKET
+0xA177 0xFE41 # PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET
+0xA178 0xFE42 # PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET
+0xA179 0x300E # LEFT WHITE CORNER BRACKET
+0xA17A 0x300F # RIGHT WHITE CORNER BRACKET
+0xA17B 0xFE43 # PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET
+0xA17C 0xFE44 # PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET
+0xA17D 0xFE59 # SMALL LEFT PARENTHESIS
+0xA17E 0xFE5A # SMALL RIGHT PARENTHESIS
+0xA1A1 0xFE5B # SMALL LEFT CURLY BRACKET
+0xA1A2 0xFE5C # SMALL RIGHT CURLY BRACKET
+0xA1A3 0xFE5D # SMALL LEFT TORTOISE SHELL BRACKET
+0xA1A4 0xFE5E # SMALL RIGHT TORTOISE SHELL BRACKET
+0xA1A5 0x2018 # LEFT SINGLE QUOTATION MARK
+0xA1A6 0x2019 # RIGHT SINGLE QUOTATION MARK
+0xA1A7 0x201C # LEFT DOUBLE QUOTATION MARK
+0xA1A8 0x201D # RIGHT DOUBLE QUOTATION MARK
+0xA1A9 0x301D # REVERSED DOUBLE PRIME QUOTATION MARK
+0xA1AA 0x301E # DOUBLE PRIME QUOTATION MARK
+0xA1AB 0x2035 # REVERSED PRIME
+0xA1AC 0x2032 # PRIME
+0xA1AD 0xFF03 # FULLWIDTH NUMBER SIGN
+0xA1AE 0xFF06 # FULLWIDTH AMPERSAND
+0xA1AF 0xFF0A # FULLWIDTH ASTERISK
+0xA1B0 0x203B # REFERENCE MARK
+0xA1B1 0x00A7 # SECTION SIGN
+0xA1B2 0x3003 # DITTO MARK
+0xA1B3 0x25CB # WHITE CIRCLE
+0xA1B4 0x25CF # BLACK CIRCLE
+0xA1B5 0x25B3 # WHITE UP-POINTING TRIANGLE
+0xA1B6 0x25B2 # BLACK UP-POINTING TRIANGLE
+0xA1B7 0x25CE # BULLSEYE
+0xA1B8 0x2606 # WHITE STAR
+0xA1B9 0x2605 # BLACK STAR
+0xA1BA 0x25C7 # WHITE DIAMOND
+0xA1BB 0x25C6 # BLACK DIAMOND
+0xA1BC 0x25A1 # WHITE SQUARE
+0xA1BD 0x25A0 # BLACK SQUARE
+0xA1BE 0x25BD # WHITE DOWN-POINTING TRIANGLE
+0xA1BF 0x25BC # BLACK DOWN-POINTING TRIANGLE
+0xA1C0 0x32A3 # CIRCLED IDEOGRAPH CORRECT
+0xA1C1 0x2105 # CARE OF
+0xA1C2 0x203E # OVERLINE
+0xA1C6 0xFE49 # DASHED OVERLINE
+0xA1C7 0xFE4A # CENTRELINE OVERLINE
+0xA1C8 0xFE4D # DASHED LOW LINE
+0xA1C9 0xFE4E # CENTRELINE LOW LINE
+0xA1CA 0xFE4B # WAVY OVERLINE
+0xA1CB 0xFE4C # DOUBLE WAVY OVERLINE
+0xA1CC 0xFE5F # SMALL NUMBER SIGN
+0xA1CD 0xFE60 # SMALL AMPERSAND
+0xA1CE 0xFE61 # SMALL ASTERISK
+0xA1CF 0xFF0B # FULLWIDTH PLUS SIGN
+0xA1D0 0xFF0D # FULLWIDTH HYPHEN-MINUS
+0xA1D1 0x00D7 # MULTIPLICATION SIGN
+0xA1D2 0x00F7 # DIVISION SIGN
+0xA1D3 0x00B1 # PLUS-MINUS SIGN
+0xA1D4 0x221A # SQUARE ROOT
+0xA1D5 0xFF1C # FULLWIDTH LESS-THAN SIGN
+0xA1D6 0xFF1E # FULLWIDTH GREATER-THAN SIGN
+0xA1D7 0xFF1D # FULLWIDTH EQUALS SIGN
+0xA1D8 0x2266 # LESS THAN OVER EQUAL TO
+0xA1D9 0x2267 # GREATER THAN OVER EQUAL TO
+0xA1DA 0x2260 # NOT EQUAL TO
+0xA1DB 0x221E # INFINITY
+0xA1DC 0x2252 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
+0xA1DD 0x2261 # IDENTICAL TO
+0xA1DE 0xFE62 # SMALL PLUS SIGN
+0xA1DF 0xFE63 # SMALL HYPHEN-MINUS
+0xA1E0 0xFE64 # SMALL LESS-THAN SIGN
+0xA1E1 0xFE65 # SMALL GREATER-THAN SIGN
+0xA1E2 0xFE66 # SMALL EQUALS SIGN
+0xA1E3 0x223C # TILDE OPERATOR
+0xA1E4 0x2229 # INTERSECTION
+0xA1E5 0x222A # UNION
+0xA1E6 0x22A5 # UP TACK
+0xA1E7 0x2220 # ANGLE
+0xA1E8 0x221F # RIGHT ANGLE
+0xA1E9 0x22BF # RIGHT TRIANGLE
+0xA1EA 0x33D2 # SQUARE LOG
+0xA1EB 0x33D1 # SQUARE LN
+0xA1EC 0x222B # INTEGRAL
+0xA1ED 0x222E # CONTOUR INTEGRAL
+0xA1EE 0x2235 # BECAUSE
+0xA1EF 0x2234 # THEREFORE
+0xA1F0 0x2640 # FEMALE SIGN
+0xA1F1 0x2642 # MALE SIGN
+0xA1F2 0x2641 # EARTH
+0xA1F3 0x2609 # SUN
+0xA1F4 0x2191 # UPWARDS ARROW
+0xA1F5 0x2193 # DOWNWARDS ARROW
+0xA1F6 0x2190 # LEFTWARDS ARROW
+0xA1F7 0x2192 # RIGHTWARDS ARROW
+0xA1F8 0x2196 # NORTH WEST ARROW
+0xA1F9 0x2197 # NORTH EAST ARROW
+0xA1FA 0x2199 # SOUTH WEST ARROW
+0xA1FB 0x2198 # SOUTH EAST ARROW
+0xA1FC 0x2225 # PARALLEL TO
+0xA1FD 0x2223 # DIVIDES
+0xA241 0xFF0F # FULLWIDTH SOLIDUS
+0xA242 0xFF3C # FULLWIDTH REVERSE SOLIDUS
+0xA243 0xFF04 # FULLWIDTH DOLLAR SIGN
+0xA244 0x00A5 # YEN SIGN
+0xA245 0x3012 # POSTAL MARK
+0xA246 0x00A2 # CENT SIGN
+0xA247 0x00A3 # POUND SIGN
+0xA248 0xFF05 # FULLWIDTH PERCENT SIGN
+0xA249 0xFF20 # FULLWIDTH COMMERCIAL AT
+0xA24A 0x2103 # DEGREE CELSIUS
+0xA24B 0x2109 # DEGREE FAHRENHEIT
+0xA24C 0xFE69 # SMALL DOLLAR SIGN
+0xA24D 0xFE6A # SMALL PERCENT SIGN
+0xA24E 0xFE6B # SMALL COMMERCIAL AT
+0xA24F 0x33D5 # SQUARE MIL
+0xA250 0x339C # SQUARE MM
+0xA251 0x339D # SQUARE CM
+0xA252 0x339E # SQUARE KM
+0xA253 0x33CE # SQUARE KM CAPITAL
+0xA254 0x33A1 # SQUARE M SQUARED
+0xA255 0x338E # SQUARE MG
+0xA256 0x338F # SQUARE KG
+0xA257 0x33C4 # SQUARE CC
+0xA258 0x00B0 # DEGREE SIGN
+0xA259 0x5159 #
+0xA25A 0x515B #
+0xA25B 0x515E #
+0xA25C 0x515D #
+0xA25D 0x5161 #
+0xA25E 0x5163 #
+0xA25F 0x55E7 #
+0xA260 0x74E9 #
+0xA261 0x7CCE #
+0xA262 0x2581 # LOWER ONE EIGHTH BLOCK
+0xA263 0x2582 # LOWER ONE QUARTER BLOCK
+0xA264 0x2583 # LOWER THREE EIGHTHS BLOCK
+0xA265 0x2584 # LOWER HALF BLOCK
+0xA266 0x2585 # LOWER FIVE EIGHTHS BLOCK
+0xA267 0x2586 # LOWER THREE QUARTERS BLOCK
+0xA268 0x2587 # LOWER SEVEN EIGHTHS BLOCK
+0xA269 0x2588 # FULL BLOCK
+0xA26A 0x258F # LEFT ONE EIGHTH BLOCK
+0xA26B 0x258E # LEFT ONE QUARTER BLOCK
+0xA26C 0x258D # LEFT THREE EIGHTHS BLOCK
+0xA26D 0x258C # LEFT HALF BLOCK
+0xA26E 0x258B # LEFT FIVE EIGHTHS BLOCK
+0xA26F 0x258A # LEFT THREE QUARTERS BLOCK
+0xA270 0x2589 # LEFT SEVEN EIGHTHS BLOCK
+0xA271 0x253C # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0xA272 0x2534 # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0xA273 0x252C # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0xA274 0x2524 # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0xA275 0x251C # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0xA276 0x2594 # UPPER ONE EIGHTH BLOCK
+0xA277 0x2500 # BOX DRAWINGS LIGHT HORIZONTAL
+0xA278 0x2502 # BOX DRAWINGS LIGHT VERTICAL
+0xA279 0x2595 # RIGHT ONE EIGHTH BLOCK
+0xA27A 0x250C # BOX DRAWINGS LIGHT DOWN AND RIGHT
+0xA27B 0x2510 # BOX DRAWINGS LIGHT DOWN AND LEFT
+0xA27C 0x2514 # BOX DRAWINGS LIGHT UP AND RIGHT
+0xA27D 0x2518 # BOX DRAWINGS LIGHT UP AND LEFT
+0xA27E 0x256D # BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
+0xA2A1 0x256E # BOX DRAWINGS LIGHT ARC DOWN AND LEFT
+0xA2A2 0x2570 # BOX DRAWINGS LIGHT ARC UP AND RIGHT
+0xA2A3 0x256F # BOX DRAWINGS LIGHT ARC UP AND LEFT
+0xA2A4 0x2550 # BOX DRAWINGS DOUBLE HORIZONTAL
+0xA2A5 0x255E # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+0xA2A6 0x256A # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+0xA2A7 0x2561 # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+0xA2A8 0x25E2 # BLACK LOWER RIGHT TRIANGLE
+0xA2A9 0x25E3 # BLACK LOWER LEFT TRIANGLE
+0xA2AA 0x25E5 # BLACK UPPER RIGHT TRIANGLE
+0xA2AB 0x25E4 # BLACK UPPER LEFT TRIANGLE
+0xA2AE 0x2573 # BOX DRAWINGS LIGHT DIAGONAL CROSS
+0xA2AF 0xFF10 # FULLWIDTH DIGIT ZERO
+0xA2B0 0xFF11 # FULLWIDTH DIGIT ONE
+0xA2B1 0xFF12 # FULLWIDTH DIGIT TWO
+0xA2B2 0xFF13 # FULLWIDTH DIGIT THREE
+0xA2B3 0xFF14 # FULLWIDTH DIGIT FOUR
+0xA2B4 0xFF15 # FULLWIDTH DIGIT FIVE
+0xA2B5 0xFF16 # FULLWIDTH DIGIT SIX
+0xA2B6 0xFF17 # FULLWIDTH DIGIT SEVEN
+0xA2B7 0xFF18 # FULLWIDTH DIGIT EIGHT
+0xA2B8 0xFF19 # FULLWIDTH DIGIT NINE
+0xA2B9 0x2160 # ROMAN NUMERAL ONE
+0xA2BA 0x2161 # ROMAN NUMERAL TWO
+0xA2BB 0x2162 # ROMAN NUMERAL THREE
+0xA2BC 0x2163 # ROMAN NUMERAL FOUR
+0xA2BD 0x2164 # ROMAN NUMERAL FIVE
+0xA2BE 0x2165 # ROMAN NUMERAL SIX
+0xA2BF 0x2166 # ROMAN NUMERAL SEVEN
+0xA2C0 0x2167 # ROMAN NUMERAL EIGHT
+0xA2C1 0x2168 # ROMAN NUMERAL NINE
+0xA2C2 0x2169 # ROMAN NUMERAL TEN
+0xA2C3 0x3021 # HANGZHOU NUMERAL ONE
+0xA2C4 0x3022 # HANGZHOU NUMERAL TWO
+0xA2C5 0x3023 # HANGZHOU NUMERAL THREE
+0xA2C6 0x3024 # HANGZHOU NUMERAL FOUR
+0xA2C7 0x3025 # HANGZHOU NUMERAL FIVE
+0xA2C8 0x3026 # HANGZHOU NUMERAL SIX
+0xA2C9 0x3027 # HANGZHOU NUMERAL SEVEN
+0xA2CA 0x3028 # HANGZHOU NUMERAL EIGHT
+0xA2CB 0x3029 # HANGZHOU NUMERAL NINE
+0xA2CD 0x5344 #
+0xA2CF 0xFF21 # FULLWIDTH LATIN CAPITAL LETTER A
+0xA2D0 0xFF22 # FULLWIDTH LATIN CAPITAL LETTER B
+0xA2D1 0xFF23 # FULLWIDTH LATIN CAPITAL LETTER C
+0xA2D2 0xFF24 # FULLWIDTH LATIN CAPITAL LETTER D
+0xA2D3 0xFF25 # FULLWIDTH LATIN CAPITAL LETTER E
+0xA2D4 0xFF26 # FULLWIDTH LATIN CAPITAL LETTER F
+0xA2D5 0xFF27 # FULLWIDTH LATIN CAPITAL LETTER G
+0xA2D6 0xFF28 # FULLWIDTH LATIN CAPITAL LETTER H
+0xA2D7 0xFF29 # FULLWIDTH LATIN CAPITAL LETTER I
+0xA2D8 0xFF2A # FULLWIDTH LATIN CAPITAL LETTER J
+0xA2D9 0xFF2B # FULLWIDTH LATIN CAPITAL LETTER K
+0xA2DA 0xFF2C # FULLWIDTH LATIN CAPITAL LETTER L
+0xA2DB 0xFF2D # FULLWIDTH LATIN CAPITAL LETTER M
+0xA2DC 0xFF2E # FULLWIDTH LATIN CAPITAL LETTER N
+0xA2DD 0xFF2F # FULLWIDTH LATIN CAPITAL LETTER O
+0xA2DE 0xFF30 # FULLWIDTH LATIN CAPITAL LETTER P
+0xA2DF 0xFF31 # FULLWIDTH LATIN CAPITAL LETTER Q
+0xA2E0 0xFF32 # FULLWIDTH LATIN CAPITAL LETTER R
+0xA2E1 0xFF33 # FULLWIDTH LATIN CAPITAL LETTER S
+0xA2E2 0xFF34 # FULLWIDTH LATIN CAPITAL LETTER T
+0xA2E3 0xFF35 # FULLWIDTH LATIN CAPITAL LETTER U
+0xA2E4 0xFF36 # FULLWIDTH LATIN CAPITAL LETTER V
+0xA2E5 0xFF37 # FULLWIDTH LATIN CAPITAL LETTER W
+0xA2E6 0xFF38 # FULLWIDTH LATIN CAPITAL LETTER X
+0xA2E7 0xFF39 # FULLWIDTH LATIN CAPITAL LETTER Y
+0xA2E8 0xFF3A # FULLWIDTH LATIN CAPITAL LETTER Z
+0xA2E9 0xFF41 # FULLWIDTH LATIN SMALL LETTER A
+0xA2EA 0xFF42 # FULLWIDTH LATIN SMALL LETTER B
+0xA2EB 0xFF43 # FULLWIDTH LATIN SMALL LETTER C
+0xA2EC 0xFF44 # FULLWIDTH LATIN SMALL LETTER D
+0xA2ED 0xFF45 # FULLWIDTH LATIN SMALL LETTER E
+0xA2EE 0xFF46 # FULLWIDTH LATIN SMALL LETTER F
+0xA2EF 0xFF47 # FULLWIDTH LATIN SMALL LETTER G
+0xA2F0 0xFF48 # FULLWIDTH LATIN SMALL LETTER H
+0xA2F1 0xFF49 # FULLWIDTH LATIN SMALL LETTER I
+0xA2F2 0xFF4A # FULLWIDTH LATIN SMALL LETTER J
+0xA2F3 0xFF4B # FULLWIDTH LATIN SMALL LETTER K
+0xA2F4 0xFF4C # FULLWIDTH LATIN SMALL LETTER L
+0xA2F5 0xFF4D # FULLWIDTH LATIN SMALL LETTER M
+0xA2F6 0xFF4E # FULLWIDTH LATIN SMALL LETTER N
+0xA2F7 0xFF4F # FULLWIDTH LATIN SMALL LETTER O
+0xA2F8 0xFF50 # FULLWIDTH LATIN SMALL LETTER P
+0xA2F9 0xFF51 # FULLWIDTH LATIN SMALL LETTER Q
+0xA2FA 0xFF52 # FULLWIDTH LATIN SMALL LETTER R
+0xA2FB 0xFF53 # FULLWIDTH LATIN SMALL LETTER S
+0xA2FC 0xFF54 # FULLWIDTH LATIN SMALL LETTER T
+0xA2FD 0xFF55 # FULLWIDTH LATIN SMALL LETTER U
+0xA2FE 0xFF56 # FULLWIDTH LATIN SMALL LETTER V
+0xA340 0xFF57 # FULLWIDTH LATIN SMALL LETTER W
+0xA341 0xFF58 # FULLWIDTH LATIN SMALL LETTER X
+0xA342 0xFF59 # FULLWIDTH LATIN SMALL LETTER Y
+0xA343 0xFF5A # FULLWIDTH LATIN SMALL LETTER Z
+0xA344 0x0391 # GREEK CAPITAL LETTER ALPHA
+0xA345 0x0392 # GREEK CAPITAL LETTER BETA
+0xA346 0x0393 # GREEK CAPITAL LETTER GAMMA
+0xA347 0x0394 # GREEK CAPITAL LETTER DELTA
+0xA348 0x0395 # GREEK CAPITAL LETTER EPSILON
+0xA349 0x0396 # GREEK CAPITAL LETTER ZETA
+0xA34A 0x0397 # GREEK CAPITAL LETTER ETA
+0xA34B 0x0398 # GREEK CAPITAL LETTER THETA
+0xA34C 0x0399 # GREEK CAPITAL LETTER IOTA
+0xA34D 0x039A # GREEK CAPITAL LETTER KAPPA
+0xA34E 0x039B # GREEK CAPITAL LETTER LAMDA
+0xA34F 0x039C # GREEK CAPITAL LETTER MU
+0xA350 0x039D # GREEK CAPITAL LETTER NU
+0xA351 0x039E # GREEK CAPITAL LETTER XI
+0xA352 0x039F # GREEK CAPITAL LETTER OMICRON
+0xA353 0x03A0 # GREEK CAPITAL LETTER PI
+0xA354 0x03A1 # GREEK CAPITAL LETTER RHO
+0xA355 0x03A3 # GREEK CAPITAL LETTER SIGMA
+0xA356 0x03A4 # GREEK CAPITAL LETTER TAU
+0xA357 0x03A5 # GREEK CAPITAL LETTER UPSILON
+0xA358 0x03A6 # GREEK CAPITAL LETTER PHI
+0xA359 0x03A7 # GREEK CAPITAL LETTER CHI
+0xA35A 0x03A8 # GREEK CAPITAL LETTER PSI
+0xA35B 0x03A9 # GREEK CAPITAL LETTER OMEGA
+0xA35C 0x03B1 # GREEK SMALL LETTER ALPHA
+0xA35D 0x03B2 # GREEK SMALL LETTER BETA
+0xA35E 0x03B3 # GREEK SMALL LETTER GAMMA
+0xA35F 0x03B4 # GREEK SMALL LETTER DELTA
+0xA360 0x03B5 # GREEK SMALL LETTER EPSILON
+0xA361 0x03B6 # GREEK SMALL LETTER ZETA
+0xA362 0x03B7 # GREEK SMALL LETTER ETA
+0xA363 0x03B8 # GREEK SMALL LETTER THETA
+0xA364 0x03B9 # GREEK SMALL LETTER IOTA
+0xA365 0x03BA # GREEK SMALL LETTER KAPPA
+0xA366 0x03BB # GREEK SMALL LETTER LAMDA
+0xA367 0x03BC # GREEK SMALL LETTER MU
+0xA368 0x03BD # GREEK SMALL LETTER NU
+0xA369 0x03BE # GREEK SMALL LETTER XI
+0xA36A 0x03BF # GREEK SMALL LETTER OMICRON
+0xA36B 0x03C0 # GREEK SMALL LETTER PI
+0xA36C 0x03C1 # GREEK SMALL LETTER RHO
+0xA36D 0x03C3 # GREEK SMALL LETTER SIGMA
+0xA36E 0x03C4 # GREEK SMALL LETTER TAU
+0xA36F 0x03C5 # GREEK SMALL LETTER UPSILON
+0xA370 0x03C6 # GREEK SMALL LETTER PHI
+0xA371 0x03C7 # GREEK SMALL LETTER CHI
+0xA372 0x03C8 # GREEK SMALL LETTER PSI
+0xA373 0x03C9 # GREEK SMALL LETTER OMEGA
+0xA374 0x3105 # BOPOMOFO LETTER B
+0xA375 0x3106 # BOPOMOFO LETTER P
+0xA376 0x3107 # BOPOMOFO LETTER M
+0xA377 0x3108 # BOPOMOFO LETTER F
+0xA378 0x3109 # BOPOMOFO LETTER D
+0xA379 0x310A # BOPOMOFO LETTER T
+0xA37A 0x310B # BOPOMOFO LETTER N
+0xA37B 0x310C # BOPOMOFO LETTER L
+0xA37C 0x310D # BOPOMOFO LETTER G
+0xA37D 0x310E # BOPOMOFO LETTER K
+0xA37E 0x310F # BOPOMOFO LETTER H
+0xA3A1 0x3110 # BOPOMOFO LETTER J
+0xA3A2 0x3111 # BOPOMOFO LETTER Q
+0xA3A3 0x3112 # BOPOMOFO LETTER X
+0xA3A4 0x3113 # BOPOMOFO LETTER ZH
+0xA3A5 0x3114 # BOPOMOFO LETTER CH
+0xA3A6 0x3115 # BOPOMOFO LETTER SH
+0xA3A7 0x3116 # BOPOMOFO LETTER R
+0xA3A8 0x3117 # BOPOMOFO LETTER Z
+0xA3A9 0x3118 # BOPOMOFO LETTER C
+0xA3AA 0x3119 # BOPOMOFO LETTER S
+0xA3AB 0x311A # BOPOMOFO LETTER A
+0xA3AC 0x311B # BOPOMOFO LETTER O
+0xA3AD 0x311C # BOPOMOFO LETTER E
+0xA3AE 0x311D # BOPOMOFO LETTER EH
+0xA3AF 0x311E # BOPOMOFO LETTER AI
+0xA3B0 0x311F # BOPOMOFO LETTER EI
+0xA3B1 0x3120 # BOPOMOFO LETTER AU
+0xA3B2 0x3121 # BOPOMOFO LETTER OU
+0xA3B3 0x3122 # BOPOMOFO LETTER AN
+0xA3B4 0x3123 # BOPOMOFO LETTER EN
+0xA3B5 0x3124 # BOPOMOFO LETTER ANG
+0xA3B6 0x3125 # BOPOMOFO LETTER ENG
+0xA3B7 0x3126 # BOPOMOFO LETTER ER
+0xA3B8 0x3127 # BOPOMOFO LETTER I
+0xA3B9 0x3128 # BOPOMOFO LETTER U
+0xA3BA 0x3129 # BOPOMOFO LETTER IU
+0xA3BB 0x02D9 # DOT ABOVE (Mandarin Chinese light tone)
+0xA3BC 0x02C9 # MODIFIER LETTER MACRON (Mandarin Chinese first tone)
+0xA3BD 0x02CA # MODIFIER LETTER ACUTE ACCENT (Mandarin Chinese second tone)
+0xA3BE 0x02C7 # CARON (Mandarin Chinese third tone)
+0xA3BF 0x02CB # MODIFIER LETTER GRAVE ACCENT (Mandarin Chinese fourth tone)
+0xA440 0x4E00 #
+0xA441 0x4E59 #
+0xA442 0x4E01 #
+0xA443 0x4E03 #
+0xA444 0x4E43 #
+0xA445 0x4E5D #
+0xA446 0x4E86 #
+0xA447 0x4E8C #
+0xA448 0x4EBA #
+0xA449 0x513F #
+0xA44A 0x5165 #
+0xA44B 0x516B #
+0xA44C 0x51E0 #
+0xA44D 0x5200 #
+0xA44E 0x5201 #
+0xA44F 0x529B #
+0xA450 0x5315 #
+0xA452 0x535C #
+0xA453 0x53C8 #
+0xA454 0x4E09 #
+0xA455 0x4E0B #
+0xA456 0x4E08 #
+0xA457 0x4E0A #
+0xA458 0x4E2B #
+0xA459 0x4E38 #
+0xA45A 0x51E1 #
+0xA45B 0x4E45 #
+0xA45C 0x4E48 #
+0xA45D 0x4E5F #
+0xA45E 0x4E5E #
+0xA45F 0x4E8E #
+0xA460 0x4EA1 #
+0xA461 0x5140 #
+0xA462 0x5203 #
+0xA463 0x52FA #
+0xA464 0x5343 #
+0xA465 0x53C9 #
+0xA466 0x53E3 #
+0xA467 0x571F #
+0xA468 0x58EB #
+0xA469 0x5915 #
+0xA46A 0x5927 #
+0xA46B 0x5973 #
+0xA46C 0x5B50 #
+0xA46D 0x5B51 #
+0xA46E 0x5B53 #
+0xA46F 0x5BF8 #
+0xA470 0x5C0F #
+0xA471 0x5C22 #
+0xA472 0x5C38 #
+0xA473 0x5C71 #
+0xA474 0x5DDD #
+0xA475 0x5DE5 #
+0xA476 0x5DF1 #
+0xA477 0x5DF2 #
+0xA478 0x5DF3 #
+0xA479 0x5DFE #
+0xA47A 0x5E72 #
+0xA47B 0x5EFE #
+0xA47C 0x5F0B #
+0xA47D 0x5F13 #
+0xA47E 0x624D #
+0xA4A1 0x4E11 #
+0xA4A2 0x4E10 #
+0xA4A3 0x4E0D #
+0xA4A4 0x4E2D #
+0xA4A5 0x4E30 #
+0xA4A6 0x4E39 #
+0xA4A7 0x4E4B #
+0xA4A8 0x5C39 #
+0xA4A9 0x4E88 #
+0xA4AA 0x4E91 #
+0xA4AB 0x4E95 #
+0xA4AC 0x4E92 #
+0xA4AD 0x4E94 #
+0xA4AE 0x4EA2 #
+0xA4AF 0x4EC1 #
+0xA4B0 0x4EC0 #
+0xA4B1 0x4EC3 #
+0xA4B2 0x4EC6 #
+0xA4B3 0x4EC7 #