--- a/jdk/make/lib/Awt2dLibraries.gmk Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/make/lib/Awt2dLibraries.gmk Thu Dec 03 11:56:10 2015 -0800
@@ -622,9 +622,8 @@
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
endif
-ifndef OPENJDK
- LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
-endif
+# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
+LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
--- a/jdk/make/src/classes/build/tools/cldrconverter/ResourceBundleGenerator.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/make/src/classes/build/tools/cldrconverter/ResourceBundleGenerator.java Thu Dec 03 11:56:10 2015 -0800
@@ -62,6 +62,7 @@
"Asia/Tokyo",
"Europe/Bucharest",
"Asia/Shanghai",
+ "UTC",
};
// For duplicated values
@@ -136,7 +137,7 @@
for (String preferred : preferredTZIDs) {
if (map.containsKey(preferred)) {
newMap.put(preferred, map.remove(preferred));
- } else if ("GMT".equals(preferred) &&
+ } else if (("GMT".equals(preferred) || "UTC".equals(preferred)) &&
metaKeys.contains(CLDRConverter.METAZONE_ID_PREFIX+preferred)) {
newMap.put(preferred, preferred);
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Dec 03 11:56:10 2015 -0800
@@ -1276,10 +1276,10 @@
/**
* Generate bytecode for a LambdaForm.vmentry which calls interpretWithArguments.
*/
- static MemberName generateLambdaFormInterpreterEntryPoint(String sig) {
- assert(isValidSignature(sig));
- String name = "interpret_"+signatureReturn(sig).basicTypeChar();
- MethodType type = signatureType(sig); // sig includes leading argument
+ static MemberName generateLambdaFormInterpreterEntryPoint(MethodType mt) {
+ assert(isValidSignature(basicTypeSignature(mt)));
+ String name = "interpret_"+basicTypeChar(mt.returnType());
+ MethodType type = mt; // includes leading argument
type = type.changeParameterType(0, MethodHandle.class);
InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("LFI", name, type);
return g.loadMethod(g.generateLambdaFormInterpreterEntryPointBytes());
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java Thu Dec 03 11:56:10 2015 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -288,32 +288,28 @@
return names;
}
- private LambdaForm(String sig) {
+ private LambdaForm(MethodType mt) {
// Make a blank lambda form, which returns a constant zero or null.
// It is used as a template for managing the invocation of similar forms that are non-empty.
// Called only from getPreparedForm.
- assert(isValidSignature(sig));
- this.arity = signatureArity(sig);
- this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity);
- this.names = buildEmptyNames(arity, sig);
+ this.arity = mt.parameterCount();
+ this.result = (mt.returnType() == void.class || mt.returnType() == Void.class) ? -1 : arity;
+ this.names = buildEmptyNames(arity, mt, result == -1);
this.debugName = "LF.zero";
this.forceInline = true;
this.customized = null;
assert(nameRefsAreLegal());
assert(isEmpty());
+ String sig = null;
+ assert(isValidSignature(sig = basicTypeSignature()));
assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature();
}
- private static Name[] buildEmptyNames(int arity, String basicTypeSignature) {
- assert(isValidSignature(basicTypeSignature));
- int resultPos = arity + 1; // skip '_'
- if (arity < 0 || basicTypeSignature.length() != resultPos+1)
- throw new IllegalArgumentException("bad arity for "+basicTypeSignature);
- int numRes = (basicType(basicTypeSignature.charAt(resultPos)) == V_TYPE ? 0 : 1);
- Name[] names = arguments(numRes, basicTypeSignature.substring(0, arity));
- for (int i = 0; i < numRes; i++) {
- Name zero = new Name(constantZero(basicType(basicTypeSignature.charAt(resultPos + i))));
- names[arity + i] = zero.newIndex(arity + i);
+ private static Name[] buildEmptyNames(int arity, MethodType mt, boolean isVoid) {
+ Name[] names = arguments(isVoid ? 0 : 1, mt);
+ if (!isVoid) {
+ Name zero = new Name(constantZero(basicType(mt.returnType())));
+ names[arity] = zero.newIndex(arity);
}
return names;
}
@@ -520,8 +516,13 @@
/** Return the method type corresponding to my basic type signature. */
MethodType methodType() {
- return signatureType(basicTypeSignature());
+ Class<?>[] ptypes = new Class<?>[arity];
+ for (int i = 0; i < arity; ++i) {
+ ptypes[i] = parameterType(i).btClass;
+ }
+ return MethodType.methodType(returnType().btClass, ptypes);
}
+
/** Return ABC_Z, where the ABC are parameter type characters, and Z is the return type character. */
final String basicTypeSignature() {
StringBuilder buf = new StringBuilder(arity() + 3);
@@ -633,7 +634,14 @@
// already prepared (e.g., a primitive DMH invoker form)
return;
}
- LambdaForm prep = getPreparedForm(basicTypeSignature());
+ MethodType mtype = methodType();
+ LambdaForm prep = mtype.form().cachedLambdaForm(MethodTypeForm.LF_INTERPRET);
+ if (prep == null) {
+ assert (isValidSignature(basicTypeSignature()));
+ prep = new LambdaForm(mtype);
+ prep.vmentry = InvokerBytecodeGenerator.generateLambdaFormInterpreterEntryPoint(mtype);
+ prep = mtype.form().setCachedLambdaForm(MethodTypeForm.LF_INTERPRET, prep);
+ }
this.vmentry = prep.vmentry;
// TO DO: Maybe add invokeGeneric, invokeWithArguments
}
@@ -664,9 +672,10 @@
if (mt.parameterCount() > 0 &&
mt.parameterType(0) == MethodHandle.class &&
m.getName().startsWith("interpret_")) {
- String sig = basicTypeSignature(mt);
- assert(m.getName().equals("interpret" + sig.substring(sig.indexOf('_'))));
- LambdaForm form = new LambdaForm(sig);
+ String sig = null;
+ assert((sig = basicTypeSignature(mt)) != null &&
+ m.getName().equals("interpret" + sig.substring(sig.indexOf('_'))));
+ LambdaForm form = new LambdaForm(mt);
form.vmentry = m;
form = mt.form().setCachedLambdaForm(MethodTypeForm.LF_INTERPRET, form);
}
@@ -702,15 +711,6 @@
assert(returnTypesMatch(sig, av, res));
return res;
}
- private static LambdaForm getPreparedForm(String sig) {
- MethodType mtype = signatureType(sig);
- LambdaForm prep = mtype.form().cachedLambdaForm(MethodTypeForm.LF_INTERPRET);
- if (prep != null) return prep;
- assert(isValidSignature(sig));
- prep = new LambdaForm(sig);
- prep.vmentry = InvokerBytecodeGenerator.generateLambdaFormInterpreterEntryPoint(sig);
- return mtype.form().setCachedLambdaForm(MethodTypeForm.LF_INTERPRET, prep);
- }
// The next few routines are called only from assert expressions
// They verify that the built-in invokers process the correct raw data types.
@@ -1558,13 +1558,6 @@
if (n.constraint != null) return n;
return argument(n.index, n.type);
}
- static Name[] arguments(int extra, String types) {
- int length = types.length();
- Name[] names = new Name[length + extra];
- for (int i = 0; i < length; i++)
- names[i] = argument(i, basicType(types.charAt(i)));
- return names;
- }
static Name[] arguments(int extra, MethodType types) {
int length = types.parameterCount();
Name[] names = new Name[length + extra];
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Dec 03 11:56:10 2015 -0800
@@ -3463,7 +3463,7 @@
* return zip;
* }
* // assume MH_initZip, MH_zipPred, and MH_zipStep are handles to the above methods
- * MethodHandle loop = MethodHandles.doWhileLoop(MH_initZip, MH_zipPred, MH_zipStep);
+ * MethodHandle loop = MethodHandles.doWhileLoop(MH_initZip, MH_zipStep, MH_zipPred);
* List<String> a = Arrays.asList("a", "b", "c", "d");
* List<String> b = Arrays.asList("e", "f", "g", "h");
* List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");
@@ -3602,7 +3602,8 @@
* String start(String arg) { return arg; }
* String step(int counter, String v, String arg) { return "na " + v; }
* // assume MH_start and MH_step are handles to the two methods above
- * MethodHandle loop = MethodHandles.countedLoop(13, MH_start, MH_step);
+ * MethodHandle fit13 = MethodHandles.constant(int.class, 13);
+ * MethodHandle loop = MethodHandles.countedLoop(fit13, MH_start, MH_step);
* assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
* }</pre></blockquote>
*
@@ -3742,11 +3743,11 @@
* @apiNote Example:
* <blockquote><pre>{@code
* // reverse a list
- * List<String> reverseStep(String e, List<String> r) {
+ * List<String> reverseStep(String e, List<String> r, List<String> l) {
* r.add(0, e);
* return r;
* }
- * List<String> newArrayList() { return new ArrayList<>(); }
+ * List<String> newArrayList(List<String> l) { return new ArrayList<>(); }
* // assume MH_reverseStep, MH_newArrayList are handles to the above methods
* MethodHandle loop = MethodHandles.iteratedLoop(null, MH_newArrayList, MH_reverseStep);
* List<String> list = Arrays.asList("a", "b", "c", "d", "e");
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java Thu Dec 03 11:56:10 2015 -0800
@@ -389,9 +389,9 @@
} else {
if (msgSupplier != null) {
if (thrown != null) {
- logger.log(platformLevel, sourceClass, sourceMethod, thrown, msgSupplier);
+ logger.logp(platformLevel, sourceClass, sourceMethod, thrown, msgSupplier);
} else {
- logger.log(platformLevel,sourceClass, sourceMethod, msgSupplier);
+ logger.logp(platformLevel, sourceClass, sourceMethod, msgSupplier);
}
} else {
// BootstrapLoggers are never localized so we can safely
--- a/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java Thu Dec 03 11:56:10 2015 -0800
@@ -307,6 +307,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/BR/TimeZoneNames_pt_BR.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/BR/TimeZoneNames_pt_BR.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/CN/TimeZoneNames_zh_CN.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/CN/TimeZoneNames_zh_CN.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1034,7 +1035,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TW/TimeZoneNames_zh_TW.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TW/TimeZoneNames_zh_TW.java Thu Dec 03 11:56:10 2015 -0800
@@ -308,6 +308,7 @@
{"Europe/Bucharest", EET},
{"Asia/Shanghai", CTT},
{"CTT", CTT},
+ {"UTC", UTC},
/* Don't change the order of the above zones
* to keep compatibility with the previous version.
*/
@@ -1036,7 +1037,6 @@
{"US/Pacific", PST},
{"US/Pacific-New", PST},
{"US/Samoa", SAMOA},
- {"UTC", UTC},
{"VST", ICT},
{"W-SU", MSK},
{"WET", WET},
--- a/jdk/test/com/sun/crypto/provider/Cipher/KeyWrap/XMLEncKAT.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/com/sun/crypto/provider/Cipher/KeyWrap/XMLEncKAT.java Thu Dec 03 11:56:10 2015 -0800
@@ -26,16 +26,14 @@
* @bug 5008159 5008156
* @summary Verify that the two key wrap ciphers, i.e. "DESedeWrap"
* and "AESWrap", work as expected.
- * @modules java.base/sun.misc
* @run main XMLEncKAT
* @author Valerie Peng
*/
+import java.util.Base64;
import java.security.Key;
import java.security.AlgorithmParameters;
import javax.crypto.*;
import javax.crypto.spec.*;
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
@@ -50,8 +48,8 @@
private static byte[] aes192Key_2;
private static byte[] aes256Key_2;
- private static BASE64Decoder base64D = new BASE64Decoder();
- private static BASE64Encoder base64E = new BASE64Encoder();
+ private static Base64.Decoder base64D = Base64.getDecoder();
+ private static Base64.Encoder base64E = Base64.getEncoder();
static {
try {
@@ -62,18 +60,16 @@
} catch (UnsupportedEncodingException uee) {
// should never happen
}
- try {
- desEdeKey_2 = base64D.decodeBuffer
- ("yI+J1f3puYAERjIcT6vfg6RitmKX8nD0");
- aes128Key_2 = base64D.decodeBuffer
- ("01+yuQ2huPS1+Qv0LH+zaQ==");
- aes192Key_2 = base64D.decodeBuffer
- ("IlfuS40LvStVU0Mj8ePrrGHVhAb48y++");
- aes256Key_2 = base64D.decodeBuffer
- ("ZhZ4v3RlwTlCEOpIrHfLKVyJOBDtEJOOQDat/4xR1bA=");
- } catch (IOException ioe) {
- // should never happen
- }
+
+ desEdeKey_2 = base64D.decode
+ ("yI+J1f3puYAERjIcT6vfg6RitmKX8nD0");
+ aes128Key_2 = base64D.decode
+ ("01+yuQ2huPS1+Qv0LH+zaQ==");
+ aes192Key_2 = base64D.decode
+ ("IlfuS40LvStVU0Mj8ePrrGHVhAb48y++");
+ aes256Key_2 = base64D.decode
+ ("ZhZ4v3RlwTlCEOpIrHfLKVyJOBDtEJOOQDat/4xR1bA=");
+
}
private static String[] desEdeWrappedKey_1 = {
"ZyJbVsjRM4MEsswwwHz57aUz1eMqZHuEIoEPGS47CcmLvhuCtlzWZ9S/WcVJZIpz",
@@ -123,7 +119,7 @@
new IvParameterSpec[base64Wrapped.length];
// first test UNWRAP with known values
for (int i = 0; i < base64Wrapped.length; i++) {
- byte[] wrappedKey = base64D.decodeBuffer(base64Wrapped[i]);
+ byte[] wrappedKey = base64D.decode(base64Wrapped[i]);
key[i] = c.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY);
if (c.getIV() != null) {
params[i] = new IvParameterSpec(c.getIV());
@@ -133,7 +129,7 @@
for (int i = 0; i < key.length; i++) {
c.init(Cipher.WRAP_MODE, cKey, params[i]);
byte[] wrapped2 = c.wrap(key[i]);
- String out = base64E.encode(wrapped2);
+ String out = base64E.encodeToString(wrapped2);
if (!out.equalsIgnoreCase(base64Wrapped[i])) {
throw new Exception("Wrap failed; got " + out + ", expect " +
base64Wrapped[i]);
--- a/jdk/test/com/sun/jndi/ldap/Base64Test.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/com/sun/jndi/ldap/Base64Test.java Thu Dec 03 11:56:10 2015 -0800
@@ -25,7 +25,6 @@
* @test
* @bug 8035807
* @summary Confirm that old and new Base64 encodings are compatible.
- * @modules java.base/sun.misc
*/
import java.io.*;
@@ -33,8 +32,6 @@
import javax.naming.*;
import javax.naming.directory.*;
-import sun.misc.BASE64Decoder;
-
/*
* RFC 2713 specifies an encoding for Java objects stored in an LDAP directory.
* Section 3.6 specifies how a binary-valued JNDI RefAddr object is encoded
@@ -48,12 +45,10 @@
* as the line separator. It is a compatible change.
*
* This test demonstrates that there is no compatability problem when
- * encoding and decoding using either Base64 coder:
+ * decoding using the new Base64 coder:
*
- * encode with s.m.BASE64Encoder, decode with s.m.BASE64Decoder => OK
- * encode with s.m.BASE64Encoder, decode with j.u.Base64.Decoder => OK
- * encode with j.u.Base64.Encoder, decode with s.m.BASE64Decoder => OK
- * encode with j.u.Base64.Encoder, decode with j.u.Base64.Decoder => OK
+ * encoded bytes captured from s.m.BASE64Encoder, decode with j.u.Base64.Decoder => OK
+ * encoded bytes captured from j.u.Base64.Encoder, decode with j.u.Base64.Decoder => OK
*
*
* NOTE: The two Base64 encodings used in this test were captured from
@@ -148,25 +143,9 @@
System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
System.out.println("Old Base64 encoded serialized RefAddr object:\n" +
- OLD_ENCODING);
- System.out.println("Decode using old Base64 decoder...");
- deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
-
- System.out.println("----");
-
- System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
- System.out.println("Old Base64 encoded serialized RefAddr object:\n" +
- OLD_ENCODING);
+ OLD_ENCODING + "\n");
System.out.println("Decode using new Base64 decoder...");
- deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
-
- System.out.println("----");
-
- System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
- System.out.println("New Base64 encoded serialized RefAddr object:\n" +
- NEW_ENCODING + "\n");
- System.out.println("Decode using old Base64 decoder...");
- deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
+ deserialize(Base64.getMimeDecoder().decode(OLD_ENCODING));
System.out.println("----");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java Thu Dec 03 11:56:10 2015 -0800
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.PrintStream;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import jdk.internal.logger.BootstrapLogger;
+import jdk.internal.logger.LazyLoggers;
+
+/*
+ * @test
+ * @bug 8144460 8144214
+ * @summary Cover the logXX and LogEvent.valueOf APIs of BootstrapLogger
+ * and logXX APIs of SimpleConsoleLogger.
+ * @modules java.base/jdk.internal.logger
+ * @build BootstrapLoggerUtils LogStream
+ * @run main/othervm BootstrapLoggerAPIsTest
+ */
+
+public class BootstrapLoggerAPIsTest {
+
+ private static final LogStream ERR = new LogStream();
+
+ public static void main(String[] args) throws Exception {
+
+ final ContentManager MGR = new ContentManager();
+
+ // private reflection hook that allows us to simulate a non booted VM
+ final AtomicBoolean VM_BOOTED = new AtomicBoolean(false);
+
+ BootstrapLoggerUtils.setBootedHook(() -> VM_BOOTED.get());
+
+ // We replace System.err to check the messages that have been logged
+ // by the JUL ConsoleHandler and default SimpleConsoleLogger
+ // implementaion
+ System.setErr(new PrintStream(ERR));
+
+ VM_BOOTED.getAndSet(false);
+ if (BootstrapLogger.isBooted()) {
+ throw new RuntimeException("VM should not be booted!");
+ }
+
+ final Logger LOGGER =
+ LazyLoggers.getLogger("foo.bar", Thread.class);
+ final sun.util.logging.PlatformLogger.Level PLATFORM_LEVEL =
+ sun.util.logging.PlatformLogger.Level.SEVERE;
+ final MyResources BUNDLE = new MyResources();
+
+ /*
+ * Test logXX APIs for interface java.lang.System.Logger. Log content
+ * before VM is booted should be retained. Log content after VM was
+ * booted should be flushed instantly. VM is not booted in first round
+ * of loop, VM is booted in second round of loop.
+ */
+ for (int i = 0; i < 2; i++) {
+ boolean booted = BootstrapLogger.isBooted();
+
+ // make sure there is no [remaining] content in the LogStream.
+ MGR.failLog("xyz", "throwable #", "MyClass_#", "MyMethod_#");
+
+ /*
+ * test logXX APIs for interface java.lang.System.Logger.
+ */
+ // void log(java.lang.System$Logger$Level,java.util.ResourceBundle,
+ // java.lang.String,java.lang.Throwable)
+ LOGGER.log(Level.ERROR, BUNDLE, "abc #0", new RuntimeException("throwable #0"));
+ MGR.checkLog(booted, "xyz #0", "throwable #0");
+
+ // void log(java.lang.System$Logger$Level,java.util.ResourceBundle,
+ // java.lang.String,java.lang.Object[])
+ LOGGER.log(Level.ERROR, BUNDLE, "abc #1");
+ MGR.checkLog(booted, "xyz #1");
+
+ // void log(java.lang.System$Logger$Level,java.lang.String,java.lang.Object[])
+ LOGGER.log(Level.ERROR, BUNDLE, "abc {0}", "#2");
+ MGR.checkLog(booted, "xyz #2");
+
+ // void log(java.lang.System$Logger$Level,java.lang.String,java.lang.Throwable)
+ LOGGER.log(Level.ERROR, "xyz #3", new RuntimeException("throwable #3"));
+ MGR.checkLog(booted, "xyz #3", "throwable #3");
+
+ // void log(java.lang.System$Logger$Level,java.util.function.Supplier)
+ LOGGER.log(Level.ERROR, () -> "xyz #4");
+ MGR.checkLog(booted, "xyz #4");
+
+ // void log(java.lang.System$Logger$Level,java.lang.Object)
+ LOGGER.log(Level.ERROR, new MyObject("xyz #5"));
+ MGR.checkLog(booted, "xyz #5");
+
+ // void log(java.lang.System$Logger$Level,java.util.function.Supplier,
+ // java.lang.Throwable)
+ LOGGER.log(Level.ERROR, () -> "xyz #6", new RuntimeException("throwable #6"));
+ MGR.checkLog(booted, "xyz #6", "throwable #6");
+
+
+ /*
+ * test logXX APIs for interface
+ * sun.util.logging.PlatformLogger.Bridge.
+ */
+ sun.util.logging.PlatformLogger.Bridge bridge =
+ (sun.util.logging.PlatformLogger.Bridge) LOGGER;
+
+ // void log(sun.util.logging.PlatformLogger$Level,java.lang.String)
+ bridge.log(PLATFORM_LEVEL, "xyz #7");
+ MGR.checkLog(booted, "xyz #7");
+
+ // void log(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.Throwable)
+ bridge.log(PLATFORM_LEVEL, "xyz #8", new RuntimeException("throwable #8"));
+ MGR.checkLog(booted, "xyz #8", "throwable #8");
+
+ // void log(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.Object[])
+ bridge.log(PLATFORM_LEVEL, "xyz {0}", "#9");
+ MGR.checkLog(booted, "xyz #9");
+
+ // void log(sun.util.logging.PlatformLogger$Level,java.util.function.Supplier)
+ bridge.log(PLATFORM_LEVEL, () -> "xyz #10");
+ MGR.checkLog(booted, "xyz #10");
+
+ // void log(sun.util.logging.PlatformLogger$Level,
+ // java.lang.Throwable,java.util.function.Supplier)
+ bridge.log(PLATFORM_LEVEL, new RuntimeException("throwable #11"), () -> "xyz #11");
+ MGR.checkLog(booted, "xyz #11", "throwable #11");
+
+ // void logp(sun.util.logging.PlatformLogger$Level,java.lang.String,
+ // java.lang.String,java.lang.String)
+ bridge.logp(PLATFORM_LEVEL, "MyClass_#12", "MyMethod_#12", "xyz #12");
+ MGR.checkLog(booted, "xyz #12", "MyClass_#12", "MyMethod_#12");
+
+ // void logp(sun.util.logging.PlatformLogger$Level,java.lang.String,
+ // java.lang.String,java.util.function.Supplier)
+ bridge.logp(PLATFORM_LEVEL, "MyClass_#13", "MyMethod_#13", () -> "xyz #13");
+ MGR.checkLog(booted, "xyz #13", "MyClass_#13", "MyMethod_#13");
+
+ // void logp(sun.util.logging.PlatformLogger$Level,java.lang.String,
+ // java.lang.String,java.lang.String,java.lang.Object[])
+ bridge.logp(PLATFORM_LEVEL, "MyClass_#14", "MyMethod_#14", "xyz {0}", "#14");
+ MGR.checkLog(booted, "xyz #14", "MyClass_#14", "MyMethod_#14");
+
+ // void logp(sun.util.logging.PlatformLogger$Level,java.lang.String,
+ // java.lang.String,java.lang.String,java.lang.Throwable)
+ bridge.logp(PLATFORM_LEVEL, "MyClass_#15", "MyMethod_#15",
+ "xyz #15", new RuntimeException("throwable #15"));
+ MGR.checkLog(booted, "xyz #15", "throwable #15", "MyClass_#15", "MyMethod_#15");
+
+ // void logp(sun.util.logging.PlatformLogger$Level,java.lang.String,
+ // java.lang.String,java.lang.Throwable,java.util.function.Supplier)
+ bridge.logp(PLATFORM_LEVEL, "MyClass_#16", "MyMethod_#16",
+ new RuntimeException("throwable #16"), () -> "xyz #16");
+ MGR.checkLog(booted, "xyz #16", "throwable #16", "MyClass_#16", "MyMethod_#16");
+
+ // void logrb(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.String,
+ // java.util.ResourceBundle,java.lang.String,java.lang.Object[])
+ bridge.logrb(PLATFORM_LEVEL, "MyClass_#17", "MyMethod_#17",
+ BUNDLE, "abc {0}", "#17");
+ MGR.checkLog(booted, "xyz #17", "MyClass_#17", "MyMethod_#17");
+
+ // void logrb(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.String,
+ // java.util.ResourceBundle,java.lang.String,java.lang.Throwable)
+ bridge.logrb(PLATFORM_LEVEL, "MyClass_#18", "MyMethod_#18",
+ BUNDLE, "abc #18", new RuntimeException("throwable #18"));
+ MGR.checkLog(booted, "xyz #18", "throwable #18", "MyClass_#18", "MyMethod_#18");
+
+ // void logrb(sun.util.logging.PlatformLogger$Level,java.util.ResourceBundle,
+ // java.lang.String,java.lang.Object[])
+ bridge.logrb(PLATFORM_LEVEL, BUNDLE, "abc {0}", "#19");
+ MGR.checkLog(booted, "xyz #19");
+
+ // void logrb(sun.util.logging.PlatformLogger$Level,java.util.ResourceBundle,
+ // java.lang.String,java.lang.Throwable)
+ bridge.logrb(PLATFORM_LEVEL, BUNDLE, "abc #20",
+ new RuntimeException("throwable #20"));
+ MGR.checkLog(booted, "xyz #20", "throwable #20");
+
+ /*
+ * retained log content should be flushed after VM is booted.
+ */
+ if (!booted) {
+ VM_BOOTED.getAndSet(true);
+ // trigger the flush, make sure to call LOGGER.log(...)
+ // after VM_BOOTED.getAndSet(true) and before MGR.assertCachedLog()
+ LOGGER.log(Level.ERROR, "VM was just booted! This log should flush the cached logs.");
+ MGR.assertCachedLog();
+ }
+ }
+ }
+
+ private static class ContentManager {
+ final List<String[]> cached = new ArrayList<String[]>();
+ String[] last;
+
+ public void cache() {
+ cached.add(last);
+ }
+
+ public ContentManager failLog(String... nonexistent) {
+ last = nonexistent;
+ for (String c : nonexistent) {
+ if (ERR.drain().contains(c)) {
+ throw new RuntimeException("Content \"" + nonexistent
+ + "\" should not exist in the log!");
+ }
+ }
+ return this;
+ }
+
+ public void assertLog(String... logs) {
+ String log = ERR.drain();
+ for (String str : logs) {
+ if (!log.contains(str)) {
+ throw new RuntimeException("Content \"" + str + "\" does not exist in the log!");
+ }
+ }
+ }
+
+ public void checkLog(boolean booted, String... logs) {
+ if (!booted) {
+ failLog(logs).cache();
+ } else {
+ assertLog(logs);
+ }
+ }
+
+ public void assertCachedLog() {
+ String log = ERR.drain();
+ for (String[] arr : cached) {
+ for (String c : arr) {
+ if (!log.contains(c)) {
+ throw new RuntimeException("Content \"" + c + "\" does not exist in the log!");
+ }
+ }
+ }
+ }
+ }
+
+ private static class MyObject {
+ String str;
+
+ public MyObject(String str) {
+ this.str = str;
+ }
+
+ public String toString() {
+ return str;
+ }
+ }
+
+ private static class MyResources extends ResourceBundle {
+ public Object handleGetObject(String key) {
+ if (key.contains("abc #") || key.contains("abc {")) {
+ return key.replaceAll("abc ", "xyz ");
+ }
+ return null;
+ }
+
+ public Enumeration<String> getKeys() {
+ return null;
+ }
+ }
+}
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java Thu Dec 03 11:56:10 2015 -0800
@@ -21,19 +21,14 @@
* questions.
*/
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
import java.io.PrintStream;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.BooleanSupplier;
+import java.lang.reflect.Method;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permission;
@@ -41,6 +36,7 @@
import java.security.Permissions;
import java.security.Policy;
import java.security.ProtectionDomain;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -56,25 +52,17 @@
Tests the behavior of bootstrap loggers (and SimpleConsoleLoggers
* too).
* @modules java.base/jdk.internal.logger
+ * @build BootstrapLoggerUtils LogStream
* @run main/othervm BootstrapLoggerTest NO_SECURITY
* @run main/othervm BootstrapLoggerTest SECURE
* @run main/othervm/timeout=120 BootstrapLoggerTest SECURE_AND_WAIT
*/
public class BootstrapLoggerTest {
- static final Method awaitPending;
static final Method isAlive;
- static final Field isBooted;
static final Field logManagerInitialized;
static {
try {
- isBooted = BootstrapLogger.class.getDeclaredField("isBooted");
- isBooted.setAccessible(true);
- // private reflection hook that allows us to test wait until all
- // the tasks pending in the BootstrapExecutor are finished.
- awaitPending = BootstrapLogger.class
- .getDeclaredMethod("awaitPendingTasks");
- awaitPending.setAccessible(true);
// private reflection hook that allows us to test whether
// the BootstrapExecutor is alive.
isAlive = BootstrapLogger.class
@@ -90,43 +78,6 @@
}
}
- static void awaitPending() {
- try {
- awaitPending.invoke(null);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
- ex.printStackTrace(LogStream.err);
- }
- }
-
- /**
- * We use an instance of this class to check what the logging system has
- * printed on System.err.
- */
- public static class LogStream extends OutputStream {
-
- final static PrintStream err = System.err;
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- public LogStream() {
- super();
- }
-
- @Override
- public synchronized void write(int b) {
- baos.write(b);
- err.write(b);
- }
-
- public String drain() {
- awaitPending();
- synchronized(this) {
- String txt = baos.toString();
- baos.reset();
- return txt;
- }
- }
- }
-
static enum TestCase {
NO_SECURITY, SECURE, SECURE_AND_WAIT
}
@@ -142,7 +93,7 @@
// private reflection hook that allows us to simulate a non booted VM
final AtomicBoolean vmBooted = new AtomicBoolean(false);
- isBooted.set(null,(BooleanSupplier) () -> vmBooted.get());
+ BootstrapLoggerUtils.setBootedHook(() -> vmBooted.get());
// We replace System.err to check the messages that have been logged
// by the JUL ConsoleHandler and default SimpleConsoleLogger
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerUtils.java Thu Dec 03 11:56:10 2015 -0800
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.function.BooleanSupplier;
+
+import jdk.internal.logger.BootstrapLogger;
+
+class BootstrapLoggerUtils {
+
+ private static final Field IS_BOOTED;
+ private static final Method AWAIT_PENDING;
+
+ static {
+ try {
+ IS_BOOTED = BootstrapLogger.class.getDeclaredField("isBooted");
+ IS_BOOTED.setAccessible(true);
+ // private reflection hook that allows us to test wait until all
+ // the tasks pending in the BootstrapExecutor are finished.
+ AWAIT_PENDING = BootstrapLogger.class.getDeclaredMethod("awaitPendingTasks");
+ AWAIT_PENDING.setAccessible(true);
+ } catch (Exception ex) {
+ throw new ExceptionInInitializerError(ex);
+ }
+ }
+
+ static void setBootedHook(BooleanSupplier supplier) throws IllegalAccessException {
+ IS_BOOTED.set(null, supplier);
+ }
+
+ static void awaitPending() {
+ try {
+ AWAIT_PENDING.invoke(null);
+ } catch (IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException ex) {
+ ex.printStackTrace();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/LogStream.java Thu Dec 03 11:56:10 2015 -0800
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import jdk.internal.logger.BootstrapLogger;
+
+/**
+ * We use an instance of this class to check what the logging system has printed
+ * on System.err.
+ */
+class LogStream extends OutputStream {
+
+ static final PrintStream err = System.err;
+
+ private final ByteArrayOutputStream BAOS = new ByteArrayOutputStream();
+
+ LogStream() {
+ super();
+ }
+
+ @Override
+ public synchronized void write(int b) {
+ BAOS.write(b);
+ err.write(b);
+ }
+
+ String drain() {
+ BootstrapLoggerUtils.awaitPending();
+ synchronized (this) {
+ String txt = BAOS.toString();
+ BAOS.reset();
+ return txt;
+ }
+ }
+}
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java Thu Dec 03 11:56:10 2015 -0800
@@ -29,6 +29,7 @@
package test.java.lang.invoke;
+import java.io.StringWriter;
import java.lang.invoke.*;
import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*;
@@ -36,7 +37,6 @@
import java.util.*;
import org.testng.*;
-import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
/**
@@ -322,6 +322,13 @@
Assert.assertEquals(exp, act);
}
+ static void assertTrue(boolean b) {
+ if (verbosity > 0) {
+ System.out.println("result: " + b);
+ }
+ Assert.assertTrue(b);
+ }
+
@Test public void testMethodHandlesSummary() throws Throwable {
{{
{} /// JAVADOC
@@ -639,6 +646,165 @@
}}
}
+ static int one(int k) { return 1; }
+ static int inc(int i, int acc, int k) { return i + 1; }
+ static int mult(int i, int acc, int k) { return i * acc; }
+ static boolean pred(int i, int acc, int k) { return i < k; }
+ static int fin(int i, int acc, int k) { return acc; }
+
+ @Test public void testLoop() throws Throwable {
+ MethodHandle MH_inc, MH_one, MH_mult, MH_pred, MH_fin;
+ Class<?> I = int.class;
+ MH_inc = LOOKUP.findStatic(THIS_CLASS, "inc", methodType(I, I, I, I));
+ MH_one = LOOKUP.findStatic(THIS_CLASS, "one", methodType(I, I));
+ MH_mult = LOOKUP.findStatic(THIS_CLASS, "mult", methodType(I, I, I, I));
+ MH_pred = LOOKUP.findStatic(THIS_CLASS, "pred", methodType(boolean.class, I, I, I));
+ MH_fin = LOOKUP.findStatic(THIS_CLASS, "fin", methodType(I, I, I, I));
+ {{
+{} /// JAVADOC
+// iterative implementation of the factorial function as a loop handle
+// null initializer for counter, should initialize to 0
+MethodHandle[] counterClause = new MethodHandle[]{null, MH_inc};
+MethodHandle[] accumulatorClause = new MethodHandle[]{MH_one, MH_mult, MH_pred, MH_fin};
+MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause);
+assertEquals(120, loop.invoke(5));
+{}
+ }}
+ }
+
+ static List<String> initZip(Iterator<String> a, Iterator<String> b) { return new ArrayList<>(); }
+ static boolean zipPred(List<String> zip, Iterator<String> a, Iterator<String> b) { return a.hasNext() && b.hasNext(); }
+ static List<String> zipStep(List<String> zip, Iterator<String> a, Iterator<String> b) {
+ zip.add(a.next());
+ zip.add(b.next());
+ return zip;
+ }
+
+ @Test public void testWhileLoop() throws Throwable {
+ MethodHandle MH_initZip, MH_zipPred, MH_zipStep;
+ Class<?> IT = Iterator.class;
+ Class<?> L = List.class;
+ MH_initZip = LOOKUP.findStatic(THIS_CLASS, "initZip", methodType(L, IT, IT));
+ MH_zipPred = LOOKUP.findStatic(THIS_CLASS, "zipPred", methodType(boolean.class, L, IT, IT));
+ MH_zipStep = LOOKUP.findStatic(THIS_CLASS, "zipStep", methodType(L, L, IT, IT));
+ {{
+{} /// JAVADOC
+// implement the zip function for lists as a loop handle
+MethodHandle loop = MethodHandles.doWhileLoop(MH_initZip, MH_zipStep, MH_zipPred);
+List<String> a = Arrays.asList("a", "b", "c", "d");
+List<String> b = Arrays.asList("e", "f", "g", "h");
+List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");
+assertEquals(zipped, (List<String>) loop.invoke(a.iterator(), b.iterator()));
+{}
+ }}
+ }
+
+ static int zero(int limit) { return 0; }
+ static int step(int i, int limit) { return i + 1; }
+ static boolean pred(int i, int limit) { return i < limit; }
+
+ @Test public void testDoWhileLoop() throws Throwable {
+ MethodHandle MH_zero, MH_step, MH_pred;
+ Class<?> I = int.class;
+ MH_zero = LOOKUP.findStatic(THIS_CLASS, "zero", methodType(I, I));
+ MH_step = LOOKUP.findStatic(THIS_CLASS, "step", methodType(I, I, I));
+ MH_pred = LOOKUP.findStatic(THIS_CLASS, "pred", methodType(boolean.class, I, I));
+ {{
+{} /// JAVADOC
+// int i = 0; while (i < limit) { ++i; } return i; => limit
+MethodHandle loop = MethodHandles.doWhileLoop(MH_zero, MH_step, MH_pred);
+assertEquals(23, loop.invoke(23));
+{}
+ }}
+ }
+
+ static String start(String arg) { return arg; }
+ static String step(int counter, String v, String arg) { return "na " + v; }
+
+ @Test public void testCountedLoop() throws Throwable {
+ MethodHandle MH_start, MH_step;
+ Class<?> S = String.class;
+ MH_start = LOOKUP.findStatic(THIS_CLASS, "start", methodType(S, S));
+ MH_step = LOOKUP.findStatic(THIS_CLASS, "step", methodType(S, int.class, S, S));
+ {{
+{} /// JAVADOC
+// String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s;
+// => a variation on a well known theme
+MethodHandle fit13 = MethodHandles.constant(int.class, 13);
+MethodHandle loop = MethodHandles.countedLoop(fit13, MH_start, MH_step);
+assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
+{}
+ }}
+ }
+
+ static List<String> reverseStep(String e, List<String> r, List<String> l) {
+ r.add(0, e);
+ return r;
+ }
+ static List<String> newArrayList(List<String> l) { return new ArrayList<>(); }
+
+ @Test public void testIteratedLoop() throws Throwable {
+ MethodHandle MH_newArrayList, MH_reverseStep;
+ Class<?> L = List.class;
+ MH_newArrayList = LOOKUP.findStatic(THIS_CLASS, "newArrayList", methodType(L, L));
+ MH_reverseStep = LOOKUP.findStatic(THIS_CLASS, "reverseStep", methodType(L, String.class, L, L));
+ {{
+{} /// JAVADOC
+// reverse a list
+MethodHandle loop = MethodHandles.iteratedLoop(null, MH_newArrayList, MH_reverseStep);
+List<String> list = Arrays.asList("a", "b", "c", "d", "e");
+List<String> reversedList = Arrays.asList("e", "d", "c", "b", "a");
+assertEquals(reversedList, (List<String>) loop.invoke(list));
+{}
+ }}
+ }
+
+ @Test public void testFoldArguments3() throws Throwable {
+ {{
+{} /// JAVADOC
+MethodHandle trace = publicLookup().findVirtual(java.io.PrintStream.class,
+ "println", methodType(void.class, String.class))
+ .bindTo(System.out);
+MethodHandle cat = lookup().findVirtual(String.class,
+ "concat", methodType(String.class, String.class));
+assertEquals("boojum", (String) cat.invokeExact("boo", "jum"));
+MethodHandle catTrace = foldArguments(cat, 1, trace);
+// also prints "jum":
+assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
+{}
+ }}
+ }
+
+ @Test public void testAsCollector2() throws Throwable {
+ {{
+{} /// JAVADOC
+StringWriter swr = new StringWriter();
+MethodHandle swWrite = LOOKUP.findVirtual(StringWriter.class, "write", methodType(void.class, char[].class, int.class, int.class)).bindTo(swr);
+MethodHandle swWrite4 = swWrite.asCollector(0, char[].class, 4);
+swWrite4.invoke('A', 'B', 'C', 'D', 1, 2);
+assertEquals("BC", swr.toString());
+swWrite4.invoke('P', 'Q', 'R', 'S', 0, 4);
+assertEquals("BCPQRS", swr.toString());
+swWrite4.invoke('W', 'X', 'Y', 'Z', 3, 1);
+assertEquals("BCPQRSZ", swr.toString());
+{}
+ }}
+ }
+
+ @Test public void testAsSpreader2() throws Throwable {
+ {{
+{} /// JAVADOC
+MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class));
+MethodHandle compare2FromArray = compare.asSpreader(0, Object[].class, 2);
+Object[] ints = new Object[]{3, 9, 7, 7};
+Comparator<Integer> cmp = (a, b) -> a - b;
+assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 0, 2), cmp) < 0);
+assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 1, 3), cmp) > 0);
+assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 2, 4), cmp) == 0);
+{}
+ }}
+ }
+
/* ---- TEMPLATE ----
@Test public void testFoo() throws Throwable {
{{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/Format/DateFormat/Bug8141243.java Thu Dec 03 11:56:10 2015 -0800
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8141243
+ * @summary Make sure that SimpleDateFormat parses "UTC" as the UTC time zone.
+ * @run main Bug8141243
+ * @run main/othervm -Djava.locale.providers=COMPAT Bug8141243
+ */
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.TimeZone;
+import static java.util.TimeZone.*;
+
+public class Bug8141243 {
+ public static void main(String[] args) {
+ TimeZone UTC = TimeZone.getTimeZone("UTC");
+ TimeZone initTz = TimeZone.getDefault();
+
+ List<String> errors = new ArrayList<>();
+ try {
+ TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
+ for (Locale locale : DateFormat.getAvailableLocales()) {
+ // exclude any locales which localize "UTC".
+ String utc = UTC.getDisplayName(false, SHORT, locale);
+ if (!"UTC".equals(utc)) {
+ System.out.println("Skipping " + locale + " due to localized UTC name: " + utc);
+ continue;
+ }
+ SimpleDateFormat fmt = new SimpleDateFormat("z", locale);
+ try {
+ Date date = fmt.parse("UTC");
+ // Parsed one may not exactly be UTC. Universal, UCT, etc. are equivalents.
+ if (!fmt.getTimeZone().getID().matches("(Etc/)?(UTC|Universal|UCT|Zulu)")) {
+ errors.add("timezone: " + fmt.getTimeZone().getID()
+ + ", locale: " + locale);
+ }
+ } catch (ParseException e) {
+ errors.add("parse exception: " + e + ", locale: " + locale);
+ }
+ }
+ } finally {
+ // Restore the default time zone
+ TimeZone.setDefault(initTz);
+ }
+
+ if (!errors.isEmpty()) {
+ System.out.println("Got unexpected results:");
+ for (String s : errors) {
+ System.out.println(" " + s);
+ }
+ throw new RuntimeException("Test failed.");
+ } else {
+ System.out.println("Test passed.");
+ }
+ }
+}
--- a/jdk/test/java/util/Currency/PropertiesTest.sh Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/java/util/Currency/PropertiesTest.sh Thu Dec 03 11:56:10 2015 -0800
@@ -23,7 +23,7 @@
#
# @test
-# @bug 6332666 6863624 7180362 8003846 8074350 8074351
+# @bug 6332666 6863624 7180362 8003846 8074350 8074351 8130246
# @summary tests the capability of replacing the currency data with user
# specified currency properties file
# @build PropertiesTest
@@ -75,7 +75,7 @@
run() {
echo ''
- sh -xc "${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $*" 2>&1
+ ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $* 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
}
@@ -108,7 +108,7 @@
# run
echo ''
-sh -xc "${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3"
+${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
# Cleanup
--- a/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java Thu Dec 03 11:56:10 2015 -0800
@@ -32,7 +32,6 @@
* @test
* @bug 7030966
* @summary Support AEAD CipherSuites
- * @modules java.base/sun.misc
* @run main/othervm ShortRSAKeyGCM PKIX TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* @run main/othervm ShortRSAKeyGCM PKIX TLS_RSA_WITH_AES_128_GCM_SHA256
* @run main/othervm ShortRSAKeyGCM PKIX TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
@@ -69,7 +68,6 @@
import java.security.cert.CertificateFactory;
import java.security.spec.*;
import java.security.interfaces.*;
-import sun.misc.BASE64Decoder;
public class ShortRSAKeyGCM {
@@ -252,7 +250,7 @@
if (keyCertStr != null) {
// generate the private key.
PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec(
- new BASE64Decoder().decodeBuffer(keySpecStr));
+ Base64.getMimeDecoder().decode(keySpecStr));
KeyFactory kf = KeyFactory.getInstance("RSA");
RSAPrivateKey priKey =
(RSAPrivateKey)kf.generatePrivate(priKeySpec);
--- a/jdk/test/sun/security/util/Oid/S11N.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/sun/security/util/Oid/S11N.java Thu Dec 03 11:56:10 2015 -0800
@@ -24,8 +24,7 @@
/*
* @test
* @bug 4811968 6908628 8006564 8130696
- * @modules java.base/sun.misc
- * java.base/sun.security.util
+ * @modules java.base/sun.security.util
* @run main S11N check
* @summary Serialization compatibility with old versions (and fixes)
*/
@@ -36,7 +35,6 @@
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;
-import sun.misc.BASE64Encoder;
import sun.security.util.ObjectIdentifier;
public class S11N {
@@ -56,14 +54,6 @@
"1.2.8888888888888888.33333333333333333.44444444444444",
};
- // Do not use j.u.Base64, the test needs to run in jdk6
- static BASE64Encoder encoder = new BASE64Encoder() {
- @Override
- protected int bytesPerLine() {
- return 48;
- }
- };
-
public static void main(String[] args) throws Exception {
if (args[0].equals("check")) {
String jv = System.getProperty("java.version");
@@ -117,12 +107,12 @@
// Gets the serialized form for jdk6
private static byte[] out6(String oid) throws Exception {
- return new sun.misc.BASE64Decoder().decodeBuffer(dump6.get(oid));
+ return decode(dump6.get(oid));
}
// Gets the serialized form for jdk7
private static byte[] out7(String oid) throws Exception {
- return new sun.misc.BASE64Decoder().decodeBuffer(dump7.get(oid));
+ return decode(dump7.get(oid));
}
// Gets the serialized form for this java
@@ -144,11 +134,15 @@
// dump serialized form to java code style text
private static void dump(String title, String[] oids) throws Exception {
for (String oid: oids) {
- String[] base64 = encoder.encodeBuffer(out(oid)).split("\n");
+ String hex = encode(out(oid));
System.out.println(" " + title + ".put(\"" + oid + "\",");
- for (int i = 0; i<base64.length; i++) {
- System.out.print(" \"" + base64[i] + "\"");
- if (i == base64.length - 1) {
+ for (int i = 0; i<hex.length(); i+= 64) {
+ int end = i + 64;
+ if (end > hex.length()) {
+ end = hex.length();
+ }
+ System.out.print(" \"" + hex.substring(i, end) + "\"");
+ if (end == hex.length()) {
System.out.println(");");
} else {
System.out.println(" +");
@@ -157,6 +151,22 @@
}
}
+ private static String encode(byte[] bytes) {
+ StringBuilder sb = new StringBuilder(bytes.length * 2);
+ for (byte b: bytes) {
+ sb.append(String.format("%02x", b & 0xff));
+ }
+ return sb.toString();
+ }
+
+ private static byte[] decode(String var) {
+ byte[] data = new byte[var.length()/2];
+ for (int i=0; i<data.length; i++) {
+ data[i] = Integer.valueOf(var.substring(2 * i, 2 * i + 2), 16).byteValue();
+ }
+ return data;
+ }
+
// Do not use diamond operator, this test is also meant to run in jdk6
private static Map<String,String> dump7 = new HashMap<String,String>();
private static Map<String,String> dump6 = new HashMap<String,String>();
@@ -164,88 +174,119 @@
static {
////////////// PASTE BEGIN //////////////
dump7.put("0.0",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" +
- "AAACAAAAAAAAAAB1cgACW0Ks8xf4BghU4AIAAHhwAAAAAQB4");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b4278700000000275720002" +
+ "5b494dba602676eab2a50200007870000000020000000000000000757200025b" +
+ "42acf317f8060854e00200007870000000010078");
dump7.put("1.1",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" +
- "AAACAAAAAQAAAAF1cgACW0Ks8xf4BghU4AIAAHhwAAAAASl4");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b4278700000000275720002" +
+ "5b494dba602676eab2a50200007870000000020000000100000001757200025b" +
+ "42acf317f8060854e00200007870000000012978");
dump7.put("2.2",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" +
- "AAACAAAAAgAAAAJ1cgACW0Ks8xf4BghU4AIAAHhwAAAAAVJ4");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b4278700000000275720002" +
+ "5b494dba602676eab2a50200007870000000020000000200000002757200025b" +
+ "42acf317f8060854e00200007870000000015278");
dump7.put("1.2.3456",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAA3VyAAJbSU26YCZ26rKlAgAAeHAA" +
- "AAADAAAAAQAAAAIAAA2AdXIAAltCrPMX+AYIVOACAAB4cAAAAAMqmwB4");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b4278700000000375720002" +
+ "5b494dba602676eab2a5020000787000000003000000010000000200000d8075" +
+ "7200025b42acf317f8060854e00200007870000000032a9b0078");
dump7.put("1.2.2147483647.4",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAABHVyAAJbSU26YCZ26rKlAgAAeHAA" +
- "AAAEAAAAAQAAAAJ/////AAAABHVyAAJbQqzzF/gGCFTgAgAAeHAAAAAHKof///9/" +
- "BHg=");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b4278700000000475720002" +
+ "5b494dba602676eab2a502000078700000000400000001000000027fffffff00" +
+ "000004757200025b42acf317f8060854e00200007870000000072a87ffffff7f" +
+ "0478");
dump7.put("1.2.268435456.4",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAABHVyAAJbSU26YCZ26rKlAgAAeHAA" +
- "AAAEAAAAAQAAAAIQAAAAAAAABHVyAAJbQqzzF/gGCFTgAgAAeHAAAAAHKoGAgIAA" +
- "BHg=");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b4278700000000475720002" +
+ "5b494dba602676eab2a502000078700000000400000001000000021000000000" +
+ "000004757200025b42acf317f8060854e00200007870000000072a8180808000" +
+ "0478");
dump7.put("2.16.764.1.3101555394.1.0.100.2.1",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
- "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
- "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAADmCFfAGLxvf1QgEAZAIB" +
- "eA==");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
+ "73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
+ "657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
+ "0000000000010200007870757200025b42acf317f8060854e002000078700000" +
+ "000e60857c018bc6f7f542010064020178");
dump7.put("1.2.2147483648.4",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
- "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
- "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAAByqIgICAAAR4");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
+ "73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
+ "657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
+ "0000000000010200007870757200025b42acf317f8060854e002000078700000" +
+ "00072a88808080000478");
dump7.put("2.3.4444444444444444444444",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
- "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
- "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAADFOD4e+HpNG968eOHHg=");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
+ "73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
+ "657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
+ "0000000000010200007870757200025b42acf317f8060854e002000078700000" +
+ "000c5383e1ef87a4d1bdebc78e1c78");
dump7.put("1.2.8888888888888888.33333333333333333.44444444444444",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" +
- "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" +
- "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" +
- "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAAGCqP5Yzbxa6cOLubj9ek" +
- "japVio3AusuOHHg=");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e03000349000c636f6d706f6e656e" +
+ "744c656e4c000a636f6d706f6e656e74737400124c6a6176612f6c616e672f4f" +
+ "626a6563743b5b0008656e636f64696e677400025b427870ffffffff7372003e" +
+ "73756e2e73656375726974792e7574696c2e4f626a6563744964656e74696669" +
+ "657224487567654f69644e6f74537570706f7274656442794f6c644a444b0000" +
+ "0000000000010200007870757200025b42acf317f8060854e002000078700000" +
+ "00182a8fe58cdbc5ae9c38bb9b8fd7a48daa558a8dc0bacb8e1c78");
dump6.put("0.0",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" +
- "W0lNumAmduqypQIAAHhwAAAAAgAAAAAAAAAA");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
+ "744c656e5b000a636f6d706f6e656e74737400025b4978700000000275720002" +
+ "5b494dba602676eab2a50200007870000000020000000000000000");
dump6.put("1.1",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" +
- "W0lNumAmduqypQIAAHhwAAAAAgAAAAEAAAAB");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
+ "744c656e5b000a636f6d706f6e656e74737400025b4978700000000275720002" +
+ "5b494dba602676eab2a50200007870000000020000000100000001");
dump6.put("2.2",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" +
- "W0lNumAmduqypQIAAHhwAAAAAgAAAAIAAAAC");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
+ "744c656e5b000a636f6d706f6e656e74737400025b4978700000000275720002" +
+ "5b494dba602676eab2a50200007870000000020000000200000002");
dump6.put("1.2.3456",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAN1cgAC" +
- "W0lNumAmduqypQIAAHhwAAAAAwAAAAEAAAACAAANgA==");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
+ "744c656e5b000a636f6d706f6e656e74737400025b4978700000000375720002" +
+ "5b494dba602676eab2a5020000787000000003000000010000000200000d80");
dump6.put("1.2.2147483647.4",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAR1cgAC" +
- "W0lNumAmduqypQIAAHhwAAAABAAAAAEAAAACf////wAAAAQ=");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
+ "744c656e5b000a636f6d706f6e656e74737400025b4978700000000475720002" +
+ "5b494dba602676eab2a502000078700000000400000001000000027fffffff00" +
+ "000004");
dump6.put("1.2.268435456.4",
- "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" +
- "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAR1cgAC" +
- "W0lNumAmduqypQIAAHhwAAAABAAAAAEAAAACEAAAAAAAAAQ=");
+ "aced00057372002273756e2e73656375726974792e7574696c2e4f626a656374" +
+ "4964656e74696669657278b20eec64177f2e02000249000c636f6d706f6e656e" +
+ "744c656e5b000a636f6d706f6e656e74737400025b4978700000000475720002" +
+ "5b494dba602676eab2a502000078700000000400000001000000021000000000" +
+ "000004");
+
////////////// PASTE END //////////////
}
}
--- a/jdk/test/sun/security/x509/X509CertImpl/V3Certificate.java Thu Dec 03 15:22:31 2015 +0300
+++ b/jdk/test/sun/security/x509/X509CertImpl/V3Certificate.java Thu Dec 03 11:56:10 2015 -0800
@@ -42,10 +42,10 @@
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
+import java.util.Base64;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
-import sun.misc.BASE64Encoder;
import sun.security.util.BitArray;
import sun.security.util.ObjectIdentifier;
import sun.security.x509.*;
@@ -55,7 +55,6 @@
* @bug 8049237
* @modules java.base/sun.security.x509
* java.base/sun.security.util
- * java.base/sun.misc
* @summary This test generates V3 certificate with all the supported
* extensions. Writes back the generated certificate in to a file and checks for
* equality with the original certificate.
@@ -224,7 +223,7 @@
// Certificate boundaries/
pw.println("-----BEGIN CERTIFICATE-----");
pw.flush();
- new BASE64Encoder().encodeBuffer(crt.getEncoded(), fos_b64);
+ fos_b64.write(Base64.getMimeEncoder().encode(crt.getEncoded()));
fos_b64.flush();
pw.println("-----END CERTIFICATE-----");
}