From 2ec4f5a76abea2b7d8b055bd45c3c0435d380e79 Mon Sep 17 00:00:00 2001 From: Rachel Protacio Date: Thu, 21 Jul 2016 15:49:17 -0400 Subject: [PATCH 01/71] 8159507: RuntimeVisibleAnnotation validation Reviewed-by: coleenp, hseigel, mschoene, acorn --- .../share/vm/classfile/classFileParser.cpp | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index f1eace4eb65..96ffac10af0 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -1025,16 +1025,20 @@ public: static int skip_annotation_value(const u1*, int, int); // fwd decl +// Safely increment index by val if does not pass limit +#define SAFE_ADD(index, limit, val) \ +if (index >= limit - val) return limit; \ +index += val; + // Skip an annotation. Return >=limit if there is any problem. static int skip_annotation(const u1* buffer, int limit, int index) { assert(buffer != NULL, "invariant"); // annotation := atype:u2 do(nmem:u2) {member:u2 value} // value := switch (tag:u1) { ... } - index += 2; // skip atype - if ((index += 2) >= limit) return limit; // read nmem + SAFE_ADD(index, limit, 4); // skip atype and read nmem int nmem = Bytes::get_Java_u2((address)buffer + index - 2); while (--nmem >= 0 && index < limit) { - index += 2; // skip member + SAFE_ADD(index, limit, 2); // skip member index = skip_annotation_value(buffer, limit, index); } return index; @@ -1052,7 +1056,7 @@ static int skip_annotation_value(const u1* buffer, int limit, int index) { // case @: annotation; // case s: s_con:u2; // } - if ((index += 1) >= limit) return limit; // read tag + SAFE_ADD(index, limit, 1); // read tag const u1 tag = buffer[index - 1]; switch (tag) { case 'B': @@ -1065,14 +1069,14 @@ static int skip_annotation_value(const u1* buffer, int limit, int index) { case 'J': case 'c': case 's': - index += 2; // skip con or s_con + SAFE_ADD(index, limit, 2); // skip con or s_con break; case 'e': - index += 4; // skip e_class, e_name + SAFE_ADD(index, limit, 4); // skip e_class, e_name break; case '[': { - if ((index += 2) >= limit) return limit; // read nval + SAFE_ADD(index, limit, 2); // read nval int nval = Bytes::get_Java_u2((address)buffer + index - 2); while (--nval >= 0 && index < limit) { index = skip_annotation_value(buffer, limit, index); @@ -1101,8 +1105,8 @@ static void parse_annotations(const ConstantPool* const cp, assert(loader_data != NULL, "invariant"); // annotations := do(nann:u2) {annotation} - int index = 0; - if ((index += 2) >= limit) return; // read nann + int index = 2; // read nann + if (index >= limit) return; int nann = Bytes::get_Java_u2((address)buffer + index - 2); enum { // initial annotation layout atype_off = 0, // utf8 such as 'Ljava/lang/annotation/Retention;' @@ -1121,7 +1125,8 @@ static void parse_annotations(const ConstantPool* const cp, s_size = 9, min_size = 6 // smallest possible size (zero members) }; - while ((--nann) >= 0 && (index - 2 + min_size <= limit)) { + // Cannot add min_size to index in case of overflow MAX_INT + while ((--nann) >= 0 && (index - 2 <= limit - min_size)) { int index0 = index; index = skip_annotation(buffer, limit, index); const u1* const abase = buffer + index0; @@ -1253,13 +1258,14 @@ void ClassFileParser::parse_field_attributes(const ClassFileStream* const cfs, runtime_visible_annotations_length = attribute_length; runtime_visible_annotations = cfs->get_u1_buffer(); assert(runtime_visible_annotations != NULL, "null visible annotations"); + cfs->guarantee_more(runtime_visible_annotations_length, CHECK); parse_annotations(cp, runtime_visible_annotations, runtime_visible_annotations_length, parsed_annotations, _loader_data, CHECK); - cfs->skip_u1(runtime_visible_annotations_length, CHECK); + cfs->skip_u1_fast(runtime_visible_annotations_length); } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { if (runtime_invisible_annotations_exists) { classfile_parse_error( @@ -2574,13 +2580,14 @@ Method* ClassFileParser::parse_method(const ClassFileStream* const cfs, runtime_visible_annotations_length = method_attribute_length; runtime_visible_annotations = cfs->get_u1_buffer(); assert(runtime_visible_annotations != NULL, "null visible annotations"); + cfs->guarantee_more(runtime_visible_annotations_length, CHECK_NULL); parse_annotations(cp, runtime_visible_annotations, runtime_visible_annotations_length, &parsed_annotations, _loader_data, CHECK_NULL); - cfs->skip_u1(runtime_visible_annotations_length, CHECK_NULL); + cfs->skip_u1_fast(runtime_visible_annotations_length); } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { if (runtime_invisible_annotations_exists) { classfile_parse_error( @@ -3285,13 +3292,14 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf runtime_visible_annotations_length = attribute_length; runtime_visible_annotations = cfs->get_u1_buffer(); assert(runtime_visible_annotations != NULL, "null visible annotations"); + cfs->guarantee_more(runtime_visible_annotations_length, CHECK); parse_annotations(cp, runtime_visible_annotations, runtime_visible_annotations_length, parsed_annotations, _loader_data, CHECK); - cfs->skip_u1(runtime_visible_annotations_length, CHECK); + cfs->skip_u1_fast(runtime_visible_annotations_length); } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) { if (runtime_invisible_annotations_exists) { classfile_parse_error( From 6beed1f8447427be0b454bb5d96b2831b82a8042 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Tue, 26 Jul 2016 08:23:25 -0400 Subject: [PATCH 02/71] 8161218: Better bytecode loading Reviewed-by: acorn, mschoene, ctornqvi --- hotspot/src/share/vm/classfile/verifier.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index 93392009cc9..570a51fd7d9 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -541,19 +541,13 @@ void ErrorContext::stackmap_details(outputStream* ss, const Method* method) cons stack_map_frame* sm_frame = sm_table->entries(); streamIndentor si2(ss); int current_offset = -1; - // Subtract two from StackMapAttribute length because the length includes - // two bytes for number of table entries. - size_t sm_table_space = method->stackmap_data()->length() - 2; + address end_of_sm_table = (address)sm_table + method->stackmap_data()->length(); for (u2 i = 0; i < sm_table->number_of_entries(); ++i) { ss->indent(); - size_t sm_frame_size = sm_frame->size(); - // If the size of the next stackmap exceeds the length of the entire - // stackmap table then print a truncated message and return. - if (sm_frame_size > sm_table_space) { + if (!sm_frame->verify((address)sm_frame, end_of_sm_table)) { sm_frame->print_truncated(ss, current_offset); return; } - sm_table_space -= sm_frame_size; sm_frame->print_on(ss, current_offset); ss->cr(); current_offset += sm_frame->offset_delta(); From d109f68ebd657de9ad523d6d8e634e49963c67fb Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Wed, 27 Jul 2016 02:23:16 +0000 Subject: [PATCH 03/71] 8151465: SSLSession may not return a valid chain Reviewed-by: mullan, ahgross --- .../share/classes/com/sun/net/ssl/HttpsURLConnection.java | 4 ++++ .../classes/javax/net/ssl/HandshakeCompletedEvent.java | 8 +++++++- .../share/classes/javax/net/ssl/HttpsURLConnection.java | 5 ++++- .../java.base/share/classes/javax/net/ssl/SSLSession.java | 8 +++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java index d376fc395fe..895b17ac578 100644 --- a/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java +++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java @@ -69,6 +69,10 @@ class HttpsURLConnection extends HttpURLConnection /** * Returns the server's X.509 certificate chain, or null if * the server did not authenticate. + *

+ * Note: The returned value may not be a valid certificate chain + * and should not be relied on for trust decisions. + * * @return the server certificate chain */ public abstract Certificate[] getServerCertificates() diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java index 1317f0021f4..67e8d7548a7 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -120,6 +120,9 @@ public class HandshakeCompletedEvent extends EventObject * Note: This method can be used only when using certificate-based * cipher suites; using it with non-certificate-based cipher suites, * such as Kerberos, will throw an SSLPeerUnverifiedException. + *

+ * Note: The returned value may not be a valid certificate chain + * and should not be relied on for trust decisions. * * @return an ordered array of the peer certificates, * with the peer's own certificate first followed by @@ -140,6 +143,9 @@ public class HandshakeCompletedEvent extends EventObject * Note: This method can be used only when using certificate-based * cipher suites; using it with non-certificate-based cipher suites, * such as Kerberos, will throw an SSLPeerUnverifiedException. + *

+ * Note: The returned value may not be a valid certificate chain + * and should not be relied on for trust decisions. * *

Note: this method exists for compatibility with previous * releases. New applications should use diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java b/jdk/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java index 7c775321640..7d93ef274c6 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -104,6 +104,9 @@ class HttpsURLConnection extends HttpURLConnection * Note: This method can be used only when using certificate-based * cipher suites; using it with non-certificate-based cipher suites, * such as Kerberos, will throw an SSLPeerUnverifiedException. + *

+ * Note: The returned value may not be a valid certificate chain + * and should not be relied on for trust decisions. * * @return an ordered array of server certificates, * with the peer's own certificate first followed by diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java index 2a04e159728..a355d187889 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -219,6 +219,9 @@ public interface SSLSession { * Note: This method can be used only when using certificate-based * cipher suites; using it with non-certificate-based cipher suites, * such as Kerberos, will throw an SSLPeerUnverifiedException. + *

+ * Note: The returned value may not be a valid certificate chain + * and should not be relied on for trust decisions. * * @return an ordered array of peer certificates, * with the peer's own certificate first followed by any @@ -259,6 +262,9 @@ public interface SSLSession { * Note: This method can be used only when using certificate-based * cipher suites; using it with non-certificate-based cipher suites, * such as Kerberos, will throw an SSLPeerUnverifiedException. + *

+ * Note: The returned value may not be a valid certificate chain + * and should not be relied on for trust decisions. * *

Note: this method exists for compatibility with previous * releases. New applications should use From 60cfb25bfee129e130ec1a496c38b4cfbe8913e1 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Thu, 28 Jul 2016 10:13:12 +0100 Subject: [PATCH 04/71] 8151934: Resolve class resolution Reviewed-by: alanb, skoivu --- .../classes/java/net/URLClassLoader.java | 14 ++--- .../jdk/internal/loader/URLClassPath.java | 60 +++++++++++++++---- .../jdk/internal/util/jar/JarIndex.java | 3 +- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java index 57f45027ea2..11077b4032a 100644 --- a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java +++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java @@ -115,8 +115,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { if (security != null) { security.checkCreateClassLoader(); } - this.ucp = new URLClassPath(urls); this.acc = AccessController.getContext(); + this.ucp = new URLClassPath(urls, acc); } URLClassLoader(String name, URL[] urls, ClassLoader parent, @@ -127,8 +127,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { if (security != null) { security.checkCreateClassLoader(); } - this.ucp = new URLClassPath(urls); this.acc = acc; + this.ucp = new URLClassPath(urls, acc); } /** @@ -159,8 +159,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { if (security != null) { security.checkCreateClassLoader(); } - this.ucp = new URLClassPath(urls); this.acc = AccessController.getContext(); + this.ucp = new URLClassPath(urls, acc); } URLClassLoader(URL[] urls, AccessControlContext acc) { @@ -170,8 +170,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { if (security != null) { security.checkCreateClassLoader(); } - this.ucp = new URLClassPath(urls); this.acc = acc; + this.ucp = new URLClassPath(urls, acc); } /** @@ -203,8 +203,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { if (security != null) { security.checkCreateClassLoader(); } - this.ucp = new URLClassPath(urls, factory); this.acc = AccessController.getContext(); + this.ucp = new URLClassPath(urls, factory, acc); } @@ -238,8 +238,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { if (security != null) { security.checkCreateClassLoader(); } - this.ucp = new URLClassPath(urls); this.acc = AccessController.getContext(); + this.ucp = new URLClassPath(urls, acc); } /** @@ -271,8 +271,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { if (security != null) { security.checkCreateClassLoader(); } - this.ucp = new URLClassPath(urls, factory); this.acc = AccessController.getContext(); + this.ucp = new URLClassPath(urls, factory, acc); } /* A map (used as a set) to keep track of closeable local resources diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java b/jdk/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java index 695d8028068..d67c342fb0a 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java @@ -38,6 +38,7 @@ import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; import java.net.URLStreamHandlerFactory; +import java.security.AccessControlContext; import java.security.AccessControlException; import java.security.AccessController; import java.security.CodeSigner; @@ -83,6 +84,7 @@ public class URLClassPath { private static final String JAVA_VERSION; private static final boolean DEBUG; private static final boolean DISABLE_JAR_CHECKING; + private static final boolean DISABLE_ACC_CHECKING; static { Properties props = GetPropertyAction.privilegedGetProperties(); @@ -90,6 +92,9 @@ public class URLClassPath { DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null); String p = props.getProperty("sun.misc.URLClassPath.disableJarChecking"); DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false; + + p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions"); + DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false; } /* The original search path of URLs. */ @@ -110,6 +115,11 @@ public class URLClassPath { /* Whether this URLClassLoader has been closed yet */ private boolean closed = false; + /* The context to be used when loading classes and resources. If non-null + * this is the context that was captured during the creation of the + * URLClassLoader. null implies no additional security restrictions. */ + private final AccessControlContext acc; + /** * Creates a new URLClassPath for the given URLs. The URLs will be * searched in the order specified for classes and resources. A URL @@ -119,8 +129,12 @@ public class URLClassPath { * @param urls the directory and JAR file URLs to search for classes * and resources * @param factory the URLStreamHandlerFactory to use when creating new URLs + * @param acc the context to be used when loading classes and resources, may + * be null */ - public URLClassPath(URL[] urls, URLStreamHandlerFactory factory) { + public URLClassPath(URL[] urls, + URLStreamHandlerFactory factory, + AccessControlContext acc) { for (int i = 0; i < urls.length; i++) { path.add(urls[i]); } @@ -128,10 +142,22 @@ public class URLClassPath { if (factory != null) { jarHandler = factory.createURLStreamHandler("jar"); } + if (DISABLE_ACC_CHECKING) + this.acc = null; + else + this.acc = acc; } + /** + * Constructs a URLClassPath with no additional security restrictions. + * Used by code that implements the class path. + */ public URLClassPath(URL[] urls) { - this(urls, null); + this(urls, null, null); + } + + public URLClassPath(URL[] urls, AccessControlContext acc) { + this(urls, null, acc); } public synchronized List closeLoaders() { @@ -356,6 +382,14 @@ public class URLClassPath { } catch (IOException e) { // Silently ignore for now... continue; + } catch (SecurityException se) { + // Always silently ignore. The context, if there is one, that + // this URLClassPath was given during construction will never + // have permission to access the URL. + if (DEBUG) { + System.err.println("Failed to access " + url + ", " + se ); + } + continue; } // Finally, add the Loader to the search path. loaders.add(loader); @@ -378,7 +412,7 @@ public class URLClassPath { && file != null && (file.indexOf("!/") == file.length() - 2)) { // extract the nested URL URL nestedUrl = new URL(file.substring(0, file.length() - 2)); - return new JarLoader(nestedUrl, jarHandler, lmap); + return new JarLoader(nestedUrl, jarHandler, lmap, acc); } else if (file != null && file.endsWith("/")) { if ("file".equals(protocol)) { return new FileLoader(url); @@ -386,10 +420,10 @@ public class URLClassPath { return new Loader(url); } } else { - return new JarLoader(url, jarHandler, lmap); + return new JarLoader(url, jarHandler, lmap, acc); } } - }); + }, acc); } catch (java.security.PrivilegedActionException pae) { throw (IOException)pae.getException(); } @@ -585,10 +619,11 @@ public class URLClassPath { */ static class JarLoader extends Loader { private JarFile jar; - private URL csu; + private final URL csu; private JarIndex index; private URLStreamHandler handler; - private HashMap lmap; + private final HashMap lmap; + private final AccessControlContext acc; private boolean closed = false; private static final JavaUtilZipFileAccess zipAccess = SharedSecrets.getJavaUtilZipFileAccess(); @@ -598,13 +633,15 @@ public class URLClassPath { * a JAR file. */ JarLoader(URL url, URLStreamHandler jarHandler, - HashMap loaderMap) + HashMap loaderMap, + AccessControlContext acc) throws IOException { super(new URL("jar", "", -1, url + "!/", jarHandler)); csu = url; handler = jarHandler; lmap = loaderMap; + this.acc = acc; ensureOpen(); } @@ -663,8 +700,7 @@ public class URLClassPath { } return null; } - } - ); + }, acc); } catch (java.security.PrivilegedActionException pae) { throw (IOException)pae.getException(); } @@ -859,9 +895,9 @@ public class URLClassPath { new PrivilegedExceptionAction<>() { public JarLoader run() throws IOException { return new JarLoader(url, handler, - lmap); + lmap, acc); } - }); + }, acc); /* this newly opened jar file has its own index, * merge it into the parent's index, taking into diff --git a/jdk/src/java.base/share/classes/jdk/internal/util/jar/JarIndex.java b/jdk/src/java.base/share/classes/jdk/internal/util/jar/JarIndex.java index 367ac31b07a..f0d14a886a5 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/util/jar/JarIndex.java +++ b/jdk/src/java.base/share/classes/jdk/internal/util/jar/JarIndex.java @@ -29,6 +29,7 @@ import java.io.*; import java.util.*; import java.util.jar.*; import java.util.zip.*; +import static sun.security.action.GetPropertyAction.privilegedGetProperty; /** * This class is used to maintain mappings from packages, classes @@ -72,7 +73,7 @@ public class JarIndex { * be added to the index. Otherwise, just the directory names are added. */ private static final boolean metaInfFilenames = - "true".equals(System.getProperty("sun.misc.JarIndex.metaInfFilenames")); + "true".equals(privilegedGetProperty("sun.misc.JarIndex.metaInfFilenames")); /** * Constructs a new, empty jar index. From 23a605ff5c0c25b126bf243b12af22fcd38f265b Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Tue, 9 Aug 2016 11:41:47 +0100 Subject: [PATCH 05/71] 8162577: Standardize logging levels Reviewed-by: mchung, rriggs, skoivu --- .../share/classes/java/util/logging/Level.java | 5 ++++- .../share/classes/java/util/logging/LogRecord.java | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.logging/share/classes/java/util/logging/Level.java b/jdk/src/java.logging/share/classes/java/util/logging/Level.java index c222a8fde25..526161bafa9 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/Level.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/Level.java @@ -692,11 +692,14 @@ public class Level implements java.io.Serializable { Level levelObject = ref.get(); if (levelObject == null) continue; Level other = ref.mirroredLevel; + Class type = levelObject.getClass(); if (l.value == other.value && (l.resourceBundleName == other.resourceBundleName || (l.resourceBundleName != null && l.resourceBundleName.equals(other.resourceBundleName)))) { - return Optional.of(levelObject); + if (type == l.getClass()) { + return Optional.of(levelObject); + } } } } diff --git a/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java b/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java index 33b5509a566..4b88e359f7c 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -619,13 +619,21 @@ public class LogRecord implements java.io.Serializable { throw new IOException("LogRecord: bad version: " + major + "." + minor); } int len = in.readInt(); - if (len == -1) { + if (len < -1) { + throw new NegativeArraySizeException(); + } else if (len == -1) { parameters = null; - } else { + } else if (len < 255) { parameters = new Object[len]; for (int i = 0; i < parameters.length; i++) { parameters[i] = in.readObject(); } + } else { + List params = new ArrayList<>(Math.min(len, 1024)); + for (int i = 0; i < len; i++) { + params.add(in.readObject()); + } + parameters = params.toArray(new Object[params.size()]); } // If necessary, try to regenerate the resource bundle. if (resourceBundleName != null) { From 8861efc7b55d05603226a22a54587a053319953c Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Fri, 12 Aug 2016 10:20:13 +0800 Subject: [PATCH 06/71] 8161743: Provide proper login context Reviewed-by: ahgross, vinnie, xuelei --- .../com/sun/security/auth/module/LdapLoginModule.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java index ff60810021b..b3743a662fd 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java @@ -418,7 +418,6 @@ public class LdapLoginModule implements LoginModule { constraints = new SearchControls(); constraints.setSearchScope(SearchControls.SUBTREE_SCOPE); constraints.setReturningAttributes(new String[0]); //return no attrs - constraints.setReturningObjFlag(true); // to get the full DN } authzIdentity = (String)options.get(AUTHZ_IDENTITY); @@ -878,11 +877,7 @@ public class LdapLoginModule implements LoginModule { // (Use the first entry if more than one is returned) if (results.hasMore()) { SearchResult entry = results.next(); - - // %%% - use the SearchResult.getNameInNamespace method - // available in JDK 1.5 and later. - // (can remove call to constraints.setReturningObjFlag) - userDN = ((Context)entry.getObject()).getNameInNamespace(); + userDN = entry.getNameInNamespace(); if (debug) { System.out.println("\t\t[LdapLoginModule] found entry: " + From f436ae7a54a3781926f8c3c22be5f5efab6aaa29 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Fri, 12 Aug 2016 10:37:15 +0100 Subject: [PATCH 07/71] 8161228: URL objects with custom protocol handlers have port changed after deserializing Reviewed-by: chegar, rriggs, coffeys --- jdk/src/java.base/share/classes/java/net/URL.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/URL.java b/jdk/src/java.base/share/classes/java/net/URL.java index 145cf29d001..b029b83d7ca 100644 --- a/jdk/src/java.base/share/classes/java/net/URL.java +++ b/jdk/src/java.base/share/classes/java/net/URL.java @@ -1556,9 +1556,6 @@ public final class URL implements java.io.Serializable { path = file; } - if (port == -1) { - port = 0; - } // Set the object fields. this.protocol = protocol; this.host = host; From 5dd6d9c4ca11283c2bda7ec5ba05c52c32908e94 Mon Sep 17 00:00:00 2001 From: Harsha Wardhana B Date: Tue, 16 Aug 2016 17:05:00 +0530 Subject: [PATCH 08/71] 8158406: Limited Parameter Processing Reviewed-by: dfuchs, skoivu --- .../remote/rmi/RMIConnectionImpl.java | 67 +++++++++++++------ 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java index c37e3e9af12..03b652a0ba7 100644 --- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java +++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java @@ -347,7 +347,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { +", unwrapping parameters using classLoaderWithRepository."); values = - nullIsEmpty(unwrap(params, classLoaderWithRepository, Object[].class)); + nullIsEmpty(unwrap(params, classLoaderWithRepository, Object[].class,delegationSubject)); try { final Object params2[] = @@ -411,7 +411,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { values = nullIsEmpty(unwrap(params, getClassLoader(loaderName), defaultClassLoader, - Object[].class)); + Object[].class,delegationSubject)); try { final Object params2[] = @@ -522,7 +522,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { "connectionId=" + connectionId +" unwrapping query with defaultClassLoader."); - queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class); + queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class, delegationSubject); try { final Object params[] = new Object[] { name, queryValue }; @@ -557,7 +557,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { "connectionId=" + connectionId +" unwrapping query with defaultClassLoader."); - queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class); + queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class, delegationSubject); try { final Object params[] = new Object[] { name, queryValue }; @@ -707,7 +707,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { attr = unwrap(attribute, getClassLoaderFor(name), defaultClassLoader, - Attribute.class); + Attribute.class, delegationSubject); try { final Object params[] = new Object[] { name, attr }; @@ -758,7 +758,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { unwrap(attributes, getClassLoaderFor(name), defaultClassLoader, - AttributeList.class); + AttributeList.class, delegationSubject); try { final Object params[] = new Object[] { name, attrlist }; @@ -810,7 +810,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { values = nullIsEmpty(unwrap(params, getClassLoaderFor(name), defaultClassLoader, - Object[].class)); + Object[].class, delegationSubject)); try { final Object params2[] = @@ -990,7 +990,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { filterValues[i] = unwrap(filters[i], targetCl, defaultClassLoader, - NotificationFilter.class); + NotificationFilter.class, delegationSubjects[i]); if (debug) logger.debug("addNotificationListener"+ "(ObjectName,NotificationFilter)", @@ -1058,7 +1058,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { +" unwrapping filter with target extended ClassLoader."); filterValue = - unwrap(filter, targetCl, defaultClassLoader, NotificationFilter.class); + unwrap(filter, targetCl, defaultClassLoader, NotificationFilter.class, delegationSubject); if (debug) logger.debug("addNotificationListener"+ "(ObjectName,ObjectName,NotificationFilter,Object)", @@ -1066,7 +1066,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { +" unwrapping handback with target extended ClassLoader."); handbackValue = - unwrap(handback, targetCl, defaultClassLoader, Object.class); + unwrap(handback, targetCl, defaultClassLoader, Object.class, delegationSubject); try { final Object params[] = @@ -1197,7 +1197,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { +" unwrapping filter with target extended ClassLoader."); filterValue = - unwrap(filter, targetCl, defaultClassLoader, NotificationFilter.class); + unwrap(filter, targetCl, defaultClassLoader, NotificationFilter.class, delegationSubject); if (debug) logger.debug("removeNotificationListener"+ "(ObjectName,ObjectName,NotificationFilter,Object)", @@ -1205,7 +1205,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { +" unwrapping handback with target extended ClassLoader."); handbackValue = - unwrap(handback, targetCl, defaultClassLoader, Object.class); + unwrap(handback, targetCl, defaultClassLoader, Object.class, delegationSubject); try { final Object params[] = @@ -1549,20 +1549,38 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } - private static T unwrap(final MarshalledObject mo, + private T unwrap(final MarshalledObject mo, final ClassLoader cl, - final Class wrappedClass) + final Class wrappedClass, + Subject delegationSubject) throws IOException { if (mo == null) { return null; } try { final ClassLoader old = AccessController.doPrivileged(new SetCcl(cl)); - try { - return wrappedClass.cast(mo.get()); - } catch (ClassNotFoundException cnfe) { - throw new UnmarshalException(cnfe.toString(), cnfe); - } finally { + try{ + final AccessControlContext reqACC; + if (delegationSubject == null) + reqACC = acc; + else { + if (subject == null) { + final String msg = + "Subject delegation cannot be enabled unless " + + "an authenticated subject is put in place"; + throw new SecurityException(msg); + } + reqACC = subjectDelegator.delegatedContext( + acc, delegationSubject, removeCallerContext); + } + if(reqACC != null){ + return AccessController.doPrivileged( + (PrivilegedExceptionAction) () -> + wrappedClass.cast(mo.get()), reqACC); + }else{ + return wrappedClass.cast(mo.get()); + } + }finally{ AccessController.doPrivileged(new SetCcl(old)); } } catch (PrivilegedActionException pe) { @@ -1575,14 +1593,19 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } logger.warning("unwrap", "Failed to unmarshall object: " + e); logger.debug("unwrap", e); + }catch (ClassNotFoundException ex) { + logger.warning("unwrap", "Failed to unmarshall object: " + ex); + logger.debug("unwrap", ex); + throw new UnmarshalException(ex.toString(), ex); } return null; } - private static T unwrap(final MarshalledObject mo, + private T unwrap(final MarshalledObject mo, final ClassLoader cl1, final ClassLoader cl2, - final Class wrappedClass) + final Class wrappedClass, + Subject delegationSubject) throws IOException { if (mo == null) { return null; @@ -1596,7 +1619,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } ); - return unwrap(mo, orderCL, wrappedClass); + return unwrap(mo, orderCL, wrappedClass,delegationSubject); } catch (PrivilegedActionException pe) { Exception e = extractException(pe); if (e instanceof IOException) { From 6e132741b6a1480dea4b9cfd4e8bbe1d6f0351c9 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Tue, 13 Sep 2016 00:20:17 +0000 Subject: [PATCH 09/71] 8165071: Expand TLS support Reviewed-by: jnimeh, ahgross, asmotrak --- jdk/src/java.base/share/conf/security/java.security | 9 +++++---- .../net/ssl/SSLParameters/UseCipherSuitesOrder.java | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security index fe45e0ba06c..974dc0a839f 100644 --- a/jdk/src/java.base/share/conf/security/java.security +++ b/jdk/src/java.base/share/conf/security/java.security @@ -720,7 +720,7 @@ jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024, \ # Note: The algorithm restrictions do not apply to trust anchors or # self-signed certificates. # -# Note: This property is currently used by Oracle's JSSE implementation. +# Note: This property is currently used by the JDK Reference implementation. # It is not guaranteed to be examined and used by other implementations. # # Example: @@ -740,7 +740,7 @@ jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024, \ # During SSL/TLS security parameters negotiation, legacy algorithms will # not be negotiated unless there are no other candidates. # -# The syntax of the disabled algorithm string is described as this Java +# The syntax of the legacy algorithms string is described as this Java # BNF-style: # LegacyAlgorithms: # " LegacyAlgorithm { , LegacyAlgorithm } " @@ -776,7 +776,7 @@ jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024, \ # javax.net.ssl.SSLParameters.setAlgorithmConstraints()), # then the algorithm is completely disabled and will not be negotiated. # -# Note: This property is currently used by Oracle's JSSE implementation. +# Note: This property is currently used by the JDK Reference implementation. # It is not guaranteed to be examined and used by other implementations. # There is no guarantee the property will continue to exist or be of the # same syntax in future releases. @@ -789,7 +789,8 @@ jdk.tls.legacyAlgorithms= \ DHE_DSS_EXPORT, DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, \ DH_RSA_EXPORT, RSA_EXPORT, \ DH_anon, ECDH_anon, \ - RC4_128, RC4_40, DES_CBC, DES40_CBC + RC4_128, RC4_40, DES_CBC, DES40_CBC, \ + 3DES_EDE_CBC # The pre-defined default finite field Diffie-Hellman ephemeral (DHE) # parameters for Transport Layer Security (SSL/TLS/DTLS) processing. diff --git a/jdk/test/javax/net/ssl/SSLParameters/UseCipherSuitesOrder.java b/jdk/test/javax/net/ssl/SSLParameters/UseCipherSuitesOrder.java index 87712ae0ce8..58e387bcdad 100644 --- a/jdk/test/javax/net/ssl/SSLParameters/UseCipherSuitesOrder.java +++ b/jdk/test/javax/net/ssl/SSLParameters/UseCipherSuitesOrder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,7 +31,7 @@ * @bug 7188657 * @summary There should be a way to reorder the JSSE ciphers * @run main/othervm UseCipherSuitesOrder - * TLS_RSA_WITH_AES_128_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA + * TLS_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA */ import java.io.*; From 3463ee94d8ff97b130df05eb9f2ac44048567152 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Tue, 13 Sep 2016 11:59:56 +0100 Subject: [PATCH 10/71] 8164147: Improve streaming socket output Reviewed-by: chegar, igerasim --- .../classes/java/net/SocketInputStream.java | 7 +- .../classes/java/net/SocketOutputStream.java | 8 +- .../unix/native/libnet/SocketOutputStream.c | 42 ++++--- .../native/libnet/SocketOutputStream.c | 113 +++++++++--------- 4 files changed, 90 insertions(+), 80 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java index 2fb035ef7d8..2f54d344659 100644 --- a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java +++ b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2016, 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 @@ -155,11 +155,12 @@ class SocketInputStream extends FileInputStream } // bounds check - if (length <= 0 || off < 0 || off + length > b.length) { + if (length <= 0 || off < 0 || length > b.length - off) { if (length == 0) { return 0; } - throw new ArrayIndexOutOfBoundsException(); + throw new ArrayIndexOutOfBoundsException("length == " + length + + " off == " + off + " buffer length == " + b.length); } boolean gotReset = false; diff --git a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java index 4aa1e53761b..9cbe056066f 100644 --- a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java +++ b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2016, 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 @@ -97,11 +97,13 @@ class SocketOutputStream extends FileOutputStream */ private void socketWrite(byte b[], int off, int len) throws IOException { - if (len <= 0 || off < 0 || off + len > b.length) { + + if (len <= 0 || off < 0 || len > b.length - off) { if (len == 0) { return; } - throw new ArrayIndexOutOfBoundsException(); + throw new ArrayIndexOutOfBoundsException("len == " + len + + " off == " + off + " buffer length == " + b.length); } FileDescriptor fd = impl.acquireFD(); diff --git a/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c b/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c index 17afe8b8d46..ba3a907ae67 100644 --- a/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c +++ b/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c @@ -98,27 +98,31 @@ Java_java_net_SocketOutputStream_socketWrite0(JNIEnv *env, jobject this, int llen = chunkLen; (*env)->GetByteArrayRegion(env, data, off, chunkLen, (jbyte *)bufP); - while(llen > 0) { - int n = NET_Send(fd, bufP + loff, llen, 0); - if (n > 0) { - llen -= n; - loff += n; - continue; + if ((*env)->ExceptionCheck(env)) { + break; + } else { + while(llen > 0) { + int n = NET_Send(fd, bufP + loff, llen, 0); + if (n > 0) { + llen -= n; + loff += n; + continue; + } + if (errno == ECONNRESET) { + JNU_ThrowByName(env, "sun/net/ConnectionResetException", + "Connection reset"); + } else { + JNU_ThrowByNameWithMessageAndLastError + (env, "java/net/SocketException", "Write failed"); + } + if (bufP != BUF) { + free(bufP); + } + return; } - if (errno == ECONNRESET) { - JNU_ThrowByName(env, "sun/net/ConnectionResetException", - "Connection reset"); - } else { - JNU_ThrowByNameWithMessageAndLastError - (env, "java/net/SocketException", "Write failed"); - } - if (bufP != BUF) { - free(bufP); - } - return; + len -= chunkLen; + off += chunkLen; } - len -= chunkLen; - off += chunkLen; } if (bufP != BUF) { diff --git a/jdk/src/java.base/windows/native/libnet/SocketOutputStream.c b/jdk/src/java.base/windows/native/libnet/SocketOutputStream.c index 9894cb0e596..dcb533b753e 100644 --- a/jdk/src/java.base/windows/native/libnet/SocketOutputStream.c +++ b/jdk/src/java.base/windows/native/libnet/SocketOutputStream.c @@ -92,66 +92,69 @@ Java_java_net_SocketOutputStream_socketWrite0(JNIEnv *env, jobject this, int retry = 0; (*env)->GetByteArrayRegion(env, data, off, chunkLen, (jbyte *)bufP); - - while(llen > 0) { - int n = send(fd, bufP + loff, llen, 0); - if (n > 0) { - llen -= n; - loff += n; - continue; - } - - /* - * Due to a bug in Windows Sockets (observed on NT and Windows - * 2000) it may be necessary to retry the send. The issue is that - * on blocking sockets send/WSASend is supposed to block if there - * is insufficient buffer space available. If there are a large - * number of threads blocked on write due to congestion then it's - * possile to hit the NT/2000 bug whereby send returns WSAENOBUFS. - * The workaround we use is to retry the send. If we have a - * large buffer to send (>2k) then we retry with a maximum of - * 2k buffer. If we hit the issue with <=2k buffer then we backoff - * for 1 second and retry again. We repeat this up to a reasonable - * limit before bailing out and throwing an exception. In load - * conditions we've observed that the send will succeed after 2-3 - * attempts but this depends on network buffers associated with - * other sockets draining. - */ - if (WSAGetLastError() == WSAENOBUFS) { - if (llen > MAX_BUFFER_LEN) { - buflen = MAX_BUFFER_LEN; - chunkLen = MAX_BUFFER_LEN; - llen = MAX_BUFFER_LEN; + if ((*env)->ExceptionCheck(env)) { + break; + } else { + while(llen > 0) { + int n = send(fd, bufP + loff, llen, 0); + if (n > 0) { + llen -= n; + loff += n; continue; } - if (retry >= 30) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", - "No buffer space available - exhausted attempts to queue buffer"); - if (bufP != BUF) { - free(bufP); - } - return; - } - Sleep(1000); - retry++; - continue; - } - /* - * Send failed - can be caused by close or write error. - */ - if (WSAGetLastError() == WSAENOTSOCK) { - JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed"); - } else { - NET_ThrowCurrent(env, "socket write error"); + /* + * Due to a bug in Windows Sockets (observed on NT and Windows + * 2000) it may be necessary to retry the send. The issue is that + * on blocking sockets send/WSASend is supposed to block if there + * is insufficient buffer space available. If there are a large + * number of threads blocked on write due to congestion then it's + * possile to hit the NT/2000 bug whereby send returns WSAENOBUFS. + * The workaround we use is to retry the send. If we have a + * large buffer to send (>2k) then we retry with a maximum of + * 2k buffer. If we hit the issue with <=2k buffer then we backoff + * for 1 second and retry again. We repeat this up to a reasonable + * limit before bailing out and throwing an exception. In load + * conditions we've observed that the send will succeed after 2-3 + * attempts but this depends on network buffers associated with + * other sockets draining. + */ + if (WSAGetLastError() == WSAENOBUFS) { + if (llen > MAX_BUFFER_LEN) { + buflen = MAX_BUFFER_LEN; + chunkLen = MAX_BUFFER_LEN; + llen = MAX_BUFFER_LEN; + continue; + } + if (retry >= 30) { + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", + "No buffer space available - exhausted attempts to queue buffer"); + if (bufP != BUF) { + free(bufP); + } + return; + } + Sleep(1000); + retry++; + continue; + } + + /* + * Send failed - can be caused by close or write error. + */ + if (WSAGetLastError() == WSAENOTSOCK) { + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed"); + } else { + NET_ThrowCurrent(env, "socket write error"); + } + if (bufP != BUF) { + free(bufP); + } + return; } - if (bufP != BUF) { - free(bufP); - } - return; + len -= chunkLen; + off += chunkLen; } - len -= chunkLen; - off += chunkLen; } if (bufP != BUF) { From 452a01e1030334dd16c3c1eb3718478fbde8823c Mon Sep 17 00:00:00 2001 From: Harsha Wardhana B Date: Thu, 15 Sep 2016 13:24:24 +0530 Subject: [PATCH 11/71] 8165230: RMIConnection addNotificationListeners failing with specific inputs Reviewed-by: dfuchs, skoivu --- .../javax/management/remote/rmi/RMIConnectionImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java index 03b652a0ba7..fb7c00cd2d9 100644 --- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java +++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -990,7 +990,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { filterValues[i] = unwrap(filters[i], targetCl, defaultClassLoader, - NotificationFilter.class, delegationSubjects[i]); + NotificationFilter.class, sbjs[i]); if (debug) logger.debug("addNotificationListener"+ "(ObjectName,NotificationFilter)", From b96a819e4b70fbe29309b7caf7bc1d1424651ae8 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Tue, 27 Sep 2016 03:23:40 +0300 Subject: [PATCH 12/71] 8164143: Improve components for menu items Reviewed-by: ssadetsky, prr, ddehaven --- .../com/apple/eawt/_AppMenuBarHandler.java | 2 +- .../sun/lwawt/macosx/CCheckboxMenuItem.java | 15 ++-- .../sun/lwawt/macosx/CFRetainedResource.java | 68 ++++++++++++++++++- .../classes/sun/lwawt/macosx/CMenu.java | 44 ++++++------ .../classes/sun/lwawt/macosx/CMenuBar.java | 17 ++--- .../sun/lwawt/macosx/CMenuComponent.java | 32 ++++----- .../classes/sun/lwawt/macosx/CMenuItem.java | 35 ++++++---- .../sun/lwawt/macosx/CPlatformWindow.java | 2 +- .../classes/sun/lwawt/macosx/CPopupMenu.java | 14 ++-- .../classes/sun/lwawt/macosx/CTrayIcon.java | 7 +- .../macosx/native/libawt_lwawt/awt/CMenu.m | 15 ++-- .../macosx/native/libawt_lwawt/awt/CMenuBar.m | 19 ++---- .../native/libawt_lwawt/awt/CMenuComponent.m | 40 +---------- .../native/libawt_lwawt/awt/CMenuItem.h | 4 +- .../native/libawt_lwawt/awt/CMenuItem.m | 41 ++++------- 15 files changed, 184 insertions(+), 171 deletions(-) diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java index 027cbcf67e6..e017b32538a 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java @@ -123,7 +123,7 @@ class _AppMenuBarHandler { } // grab the pointer to the CMenuBar, and retain it in native - nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); + ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar); } void setAboutMenuItemVisible(final boolean present) { diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CCheckboxMenuItem.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CCheckboxMenuItem.java index da53c302ad5..d21de341fb4 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CCheckboxMenuItem.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CCheckboxMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -26,29 +26,28 @@ package sun.lwawt.macosx; import java.awt.CheckboxMenuItem; -import java.awt.EventQueue; import java.awt.event.ItemEvent; import java.awt.peer.CheckboxMenuItemPeer; import sun.awt.SunToolkit; public class CCheckboxMenuItem extends CMenuItem implements CheckboxMenuItemPeer { - boolean fAutoToggle = true; - boolean fIsIndeterminate = false; + volatile boolean fAutoToggle = true; + volatile boolean fIsIndeterminate = false; private native void nativeSetState(long modelPtr, boolean state); private native void nativeSetIsCheckbox(long modelPtr); - CCheckboxMenuItem(CheckboxMenuItem target) { + CCheckboxMenuItem(final CheckboxMenuItem target) { super(target); - nativeSetIsCheckbox(getModel()); + execute(this::nativeSetIsCheckbox); setState(target.getState()); } // MenuItemPeer implementation @Override - public void setState(boolean state) { - nativeSetState(getModel(), state); + public void setState(final boolean state) { + execute(ptr -> nativeSetState(ptr, state)); } public void handleAction(final boolean state) { diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java index cec76f5c897..f69ad201ef8 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java @@ -23,7 +23,6 @@ * questions. */ - package sun.lwawt.macosx; /** @@ -34,6 +33,7 @@ public class CFRetainedResource { private static native void nativeCFRelease(final long ptr, final boolean disposeOnAppKitThread); private final boolean disposeOnAppKitThread; + // TODO this pointer should be private and accessed via CFNativeAction class protected volatile long ptr; /** @@ -70,8 +70,72 @@ public class CFRetainedResource { nativeCFRelease(oldPtr, disposeOnAppKitThread); // perform outside of the synchronized block } + /** + * The interface which allows to execute some native operations with + * assumption that the native pointer will be valid till the end. + */ + public interface CFNativeAction { + + /** + * The native operation should be called from this method. + * + * @param ptr the pointer to the native data + */ + void run(long ptr); + } + + /** + * The interface which allows to execute some native operations and get a + * result with assumption that the native pointer will be valid till the + * end. + */ + interface CFNativeActionGet { + + /** + * The native operation should be called from this method. + * + * @param ptr the pointer to the native data + * @return result of the native operation + */ + long run(long ptr); + } + + /** + * This is utility method which should be used instead of the direct access + * to the {@link #ptr}, because this method guaranteed that the pointer will + * not be zero and will be valid till the end of the operation.It is highly + * recomended to not use any external lock in action. If the current + * {@link #ptr} is {@code 0} then action will be ignored. + * + * @param action The native operation + */ + public final synchronized void execute(final CFNativeAction action) { + if (ptr != 0) { + action.run(ptr); + } + } + + /** + * This is utility method which should be used instead of the direct access + * to the {@link #ptr}, because this method guaranteed that the pointer will + * not be zero and will be valid till the end of the operation. It is highly + * recomended to not use any external lock in action. If the current + * {@link #ptr} is {@code 0} then action will be ignored and {@code} is + * returned. + * + * @param action the native operation + * @return result of the native operation, usually the native pointer to + * some other data + */ + final synchronized long executeGet(final CFNativeActionGet action) { + if (ptr != 0) { + return action.run(ptr); + } + return 0; + } + @Override - protected void finalize() throws Throwable { + protected final void finalize() throws Throwable { dispose(); } } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenu.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenu.java index 9e1499b8de9..4f2fc96ad8a 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenu.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,9 @@ package sun.lwawt.macosx; -import java.awt.*; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; import java.awt.peer.MenuItemPeer; import java.awt.peer.MenuPeer; @@ -37,7 +39,7 @@ public class CMenu extends CMenuItem implements MenuPeer { // This way we avoiding invocation of the setters twice @Override - protected void initialize(MenuItem target) { + protected final void initialize(MenuItem target) { setLabel(target.getLabel()); setEnabled(target.isEnabled()); } @@ -57,52 +59,50 @@ public class CMenu extends CMenuItem implements MenuPeer { } @Override - protected long createModel() { + long createModel() { CMenuComponent parent = (CMenuComponent) LWCToolkit.targetToPeer(getTarget().getParent()); - if (parent instanceof CMenu || - parent instanceof CPopupMenu) - { - return nativeCreateSubMenu(parent.getModel()); - } else if (parent instanceof CMenuBar) { + if (parent instanceof CMenu) { + return parent.executeGet(this::nativeCreateSubMenu); + } + if (parent instanceof CMenuBar) { MenuBar parentContainer = (MenuBar)getTarget().getParent(); boolean isHelpMenu = parentContainer.getHelpMenu() == getTarget(); int insertionLocation = ((CMenuBar)parent).getNextInsertionIndex(); - return nativeCreateMenu(parent.getModel(), - isHelpMenu, insertionLocation); - } else { - throw new InternalError("Parent must be CMenu or CMenuBar"); + return parent.executeGet(ptr -> nativeCreateMenu(ptr, isHelpMenu, + insertionLocation)); } + throw new InternalError("Parent must be CMenu or CMenuBar"); } @Override - public void addItem(MenuItem item) { + public final void addItem(MenuItem item) { // Nothing to do here -- we added it when we created the // menu item's peer. } @Override - public void delItem(int index) { - nativeDeleteItem(getModel(), index); + public final void delItem(final int index) { + execute(ptr -> nativeDeleteItem(ptr, index)); } @Override - public void setLabel(String label) { - nativeSetMenuTitle(getModel(), label); + public final void setLabel(final String label) { + execute(ptr->nativeSetMenuTitle(ptr, label)); super.setLabel(label); } // Note that addSeparator is never called directly from java.awt.Menu, // though it is required in the MenuPeer interface. @Override - public void addSeparator() { - nativeAddSeparator(getModel()); + public final void addSeparator() { + execute(this::nativeAddSeparator); } // Used by ScreenMenuBar to get to the native menu for event handling. - public long getNativeMenu() { - return nativeGetNSMenu(getModel()); + public final long getNativeMenu() { + return executeGet(this::nativeGetNSMenu); } private native long nativeCreateMenu(long parentMenuPtr, diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java index 7d2aa7b7beb..3dd64a97422 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -31,7 +31,7 @@ import java.awt.peer.MenuBarPeer; import sun.awt.AWTAccessor; -public class CMenuBar extends CMenuComponent implements MenuBarPeer { +public final class CMenuBar extends CMenuComponent implements MenuBarPeer { private int nextInsertionIndex = -1; @@ -40,14 +40,15 @@ public class CMenuBar extends CMenuComponent implements MenuBarPeer { } @Override - protected long createModel() { + long createModel() { return nativeCreateMenuBar(); } @Override - public void addHelpMenu(Menu m) { - CMenu cMenu = AWTAccessor.getMenuComponentAccessor().getPeer(m); - nativeSetHelpMenu(getModel(), cMenu.getModel()); + public void addHelpMenu(final Menu m) { + final CMenu cMenu = AWTAccessor.getMenuComponentAccessor().getPeer(m); + execute(parentPtr -> cMenu.execute( + menuPtr -> nativeSetHelpMenu(parentPtr, menuPtr))); } public int getNextInsertionIndex() { @@ -65,8 +66,8 @@ public class CMenuBar extends CMenuComponent implements MenuBarPeer { } @Override - public void delMenu(int index) { - nativeDelMenu(getModel(), index); + public void delMenu(final int index) { + execute(ptr -> nativeDelMenu(ptr, index)); } private native long nativeCreateMenuBar(); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuComponent.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuComponent.java index 2dbc923859c..6100916be3e 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuComponent.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -29,36 +29,32 @@ import java.awt.Font; import java.awt.MenuComponent; import java.awt.peer.MenuComponentPeer; -public abstract class CMenuComponent implements MenuComponentPeer { +abstract class CMenuComponent extends CFRetainedResource + implements MenuComponentPeer { - private MenuComponent target; - private long modelPtr; + private final MenuComponent target; - CMenuComponent(MenuComponent target) { + CMenuComponent(final MenuComponent target) { + super(0, true); this.target = target; - this.modelPtr = createModel(); + setPtr(createModel()); } - MenuComponent getTarget() { + final MenuComponent getTarget() { return target; } - public long getModel() { - return modelPtr; - } + abstract long createModel(); - protected abstract long createModel(); - - public void dispose() { + @Override + public final void dispose() { + super.dispose(); LWCToolkit.targetDisposedPeer(target, this); - nativeDispose(modelPtr); - target = null; } - private native void nativeDispose(long modelPtr); - // 1.5 peer method - public void setFont(Font f) { + @Override + public final void setFont(final Font f) { // no-op, as we don't currently support menu fonts // c.f. radar 4032912 } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuItem.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuItem.java index 2fca524922b..0230c4e842f 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuItem.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,16 +25,17 @@ package sun.lwawt.macosx; -import sun.awt.SunToolkit; -import sun.lwawt.LWToolkit; - -import java.awt.MenuContainer; import java.awt.MenuItem; import java.awt.MenuShortcut; -import java.awt.event.*; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; import java.awt.peer.MenuItemPeer; import java.util.concurrent.atomic.AtomicBoolean; +import sun.awt.SunToolkit; +import sun.lwawt.LWToolkit; + public class CMenuItem extends CMenuComponent implements MenuItemPeer { private final AtomicBoolean enabled = new AtomicBoolean(true); @@ -58,9 +59,9 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer { } @Override - protected long createModel() { + long createModel() { CMenuComponent parent = (CMenuComponent)LWToolkit.targetToPeer(getTarget().getParent()); - return nativeCreate(parent.getModel(), isSeparator()); + return parent.executeGet(ptr->nativeCreate(ptr, isSeparator())); } public void setLabel(String label, char keyChar, int keyCode, int modifiers) { @@ -90,7 +91,12 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer { keyChar = 0; } - nativeSetLabel(getModel(), label, keyChar, keyCode, keyMask); + final String finalLabel = label; + final char finalKeyChar = keyChar; + final int finalKeyCode = keyCode; + final int finalKeyMask = keyMask; + execute(ptr -> nativeSetLabel(ptr, finalLabel, finalKeyChar, + finalKeyCode, finalKeyMask)); } @Override @@ -105,16 +111,16 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer { * There isn't a need to expose this except in a instanceof because * it isn't defined in the peer api. */ - public void setImage(java.awt.Image img) { + public final void setImage(final java.awt.Image img) { CImage cimg = CImage.getCreator().createFromImage(img); - nativeSetImage(getModel(), cimg == null ? 0L : cimg.ptr); + execute(ptr -> nativeSetImage(ptr, cimg == null ? 0L : cimg.ptr)); } /** * New API for tooltips */ - public void setToolTipText(String text) { - nativeSetTooltip(getModel(), text); + public final void setToolTipText(final String text) { + execute(ptr -> nativeSetTooltip(ptr, text)); } // @Override @@ -138,7 +144,8 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer { b &= ((CMenuItem) parent).isEnabled(); } if (enabled.compareAndSet(!b, b)) { - nativeSetEnabled(getModel(), b); + final boolean finalB = b; + execute(ptr->nativeSetEnabled(ptr, finalB)); } } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 38dd927c70f..102851f3b87 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -449,7 +449,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo final long nsWindowPtr = getNSWindowPtr(); CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb); if (mbPeer != null) { - nativeSetNSWindowMenuBar(nsWindowPtr, mbPeer.getModel()); + mbPeer.execute(ptr -> nativeSetNSWindowMenuBar(nsWindowPtr, ptr)); } else { nativeSetNSWindowMenuBar(nsWindowPtr, 0); } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPopupMenu.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPopupMenu.java index 67ddf91471a..b73f67a0f79 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPopupMenu.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPopupMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,18 +25,20 @@ package sun.lwawt.macosx; -import java.awt.*; +import java.awt.Component; +import java.awt.Event; +import java.awt.Point; +import java.awt.PopupMenu; import java.awt.peer.PopupMenuPeer; -import sun.lwawt.LWWindowPeer; +final class CPopupMenu extends CMenu implements PopupMenuPeer { -public class CPopupMenu extends CMenu implements PopupMenuPeer { CPopupMenu(PopupMenu target) { super(target); } @Override - protected long createModel() { + long createModel() { return nativeCreatePopupMenu(); } @@ -50,7 +52,7 @@ public class CPopupMenu extends CMenu implements PopupMenuPeer { Point loc = origin.getLocationOnScreen(); e.x += loc.x; e.y += loc.y; - nativeShowPopupMenu(getModel(), e.x, e.y); + execute(ptr -> nativeShowPopupMenu(ptr, e.x, e.y)); } } } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java index abd092b8be9..bcbb242f949 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -118,7 +118,10 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer { } } - return checkAndCreatePopupPeer().getModel(); + // This method is executed on Appkit, so if ptr is not zero means that, + // it is still not deallocated(even if we call NSApp postRunnableEvent) + // and sent CFRelease to the native queue + return checkAndCreatePopupPeer().ptr; } /** diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m index 43b08f09d2c..fe42ac75247 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ - (id)initWithPeer:(jobject)peer { AWT_ASSERT_APPKIT_THREAD; // Create the new NSMenu - self = [super initWithPeer:peer asSeparator:[NSNumber numberWithBool:NO]]; + self = [super initWithPeer:peer asSeparator:NO]; if (self) { fMenu = [NSMenu javaMenuWithTitle:@""]; [fMenu retain]; @@ -133,14 +133,13 @@ AWT_ASSERT_APPKIT_THREAD; CMenu * createCMenu (jobject cPeerObjGlobal) { - CMenu *aCMenu = nil; + __block CMenu *aCMenu = nil; - // We use an array here only to be able to get a return value - NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], nil]; + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - [ThreadUtilities performOnMainThread:@selector(_create_OnAppKitThread:) on:[CMenu alloc] withObject:args waitUntilDone:YES]; - - aCMenu = (CMenu *)[args objectAtIndex: 0]; + aCMenu = [[CMenu alloc] initWithPeer:cPeerObjGlobal]; + // the aCMenu is released in CMenuComponent.dispose() + }]; if (aCMenu == nil) { return 0L; diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.m index 34ba099331b..2de86be755b 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -383,27 +383,20 @@ JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CMenuBar_nativeCreateMenuBar (JNIEnv *env, jobject peer) { - CMenuBar *aCMenuBar = nil; + __block CMenuBar *aCMenuBar = nil; JNF_COCOA_ENTER(env); jobject cPeerObjGlobal = (*env)->NewGlobalRef(env, peer); - // We use an array here only to be able to get a return value - NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], nil]; - - [ThreadUtilities performOnMainThread:@selector(_create_OnAppKitThread:) on:[CMenuBar alloc] withObject:args waitUntilDone:YES]; - - aCMenuBar = (CMenuBar *)[args objectAtIndex: 0]; + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + aCMenuBar = [[CMenuBar alloc] initWithPeer:cPeerObjGlobal]; + // the aCMenuBar is released in CMenuComponent.dispose() + }]; if (aCMenuBar == nil) { return 0L; } - // [args release]; - - // A strange memory managment after that. - - JNF_COCOA_EXIT(env); return ptr_to_jlong(aCMenuBar); } diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.m index c3bff14241c..cf093cd650c 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -41,45 +41,11 @@ return self; } --(void) cleanup { - // Used by subclasses -} - --(void) disposer { +- (void)dealloc { JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; JNFDeleteGlobalRef(env, fPeer); fPeer = NULL; - [self cleanup]; - [self release]; + [super dealloc]; } - -// The method is used by all subclasses, since the process of the creation -// is the same. The only exception is the CMenuItem class. -- (void) _create_OnAppKitThread: (NSMutableArray *)argValue { - jobject cPeerObjGlobal = (jobject)[[argValue objectAtIndex: 0] pointerValue]; - CMenuItem *aCMenuItem = [self initWithPeer:cPeerObjGlobal]; - [argValue removeAllObjects]; - [argValue addObject: aCMenuItem]; -} - @end - -/* - * Class: sun_lwawt_macosx_CMenuComponent - * Method: nativeDispose - * Signature: (J)V - */ -JNIEXPORT void JNICALL -Java_sun_lwawt_macosx_CMenuComponent_nativeDispose -(JNIEnv *env, jobject peer, jlong menuItemObj) -{ -JNF_COCOA_ENTER(env); - - [ThreadUtilities performOnMainThread:@selector(disposer) - on:((id)jlong_to_ptr(menuItemObj)) - withObject:nil - waitUntilDone:NO]; - -JNF_COCOA_EXIT(env); -} diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.h index 60a0565f3f6..e2c72f2e539 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.h +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -32,7 +32,7 @@ } // Setup -- (id) initWithPeer:(jobject)peer asSeparator: (NSNumber *) asSeparator; +- (id) initWithPeer:(jobject)peer asSeparator: (BOOL) asSeparator; - (void) setIsCheckbox; // Events diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m index bcf7893005c..c9cc97ae21e 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -39,11 +39,11 @@ @implementation CMenuItem -- (id) initWithPeer:(jobject)peer asSeparator: (NSNumber *) asSeparator{ +- (id) initWithPeer:(jobject)peer asSeparator: (BOOL) asSeparator{ AWT_ASSERT_APPKIT_THREAD; self = [super initWithPeer:peer]; if (self) { - if ([asSeparator boolValue]) { + if (asSeparator) { fMenuItem = (NSMenuItem*)[NSMenuItem separatorItem]; [fMenuItem retain]; } else { @@ -204,12 +204,9 @@ }]; } -- (void)cleanup { +- (void)dealloc { [fMenuItem setAction:NULL]; [fMenuItem setTarget:nil]; -} - -- (void)dealloc { [fMenuItem release]; fMenuItem = nil; @@ -228,14 +225,6 @@ fIsCheckbox = YES; } -- (void) _createMenuItem_OnAppKitThread: (NSMutableArray *)argValue { - jobject cPeerObjGlobal = (jobject)[[argValue objectAtIndex: 0] pointerValue]; - NSNumber * asSeparator = (NSNumber *)[argValue objectAtIndex: 1]; - CMenuItem *aCMenuItem = [self initWithPeer: cPeerObjGlobal asSeparator: asSeparator]; - [argValue removeAllObjects]; - [argValue addObject: aCMenuItem]; -} - - (NSString *)description { return [NSString stringWithFormat:@"CMenuItem[ %@ ]", fMenuItem]; } @@ -397,24 +386,18 @@ Java_sun_lwawt_macosx_CMenuItem_nativeCreate (JNIEnv *env, jobject peer, jlong parentCMenuObj, jboolean isSeparator) { - CMenuItem *aCMenuItem = nil; + __block CMenuItem *aCMenuItem = nil; + BOOL asSeparator = (isSeparator == JNI_TRUE) ? YES: NO; CMenu *parentCMenu = (CMenu *)jlong_to_ptr(parentCMenuObj); JNF_COCOA_ENTER(env); jobject cPeerObjGlobal = (*env)->NewGlobalRef(env, peer); - - NSMutableArray *args = nil; - - // Create a new item.... - if (isSeparator == JNI_TRUE) { - args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], [NSNumber numberWithBool:YES], nil]; - } else { - args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], [NSNumber numberWithBool:NO], nil]; - } - - [ThreadUtilities performOnMainThread:@selector(_createMenuItem_OnAppKitThread:) on:[CMenuItem alloc] withObject:args waitUntilDone:YES]; - - aCMenuItem = (CMenuItem *)[args objectAtIndex: 0]; + + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + aCMenuItem = [[CMenuItem alloc] initWithPeer: cPeerObjGlobal + asSeparator: asSeparator]; + // the CMenuItem is released in CMenuComponent.dispose() + }]; if (aCMenuItem == nil) { return 0L; From 79f1e4263bf559829ca45c1ecad912198a20b9b1 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Tue, 27 Sep 2016 16:35:28 +0300 Subject: [PATCH 13/71] 8162973: Better component components Reviewed-by: ssadetsky, prr, ahgross --- .../windows/native/libawt/windows/awt_Component.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp index f2d32860e32..edd513263d9 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp @@ -99,7 +99,6 @@ BOOL AwtComponent::sm_restoreFocusAndActivation = FALSE; HWND AwtComponent::sm_focusOwner = NULL; HWND AwtComponent::sm_focusedWindow = NULL; BOOL AwtComponent::sm_bMenuLoop = FALSE; -AwtComponent* AwtComponent::sm_getComponentCache = NULL; BOOL AwtComponent::sm_inSynthesizeFocus = FALSE; /************************************************************************/ @@ -276,10 +275,6 @@ AwtComponent::~AwtComponent() * handle. */ DestroyHWnd(); - - if (sm_getComponentCache == this) { - sm_getComponentCache = NULL; - } } void AwtComponent::Dispose() @@ -352,9 +347,6 @@ AwtComponent* AwtComponent::GetComponent(HWND hWnd) { if (hWnd == AwtToolkit::GetInstance().GetHWnd()) { return NULL; } - if (sm_getComponentCache && sm_getComponentCache->GetHWnd() == hWnd) { - return sm_getComponentCache; - } // check that it's an AWT component from the same toolkit as the caller if (::IsWindow(hWnd) && @@ -362,7 +354,7 @@ AwtComponent* AwtComponent::GetComponent(HWND hWnd) { { DASSERT(WmAwtIsComponent != 0); if (::SendMessage(hWnd, WmAwtIsComponent, 0, 0L)) { - return sm_getComponentCache = GetComponentImpl(hWnd); + return GetComponentImpl(hWnd); } } return NULL; From 09a11f3b8709217dfb3a0cc263cbeeb6b1c30722 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Tue, 4 Oct 2016 17:15:49 -0400 Subject: [PATCH 14/71] 8140353: Improve signature checking Reviewed-by: xuelei, ahgross, mchung --- .../java.base/share/classes/module-info.java | 1 + .../share/conf/security/java.security | 10 ++++-- .../share/lib/security/default.policy | 2 ++ .../dsig/internal/dom/DOMSignatureMethod.java | 36 ++++++++++++++++++- .../org/jcp/xml/dsig/internal/dom/Policy.java | 18 ++++++++++ 5 files changed, 64 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 2fd479eb925..1f62f7e6751 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -279,6 +279,7 @@ module java.base { java.security.jgss, java.security.sasl, java.smartcardio, + java.xml.crypto, jdk.crypto.ec, jdk.crypto.token, jdk.jartool, diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security index 974dc0a839f..08c6804f5e2 100644 --- a/jdk/src/java.base/share/conf/security/java.security +++ b/jdk/src/java.base/share/conf/security/java.security @@ -913,7 +913,7 @@ crypto.policy=crypto.policydir-tbd # Constraint {"," Constraint } # Constraint: # AlgConstraint | MaxTransformsConstraint | MaxReferencesConstraint | -# ReferenceUriSchemeConstraint | OtherConstraint +# ReferenceUriSchemeConstraint | KeySizeConstraint | OtherConstraint # AlgConstraint # "disallowAlg" Uri # MaxTransformsConstraint: @@ -922,12 +922,16 @@ crypto.policy=crypto.policydir-tbd # "maxReferences" Integer # ReferenceUriSchemeConstraint: # "disallowReferenceUriSchemes" String { String } +# KeySizeConstraint: +# "minKeySize" KeyAlg Integer # OtherConstraint: # "noDuplicateIds" | "noRetrievalMethodLoops" # # For AlgConstraint, Uri is the algorithm URI String that is not allowed. # See the XML Signature Recommendation for more information on algorithm -# URI Identifiers. If the MaxTransformsConstraint or MaxReferencesConstraint is +# URI Identifiers. For KeySizeConstraint, KeyAlg is the standard algorithm +# name of the key type (ex: "RSA"). If the MaxTransformsConstraint, +# MaxReferencesConstraint or KeySizeConstraint (for the same key type) is # specified more than once, only the last entry is enforced. # # Note: This property is currently used by the JDK Reference implementation. It @@ -941,6 +945,8 @@ jdk.xml.dsig.secureValidationPolicy=\ maxTransforms 5,\ maxReferences 30,\ disallowReferenceUriSchemes file http https,\ + minKeySize RSA 1024,\ + minKeySize DSA 1024,\ noDuplicateIds,\ noRetrievalMethodLoops diff --git a/jdk/src/java.base/share/lib/security/default.policy b/jdk/src/java.base/share/lib/security/default.policy index 0c1798fbe9b..1f445078c6b 100644 --- a/jdk/src/java.base/share/lib/security/default.policy +++ b/jdk/src/java.base/share/lib/security/default.policy @@ -81,6 +81,8 @@ grant codeBase "jrt:/java.xml.bind" { }; grant codeBase "jrt:/java.xml.crypto" { + permission java.lang.RuntimePermission + "accessClassInPackage.sun.security.util"; permission java.util.PropertyPermission "*", "read"; permission java.security.SecurityPermission "putProviderProperty.XMLDSig"; permission java.security.SecurityPermission diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java index 9e367695d61..ad80c3b49b6 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java @@ -21,7 +21,7 @@ * under the License. */ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: DOMSignatureMethod.java 1333415 2012-05-03 12:03:51Z coheigea $ @@ -41,6 +41,7 @@ import org.w3c.dom.Element; import com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureECDSA; import com.sun.org.apache.xml.internal.security.utils.JavaUtils; import org.jcp.xml.dsig.internal.SignerOutputStream; +import sun.security.util.KeyUtil; /** * DOM-based abstract implementation of SignatureMethod. @@ -207,6 +208,7 @@ public abstract class DOMSignatureMethod extends AbstractDOMSignatureMethod { if (!(key instanceof PublicKey)) { throw new InvalidKeyException("key must be PublicKey"); } + checkKeySize(context, key); if (signature == null) { Provider p = (Provider)context.getProperty( "org.jcp.xml.dsig.internal.dom.SignatureProvider"); @@ -234,6 +236,37 @@ public abstract class DOMSignatureMethod extends AbstractDOMSignatureMethod { return signature.verify(s); } + /** + * If secure validation mode is enabled, checks that the key size is + * restricted. + * + * @param context the context + * @param key the key to check + * @throws XMLSignatureException if the key size is restricted + */ + private static void checkKeySize(XMLCryptoContext context, Key key) + throws XMLSignatureException { + if (Utils.secureValidation(context)) { + int size = KeyUtil.getKeySize(key); + if (size == -1) { + // key size cannot be determined, so we cannot check against + // restrictions. Note that a DSA key w/o params will be + // rejected later if the certificate chain is validated. + if (log.isLoggable(java.util.logging.Level.FINE)) { + log.log(java.util.logging.Level.FINE, "Size for " + + key.getAlgorithm() + " key cannot be determined"); + } + return; + } + if (Policy.restrictKey(key.getAlgorithm(), size)) { + throw new XMLSignatureException(key.getAlgorithm() + + " keys less than " + + Policy.minKeySize(key.getAlgorithm()) + " bits are" + + " forbidden when secure validation is enabled"); + } + } + } + byte[] sign(Key key, SignedInfo si, XMLSignContext context) throws InvalidKeyException, XMLSignatureException { @@ -244,6 +277,7 @@ public abstract class DOMSignatureMethod extends AbstractDOMSignatureMethod { if (!(key instanceof PrivateKey)) { throw new InvalidKeyException("key must be PrivateKey"); } + checkKeySize(context, key); if (signature == null) { Provider p = (Provider)context.getProperty( "org.jcp.xml.dsig.internal.dom.SignatureProvider"); diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Policy.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Policy.java index af9bea40876..1608ad8481e 100644 --- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Policy.java +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Policy.java @@ -31,8 +31,10 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.Security; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.Locale; +import java.util.Map; import java.util.Set; /** @@ -46,6 +48,7 @@ public final class Policy { private static int maxTrans = Integer.MAX_VALUE; private static int maxRefs = Integer.MAX_VALUE; private static Set disallowedRefUriSchemes = new HashSet<>(); + private static Map minKeyMap = new HashMap<>(); private static boolean noDuplicateIds = false; private static boolean noRMLoops = false; @@ -101,6 +104,13 @@ public final class Policy { scheme.toLowerCase(Locale.ROOT)); } break; + case "minKeySize": + if (tokens.length != 3) { + error(entry); + } + minKeyMap.put(tokens[1], + Integer.parseUnsignedInt(tokens[2])); + break; case "noDuplicateIds": if (tokens.length != 1) { error(entry); @@ -147,6 +157,10 @@ public final class Policy { return false; } + public static boolean restrictKey(String type, int size) { + return (size < minKeyMap.getOrDefault(type, 0)); + } + public static boolean restrictDuplicateIds() { return noDuplicateIds; } @@ -171,6 +185,10 @@ public final class Policy { return Collections.unmodifiableSet(disallowedRefUriSchemes); } + public static int minKeySize(String type) { + return minKeyMap.getOrDefault(type, 0); + } + private static void error(String entry) { throw new IllegalArgumentException( "Invalid jdk.xml.dsig.secureValidationPolicy entry: " + entry); From c12cdd9a1c0f0e776b591baa98ea870cf7cac18d Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Wed, 5 Oct 2016 11:30:16 -0700 Subject: [PATCH 15/71] 8165344: Update concurrency support Reviewed-by: coffeys, robm, ahgross, chegar --- .../atomic/AtomicIntegerFieldUpdater.java | 22 +++++++++++- .../atomic/AtomicLongFieldUpdater.java | 34 +++++++++++++++++-- .../atomic/AtomicReferenceFieldUpdater.java | 22 +++++++++++- 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java index 55af35b0139..1de994f06ec 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java @@ -40,6 +40,7 @@ import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.Objects; import java.util.function.IntBinaryOperator; import java.util.function.IntUnaryOperator; import jdk.internal.misc.Unsafe; @@ -411,7 +412,17 @@ public abstract class AtomicIntegerFieldUpdater { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers)) ? caller : tclass; + // Access to protected field members is restricted to receivers only + // of the accessing class, or one of its subclasses, and the + // accessing class must in turn be a subclass (or package sibling) + // of the protected member's defining class. + // If the updater refers to a protected field of a declaring class + // outside the current package, the receiver argument will be + // narrowed to the type of the accessing class. + this.cclass = (Modifier.isProtected(modifiers) && + tclass.isAssignableFrom(caller) && + !isSamePackage(tclass, caller)) + ? caller : tclass; this.tclass = tclass; this.offset = U.objectFieldOffset(field); } @@ -432,6 +443,15 @@ public abstract class AtomicIntegerFieldUpdater { return false; } + /** + * Returns true if the two classes have the same class loader and + * package qualifier + */ + private static boolean isSamePackage(Class class1, Class class2) { + return class1.getClassLoader() == class2.getClassLoader() + && Objects.equals(class1.getPackageName(), class2.getPackageName()); + } + /** * Checks that target argument is instance of cclass. On * failure, throws cause. diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index ff444676685..bd60f0bdcbb 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -40,6 +40,7 @@ import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.Objects; import java.util.function.LongBinaryOperator; import java.util.function.LongUnaryOperator; import jdk.internal.misc.Unsafe; @@ -409,7 +410,17 @@ public abstract class AtomicLongFieldUpdater { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers)) ? caller : tclass; + // Access to protected field members is restricted to receivers only + // of the accessing class, or one of its subclasses, and the + // accessing class must in turn be a subclass (or package sibling) + // of the protected member's defining class. + // If the updater refers to a protected field of a declaring class + // outside the current package, the receiver argument will be + // narrowed to the type of the accessing class. + this.cclass = (Modifier.isProtected(modifiers) && + tclass.isAssignableFrom(caller) && + !isSamePackage(tclass, caller)) + ? caller : tclass; this.tclass = tclass; this.offset = U.objectFieldOffset(field); } @@ -540,7 +551,17 @@ public abstract class AtomicLongFieldUpdater { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers)) ? caller : tclass; + // Access to protected field members is restricted to receivers only + // of the accessing class, or one of its subclasses, and the + // accessing class must in turn be a subclass (or package sibling) + // of the protected member's defining class. + // If the updater refers to a protected field of a declaring class + // outside the current package, the receiver argument will be + // narrowed to the type of the accessing class. + this.cclass = (Modifier.isProtected(modifiers) && + tclass.isAssignableFrom(caller) && + !isSamePackage(tclass, caller)) + ? caller : tclass; this.tclass = tclass; this.offset = U.objectFieldOffset(field); } @@ -621,4 +642,13 @@ public abstract class AtomicLongFieldUpdater { } while (acl != null); return false; } + + /** + * Returns true if the two classes have the same class loader and + * package qualifier + */ + static boolean isSamePackage(Class class1, Class class2) { + return class1.getClassLoader() == class2.getClassLoader() + && Objects.equals(class1.getPackageName(), class2.getPackageName()); + } } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java index 2b75d5654ae..56f6751b9f0 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java @@ -40,6 +40,7 @@ import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.Objects; import java.util.function.BinaryOperator; import java.util.function.UnaryOperator; import jdk.internal.misc.Unsafe; @@ -351,7 +352,17 @@ public abstract class AtomicReferenceFieldUpdater { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers)) ? caller : tclass; + // Access to protected field members is restricted to receivers only + // of the accessing class, or one of its subclasses, and the + // accessing class must in turn be a subclass (or package sibling) + // of the protected member's defining class. + // If the updater refers to a protected field of a declaring class + // outside the current package, the receiver argument will be + // narrowed to the type of the accessing class. + this.cclass = (Modifier.isProtected(modifiers) && + tclass.isAssignableFrom(caller) && + !isSamePackage(tclass, caller)) + ? caller : tclass; this.tclass = tclass; this.vclass = vclass; this.offset = U.objectFieldOffset(field); @@ -373,6 +384,15 @@ public abstract class AtomicReferenceFieldUpdater { return false; } + /** + * Returns true if the two classes have the same class loader and + * package qualifier + */ + private static boolean isSamePackage(Class class1, Class class2) { + return class1.getClassLoader() == class2.getClassLoader() + && Objects.equals(class1.getPackageName(), class2.getPackageName()); + } + /** * Checks that target argument is instance of cclass. On * failure, throws cause. From 7007b4d6f21912f4ef6e8c958ddf86ea71c3e494 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Thu, 6 Oct 2016 17:33:57 +0100 Subject: [PATCH 16/71] 8158997: JNDI Protocols Switch Reviewed-by: dfuchs --- .../jndi/rmi/registry/RegistryContext.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java index 720a1ff940f..874d6872af5 100644 --- a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java +++ b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java @@ -32,6 +32,8 @@ import java.rmi.*; import java.rmi.server.*; import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; +import java.security.AccessController; +import java.security.PrivilegedAction; import javax.naming.*; import javax.naming.spi.NamingManager; @@ -52,6 +54,18 @@ public class RegistryContext implements Context, Referenceable { private int port; private static final NameParser nameParser = new AtomicNameParser(); private static final String SOCKET_FACTORY = "com.sun.jndi.rmi.factory.socket"; + /** + * Determines whether classes may be loaded from an arbitrary URL code base. + */ + static final boolean trustURLCodebase; + static { + // System property to control whether classes may be loaded from an + // arbitrary URL codebase + PrivilegedAction act = () -> System.getProperty( + "com.sun.jndi.rmi.object.trustURLCodebase", "false"); + String trust = AccessController.doPrivileged(act); + trustURLCodebase = "true".equalsIgnoreCase(trust); + } Reference reference = null; // ref used to create this context, if any @@ -460,6 +474,27 @@ public class RegistryContext implements Context, Referenceable { Object obj = (r instanceof RemoteReference) ? ((RemoteReference)r).getReference() : (Object)r; + + /* + * Classes may only be loaded from an arbitrary URL codebase when + * the system property com.sun.jndi.rmi.object.trustURLCodebase + * has been set to "true". + */ + + // Use reference if possible + Reference ref = null; + if (obj instanceof Reference) { + ref = (Reference) obj; + } else if (obj instanceof Referenceable) { + ref = ((Referenceable)(obj)).getReference(); + } + + if (ref != null && ref.getFactoryClassLocation() != null && + !trustURLCodebase) { + throw new ConfigurationException( + "The object factory is untrusted. Set the system property" + + " 'com.sun.jndi.rmi.object.trustURLCodebase' to 'true'."); + } return NamingManager.getObjectInstance(obj, name, this, environment); } catch (NamingException e) { From 7a1887e91ce50162dc6c89449f290ee34b28b9b0 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Thu, 6 Oct 2016 17:33:57 +0100 Subject: [PATCH 17/71] 8158997: JNDI Protocols Switch Reviewed-by: dfuchs --- .../jndi/cosnaming/CNBindingEnumeration.java | 7 ++++- .../classes/com/sun/jndi/cosnaming/CNCtx.java | 26 ++++++++++++++-- .../sun/jndi/cosnaming/ExceptionMapper.java | 11 +++++-- .../sun/jndi/toolkit/corba/CorbaUtils.java | 31 +++++++++++++++++-- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java b/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java index ae5c61d6fe7..7c6d58de772 100644 --- a/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java +++ b/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java @@ -33,6 +33,8 @@ import java.util.Hashtable; import org.omg.CosNaming.*; +import com.sun.jndi.toolkit.corba.CorbaUtils; + /** * Implements the JNDI NamingEnumeration interface for COS * Naming. Gets hold of a list of bindings from the COS Naming Server @@ -212,7 +214,10 @@ final class CNBindingEnumeration Name cname = CNNameParser.cosNameToName(bndg.binding_name); try { - obj = NamingManager.getObjectInstance(obj, cname, _ctx, _env); + // Check whether object factory codebase is trusted + if (CorbaUtils.isObjectFactoryTrusted(obj)) { + obj = NamingManager.getObjectInstance(obj, cname, _ctx, _env); + } } catch (NamingException e) { throw e; } catch (Exception e) { diff --git a/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java b/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java index 3d77c3746b7..82078e3f0dc 100644 --- a/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java +++ b/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java @@ -36,6 +36,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; +import java.security.AccessController; +import java.security.PrivilegedAction; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; @@ -82,6 +84,19 @@ public class CNCtx implements javax.naming.Context { private static final String FED_PROP = "com.sun.jndi.cosnaming.federation"; boolean federation = false; + /** + * Determines whether classes may be loaded from an arbitrary URL code base. + */ + public static final boolean trustURLCodebase; + static { + // System property to control whether classes may be loaded from an + // arbitrary URL code base + PrivilegedAction act = () -> System.getProperty( + "com.sun.jndi.cosnaming.object.trustURLCodebase", "false"); + String trust = AccessController.doPrivileged(act); + trustURLCodebase = "true".equalsIgnoreCase(trust); + } + // Reference counter for tracking _orb references OrbReuseTracker orbTracker = null; int enumCount; @@ -534,12 +549,16 @@ public class CNCtx implements javax.naming.Context { if (name.size() == 0 ) return this; // %%% should clone() so that env can be changed NameComponent[] path = CNNameParser.nameToCosName(name); + java.lang.Object answer = null; try { - java.lang.Object answer = callResolve(path); - + answer = callResolve(path); try { - return NamingManager.getObjectInstance(answer, name, this, _env); + // Check whether object factory codebase is trusted + if (CorbaUtils.isObjectFactoryTrusted(answer)) { + answer = NamingManager.getObjectInstance( + answer, name, this, _env); + } } catch (NamingException e) { throw e; } catch (Exception e) { @@ -552,6 +571,7 @@ public class CNCtx implements javax.naming.Context { javax.naming.Context cctx = getContinuationContext(cpe); return cctx.lookup(cpe.getRemainingName()); } + return answer; } /** diff --git a/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java b/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java index a1e9fd66424..1f626d5da0d 100644 --- a/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java +++ b/corba/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java @@ -33,6 +33,8 @@ import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; +import com.sun.jndi.toolkit.corba.CorbaUtils; + /** * A convenience class to map the COS Naming exceptions to the JNDI exceptions. * @author Raj Krishnamurthy @@ -202,10 +204,13 @@ public final class ExceptionMapper { // Not a context, use object factory to transform object. Name cname = CNNameParser.cosNameToName(resolvedName); - java.lang.Object resolvedObj2; + java.lang.Object resolvedObj2 = null; try { - resolvedObj2 = NamingManager.getObjectInstance(resolvedObj, - cname, ctx, ctx._env); + // Check whether object factory codebase is trusted + if (CorbaUtils.isObjectFactoryTrusted(resolvedObj)) { + resolvedObj2 = NamingManager.getObjectInstance(resolvedObj, + cname, ctx, ctx._env); + } } catch (NamingException ge) { throw ge; } catch (Exception ge) { diff --git a/corba/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java b/corba/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java index 422857bcc1e..856ce9d24d2 100644 --- a/corba/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java +++ b/corba/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java @@ -36,11 +36,12 @@ import java.applet.Applet; import org.omg.CORBA.ORB; -import javax.naming.Context; -import javax.naming.ConfigurationException; +import javax.naming.*; import javax.rmi.CORBA.Stub; import javax.rmi.PortableRemoteObject; +import com.sun.jndi.cosnaming.CNCtx; + import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URLDecoder; @@ -182,6 +183,32 @@ public class CorbaUtils { return ORB.init(new String[0], orbProp); } + /** + * Check whether object factory code base is trusted. + * Classes may only be loaded from an arbitrary URL code base when + * the system property com.sun.jndi.rmi.object.trustURLCodebase + * has been set to "true". + */ + public static boolean isObjectFactoryTrusted(Object obj) + throws NamingException { + + // Extract Reference, if possible + Reference ref = null; + if (obj instanceof Reference) { + ref = (Reference) obj; + } else if (obj instanceof Referenceable) { + ref = ((Referenceable)(obj)).getReference(); + } + + if (ref != null && ref.getFactoryClassLocation() != null && + !CNCtx.trustURLCodebase) { + throw new ConfigurationException( + "The object factory is untrusted. Set the system property" + + " 'com.sun.jndi.cosnaming.object.trustURLCodebase' to 'true'."); + } + return true; + } + /** * Decode a URI string (according to RFC 2396). */ From 698c52a1eb615d409963efae884a16f6408eea16 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 6 Oct 2016 10:31:41 -0700 Subject: [PATCH 18/71] 8166988: Improve image processing performance Reviewed-by: serb, vadim, mschoene --- .../com/sun/imageio/plugins/png/PNGImageReader.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java index 79a31fd71b0..a2d7e7ecafc 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java @@ -735,7 +735,11 @@ public class PNGImageReader extends ImageReader { parse_iCCP_chunk(chunkLength); break; case iTXt_TYPE: - parse_iTXt_chunk(chunkLength); + if (ignoreMetadata) { + stream.skipBytes(chunkLength); + } else { + parse_iTXt_chunk(chunkLength); + } break; case pHYs_TYPE: parse_pHYs_chunk(); @@ -759,7 +763,11 @@ public class PNGImageReader extends ImageReader { parse_tRNS_chunk(chunkLength); break; case zTXt_TYPE: - parse_zTXt_chunk(chunkLength); + if (ignoreMetadata) { + stream.skipBytes(chunkLength); + } else { + parse_zTXt_chunk(chunkLength); + } break; default: // Read an unknown chunk From 90e6cda73c08be29fa1fd85d16db9e1f3eaa7abe Mon Sep 17 00:00:00 2001 From: Xuelei Fan Date: Sun, 9 Oct 2016 14:38:30 +0300 Subject: [PATCH 19/71] 8166878: Connection reset during TLS handshake Reviewed-by: xuelei --- .../share/classes/sun/security/ssl/ClientHandshaker.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java index 1f155a6bf2a..b95de5ecde2 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java @@ -673,8 +673,11 @@ final class ClientHandshaker extends Handshaker { } else { // we wanted to resume, but the server refused // - // Invalidate the session in case of reusing next time. - session.invalidate(); + // Invalidate the session for initial handshake in case + // of reusing next time. + if (isInitialHandshake) { + session.invalidate(); + } session = null; if (!enableNewSession) { throw new SSLException("New session creation is disabled"); From e68ae2ec8e728ffaddb2bbde20bf96b86004152d Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Wed, 12 Oct 2016 12:56:35 -0400 Subject: [PATCH 20/71] 8156802: Better constraint checking Reviewed-by: dfuchs --- .../share/conf/security/java.security | 30 +++ .../classes/java/rmi/MarshalledObject.java | 39 +++- .../sun/rmi/registry/RegistryImpl.java | 115 ++++++++++- .../share/classes/sun/rmi/runtime/Log.java | 5 + .../classes/sun/rmi/transport/DGCImpl.java | 95 ++++++++- .../rmi/MarshalledObject/MOFilterTest.java | 140 +++++++++++++ .../serialFilter/RegistryFilterTest.java | 186 ++++++++++++++++++ .../serialFilter/java.security-extra1 | 9 + .../rmi/registry/serialFilter/security.policy | 4 + 9 files changed, 610 insertions(+), 13 deletions(-) create mode 100644 jdk/test/java/rmi/MarshalledObject/MOFilterTest.java create mode 100644 jdk/test/java/rmi/registry/serialFilter/RegistryFilterTest.java create mode 100644 jdk/test/java/rmi/registry/serialFilter/java.security-extra1 create mode 100644 jdk/test/java/rmi/registry/serialFilter/security.policy diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security index 08c6804f5e2..61a5169322c 100644 --- a/jdk/src/java.base/share/conf/security/java.security +++ b/jdk/src/java.base/share/conf/security/java.security @@ -658,6 +658,36 @@ krb5.kdc.bad.policy = tryLast jdk.certpath.disabledAlgorithms=MD2, MD5, SHA1 jdkCA & denyAfter 2017-01-01, \ RSA keySize < 1024, DSA keySize < 1024, EC keySize < 224 +# +# RMI Registry Serial Filter +# +# The filter pattern uses the same format as jdk.serialFilter. +# This filter can override the builtin filter if additional types need to be +# allowed or rejected from the RMI Registry. +# +# Note: This property is currently used by the JDK Reference implementation. +# It is not guaranteed to be examined and used by other implementations. +# +#sun.rmi.registry.registryFilter=pattern;pattern +# +# RMI Distributed Garbage Collector (DGC) Serial Filter +# +# The filter pattern uses the same format as jdk.serialFilter. +# This filter can override the builtin filter if additional types need to be +# allowed or rejected from the RMI DGC. +# +# Note: This property is currently used by the JDK Reference implementation. +# It is not guaranteed to be examined and used by other implementations. +# +# The builtin DGC filter can approximately be represented as the filter pattern: +# +#sun.rmi.transport.dgcFilter=\ +# java.rmi.server.ObjID;\ +# java.rmi.server.UID;\ +# java.rmi.dgc.VMID;\ +# java.rmi.dgc.Lease;\ +# maxdepth=5;maxarray=10000 + # Algorithm restrictions for signed JAR files # # In some environments, certain algorithms or key lengths may be undesirable diff --git a/jdk/src/java.rmi/share/classes/java/rmi/MarshalledObject.java b/jdk/src/java.rmi/share/classes/java/rmi/MarshalledObject.java index b5f8b73123f..7b6e4cb4a0a 100644 --- a/jdk/src/java.rmi/share/classes/java/rmi/MarshalledObject.java +++ b/jdk/src/java.rmi/share/classes/java/rmi/MarshalledObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -29,11 +29,15 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.ObjectInputFilter; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamConstants; import java.io.OutputStream; import java.io.Serializable; +import java.security.AccessController; +import java.security.PrivilegedAction; + import sun.rmi.server.MarshalInputStream; import sun.rmi.server.MarshalOutputStream; @@ -90,6 +94,9 @@ public final class MarshalledObject implements Serializable { */ private int hash; + /** Filter used when creating the instance from a stream; may be null. */ + private transient ObjectInputFilter objectInputFilter = null; + /** Indicate compatibility with 1.2 version of class. */ private static final long serialVersionUID = 8988374069173025854L; @@ -132,10 +139,26 @@ public final class MarshalledObject implements Serializable { hash = h; } + /** + * Reads in the state of the object and saves the stream's + * serialization filter to be used when the object is deserialized. + * + * @param stream the stream + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if a class cannot be found + */ + private void readObject(ObjectInputStream stream) + throws IOException, ClassNotFoundException { + stream.defaultReadObject(); // read in all fields + objectInputFilter = stream.getObjectInputFilter(); + } + /** * Returns a new copy of the contained marshalledobject. The internal * representation is deserialized with the semantics used for * unmarshaling parameters for RMI calls. + * If the MarshalledObject was read from an ObjectInputStream, + * the filter from that stream is used to deserialize the object. * * @return a copy of the contained object * @exception IOException if an IOException occurs while @@ -155,7 +178,7 @@ public final class MarshalledObject implements Serializable { ByteArrayInputStream lin = (locBytes == null ? null : new ByteArrayInputStream(locBytes)); MarshalledObjectInputStream in = - new MarshalledObjectInputStream(bin, lin); + new MarshalledObjectInputStream(bin, lin, objectInputFilter); @SuppressWarnings("unchecked") T obj = (T) in.readObject(); in.close(); @@ -295,11 +318,21 @@ public final class MarshalledObject implements Serializable { * null, then all annotations will be * null. */ - MarshalledObjectInputStream(InputStream objIn, InputStream locIn) + MarshalledObjectInputStream(InputStream objIn, InputStream locIn, + ObjectInputFilter filter) throws IOException { super(objIn); this.locIn = (locIn == null ? null : new ObjectInputStream(locIn)); + if (filter != null) { + AccessController.doPrivileged((PrivilegedAction) () -> { + MarshalledObjectInputStream.this.setObjectInputFilter(filter); + if (MarshalledObjectInputStream.this.locIn != null) { + MarshalledObjectInputStream.this.locIn.setObjectInputFilter(filter); + } + return null; + }); + } } /** diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java index 03119cc9552..d45cfac685e 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java @@ -25,8 +25,12 @@ package sun.rmi.registry; +import java.io.ObjectInputFilter; import java.nio.file.Path; import java.nio.file.Paths; +import java.rmi.server.LogStream; +import java.security.PrivilegedAction; +import java.security.Security; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; @@ -39,7 +43,6 @@ import java.io.IOException; import java.net.*; import java.rmi.*; import java.rmi.server.ObjID; -import java.rmi.server.RemoteServer; import java.rmi.server.ServerNotActiveException; import java.rmi.registry.Registry; import java.rmi.server.RMIClientSocketFactory; @@ -54,12 +57,12 @@ import java.security.PermissionCollection; import java.security.Permissions; import java.security.ProtectionDomain; import java.text.MessageFormat; -import sun.rmi.server.LoaderHandler; + +import sun.rmi.runtime.Log; +import sun.rmi.server.UnicastRef; import sun.rmi.server.UnicastServerRef; import sun.rmi.server.UnicastServerRef2; import sun.rmi.transport.LiveRef; -import sun.rmi.transport.ObjectTable; -import sun.rmi.transport.Target; /** * A "registry" exists on every node that allows RMI connections to @@ -90,6 +93,48 @@ public class RegistryImpl extends java.rmi.server.RemoteServer private static ResourceBundle resources = null; + /** + * Property name of the RMI Registry serial filter to augment + * the built-in list of allowed types. + * Setting the property in the {@code conf/security/java.security} file + * will enable the augmented filter. + */ + private static final String REGISTRY_FILTER_PROPNAME = "sun.rmi.registry.registryFilter"; + + /** Registry max depth of remote invocations. **/ + private static int REGISTRY_MAX_DEPTH = 5; + + /** Registry maximum array size in remote invocations. **/ + private static int REGISTRY_MAX_ARRAY_SIZE = 10000; + + /** + * The registryFilter created from the value of the {@code "sun.rmi.registry.registryFilter"} + * property. + */ + private static final ObjectInputFilter registryFilter = + AccessController.doPrivileged((PrivilegedAction)RegistryImpl::initRegistryFilter); + + /** + * Initialize the registryFilter from the security properties or system property; if any + * @return an ObjectInputFilter, or null + */ + @SuppressWarnings("deprecation") + private static ObjectInputFilter initRegistryFilter() { + ObjectInputFilter filter = null; + String props = System.getProperty(REGISTRY_FILTER_PROPNAME); + if (props == null) { + props = Security.getProperty(REGISTRY_FILTER_PROPNAME); + } + if (props != null) { + filter = ObjectInputFilter.Config.createFilter(props); + Log regLog = Log.getLog("sun.rmi.registry", "registry", -1); + if (regLog.isLoggable(Log.BRIEF)) { + regLog.log(Log.BRIEF, "registryFilter = " + filter); + } + } + return filter; + } + /** * Construct a new RegistryImpl on the specified port with the * given custom socket factory pair. @@ -105,7 +150,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer AccessController.doPrivileged(new PrivilegedExceptionAction() { public Void run() throws RemoteException { LiveRef lref = new LiveRef(id, port, csf, ssf); - setup(new UnicastServerRef2(lref)); + setup(new UnicastServerRef2(lref, RegistryImpl::registryFilter)); return null; } }, null, new SocketPermission("localhost:"+port, "listen,accept")); @@ -114,7 +159,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer } } else { LiveRef lref = new LiveRef(id, port, csf, ssf); - setup(new UnicastServerRef2(lref)); + setup(new UnicastServerRef2(lref, RegistryImpl::registryFilter)); } } @@ -130,7 +175,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer AccessController.doPrivileged(new PrivilegedExceptionAction() { public Void run() throws RemoteException { LiveRef lref = new LiveRef(id, port); - setup(new UnicastServerRef(lref)); + setup(new UnicastServerRef(lref, RegistryImpl::registryFilter)); return null; } }, null, new SocketPermission("localhost:"+port, "listen,accept")); @@ -139,7 +184,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer } } else { LiveRef lref = new LiveRef(id, port); - setup(new UnicastServerRef(lref)); + setup(new UnicastServerRef(lref, RegistryImpl::registryFilter)); } } @@ -361,6 +406,60 @@ public class RegistryImpl extends java.rmi.server.RemoteServer return paths.toArray(new URL[0]); } + /** + * ObjectInputFilter to filter Registry input objects. + * The list of acceptable classes is limited to classes normally + * stored in a registry. + * + * @param filterInfo access to the class, array length, etc. + * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, + * {@link ObjectInputFilter.Status#REJECTED} if rejected, + * otherwise {@link ObjectInputFilter.Status#UNDECIDED} + */ + private static ObjectInputFilter.Status registryFilter(ObjectInputFilter.FilterInfo filterInfo) { + if (registryFilter != null) { + ObjectInputFilter.Status status = registryFilter.checkInput(filterInfo); + if (status != ObjectInputFilter.Status.UNDECIDED) { + // The Registry filter can override the built-in white-list + return status; + } + } + + if (filterInfo.depth() > REGISTRY_MAX_DEPTH) { + return ObjectInputFilter.Status.REJECTED; + } + Class clazz = filterInfo.serialClass(); + if (clazz != null) { + if (clazz.isArray()) { + if (filterInfo.arrayLength() >= 0 && filterInfo.arrayLength() > REGISTRY_MAX_ARRAY_SIZE) { + return ObjectInputFilter.Status.REJECTED; + } + do { + // Arrays are allowed depending on the component type + clazz = clazz.getComponentType(); + } while (clazz.isArray()); + } + if (clazz.isPrimitive()) { + // Arrays of primitives are allowed + return ObjectInputFilter.Status.ALLOWED; + } + if (String.class == clazz + || java.lang.Number.class.isAssignableFrom(clazz) + || Remote.class.isAssignableFrom(clazz) + || java.lang.reflect.Proxy.class.isAssignableFrom(clazz) + || UnicastRef.class.isAssignableFrom(clazz) + || RMIClientSocketFactory.class.isAssignableFrom(clazz) + || RMIServerSocketFactory.class.isAssignableFrom(clazz) + || java.rmi.activation.ActivationID.class.isAssignableFrom(clazz) + || java.rmi.server.UID.class.isAssignableFrom(clazz)) { + return ObjectInputFilter.Status.ALLOWED; + } else { + return ObjectInputFilter.Status.REJECTED; + } + } + return ObjectInputFilter.Status.UNDECIDED; + } + /** * Return a new RegistryImpl on the requested port and export it to serve * registry requests. A classloader is initialized from the system property diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/runtime/Log.java b/jdk/src/java.rmi/share/classes/sun/rmi/runtime/Log.java index 9ba58a55539..d80d8e1f2da 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/runtime/Log.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/runtime/Log.java @@ -232,6 +232,11 @@ public abstract class Log { } } + public String toString() { + return logger.toString() + ", level: " + logger.getLevel() + + ", name: " + logger.getName(); + } + /** * Set the output stream associated with the RMI server call * logger. diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java b/jdk/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java index 6664a609e50..b1c9e6e8476 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -24,6 +24,7 @@ */ package sun.rmi.transport; +import java.io.ObjectInputFilter; import java.net.SocketPermission; import java.rmi.Remote; import java.rmi.RemoteException; @@ -34,11 +35,13 @@ import java.rmi.server.LogStream; import java.rmi.server.ObjID; import java.rmi.server.RemoteServer; import java.rmi.server.ServerNotActiveException; +import java.rmi.server.UID; import java.security.AccessControlContext; import java.security.AccessController; import java.security.Permissions; import java.security.PrivilegedAction; import java.security.ProtectionDomain; +import java.security.Security; import java.util.ArrayList; import java.util.HashSet; import java.util.HashMap; @@ -99,6 +102,46 @@ final class DGCImpl implements DGC { return dgc; } + /** + * Property name of the DGC serial filter to augment + * the built-in list of allowed types. + * Setting the property in the {@code conf/security/java.security} file + * or system property will enable the augmented filter. + */ + private static final String DGC_FILTER_PROPNAME = "sun.rmi.transport.dgcFilter"; + + /** Registry max depth of remote invocations. **/ + private static int DGC_MAX_DEPTH = 5; + + /** Registry maximum array size in remote invocations. **/ + private static int DGC_MAX_ARRAY_SIZE = 10000; + + /** + * The dgcFilter created from the value of the {@code "sun.rmi.transport.dgcFilter"} + * property. + */ + private static final ObjectInputFilter dgcFilter = + AccessController.doPrivileged((PrivilegedAction)DGCImpl::initDgcFilter); + + /** + * Initialize the dgcFilter from the security properties or system property; if any + * @return an ObjectInputFilter, or null + */ + private static ObjectInputFilter initDgcFilter() { + ObjectInputFilter filter = null; + String props = System.getProperty(DGC_FILTER_PROPNAME); + if (props == null) { + props = Security.getProperty(DGC_FILTER_PROPNAME); + } + if (props != null) { + filter = ObjectInputFilter.Config.createFilter(props); + if (dgcLog.isLoggable(Log.BRIEF)) { + dgcLog.log(Log.BRIEF, "dgcFilter = " + filter); + } + } + return filter; + } + /** * Construct a new server-side remote object collector at * a particular port. Disallow construction from outside. @@ -293,7 +336,8 @@ final class DGCImpl implements DGC { dgc = new DGCImpl(); ObjID dgcID = new ObjID(ObjID.DGC_ID); LiveRef ref = new LiveRef(dgcID, 0); - UnicastServerRef disp = new UnicastServerRef(ref); + UnicastServerRef disp = new UnicastServerRef(ref, + DGCImpl::checkInput); Remote stub = Util.createProxy(DGCImpl.class, new UnicastRef(ref), true); @@ -324,6 +368,53 @@ final class DGCImpl implements DGC { }); } + /** + * ObjectInputFilter to filter DGC input objects. + * The list of acceptable classes is very short and explicit. + * The depth and array sizes are limited. + * + * @param filterInfo access to class, arrayLength, etc. + * @return {@link ObjectInputFilter.Status#ALLOWED} if allowed, + * {@link ObjectInputFilter.Status#REJECTED} if rejected, + * otherwise {@link ObjectInputFilter.Status#UNDECIDED} + */ + private static ObjectInputFilter.Status checkInput(ObjectInputFilter.FilterInfo filterInfo) { + if (dgcFilter != null) { + ObjectInputFilter.Status status = dgcFilter.checkInput(filterInfo); + if (status != ObjectInputFilter.Status.UNDECIDED) { + // The DGC filter can override the built-in white-list + return status; + } + } + + if (filterInfo.depth() > DGC_MAX_DEPTH) { + return ObjectInputFilter.Status.REJECTED; + } + Class clazz = filterInfo.serialClass(); + if (clazz != null) { + while (clazz.isArray()) { + if (filterInfo.arrayLength() >= 0 && filterInfo.arrayLength() > DGC_MAX_ARRAY_SIZE) { + return ObjectInputFilter.Status.REJECTED; + } + // Arrays are allowed depending on the component type + clazz = clazz.getComponentType(); + } + if (clazz.isPrimitive()) { + // Arrays of primitives are allowed + return ObjectInputFilter.Status.ALLOWED; + } + return (clazz == ObjID.class || + clazz == UID.class || + clazz == VMID.class || + clazz == Lease.class) + ? ObjectInputFilter.Status.ALLOWED + : ObjectInputFilter.Status.REJECTED; + } + // Not a class, not size limited + return ObjectInputFilter.Status.UNDECIDED; + } + + private static class LeaseInfo { VMID vmid; long expiration; diff --git a/jdk/test/java/rmi/MarshalledObject/MOFilterTest.java b/jdk/test/java/rmi/MarshalledObject/MOFilterTest.java new file mode 100644 index 00000000000..c25b47467e8 --- /dev/null +++ b/jdk/test/java/rmi/MarshalledObject/MOFilterTest.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2016, 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.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InvalidClassException; +import java.io.ObjectInput; +import java.io.ObjectInputStream; +import java.io.ObjectInputFilter; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.rmi.MarshalledObject; +import java.util.Objects; + + +import org.testng.Assert; +import org.testng.annotations.Test; +import org.testng.annotations.DataProvider; + +/* @test + * @run testng/othervm MOFilterTest + * + * @summary Test MarshalledObject applies ObjectInputFilter + */ +@Test +public class MOFilterTest { + + /** + * Two cases are tested. + * The filter = null and a filter set to verify the calls to the filter. + * @return array objects with test parameters for each test case + */ + @DataProvider(name = "FilterCases") + public static Object[][] filterCases() { + return new Object[][] { + {true}, // run the test with the filter + {false}, // run the test without the filter + + }; + } + + /** + * Test that MarshalledObject inherits the ObjectInputFilter from + * the stream it was deserialized from. + */ + @Test(dataProvider="FilterCases") + static void delegatesToMO(boolean withFilter) { + try { + Serializable testobj = Integer.valueOf(5); + MarshalledObject mo = new MarshalledObject<>(testobj); + Assert.assertEquals(mo.get(), testobj, "MarshalledObject.get returned a non-equals test object"); + + byte[] bytes = writeObjects(mo); + + try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + ObjectInputStream ois = new ObjectInputStream(bais)) { + + CountingFilter filter1 = new CountingFilter(); + ois.setObjectInputFilter(withFilter ? filter1 : null); + MarshalledObject actualMO = (MarshalledObject)ois.readObject(); + int count = filter1.getCount(); + + actualMO.get(); + int expectedCount = withFilter ? count + 2 : count; + int actualCount = filter1.getCount(); + Assert.assertEquals(actualCount, expectedCount, "filter called wrong number of times during get()"); + } + } catch (IOException ioe) { + Assert.fail("Unexpected IOException", ioe); + } catch (ClassNotFoundException cnf) { + Assert.fail("Deserializing", cnf); + } + } + + /** + * Write objects and return a byte array with the bytes. + * + * @param objects zero or more objects to serialize + * @return the byte array of the serialized objects + * @throws IOException if an exception occurs + */ + static byte[] writeObjects(Object... objects) throws IOException { + byte[] bytes; + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos)) { + for (Object o : objects) { + oos.writeObject(o); + } + bytes = baos.toByteArray(); + } + return bytes; + } + + + static class CountingFilter implements ObjectInputFilter { + + private int count; // count of calls to the filter + + CountingFilter() { + count = 0; + } + + int getCount() { + return count; + } + + /** + * Filter that rejects class Integer and allows others + * + * @param filterInfo access to the class, arrayLength, etc. + * @return {@code STATUS.REJECTED} + */ + public ObjectInputFilter.Status checkInput(FilterInfo filterInfo) { + count++; + return ObjectInputFilter.Status.ALLOWED; + } + } + +} diff --git a/jdk/test/java/rmi/registry/serialFilter/RegistryFilterTest.java b/jdk/test/java/rmi/registry/serialFilter/RegistryFilterTest.java new file mode 100644 index 00000000000..e29e24aea8a --- /dev/null +++ b/jdk/test/java/rmi/registry/serialFilter/RegistryFilterTest.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2016, 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.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.Serializable; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.rmi.MarshalledObject; +import java.rmi.NotBoundException; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.AlreadyBoundException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; +import java.util.Objects; +import java.security.Security; + +import org.testng.Assert; +import org.testng.TestNG; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/* + * @test + * @library /java/rmi/testlibrary + * @modules java.rmi/sun.rmi.registry + * java.rmi/sun.rmi.server + * java.rmi/sun.rmi.transport + * java.rmi/sun.rmi.transport.tcp + * @build TestLibrary + * @summary Test filters for the RMI Registry + * @run testng/othervm RegistryFilterTest + * @run testng/othervm + * -Dsun.rmi.registry.registryFilter=!java.lang.Long;!RegistryFilterTest$RejectableClass + * RegistryFilterTest + * @run testng/othervm/policy=security.policy + * -Djava.security.properties=${test.src}/java.security-extra1 + * RegistryFilterTest + */ +public class RegistryFilterTest { + private static Registry impl; + private static int port; + private static Registry registry; + + static final int REGISTRY_MAX_ARRAY = 10000; + + static final String registryFilter = + System.getProperty("sun.rmi.registry.registryFilter", + Security.getProperty("sun.rmi.registry.registryFilter")); + + @DataProvider(name = "bindAllowed") + static Object[][] bindAllowedObjects() { + Object[][] objects = { + }; + return objects; + } + + /** + * Data RMI Regiry bind test. + * - name + * - Object + * - true/false if object is blacklisted by a filter (implicit or explicit) + * @return array of test data + */ + @DataProvider(name = "bindData") + static Object[][] bindObjects() { + Object[][] data = { + { "byte[max]", new XX(new byte[REGISTRY_MAX_ARRAY]), false }, + { "String", new XX("now is the time"), false}, + { "String[]", new XX(new String[3]), false}, + { "Long[4]", new XX(new Long[4]), registryFilter != null }, + { "rej-byte[toobig]", new XX(new byte[REGISTRY_MAX_ARRAY + 1]), true }, + { "rej-MarshalledObject", createMarshalledObject(), true }, + { "rej-RejectableClass", new RejectableClass(), registryFilter != null}, + }; + return data; + } + + static XX createMarshalledObject() { + try { + return new XX(new MarshalledObject<>(null)); + } catch (IOException ioe) { + return new XX(ioe); + } + } + + @BeforeSuite + static void setupRegistry() { + try { + impl = TestLibrary.createRegistryOnEphemeralPort(); + port = TestLibrary.getRegistryPort(impl); + registry = LocateRegistry.getRegistry("localhost", port); + } catch (RemoteException ex) { + Assert.fail("initialization of registry", ex); + } + + System.out.printf("RMI Registry filter: %s%n", registryFilter); + } + + + /* + * Test registry rejects an object with the max array size + 1. + */ + @Test(dataProvider="bindData") + public void simpleBind(String name, Remote obj, boolean blacklisted) throws RemoteException, AlreadyBoundException, NotBoundException { + try { + registry.bind(name, obj); + Assert.assertFalse(blacklisted, "Registry filter did not reject (but should have) "); + registry.unbind(name); + } catch (Exception rex) { + Assert.assertTrue(blacklisted, "Registry filter should not have rejected"); + } + } + + /* + * Test registry rejects an object with a well known class + * if blacklisted in the security properties. + */ + @Test + public void simpleRejectableClass() throws RemoteException, AlreadyBoundException, NotBoundException { + RejectableClass r1 = null; + try { + String name = "reject1"; + r1 = new RejectableClass(); + registry.bind(name, r1); + registry.unbind(name); + Assert.assertNull(registryFilter, "Registry filter should not have rejected"); + } catch (Exception rex) { + Assert.assertNotNull(registryFilter, "Registry filter should have rejected"); + } + } + + /** + * A simple Serializable Remote object that is passed by value. + * It and its contents are checked by the Registry serial filter. + */ + static class XX implements Serializable, Remote { + private static final long serialVersionUID = 362498820763181265L; + + final Object obj; + + XX(Object obj) { + this.obj = obj; + } + + public String toString() { + return super.toString() + "//" + Objects.toString(obj); + } + } + /** + * A simple Serializable Remote object that is passed by value. + * It and its contents are checked by the Registry serial filter. + */ + static class RejectableClass implements Serializable, Remote { + private static final long serialVersionUID = 362498820763181264L; + + RejectableClass() {} + } + +} diff --git a/jdk/test/java/rmi/registry/serialFilter/java.security-extra1 b/jdk/test/java/rmi/registry/serialFilter/java.security-extra1 new file mode 100644 index 00000000000..5c68f6fd344 --- /dev/null +++ b/jdk/test/java/rmi/registry/serialFilter/java.security-extra1 @@ -0,0 +1,9 @@ +# RMI Registry Input Serial Filter +# +# The filter pattern uses the same format as java.io.ObjectInputStream.serialFilter. +# This filter can override the builtin filter if additional types need to be +# allowed or rejected from the RMI Registry. +# +#sun.rmi.registry.registryFilter=pattern,pattern +sun.rmi.registry.registryFilter=!java.lang.Long;!RegistryFilterTest$RejectableClass + diff --git a/jdk/test/java/rmi/registry/serialFilter/security.policy b/jdk/test/java/rmi/registry/serialFilter/security.policy new file mode 100644 index 00000000000..554e9eaee47 --- /dev/null +++ b/jdk/test/java/rmi/registry/serialFilter/security.policy @@ -0,0 +1,4 @@ +grant { + permission java.security.AllPermission; +}; + From 300390f2757135ce3e851a2d7c2d71ff187e9e92 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Wed, 26 Oct 2016 15:12:53 -0400 Subject: [PATCH 21/71] 8167104: Additional class construction refinements Reviewed-by: acorn, mschoene, asmotrak --- .../src/share/vm/classfile/stackMapFrame.cpp | 46 ++----------------- .../src/share/vm/classfile/stackMapFrame.hpp | 7 +-- .../src/share/vm/classfile/stackMapTable.cpp | 23 +++++----- .../src/share/vm/classfile/stackMapTable.hpp | 6 +-- hotspot/src/share/vm/classfile/verifier.cpp | 4 +- .../handlerInTry/LoadHandlerInTry.java | 11 +++-- 6 files changed, 27 insertions(+), 70 deletions(-) diff --git a/hotspot/src/share/vm/classfile/stackMapFrame.cpp b/hotspot/src/share/vm/classfile/stackMapFrame.cpp index 1199a1d453e..2bd5f80db66 100644 --- a/hotspot/src/share/vm/classfile/stackMapFrame.cpp +++ b/hotspot/src/share/vm/classfile/stackMapFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -155,47 +155,8 @@ int StackMapFrame::is_assignable_to( return i; } -bool StackMapFrame::has_flag_match_exception( - const StackMapFrame* target) const { - // We allow flags of {UninitThis} to assign to {} if-and-only-if the - // target frame does not depend upon the current type. - // This is slightly too strict, as we need only enforce that the - // slots that were initialized by the (the things that were - // UninitializedThis before initialize_object() converted them) are unused. - // However we didn't save that information so we'll enforce this upon - // anything that might have been initialized. This is a rare situation - // and javac never generates code that would end up here, but some profilers - // (such as NetBeans) might, when adding exception handlers in - // methods to cover the invokespecial instruction. See 7020118. - - assert(max_locals() == target->max_locals() && - stack_size() == target->stack_size(), "StackMap sizes must match"); - - VerificationType top = VerificationType::top_type(); - VerificationType this_type = verifier()->current_type(); - - if (!flag_this_uninit() || target->flags() != 0) { - return false; - } - - for (int i = 0; i < target->locals_size(); ++i) { - if (locals()[i] == this_type && target->locals()[i] != top) { - return false; - } - } - - for (int i = 0; i < target->stack_size(); ++i) { - if (stack()[i] == this_type && target->stack()[i] != top) { - return false; - } - } - - return true; -} - bool StackMapFrame::is_assignable_to( - const StackMapFrame* target, bool is_exception_handler, - ErrorContext* ctx, TRAPS) const { + const StackMapFrame* target, ErrorContext* ctx, TRAPS) const { if (_max_locals != target->max_locals()) { *ctx = ErrorContext::locals_size_mismatch( _offset, (StackMapFrame*)this, (StackMapFrame*)target); @@ -226,8 +187,7 @@ bool StackMapFrame::is_assignable_to( return false; } - bool match_flags = (_flags | target->flags()) == target->flags(); - if (match_flags || is_exception_handler && has_flag_match_exception(target)) { + if ((_flags | target->flags()) == target->flags()) { return true; } else { *ctx = ErrorContext::bad_flags(target->offset(), diff --git a/hotspot/src/share/vm/classfile/stackMapFrame.hpp b/hotspot/src/share/vm/classfile/stackMapFrame.hpp index 43dfde0184c..0e13fd8b345 100644 --- a/hotspot/src/share/vm/classfile/stackMapFrame.hpp +++ b/hotspot/src/share/vm/classfile/stackMapFrame.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -167,8 +167,7 @@ class StackMapFrame : public ResourceObj { // Return true if this stack map frame is assignable to target. bool is_assignable_to( - const StackMapFrame* target, bool is_exception_handler, - ErrorContext* ctx, TRAPS) const; + const StackMapFrame* target, ErrorContext* ctx, TRAPS) const; inline void set_mark() { #ifdef ASSERT @@ -290,8 +289,6 @@ class StackMapFrame : public ResourceObj { int is_assignable_to( VerificationType* src, VerificationType* target, int32_t len, TRAPS) const; - bool has_flag_match_exception(const StackMapFrame* target) const; - TypeOrigin stack_top_ctx(); void print_on(outputStream* str) const; diff --git a/hotspot/src/share/vm/classfile/stackMapTable.cpp b/hotspot/src/share/vm/classfile/stackMapTable.cpp index 1c92b61e5fe..547dcf64b98 100644 --- a/hotspot/src/share/vm/classfile/stackMapTable.cpp +++ b/hotspot/src/share/vm/classfile/stackMapTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -70,26 +70,25 @@ int StackMapTable::get_index_from_offset(int32_t offset) const { bool StackMapTable::match_stackmap( StackMapFrame* frame, int32_t target, - bool match, bool update, bool handler, ErrorContext* ctx, TRAPS) const { + bool match, bool update, ErrorContext* ctx, TRAPS) const { int index = get_index_from_offset(target); - return match_stackmap(frame, target, index, match, update, handler, ctx, THREAD); + return match_stackmap(frame, target, index, match, update, ctx, THREAD); } // Match and/or update current_frame to the frame in stackmap table with // specified offset and frame index. Return true if the two frames match. -// handler is true if the frame in stackmap_table is for an exception handler. // -// The values of match and update are: _match__update__handler +// The values of match and update are: _match__update // -// checking a branch target: true false false -// checking an exception handler: true false true +// checking a branch target: true false +// checking an exception handler: true false // linear bytecode verification following an -// unconditional branch: false true false +// unconditional branch: false true // linear bytecode verification not following an -// unconditional branch: true true false +// unconditional branch: true true bool StackMapTable::match_stackmap( StackMapFrame* frame, int32_t target, int32_t frame_index, - bool match, bool update, bool handler, ErrorContext* ctx, TRAPS) const { + bool match, bool update, ErrorContext* ctx, TRAPS) const { if (frame_index < 0 || frame_index >= _frame_count) { *ctx = ErrorContext::missing_stackmap(frame->offset()); frame->verifier()->verify_error( @@ -102,7 +101,7 @@ bool StackMapTable::match_stackmap( if (match) { // Has direct control flow from last instruction, need to match the two // frames. - result = frame->is_assignable_to(stackmap_frame, handler, + result = frame->is_assignable_to(stackmap_frame, ctx, CHECK_VERIFY_(frame->verifier(), result)); } if (update) { @@ -126,7 +125,7 @@ void StackMapTable::check_jump_target( StackMapFrame* frame, int32_t target, TRAPS) const { ErrorContext ctx; bool match = match_stackmap( - frame, target, true, false, false, &ctx, CHECK_VERIFY(frame->verifier())); + frame, target, true, false, &ctx, CHECK_VERIFY(frame->verifier())); if (!match || (target < 0 || target >= _code_length)) { frame->verifier()->verify_error(ctx, "Inconsistent stackmap frames at branch target %d", target); diff --git a/hotspot/src/share/vm/classfile/stackMapTable.hpp b/hotspot/src/share/vm/classfile/stackMapTable.hpp index 590adda5f67..a2936d8df99 100644 --- a/hotspot/src/share/vm/classfile/stackMapTable.hpp +++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -60,12 +60,12 @@ class StackMapTable : public StackObj { // specified offset. Return true if the two frames match. bool match_stackmap( StackMapFrame* current_frame, int32_t offset, - bool match, bool update, bool handler, ErrorContext* ctx, TRAPS) const; + bool match, bool update, ErrorContext* ctx, TRAPS) const; // Match and/or update current_frame to the frame in stackmap table with // specified offset and frame index. Return true if the two frames match. bool match_stackmap( StackMapFrame* current_frame, int32_t offset, int32_t frame_index, - bool match, bool update, bool handler, ErrorContext* ctx, TRAPS) const; + bool match, bool update, ErrorContext* ctx, TRAPS) const; // Check jump instructions. Make sure there are no uninitialized // instances on backward branch. diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index 570a51fd7d9..e6264afdedf 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -1857,7 +1857,7 @@ u2 ClassVerifier::verify_stackmap_table(u2 stackmap_index, u2 bci, // If matched, current_frame will be updated by this method. bool matches = stackmap_table->match_stackmap( current_frame, this_offset, stackmap_index, - !no_control_flow, true, false, &ctx, CHECK_VERIFY_(this, 0)); + !no_control_flow, true, &ctx, CHECK_VERIFY_(this, 0)); if (!matches) { // report type error verify_error(ctx, "Instruction type does not match stack map"); @@ -1907,7 +1907,7 @@ void ClassVerifier::verify_exception_handler_targets(u2 bci, bool this_uninit, } ErrorContext ctx; bool matches = stackmap_table->match_stackmap( - new_frame, handler_pc, true, false, true, &ctx, CHECK_VERIFY(this)); + new_frame, handler_pc, true, false, &ctx, CHECK_VERIFY(this)); if (!matches) { verify_error(ctx, "Stack map does not match the one at " "exception handler %d", handler_pc); diff --git a/hotspot/test/runtime/handlerInTry/LoadHandlerInTry.java b/hotspot/test/runtime/handlerInTry/LoadHandlerInTry.java index 5fc7268790e..9c3e8f7866f 100644 --- a/hotspot/test/runtime/handlerInTry/LoadHandlerInTry.java +++ b/hotspot/test/runtime/handlerInTry/LoadHandlerInTry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -24,7 +24,7 @@ /* * @test * @bug 8075118 - * @summary Allow a ctor to call super() from a switch bytecode. + * @summary JVM stuck in infinite loop during verification * @compile HandlerInTry.jasm * @compile IsolatedHandlerInTry.jasm * @run main/othervm -Xverify:all LoadHandlerInTry @@ -70,9 +70,10 @@ public class LoadHandlerInTry { System.out.println("Regression test for bug 8075118"); try { Class newClass = Class.forName("HandlerInTry"); - } catch (Exception e) { - System.out.println("Failed: Exception was thrown: " + e.toString()); - throw e; + throw new RuntimeException( + "Failed to throw VerifyError for HandlerInTry"); + } catch (java.lang.VerifyError e) { + System.out.println("Passed: VerifyError exception was thrown"); } try { From ec3a122b19a4c9fb696271195a00a0c11b8b8262 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 10 Nov 2016 15:46:40 +0000 Subject: [PATCH 22/71] 8168728: DSA signing improvments Reviewed-by: valeriep, vinnie, ahgross, asmotrak, robm --- .../classes/sun/security/provider/DSA.java | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/provider/DSA.java b/jdk/src/java.base/share/classes/sun/security/provider/DSA.java index 554b0cc1cf7..c1cc11bf4ed 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/DSA.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/DSA.java @@ -427,13 +427,49 @@ abstract class DSA extends SignatureSpi { return t5.mod(q); } - // NOTE: This following impl is defined in FIPS 186-4 AppendixB.2.1. protected BigInteger generateK(BigInteger q) { + // Implementation defined in FIPS 186-4 AppendixB.2.1. SecureRandom random = getSigningRandom(); byte[] kValue = new byte[(q.bitLength() + 7)/8 + 8]; random.nextBytes(kValue); - return new BigInteger(1, kValue).mod(q.subtract(BigInteger.ONE)).add(BigInteger.ONE); + BigInteger k = new BigInteger(1, kValue).mod( + q.subtract(BigInteger.ONE)).add(BigInteger.ONE); + + // Using an equivalent exponent of fixed length (same as q or 1 bit + // less than q) to keep the kG timing relatively constant. + // + // Note that this is an extra step on top of the approach defined in + // FIPS 186-4 AppendixB.2.1 so as to make a fixed length K. + k = k.add(q).divide(BigInteger.TWO); + + // An alternative implementation based on FIPS 186-4 AppendixB2.2 + // with fixed-length K. + // + // Please keep it here as we may need to switch to it in the future. + // + // SecureRandom random = getSigningRandom(); + // byte[] kValue = new byte[(q.bitLength() + 7)/8]; + // BigInteger d = q.subtract(BigInteger.TWO); + // BigInteger k; + // do { + // random.nextBytes(kValue); + // BigInteger c = new BigInteger(1, kValue); + // if (c.compareTo(d) <= 0) { + // k = c.add(BigInteger.ONE); + // // Using an equivalent exponent of fixed length to keep + // // the g^k timing relatively constant. + // // + // // Note that this is an extra step on top of the approach + // // defined in FIPS 186-4 AppendixB.2.2 so as to make a + // // fixed length K. + // if (k.bitLength() >= q.bitLength()) { + // break; + // } + // } + // } while (true); + + return k; } // Use the application-specified SecureRandom Object if provided. From fc58c85eb4f88a6340680d448d20ef5c55127ce5 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 10 Nov 2016 15:52:48 +0000 Subject: [PATCH 23/71] 8168724: ECDSA signing improvments Reviewed-by: valeriep, vinnie, ahgross, asmotrak, robm --- .../jdk.crypto.ec/share/native/libsunec/impl/ec.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c b/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c index dd1f9101e25..4f3cab36b8c 100644 --- a/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c +++ b/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c @@ -34,7 +34,7 @@ * Dr Vipul Gupta and * Douglas Stebila , Sun Microsystems Laboratories * - * Last Modified Date from the Original Code: Nov 2016 + * Last Modified Date from the Original Code: November 2016 *********************************************************************** */ #include "mplogic.h" @@ -714,6 +714,16 @@ ECDSA_SignDigestWithSeed(ECPrivateKey *key, SECItem *signature, goto cleanup; } + /* + * Using an equivalent exponent of fixed length (same as n or 1 bit less + * than n) to keep the kG timing relatively constant. + * + * Note that this is an extra step on top of the approach defined in + * ANSI X9.62 so as to make a fixed length K. + */ + CHECK_MPI_OK( mp_add(&k, &n, &k) ); + CHECK_MPI_OK( mp_div_2(&k, &k) ); + /* ** ANSI X9.62, Section 5.3.2, Step 2 ** From adcdf5a459fdf690476b76388912e494f2383d00 Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Thu, 17 Nov 2016 02:08:53 +0000 Subject: [PATCH 24/71] 8168714: Tighten ECDSA validation Added additional checks to DER parsing code Reviewed-by: vinnie, ahgross --- .../classes/sun/security/provider/DSA.java | 17 ++-- .../sun/security/rsa/RSASignature.java | 5 +- .../sun/security/util/DerInputBuffer.java | 7 +- .../sun/security/util/DerInputStream.java | 81 ++++++++++++++----- .../classes/sun/security/util/DerValue.java | 6 +- .../sun/security/ec/ECDSASignature.java | 18 +++-- .../sun/security/pkcs11/P11Signature.java | 36 +++++---- 7 files changed, 114 insertions(+), 56 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/provider/DSA.java b/jdk/src/java.base/share/classes/sun/security/provider/DSA.java index c1cc11bf4ed..5763e650284 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/DSA.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/DSA.java @@ -322,19 +322,20 @@ abstract class DSA extends SignatureSpi { } else { // first decode the signature. try { - DerInputStream in = new DerInputStream(signature, offset, - length); + // Enforce strict DER checking for signatures + DerInputStream in = + new DerInputStream(signature, offset, length, false); DerValue[] values = in.getSequence(2); + // check number of components in the read sequence + // and trailing data + if ((values.length != 2) || (in.available() != 0)) { + throw new IOException("Invalid encoding for signature"); + } r = values[0].getBigInteger(); s = values[1].getBigInteger(); - - // Check for trailing signature data - if (in.available() != 0) { - throw new IOException("Incorrect signature length"); - } } catch (IOException e) { - throw new SignatureException("invalid encoding for signature"); + throw new SignatureException("Invalid encoding for signature", e); } } diff --git a/jdk/src/java.base/share/classes/sun/security/rsa/RSASignature.java b/jdk/src/java.base/share/classes/sun/security/rsa/RSASignature.java index 43e605a1457..a426f6cd374 100644 --- a/jdk/src/java.base/share/classes/sun/security/rsa/RSASignature.java +++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSASignature.java @@ -226,9 +226,10 @@ public abstract class RSASignature extends SignatureSpi { * Decode the signature data. Verify that the object identifier matches * and return the message digest. */ - public static byte[] decodeSignature(ObjectIdentifier oid, byte[] signature) + public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig) throws IOException { - DerInputStream in = new DerInputStream(signature); + // Enforce strict DER checking for signatures + DerInputStream in = new DerInputStream(sig, 0, sig.length, false); DerValue[] values = in.getSequence(2); if ((values.length != 2) || (in.available() != 0)) { throw new IOException("SEQUENCE length error"); diff --git a/jdk/src/java.base/share/classes/sun/security/util/DerInputBuffer.java b/jdk/src/java.base/share/classes/sun/security/util/DerInputBuffer.java index 26bd198741a..1e5600214bc 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/DerInputBuffer.java +++ b/jdk/src/java.base/share/classes/sun/security/util/DerInputBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -147,6 +147,11 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable { System.arraycopy(buf, pos, bytes, 0, len); skip(len); + // check to make sure no extra leading 0s for DER + if (len >= 2 && (bytes[0] == 0) && (bytes[1] >= 0)) { + throw new IOException("Invalid encoding: redundant leading 0s"); + } + if (makePositive) { return new BigInteger(1, bytes); } else { diff --git a/jdk/src/java.base/share/classes/sun/security/util/DerInputStream.java b/jdk/src/java.base/share/classes/sun/security/util/DerInputStream.java index 264bfd0e9c7..94c9085a7bc 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/DerInputStream.java +++ b/jdk/src/java.base/share/classes/sun/security/util/DerInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -77,7 +77,7 @@ public class DerInputStream { * @param data the buffer from which to create the string (CONSUMED) */ public DerInputStream(byte[] data) throws IOException { - init(data, 0, data.length); + init(data, 0, data.length, true); } /** @@ -92,23 +92,48 @@ public class DerInputStream { * starting at "offset" */ public DerInputStream(byte[] data, int offset, int len) throws IOException { - init(data, offset, len); + init(data, offset, len, true); + } + + /** + * Create a DER input stream from part of a data buffer with + * additional arg to indicate whether to allow constructed + * indefinite-length encoding. + * The buffer is not copied, it is shared. Accordingly, the + * buffer should be treated as read-only. + * + * @param data the buffer from which to create the string (CONSUMED) + * @param offset the first index of data which will + * be read as DER input in the new stream + * @param len how long a chunk of the buffer to use, + * starting at "offset" + * @param allowIndefiniteLength whether to allow constructed + * indefinite-length encoding + */ + public DerInputStream(byte[] data, int offset, int len, + boolean allowIndefiniteLength) throws IOException { + init(data, offset, len, allowIndefiniteLength); } /* * private helper routine */ - private void init(byte[] data, int offset, int len) throws IOException { + private void init(byte[] data, int offset, int len, + boolean allowIndefiniteLength) throws IOException { if ((offset+2 > data.length) || (offset+len > data.length)) { throw new IOException("Encoding bytes too short"); } // check for indefinite length encoding if (DerIndefLenConverter.isIndefinite(data[offset+1])) { - byte[] inData = new byte[len]; - System.arraycopy(data, offset, inData, 0, len); + if (!allowIndefiniteLength) { + throw new IOException("Indefinite length BER encoding found"); + } else { + byte[] inData = new byte[len]; + System.arraycopy(data, offset, inData, 0, len); - DerIndefLenConverter derIn = new DerIndefLenConverter(); - buffer = new DerInputBuffer(derIn.convert(inData)); + DerIndefLenConverter derIn = new DerIndefLenConverter(); + buffer = new DerInputBuffer(derIn.convert(inData)); + } } else buffer = new DerInputBuffer(data, offset, len); buffer.mark(Integer.MAX_VALUE); @@ -239,15 +264,19 @@ public class DerInputStream { * representation. */ length--; - int validBits = length*8 - buffer.read(); + int excessBits = buffer.read(); + if (excessBits < 0) { + throw new IOException("Unused bits of bit string invalid"); + } + int validBits = length*8 - excessBits; if (validBits < 0) { - throw new IOException("valid bits of bit string invalid"); + throw new IOException("Valid bits of bit string invalid"); } byte[] repn = new byte[length]; if ((length != 0) && (buffer.read(repn) != length)) { - throw new IOException("short read of DER bit string"); + throw new IOException("Short read of DER bit string"); } return new BitArray(validBits, repn); @@ -263,7 +292,7 @@ public class DerInputStream { int length = getDefiniteLength(buffer); byte[] retval = new byte[length]; if ((length != 0) && (buffer.read(retval) != length)) - throw new IOException("short read of DER octet string"); + throw new IOException("Short read of DER octet string"); return retval; } @@ -273,7 +302,7 @@ public class DerInputStream { */ public void getBytes(byte[] val) throws IOException { if ((val.length != 0) && (buffer.read(val) != val.length)) { - throw new IOException("short read of DER octet string"); + throw new IOException("Short read of DER octet string"); } } @@ -357,7 +386,7 @@ public class DerInputStream { DerInputStream newstr; byte lenByte = (byte)buffer.read(); - int len = getLength((lenByte & 0xff), buffer); + int len = getLength(lenByte, buffer); if (len == -1) { // indefinite length encoding found @@ -403,7 +432,7 @@ public class DerInputStream { } while (newstr.available() > 0); if (newstr.available() != 0) - throw new IOException("extra data at end of vector"); + throw new IOException("Extra data at end of vector"); /* * Now stick them into the array we're returning. @@ -494,7 +523,7 @@ public class DerInputStream { int length = getDefiniteLength(buffer); byte[] retval = new byte[length]; if ((length != 0) && (buffer.read(retval) != length)) - throw new IOException("short read of DER " + + throw new IOException("Short read of DER " + stringName + " string"); return new String(retval, enc); @@ -555,7 +584,11 @@ public class DerInputStream { */ static int getLength(int lenByte, InputStream in) throws IOException { int value, tmp; + if (lenByte == -1) { + throw new IOException("Short read of DER length"); + } + String mdName = "DerInputStream.getLength(): "; tmp = lenByte; if ((tmp & 0x080) == 0x00) { // short form, 1 byte datum value = tmp; @@ -569,17 +602,23 @@ public class DerInputStream { if (tmp == 0) return -1; if (tmp < 0 || tmp > 4) - throw new IOException("DerInputStream.getLength(): lengthTag=" - + tmp + ", " + throw new IOException(mdName + "lengthTag=" + tmp + ", " + ((tmp < 0) ? "incorrect DER encoding." : "too big.")); - for (value = 0; tmp > 0; tmp --) { + value = 0x0ff & in.read(); + tmp--; + if (value == 0) { + // DER requires length value be encoded in minimum number of bytes + throw new IOException(mdName + "Redundant length bytes found"); + } + while (tmp-- > 0) { value <<= 8; value += 0x0ff & in.read(); } if (value < 0) { - throw new IOException("DerInputStream.getLength(): " - + "Invalid length bytes"); + throw new IOException(mdName + "Invalid length bytes"); + } else if (value <= 127) { + throw new IOException(mdName + "Should use short form for length"); } } return value; diff --git a/jdk/src/java.base/share/classes/sun/security/util/DerValue.java b/jdk/src/java.base/share/classes/sun/security/util/DerValue.java index 936e2ff70b7..b47064abce9 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/DerValue.java +++ b/jdk/src/java.base/share/classes/sun/security/util/DerValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -248,7 +248,7 @@ public class DerValue { tag = (byte)in.read(); byte lenByte = (byte)in.read(); - length = DerInputStream.getLength((lenByte & 0xff), in); + length = DerInputStream.getLength(lenByte, in); if (length == -1) { // indefinite length encoding found DerInputBuffer inbuf = in.dup(); int readLen = inbuf.available(); @@ -361,7 +361,7 @@ public class DerValue { tag = (byte)in.read(); byte lenByte = (byte)in.read(); - length = DerInputStream.getLength((lenByte & 0xff), in); + length = DerInputStream.getLength(lenByte, in); if (length == -1) { // indefinite length encoding found int readLen = in.available(); int offset = 2; // for tag and length bytes diff --git a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECDSASignature.java b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECDSASignature.java index c88c191cb0c..3b743388bdb 100644 --- a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECDSASignature.java +++ b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECDSASignature.java @@ -455,18 +455,22 @@ abstract class ECDSASignature extends SignatureSpi { } // Convert the DER encoding of R and S into a concatenation of R and S - private byte[] decodeSignature(byte[] signature) throws SignatureException { + private byte[] decodeSignature(byte[] sig) throws SignatureException { try { - DerInputStream in = new DerInputStream(signature); + // Enforce strict DER checking for signatures + DerInputStream in = new DerInputStream(sig, 0, sig.length, false); DerValue[] values = in.getSequence(2); + + // check number of components in the read sequence + // and trailing data + if ((values.length != 2) || (in.available() != 0)) { + throw new IOException("Invalid encoding for signature"); + } + BigInteger r = values[0].getPositiveBigInteger(); BigInteger s = values[1].getPositiveBigInteger(); - // Check for trailing signature data - if (in.available() != 0) { - throw new IOException("Incorrect signature length"); - } // trim leading zeroes byte[] rBytes = trimZeroes(r.toByteArray()); byte[] sBytes = trimZeroes(s.toByteArray()); @@ -480,7 +484,7 @@ abstract class ECDSASignature extends SignatureSpi { return result; } catch (Exception e) { - throw new SignatureException("Could not decode signature", e); + throw new SignatureException("Invalid encoding for signature", e); } } diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Signature.java b/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Signature.java index 43dfcd6a0b0..0260a55486d 100644 --- a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Signature.java +++ b/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Signature.java @@ -740,17 +740,21 @@ final class P11Signature extends SignatureSpi { } } - private static byte[] asn1ToDSA(byte[] signature) throws SignatureException { + private static byte[] asn1ToDSA(byte[] sig) throws SignatureException { try { - DerInputStream in = new DerInputStream(signature); + // Enforce strict DER checking for signatures + DerInputStream in = new DerInputStream(sig, 0, sig.length, false); DerValue[] values = in.getSequence(2); + + // check number of components in the read sequence + // and trailing data + if ((values.length != 2) || (in.available() != 0)) { + throw new IOException("Invalid encoding for signature"); + } + BigInteger r = values[0].getPositiveBigInteger(); BigInteger s = values[1].getPositiveBigInteger(); - // Check for trailing signature data - if (in.available() != 0) { - throw new IOException("Incorrect signature length"); - } byte[] br = toByteArray(r, 20); byte[] bs = toByteArray(s, 20); if ((br == null) || (bs == null)) { @@ -760,21 +764,25 @@ final class P11Signature extends SignatureSpi { } catch (SignatureException e) { throw e; } catch (Exception e) { - throw new SignatureException("invalid encoding for signature", e); + throw new SignatureException("Invalid encoding for signature", e); } } - private byte[] asn1ToECDSA(byte[] signature) throws SignatureException { + private byte[] asn1ToECDSA(byte[] sig) throws SignatureException { try { - DerInputStream in = new DerInputStream(signature); + // Enforce strict DER checking for signatures + DerInputStream in = new DerInputStream(sig, 0, sig.length, false); DerValue[] values = in.getSequence(2); + + // check number of components in the read sequence + // and trailing data + if ((values.length != 2) || (in.available() != 0)) { + throw new IOException("Invalid encoding for signature"); + } + BigInteger r = values[0].getPositiveBigInteger(); BigInteger s = values[1].getPositiveBigInteger(); - // Check for trailing signature data - if (in.available() != 0) { - throw new IOException("Incorrect signature length"); - } // trim leading zeroes byte[] br = KeyUtil.trimZeroes(r.toByteArray()); byte[] bs = KeyUtil.trimZeroes(s.toByteArray()); @@ -785,7 +793,7 @@ final class P11Signature extends SignatureSpi { System.arraycopy(bs, 0, res, res.length - bs.length, bs.length); return res; } catch (Exception e) { - throw new SignatureException("invalid encoding for signature", e); + throw new SignatureException("Invalid encoding for signature", e); } } From e859125b09af27267e0850c18c9127d9a274bc2b Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 17 Nov 2016 16:59:18 +0000 Subject: [PATCH 25/71] 8167223: URL handling improvements Reviewed-by: prappo, chegar --- .../share/classes/java/net/URLStreamHandler.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java index 30c9791cd95..8ce586bdcaa 100644 --- a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java +++ b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java @@ -161,9 +161,9 @@ public abstract class URLStreamHandler { (spec.charAt(start + 1) == '/')) { start += 2; i = spec.indexOf('/', start); - if (i < 0) { + if (i < 0 || i > limit) { i = spec.indexOf('?', start); - if (i < 0) + if (i < 0 || i > limit) i = limit; } @@ -171,8 +171,14 @@ public abstract class URLStreamHandler { int ind = authority.indexOf('@'); if (ind != -1) { - userInfo = authority.substring(0, ind); - host = authority.substring(ind+1); + if (ind != authority.lastIndexOf('@')) { + // more than one '@' in authority. This is not server based + userInfo = null; + host = null; + } else { + userInfo = authority.substring(0, ind); + host = authority.substring(ind+1); + } } else { userInfo = null; } From 3a41c2175c622a1cc4e8470b1fff6d51a10fe462 Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Thu, 17 Nov 2016 09:51:10 -0800 Subject: [PATCH 26/71] 8168705: Better ObjectIdentifier validation Reviewed-by: mullan, asmotrak, ahgross --- .../share/classes/sun/security/util/ObjectIdentifier.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java b/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java index 0e9bd41a71c..12aabe6f071 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java +++ b/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java @@ -255,7 +255,13 @@ class ObjectIdentifier implements Serializable + " (tag = " + type_id + ")" ); - encoding = new byte[in.getDefiniteLength()]; + int len = in.getDefiniteLength(); + if (len > in.available()) { + throw new IOException("ObjectIdentifier() -- length exceeds" + + "data available. Length: " + len + ", Available: " + + in.available()); + } + encoding = new byte[len]; in.getBytes(encoding); check(encoding); } From c22c7101355ae696b74d19ec27316dddced579fe Mon Sep 17 00:00:00 2001 From: Dmitry Markov Date: Thu, 12 Jan 2017 22:01:15 +0300 Subject: [PATCH 27/71] 8171909: [PIT] on Windows, failure of java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java Reviewed-by: yan, serb --- .../awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java b/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java index 6db02253f42..6f0a6317f1b 100644 --- a/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java +++ b/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8169589 + * @bug 8169589 8171909 * @summary Activating a dialog puts to back another dialog owned by the same frame * @author Dmitry Markov * @library ../../regtesthelpers @@ -68,7 +68,7 @@ public class DialogAboveFrameTest { int y = point.y + (int)(dialog1.getHeight() * 0.9); try { - if (!robot.getPixelColor(x, y).equals(dialog1.getBackground())) { + if (!Util.testPixelColor(x, y, dialog1.getBackground(), 10, 100, robot)) { throw new RuntimeException("Test FAILED: Dialog is behind the frame"); } } finally { From 32ee8faef4017b16001002cd76a22e552dcf16b4 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Sat, 21 Jan 2017 20:31:21 -0800 Subject: [PATCH 28/71] 8173024: Replace direct use of AuthResources resource bundle from jdk.security.auth Reviewed-by: weijun --- .../java.base/share/classes/module-info.java | 3 -- .../sun/security/provider/ConfigFile.java | 9 +++-- .../security/provider/SubjectCodeSource.java | 12 ++----- .../security/util/AuthResourcesProvider.java | 29 --------------- .../util/AuthResourcesProviderImpl.java | 35 ------------------- .../sun/security/util/ResourcesMgr.java | 34 +++++++++--------- .../sun/security/auth/NTDomainPrincipal.java | 10 +++--- .../security/auth/NTNumericCredential.java | 5 ++- .../classes/com/sun/security/auth/NTSid.java | 15 ++++---- .../security/auth/NTSidDomainPrincipal.java | 5 ++- .../security/auth/NTSidGroupPrincipal.java | 5 ++- .../auth/NTSidPrimaryGroupPrincipal.java | 5 ++- .../sun/security/auth/NTSidUserPrincipal.java | 5 ++- .../sun/security/auth/NTUserPrincipal.java | 10 +++--- .../auth/SolarisNumericGroupPrincipal.java | 14 ++++---- .../auth/SolarisNumericUserPrincipal.java | 8 ++--- .../sun/security/auth/SolarisPrincipal.java | 10 +++--- .../auth/UnixNumericGroupPrincipal.java | 15 ++++---- .../auth/UnixNumericUserPrincipal.java | 10 +++--- .../com/sun/security/auth/UnixPrincipal.java | 10 +++--- .../com/sun/security/auth/X500Principal.java | 6 ++-- .../security/auth/module/JndiLoginModule.java | 11 ++---- .../auth/module/KeyStoreLoginModule.java | 15 ++++---- .../security/auth/module/Krb5LoginModule.java | 9 ++--- .../security/auth/module/LdapLoginModule.java | 12 ++----- .../share/classes/module-info.java | 2 -- 26 files changed, 91 insertions(+), 213 deletions(-) delete mode 100644 jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProvider.java delete mode 100644 jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProviderImpl.java diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 1114d513687..b831d9a3549 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -310,7 +310,6 @@ module java.base { // JDK-internal service types uses jdk.internal.logger.DefaultLoggerFinder; uses sun.security.ssl.ClientKeyExchangeService; - uses sun.security.util.AuthResourcesProvider; uses sun.text.spi.JavaTimeDateTimePatternProvider; uses sun.util.spi.CalendarProvider; uses sun.util.locale.provider.LocaleDataMetaInfo; @@ -322,6 +321,4 @@ module java.base { provides java.nio.file.spi.FileSystemProvider with jdk.internal.jrtfs.JrtFileSystemProvider; - provides sun.security.util.AuthResourcesProvider with - sun.security.util.AuthResourcesProviderImpl; } diff --git a/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java b/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java index 25a975504d6..450a4292cff 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java @@ -331,9 +331,8 @@ public final class ConfigFile extends Configuration { if (debugConfig != null) { debugConfig.println(fnfe.toString()); } - throw new IOException(ResourcesMgr.getString - ("Configuration.Error.No.such.file.or.directory", - "sun.security.util.AuthResources")); + throw new IOException(ResourcesMgr.getAuthResourceString + ("Configuration.Error.No.such.file.or.directory")); } } @@ -661,8 +660,8 @@ public final class ConfigFile extends Configuration { } private IOException ioException(String resourceKey, Object... args) { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - (resourceKey, "sun.security.util.AuthResources")); + MessageFormat form = new MessageFormat( + ResourcesMgr.getAuthResourceString(resourceKey)); return new IOException(form.format(args)); } } diff --git a/jdk/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java b/jdk/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java index a92ff27906a..26a3d4e3f89 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java @@ -34,6 +34,7 @@ import java.lang.reflect.Constructor; import javax.security.auth.Subject; import sun.security.provider.PolicyParser.PrincipalEntry; +import sun.security.util.ResourcesMgr; /** *

This SubjectCodeSource class contains @@ -47,15 +48,6 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { private static final long serialVersionUID = 6039418085604715275L; - private static final java.util.ResourceBundle rb = - java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public java.util.ResourceBundle run() { - return (java.util.ResourceBundle.getBundle - ("sun.security.util.AuthResources")); - } - }); - private Subject subject; private LinkedList principals; private static final Class[] PARAMS = { String.class }; @@ -391,7 +383,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { ListIterator li = principals.listIterator(); while (li.hasNext()) { PrincipalEntry pppe = li.next(); - returnMe = returnMe + rb.getString("NEWLINE") + + returnMe = returnMe + ResourcesMgr.getAuthResourceString("NEWLINE") + pppe.getPrincipalClass() + " " + pppe.getPrincipalName(); } diff --git a/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProvider.java b/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProvider.java deleted file mode 100644 index 126286a6ff1..00000000000 --- a/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.security.util; - -public interface AuthResourcesProvider extends java.util.spi.ResourceBundleProvider { -} diff --git a/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProviderImpl.java b/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProviderImpl.java deleted file mode 100644 index 6572ad0113d..00000000000 --- a/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProviderImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.security.util; - -import java.util.spi.AbstractResourceBundleProvider; - -public final class AuthResourcesProviderImpl extends AbstractResourceBundleProvider - implements AuthResourcesProvider { - public AuthResourcesProviderImpl() { - super("java.class"); - } -} \ No newline at end of file diff --git a/jdk/src/java.base/share/classes/sun/security/util/ResourcesMgr.java b/jdk/src/java.base/share/classes/sun/security/util/ResourcesMgr.java index 091f2ea8e13..725d21b6eb7 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/ResourcesMgr.java +++ b/jdk/src/java.base/share/classes/sun/security/util/ResourcesMgr.java @@ -25,18 +25,22 @@ package sun.security.util; +import java.util.Map; +import java.util.ResourceBundle; +import java.util.concurrent.ConcurrentHashMap; +import jdk.internal.misc.VM; + /** */ public class ResourcesMgr { - // intended for java.security, javax.security and sun.security resources - private static java.util.ResourceBundle bundle; + private final static String RESOURCES = "sun.security.util.Resources"; + private final static String AUTH_RESOURCES = "sun.security.util.AuthResources"; - // intended for com.sun.security resources - private static java.util.ResourceBundle altBundle; + private final static Map bundles = new ConcurrentHashMap<>(); public static String getString(String s) { - + ResourceBundle bundle = bundles.get(RESOURCES); if (bundle == null) { // only load if/when needed @@ -52,19 +56,15 @@ public class ResourcesMgr { return bundle.getString(s); } - public static String getString(String s, final String altBundleName) { - - if (altBundle == null) { - - // only load if/when needed - altBundle = java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.util.ResourceBundle run() { - return (java.util.ResourceBundle.getBundle(altBundleName)); - } - }); + public static String getAuthResourceString(String s) { + if (VM.initLevel() == 3) { + // cannot trigger loading of any resource bundle as + // it depends on the system class loader fully initialized. + throw new InternalError("system class loader is being initialized"); } - return altBundle.getString(s); + return bundles.computeIfAbsent(AUTH_RESOURCES, ResourceBundle::getBundle) + .getString(s); } + } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java index 2b15a509e4c..ed9c2eff568 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java @@ -65,9 +65,8 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable { public NTDomainPrincipal(String name) { if (name == null) { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("invalid.null.input.value", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("invalid.null.input.value")); Object[] source = {"name"}; throw new NullPointerException(form.format(source)); } @@ -92,9 +91,8 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTDomainPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTDomainPrincipal.name")); Object[] source = {name}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java index 480e400ceb1..22c186a4989 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java @@ -61,9 +61,8 @@ public class NTNumericCredential { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTNumericCredential.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTNumericCredential.name")); Object[] source = {Long.toString(impersonationToken)}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSid.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSid.java index 602e817ea72..b5e2dc7d6d6 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSid.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSid.java @@ -70,17 +70,15 @@ public class NTSid implements Principal, java.io.Serializable { public NTSid (String stringSid) { if (stringSid == null) { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("invalid.null.input.value", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("invalid.null.input.value")); Object[] source = {"stringSid"}; throw new NullPointerException(form.format(source)); } if (stringSid.length() == 0) { throw new IllegalArgumentException - (sun.security.util.ResourcesMgr.getString - ("Invalid.NTSid.value", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("Invalid.NTSid.value")); } sid = new String(stringSid); } @@ -101,9 +99,8 @@ public class NTSid implements Principal, java.io.Serializable { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTSid.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTSid.name")); Object[] source = {sid}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java index 2b033bbbc66..78858375a05 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java @@ -68,9 +68,8 @@ public class NTSidDomainPrincipal extends NTSid { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTSidDomainPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTSidDomainPrincipal.name")); Object[] source = {getName()}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java index d63451e992a..3ebd8fe996a 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java @@ -63,9 +63,8 @@ public class NTSidGroupPrincipal extends NTSid { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTSidGroupPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTSidGroupPrincipal.name")); Object[] source = {getName()}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java index 7a482a70c9a..7b636f42222 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java @@ -65,9 +65,8 @@ public class NTSidPrimaryGroupPrincipal extends NTSid { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTSidPrimaryGroupPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTSidPrimaryGroupPrincipal.name")); Object[] source = {getName()}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java index b2e583d816c..983dc2b0590 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java @@ -62,9 +62,8 @@ public class NTSidUserPrincipal extends NTSid { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTSidUserPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTSidUserPrincipal.name")); Object[] source = {getName()}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java index 687682b56e1..a7c2ce97cd0 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java @@ -61,9 +61,8 @@ public class NTUserPrincipal implements Principal, java.io.Serializable { public NTUserPrincipal(String name) { if (name == null) { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("invalid.null.input.value", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("invalid.null.input.value")); Object[] source = {"name"}; throw new NullPointerException(form.format(source)); } @@ -86,9 +85,8 @@ public class NTUserPrincipal implements Principal, java.io.Serializable { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("NTUserPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("NTUserPrincipal.name")); Object[] source = {name}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java index 0dcde2dd744..aa607107baf 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java @@ -26,6 +26,7 @@ package com.sun.security.auth; import java.security.Principal; +import static sun.security.util.ResourcesMgr.getAuthResourceString; /** * This class implements the {@code Principal} interface @@ -53,9 +54,6 @@ public class SolarisNumericGroupPrincipal implements private static final long serialVersionUID = 2345199581042573224L; - private static final java.util.ResourceBundle rb = - java.util.ResourceBundle.getBundle("sun.security.util.AuthResources"); - /** * @serial */ @@ -82,7 +80,7 @@ public class SolarisNumericGroupPrincipal implements */ public SolarisNumericGroupPrincipal(String name, boolean primaryGroup) { if (name == null) - throw new NullPointerException(rb.getString("provided.null.name")); + throw new NullPointerException(getAuthResourceString("provided.null.name")); this.name = name; this.primaryGroup = primaryGroup; @@ -146,11 +144,11 @@ public class SolarisNumericGroupPrincipal implements * {@code SolarisNumericGroupPrincipal}. */ public String toString() { - return((primaryGroup ? - rb.getString + return primaryGroup ? + getAuthResourceString ("SolarisNumericGroupPrincipal.Primary.Group.") + name : - rb.getString - ("SolarisNumericGroupPrincipal.Supplementary.Group.") + name)); + getAuthResourceString + ("SolarisNumericGroupPrincipal.Supplementary.Group.") + name; } /** diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java index 806f62187c4..c9521105c1f 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java @@ -26,6 +26,7 @@ package com.sun.security.auth; import java.security.Principal; +import static sun.security.util.ResourcesMgr.getAuthResourceString; /** * This class implements the {@code Principal} interface @@ -52,9 +53,6 @@ public class SolarisNumericUserPrincipal implements private static final long serialVersionUID = -3178578484679887104L; - private static final java.util.ResourceBundle rb = - java.util.ResourceBundle.getBundle("sun.security.util.AuthResources"); - /** * @serial */ @@ -72,7 +70,7 @@ public class SolarisNumericUserPrincipal implements */ public SolarisNumericUserPrincipal(String name) { if (name == null) - throw new NullPointerException(rb.getString("provided.null.name")); + throw new NullPointerException(getAuthResourceString("provided.null.name")); this.name = name; } @@ -118,7 +116,7 @@ public class SolarisNumericUserPrincipal implements * {@code SolarisNumericUserPrincipal}. */ public String toString() { - return(rb.getString("SolarisNumericUserPrincipal.") + name); + return(getAuthResourceString("SolarisNumericUserPrincipal.") + name); } /** diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java index f4491db4dc8..3ec93179fba 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java @@ -26,6 +26,8 @@ package com.sun.security.auth; import java.security.Principal; +import static sun.security.util.ResourcesMgr.getAuthResourceString; + /** * This class implements the {@code Principal} interface @@ -50,10 +52,6 @@ public class SolarisPrincipal implements Principal, java.io.Serializable { private static final long serialVersionUID = -7840670002439379038L; - private static final java.util.ResourceBundle rb = - java.util.ResourceBundle.getBundle("sun.security.util.AuthResources"); - - /** * @serial */ @@ -69,7 +67,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable { */ public SolarisPrincipal(String name) { if (name == null) - throw new NullPointerException(rb.getString("provided.null.name")); + throw new NullPointerException(getAuthResourceString("provided.null.name")); this.name = name; } @@ -89,7 +87,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable { * @return a string representation of this {@code SolarisPrincipal}. */ public String toString() { - return(rb.getString("SolarisPrincipal.") + name); + return(getAuthResourceString("SolarisPrincipal.") + name); } /** diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java index f71aa128c95..5498c5d5c62 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java @@ -74,9 +74,8 @@ public class UnixNumericGroupPrincipal implements public UnixNumericGroupPrincipal(String name, boolean primaryGroup) { if (name == null) { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("invalid.null.input.value", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("invalid.null.input.value")); Object[] source = {"name"}; throw new NullPointerException(form.format(source)); } @@ -146,16 +145,14 @@ public class UnixNumericGroupPrincipal implements if (primaryGroup) { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("UnixNumericGroupPrincipal.Primary.Group.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("UnixNumericGroupPrincipal.Primary.Group.name")); Object[] source = {name}; return form.format(source); } else { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("UnixNumericGroupPrincipal.Supplementary.Group.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("UnixNumericGroupPrincipal.Supplementary.Group.name")); Object[] source = {name}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java index e07cb8ad39f..30a1e9ca81d 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java @@ -64,9 +64,8 @@ public class UnixNumericUserPrincipal implements public UnixNumericUserPrincipal(String name) { if (name == null) { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("invalid.null.input.value", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("invalid.null.input.value")); Object[] source = {"name"}; throw new NullPointerException(form.format(source)); } @@ -116,9 +115,8 @@ public class UnixNumericUserPrincipal implements */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("UnixNumericUserPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("UnixNumericUserPrincipal.name")); Object[] source = {name}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java index 1215015330a..fde93a62a53 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java @@ -61,9 +61,8 @@ public class UnixPrincipal implements Principal, java.io.Serializable { public UnixPrincipal(String name) { if (name == null) { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("invalid.null.input.value", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("invalid.null.input.value")); Object[] source = {"name"}; throw new NullPointerException(form.format(source)); } @@ -87,9 +86,8 @@ public class UnixPrincipal implements Principal, java.io.Serializable { */ public String toString() { java.text.MessageFormat form = new java.text.MessageFormat - (sun.security.util.ResourcesMgr.getString - ("UnixPrincipal.name", - "sun.security.util.AuthResources")); + (sun.security.util.ResourcesMgr.getAuthResourceString + ("UnixPrincipal.name")); Object[] source = {name}; return form.format(source); } diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java index a3a04a04fa1..bad8ae8addc 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java @@ -27,6 +27,7 @@ package com.sun.security.auth; import java.security.Principal; import sun.security.x509.X500Name; +import static sun.security.util.ResourcesMgr.getAuthResourceString; /** * This class represents an X.500 {@code Principal}. @@ -55,9 +56,6 @@ public class X500Principal implements Principal, java.io.Serializable { private static final long serialVersionUID = -8222422609431628648L; - private static final java.util.ResourceBundle rb = - java.util.ResourceBundle.getBundle("sun.security.util.AuthResources"); - /** * @serial */ @@ -80,7 +78,7 @@ public class X500Principal implements Principal, java.io.Serializable { */ public X500Principal(String name) { if (name == null) - throw new NullPointerException(rb.getString("provided.null.name")); + throw new NullPointerException(getAuthResourceString("provided.null.name")); try { thisX500Name = new X500Name(name); diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java index 4e0225372b7..349409c579d 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java @@ -32,15 +32,13 @@ import javax.security.auth.spi.*; import javax.naming.*; import javax.naming.directory.*; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Map; import java.util.LinkedList; -import java.util.ResourceBundle; import com.sun.security.auth.UnixPrincipal; import com.sun.security.auth.UnixNumericUserPrincipal; import com.sun.security.auth.UnixNumericGroupPrincipal; +import static sun.security.util.ResourcesMgr.getAuthResourceString; /** @@ -153,9 +151,6 @@ import com.sun.security.auth.UnixNumericGroupPrincipal; */ public class JndiLoginModule implements LoginModule { - private static final ResourceBundle rb = - ResourceBundle.getBundle("sun.security.util.AuthResources"); - /** JNDI Provider */ public final String USER_PROVIDER = "user.provider.url"; public final String GROUP_PROVIDER = "group.provider.url"; @@ -677,9 +672,9 @@ public class JndiLoginModule implements LoginModule { Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback(protocol + " " - + rb.getString("username.")); + + getAuthResourceString("username.")); callbacks[1] = new PasswordCallback(protocol + " " + - rb.getString("password."), + getAuthResourceString("password."), false); try { diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java index 34f98390ee2..625739c1b52 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java @@ -51,6 +51,7 @@ import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; import sun.security.util.Password; +import static sun.security.util.ResourcesMgr.getAuthResourceString; /** * Provides a JAAS login module that prompts for a key store alias and @@ -112,9 +113,6 @@ import sun.security.util.Password; */ public class KeyStoreLoginModule implements LoginModule { - private static final ResourceBundle rb = - ResourceBundle.getBundle("sun.security.util.AuthResources"); - /* -- Fields -- */ private static final int UNINITIALIZED = 0; @@ -132,7 +130,7 @@ public class KeyStoreLoginModule implements LoginModule { private static final TextOutputCallback bannerCallback = new TextOutputCallback (TextOutputCallback.INFORMATION, - rb.getString("Please.enter.keystore.information")); + getAuthResourceString("Please.enter.keystore.information")); private final ConfirmationCallback confirmationCallback = new ConfirmationCallback (ConfirmationCallback.INFORMATION, @@ -344,11 +342,10 @@ public class KeyStoreLoginModule implements LoginModule { NameCallback aliasCallback; if (keyStoreAlias == null || keyStoreAlias.length() == 0) { - aliasCallback = new NameCallback( - rb.getString("Keystore.alias.")); + aliasCallback = new NameCallback(getAuthResourceString("Keystore.alias.")); } else { aliasCallback = - new NameCallback(rb.getString("Keystore.alias."), + new NameCallback(getAuthResourceString("Keystore.alias."), keyStoreAlias); } @@ -360,11 +357,11 @@ public class KeyStoreLoginModule implements LoginModule { break; case NORMAL: keyPassCallback = new PasswordCallback - (rb.getString("Private.key.password.optional."), false); + (getAuthResourceString("Private.key.password.optional."), false); // fall thru case TOKEN: storePassCallback = new PasswordCallback - (rb.getString("Keystore.password."), false); + (getAuthResourceString("Keystore.password."), false); break; } prompt(aliasCallback, storePassCallback, keyPassCallback); diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java index 2aa1e8ae65d..df5733b7544 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java @@ -27,8 +27,6 @@ package com.sun.security.auth.module; import java.io.*; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.text.MessageFormat; import java.util.*; @@ -45,6 +43,7 @@ import sun.security.krb5.*; import sun.security.jgss.krb5.Krb5Util; import sun.security.krb5.Credentials; import sun.security.util.HexDumpEncoder; +import static sun.security.util.ResourcesMgr.getAuthResourceString; /** * This {@code LoginModule} authenticates users using @@ -419,8 +418,6 @@ public class Krb5LoginModule implements LoginModule { private static final String NAME = "javax.security.auth.login.name"; private static final String PWD = "javax.security.auth.login.password"; - private static final ResourceBundle rb = - ResourceBundle.getBundle("sun.security.util.AuthResources"); /** * Initialize this {@code LoginModule}. @@ -831,7 +828,7 @@ public class Krb5LoginModule implements LoginModule { Callback[] callbacks = new Callback[1]; MessageFormat form = new MessageFormat( - rb.getString( + getAuthResourceString( "Kerberos.username.defUsername.")); Object[] source = {defUsername}; callbacks[0] = new NameCallback(form.format(source)); @@ -886,7 +883,7 @@ public class Krb5LoginModule implements LoginModule { Callback[] callbacks = new Callback[1]; String userName = krb5PrincName.toString(); MessageFormat form = new MessageFormat( - rb.getString( + getAuthResourceString( "Kerberos.password.for.username.")); Object[] source = {userName}; callbacks[0] = new PasswordCallback( diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java index b3743a662fd..c0f5788cfa8 100644 --- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java +++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java @@ -25,14 +25,11 @@ package com.sun.security.auth.module; -import java.security.AccessController; import java.net.SocketPermission; import java.security.Principal; -import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Hashtable; import java.util.Map; -import java.util.ResourceBundle; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.Set; @@ -47,6 +44,7 @@ import javax.security.auth.spi.*; import com.sun.security.auth.LdapPrincipal; import com.sun.security.auth.UserPrincipal; +import static sun.security.util.ResourcesMgr.getAuthResourceString; /** @@ -305,10 +303,6 @@ import com.sun.security.auth.UserPrincipal; */ public class LdapLoginModule implements LoginModule { - // Use the default classloader for this class to load the prompt strings. - private static final ResourceBundle rb = - ResourceBundle.getBundle("sun.security.util.AuthResources"); - // Keys to retrieve the stored username and password private static final String USERNAME_KEY = "javax.security.auth.login.name"; private static final String PASSWORD_KEY = @@ -957,8 +951,8 @@ public class LdapLoginModule implements LoginModule { "to acquire authentication information from the user"); Callback[] callbacks = new Callback[2]; - callbacks[0] = new NameCallback(rb.getString("username.")); - callbacks[1] = new PasswordCallback(rb.getString("password."), false); + callbacks[0] = new NameCallback(getAuthResourceString("username.")); + callbacks[1] = new PasswordCallback(getAuthResourceString("password."), false); try { callbackHandler.handle(callbacks); diff --git a/jdk/src/jdk.security.auth/share/classes/module-info.java b/jdk/src/jdk.security.auth/share/classes/module-info.java index 5181d23f513..4675b238e19 100644 --- a/jdk/src/jdk.security.auth/share/classes/module-info.java +++ b/jdk/src/jdk.security.auth/share/classes/module-info.java @@ -36,8 +36,6 @@ module jdk.security.auth { exports com.sun.security.auth.login; exports com.sun.security.auth.module; - uses sun.security.util.AuthResourcesProvider; - provides javax.security.auth.spi.LoginModule with com.sun.security.auth.module.Krb5LoginModule, com.sun.security.auth.module.UnixLoginModule, From dfca46bc7e09c4300e291301cacc27fa7b4dce45 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Fri, 13 Jan 2017 20:39:16 -0800 Subject: [PATCH 29/71] 8160881: Remove jvisualvm from JDK9 Reviewed-by: erikj, ihse, ksrini --- jdk/src/linux/doc/man/ja/jvisualvm.1 | 126 ------------------ jdk/src/linux/doc/man/jvisualvm.1 | 104 --------------- .../solaris/doc/sun/man/man1/ja/jvisualvm.1 | 126 ------------------ jdk/src/solaris/doc/sun/man/man1/jvisualvm.1 | 104 --------------- jdk/test/tools/launcher/VersionCheck.java | 2 - 5 files changed, 462 deletions(-) delete mode 100644 jdk/src/linux/doc/man/ja/jvisualvm.1 delete mode 100644 jdk/src/linux/doc/man/jvisualvm.1 delete mode 100644 jdk/src/solaris/doc/sun/man/man1/ja/jvisualvm.1 delete mode 100644 jdk/src/solaris/doc/sun/man/man1/jvisualvm.1 diff --git a/jdk/src/linux/doc/man/ja/jvisualvm.1 b/jdk/src/linux/doc/man/ja/jvisualvm.1 deleted file mode 100644 index a3349bfd6b1..00000000000 --- a/jdk/src/linux/doc/man/ja/jvisualvm.1 +++ /dev/null @@ -1,126 +0,0 @@ -'\" t -.\" -.\" 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. -.\" -.\" Title: jvisualvm -.\" Language: Japanese -.\" Date: 2013ǯ11·î21Æü -.\" SectDesc: Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó¥°¤ª¤è¤Ó´ÉÍý¥Ä¡¼¥ë -.\" Software: JDK 8 -.\" Arch: ÈÆÍÑ -.\" Part Number: E58103-01 -.\" Doc ID: JSSON -.\" -.if n .pl 99999 -.TH "jvisualvm" "1" "2013ǯ11·î21Æü" "JDK 8" "Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "̾Á°" -jvisualvm \- Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò»ë³ÐŪ¤Ë¥â¥Ë¥¿¡¼¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥È¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ë¤·¤Þ¤¹¡£ -.SH "³µÍ×" -.sp -.if n \{\ -.RS 4 -.\} -.nf -\fBjvisualvm\fR [ \fIoptions\fR ] -.fi -.if n \{\ -.RE -.\} -.PP -\fIoptions\fR -.RS 4 -¥³¥Þ¥ó¥É¹Ô¥ª¥×¥·¥ç¥ó¡£¥ª¥×¥·¥ç¥ó¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ -.RE -.SH "ÀâÌÀ" -.PP -Java VisualVM¤Ï¡¢»ØÄꤵ¤ì¤¿Java Virtual Machine (JVM)¤ÇJava¥Æ¥¯¥Î¥í¥¸¡¦¥Ù¡¼¥¹¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó(Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó)¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¤È¤­¤Ë¡¢¤½¤ÎJava¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë´Ø¤¹¤ë¾ÜºÙ¤Ê¾ðÊó¤òÄ󶡤¹¤ëľ´¶Åª¤Ê¥°¥é¥Õ¥£¥«¥ë¡¦¥æ¡¼¥¶¡¼¡¦¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¹¡£Java VisualVM¤È¤¤¤¦Ì¾Á°¤Ï¡¢Java VisualVM¤¬JVM¥½¥Õ¥È¥¦¥§¥¢¤Ë´Ø¤¹¤ë¾ðÊó¤ò»ë³ÐŪ¤ËÄ󶡤¹¤ë¤È¤¤¤¦»ö¼Â¤ËͳÍ褷¤Æ¤¤¤Þ¤¹¡£ -.PP -Java VisualVM¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¥â¥Ë¥¿¥ê¥ó¥°¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¦¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤ò1¤Ä¤Î¥Ä¡¼¥ë¤ËÅý¹ç¤·¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢¥¹¥¿¥ó¥É¥¢¥í¥ó¡¦¥Ä¡¼¥ë\fBjmap\fR¡¢\fBjinfo\fR¡¢\fBjstat\fR¤ª¤è¤Ó\fBjstack\fR¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ëµ¡Ç½¤Î¤Û¤È¤ó¤É¤¬¡¢Java VisualVM¤ËÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£\fBjconsole\fR¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤ÆÄ󶡤µ¤ì¤ë°ìÉô¤Îµ¡Ç½¤Ê¤É¡¢Â¾¤Îµ¡Ç½¤Ï¥ª¥×¥·¥ç¥ó¤Î¥×¥é¥°¥¤¥ó¤È¤·¤ÆÄɲäǤ­¤Þ¤¹¡£ -.PP -Java VisualVM¤Ï¡¢Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î³«È¯¼Ô¤¬¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ò¹Ô¤Ã¤¿¤ê¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ò¥â¥Ë¥¿¡¼¤ª¤è¤Ó²þÁ±¤·¤¿¤ê¤¹¤ë¤Î¤ËÌòΩ¤Á¤Þ¤¹¡£Java VisualVM¤ò»ÈÍѤ¹¤ë¤È¡¢³«È¯¼Ô¤Ï¥Ò¡¼¥×¡¦¥À¥ó¥×¤ÎÀ¸À®¤ª¤è¤Ó²òÀÏ¡¢¥á¥â¥ê¡¼¡¦¥ê¡¼¥¯¤ÎÆÃÄê¡¢¥¬¥Ù¡¼¥¸¡¦¥³¥ì¥¯¥·¥ç¥ó¤Î¼Â¹Ô¤ª¤è¤Ó¥â¥Ë¥¿¡¼¡¢¤ª¤è¤Ó¥á¥â¥ê¡¼¤ÈCPU¤Î´Ê°×¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤Î¼Â¹Ô¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£¥×¥é¥°¥¤¥ó¤ÇJava VisualVM¤Îµ¡Ç½¤ò³ÈÄ¥¤Ç¤­¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢\fBjconsole\fR¥³¥Þ¥ó¥É¤Î¤Û¤È¤ó¤É¤Îµ¡Ç½¤Ï¡¢¡ÖMBean¡×¥¿¥Ö¤ª¤è¤ÓJConsole Plug\-in Wrapper¥×¥é¥°¥¤¥ó¤ò²ð¤·¤Æ»ÈÍѤǤ­¤Þ¤¹¡£É¸½à¤ÎJava VisualVM¥×¥é¥°¥¤¥ó¤Î¥«¥¿¥í¥°¤«¤éÁªÂò¤¹¤ë¤Ë¤Ï¡¢Java VisualVM¥á¥Ë¥å¡¼¤Î\fB¡Ö¥Ä¡¼¥ë¡×\fR¡¢\fB¡Ö¥×¥é¥°¥¤¥ó¡×\fR¤òÁªÂò¤·¤Þ¤¹¡£ -.PP -Java VisualVM¤òµ¯Æ°¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤Þ¤¹¡£ -.sp -.if n \{\ -.RS 4 -.\} -.nf -\fB% jvisualvm \fR - -.fi -.if n \{\ -.RE -.\} -.SH "¥ª¥×¥·¥ç¥ó" -.PP -¼¡¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢Java VisualVM¤òµ¯Æ°¤·¤¿¤È¤­¤Ë¼Â¹Ô²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£ -.PP -\-J\fIjvm_option\fR -.RS 4 -¤³¤Î\fBjvm_option\fR¤òJVM¥½¥Õ¥È¥¦¥§¥¢¤ËÅϤ·¤Þ¤¹¡£ -.RE -.SH "´ØÏ¢¹àÌÜ" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Java VisualVM³«È¯¼Ô¤Î¥µ¥¤¥È -http://visualvm\&.java\&.net/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Java SE¥É¥­¥å¥á¥ó¥È¤ÎJava VisualVM -(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/visualvm/index\&.html) -.RE -.br -'pl 8.5i -'bp diff --git a/jdk/src/linux/doc/man/jvisualvm.1 b/jdk/src/linux/doc/man/jvisualvm.1 deleted file mode 100644 index eae03edd804..00000000000 --- a/jdk/src/linux/doc/man/jvisualvm.1 +++ /dev/null @@ -1,104 +0,0 @@ -." Copyright (c) 2008, 2011, 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. -." -.TH jvisualvm 1 "10 May 2011" - -.LP -.SH "Name" -\f2jvisualvm\fP \- Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool -.LP -.SH "SYNOPSIS" -.LP -.nf -\f3 -.fl - \fP\f3jvisualvm\fP [ \f2options\fP ] -.fl -.fi - -.LP -.SH "PARAMETERS" -.LP -.LP -Options, if used, should follow immediately after the command name. Options may be in any order. For a discussion of parameters that apply to a specific option, see OPTIONS below. -.LP -.SH "DESCRIPTION" -.LP -.LP -Java VisualVM is an intuitive graphical user interface that provides detailed information about Java technology\-based applications (Java applications) while they are running on a given Java Virtual Machine (JVM(*)). The name Java VisualVM comes from the fact that Java VisualVM provides information about the JVM software \f2visually\fP. -.LP -.LP -Java VisualVM combines several monitoring, troubleshooting, and profiling utilities into a single tool. For example, most of the functionality offered by the standalone tools \f2jmap\fP, \f2jinfo\fP, \f2jstat\fP and \f2jstack\fP have been integrated into Java VisualVM. Other functionalities, such as some of those offered by the JConsole tool, can be added as optional plug\-ins. -.LP -.SH "OPTIONS" -.LP -.LP -The following option is possible when you launch Java VisualVM. -.LP -.RS 3 -.TP 3 -\-J\ -Pass this \f2\fP to the JVM software. -.RE - -.LP -.SH "USAGE" -.LP -.LP -Java VisualVM is useful to Java application developers to troubleshoot applications and to monitor and improve the applications' performance. Java VisualVM can allow developers to generate and analyse heap dumps, track down memory leaks, perform and monitor garbage collection, and perform lightweight memory and CPU profiling. Plug\-ins also exist that expand the functionality of Java VisualVM. For example, most of the functionality of the JConsole tool is available via the MBeans Tab and JConsole Plug\-in Wrapper plug\-ins. You can choose from a catalog of standard Java VisualVM plug\-ins by selecting 'Tools' | 'Plugins' in the Java VisualVM menus. -.LP -.LP -Start Java VisualVM with the following command: -.LP -.nf -\f3 -.fl -% jvisualvm \fP\f4\fP\f3 -.fl -\fP -.fi - -.LP -.SH "SEE ALSO" -.LP -.LP -For more details about Java VisualVM see the following pages. -.LP -.RS 3 -.TP 2 -o -.na -\f2Java VisualVM developers' site\fP @ -.fi -http://visualvm.java.net -.TP 2 -o -.na -\f2Java VisualVM in Java SE platform documentation\fP @ -.fi -http://download.oracle.com/javase/7/docs/technotes/guides/visualvm/index.html -.RE - -.LP -.LP -\f2(* The terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.)\fP -.LP - diff --git a/jdk/src/solaris/doc/sun/man/man1/ja/jvisualvm.1 b/jdk/src/solaris/doc/sun/man/man1/ja/jvisualvm.1 deleted file mode 100644 index a3349bfd6b1..00000000000 --- a/jdk/src/solaris/doc/sun/man/man1/ja/jvisualvm.1 +++ /dev/null @@ -1,126 +0,0 @@ -'\" t -.\" -.\" 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. -.\" -.\" Title: jvisualvm -.\" Language: Japanese -.\" Date: 2013ǯ11·î21Æü -.\" SectDesc: Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó¥°¤ª¤è¤Ó´ÉÍý¥Ä¡¼¥ë -.\" Software: JDK 8 -.\" Arch: ÈÆÍÑ -.\" Part Number: E58103-01 -.\" Doc ID: JSSON -.\" -.if n .pl 99999 -.TH "jvisualvm" "1" "2013ǯ11·î21Æü" "JDK 8" "Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "̾Á°" -jvisualvm \- Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò»ë³ÐŪ¤Ë¥â¥Ë¥¿¡¼¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥È¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ë¤·¤Þ¤¹¡£ -.SH "³µÍ×" -.sp -.if n \{\ -.RS 4 -.\} -.nf -\fBjvisualvm\fR [ \fIoptions\fR ] -.fi -.if n \{\ -.RE -.\} -.PP -\fIoptions\fR -.RS 4 -¥³¥Þ¥ó¥É¹Ô¥ª¥×¥·¥ç¥ó¡£¥ª¥×¥·¥ç¥ó¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ -.RE -.SH "ÀâÌÀ" -.PP -Java VisualVM¤Ï¡¢»ØÄꤵ¤ì¤¿Java Virtual Machine (JVM)¤ÇJava¥Æ¥¯¥Î¥í¥¸¡¦¥Ù¡¼¥¹¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó(Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó)¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¤È¤­¤Ë¡¢¤½¤ÎJava¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë´Ø¤¹¤ë¾ÜºÙ¤Ê¾ðÊó¤òÄ󶡤¹¤ëľ´¶Åª¤Ê¥°¥é¥Õ¥£¥«¥ë¡¦¥æ¡¼¥¶¡¼¡¦¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¹¡£Java VisualVM¤È¤¤¤¦Ì¾Á°¤Ï¡¢Java VisualVM¤¬JVM¥½¥Õ¥È¥¦¥§¥¢¤Ë´Ø¤¹¤ë¾ðÊó¤ò»ë³ÐŪ¤ËÄ󶡤¹¤ë¤È¤¤¤¦»ö¼Â¤ËͳÍ褷¤Æ¤¤¤Þ¤¹¡£ -.PP -Java VisualVM¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¥â¥Ë¥¿¥ê¥ó¥°¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¦¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤ò1¤Ä¤Î¥Ä¡¼¥ë¤ËÅý¹ç¤·¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢¥¹¥¿¥ó¥É¥¢¥í¥ó¡¦¥Ä¡¼¥ë\fBjmap\fR¡¢\fBjinfo\fR¡¢\fBjstat\fR¤ª¤è¤Ó\fBjstack\fR¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ëµ¡Ç½¤Î¤Û¤È¤ó¤É¤¬¡¢Java VisualVM¤ËÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£\fBjconsole\fR¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤ÆÄ󶡤µ¤ì¤ë°ìÉô¤Îµ¡Ç½¤Ê¤É¡¢Â¾¤Îµ¡Ç½¤Ï¥ª¥×¥·¥ç¥ó¤Î¥×¥é¥°¥¤¥ó¤È¤·¤ÆÄɲäǤ­¤Þ¤¹¡£ -.PP -Java VisualVM¤Ï¡¢Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î³«È¯¼Ô¤¬¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ò¹Ô¤Ã¤¿¤ê¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ò¥â¥Ë¥¿¡¼¤ª¤è¤Ó²þÁ±¤·¤¿¤ê¤¹¤ë¤Î¤ËÌòΩ¤Á¤Þ¤¹¡£Java VisualVM¤ò»ÈÍѤ¹¤ë¤È¡¢³«È¯¼Ô¤Ï¥Ò¡¼¥×¡¦¥À¥ó¥×¤ÎÀ¸À®¤ª¤è¤Ó²òÀÏ¡¢¥á¥â¥ê¡¼¡¦¥ê¡¼¥¯¤ÎÆÃÄê¡¢¥¬¥Ù¡¼¥¸¡¦¥³¥ì¥¯¥·¥ç¥ó¤Î¼Â¹Ô¤ª¤è¤Ó¥â¥Ë¥¿¡¼¡¢¤ª¤è¤Ó¥á¥â¥ê¡¼¤ÈCPU¤Î´Ê°×¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤Î¼Â¹Ô¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£¥×¥é¥°¥¤¥ó¤ÇJava VisualVM¤Îµ¡Ç½¤ò³ÈÄ¥¤Ç¤­¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢\fBjconsole\fR¥³¥Þ¥ó¥É¤Î¤Û¤È¤ó¤É¤Îµ¡Ç½¤Ï¡¢¡ÖMBean¡×¥¿¥Ö¤ª¤è¤ÓJConsole Plug\-in Wrapper¥×¥é¥°¥¤¥ó¤ò²ð¤·¤Æ»ÈÍѤǤ­¤Þ¤¹¡£É¸½à¤ÎJava VisualVM¥×¥é¥°¥¤¥ó¤Î¥«¥¿¥í¥°¤«¤éÁªÂò¤¹¤ë¤Ë¤Ï¡¢Java VisualVM¥á¥Ë¥å¡¼¤Î\fB¡Ö¥Ä¡¼¥ë¡×\fR¡¢\fB¡Ö¥×¥é¥°¥¤¥ó¡×\fR¤òÁªÂò¤·¤Þ¤¹¡£ -.PP -Java VisualVM¤òµ¯Æ°¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤Þ¤¹¡£ -.sp -.if n \{\ -.RS 4 -.\} -.nf -\fB% jvisualvm \fR - -.fi -.if n \{\ -.RE -.\} -.SH "¥ª¥×¥·¥ç¥ó" -.PP -¼¡¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢Java VisualVM¤òµ¯Æ°¤·¤¿¤È¤­¤Ë¼Â¹Ô²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£ -.PP -\-J\fIjvm_option\fR -.RS 4 -¤³¤Î\fBjvm_option\fR¤òJVM¥½¥Õ¥È¥¦¥§¥¢¤ËÅϤ·¤Þ¤¹¡£ -.RE -.SH "´ØÏ¢¹àÌÜ" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Java VisualVM³«È¯¼Ô¤Î¥µ¥¤¥È -http://visualvm\&.java\&.net/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Java SE¥É¥­¥å¥á¥ó¥È¤ÎJava VisualVM -(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/visualvm/index\&.html) -.RE -.br -'pl 8.5i -'bp diff --git a/jdk/src/solaris/doc/sun/man/man1/jvisualvm.1 b/jdk/src/solaris/doc/sun/man/man1/jvisualvm.1 deleted file mode 100644 index eae03edd804..00000000000 --- a/jdk/src/solaris/doc/sun/man/man1/jvisualvm.1 +++ /dev/null @@ -1,104 +0,0 @@ -." Copyright (c) 2008, 2011, 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. -." -.TH jvisualvm 1 "10 May 2011" - -.LP -.SH "Name" -\f2jvisualvm\fP \- Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool -.LP -.SH "SYNOPSIS" -.LP -.nf -\f3 -.fl - \fP\f3jvisualvm\fP [ \f2options\fP ] -.fl -.fi - -.LP -.SH "PARAMETERS" -.LP -.LP -Options, if used, should follow immediately after the command name. Options may be in any order. For a discussion of parameters that apply to a specific option, see OPTIONS below. -.LP -.SH "DESCRIPTION" -.LP -.LP -Java VisualVM is an intuitive graphical user interface that provides detailed information about Java technology\-based applications (Java applications) while they are running on a given Java Virtual Machine (JVM(*)). The name Java VisualVM comes from the fact that Java VisualVM provides information about the JVM software \f2visually\fP. -.LP -.LP -Java VisualVM combines several monitoring, troubleshooting, and profiling utilities into a single tool. For example, most of the functionality offered by the standalone tools \f2jmap\fP, \f2jinfo\fP, \f2jstat\fP and \f2jstack\fP have been integrated into Java VisualVM. Other functionalities, such as some of those offered by the JConsole tool, can be added as optional plug\-ins. -.LP -.SH "OPTIONS" -.LP -.LP -The following option is possible when you launch Java VisualVM. -.LP -.RS 3 -.TP 3 -\-J\ -Pass this \f2\fP to the JVM software. -.RE - -.LP -.SH "USAGE" -.LP -.LP -Java VisualVM is useful to Java application developers to troubleshoot applications and to monitor and improve the applications' performance. Java VisualVM can allow developers to generate and analyse heap dumps, track down memory leaks, perform and monitor garbage collection, and perform lightweight memory and CPU profiling. Plug\-ins also exist that expand the functionality of Java VisualVM. For example, most of the functionality of the JConsole tool is available via the MBeans Tab and JConsole Plug\-in Wrapper plug\-ins. You can choose from a catalog of standard Java VisualVM plug\-ins by selecting 'Tools' | 'Plugins' in the Java VisualVM menus. -.LP -.LP -Start Java VisualVM with the following command: -.LP -.nf -\f3 -.fl -% jvisualvm \fP\f4\fP\f3 -.fl -\fP -.fi - -.LP -.SH "SEE ALSO" -.LP -.LP -For more details about Java VisualVM see the following pages. -.LP -.RS 3 -.TP 2 -o -.na -\f2Java VisualVM developers' site\fP @ -.fi -http://visualvm.java.net -.TP 2 -o -.na -\f2Java VisualVM in Java SE platform documentation\fP @ -.fi -http://download.oracle.com/javase/7/docs/technotes/guides/visualvm/index.html -.RE - -.LP -.LP -\f2(* The terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.)\fP -.LP - diff --git a/jdk/test/tools/launcher/VersionCheck.java b/jdk/test/tools/launcher/VersionCheck.java index aa507b6da43..c199e1ed88f 100644 --- a/jdk/test/tools/launcher/VersionCheck.java +++ b/jdk/test/tools/launcher/VersionCheck.java @@ -58,7 +58,6 @@ public class VersionCheck extends TestHelper { "jmc", "jmc.ini", "jweblauncher", - "jvisualvm", "packager", "ssvagent", "unpack200", @@ -100,7 +99,6 @@ public class VersionCheck extends TestHelper { "jstat", "jstatd", "jweblauncher", - "jvisualvm", "keytool", "kinit", "klist", From 56e387c99e3fffa83ca96b32274080ae84f5d8ca Mon Sep 17 00:00:00 2001 From: Alexander Zvegintsev Date: Mon, 16 Jan 2017 16:37:47 +0300 Subject: [PATCH 30/71] 8165705: Robot.createScreenCapture produces black screenshot on Oracle Linux 7.1 Reviewed-by: serb --- .../unix/classes/sun/awt/X11/XRobotPeer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java index c300431cf88..0dbd8e00e9b 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java @@ -27,7 +27,7 @@ package sun.awt.X11; import java.awt.*; import java.awt.peer.*; import java.security.AccessController; -import java.security.PrivilegedAction; +import sun.security.action.GetPropertyAction; import sun.awt.AWTAccessor; import sun.awt.SunToolkit; @@ -40,11 +40,11 @@ class XRobotPeer implements RobotPeer { static final boolean tryGtk; static { loadNativeLibraries(); - tryGtk = AccessController.doPrivileged((PrivilegedAction)() - -> Boolean.getBoolean("awt.robot.gtk")); + tryGtk = Boolean.parseBoolean( + AccessController.doPrivileged( + new GetPropertyAction("awt.robot.gtk", "true") + )); } - - private static boolean isGtkSupported = false; private static volatile boolean useGtk; private X11GraphicsConfig xgc = null; From ebac6beb700a78c2da008dd763538b3bfc73e9d1 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 17 Jan 2017 14:14:24 +0100 Subject: [PATCH 31/71] 8170863: Always pass MAKE_ARGS to MAKE in Main.gmk Reviewed-by: erikj --- make/Main.gmk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/make/Main.gmk b/make/Main.gmk index a94e8ca60b1..22f43c2317d 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -247,7 +247,7 @@ HOTSPOT_VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(HOTSPOT_VARIANT_TARGETS)) define DeclareHotspotGensrcRecipe hotspot-$1-gensrc: $$(call LogInfo, Building JVM variant '$1' with features '$(JVM_FEATURES_$1)') - +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f gensrc/GenerateSources.gmk \ + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f gensrc/GenerateSources.gmk \ JVM_VARIANT=$1) endef @@ -255,14 +255,14 @@ $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotGensrcRecipe,$v))) define DeclareHotspotLibsRecipe hotspot-$1-libs: - +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f lib/CompileLibraries.gmk \ + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibraries.gmk \ JVM_VARIANT=$1) endef $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v))) hotspot-jsig: - +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) -f lib/CompileLibjsig.gmk) + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibjsig.gmk) hotspot-ide-project: +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) @@ -285,7 +285,7 @@ ALL_TARGETS += demos-jdk samples-jdk # Jigsaw specific data and analysis targets. generate-summary: - +($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk) + +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GenerateModuleSummary.gmk) ALL_TARGETS += generate-summary @@ -318,7 +318,7 @@ BOOTCYCLE_TARGET := product-images bootcycle-images: ifneq ($(COMPILE_TYPE), cross) $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image) - +$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ + +$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main else $(call LogWarn, Boot cycle build disabled when cross compiling) From ffab9993d7ae208b20b65c38a29464ba2fe23d05 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 17 Jan 2017 18:24:28 +0300 Subject: [PATCH 32/71] 8161732: [TEST_BUG] Test closed/java/awt/MenuBar/MenuBarPeer/MenuBarPeerDisposeTest.java fails in unix enviroments with NullPointerException Reviewed-by: yan --- .../unix/classes/sun/awt/X11/XMenuBarPeer.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java index c9a8108a2e9..65dda8489f1 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -248,9 +248,11 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { XMenuItemPeer.TextMetrics[] itemMetrics = new XMenuItemPeer.TextMetrics[itemCnt]; for (int i = 0; i < itemCnt; i++) { itemMetrics[i] = itemVector[i].getTextMetrics(); - Dimension dim = itemMetrics[i].getTextDimension(); - if (dim != null) { - maxHeight = Math.max(maxHeight, dim.height); + if (itemMetrics[i] != null) { + Dimension dim = itemMetrics[i].getTextDimension(); + if (dim != null) { + maxHeight = Math.max(maxHeight, dim.height); + } } } //Calculate bounds @@ -260,6 +262,9 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { for (int i = 0; i < itemCnt; i++) { XMenuItemPeer item = itemVector[i]; XMenuItemPeer.TextMetrics metrics = itemMetrics[i]; + if (metrics == null) { + continue; + } Dimension dim = metrics.getTextDimension(); if (dim != null) { int itemWidth = BAR_ITEM_MARGIN_LEFT + dim.width + BAR_ITEM_MARGIN_RIGHT; @@ -280,9 +285,6 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP + y); nextOffset += itemWidth + BAR_ITEM_SPACING; item.map(bounds, textOrigin); - } else { - Rectangle bounds = new Rectangle(nextOffset, BAR_SPACING_TOP, 0, 0); - Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP); } } XMenuItemPeer mappedVector[] = new XMenuItemPeer[mappedCnt]; From 842350c6669a3aae89c2daf6126b730484599c3e Mon Sep 17 00:00:00 2001 From: Peter Levart Date: Tue, 17 Jan 2017 11:34:47 -0800 Subject: [PATCH 33/71] 8171139: Simplify ResourceBundle.CacheKey and ClassLoader may not be needed Reviewed-by: dfuchs --- .../classes/java/util/ResourceBundle.java | 345 +++++++----------- .../ResourceBundle/ResourceBundleTest.java | 61 +++- 2 files changed, 186 insertions(+), 220 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java index 109ca64a42e..a1f2779deef 100644 --- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java @@ -43,6 +43,7 @@ package java.util; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; +import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.lang.ref.WeakReference; @@ -365,7 +366,7 @@ public abstract class ResourceBundle { @Override public ResourceBundle getBundle(String baseName, Locale locale, Module module) { // use the given module as the caller to bypass the access check - return getBundleImpl(module, module, getLoader(module), + return getBundleImpl(module, module, baseName, locale, Control.INSTANCE); } @@ -537,63 +538,19 @@ public abstract class ResourceBundle { return locale; } - /* - * Automatic determination of the ClassLoader to be used to load - * resources on behalf of the client. - */ - private static ClassLoader getLoader(Class caller) { - ClassLoader cl = caller == null ? null : caller.getClassLoader(); - if (cl == null) { - // When the caller's loader is the boot class loader, cl is null - // here. In that case, ClassLoader.getSystemClassLoader() may - // return the same class loader that the application is - // using. We therefore use a wrapper ClassLoader to create a - // separate scope for bundles loaded on behalf of the Java - // runtime so that these bundles cannot be returned from the - // cache to the application (5048280). - cl = RBClassLoader.INSTANCE; - } - return cl; - } - private static ClassLoader getLoader(Module module) { PrivilegedAction pa = module::getClassLoader; return AccessController.doPrivileged(pa); } /** - * A wrapper of ClassLoader.getSystemClassLoader(). + * @param module a non-null-screened module form the {@link CacheKey#getModule()}. + * @return the ClassLoader to use in {@link Control#needsReload} + * and {@link Control#newBundle} */ - private static class RBClassLoader extends ClassLoader { - private static final RBClassLoader INSTANCE = AccessController.doPrivileged( - new PrivilegedAction() { - public RBClassLoader run() { - return new RBClassLoader(); - } - }); - private RBClassLoader() { - } - public Class loadClass(String name) throws ClassNotFoundException { - ClassLoader loader = ClassLoader.getSystemClassLoader(); - if (loader != null) { - return loader.loadClass(name); - } - return Class.forName(name); - } - public URL getResource(String name) { - ClassLoader loader = ClassLoader.getSystemClassLoader(); - if (loader != null) { - return loader.getResource(name); - } - return ClassLoader.getSystemResource(name); - } - public InputStream getResourceAsStream(String name) { - ClassLoader loader = ClassLoader.getSystemClassLoader(); - if (loader != null) { - return loader.getResourceAsStream(name); - } - return ClassLoader.getSystemResourceAsStream(name); - } + private static ClassLoader getLoaderForControl(Module module) { + ClassLoader loader = getLoader(module); + return loader == null ? ClassLoader.getSystemClassLoader() : loader; } /** @@ -610,23 +567,23 @@ public abstract class ResourceBundle { /** * Key used for cached resource bundles. The key checks the base - * name, the locale, the class loader, and the caller module + * name, the locale, the bundle module, and the caller module * to determine if the resource is a match to the requested one. - * The loader may be null, but the base name, the locale and - * module must have a non-null value. + * The base name, the locale and both modules must have a non-null value. */ - private static class CacheKey implements Cloneable { + private static final class CacheKey { // These four are the actual keys for lookup in Map. - private String name; - private Locale locale; - private KeyElementReference loaderRef; - private KeyElementReference moduleRef; - private KeyElementReference callerRef; - + private final String name; + private volatile Locale locale; + private final KeyElementReference moduleRef; + private final KeyElementReference callerRef; + // this is the part of hashCode that pertains to module and callerModule + // which can be GCed.. + private final int modulesHash; // bundle format which is necessary for calling // Control.needsReload(). - private String format; + private volatile String format; // These time values are in CacheKey so that NONEXISTENT_BUNDLE // doesn't need to be cloned for caching. @@ -639,63 +596,55 @@ public abstract class ResourceBundle { private volatile long expirationTime; // Placeholder for an error report by a Throwable - private Throwable cause; - - // Hash code value cache to avoid recalculating the hash code - // of this instance. - private int hashCodeCache; + private volatile Throwable cause; // ResourceBundleProviders for loading ResourceBundles - private ServiceLoader providers; - private boolean providersChecked; + private volatile ServiceLoader providers; + private volatile boolean providersChecked; // Boolean.TRUE if the factory method caller provides a ResourceBundleProvier. - private Boolean callerHasProvider; + private volatile Boolean callerHasProvider; - CacheKey(String baseName, Locale locale, ClassLoader loader, Module module, Module caller) { + CacheKey(String baseName, Locale locale, Module module, Module caller) { Objects.requireNonNull(module); + Objects.requireNonNull(caller); this.name = baseName; this.locale = locale; - if (loader == null) { - this.loaderRef = null; - } else { - this.loaderRef = new KeyElementReference<>(loader, referenceQueue, this); - } this.moduleRef = new KeyElementReference<>(module, referenceQueue, this); this.callerRef = new KeyElementReference<>(caller, referenceQueue, this); + this.modulesHash = module.hashCode() ^ caller.hashCode(); + } - calculateHashCode(); + CacheKey(CacheKey src) { + // Create References to src's modules + this.moduleRef = new KeyElementReference<>( + Objects.requireNonNull(src.getModule()), referenceQueue, this); + this.callerRef = new KeyElementReference<>( + Objects.requireNonNull(src.getCallerModule()), referenceQueue, this); + // Copy fields from src. ResourceBundleProviders related fields + // and "cause" should not be copied. + this.name = src.name; + this.locale = src.locale; + this.modulesHash = src.modulesHash; + this.format = src.format; + this.loadTime = src.loadTime; + this.expirationTime = src.expirationTime; } String getName() { return name; } - CacheKey setName(String baseName) { - if (!this.name.equals(baseName)) { - this.name = baseName; - calculateHashCode(); - } - return this; - } - Locale getLocale() { return locale; } CacheKey setLocale(Locale locale) { - if (!this.locale.equals(locale)) { - this.locale = locale; - calculateHashCode(); - } + this.locale = locale; return this; } - ClassLoader getLoader() { - return (loaderRef != null) ? loaderRef.get() : null; - } - Module getModule() { return moduleRef.get(); } @@ -728,7 +677,7 @@ public abstract class ResourceBundle { try { final CacheKey otherEntry = (CacheKey)other; //quick check to see if they are not equal - if (hashCodeCache != otherEntry.hashCodeCache) { + if (modulesHash != otherEntry.modulesHash) { return false; } //are the names the same? @@ -739,24 +688,11 @@ public abstract class ResourceBundle { if (!locale.equals(otherEntry.locale)) { return false; } - //are refs (both non-null) or (both null)? - if (loaderRef == null) { - return otherEntry.loaderRef == null; - } - ClassLoader loader = getLoader(); + // are modules and callerModules the same and non-null? Module module = getModule(); Module caller = getCallerModule(); - - return (otherEntry.loaderRef != null) - // with a null reference we can no longer find - // out which class loader or module was referenced; so - // treat it as unequal - && (loader != null) - && (loader == otherEntry.getLoader()) - && (module != null) - && (module.equals(otherEntry.getModule())) - && (caller != null) - && (caller.equals(otherEntry.getCallerModule())); + return ((module != null) && (module.equals(otherEntry.getModule())) && + (caller != null) && (caller.equals(otherEntry.getCallerModule()))); } catch (NullPointerException | ClassCastException e) { } return false; @@ -764,51 +700,7 @@ public abstract class ResourceBundle { @Override public int hashCode() { - return hashCodeCache; - } - - private void calculateHashCode() { - hashCodeCache = name.hashCode() << 3; - hashCodeCache ^= locale.hashCode(); - ClassLoader loader = getLoader(); - if (loader != null) { - hashCodeCache ^= loader.hashCode(); - } - Module module = getModule(); - if (module != null) { - hashCodeCache ^= module.hashCode(); - } - Module caller = getCallerModule(); - if (caller != null) { - hashCodeCache ^= caller.hashCode(); - } - } - - @Override - public Object clone() { - try { - CacheKey clone = (CacheKey) super.clone(); - if (loaderRef != null) { - clone.loaderRef = new KeyElementReference<>(getLoader(), - referenceQueue, clone); - } - clone.moduleRef = new KeyElementReference<>(getModule(), - referenceQueue, clone); - clone.callerRef = new KeyElementReference<>(getCallerModule(), - referenceQueue, clone); - - // Clear the reference to ResourceBundleProviders and the flag - clone.providers = null; - clone.providersChecked = false; - // Clear the reference to a Throwable - clone.cause = null; - // Clear callerHasProvider - clone.callerHasProvider = null; - return clone; - } catch (CloneNotSupportedException e) { - //this should never happen - throw new InternalError(e); - } + return (name.hashCode() << 3) ^ locale.hashCode() ^ modulesHash; } String getFormat() { @@ -845,8 +737,12 @@ public abstract class ResourceBundle { l = "\"\""; } } - return "CacheKey[" + name + ", lc=" + l + ", ldr=" + getLoader() - + "(format=" + format + ")]"; + return "CacheKey[" + name + + ", locale=" + l + + ", module=" + getModule() + + ", callerModule=" + getCallerModule() + + ", format=" + format + + "]"; } } @@ -1568,7 +1464,7 @@ public abstract class ResourceBundle { Locale locale, Class caller, Control control) { - return getBundleImpl(baseName, locale, caller, getLoader(caller), control); + return getBundleImpl(baseName, locale, caller, caller.getClassLoader(), control); } /** @@ -1587,26 +1483,25 @@ public abstract class ResourceBundle { Class caller, ClassLoader loader, Control control) { - if (caller != null && caller.getModule().isNamed()) { - Module module = caller.getModule(); - ClassLoader ml = getLoader(module); - // get resource bundles for a named module only - // if loader is the module's class loader - if (loader == ml || (ml == null && loader == RBClassLoader.INSTANCE)) { - return getBundleImpl(module, module, loader, baseName, locale, control); - } - } - // find resource bundles from unnamed module - Module unnamedModule = loader != null - ? loader.getUnnamedModule() - : ClassLoader.getSystemClassLoader().getUnnamedModule(); - if (caller == null) { throw new InternalError("null caller"); } - Module callerModule = caller.getModule(); - return getBundleImpl(callerModule, unnamedModule, loader, baseName, locale, control); + + // get resource bundles for a named module only if loader is the module's class loader + if (callerModule.isNamed() && loader == getLoader(callerModule)) { + return getBundleImpl(callerModule, callerModule, baseName, locale, control); + } + + // find resource bundles from unnamed module of given class loader + // Java agent can add to the bootclasspath e.g. via + // java.lang.instrument.Instrumentation and load classes in unnamed module. + // It may call RB::getBundle that will end up here with loader == null. + Module unnamedModule = loader != null + ? loader.getUnnamedModule() + : BootLoader.getUnnamedModule(); + + return getBundleImpl(callerModule, unnamedModule, baseName, locale, control); } private static ResourceBundle getBundleFromModule(Class caller, @@ -1622,12 +1517,11 @@ public abstract class ResourceBundle { sm.checkPermission(GET_CLASSLOADER_PERMISSION); } } - return getBundleImpl(callerModule, module, getLoader(module), baseName, locale, control); + return getBundleImpl(callerModule, module, baseName, locale, control); } private static ResourceBundle getBundleImpl(Module callerModule, Module module, - ClassLoader loader, String baseName, Locale locale, Control control) { @@ -1636,10 +1530,10 @@ public abstract class ResourceBundle { } // We create a CacheKey here for use by this call. The base name - // loader, and module will never change during the bundle loading + // and modules will never change during the bundle loading // process. We have to make sure that the locale is set before // using it as a cache key. - CacheKey cacheKey = new CacheKey(baseName, locale, loader, module, callerModule); + CacheKey cacheKey = new CacheKey(baseName, locale, module, callerModule); ResourceBundle bundle = null; // Quick lookup of the cache. @@ -1708,6 +1602,11 @@ public abstract class ResourceBundle { bundle = baseBundle; } + // keep callerModule and module reachable for as long as we are operating + // with WeakReference(s) to them (in CacheKey)... + Reference.reachabilityFence(callerModule); + Reference.reachabilityFence(module); + return bundle; } @@ -1745,7 +1644,7 @@ public abstract class ResourceBundle { } // Before we do the real loading work, see whether we need to - // do some housekeeping: If references to class loaders or + // do some housekeeping: If references to modules or // resource bundles have been nulled out, remove all related // information from the cache. Object ref; @@ -1781,31 +1680,24 @@ public abstract class ResourceBundle { } if (bundle != NONEXISTENT_BUNDLE) { - CacheKey constKey = (CacheKey) cacheKey.clone(); trace("findBundle: %d %s %s formats: %s%n", index, candidateLocales, cacheKey, formats); - try { - if (module.isNamed()) { - bundle = loadBundle(cacheKey, formats, control, module, callerModule); - } else { - bundle = loadBundle(cacheKey, formats, control, expiredBundle); - } - if (bundle != null) { - if (bundle.parent == null) { - bundle.setParent(parent); - } - bundle.locale = targetLocale; - bundle = putBundleInCache(cacheKey, bundle, control); - return bundle; - } - - // Put NONEXISTENT_BUNDLE in the cache as a mark that there's no bundle - // instance for the locale. - putBundleInCache(cacheKey, NONEXISTENT_BUNDLE, control); - } finally { - if (constKey.getCause() instanceof InterruptedException) { - Thread.currentThread().interrupt(); - } + if (module.isNamed()) { + bundle = loadBundle(cacheKey, formats, control, module, callerModule); + } else { + bundle = loadBundle(cacheKey, formats, control, expiredBundle); } + if (bundle != null) { + if (bundle.parent == null) { + bundle.setParent(parent); + } + bundle.locale = targetLocale; + bundle = putBundleInCache(cacheKey, bundle, control); + return bundle; + } + + // Put NONEXISTENT_BUNDLE in the cache as a mark that there's no bundle + // instance for the locale. + putBundleInCache(cacheKey, NONEXISTENT_BUNDLE, control); } return parent; } @@ -1991,12 +1883,20 @@ public abstract class ResourceBundle { // specified by the getFormats() value. Locale targetLocale = cacheKey.getLocale(); + Module module = cacheKey.getModule(); + if (module == null) { + // should not happen + throw new InternalError( + "Module for cache key: " + cacheKey + " has been GCed."); + } + ClassLoader loader = getLoaderForControl(module); + ResourceBundle bundle = null; for (String format : formats) { try { // ResourceBundle.Control.newBundle may be overridden bundle = control.newBundle(cacheKey.getName(), targetLocale, format, - cacheKey.getLoader(), reload); + loader, reload); } catch (LinkageError | Exception error) { // We need to handle the LinkageError case due to // inconsistent case-sensitivity in ClassLoader. @@ -2138,12 +2038,15 @@ public abstract class ResourceBundle { if (!bundle.expired && expirationTime >= 0 && expirationTime <= System.currentTimeMillis()) { try { - bundle.expired = control.needsReload(key.getName(), - key.getLocale(), - key.getFormat(), - key.getLoader(), - bundle, - key.loadTime); + Module module = cacheKey.getModule(); + bundle.expired = + module == null || // already GCed + control.needsReload(key.getName(), + key.getLocale(), + key.getFormat(), + getLoaderForControl(module), + bundle, + key.loadTime); } catch (Exception e) { cacheKey.setCause(e); } @@ -2185,7 +2088,7 @@ public abstract class ResourceBundle { Control control) { setExpirationTime(cacheKey, control); if (cacheKey.expirationTime != Control.TTL_DONT_CACHE) { - CacheKey key = (CacheKey) cacheKey.clone(); + CacheKey key = new CacheKey(cacheKey); BundleReference bundleRef = new BundleReference(bundle, referenceQueue, key); bundle.cacheKey = key; @@ -2239,7 +2142,7 @@ public abstract class ResourceBundle { @CallerSensitive public static final void clearCache() { Class caller = Reflection.getCallerClass(); - clearCache(getLoader(caller), caller.getModule()); + clearCacheImpl(caller.getModule(), caller.getClassLoader()); } /** @@ -2254,7 +2157,8 @@ public abstract class ResourceBundle { @CallerSensitive public static final void clearCache(ClassLoader loader) { Objects.requireNonNull(loader); - clearCache(loader, Reflection.getCallerClass().getModule()); + Class caller = Reflection.getCallerClass(); + clearCacheImpl(caller.getModule(), loader); } /** @@ -2272,14 +2176,19 @@ public abstract class ResourceBundle { * @see ResourceBundle.Control#getTimeToLive(String,Locale) */ public static final void clearCache(Module module) { - clearCache(module.getClassLoader(), module); + Objects.requireNonNull(module); + clearCacheImpl(module, module.getClassLoader()); } - private static void clearCache(ClassLoader loader, Module module) { - Set set = cacheList.keySet(); - set.stream() - .filter((key) -> (key.getLoader() == loader && key.getModule() == module)) - .forEach(set::remove); + private static void clearCacheImpl(Module callerModule, ClassLoader loader) { + cacheList.keySet().removeIf( + key -> { + Module m; + return key.getCallerModule() == callerModule && + (m = key.getModule()) != null && + getLoader(m) == loader; + } + ); } /** diff --git a/jdk/test/java/util/ResourceBundle/ResourceBundleTest.java b/jdk/test/java/util/ResourceBundle/ResourceBundleTest.java index 4a939fbc44e..44b845256e9 100644 --- a/jdk/test/java/util/ResourceBundle/ResourceBundleTest.java +++ b/jdk/test/java/util/ResourceBundle/ResourceBundleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -22,7 +22,7 @@ */ /* @test - @bug 4049325 4073127 4083270 4106034 4108126 8027930 + @bug 4049325 4073127 4083270 4106034 4108126 8027930 8171139 @summary test Resource Bundle @build TestResource TestResource_de TestResource_fr TestResource_fr_CH @build TestResource_it FakeTestResource @@ -65,6 +65,7 @@ import java.text.*; import java.util.*; import java.util.ResourceBundle.Control; import java.io.*; +import java.net.URL; public class ResourceBundleTest extends RBTestFmwk { public static void main(String[] args) throws Exception { @@ -330,6 +331,44 @@ public class ResourceBundleTest extends RBTestFmwk { } } + /* + * @bug 8171139 + * @summary Make sure clearCache() clears cached ResourceBundle instances + */ + public void TestClearCache() { + final String className = "TestResource"; + Locale loc = Locale.getDefault(); + + // testing no-arg clearCache() + ResourceBundle rb1 = ResourceBundle.getBundle(className, loc); + ResourceBundle.clearCache(); + ResourceBundle rb2 = ResourceBundle.getBundle(className, loc); + if (rb1 == rb2) { + errln("clearCache(no-arg) did not clear cache"); + } + + // clearCache() with a custom classloader + ClassLoader cl1 = new DummyClassLoader(); + rb1 = ResourceBundle.getBundle(className, loc, cl1); + if (rb1 == rb2) { + errln("Same bundle was returned for different class loaders"); + } + ResourceBundle.clearCache(cl1); + rb2= ResourceBundle.getBundle(className, loc, cl1); + if (rb1 == rb2) { + errln("clearCache(classLoader) did not clear cache"); + } + ClassLoader cl2 = new DummyClassLoader(); + rb1 = ResourceBundle.getBundle(className, loc, cl2); + if (rb1 == rb2) { + errln("Same bundle was returned for different class loaders"); + } + ResourceBundle.clearCache(cl1); + rb2 = ResourceBundle.getBundle(className, loc, cl2); + if (rb1 != rb2) { + errln("clearCache(classLoader) incorrectly cleared cache"); + } + } private void makePropertiesFile() { try { @@ -393,4 +432,22 @@ public class ResourceBundleTest extends RBTestFmwk { errln("Wrong number of elements in key list: expected " + expectedKeys.length + " got " + elementCount); } + + private static class DummyClassLoader extends ClassLoader { + public DummyClassLoader() { + super(DummyClassLoader.class.getClassLoader()); + } + + public Class loadClass(String name) throws ClassNotFoundException { + return DummyClassLoader.class.getClassLoader().loadClass(name); + } + + public URL getResource(String name) { + return DummyClassLoader.class.getClassLoader().getResource(name); + } + + public InputStream getResourceAsStream(String name) { + return DummyClassLoader.class.getClassLoader().getResourceAsStream(name); + } + } } From e13c369fbf3e34c09c5caf4a27b23b1ac5932a40 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 17 Jan 2017 11:56:40 -0800 Subject: [PATCH 34/71] 8171456: Upgrade harfbuzz in JDK 9 to v1.4.1 Reviewed-by: serb, vadim, simonis --- .../native/libfontmanager/harfbuzz/hb-blob.cc | 16 +- .../harfbuzz/hb-buffer-deserialize-json.hh | 744 ++--- .../harfbuzz/hb-buffer-deserialize-text.hh | 490 ++-- .../harfbuzz/hb-buffer-private.hh | 6 +- .../harfbuzz/hb-buffer-serialize.cc | 14 +- .../libfontmanager/harfbuzz/hb-buffer.cc | 44 +- .../harfbuzz/hb-cache-private.hh | 8 +- .../libfontmanager/harfbuzz/hb-common.cc | 50 +- .../libfontmanager/harfbuzz/hb-coretext.cc | 26 +- .../native/libfontmanager/harfbuzz/hb-face.cc | 74 +- .../harfbuzz/hb-fallback-shape.cc | 4 +- .../harfbuzz/hb-font-private.hh | 115 +- .../native/libfontmanager/harfbuzz/hb-font.cc | 365 +-- .../native/libfontmanager/harfbuzz/hb-font.h | 5 + .../native/libfontmanager/harfbuzz/hb-ft.cc | 54 +- .../harfbuzz/hb-open-type-private.hh | 10 +- .../harfbuzz/hb-ot-cbdt-table.hh | 384 +++ .../libfontmanager/harfbuzz/hb-ot-font.cc | 113 +- .../harfbuzz/hb-ot-layout-common-private.hh | 497 +++- .../harfbuzz/hb-ot-layout-gdef-table.hh | 52 +- .../harfbuzz/hb-ot-layout-gpos-table.hh | 117 +- .../harfbuzz/hb-ot-layout-gsub-table.hh | 82 +- .../harfbuzz/hb-ot-layout-gsubgpos-private.hh | 36 +- .../harfbuzz/hb-ot-layout-private.hh | 3 + .../libfontmanager/harfbuzz/hb-ot-layout.cc | 57 +- .../libfontmanager/harfbuzz/hb-ot-layout.h | 19 + .../harfbuzz/hb-ot-map-private.hh | 18 +- .../libfontmanager/harfbuzz/hb-ot-map.cc | 118 +- .../libfontmanager/harfbuzz/hb-ot-math.h | 209 ++ .../harfbuzz/hb-ot-shape-complex-arabic.cc | 1 + .../harfbuzz/hb-ot-shape-complex-default.cc | 1 + .../harfbuzz/hb-ot-shape-complex-hangul.cc | 1 + .../harfbuzz/hb-ot-shape-complex-hebrew.cc | 13 + .../hb-ot-shape-complex-indic-machine.hh | 2560 ++++++++--------- .../harfbuzz/hb-ot-shape-complex-indic.cc | 20 +- .../hb-ot-shape-complex-myanmar-machine.hh | 374 +-- .../harfbuzz/hb-ot-shape-complex-myanmar.cc | 2 + .../harfbuzz/hb-ot-shape-complex-private.hh | 8 + .../harfbuzz/hb-ot-shape-complex-thai.cc | 1 + .../harfbuzz/hb-ot-shape-complex-tibetan.cc | 1 + .../hb-ot-shape-complex-use-machine.hh | 422 +-- .../harfbuzz/hb-ot-shape-complex-use.cc | 44 +- .../harfbuzz/hb-ot-shape-private.hh | 6 +- .../libfontmanager/harfbuzz/hb-ot-shape.cc | 70 +- .../libfontmanager/harfbuzz/hb-ot-tag.cc | 23 +- .../native/libfontmanager/harfbuzz/hb-ot.h | 1 + .../libfontmanager/harfbuzz/hb-private.hh | 11 +- .../libfontmanager/harfbuzz/hb-set-private.hh | 4 +- .../native/libfontmanager/harfbuzz/hb-set.cc | 66 +- .../harfbuzz/hb-shape-plan-private.hh | 9 +- .../libfontmanager/harfbuzz/hb-shape-plan.cc | 153 +- .../libfontmanager/harfbuzz/hb-shape-plan.h | 19 + .../libfontmanager/harfbuzz/hb-shape.cc | 5 +- .../libfontmanager/harfbuzz/hb-unicode.cc | 60 +- .../libfontmanager/harfbuzz/hb-version.h | 6 +- .../native/libfontmanager/hb-jdk-font.cc | 20 +- 56 files changed, 4645 insertions(+), 2986 deletions(-) create mode 100644 jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cbdt-table.hh create mode 100644 jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-math.h diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc index 5068dc14d9a..02c60253bfc 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc @@ -247,7 +247,7 @@ hb_blob_destroy (hb_blob_t *blob) * @destroy: callback to call when @data is not needed anymore. * @replace: whether to replace an existing data with the same key. * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -266,9 +266,9 @@ hb_blob_set_user_data (hb_blob_t *blob, * @blob: a blob. * @key: key for data to get. * + * * - * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -284,7 +284,7 @@ hb_blob_get_user_data (hb_blob_t *blob, * hb_blob_make_immutable: * @blob: a blob. * - * + * * * Since: 0.9.2 **/ @@ -301,7 +301,7 @@ hb_blob_make_immutable (hb_blob_t *blob) * hb_blob_is_immutable: * @blob: a blob. * - * + * * * Return value: TODO * @@ -318,7 +318,7 @@ hb_blob_is_immutable (hb_blob_t *blob) * hb_blob_get_length: * @blob: a blob. * - * + * * * Return value: the length of blob data in bytes. * @@ -335,9 +335,9 @@ hb_blob_get_length (hb_blob_t *blob) * @blob: a blob. * @length: (out): * + * * - * - * Returns: (transfer none) (array length=length): + * Returns: (transfer none) (array length=length): * * Since: 0.9.2 **/ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-json.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-json.hh index 5d4387149ac..7581c2cd739 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-json.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-json.hh @@ -34,397 +34,397 @@ #line 36 "hb-buffer-deserialize-json.hh" static const unsigned char _deserialize_json_trans_keys[] = { - 0u, 0u, 9u, 123u, 9u, 34u, 97u, 103u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, - 48u, 57u, 9u, 125u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, - 9u, 125u, 9u, 125u, 108u, 108u, 34u, 34u, 9u, 58u, 9u, 57u, 9u, 125u, 9u, 125u, - 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, - 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, + 0u, 0u, 9u, 123u, 9u, 34u, 97u, 103u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, + 48u, 57u, 9u, 125u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, + 9u, 125u, 9u, 125u, 108u, 108u, 34u, 34u, 9u, 58u, 9u, 57u, 9u, 125u, 9u, 125u, + 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, + 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 65u, 122u, 34u, 122u, 9u, 125u, 9u, 125u, 9u, 93u, 9u, 123u, 0u, 0u, 0 }; static const char _deserialize_json_key_spans[] = { - 0, 115, 26, 7, 2, 1, 50, 49, - 10, 117, 117, 117, 1, 50, 49, 10, - 117, 117, 1, 1, 50, 49, 117, 117, - 2, 1, 50, 49, 10, 117, 117, 1, - 50, 49, 10, 117, 117, 1, 50, 49, + 0, 115, 26, 7, 2, 1, 50, 49, + 10, 117, 117, 117, 1, 50, 49, 10, + 117, 117, 1, 1, 50, 49, 117, 117, + 2, 1, 50, 49, 10, 117, 117, 1, + 50, 49, 10, 117, 117, 1, 50, 49, 58, 89, 117, 117, 85, 115, 0 }; static const short _deserialize_json_index_offsets[] = { - 0, 0, 116, 143, 151, 154, 156, 207, - 257, 268, 386, 504, 622, 624, 675, 725, - 736, 854, 972, 974, 976, 1027, 1077, 1195, - 1313, 1316, 1318, 1369, 1419, 1430, 1548, 1666, - 1668, 1719, 1769, 1780, 1898, 2016, 2018, 2069, + 0, 0, 116, 143, 151, 154, 156, 207, + 257, 268, 386, 504, 622, 624, 675, 725, + 736, 854, 972, 974, 976, 1027, 1077, 1195, + 1313, 1316, 1318, 1369, 1419, 1430, 1548, 1666, + 1668, 1719, 1769, 1780, 1898, 2016, 2018, 2069, 2119, 2178, 2268, 2386, 2504, 2590, 2706 }; static const char _deserialize_json_indicies[] = { - 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 1, 3, 3, 3, - 3, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 4, 1, - 5, 1, 6, 7, 1, 1, 8, 1, - 9, 10, 1, 11, 1, 11, 11, 11, - 11, 11, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 11, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 12, 1, - 12, 12, 12, 12, 12, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 12, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 13, 1, 1, 14, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 1, 16, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 1, 18, 18, 18, - 18, 18, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 18, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 19, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 20, 1, 21, 21, 21, 21, 21, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 21, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 22, - 1, 18, 18, 18, 18, 18, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 18, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 19, 1, 1, 1, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 20, 1, 23, - 1, 23, 23, 23, 23, 23, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 23, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 24, 1, 24, 24, 24, 24, - 24, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 24, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 25, 1, 1, 26, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 1, 28, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 1, 30, 30, 30, 30, 30, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 30, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 31, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 32, 1, 30, - 30, 30, 30, 30, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 30, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 31, 1, 1, 1, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 32, 1, 33, 1, 34, - 1, 34, 34, 34, 34, 34, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 34, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 35, 1, 35, 35, 35, 35, - 35, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 35, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 36, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 1, 38, 38, - 38, 38, 38, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 38, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 39, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 40, 1, 38, 38, 38, 38, - 38, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 38, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 39, - 1, 1, 1, 41, 41, 41, 41, 41, - 41, 41, 41, 41, 41, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 40, 1, 42, 43, 1, 44, 1, 44, - 44, 44, 44, 44, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 44, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 45, 1, 45, 45, 45, 45, 45, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 45, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 46, 1, - 1, 47, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 1, 49, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 1, 51, - 51, 51, 51, 51, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 51, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 52, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 53, 1, 51, 51, 51, - 51, 51, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 51, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 52, 1, 1, 1, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 53, 1, 54, 1, 54, 54, 54, - 54, 54, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 54, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 55, 1, - 55, 55, 55, 55, 55, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 55, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 56, 1, 1, 57, - 58, 58, 58, 58, 58, 58, 58, 58, - 58, 1, 59, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 1, 61, 61, 61, - 61, 61, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 61, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 62, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 63, 1, 61, 61, 61, 61, 61, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 61, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 62, 1, - 1, 1, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 63, - 1, 64, 1, 64, 64, 64, 64, 64, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 64, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 65, 1, 65, 65, - 65, 65, 65, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 65, 1, 66, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 67, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 1, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 1, 1, 1, 1, 1, 1, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 1, 70, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 71, 71, - 1, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 1, 1, 1, 1, 1, - 1, 1, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 1, 1, 1, 1, - 71, 1, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 1, 72, 72, 72, - 72, 72, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 72, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 73, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 74, 1, 72, 72, 72, 72, 72, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 72, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 73, 1, - 1, 1, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 74, - 1, 76, 76, 76, 76, 76, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 76, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 77, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 78, 1, 0, - 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 1, 3, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 1, 4, 1, + 5, 1, 6, 7, 1, 1, 8, 1, + 9, 10, 1, 11, 1, 11, 11, 11, + 11, 11, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 11, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 12, 1, + 12, 12, 12, 12, 12, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 12, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 13, 1, 1, 14, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 1, 16, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 1, 18, 18, 18, + 18, 18, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 18, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 19, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 20, 1, 21, 21, 21, 21, 21, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 21, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 22, + 1, 18, 18, 18, 18, 18, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 18, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 19, 1, 1, 1, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 20, 1, 23, + 1, 23, 23, 23, 23, 23, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 23, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 24, 1, 24, 24, 24, 24, + 24, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 24, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 25, 1, 1, 26, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 1, 28, 29, + 29, 29, 29, 29, 29, 29, 29, 29, + 1, 30, 30, 30, 30, 30, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 30, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 31, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 32, 1, 30, + 30, 30, 30, 30, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 30, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 31, 1, 1, 1, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 32, 1, 33, 1, 34, + 1, 34, 34, 34, 34, 34, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 34, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 35, 1, 35, 35, 35, 35, + 35, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 35, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 36, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 1, 38, 38, + 38, 38, 38, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 38, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 39, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 40, 1, 38, 38, 38, 38, + 38, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 38, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 39, + 1, 1, 1, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 40, 1, 42, 43, 1, 44, 1, 44, + 44, 44, 44, 44, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 44, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 45, 1, 45, 45, 45, 45, 45, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 45, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 46, 1, + 1, 47, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 1, 49, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 1, 51, + 51, 51, 51, 51, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 51, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 52, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 53, 1, 51, 51, 51, + 51, 51, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 51, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 52, 1, 1, 1, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 53, 1, 54, 1, 54, 54, 54, + 54, 54, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 54, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 55, 1, + 55, 55, 55, 55, 55, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 55, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 56, 1, 1, 57, + 58, 58, 58, 58, 58, 58, 58, 58, + 58, 1, 59, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 1, 61, 61, 61, + 61, 61, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 61, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 62, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 63, 1, 61, 61, 61, 61, 61, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 61, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 62, 1, + 1, 1, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 63, + 1, 64, 1, 64, 64, 64, 64, 64, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 64, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 65, 1, 65, 65, + 65, 65, 65, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 65, 1, 66, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 67, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 1, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 1, 1, 1, 1, 1, 1, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 1, 70, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 71, 71, + 1, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 1, 1, 1, 1, 1, + 1, 1, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 1, 1, 1, 1, + 71, 1, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 1, 72, 72, 72, + 72, 72, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 72, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 73, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 74, 1, 72, 72, 72, 72, 72, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 72, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 73, 1, + 1, 1, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 74, + 1, 76, 76, 76, 76, 76, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 76, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 77, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 78, 1, 0, + 0, 0, 0, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 0 }; static const char _deserialize_json_trans_targs[] = { - 1, 0, 2, 2, 3, 4, 18, 24, - 37, 5, 12, 6, 7, 8, 9, 11, - 9, 11, 10, 2, 44, 10, 44, 13, - 14, 15, 16, 17, 16, 17, 10, 2, - 44, 19, 20, 21, 22, 23, 10, 2, - 44, 23, 25, 31, 26, 27, 28, 29, - 30, 29, 30, 10, 2, 44, 32, 33, - 34, 35, 36, 35, 36, 10, 2, 44, - 38, 39, 40, 42, 43, 41, 10, 41, + 1, 0, 2, 2, 3, 4, 18, 24, + 37, 5, 12, 6, 7, 8, 9, 11, + 9, 11, 10, 2, 44, 10, 44, 13, + 14, 15, 16, 17, 16, 17, 10, 2, + 44, 19, 20, 21, 22, 23, 10, 2, + 44, 23, 25, 31, 26, 27, 28, 29, + 30, 29, 30, 10, 2, 44, 32, 33, + 34, 35, 36, 35, 36, 10, 2, 44, + 38, 39, 40, 42, 43, 41, 10, 41, 10, 2, 44, 43, 44, 45, 46 }; static const char _deserialize_json_trans_actions[] = { - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2, 2, 2, - 0, 0, 3, 3, 4, 0, 5, 0, - 0, 2, 2, 2, 0, 0, 6, 6, - 7, 0, 0, 0, 2, 2, 8, 8, - 9, 0, 0, 0, 0, 0, 2, 2, - 2, 0, 0, 10, 10, 11, 0, 0, - 2, 2, 2, 0, 0, 12, 12, 13, - 0, 0, 0, 2, 2, 2, 14, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2, 2, 2, + 0, 0, 3, 3, 4, 0, 5, 0, + 0, 2, 2, 2, 0, 0, 6, 6, + 7, 0, 0, 0, 2, 2, 8, 8, + 9, 0, 0, 0, 0, 0, 2, 2, + 2, 0, 0, 10, 10, 11, 0, 0, + 2, 2, 2, 0, 0, 12, 12, 13, + 0, 0, 0, 2, 2, 2, 14, 0, 15, 15, 16, 0, 0, 0, 0 }; @@ -461,7 +461,7 @@ _hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer, int cs; hb_glyph_info_t info = {0}; hb_glyph_position_t pos = {0}; - + #line 466 "hb-buffer-deserialize-json.hh" { cs = deserialize_json_start; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-text.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-text.hh index c45442c0274..259719c1fea 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-text.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-deserialize-text.hh @@ -34,274 +34,274 @@ #line 36 "hb-buffer-deserialize-text.hh" static const unsigned char _deserialize_text_trans_keys[] = { - 0u, 0u, 9u, 122u, 45u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u, - 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, 9u, 124u, 9u, 124u, 0u, 0u, - 9u, 122u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, + 0u, 0u, 9u, 122u, 45u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u, + 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, 9u, 124u, 9u, 124u, 0u, 0u, + 9u, 122u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 0 }; static const char _deserialize_text_key_spans[] = { - 0, 114, 13, 10, 13, 10, 10, 13, - 10, 1, 13, 10, 14, 116, 116, 0, - 114, 116, 116, 116, 116, 116, 116, 116, + 0, 114, 13, 10, 13, 10, 10, 13, + 10, 1, 13, 10, 14, 116, 116, 0, + 114, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116 }; static const short _deserialize_text_index_offsets[] = { - 0, 0, 115, 129, 140, 154, 165, 176, - 190, 201, 203, 217, 228, 243, 360, 477, - 478, 593, 710, 827, 944, 1061, 1178, 1295, + 0, 0, 115, 129, 140, 154, 165, 176, + 190, 201, 203, 217, 228, 243, 360, 477, + 478, 593, 710, 827, 944, 1061, 1178, 1295, 1412, 1529, 1646 }; static const char _deserialize_text_indicies[] = { - 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 1, 5, 1, 1, 6, - 7, 7, 7, 7, 7, 7, 7, 7, - 7, 1, 8, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 1, 10, 1, 1, - 11, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 1, 13, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 1, 15, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 1, 17, 1, 1, 18, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 1, 20, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 1, 22, 1, 23, 1, 1, 24, - 25, 25, 25, 25, 25, 25, 25, 25, - 25, 1, 26, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 1, 22, 1, 1, - 1, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 1, 28, 28, 28, 28, - 28, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 28, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 29, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 30, 1, 1, 31, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 32, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 33, - 1, 34, 34, 34, 34, 34, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 34, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 35, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 36, 1, 1, 0, - 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 1, 1, 1, 1, 1, 1, 1, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 1, 1, 1, 1, 1, 1, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 1, 28, 28, 28, 28, 28, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 28, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 29, 1, 1, 1, - 1, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 1, 1, 1, 30, 1, - 1, 31, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 32, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 33, 1, 38, - 38, 38, 38, 38, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 38, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 39, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 40, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 41, 1, 42, 42, 42, 42, - 42, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 42, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 43, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 44, - 1, 42, 42, 42, 42, 42, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 42, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 43, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 44, 1, 38, 38, - 38, 38, 38, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 38, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 39, 1, 1, 1, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 40, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 41, 1, 45, 45, 45, 45, 45, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 45, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 46, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 47, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 48, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 49, 1, - 50, 50, 50, 50, 50, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 50, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 51, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 52, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 53, 1, 50, 50, 50, - 50, 50, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 50, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 51, - 1, 1, 1, 1, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 52, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 53, 1, 45, 45, 45, 45, 45, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 45, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 46, 1, 1, 1, - 1, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 1, 1, 1, 1, 1, - 1, 47, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 48, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 49, 1, 28, - 28, 28, 28, 28, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 28, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 29, 1, 55, 55, 1, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 1, 1, 1, 30, 1, 1, 31, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 1, 1, 32, 1, 55, 1, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, + 0, 0, 0, 0, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 5, 1, 1, 6, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 1, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 1, 10, 1, 1, + 11, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 1, 13, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 1, 15, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 1, 17, 1, 1, 18, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 1, 20, + 21, 21, 21, 21, 21, 21, 21, 21, + 21, 1, 22, 1, 23, 1, 1, 24, + 25, 25, 25, 25, 25, 25, 25, 25, + 25, 1, 26, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 1, 22, 1, 1, + 1, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 1, 28, 28, 28, 28, + 28, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 28, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 29, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 30, 1, 1, 31, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 32, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 33, + 1, 34, 34, 34, 34, 34, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 34, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 35, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 36, 1, 1, 0, + 0, 0, 0, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 1, 1, 1, 1, 1, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 28, 28, 28, 28, 28, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 28, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 29, 1, 1, 1, + 1, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 1, 1, 1, 30, 1, + 1, 31, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 32, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 33, 1, 38, + 38, 38, 38, 38, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 38, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 39, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 40, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 41, 1, 42, 42, 42, 42, + 42, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 42, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 43, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 44, + 1, 42, 42, 42, 42, 42, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 42, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 43, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 44, 1, 38, 38, + 38, 38, 38, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 38, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 39, 1, 1, 1, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 40, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 41, 1, 45, 45, 45, 45, 45, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 45, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 46, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 47, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 48, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 49, 1, + 50, 50, 50, 50, 50, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 50, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 51, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 52, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 53, 1, 50, 50, 50, + 50, 50, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 50, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 51, + 1, 1, 1, 1, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 52, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 53, 1, 45, 45, 45, 45, 45, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 45, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 46, 1, 1, 1, + 1, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 1, 1, 1, 1, 1, + 1, 47, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 48, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 49, 1, 28, + 28, 28, 28, 28, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 28, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 29, 1, 55, 55, 1, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 1, 1, 1, 30, 1, 1, 31, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 1, 1, 32, 1, 55, 1, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 1, 33, 1, 0 }; static const char _deserialize_text_trans_targs[] = { - 1, 0, 13, 17, 26, 3, 18, 21, - 18, 21, 5, 19, 20, 19, 20, 22, - 25, 8, 9, 12, 9, 12, 10, 11, - 23, 24, 23, 24, 14, 2, 6, 7, - 15, 16, 14, 15, 16, 17, 14, 4, - 15, 16, 14, 15, 16, 14, 2, 7, + 1, 0, 13, 17, 26, 3, 18, 21, + 18, 21, 5, 19, 20, 19, 20, 22, + 25, 8, 9, 12, 9, 12, 10, 11, + 23, 24, 23, 24, 14, 2, 6, 7, + 15, 16, 14, 15, 16, 17, 14, 4, + 15, 16, 14, 15, 16, 14, 2, 7, 15, 16, 14, 2, 15, 16, 25, 26 }; static const char _deserialize_text_trans_actions[] = { - 0, 0, 1, 1, 1, 2, 2, 2, - 0, 0, 2, 2, 2, 0, 0, 2, - 2, 2, 2, 2, 0, 0, 3, 2, - 2, 2, 0, 0, 4, 5, 5, 5, - 4, 4, 0, 0, 0, 0, 6, 7, - 6, 6, 8, 8, 8, 9, 10, 10, + 0, 0, 1, 1, 1, 2, 2, 2, + 0, 0, 2, 2, 2, 0, 0, 2, + 2, 2, 2, 2, 0, 0, 3, 2, + 2, 2, 0, 0, 4, 5, 5, 5, + 4, 4, 0, 0, 0, 0, 6, 7, + 6, 6, 8, 8, 8, 9, 10, 10, 9, 9, 11, 12, 11, 11, 0, 0 }; static const char _deserialize_text_eof_actions[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 0, - 0, 4, 6, 8, 8, 6, 9, 11, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4, 0, 0, + 0, 4, 6, 8, 8, 6, 9, 11, 11, 9, 4 }; @@ -338,7 +338,7 @@ _hb_buffer_deserialize_glyphs_text (hb_buffer_t *buffer, int cs; hb_glyph_info_t info = {0}; hb_glyph_position_t pos = {0}; - + #line 343 "hb-buffer-deserialize-text.hh" { cs = deserialize_text_start; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh index 1fc2252d12c..b92b67b7e26 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-buffer-private.hh @@ -134,7 +134,7 @@ struct hb_buffer_t { #ifndef HB_NDEBUG unsigned int end = start + count; assert (end <= 8); - unsigned int bits = (1<> value_bits) != (key >> cache_bits)) return false; - *value = v & ((1<> key_bits) || (value >> value_bits))) return false; /* Overflows */ - unsigned int k = key & ((1<>cache_bits)< hb_cmap_cache_t; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc index d7b75ac1b1e..aae6351cc5f 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc @@ -57,12 +57,12 @@ _hb_options_init (void) /** * hb_tag_from_string: - * @str: (array length=len) (element-type uint8_t): - * @len: + * @str: (array length=len) (element-type uint8_t): + * @len: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -87,10 +87,10 @@ hb_tag_from_string (const char *str, int len) /** * hb_tag_to_string: - * @tag: - * @buf: (out caller-allocates) (array fixed-size=4) (element-type uint8_t): - * + * @tag: + * @buf: (out caller-allocates) (array fixed-size=4) (element-type uint8_t): * + * * * Since: 0.9.5 **/ @@ -115,12 +115,12 @@ const char direction_strings[][4] = { /** * hb_direction_from_string: - * @str: (array length=len) (element-type uint8_t): - * @len: + * @str: (array length=len) (element-type uint8_t): + * @len: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -143,11 +143,11 @@ hb_direction_from_string (const char *str, int len) /** * hb_direction_to_string: - * @direction: + * @direction: * + * * - * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -337,7 +337,7 @@ hb_language_to_string (hb_language_t language) /** * hb_language_get_default: * - * + * * * Return value: (transfer none): * @@ -366,7 +366,7 @@ hb_language_get_default (void) * * Converts an ISO 15924 script tag to a corresponding #hb_script_t. * - * Return value: + * Return value: * An #hb_script_t corresponding to the ISO 15924 tag. * * Since: 0.9.2 @@ -415,7 +415,7 @@ hb_script_from_iso15924_tag (hb_tag_t tag) * corresponding #hb_script_t. Shorthand for hb_tag_from_string() then * hb_script_from_iso15924_tag(). * - * Return value: + * Return value: * An #hb_script_t corresponding to the ISO 15924 tag. * * Since: 0.9.2 @@ -445,11 +445,11 @@ hb_script_to_iso15924_tag (hb_script_t script) /** * hb_script_get_horizontal_direction: - * @script: + * @script: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -588,13 +588,13 @@ hb_version_string (void) /** * hb_version_atleast: - * @major: - * @minor: - * @micro: + * @major: + * @minor: + * @micro: * + * * - * - * Return value: + * Return value: * * Since: 0.9.30 **/ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc index bd769a04aa8..01e3a23f2b1 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-coretext.cc @@ -145,6 +145,22 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed"); return NULL; } + + /* crbug.com/576941 and crbug.com/625902 and the investigation in the latter + * bug indicate that the cascade list reconfiguration occasionally causes + * crashes in CoreText on OS X 10.9, thus let's skip this step on older + * operating system versions. Except for the emoji font, where _not_ + * reconfiguring the cascade list causes CoreText crashes. For details, see + * crbug.com/549610 */ + // 0x00070000 stands for "kCTVersionNumber10_10", see CoreText.h + if (&CTGetCoreTextVersion != NULL && CTGetCoreTextVersion() < 0x00070000) { + CFStringRef fontName = CTFontCopyPostScriptName (ct_font); + bool isEmojiFont = CFStringCompare (fontName, CFSTR("AppleColorEmoji"), 0) == kCFCompareEqualTo; + CFRelease (fontName); + if (!isEmojiFont) + return ct_font; + } + CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttribute); /* Create font copy with cascade list that has LastResort first; this speeds up CoreText @@ -272,7 +288,9 @@ struct hb_coretext_shaper_shape_plan_data_t {}; hb_coretext_shaper_shape_plan_data_t * _hb_coretext_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan HB_UNUSED, const hb_feature_t *user_features HB_UNUSED, - unsigned int num_user_features HB_UNUSED) + unsigned int num_user_features HB_UNUSED, + const int *coords HB_UNUSED, + unsigned int num_coords HB_UNUSED) { return (hb_coretext_shaper_shape_plan_data_t *) HB_SHAPER_DATA_SUCCEEDED; } @@ -717,7 +735,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, pchars[chars_len++] = 0xFFFDu; else { pchars[chars_len++] = 0xD800u + ((c - 0x10000u) >> 10); - pchars[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1 << 10) - 1)); + pchars[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1u << 10) - 1)); } } @@ -1264,7 +1282,9 @@ struct hb_coretext_aat_shaper_shape_plan_data_t {}; hb_coretext_aat_shaper_shape_plan_data_t * _hb_coretext_aat_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan HB_UNUSED, const hb_feature_t *user_features HB_UNUSED, - unsigned int num_user_features HB_UNUSED) + unsigned int num_user_features HB_UNUSED, + const int *coords HB_UNUSED, + unsigned int num_coords HB_UNUSED) { return (hb_coretext_aat_shaper_shape_plan_data_t *) HB_SHAPER_DATA_SUCCEEDED; } diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.cc index b5019a122de..bb6673cdf2b 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-face.cc @@ -35,8 +35,6 @@ #include "hb-ot-head-table.hh" #include "hb-ot-maxp-table.hh" -#include "hb-cache-private.hh" - #include @@ -70,10 +68,10 @@ const hb_face_t _hb_face_nil = { /** * hb_face_create_for_tables: * @reference_table_func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: - * + * @user_data: + * @destroy: * + * * * Return value: (transfer full) * @@ -150,10 +148,10 @@ _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void /** * hb_face_create: (Xconstructor) - * @blob: - * @index: - * + * @blob: + * @index: * + * * * Return value: (transfer full): * @@ -185,7 +183,7 @@ hb_face_create (hb_blob_t *blob, /** * hb_face_get_empty: * - * + * * * Return value: (transfer full) * @@ -202,9 +200,9 @@ hb_face_get_empty (void) * hb_face_reference: (skip) * @face: a face. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -218,7 +216,7 @@ hb_face_reference (hb_face_t *face) * hb_face_destroy: (skip) * @face: a face. * - * + * * * Since: 0.9.2 **/ @@ -248,14 +246,14 @@ hb_face_destroy (hb_face_t *face) /** * hb_face_set_user_data: (skip) * @face: a face. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -272,9 +270,9 @@ hb_face_set_user_data (hb_face_t *face, /** * hb_face_get_user_data: (skip) * @face: a face. - * @key: - * + * @key: * + * * * Return value: (transfer none): * @@ -291,7 +289,7 @@ hb_face_get_user_data (hb_face_t *face, * hb_face_make_immutable: * @face: a face. * - * + * * * Since: 0.9.2 **/ @@ -308,9 +306,9 @@ hb_face_make_immutable (hb_face_t *face) * hb_face_is_immutable: * @face: a face. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -324,9 +322,9 @@ hb_face_is_immutable (hb_face_t *face) /** * hb_face_reference_table: * @face: a face. - * @tag: - * + * @tag: * + * * * Return value: (transfer full): * @@ -343,7 +341,7 @@ hb_face_reference_table (hb_face_t *face, * hb_face_reference_blob: * @face: a face. * - * + * * * Return value: (transfer full): * @@ -358,9 +356,9 @@ hb_face_reference_blob (hb_face_t *face) /** * hb_face_set_index: * @face: a face. - * @index: - * + * @index: * + * * * Since: 0.9.2 **/ @@ -378,9 +376,9 @@ hb_face_set_index (hb_face_t *face, * hb_face_get_index: * @face: a face. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -393,9 +391,9 @@ hb_face_get_index (hb_face_t *face) /** * hb_face_set_upem: * @face: a face. - * @upem: - * + * @upem: * + * * * Since: 0.9.2 **/ @@ -413,9 +411,9 @@ hb_face_set_upem (hb_face_t *face, * hb_face_get_upem: * @face: a face. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -437,9 +435,9 @@ hb_face_t::load_upem (void) const /** * hb_face_set_glyph_count: * @face: a face. - * @glyph_count: - * + * @glyph_count: * + * * * Since: 0.9.7 **/ @@ -457,9 +455,9 @@ hb_face_set_glyph_count (hb_face_t *face, * hb_face_get_glyph_count: * @face: a face. * + * * - * - * Return value: + * Return value: * * Since: 0.9.7 **/ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc index dee7d7d12eb..9f40c911c5f 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-fallback-shape.cc @@ -73,7 +73,9 @@ struct hb_fallback_shaper_shape_plan_data_t {}; hb_fallback_shaper_shape_plan_data_t * _hb_fallback_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan HB_UNUSED, const hb_feature_t *user_features HB_UNUSED, - unsigned int num_user_features HB_UNUSED) + unsigned int num_user_features HB_UNUSED, + const int *coords HB_UNUSED, + unsigned int num_coords HB_UNUSED) { return (hb_fallback_shaper_shape_plan_data_t *) HB_SHAPER_DATA_SUCCEEDED; } diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh index d7b48776e1e..9254cd0f4e5 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font-private.hh @@ -108,6 +108,10 @@ struct hb_font_t { unsigned int x_ppem; unsigned int y_ppem; + /* Font variation coordinates. */ + unsigned int num_coords; + int *coords; + hb_font_funcs_t *klass; void *user_data; hb_destroy_func_t destroy; @@ -116,8 +120,14 @@ struct hb_font_t { /* Convert from font-space to user-space */ - inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, this->x_scale); } - inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, this->y_scale); } + inline int dir_scale (hb_direction_t direction) + { return HB_DIRECTION_IS_VERTICAL(direction) ? y_scale : x_scale; } + inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); } + inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); } + inline hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scale); } + inline hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scale); } + inline hb_position_t em_scale_dir (int16_t v, hb_direction_t direction) + { return em_scale (v, dir_scale (direction)); } /* Convert from parent-font user-space to our user-space */ inline hb_position_t parent_scale_x_distance (hb_position_t v) { @@ -292,24 +302,32 @@ struct hb_font_t { /* A bit higher-level, and with fallback */ + inline void get_h_extents_with_fallback (hb_font_extents_t *extents) + { + if (!get_font_h_extents (extents)) + { + extents->ascender = y_scale * .8; + extents->descender = extents->ascender - y_scale; + extents->line_gap = 0; + } + } + inline void get_v_extents_with_fallback (hb_font_extents_t *extents) + { + if (!get_font_v_extents (extents)) + { + extents->ascender = x_scale / 2; + extents->descender = extents->ascender - x_scale; + extents->line_gap = 0; + } + } + inline void get_extents_for_direction (hb_direction_t direction, hb_font_extents_t *extents) { - if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) { - if (!get_font_h_extents (extents)) - { - extents->ascender = y_scale * .8; - extents->descender = y_scale - extents->ascender; - extents->line_gap = 0; - } - } else { - if (!get_font_v_extents (extents)) - { - extents->ascender = x_scale / 2; - extents->descender = x_scale - extents->ascender; - extents->line_gap = 0; - } - } + if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) + get_h_extents_with_fallback (extents); + else + get_v_extents_with_fallback (extents); } inline void get_glyph_advance_for_direction (hb_codepoint_t glyph, @@ -325,14 +343,38 @@ struct hb_font_t { } } - /* Internal only */ inline void guess_v_origin_minus_h_origin (hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y) { *x = get_glyph_h_advance (glyph) / 2; - /* TODO use font_extents.ascender */ - *y = y_scale; + /* TODO cache this somehow?! */ + hb_font_extents_t extents; + get_h_extents_with_fallback (&extents); + *y = extents.ascender; + } + + inline void get_glyph_h_origin_with_fallback (hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y) + { + if (!get_glyph_h_origin (glyph, x, y) && + get_glyph_v_origin (glyph, x, y)) + { + hb_position_t dx, dy; + guess_v_origin_minus_h_origin (glyph, &dx, &dy); + *x -= dx; *y -= dy; + } + } + inline void get_glyph_v_origin_with_fallback (hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y) + { + if (!get_glyph_v_origin (glyph, x, y) && + get_glyph_h_origin (glyph, x, y)) + { + hb_position_t dx, dy; + guess_v_origin_minus_h_origin (glyph, &dx, &dy); + *x += dx; *y += dy; + } } inline void get_glyph_origin_for_direction (hb_codepoint_t glyph, @@ -340,25 +382,9 @@ struct hb_font_t { hb_position_t *x, hb_position_t *y) { if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) - { - if (!get_glyph_h_origin (glyph, x, y) && - get_glyph_v_origin (glyph, x, y)) - { - hb_position_t dx, dy; - guess_v_origin_minus_h_origin (glyph, &dx, &dy); - *x -= dx; *y -= dy; - } - } + get_glyph_h_origin_with_fallback (glyph, x, y); else - { - if (!get_glyph_v_origin (glyph, x, y) && - get_glyph_h_origin (glyph, x, y)) - { - hb_position_t dx, dy; - guess_v_origin_minus_h_origin (glyph, &dx, &dy); - *x += dx; *y += dy; - } - } + get_glyph_v_origin_with_fallback (glyph, x, y); } inline void add_glyph_h_origin (hb_codepoint_t glyph, @@ -366,7 +392,7 @@ struct hb_font_t { { hb_position_t origin_x, origin_y; - get_glyph_h_origin (glyph, &origin_x, &origin_y); + get_glyph_h_origin_with_fallback (glyph, &origin_x, &origin_y); *x += origin_x; *y += origin_y; @@ -376,7 +402,7 @@ struct hb_font_t { { hb_position_t origin_x, origin_y; - get_glyph_v_origin (glyph, &origin_x, &origin_y); + get_glyph_v_origin_with_fallback (glyph, &origin_x, &origin_y); *x += origin_x; *y += origin_y; @@ -398,7 +424,7 @@ struct hb_font_t { { hb_position_t origin_x, origin_y; - get_glyph_h_origin (glyph, &origin_x, &origin_y); + get_glyph_h_origin_with_fallback (glyph, &origin_x, &origin_y); *x -= origin_x; *y -= origin_y; @@ -408,7 +434,7 @@ struct hb_font_t { { hb_position_t origin_x, origin_y; - get_glyph_v_origin (glyph, &origin_x, &origin_y); + get_glyph_v_origin_with_fallback (glyph, &origin_x, &origin_y); *x -= origin_x; *y -= origin_y; @@ -504,7 +530,6 @@ struct hb_font_t { return false; } - private: inline hb_position_t em_scale (int16_t v, int scale) { int upem = face->get_upem (); @@ -512,6 +537,10 @@ struct hb_font_t { scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */ return (hb_position_t) (scaled / upem); } + inline hb_position_t em_scalef (float v, int scale) + { + return (hb_position_t) (v * scale / face->get_upem ()); + } }; #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc index eb0f9fcfd09..b81c46e51d1 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.cc @@ -35,8 +35,6 @@ #include "hb-ot-head-table.hh" #include "hb-ot-maxp-table.hh" -#include "hb-cache-private.hh" - #include @@ -401,9 +399,9 @@ static const hb_font_funcs_t _hb_font_funcs_parent = { /** * hb_font_funcs_create: (Xconstructor) * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -423,9 +421,9 @@ hb_font_funcs_create (void) /** * hb_font_funcs_get_empty: * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -439,9 +437,9 @@ hb_font_funcs_get_empty (void) * hb_font_funcs_reference: (skip) * @ffuncs: font functions. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -455,7 +453,7 @@ hb_font_funcs_reference (hb_font_funcs_t *ffuncs) * hb_font_funcs_destroy: (skip) * @ffuncs: font functions. * - * + * * * Since: 0.9.2 **/ @@ -475,14 +473,14 @@ hb_font_funcs_destroy (hb_font_funcs_t *ffuncs) /** * hb_font_funcs_set_user_data: (skip) * @ffuncs: font functions. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -499,11 +497,11 @@ hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs, /** * hb_font_funcs_get_user_data: (skip) * @ffuncs: font functions. - * @key: + * @key: * + * * - * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -519,7 +517,7 @@ hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs, * hb_font_funcs_make_immutable: * @ffuncs: font functions. * - * + * * * Since: 0.9.2 **/ @@ -536,9 +534,9 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs) * hb_font_funcs_is_immutable: * @ffuncs: font functions. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -629,13 +627,13 @@ hb_font_get_v_extents (hb_font_t *font, /** * hb_font_get_glyph: * @font: a font. - * @unicode: - * @variation_selector: - * @glyph: (out): + * @unicode: + * @variation_selector: + * @glyph: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -652,12 +650,12 @@ hb_font_get_glyph (hb_font_t *font, /** * hb_font_get_nominal_glyph: * @font: a font. - * @unicode: - * @glyph: (out): + * @unicode: + * @glyph: (out): * + * * - * - * Return value: + * Return value: * * Since: 1.2.3 **/ @@ -672,13 +670,13 @@ hb_font_get_nominal_glyph (hb_font_t *font, /** * hb_font_get_variation_glyph: * @font: a font. - * @unicode: - * @variation_selector: - * @glyph: (out): + * @unicode: + * @variation_selector: + * @glyph: (out): * + * * - * - * Return value: + * Return value: * * Since: 1.2.3 **/ @@ -693,11 +691,11 @@ hb_font_get_variation_glyph (hb_font_t *font, /** * hb_font_get_glyph_h_advance: * @font: a font. - * @glyph: + * @glyph: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -711,11 +709,11 @@ hb_font_get_glyph_h_advance (hb_font_t *font, /** * hb_font_get_glyph_v_advance: * @font: a font. - * @glyph: + * @glyph: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -729,13 +727,13 @@ hb_font_get_glyph_v_advance (hb_font_t *font, /** * hb_font_get_glyph_h_origin: * @font: a font. - * @glyph: - * @x: (out): - * @y: (out): + * @glyph: + * @x: (out): + * @y: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -750,13 +748,13 @@ hb_font_get_glyph_h_origin (hb_font_t *font, /** * hb_font_get_glyph_v_origin: * @font: a font. - * @glyph: - * @x: (out): - * @y: (out): + * @glyph: + * @x: (out): + * @y: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -771,12 +769,12 @@ hb_font_get_glyph_v_origin (hb_font_t *font, /** * hb_font_get_glyph_h_kerning: * @font: a font. - * @left_glyph: - * @right_glyph: + * @left_glyph: + * @right_glyph: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -790,12 +788,12 @@ hb_font_get_glyph_h_kerning (hb_font_t *font, /** * hb_font_get_glyph_v_kerning: * @font: a font. - * @top_glyph: - * @bottom_glyph: + * @top_glyph: + * @bottom_glyph: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -809,12 +807,12 @@ hb_font_get_glyph_v_kerning (hb_font_t *font, /** * hb_font_get_glyph_extents: * @font: a font. - * @glyph: - * @extents: (out): + * @glyph: + * @extents: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -829,14 +827,14 @@ hb_font_get_glyph_extents (hb_font_t *font, /** * hb_font_get_glyph_contour_point: * @font: a font. - * @glyph: - * @point_index: - * @x: (out): - * @y: (out): + * @glyph: + * @point_index: + * @x: (out): + * @y: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -851,13 +849,13 @@ hb_font_get_glyph_contour_point (hb_font_t *font, /** * hb_font_get_glyph_name: * @font: a font. - * @glyph: - * @name: (array length=size): - * @size: + * @glyph: + * @name: (array length=size): + * @size: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -872,13 +870,13 @@ hb_font_get_glyph_name (hb_font_t *font, /** * hb_font_get_glyph_from_name: * @font: a font. - * @name: (array length=len): - * @len: - * @glyph: (out): + * @name: (array length=len): + * @len: + * @glyph: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -913,12 +911,12 @@ hb_font_get_extents_for_direction (hb_font_t *font, /** * hb_font_get_glyph_advance_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): - * + * @glyph: + * @direction: + * @x: (out): + * @y: (out): * + * * * Since: 0.9.2 **/ @@ -934,12 +932,12 @@ hb_font_get_glyph_advance_for_direction (hb_font_t *font, /** * hb_font_get_glyph_origin_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): - * + * @glyph: + * @direction: + * @x: (out): + * @y: (out): * + * * * Since: 0.9.2 **/ @@ -955,12 +953,12 @@ hb_font_get_glyph_origin_for_direction (hb_font_t *font, /** * hb_font_add_glyph_origin_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): - * + * @glyph: + * @direction: + * @x: (out): + * @y: (out): * + * * * Since: 0.9.2 **/ @@ -976,12 +974,12 @@ hb_font_add_glyph_origin_for_direction (hb_font_t *font, /** * hb_font_subtract_glyph_origin_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): - * + * @glyph: + * @direction: + * @x: (out): + * @y: (out): * + * * * Since: 0.9.2 **/ @@ -997,13 +995,13 @@ hb_font_subtract_glyph_origin_for_direction (hb_font_t *font, /** * hb_font_get_glyph_kerning_for_direction: * @font: a font. - * @first_glyph: - * @second_glyph: - * @direction: - * @x: (out): - * @y: (out): - * + * @first_glyph: + * @second_glyph: + * @direction: + * @x: (out): + * @y: (out): * + * * * Since: 0.9.2 **/ @@ -1019,13 +1017,13 @@ hb_font_get_glyph_kerning_for_direction (hb_font_t *font, /** * hb_font_get_glyph_extents_for_origin: * @font: a font. - * @glyph: - * @direction: - * @extents: (out): + * @glyph: + * @direction: + * @extents: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1041,15 +1039,15 @@ hb_font_get_glyph_extents_for_origin (hb_font_t *font, /** * hb_font_get_glyph_contour_point_for_origin: * @font: a font. - * @glyph: - * @point_index: - * @direction: - * @x: (out): - * @y: (out): + * @glyph: + * @point_index: + * @direction: + * @x: (out): + * @y: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1066,11 +1064,11 @@ hb_font_get_glyph_contour_point_for_origin (hb_font_t *font, /** * hb_font_glyph_to_string: * @font: a font. - * @glyph: - * @s: (array length=size): - * @size: - * + * @glyph: + * @s: (array length=size): + * @size: * + * * * Since: 0.9.2 **/ @@ -1086,13 +1084,13 @@ hb_font_glyph_to_string (hb_font_t *font, /** * hb_font_glyph_from_string: * @font: a font. - * @s: (array length=len) (element-type uint8_t): - * @len: - * @glyph: (out): + * @s: (array length=len) (element-type uint8_t): + * @len: + * @glyph: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1113,9 +1111,9 @@ hb_font_glyph_from_string (hb_font_t *font, * hb_font_create: (Xconstructor) * @face: a face. * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -1143,9 +1141,9 @@ hb_font_create (hb_face_t *face) * hb_font_create_sub_font: * @parent: parent font. * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -1167,13 +1165,15 @@ hb_font_create_sub_font (hb_font_t *parent) font->x_ppem = parent->x_ppem; font->y_ppem = parent->y_ppem; + /* TODO: copy variation coordinates. */ + return font; } /** * hb_font_get_empty: * - * + * * * Return value: (transfer full) * @@ -1196,6 +1196,9 @@ hb_font_get_empty (void) 0, /* x_ppem */ 0, /* y_ppem */ + 0, /* num_coords */ + NULL, /* coords */ + const_cast (&_hb_font_funcs_nil), /* klass */ NULL, /* user_data */ NULL, /* destroy */ @@ -1214,9 +1217,9 @@ hb_font_get_empty (void) * hb_font_reference: (skip) * @font: a font. * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -1230,7 +1233,7 @@ hb_font_reference (hb_font_t *font) * hb_font_destroy: (skip) * @font: a font. * - * + * * * Since: 0.9.2 **/ @@ -1250,20 +1253,22 @@ hb_font_destroy (hb_font_t *font) hb_face_destroy (font->face); hb_font_funcs_destroy (font->klass); + free (font->coords); + free (font); } /** * hb_font_set_user_data: (skip) * @font: a font. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1280,11 +1285,11 @@ hb_font_set_user_data (hb_font_t *font, /** * hb_font_get_user_data: (skip) * @font: a font. - * @key: + * @key: * + * * - * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -1299,7 +1304,7 @@ hb_font_get_user_data (hb_font_t *font, * hb_font_make_immutable: * @font: a font. * - * + * * * Since: 0.9.2 **/ @@ -1319,9 +1324,9 @@ hb_font_make_immutable (hb_font_t *font) * hb_font_is_immutable: * @font: a font. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1361,9 +1366,9 @@ hb_font_set_parent (hb_font_t *font, * hb_font_get_parent: * @font: a font. * + * * - * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -1377,9 +1382,9 @@ hb_font_get_parent (hb_font_t *font) * hb_font_get_face: * @font: a font. * + * * - * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -1394,10 +1399,10 @@ hb_font_get_face (hb_font_t *font) * hb_font_set_funcs: * @font: a font. * @klass: (closure font_data) (destroy destroy) (scope notified): - * @font_data: - * @destroy: - * + * @font_data: + * @destroy: * + * * * Since: 0.9.2 **/ @@ -1430,9 +1435,9 @@ hb_font_set_funcs (hb_font_t *font, * hb_font_set_funcs_data: * @font: a font. * @font_data: (destroy destroy) (scope notified): - * @destroy: - * + * @destroy: * + * * * Since: 0.9.2 **/ @@ -1459,10 +1464,10 @@ hb_font_set_funcs_data (hb_font_t *font, /** * hb_font_set_scale: * @font: a font. - * @x_scale: - * @y_scale: - * + * @x_scale: + * @y_scale: * + * * * Since: 0.9.2 **/ @@ -1481,10 +1486,10 @@ hb_font_set_scale (hb_font_t *font, /** * hb_font_get_scale: * @font: a font. - * @x_scale: (out): - * @y_scale: (out): - * + * @x_scale: (out): + * @y_scale: (out): * + * * * Since: 0.9.2 **/ @@ -1500,10 +1505,10 @@ hb_font_get_scale (hb_font_t *font, /** * hb_font_set_ppem: * @font: a font. - * @x_ppem: - * @y_ppem: - * + * @x_ppem: + * @y_ppem: * + * * * Since: 0.9.2 **/ @@ -1522,10 +1527,10 @@ hb_font_set_ppem (hb_font_t *font, /** * hb_font_get_ppem: * @font: a font. - * @x_ppem: (out): - * @y_ppem: (out): - * + * @x_ppem: (out): + * @y_ppem: (out): * + * * * Since: 0.9.2 **/ @@ -1539,6 +1544,32 @@ hb_font_get_ppem (hb_font_t *font, } +void +hb_font_set_var_coords_normalized (hb_font_t *font, + int *coords, /* XXX 2.14 normalized */ + unsigned int coords_length) +{ + if (font->immutable) + return; + + /* Skip tail zero entries. */ + while (coords_length && !coords[coords_length - 1]) + coords_length--; + + int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : NULL; + if (unlikely (coords_length && !copy)) + return; + + free (font->coords); + + if (coords_length) + memcpy (copy, coords, coords_length * sizeof (coords[0])); + + font->coords = copy; + font->num_coords = coords_length; +} + + #ifndef HB_DISABLE_DEPRECATED /* diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h index da9a3a7543c..ff5d88f642c 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-font.h @@ -604,6 +604,11 @@ hb_font_get_ppem (hb_font_t *font, unsigned int *y_ppem); +HB_EXTERN void +hb_font_set_var_coords_normalized (hb_font_t *font, + int *coords, /* XXX 2.14 normalized */ + unsigned int coords_length); + HB_END_DECLS #endif /* HB_FONT_H */ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc index fb3c1dfbcf0..fda781623fd 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ft.cc @@ -33,7 +33,10 @@ #include "hb-font-private.hh" +#include "hb-cache-private.hh" // Maybe use in the future? + #include FT_ADVANCES_H +#include FT_MULTIPLE_MASTERS_H #include FT_TRUETYPE_TABLES_H @@ -111,7 +114,7 @@ _hb_ft_font_destroy (hb_ft_font_t *ft_font) * @font: * @load_flags: * - * + * * * Since: 1.0.5 **/ @@ -133,7 +136,7 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags) * hb_ft_font_get_load_flags: * @font: * - * + * * * Return value: * Since: 1.0.5 @@ -504,12 +507,12 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) /** * hb_ft_face_create: - * @ft_face: (destroy destroy) (scope notified): + * @ft_face: (destroy destroy) (scope notified): * @destroy: * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * Since: 0.9.2 **/ hb_face_t * @@ -541,9 +544,9 @@ hb_ft_face_create (FT_Face ft_face, * hb_ft_face_create_referenced: * @ft_face: * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * Since: 0.9.38 **/ hb_face_t * @@ -561,11 +564,11 @@ hb_ft_face_finalize (FT_Face ft_face) /** * hb_ft_face_create_cached: - * @ft_face: + * @ft_face: * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * Since: 0.9.2 **/ hb_face_t * @@ -586,12 +589,12 @@ hb_ft_face_create_cached (FT_Face ft_face) /** * hb_ft_font_create: - * @ft_face: (destroy destroy) (scope notified): + * @ft_face: (destroy destroy) (scope notified): * @destroy: * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * Since: 0.9.2 **/ hb_font_t * @@ -606,14 +609,31 @@ hb_ft_font_create (FT_Face ft_face, hb_face_destroy (face); _hb_ft_font_set_funcs (font, ft_face, false); hb_font_set_scale (font, - (int) (((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16), - (int) (((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16)); + (int) (((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM + (1u<<15)) >> 16), + (int) (((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM + (1u<<15)) >> 16)); #if 0 /* hb-ft works in no-hinting model */ hb_font_set_ppem (font, ft_face->size->metrics.x_ppem, ft_face->size->metrics.y_ppem); #endif +#ifdef HAVE_FT_GET_VAR_BLEND_COORDINATES + FT_MM_Var *mm_var = NULL; + if (!FT_Get_MM_Var (ft_face, &mm_var)) + { + FT_Fixed coords[mm_var->num_axis]; + int hbCoords[mm_var->num_axis]; + if (!FT_Get_Var_Blend_Coordinates (ft_face, mm_var->num_axis, coords)) + { + for (int i = 0; i < mm_var->num_axis; ++i) + hbCoords[i] = coords[i] >> 2; + + hb_font_set_var_coords_normalized (font, hbCoords, mm_var->num_axis); + } + } + free (mm_var); +#endif + return font; } @@ -621,9 +641,9 @@ hb_ft_font_create (FT_Face ft_face, * hb_ft_font_create_referenced: * @ft_face: * + * * - * - * Return value: (transfer full): + * Return value: (transfer full): * Since: 0.9.38 **/ hb_font_t * diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh index 27c5f1703cd..15e927dcd8f 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-open-type-private.hh @@ -105,7 +105,7 @@ static inline Type& StructAfter(TObject &X) inline unsigned int get_size (void) const { return (size); } #define DEFINE_SIZE_UNION(size, _member) \ - DEFINE_INSTANCE_ASSERTION (this->u._member.static_size == (size)); \ + DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + sizeof(this->u._member) == (size)); \ static const unsigned int min_size = (size) #define DEFINE_SIZE_MIN(size) \ @@ -650,7 +650,9 @@ struct IntType DEFINE_SIZE_STATIC (Size); }; +typedef IntType CHAR; /* 8-bit signed integer. */ typedef IntType BYTE; /* 8-bit unsigned integer. */ +typedef IntType INT8; /* 8-bit signed integer. */ typedef IntType USHORT; /* 16-bit unsigned integer. */ typedef IntType SHORT; /* 16-bit signed integer. */ typedef IntType ULONG; /* 32-bit unsigned integer. */ @@ -805,6 +807,7 @@ struct OffsetTo : Offset if (unlikely (!c->check_struct (this))) return_trace (false); unsigned int offset = *this; if (unlikely (!offset)) return_trace (true); + if (unlikely (!c->check_range (base, offset))) return_trace (false); const Type &obj = StructAtOffset (base, offset); return_trace (likely (obj.sanitize (c)) || neuter (c)); } @@ -815,6 +818,7 @@ struct OffsetTo : Offset if (unlikely (!c->check_struct (this))) return_trace (false); unsigned int offset = *this; if (unlikely (!offset)) return_trace (true); + if (unlikely (!c->check_range (base, offset))) return_trace (false); const Type &obj = StructAtOffset (base, offset); return_trace (likely (obj.sanitize (c, user_data)) || neuter (c)); } @@ -948,8 +952,8 @@ struct ArrayOf }; /* Array of Offset's */ -template -struct OffsetArrayOf : ArrayOf > {}; +template +struct OffsetArrayOf : ArrayOf > {}; /* Array of offsets relative to the beginning of the array itself. */ template diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cbdt-table.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cbdt-table.hh new file mode 100644 index 00000000000..52897abd3a3 --- /dev/null +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-cbdt-table.hh @@ -0,0 +1,384 @@ +/* + * Copyright © 2016 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Seigo Nonaka + */ + +#ifndef HB_OT_CBDT_TABLE_HH +#define HB_OT_CBDT_TABLE_HH + +#include "hb-open-type-private.hh" + +namespace OT { + +struct SmallGlyphMetrics +{ + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + inline void get_extents (hb_glyph_extents_t *extents) const + { + extents->x_bearing = bearingX; + extents->y_bearing = bearingY; + extents->width = width; + extents->height = -height; + } + + BYTE height; + BYTE width; + CHAR bearingX; + CHAR bearingY; + BYTE advance; + + DEFINE_SIZE_STATIC(5); +}; + +struct BigGlyphMetrics : SmallGlyphMetrics +{ + CHAR vertBearingX; + CHAR vertBearingY; + BYTE vertAdvance; + + DEFINE_SIZE_STATIC(8); +}; + +struct SBitLineMetrics +{ + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + CHAR ascender; + CHAR decender; + BYTE widthMax; + CHAR caretSlopeNumerator; + CHAR caretSlopeDenominator; + CHAR caretOffset; + CHAR minOriginSB; + CHAR minAdvanceSB; + CHAR maxBeforeBL; + CHAR minAfterBL; + CHAR padding1; + CHAR padding2; + + DEFINE_SIZE_STATIC(12); +}; + + +/* + * Index Subtables. + */ + +struct IndexSubtableHeader +{ + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + USHORT indexFormat; + USHORT imageFormat; + ULONG imageDataOffset; + + DEFINE_SIZE_STATIC(8); +}; + +template +struct IndexSubtableFormat1Or3 +{ + inline bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + c->check_array (offsetArrayZ, offsetArrayZ[0].static_size, glyph_count + 1)); + } + + bool get_image_data (unsigned int idx, + unsigned int *offset, + unsigned int *length) const + { + if (unlikely (offsetArrayZ[idx + 1] <= offsetArrayZ[idx])) + return false; + + *offset = header.imageDataOffset + offsetArrayZ[idx]; + *length = offsetArrayZ[idx + 1] - offsetArrayZ[idx]; + return true; + } + + IndexSubtableHeader header; + Offset offsetArrayZ[VAR]; + + DEFINE_SIZE_ARRAY(8, offsetArrayZ); +}; + +struct IndexSubtableFormat1 : IndexSubtableFormat1Or3 {}; +struct IndexSubtableFormat3 : IndexSubtableFormat1Or3 {}; + +struct IndexSubtable +{ + inline bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const + { + TRACE_SANITIZE (this); + if (!u.header.sanitize (c)) return_trace (false); + switch (u.header.indexFormat) { + case 1: return_trace (u.format1.sanitize (c, glyph_count)); + case 3: return_trace (u.format3.sanitize (c, glyph_count)); + default:return_trace (true); + } + } + + inline bool get_extents (hb_glyph_extents_t *extents) const + { + switch (u.header.indexFormat) { + case 2: case 5: /* TODO */ + case 1: case 3: case 4: /* Variable-metrics formats do not have metrics here. */ + default:return (false); + } + } + + bool get_image_data (unsigned int idx, + unsigned int *offset, + unsigned int *length, + unsigned int *format) const + { + *format = u.header.imageFormat; + switch (u.header.indexFormat) { + case 1: return u.format1.get_image_data (idx, offset, length); + case 3: return u.format3.get_image_data (idx, offset, length); + default: return false; + } + } + + protected: + union { + IndexSubtableHeader header; + IndexSubtableFormat1 format1; + IndexSubtableFormat3 format3; + /* TODO: Format 2, 4, 5. */ + } u; + public: + DEFINE_SIZE_UNION (8, header); +}; + +struct IndexSubtableRecord +{ + inline bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + firstGlyphIndex <= lastGlyphIndex && + offsetToSubtable.sanitize (c, this, lastGlyphIndex - firstGlyphIndex + 1)); + } + + inline bool get_extents (hb_glyph_extents_t *extents) const + { + return (this+offsetToSubtable).get_extents (extents); + } + + bool get_image_data (unsigned int gid, + unsigned int *offset, + unsigned int *length, + unsigned int *format) const + { + if (gid < firstGlyphIndex || gid > lastGlyphIndex) + { + return false; + } + return (this+offsetToSubtable).get_image_data (gid - firstGlyphIndex, + offset, length, format); + } + + USHORT firstGlyphIndex; + USHORT lastGlyphIndex; + OffsetTo offsetToSubtable; + + DEFINE_SIZE_STATIC(8); +}; + +struct IndexSubtableArray +{ + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const + { + TRACE_SANITIZE (this); + if (unlikely (!c->check_array (&indexSubtablesZ, indexSubtablesZ[0].static_size, count))) + return_trace (false); + for (unsigned int i = 0; i < count; i++) + if (unlikely (!indexSubtablesZ[i].sanitize (c, this))) + return_trace (false); + return_trace (true); + } + + public: + const IndexSubtableRecord* find_table (hb_codepoint_t glyph, unsigned int numTables) const + { + for (unsigned int i = 0; i < numTables; ++i) + { + unsigned int firstGlyphIndex = indexSubtablesZ[i].firstGlyphIndex; + unsigned int lastGlyphIndex = indexSubtablesZ[i].lastGlyphIndex; + if (firstGlyphIndex <= glyph && glyph <= lastGlyphIndex) { + return &indexSubtablesZ[i]; + } + } + return NULL; + } + + protected: + IndexSubtableRecord indexSubtablesZ[VAR]; + + public: + DEFINE_SIZE_ARRAY(0, indexSubtablesZ); +}; + +struct BitmapSizeTable +{ + friend struct CBLC; + + inline bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + indexSubtableArrayOffset.sanitize (c, base, numberOfIndexSubtables) && + c->check_range (&(base+indexSubtableArrayOffset), indexTablesSize) && + horizontal.sanitize (c) && + vertical.sanitize (c)); + } + + const IndexSubtableRecord *find_table (hb_codepoint_t glyph, const void *base) const + { + return (base+indexSubtableArrayOffset).find_table (glyph, numberOfIndexSubtables); + } + + protected: + OffsetTo indexSubtableArrayOffset; + ULONG indexTablesSize; + ULONG numberOfIndexSubtables; + ULONG colorRef; + SBitLineMetrics horizontal; + SBitLineMetrics vertical; + USHORT startGlyphIndex; + USHORT endGlyphIndex; + BYTE ppemX; + BYTE ppemY; + BYTE bitDepth; + CHAR flags; + +public: + DEFINE_SIZE_STATIC(48); +}; + + +/* + * Glyph Bitmap Data Formats. + */ + +struct GlyphBitmapDataFormat17 +{ + SmallGlyphMetrics glyphMetrics; + ULONG dataLen; + BYTE dataZ[VAR]; + + DEFINE_SIZE_ARRAY(9, dataZ); +}; + + +/* + * CBLC -- Color Bitmap Location Table + */ + +#define HB_OT_TAG_CBLC HB_TAG('C','B','L','C') + +struct CBLC +{ + static const hb_tag_t tableTag = HB_OT_TAG_CBLC; + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + likely (version.major == 2 || version.major == 3) && + sizeTables.sanitize (c, this)); + } + + public: + const IndexSubtableRecord *find_table (hb_codepoint_t glyph, + unsigned int *x_ppem, unsigned int *y_ppem) const + { + /* TODO: Make it possible to select strike. */ + + unsigned int count = sizeTables.len; + for (uint32_t i = 0; i < count; ++i) + { + unsigned int startGlyphIndex = sizeTables.array[i].startGlyphIndex; + unsigned int endGlyphIndex = sizeTables.array[i].endGlyphIndex; + if (startGlyphIndex <= glyph && glyph <= endGlyphIndex) + { + *x_ppem = sizeTables[i].ppemX; + *y_ppem = sizeTables[i].ppemY; + return sizeTables[i].find_table (glyph, this); + } + } + + return NULL; + } + + protected: + FixedVersion<>version; + ArrayOf sizeTables; + + public: + DEFINE_SIZE_ARRAY(8, sizeTables); +}; + +/* + * CBDT -- Color Bitmap Data Table + */ +#define HB_OT_TAG_CBDT HB_TAG('C','B','D','T') + +struct CBDT +{ + static const hb_tag_t tableTag = HB_OT_TAG_CBDT; + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + likely (version.major == 2 || version.major == 3)); + } + + protected: + FixedVersion<>version; + BYTE dataZ[VAR]; + + public: + DEFINE_SIZE_ARRAY(4, dataZ); +}; + +} /* namespace OT */ + +#endif /* HB_OT_CBDT_TABLE_HH */ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc index 3c63f336a6b..3b3122b69a3 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-font.cc @@ -31,6 +31,7 @@ #include "hb-font-private.hh" #include "hb-ot-cmap-table.hh" +#include "hb-ot-cbdt-table.hh" #include "hb-ot-glyf-table.hh" #include "hb-ot-head-table.hh" #include "hb-ot-hhea-table.hh" @@ -47,6 +48,7 @@ struct hb_ot_face_metrics_accelerator_t unsigned short ascender; unsigned short descender; unsigned short line_gap; + bool has_font_extents; const OT::_mtx *table; hb_blob_t *blob; @@ -54,9 +56,10 @@ struct hb_ot_face_metrics_accelerator_t inline void init (hb_face_t *face, hb_tag_t _hea_tag, hb_tag_t _mtx_tag, - hb_tag_t os2_tag) + hb_tag_t os2_tag, + unsigned int default_advance = 0) { - this->default_advance = face->get_upem (); + this->default_advance = default_advance ? default_advance : face->get_upem (); bool got_font_extents = false; if (os2_tag) @@ -82,9 +85,12 @@ struct hb_ot_face_metrics_accelerator_t this->ascender = _hea->ascender; this->descender = _hea->descender; this->line_gap = _hea->lineGap; + got_font_extents = (this->ascender | this->descender) != 0; } hb_blob_destroy (_hea_blob); + this->has_font_extents = got_font_extents; + this->blob = OT::Sanitizer::sanitize (face->reference_table (_mtx_tag)); /* Cap num_metrics() and num_advances() based on table length. */ @@ -202,6 +208,91 @@ struct hb_ot_face_glyf_accelerator_t } }; +struct hb_ot_face_cbdt_accelerator_t +{ + hb_blob_t *cblc_blob; + hb_blob_t *cbdt_blob; + const OT::CBLC *cblc; + const OT::CBDT *cbdt; + + unsigned int cbdt_len; + float upem; + + inline void init (hb_face_t *face) + { + upem = face->get_upem(); + + cblc_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_CBLC)); + cbdt_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_CBDT)); + cbdt_len = hb_blob_get_length (cbdt_blob); + + if (hb_blob_get_length (cblc_blob) == 0) { + cblc = NULL; + cbdt = NULL; + return; /* Not a bitmap font. */ + } + cblc = OT::Sanitizer::lock_instance (cblc_blob); + cbdt = OT::Sanitizer::lock_instance (cbdt_blob); + + } + + inline void fini (void) + { + hb_blob_destroy (this->cblc_blob); + hb_blob_destroy (this->cbdt_blob); + } + + inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const + { + unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */ + + if (cblc == NULL) + return false; // Not a color bitmap font. + + const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem); + if (subtable_record == NULL) + return false; + + if (subtable_record->get_extents (extents)) + return true; + + unsigned int image_offset = 0, image_length = 0, image_format = 0; + if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format)) + return false; + + { + /* TODO Move the following into CBDT struct when adding more formats. */ + + if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length)) + return false; + + switch (image_format) + { + case 17: { + if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size)) + return false; + + const OT::GlyphBitmapDataFormat17& glyphFormat17 = + OT::StructAtOffset (this->cbdt, image_offset); + glyphFormat17.glyphMetrics.get_extents (extents); + } + break; + default: + // TODO: Support other image formats. + return false; + } + } + + /* Convert to the font units. */ + extents->x_bearing *= upem / (float) x_ppem; + extents->y_bearing *= upem / (float) y_ppem; + extents->width *= upem / (float) x_ppem; + extents->height *= upem / (float) y_ppem; + + return true; + } +}; + typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph); @@ -264,7 +355,11 @@ struct hb_ot_face_cmap_accelerator_t if (!subtable) subtable = cmap->find_subtable (0, 2); if (!subtable) subtable = cmap->find_subtable (0, 1); if (!subtable) subtable = cmap->find_subtable (0, 0); - if (!subtable)(subtable = cmap->find_subtable (3, 0)) && (symbol = true); + if (!subtable) + { + subtable = cmap->find_subtable (3, 0); + if (subtable) symbol = true; + } /* Meh. */ if (!subtable) subtable = &OT::Null(OT::CmapSubtable); @@ -374,6 +469,7 @@ struct hb_ot_font_t hb_ot_face_metrics_accelerator_t h_metrics; hb_ot_face_metrics_accelerator_t v_metrics; hb_lazy_loader_t glyf; + hb_lazy_loader_t cbdt; }; @@ -387,8 +483,10 @@ _hb_ot_font_create (hb_face_t *face) ot_font->cmap.init (face); ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_os2); - ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_TAG_NONE); /* TODO Can we do this lazily? */ + ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_TAG_NONE, + ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */ ot_font->glyf.init (face); + ot_font->cbdt.init (face); return ot_font; } @@ -400,6 +498,7 @@ _hb_ot_font_destroy (hb_ot_font_t *ot_font) ot_font->h_metrics.fini (); ot_font->v_metrics.fini (); ot_font->glyf.fini (); + ot_font->cbdt.fini (); free (ot_font); } @@ -458,6 +557,8 @@ hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED, { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; bool ret = ot_font->glyf->get_extents (glyph, extents); + if (!ret) + ret = ot_font->cbdt->get_extents (glyph, extents); extents->x_bearing = font->em_scale_x (extents->x_bearing); extents->y_bearing = font->em_scale_y (extents->y_bearing); extents->width = font->em_scale_x (extents->width); @@ -475,7 +576,7 @@ hb_ot_get_font_h_extents (hb_font_t *font HB_UNUSED, metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender); metrics->descender = font->em_scale_y (ot_font->h_metrics.descender); metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap); - return true; + return ot_font->h_metrics.has_font_extents; } static hb_bool_t @@ -488,7 +589,7 @@ hb_ot_get_font_v_extents (hb_font_t *font HB_UNUSED, metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender); metrics->descender = font->em_scale_x (ot_font->v_metrics.descender); metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap); - return true; + return ot_font->v_metrics.has_font_extents; } static hb_font_funcs_t *static_ot_funcs = NULL; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh index f6d966cc97d..80dc44eb1d8 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-common-private.hh @@ -507,7 +507,7 @@ struct Feature { return this+featureParams; } inline bool sanitize (hb_sanitize_context_t *c, - const Record::sanitize_closure_t *closure) const + const Record::sanitize_closure_t *closure = NULL) const { TRACE_SANITIZE (this); if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c)))) @@ -731,8 +731,8 @@ struct CoverageFormat1 inline void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; }; inline bool more (void) { return i < c->glyphArray.len; } inline void next (void) { i++; } - inline uint16_t get_glyph (void) { return c->glyphArray[i]; } - inline uint16_t get_coverage (void) { return i; } + inline hb_codepoint_t get_glyph (void) { return c->glyphArray[i]; } + inline unsigned int get_coverage (void) { return i; } private: const struct CoverageFormat1 *c; @@ -829,26 +829,33 @@ struct CoverageFormat2 public: /* Older compilers need this to be public. */ - struct Iter { - inline void init (const CoverageFormat2 &c_) { + struct Iter + { + inline void init (const CoverageFormat2 &c_) + { c = &c_; coverage = 0; i = 0; j = c->rangeRecord.len ? c_.rangeRecord[0].start : 0; } inline bool more (void) { return i < c->rangeRecord.len; } - inline void next (void) { - coverage++; - if (j == c->rangeRecord[i].end) { + inline void next (void) + { + if (j >= c->rangeRecord[i].end) + { i++; if (more ()) + { j = c->rangeRecord[i].start; + coverage = c->rangeRecord[i].value; + } return; } + coverage++; j++; } - inline uint16_t get_glyph (void) { return j; } - inline uint16_t get_coverage (void) { return coverage; } + inline hb_codepoint_t get_glyph (void) { return j; } + inline unsigned int get_coverage (void) { return coverage; } private: const struct CoverageFormat2 *c; @@ -957,14 +964,14 @@ struct Coverage default: break; } } - inline uint16_t get_glyph (void) { + inline hb_codepoint_t get_glyph (void) { switch (format) { case 1: return u.format1.get_glyph (); case 2: return u.format2.get_glyph (); default:return 0; } } - inline uint16_t get_coverage (void) { + inline unsigned int get_coverage (void) { switch (format) { case 1: return u.format1.get_coverage (); case 2: return u.format2.get_coverage (); @@ -1161,12 +1168,381 @@ struct ClassDef }; +/* + * Item Variation Store + */ + +struct VarRegionAxis +{ + inline float evaluate (int coord) const + { + int start = startCoord, peak = peakCoord, end = endCoord; + + /* TODO Move these to sanitize(). */ + if (unlikely (start > peak || peak > end)) + return 1.; + if (unlikely (start < 0 && end > 0 && peak != 0)) + return 1.; + + if (peak == 0 || coord == peak) + return 1.; + + if (coord <= start || end <= coord) + return 0.; + + /* Interpolate */ + if (coord < peak) + return float (coord - start) / (peak - start); + else + return float (end - coord) / (end - peak); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + /* TODO Handle invalid start/peak/end configs, so we don't + * have to do that at runtime. */ + } + + public: + F2DOT14 startCoord; + F2DOT14 peakCoord; + F2DOT14 endCoord; + public: + DEFINE_SIZE_STATIC (6); +}; + +struct VarRegionList +{ + inline float evaluate (unsigned int region_index, + int *coords, unsigned int coord_len) const + { + if (unlikely (region_index >= regionCount)) + return 0.; + + const VarRegionAxis *axes = axesZ + (region_index * axisCount); + + float v = 1.; + unsigned int count = MIN (coord_len, (unsigned int) axisCount); + for (unsigned int i = 0; i < count; i++) + { + float factor = axes[i].evaluate (coords[i]); + if (factor == 0.) + return 0.; + v *= factor; + } + return v; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + c->check_array (axesZ, axesZ[0].static_size, + (unsigned int) axisCount * (unsigned int) regionCount)); + } + + protected: + USHORT axisCount; + USHORT regionCount; + VarRegionAxis axesZ[VAR]; + public: + DEFINE_SIZE_ARRAY (4, axesZ); +}; + +struct VarData +{ + inline unsigned int get_row_size (void) const + { return shortCount + regionIndices.len; } + + inline unsigned int get_size (void) const + { return itemCount * get_row_size (); } + + inline float get_delta (unsigned int inner, + int *coords, unsigned int coord_count, + const VarRegionList ®ions) const + { + if (unlikely (inner >= itemCount)) + return 0.; + + unsigned int count = regionIndices.len; + unsigned int scount = shortCount; + + const BYTE *bytes = &StructAfter (regionIndices); + const BYTE *row = bytes + inner * (scount + count); + + float delta = 0.; + unsigned int i = 0; + + const SHORT *scursor = reinterpret_cast (row); + for (; i < scount; i++) + { + float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count); + delta += scalar * *scursor++; + } + const INT8 *bcursor = reinterpret_cast (scursor); + for (; i < count; i++) + { + float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count); + delta += scalar * *bcursor++; + } + + return delta; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + regionIndices.sanitize(c) && + shortCount <= regionIndices.len && + c->check_array (&StructAfter (regionIndices), + get_row_size (), itemCount)); + } + + protected: + USHORT itemCount; + USHORT shortCount; + ArrayOf regionIndices; + BYTE bytesX[VAR]; + public: + DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX); +}; + +struct VariationStore +{ + inline float get_delta (unsigned int outer, unsigned int inner, + int *coords, unsigned int coord_count) const + { + if (unlikely (outer >= dataSets.len)) + return 0.; + + return (this+dataSets[outer]).get_delta (inner, + coords, coord_count, + this+regions); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + format == 1 && + regions.sanitize (c, this) && + dataSets.sanitize (c, this)); + } + + protected: + USHORT format; + OffsetTo regions; + OffsetArrayOf dataSets; + public: + DEFINE_SIZE_ARRAY (8, dataSets); +}; + +/* + * Feature Variations + */ + +struct ConditionFormat1 +{ + friend struct Condition; + + private: + inline bool evaluate (const int *coords, unsigned int coord_len) const + { + int coord = axisIndex < coord_len ? coords[axisIndex] : 0; + return filterRangeMinValue <= coord && coord <= filterRangeMaxValue; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + protected: + USHORT format; /* Format identifier--format = 1 */ + USHORT axisIndex; + F2DOT14 filterRangeMinValue; + F2DOT14 filterRangeMaxValue; + public: + DEFINE_SIZE_STATIC (8); +}; + +struct Condition +{ + inline bool evaluate (const int *coords, unsigned int coord_len) const + { + switch (u.format) { + case 1: return u.format1.evaluate (coords, coord_len); + default:return false; + } + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + if (!u.format.sanitize (c)) return_trace (false); + switch (u.format) { + case 1: return_trace (u.format1.sanitize (c)); + default:return_trace (true); + } + } + + protected: + union { + USHORT format; /* Format identifier */ + ConditionFormat1 format1; + } u; + public: + DEFINE_SIZE_UNION (2, format); +}; + +struct ConditionSet +{ + inline bool evaluate (const int *coords, unsigned int coord_len) const + { + unsigned int count = conditions.len; + for (unsigned int i = 0; i < count; i++) + if (!(this+conditions.array[i]).evaluate (coords, coord_len)) + return false; + return true; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (conditions.sanitize (c, this)); + } + + protected: + OffsetArrayOf conditions; + public: + DEFINE_SIZE_ARRAY (2, conditions); +}; + +struct FeatureTableSubstitutionRecord +{ + friend struct FeatureTableSubstitution; + + inline bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && feature.sanitize (c, base)); + } + + protected: + USHORT featureIndex; + OffsetTo feature; + public: + DEFINE_SIZE_STATIC (6); +}; + +struct FeatureTableSubstitution +{ + inline const Feature *find_substitute (unsigned int feature_index) const + { + unsigned int count = substitutions.len; + for (unsigned int i = 0; i < count; i++) + { + const FeatureTableSubstitutionRecord &record = substitutions.array[i]; + if (record.featureIndex == feature_index) + return &(this+record.feature); + } + return NULL; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (version.sanitize (c) && + likely (version.major == 1) && + substitutions.sanitize (c, this)); + } + + protected: + FixedVersion<> version; /* Version--0x00010000u */ + ArrayOf + substitutions; + public: + DEFINE_SIZE_ARRAY (6, substitutions); +}; + +struct FeatureVariationRecord +{ + friend struct FeatureVariations; + + inline bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (conditions.sanitize (c, base) && + substitutions.sanitize (c, base)); + } + + protected: + OffsetTo + conditions; + OffsetTo + substitutions; + public: + DEFINE_SIZE_STATIC (8); +}; + +struct FeatureVariations +{ + static const unsigned int NOT_FOUND_INDEX = 0xFFFFFFFFu; + + inline bool find_index (const int *coords, unsigned int coord_len, + unsigned int *index) const + { + unsigned int count = varRecords.len; + for (unsigned int i = 0; i < count; i++) + { + const FeatureVariationRecord &record = varRecords.array[i]; + if ((this+record.conditions).evaluate (coords, coord_len)) + { + *index = i; + return true; + } + } + *index = NOT_FOUND_INDEX; + return false; + } + + inline const Feature *find_substitute (unsigned int variations_index, + unsigned int feature_index) const + { + const FeatureVariationRecord &record = varRecords[variations_index]; + return (this+record.substitutions).find_substitute (feature_index); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (version.sanitize (c) && + likely (version.major == 1) && + varRecords.sanitize (c, this)); + } + + protected: + FixedVersion<> version; /* Version--0x00010000u */ + ArrayOf + varRecords; + public: + DEFINE_SIZE_ARRAY (8, varRecords); +}; + + /* * Device Tables */ -struct Device +struct HintingDevice { + friend struct Device; + + private: inline hb_position_t get_x_delta (hb_font_t *font) const { return get_delta (font->x_ppem, font->x_scale); } @@ -1235,6 +1611,101 @@ struct Device DEFINE_SIZE_ARRAY (6, deltaValue); }; +struct VariationDevice +{ + friend struct Device; + + private: + + inline hb_position_t get_x_delta (hb_font_t *font, const VariationStore &store) const + { return font->em_scalef_x (get_delta (font, store)); } + + inline hb_position_t get_y_delta (hb_font_t *font, const VariationStore &store) const + { return font->em_scalef_y (get_delta (font, store)); } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + private: + + inline float get_delta (hb_font_t *font, const VariationStore &store) const + { + return store.get_delta (outerIndex, innerIndex, font->coords, font->num_coords); + } + + protected: + USHORT outerIndex; + USHORT innerIndex; + USHORT deltaFormat; /* Format identifier for this table: 0x0x8000 */ + public: + DEFINE_SIZE_STATIC (6); +}; + +struct DeviceHeader +{ + protected: + USHORT reserved1; + USHORT reserved2; + public: + USHORT format; /* Format identifier */ + public: + DEFINE_SIZE_STATIC (6); +}; + +struct Device +{ + inline hb_position_t get_x_delta (hb_font_t *font, const VariationStore &store=Null(VariationStore)) const + { + switch (u.b.format) + { + case 1: case 2: case 3: + return u.hinting.get_x_delta (font); + case 0x8000: + return u.variation.get_x_delta (font, store); + default: + return 0; + } + } + inline hb_position_t get_y_delta (hb_font_t *font, const VariationStore &store=Null(VariationStore)) const + { + switch (u.b.format) + { + case 1: case 2: case 3: + return u.hinting.get_y_delta (font); + case 0x8000: + return u.variation.get_y_delta (font, store); + default: + return 0; + } + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + if (!u.b.format.sanitize (c)) return_trace (false); + switch (u.b.format) { + case 1: case 2: case 3: + return_trace (u.hinting.sanitize (c)); + case 0x8000: + return_trace (u.variation.sanitize (c)); + default: + return_trace (true); + } + } + + protected: + union { + DeviceHeader b; + HintingDevice hinting; + VariationDevice variation; + } u; + public: + DEFINE_SIZE_UNION (6, b); +}; + } /* namespace OT */ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh index b77ce74062d..87abad61864 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gdef-table.hh @@ -97,7 +97,7 @@ struct CaretValueFormat1 friend struct CaretValue; private: - inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const + inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction) const { return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate) : font->em_scale_y (coordinate); } @@ -146,11 +146,11 @@ struct CaretValueFormat3 { friend struct CaretValue; - inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const + inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, const VariationStore &var_store) const { return HB_DIRECTION_IS_HORIZONTAL (direction) ? - font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) : - font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font); + font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font, var_store) : + font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font, var_store); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -172,12 +172,15 @@ struct CaretValueFormat3 struct CaretValue { - inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const + inline hb_position_t get_caret_value (hb_font_t *font, + hb_direction_t direction, + hb_codepoint_t glyph_id, + const VariationStore &var_store) const { switch (u.format) { - case 1: return u.format1.get_caret_value (font, direction, glyph_id); + case 1: return u.format1.get_caret_value (font, direction); case 2: return u.format2.get_caret_value (font, direction, glyph_id); - case 3: return u.format3.get_caret_value (font, direction, glyph_id); + case 3: return u.format3.get_caret_value (font, direction, var_store); default:return 0; } } @@ -210,6 +213,7 @@ struct LigGlyph inline unsigned int get_lig_carets (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id, + const VariationStore &var_store, unsigned int start_offset, unsigned int *caret_count /* IN/OUT */, hb_position_t *caret_array /* OUT */) const @@ -218,7 +222,7 @@ struct LigGlyph const OffsetTo *array = carets.sub_array (start_offset, caret_count); unsigned int count = *caret_count; for (unsigned int i = 0; i < count; i++) - caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id); + caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id, var_store); } return carets.len; @@ -244,6 +248,7 @@ struct LigCaretList inline unsigned int get_lig_carets (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id, + const VariationStore &var_store, unsigned int start_offset, unsigned int *caret_count /* IN/OUT */, hb_position_t *caret_array /* OUT */) const @@ -256,7 +261,7 @@ struct LigCaretList return 0; } const LigGlyph &lig_glyph = this+ligGlyph[index]; - return lig_glyph.get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array); + return lig_glyph.get_lig_carets (font, direction, glyph_id, var_store, start_offset, caret_count, caret_array); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -367,11 +372,17 @@ struct GDEF unsigned int start_offset, unsigned int *caret_count /* IN/OUT */, hb_position_t *caret_array /* OUT */) const - { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array); } + { return (this+ligCaretList).get_lig_carets (font, + direction, glyph_id, get_var_store(), + start_offset, caret_count, caret_array); } - inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef[0] != 0; } + inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef != 0; } inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const - { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); } + { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef).covers (set_index, glyph_id); } + + inline bool has_var_store (void) const { return version.to_int () >= 0x00010003u && varStore != 0; } + inline const VariationStore &get_var_store (void) const + { return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -382,10 +393,10 @@ struct GDEF attachList.sanitize (c, this) && ligCaretList.sanitize (c, this) && markAttachClassDef.sanitize (c, this) && - (version.to_int () < 0x00010002u || markGlyphSetsDef[0].sanitize (c, this))); + (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) && + (version.to_int () < 0x00010003u || varStore.sanitize (c, this))); } - /* glyph_props is a 16-bit integer where the lower 8-bit have bits representing * glyph class and other bits, and high 8-bit gthe mark attachment type (if any). * Not to be confused with lookup_props which is very similar. */ @@ -410,7 +421,7 @@ struct GDEF protected: FixedVersion<>version; /* Version of the GDEF table--currently - * 0x00010002u */ + * 0x00010003u */ OffsetTo glyphClassDef; /* Offset to class definition table * for glyph type--from beginning of @@ -428,12 +439,17 @@ struct GDEF * mark attachment type--from beginning * of GDEF header (may be Null) */ OffsetTo - markGlyphSetsDef[VAR]; /* Offset to the table of mark set + markGlyphSetsDef; /* Offset to the table of mark set * definitions--from beginning of GDEF * header (may be NULL). Introduced - * in version 00010002. */ + * in version 0x00010002. */ + OffsetTo + varStore; /* Offset to the table of Item Variation + * Store--from beginning of GDEF + * header (may be NULL). Introduced + * in version 0x00010003. */ public: - DEFINE_SIZE_ARRAY (12, markGlyphSetsDef); + DEFINE_SIZE_MIN (12); }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh index c065e179a23..d40d4614fa7 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh @@ -103,18 +103,17 @@ struct ValueFormat : USHORT inline unsigned int get_size (void) const { return get_len () * Value::static_size; } - void apply_value (hb_font_t *font, - hb_direction_t direction, + void apply_value (hb_apply_context_t *c, const void *base, const Value *values, hb_glyph_position_t &glyph_pos) const { - unsigned int x_ppem, y_ppem; unsigned int format = *this; - hb_bool_t horizontal = HB_DIRECTION_IS_HORIZONTAL (direction); - if (!format) return; + hb_font_t *font = c->font; + hb_bool_t horizontal = HB_DIRECTION_IS_HORIZONTAL (c->direction); + if (format & xPlacement) glyph_pos.x_offset += font->em_scale_x (get_short (values++)); if (format & yPlacement) glyph_pos.y_offset += font->em_scale_y (get_short (values++)); if (format & xAdvance) { @@ -129,27 +128,29 @@ struct ValueFormat : USHORT if (!has_device ()) return; - x_ppem = font->x_ppem; - y_ppem = font->y_ppem; + bool use_x_device = font->x_ppem || font->num_coords; + bool use_y_device = font->y_ppem || font->num_coords; - if (!x_ppem && !y_ppem) return; + if (!use_x_device && !use_y_device) return; + + const VariationStore &store = c->var_store; /* pixel -> fractional pixel */ if (format & xPlaDevice) { - if (x_ppem) glyph_pos.x_offset += (base + get_device (values)).get_x_delta (font); + if (use_x_device) glyph_pos.x_offset += (base + get_device (values)).get_x_delta (font, store); values++; } if (format & yPlaDevice) { - if (y_ppem) glyph_pos.y_offset += (base + get_device (values)).get_y_delta (font); + if (use_y_device) glyph_pos.y_offset += (base + get_device (values)).get_y_delta (font, store); values++; } if (format & xAdvDevice) { - if (horizontal && x_ppem) glyph_pos.x_advance += (base + get_device (values)).get_x_delta (font); + if (horizontal && use_x_device) glyph_pos.x_advance += (base + get_device (values)).get_x_delta (font, store); values++; } if (format & yAdvDevice) { /* y_advance values grow downward but font-space grows upward, hence negation */ - if (!horizontal && y_ppem) glyph_pos.y_advance -= (base + get_device (values)).get_y_delta (font); + if (!horizontal && use_y_device) glyph_pos.y_advance -= (base + get_device (values)).get_y_delta (font, store); values++; } } @@ -231,11 +232,12 @@ struct ValueFormat : USHORT struct AnchorFormat1 { - inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED, + inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, hb_position_t *x, hb_position_t *y) const { - *x = font->em_scale_x (xCoordinate); - *y = font->em_scale_y (yCoordinate); + hb_font_t *font = c->font; + *x = font->em_scale_x (xCoordinate); + *y = font->em_scale_y (yCoordinate); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -254,18 +256,19 @@ struct AnchorFormat1 struct AnchorFormat2 { - inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id, + inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id, hb_position_t *x, hb_position_t *y) const { - unsigned int x_ppem = font->x_ppem; - unsigned int y_ppem = font->y_ppem; - hb_position_t cx, cy; - hb_bool_t ret; + hb_font_t *font = c->font; + unsigned int x_ppem = font->x_ppem; + unsigned int y_ppem = font->y_ppem; + hb_position_t cx, cy; + hb_bool_t ret; - ret = (x_ppem || y_ppem) && - font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy); - *x = ret && x_ppem ? cx : font->em_scale_x (xCoordinate); - *y = ret && y_ppem ? cy : font->em_scale_y (yCoordinate); + ret = (x_ppem || y_ppem) && + font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy); + *x = ret && x_ppem ? cx : font->em_scale_x (xCoordinate); + *y = ret && y_ppem ? cy : font->em_scale_y (yCoordinate); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -285,16 +288,17 @@ struct AnchorFormat2 struct AnchorFormat3 { - inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED, + inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, hb_position_t *x, hb_position_t *y) const { - *x = font->em_scale_x (xCoordinate); - *y = font->em_scale_y (yCoordinate); + hb_font_t *font = c->font; + *x = font->em_scale_x (xCoordinate); + *y = font->em_scale_y (yCoordinate); - if (font->x_ppem) - *x += (this+xDeviceTable).get_x_delta (font); - if (font->y_ppem) - *y += (this+yDeviceTable).get_x_delta (font); + if (font->x_ppem || font->num_coords) + *x += (this+xDeviceTable).get_x_delta (font, c->var_store); + if (font->y_ppem || font->num_coords) + *y += (this+yDeviceTable).get_y_delta (font, c->var_store); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -321,14 +325,14 @@ struct AnchorFormat3 struct Anchor { - inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id, + inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id, hb_position_t *x, hb_position_t *y) const { *x = *y = 0; switch (u.format) { - case 1: u.format1.get_anchor (font, glyph_id, x, y); return; - case 2: u.format2.get_anchor (font, glyph_id, x, y); return; - case 3: u.format3.get_anchor (font, glyph_id, x, y); return; + case 1: u.format1.get_anchor (c, glyph_id, x, y); return; + case 2: u.format2.get_anchor (c, glyph_id, x, y); return; + case 3: u.format3.get_anchor (c, glyph_id, x, y); return; default: return; } } @@ -370,7 +374,7 @@ struct AnchorMatrix { TRACE_SANITIZE (this); if (!c->check_struct (this)) return_trace (false); - if (unlikely (rows > 0 && cols >= ((unsigned int) -1) / rows)) return_trace (false); + if (unlikely (_hb_unsigned_int_mul_overflows (rows, cols))) return_trace (false); unsigned int count = rows * cols; if (!c->check_array (matrixZ, matrixZ[0].static_size, count)) return_trace (false); for (unsigned int i = 0; i < count; i++) @@ -428,8 +432,8 @@ struct MarkArray : ArrayOf /* Array of MarkRecords--in Coverage ord hb_position_t mark_x, mark_y, base_x, base_y; - mark_anchor.get_anchor (c->font, buffer->cur().codepoint, &mark_x, &mark_y); - glyph_anchor.get_anchor (c->font, buffer->info[glyph_pos].codepoint, &base_x, &base_y); + mark_anchor.get_anchor (c, buffer->cur().codepoint, &mark_x, &mark_y); + glyph_anchor.get_anchor (c, buffer->info[glyph_pos].codepoint, &base_x, &base_y); hb_glyph_position_t &o = buffer->cur_pos(); o.x_offset = base_x - mark_x; @@ -472,8 +476,7 @@ struct SinglePosFormat1 unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - valueFormat.apply_value (c->font, c->direction, this, - values, buffer->cur_pos()); + valueFormat.apply_value (c, this, values, buffer->cur_pos()); buffer->idx++; return_trace (true); @@ -523,7 +526,7 @@ struct SinglePosFormat2 if (likely (index >= valueCount)) return_trace (false); - valueFormat.apply_value (c->font, c->direction, this, + valueFormat.apply_value (c, this, &values[index * valueFormat.get_len ()], buffer->cur_pos()); @@ -640,10 +643,8 @@ struct PairSet min = mid + 1; else { - valueFormats[0].apply_value (c->font, c->direction, this, - &record->values[0], buffer->cur_pos()); - valueFormats[1].apply_value (c->font, c->direction, this, - &record->values[len1], buffer->pos[pos]); + valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos()); + valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]); if (len2) pos++; buffer->idx = pos; @@ -689,7 +690,7 @@ struct PairPosFormat1 (this+coverage).add_coverage (c->input); unsigned int count = pairSet.len; for (unsigned int i = 0; i < count; i++) - (this+pairSet[i]).collect_glyphs (c, &valueFormat1); + (this+pairSet[i]).collect_glyphs (c, valueFormat); } inline const Coverage &get_coverage (void) const @@ -708,7 +709,7 @@ struct PairPosFormat1 skippy_iter.reset (buffer->idx, 1); if (!skippy_iter.next ()) return_trace (false); - return_trace ((this+pairSet[index]).apply (c, &valueFormat1, skippy_iter.idx)); + return_trace ((this+pairSet[index]).apply (c, valueFormat, skippy_iter.idx)); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -717,11 +718,11 @@ struct PairPosFormat1 if (!c->check_struct (this)) return_trace (false); - unsigned int len1 = valueFormat1.get_len (); - unsigned int len2 = valueFormat2.get_len (); + unsigned int len1 = valueFormat[0].get_len (); + unsigned int len2 = valueFormat[1].get_len (); PairSet::sanitize_closure_t closure = { this, - &valueFormat1, + valueFormat, len1, 1 + len1 + len2 }; @@ -734,10 +735,10 @@ struct PairPosFormat1 OffsetTo coverage; /* Offset to Coverage table--from * beginning of subtable */ - ValueFormat valueFormat1; /* Defines the types of data in + ValueFormat valueFormat[2]; /* [0] Defines the types of data in * ValueRecord1--for the first glyph * in the pair--may be zero (0) */ - ValueFormat valueFormat2; /* Defines the types of data in + /* [1] Defines the types of data in * ValueRecord2--for the second glyph * in the pair--may be zero (0) */ OffsetArrayOf @@ -790,10 +791,8 @@ struct PairPosFormat2 if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return_trace (false); const Value *v = &values[record_len * (klass1 * class2Count + klass2)]; - valueFormat1.apply_value (c->font, c->direction, this, - v, buffer->cur_pos()); - valueFormat2.apply_value (c->font, c->direction, this, - v + len1, buffer->pos[skippy_iter.idx]); + valueFormat1.apply_value (c, this, v, buffer->cur_pos()); + valueFormat2.apply_value (c, this, v + len1, buffer->pos[skippy_iter.idx]); buffer->idx = skippy_iter.idx; if (len2) @@ -931,8 +930,8 @@ struct CursivePosFormat1 unsigned int j = skippy_iter.idx; hb_position_t entry_x, entry_y, exit_x, exit_y; - (this+this_record.exitAnchor).get_anchor (c->font, buffer->info[i].codepoint, &exit_x, &exit_y); - (this+next_record.entryAnchor).get_anchor (c->font, buffer->info[j].codepoint, &entry_x, &entry_y); + (this+this_record.exitAnchor).get_anchor (c, buffer->info[i].codepoint, &exit_x, &exit_y); + (this+next_record.entryAnchor).get_anchor (c, buffer->info[j].codepoint, &entry_x, &entry_y); hb_glyph_position_t *pos = buffer->pos; @@ -1519,8 +1518,6 @@ struct GPOS : GSUBGPOS const OffsetTo &list = CastR > (lookupList); return_trace (list.sanitize (c, this)); } - public: - DEFINE_SIZE_STATIC (10); }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh index 44dcd120e3b..9a7481413de 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsub-table.hh @@ -41,7 +41,10 @@ struct SingleSubstFormat1 { TRACE_CLOSURE (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + /* TODO Switch to range-based API to work around malicious fonts. + * https://github.com/behdad/harfbuzz/issues/363 */ hb_codepoint_t glyph_id = iter.get_glyph (); if (c->glyphs->has (glyph_id)) c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFFu); @@ -52,7 +55,10 @@ struct SingleSubstFormat1 { TRACE_COLLECT_GLYPHS (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + /* TODO Switch to range-based API to work around malicious fonts. + * https://github.com/behdad/harfbuzz/issues/363 */ hb_codepoint_t glyph_id = iter.get_glyph (); c->input->add (glyph_id); c->output->add ((glyph_id + deltaGlyphID) & 0xFFFFu); @@ -120,7 +126,11 @@ struct SingleSubstFormat2 { TRACE_CLOSURE (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + unsigned int count = substitute.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) c->glyphs->add (substitute[iter.get_coverage ()]); } @@ -130,7 +140,11 @@ struct SingleSubstFormat2 { TRACE_COLLECT_GLYPHS (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + unsigned int count = substitute.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ c->input->add (iter.get_glyph ()); c->output->add (substitute[iter.get_coverage ()]); } @@ -321,7 +335,11 @@ struct MultipleSubstFormat1 { TRACE_CLOSURE (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + unsigned int count = sequence.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) (this+sequence[iter.get_coverage ()]).closure (c); } @@ -439,7 +457,11 @@ struct AlternateSubstFormat1 { TRACE_CLOSURE (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + unsigned int count = alternateSet.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) { const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; unsigned int count = alt_set.len; @@ -453,7 +475,11 @@ struct AlternateSubstFormat1 { TRACE_COLLECT_GLYPHS (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + unsigned int count = alternateSet.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ c->input->add (iter.get_glyph ()); const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; unsigned int count = alt_set.len; @@ -762,7 +788,11 @@ struct LigatureSubstFormat1 { TRACE_CLOSURE (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + unsigned int count = ligatureSet.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) (this+ligatureSet[iter.get_coverage ()]).closure (c); } @@ -772,7 +802,11 @@ struct LigatureSubstFormat1 { TRACE_COLLECT_GLYPHS (this); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + unsigned int count = ligatureSet.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ c->input->add (iter.get_glyph ()); (this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c); } @@ -923,7 +957,11 @@ struct ReverseChainSingleSubstFormat1 const ArrayOf &substitute = StructAfter > (lookahead); Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) { + count = substitute.len; + for (iter.init (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */ if (c->glyphs->has (iter.get_glyph ())) c->glyphs->add (substitute[iter.get_coverage ()]); } @@ -1273,8 +1311,6 @@ struct GSUB : GSUBGPOS const OffsetTo &list = CastR > (lookupList); return_trace (list.sanitize (c, this)); } - public: - DEFINE_SIZE_STATIC (10); }; @@ -1285,28 +1321,10 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) const GDEF &gdef = *hb_ot_layout_from_face (font->face)->gdef; unsigned int count = buffer->len; - hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) { - unsigned int props = gdef.get_glyph_props (info[i].codepoint); - if (!props) - { - /* Never mark default-ignorables as marks. - * They won't get in the way of lookups anyway, - * but having them as mark will cause them to be skipped - * over if the lookup-flag says so, but at least for the - * Mongolian variation selectors, looks like Uniscribe - * marks them as non-mark. Some Mongolian fonts without - * GDEF rely on this. Another notable character that - * this applies to is COMBINING GRAPHEME JOINER. */ - props = (_hb_glyph_info_get_general_category (&info[i]) != - HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK || - _hb_glyph_info_is_default_ignorable (&info[i])) ? - HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : - HB_OT_LAYOUT_GLYPH_PROPS_MARK; - } - _hb_glyph_info_set_glyph_props (&info[i], props); - _hb_glyph_info_clear_lig_props (&info[i]); + _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint)); + _hb_glyph_info_clear_lig_props (&buffer->info[i]); buffer->info[i].syllable() = 0; } } diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh index 73cfb77fe2a..d2141b226a3 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gsubgpos-private.hh @@ -469,6 +469,7 @@ struct hb_apply_context_t : unsigned int lookup_props; const GDEF &gdef; bool has_glyph_classes; + const VariationStore &var_store; skipping_iterator_t iter_input, iter_context; unsigned int lookup_index; unsigned int debug_depth; @@ -487,6 +488,7 @@ struct hb_apply_context_t : lookup_props (0), gdef (*hb_ot_layout_from_face (face)->gdef), has_glyph_classes (gdef.has_glyph_classes ()), + var_store (gdef.get_var_store ()), iter_input (), iter_context (), lookup_index ((unsigned int) -1), @@ -999,8 +1001,12 @@ static inline bool apply_lookup (hb_apply_context_t *c, end = int (end) + delta; if (end <= match_positions[idx]) { + /* End might end up being smaller than match_positions[idx] if the recursed + * lookup ended up removing many items, more than we have had matched. + * Just never rewind end back and get out of here. + * https://bugs.chromium.org/p/chromium/issues/detail?id=659496 */ + end = match_positions[idx]; /* There can't be any further changes. */ - assert (end == match_positions[idx]); break; } @@ -2269,6 +2275,24 @@ struct GSUBGPOS inline const Lookup& get_lookup (unsigned int i) const { return (this+lookupList)[i]; } + inline bool find_variations_index (const int *coords, unsigned int num_coords, + unsigned int *index) const + { return (version.to_int () >= 0x00010001u ? this+featureVars : Null(FeatureVariations)) + .find_index (coords, num_coords, index); } + inline const Feature& get_feature_variation (unsigned int feature_index, + unsigned int variations_index) const + { + if (FeatureVariations::NOT_FOUND_INDEX != variations_index && + version.to_int () >= 0x00010001u) + { + const Feature *feature = (this+featureVars).find_substitute (variations_index, + feature_index); + if (feature) + return *feature; + } + return get_feature (feature_index); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -2276,7 +2300,8 @@ struct GSUBGPOS likely (version.major == 1) && scriptList.sanitize (c, this) && featureList.sanitize (c, this) && - lookupList.sanitize (c, this)); + lookupList.sanitize (c, this) && + (version.to_int () < 0x00010001u || featureVars.sanitize (c, this))); } protected: @@ -2288,8 +2313,13 @@ struct GSUBGPOS featureList; /* FeatureList table */ OffsetTo lookupList; /* LookupList table */ + OffsetTo + featureVars; /* Offset to Feature Variations + table--from beginning of table + * (may be NULL). Introduced + * in version 0x00010001. */ public: - DEFINE_SIZE_STATIC (10); + DEFINE_SIZE_MIN (10); }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh index 2081949fe62..c7b43fe3d5b 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh @@ -124,6 +124,7 @@ namespace OT { struct GDEF; struct GSUB; struct GPOS; + struct MATH; } struct hb_ot_layout_lookup_accelerator_t @@ -152,10 +153,12 @@ struct hb_ot_layout_t hb_blob_t *gdef_blob; hb_blob_t *gsub_blob; hb_blob_t *gpos_blob; + hb_blob_t *math_blob; const struct OT::GDEF *gdef; const struct OT::GSUB *gsub; const struct OT::GPOS *gpos; + const struct OT::MATH *math; unsigned int gsub_lookup_count; unsigned int gpos_lookup_count; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc index 74f61136780..1ee59f49747 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc @@ -60,6 +60,10 @@ _hb_ot_layout_create (hb_face_t *face) layout->gpos_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_GPOS)); layout->gpos = OT::Sanitizer::lock_instance (layout->gpos_blob); + /* The MATH table is rarely used, so only try and load it in _get_math. */ + layout->math_blob = NULL; + layout->math = NULL; + { /* * The ugly business of blacklisting individual fonts' tables happen here! @@ -120,6 +124,14 @@ _hb_ot_layout_create (hb_face_t *face) /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ || (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len) + /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ + || (1046 == gdef_len && 17112 == gpos_len && 71788 == gsub_len) + /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ + || (1058 == gdef_len && 17514 == gpos_len && 71794 == gsub_len) + /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */ + || (1330 == gdef_len && 57938 == gpos_len && 109904 == gsub_len) + /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ + || (1330 == gdef_len && 58972 == gpos_len && 109904 == gsub_len) ) { /* Many versions of Tahoma have bad GDEF tables that incorrectly classify some spacing marks @@ -169,6 +181,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout) hb_blob_destroy (layout->gdef_blob); hb_blob_destroy (layout->gsub_blob); hb_blob_destroy (layout->gpos_blob); + hb_blob_destroy (layout->math_blob); free (layout); } @@ -192,7 +205,6 @@ _get_gpos (hb_face_t *face) return *hb_ot_layout_from_face (face)->gpos; } - /* * GDEF */ @@ -544,10 +556,13 @@ hb_ot_layout_feature_get_lookups (hb_face_t *face, unsigned int *lookup_count /* IN/OUT */, unsigned int *lookup_indexes /* OUT */) { - const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); - const OT::Feature &f = g.get_feature (feature_index); - - return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes); + return hb_ot_layout_feature_with_variations_get_lookups (face, + table_tag, + feature_index, + HB_OT_LAYOUT_NO_VARIATIONS_INDEX, + start_offset, + lookup_count, + lookup_indexes); } /** @@ -798,6 +813,38 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, } +/* Variations support */ + +hb_bool_t +hb_ot_layout_table_find_feature_variations (hb_face_t *face, + hb_tag_t table_tag, + const int *coords, + unsigned int num_coords, + unsigned int *variations_index /* out */) +{ + const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); + + return g.find_variations_index (coords, num_coords, variations_index); +} + +unsigned int +hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face, + hb_tag_t table_tag, + unsigned int feature_index, + unsigned int variations_index, + unsigned int start_offset, + unsigned int *lookup_count /* IN/OUT */, + unsigned int *lookup_indexes /* OUT */) +{ + ASSERT_STATIC (OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX); + const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); + + const OT::Feature &f = g.get_feature_variation (feature_index, variations_index); + + return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes); +} + + /* * OT::GSUB */ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h index 2c455a954cd..5ee95105181 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.h @@ -95,6 +95,7 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font, #define HB_OT_LAYOUT_NO_SCRIPT_INDEX 0xFFFFu #define HB_OT_LAYOUT_NO_FEATURE_INDEX 0xFFFFu #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX 0xFFFFu +#define HB_OT_LAYOUT_NO_VARIATIONS_INDEX 0xFFFFFFFFu HB_EXTERN unsigned int hb_ot_layout_table_get_script_tags (hb_face_t *face, @@ -236,6 +237,24 @@ Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face, void *user_data); #endif +/* Variations support */ + +HB_EXTERN hb_bool_t +hb_ot_layout_table_find_feature_variations (hb_face_t *face, + hb_tag_t table_tag, + const int *coords, + unsigned int num_coords, + unsigned int *variations_index /* out */); + +HB_EXTERN unsigned int +hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face, + hb_tag_t table_tag, + unsigned int feature_index, + unsigned int variations_index, + unsigned int start_offset, + unsigned int *lookup_count /* IN/OUT */, + unsigned int *lookup_indexes /* OUT */); + /* * GSUB diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh index 6d9cf96331d..dd1cad2f4f4 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map-private.hh @@ -139,12 +139,6 @@ struct hb_ot_map_t private: - HB_INTERNAL void add_lookups (hb_face_t *face, - unsigned int table_index, - unsigned int feature_index, - hb_mask_t mask, - bool auto_zwj); - hb_mask_t global_mask; hb_prealloced_array_t features; @@ -182,7 +176,9 @@ struct hb_ot_map_builder_t inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func) { add_pause (1, pause_func); } - HB_INTERNAL void compile (struct hb_ot_map_t &m); + HB_INTERNAL void compile (hb_ot_map_t &m, + const int *coords, + unsigned int num_coords); inline void finish (void) { feature_infos.finish (); @@ -194,6 +190,14 @@ struct hb_ot_map_builder_t private: + HB_INTERNAL void add_lookups (hb_ot_map_t &m, + hb_face_t *face, + unsigned int table_index, + unsigned int feature_index, + unsigned int variations_index, + hb_mask_t mask, + bool auto_zwj); + struct feature_info_t { hb_tag_t tag; unsigned int seq; /* sequence#, used for stable sorting only */ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc index 0f9f60875cc..6442e2590d6 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-map.cc @@ -31,44 +31,13 @@ #include "hb-ot-layout-private.hh" -void -hb_ot_map_t::add_lookups (hb_face_t *face, - unsigned int table_index, - unsigned int feature_index, - hb_mask_t mask, - bool auto_zwj) +void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const { - unsigned int lookup_indices[32]; - unsigned int offset, len; - unsigned int table_lookup_count; - - table_lookup_count = hb_ot_layout_table_get_lookup_count (face, table_tags[table_index]); - - offset = 0; - do { - len = ARRAY_LENGTH (lookup_indices); - hb_ot_layout_feature_get_lookups (face, - table_tags[table_index], - feature_index, - offset, &len, - lookup_indices); - - for (unsigned int i = 0; i < len; i++) - { - if (lookup_indices[i] >= table_lookup_count) - continue; - hb_ot_map_t::lookup_map_t *lookup = lookups[table_index].push (); - if (unlikely (!lookup)) - return; - lookup->mask = mask; - lookup->index = lookup_indices[i]; - lookup->auto_zwj = auto_zwj; - } - - offset += len; - } while (len == ARRAY_LENGTH (lookup_indices)); + for (unsigned int i = 0; i < lookups[table_index].len; i++) + hb_set_add (lookups_out, lookups[table_index][i].index); } + hb_ot_map_builder_t::hb_ot_map_builder_t (hb_face_t *face_, const hb_segment_properties_t *props_) { @@ -109,13 +78,48 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, info->stage[1] = current_stage[1]; } - -void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const +void +hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m, + hb_face_t *face, + unsigned int table_index, + unsigned int feature_index, + unsigned int variations_index, + hb_mask_t mask, + bool auto_zwj) { - for (unsigned int i = 0; i < lookups[table_index].len; i++) - hb_set_add (lookups_out, lookups[table_index][i].index); + unsigned int lookup_indices[32]; + unsigned int offset, len; + unsigned int table_lookup_count; + + table_lookup_count = hb_ot_layout_table_get_lookup_count (face, table_tags[table_index]); + + offset = 0; + do { + len = ARRAY_LENGTH (lookup_indices); + hb_ot_layout_feature_with_variations_get_lookups (face, + table_tags[table_index], + feature_index, + variations_index, + offset, &len, + lookup_indices); + + for (unsigned int i = 0; i < len; i++) + { + if (lookup_indices[i] >= table_lookup_count) + continue; + hb_ot_map_t::lookup_map_t *lookup = m.lookups[table_index].push (); + if (unlikely (!lookup)) + return; + lookup->mask = mask; + lookup->index = lookup_indices[i]; + lookup->auto_zwj = auto_zwj; + } + + offset += len; + } while (len == ARRAY_LENGTH (lookup_indices)); } + void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func) { stage_info_t *s = stages[table_index].push (); @@ -128,7 +132,9 @@ void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::paus } void -hb_ot_map_builder_t::compile (hb_ot_map_t &m) +hb_ot_map_builder_t::compile (hb_ot_map_t &m, + const int *coords, + unsigned int num_coords) { m.global_mask = 1; @@ -193,7 +199,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m) /* Uses the global bit */ bits_needed = 0; else - bits_needed = _hb_bit_storage (info->max_value); + /* Limit to 8 bits per feature. */ + bits_needed = MIN(8u, _hb_bit_storage (info->max_value)); if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t)) continue; /* Feature disabled, or not enough bits. */ @@ -243,11 +250,11 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m) map->mask = 1; } else { map->shift = next_bit; - map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit); + map->mask = (1u << (next_bit + bits_needed)) - (1u << next_bit); next_bit += bits_needed; m.global_mask |= (info->default_value << map->shift) & map->mask; } - map->_1_mask = (1 << map->shift) & map->mask; + map->_1_mask = (1u << map->shift) & map->mask; map->needs_fallback = !found; } @@ -261,23 +268,32 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m) { /* Collect lookup indices for features */ + unsigned int variations_index; + hb_ot_layout_table_find_feature_variations (face, + table_tags[table_index], + coords, + num_coords, + &variations_index); + unsigned int stage_index = 0; unsigned int last_num_lookups = 0; for (unsigned stage = 0; stage < current_stage[table_index]; stage++) { if (required_feature_index[table_index] != HB_OT_LAYOUT_NO_FEATURE_INDEX && required_feature_stage[table_index] == stage) - m.add_lookups (face, table_index, - required_feature_index[table_index], - 1 /* mask */, - true /* auto_zwj */); + add_lookups (m, face, table_index, + required_feature_index[table_index], + variations_index, + 1 /* mask */, + true /* auto_zwj */); for (unsigned i = 0; i < m.features.len; i++) if (m.features[i].stage[table_index] == stage) - m.add_lookups (face, table_index, - m.features[i].index[table_index], - m.features[i].mask, - m.features[i].auto_zwj); + add_lookups (m, face, table_index, + m.features[i].index[table_index], + variations_index, + m.features[i].mask, + m.features[i].auto_zwj); /* Sort lookups and merge duplicates */ if (last_num_lookups < m.lookups[table_index].len) diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-math.h b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-math.h new file mode 100644 index 00000000000..3cbdb8b3e5d --- /dev/null +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-math.h @@ -0,0 +1,209 @@ +/* + * Copyright © 2016 Igalia S.L. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Igalia Author(s): Frédéric Wang + */ + +#ifndef HB_OT_H_IN +#error "Include instead." +#endif + +#ifndef HB_OT_MATH_H +#define HB_OT_MATH_H + +#include "hb.h" + +HB_BEGIN_DECLS + + +/* + * MATH + */ + +#define HB_OT_TAG_MATH HB_TAG('M','A','T','H') + +/* Use with hb_buffer_set_script() for math shaping. */ +#define HB_OT_MATH_SCRIPT HB_TAG('m','a','t','h') + +/* Types */ + +/** + * hb_ot_math_constant_t: + * + * Since: 1.3.3 + */ +typedef enum { + HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN = 0, + HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN = 1, + HB_OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT = 2, + HB_OT_MATH_CONSTANT_DISPLAY_OPERATOR_MIN_HEIGHT = 3, + HB_OT_MATH_CONSTANT_MATH_LEADING = 4, + HB_OT_MATH_CONSTANT_AXIS_HEIGHT = 5, + HB_OT_MATH_CONSTANT_ACCENT_BASE_HEIGHT = 6, + HB_OT_MATH_CONSTANT_FLATTENED_ACCENT_BASE_HEIGHT = 7, + HB_OT_MATH_CONSTANT_SUBSCRIPT_SHIFT_DOWN = 8, + HB_OT_MATH_CONSTANT_SUBSCRIPT_TOP_MAX = 9, + HB_OT_MATH_CONSTANT_SUBSCRIPT_BASELINE_DROP_MIN = 10, + HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP = 11, + HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP_CRAMPED = 12, + HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MIN = 13, + HB_OT_MATH_CONSTANT_SUPERSCRIPT_BASELINE_DROP_MAX = 14, + HB_OT_MATH_CONSTANT_SUB_SUPERSCRIPT_GAP_MIN = 15, + HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MAX_WITH_SUBSCRIPT = 16, + HB_OT_MATH_CONSTANT_SPACE_AFTER_SCRIPT = 17, + HB_OT_MATH_CONSTANT_UPPER_LIMIT_GAP_MIN = 18, + HB_OT_MATH_CONSTANT_UPPER_LIMIT_BASELINE_RISE_MIN = 19, + HB_OT_MATH_CONSTANT_LOWER_LIMIT_GAP_MIN = 20, + HB_OT_MATH_CONSTANT_LOWER_LIMIT_BASELINE_DROP_MIN = 21, + HB_OT_MATH_CONSTANT_STACK_TOP_SHIFT_UP = 22, + HB_OT_MATH_CONSTANT_STACK_TOP_DISPLAY_STYLE_SHIFT_UP = 23, + HB_OT_MATH_CONSTANT_STACK_BOTTOM_SHIFT_DOWN = 24, + HB_OT_MATH_CONSTANT_STACK_BOTTOM_DISPLAY_STYLE_SHIFT_DOWN = 25, + HB_OT_MATH_CONSTANT_STACK_GAP_MIN = 26, + HB_OT_MATH_CONSTANT_STACK_DISPLAY_STYLE_GAP_MIN = 27, + HB_OT_MATH_CONSTANT_STRETCH_STACK_TOP_SHIFT_UP = 28, + HB_OT_MATH_CONSTANT_STRETCH_STACK_BOTTOM_SHIFT_DOWN = 29, + HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_ABOVE_MIN = 30, + HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_BELOW_MIN = 31, + HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_SHIFT_UP = 32, + HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_DISPLAY_STYLE_SHIFT_UP = 33, + HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_SHIFT_DOWN = 34, + HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_DISPLAY_STYLE_SHIFT_DOWN = 35, + HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_GAP_MIN = 36, + HB_OT_MATH_CONSTANT_FRACTION_NUM_DISPLAY_STYLE_GAP_MIN = 37, + HB_OT_MATH_CONSTANT_FRACTION_RULE_THICKNESS = 38, + HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_GAP_MIN = 39, + HB_OT_MATH_CONSTANT_FRACTION_DENOM_DISPLAY_STYLE_GAP_MIN = 40, + HB_OT_MATH_CONSTANT_SKEWED_FRACTION_HORIZONTAL_GAP = 41, + HB_OT_MATH_CONSTANT_SKEWED_FRACTION_VERTICAL_GAP = 42, + HB_OT_MATH_CONSTANT_OVERBAR_VERTICAL_GAP = 43, + HB_OT_MATH_CONSTANT_OVERBAR_RULE_THICKNESS = 44, + HB_OT_MATH_CONSTANT_OVERBAR_EXTRA_ASCENDER = 45, + HB_OT_MATH_CONSTANT_UNDERBAR_VERTICAL_GAP = 46, + HB_OT_MATH_CONSTANT_UNDERBAR_RULE_THICKNESS = 47, + HB_OT_MATH_CONSTANT_UNDERBAR_EXTRA_DESCENDER = 48, + HB_OT_MATH_CONSTANT_RADICAL_VERTICAL_GAP = 49, + HB_OT_MATH_CONSTANT_RADICAL_DISPLAY_STYLE_VERTICAL_GAP = 50, + HB_OT_MATH_CONSTANT_RADICAL_RULE_THICKNESS = 51, + HB_OT_MATH_CONSTANT_RADICAL_EXTRA_ASCENDER = 52, + HB_OT_MATH_CONSTANT_RADICAL_KERN_BEFORE_DEGREE = 53, + HB_OT_MATH_CONSTANT_RADICAL_KERN_AFTER_DEGREE = 54, + HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT = 55 +} hb_ot_math_constant_t; + +/** + * hb_ot_math_kern_t: + * + * Since: 1.3.3 + */ +typedef enum { + HB_OT_MATH_KERN_TOP_RIGHT = 0, + HB_OT_MATH_KERN_TOP_LEFT = 1, + HB_OT_MATH_KERN_BOTTOM_RIGHT = 2, + HB_OT_MATH_KERN_BOTTOM_LEFT = 3 +} hb_ot_math_kern_t; + +/** + * hb_ot_math_glyph_variant_t: + * + * Since: 1.3.3 + */ +typedef struct hb_ot_math_glyph_variant_t { + hb_codepoint_t glyph; + hb_position_t advance; +} hb_ot_math_glyph_variant_t; + +/** + * hb_ot_math_glyph_part_flags_t: + * + * Since: 1.3.3 + */ +typedef enum { /*< flags >*/ + HB_MATH_GLYPH_PART_FLAG_EXTENDER = 0x00000001u /* Extender glyph */ +} hb_ot_math_glyph_part_flags_t; + +/** + * hb_ot_math_glyph_part_t: + * + * Since: 1.3.3 + */ +typedef struct hb_ot_math_glyph_part_t { + hb_codepoint_t glyph; + hb_position_t start_connector_length; + hb_position_t end_connector_length; + hb_position_t full_advance; + hb_ot_math_glyph_part_flags_t flags; +} hb_ot_math_glyph_part_t; + +/* Methods */ + +HB_EXTERN hb_bool_t +hb_ot_math_has_data (hb_face_t *face); + +HB_EXTERN hb_position_t +hb_ot_math_get_constant (hb_font_t *font, + hb_ot_math_constant_t constant); + +HB_EXTERN hb_position_t +hb_ot_math_get_glyph_italics_correction (hb_font_t *font, + hb_codepoint_t glyph); + +HB_EXTERN hb_position_t +hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font, + hb_codepoint_t glyph); + +HB_EXTERN hb_bool_t +hb_ot_math_is_glyph_extended_shape (hb_face_t *face, + hb_codepoint_t glyph); + +HB_EXTERN hb_position_t +hb_ot_math_get_glyph_kerning (hb_font_t *font, + hb_codepoint_t glyph, + hb_ot_math_kern_t kern, + hb_position_t correction_height); + +HB_EXTERN unsigned int +hb_ot_math_get_glyph_variants (hb_font_t *font, + hb_codepoint_t glyph, + hb_direction_t direction, + unsigned int start_offset, + unsigned int *variants_count, /* IN/OUT */ + hb_ot_math_glyph_variant_t *variants /* OUT */); + +HB_EXTERN hb_position_t +hb_ot_math_get_min_connector_overlap (hb_font_t *font, + hb_direction_t direction); + +HB_EXTERN unsigned int +hb_ot_math_get_glyph_assembly (hb_font_t *font, + hb_codepoint_t glyph, + hb_direction_t direction, + unsigned int start_offset, + unsigned int *parts_count, /* IN/OUT */ + hb_ot_math_glyph_part_t *parts, /* OUT */ + hb_position_t *italics_correction /* OUT */); + + +HB_END_DECLS + +#endif /* HB_OT_MATH_H */ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc index 80accdedd75..223a54af2b7 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic.cc @@ -618,6 +618,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic = NULL, /* decompose */ NULL, /* compose */ setup_masks_arabic, + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc index be60e56feb8..42830ab6185 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-default.cc @@ -40,6 +40,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default = NULL, /* decompose */ NULL, /* compose */ NULL, /* setup_masks */ + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc index aa907390a84..82b038db0b1 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc @@ -419,6 +419,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul = NULL, /* decompose */ NULL, /* compose */ setup_masks_hangul, + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc index e6fde14dca6..60721d543a6 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hebrew.cc @@ -154,6 +154,18 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c, return found; } +static bool +disable_otl_hebrew (const hb_ot_shape_plan_t *plan) +{ + /* For Hebrew shaper, use fallback if GPOS does not have 'hebr' + * script. This matches Uniscribe better, and makes fonts like + * Arial that have GSUB/GPOS/GDEF but no data for Hebrew work. + * See: + * https://github.com/behdad/harfbuzz/issues/347#issuecomment-267838368 + */ + return plan->map.chosen_script[1] != HB_TAG ('h','e','b','r'); +} + const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = { @@ -168,6 +180,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = NULL, /* decompose */ compose_hebrew, NULL, /* setup_masks */ + disable_otl_hebrew, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh index d3f0beea43a..18cf9d11a4d 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic-machine.hh @@ -34,1316 +34,1316 @@ #line 36 "hb-ot-shape-complex-indic-machine.hh" static const unsigned char _indic_syllable_machine_trans_keys[] = { - 8u, 8u, 1u, 16u, 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, - 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, - 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, - 4u, 8u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, 8u, 13u, - 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, - 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, - 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, - 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, - 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, - 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, - 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, - 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, - 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, - 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 5u, 8u, 4u, 14u, 4u, 14u, 5u, 8u, - 5u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, - 5u, 7u, 7u, 7u, 8u, 8u, 1u, 16u, 8u, 13u, 4u, 8u, 6u, 6u, 16u, 16u, - 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, - 16u, 16u, 8u, 8u, 1u, 18u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, - 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, - 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, - 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, - 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, - 5u, 14u, 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, - 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, - 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, - 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, - 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, - 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, - 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, - 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, - 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u, - 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, - 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 3u, 17u, 4u, 14u, - 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, - 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, - 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u, - 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, - 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u, - 1u, 17u, 4u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, - 5u, 10u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 3u, 17u, 3u, 17u, 1u, 16u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, - 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, - 3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, + 8u, 8u, 1u, 16u, 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, + 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, + 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, + 4u, 8u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, + 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, 8u, 13u, + 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, + 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, + 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, + 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, + 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, + 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, + 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, + 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, + 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, + 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, + 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, + 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, + 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, + 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 5u, 8u, 4u, 14u, 4u, 14u, 5u, 8u, + 5u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, + 5u, 7u, 7u, 7u, 8u, 8u, 1u, 16u, 8u, 13u, 4u, 8u, 6u, 6u, 16u, 16u, + 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, + 16u, 16u, 8u, 8u, 1u, 18u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, + 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, + 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, + 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, + 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, + 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, + 5u, 14u, 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, + 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, + 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, + 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, + 3u, 17u, 3u, 17u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, + 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, + 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, + 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, + 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, + 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, + 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, + 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, + 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, + 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 1u, 16u, + 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, + 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, + 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, + 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, + 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, + 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u, + 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, + 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, + 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, + 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 3u, 17u, 4u, 14u, + 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, + 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, + 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, + 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, + 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, + 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u, + 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, + 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, + 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, + 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u, + 1u, 17u, 4u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, + 5u, 10u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 3u, 17u, 3u, 17u, 1u, 16u, + 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, + 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, + 3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 0 }; static const char _indic_syllable_machine_key_spans[] = { - 1, 16, 6, 4, 3, 1, 4, 3, - 1, 4, 3, 1, 4, 3, 1, 5, - 1, 1, 5, 1, 1, 5, 1, 1, - 5, 1, 1, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 1, 16, 6, - 4, 3, 1, 4, 3, 1, 4, 3, - 1, 4, 3, 1, 5, 1, 1, 5, - 1, 1, 5, 1, 1, 5, 1, 1, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 1, 16, 6, 4, 3, 1, - 4, 3, 1, 4, 3, 1, 4, 3, - 1, 5, 1, 1, 5, 1, 1, 5, - 1, 1, 5, 1, 1, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 1, 16, - 6, 4, 3, 1, 4, 3, 1, 4, - 3, 1, 4, 3, 1, 5, 1, 1, - 5, 1, 1, 5, 1, 1, 5, 1, - 1, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 4, 11, 11, 4, - 3, 4, 3, 1, 4, 3, 1, 4, - 3, 1, 1, 16, 6, 5, 1, 1, - 5, 1, 1, 5, 1, 1, 5, 1, - 1, 1, 18, 15, 15, 14, 16, 15, - 15, 14, 16, 15, 15, 14, 16, 15, - 15, 14, 16, 15, 15, 14, 10, 10, - 6, 2, 1, 2, 2, 1, 6, 11, - 8, 6, 8, 11, 12, 12, 11, 10, - 12, 11, 10, 12, 11, 10, 12, 11, - 10, 12, 16, 11, 15, 15, 16, 16, - 16, 16, 16, 15, 15, 16, 16, 16, - 16, 16, 15, 15, 16, 16, 16, 16, - 16, 15, 15, 16, 16, 16, 16, 16, - 15, 15, 15, 15, 14, 16, 15, 15, - 14, 16, 15, 15, 14, 16, 15, 15, - 14, 16, 15, 15, 14, 10, 10, 6, - 2, 1, 2, 2, 1, 6, 11, 8, - 6, 8, 11, 12, 12, 11, 10, 12, - 11, 10, 12, 11, 10, 12, 11, 10, - 12, 16, 11, 15, 15, 16, 16, 16, - 16, 16, 15, 15, 16, 16, 16, 16, - 16, 15, 15, 16, 16, 16, 16, 16, - 15, 15, 16, 16, 16, 16, 11, 16, - 15, 15, 14, 16, 15, 15, 14, 16, - 15, 15, 14, 16, 15, 15, 14, 16, - 15, 15, 14, 10, 10, 6, 2, 1, - 2, 2, 1, 6, 11, 8, 6, 8, - 11, 12, 12, 11, 10, 12, 11, 10, - 12, 11, 10, 12, 11, 10, 12, 16, - 11, 15, 15, 16, 16, 16, 16, 16, - 15, 15, 16, 16, 16, 16, 16, 15, - 15, 16, 16, 16, 16, 16, 15, 15, - 16, 16, 16, 16, 16, 11, 15, 11, - 15, 15, 14, 16, 15, 15, 14, 16, - 15, 15, 14, 16, 15, 15, 14, 16, - 15, 15, 14, 10, 10, 6, 2, 1, - 2, 2, 1, 6, 11, 8, 6, 8, - 11, 12, 12, 11, 10, 12, 11, 10, - 12, 11, 10, 12, 11, 10, 12, 16, - 11, 15, 15, 16, 16, 16, 16, 16, - 15, 15, 16, 16, 16, 16, 16, 15, - 15, 16, 16, 16, 16, 16, 15, 15, - 16, 16, 16, 16, 16, 15, 17, 15, - 17, 11, 6, 2, 1, 2, 2, 1, - 6, 16, 15, 15, 14, 15, 15, 16, - 12, 11, 10, 12, 11, 10, 12, 11, - 10, 12, 11, 10, 11, 8, 6, 8, - 11, 16, 8, 6, 6, 2, 1, 2, + 1, 16, 6, 4, 3, 1, 4, 3, + 1, 4, 3, 1, 4, 3, 1, 5, + 1, 1, 5, 1, 1, 5, 1, 1, + 5, 1, 1, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 1, 16, 6, + 4, 3, 1, 4, 3, 1, 4, 3, + 1, 4, 3, 1, 5, 1, 1, 5, + 1, 1, 5, 1, 1, 5, 1, 1, + 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 1, 16, 6, 4, 3, 1, + 4, 3, 1, 4, 3, 1, 4, 3, + 1, 5, 1, 1, 5, 1, 1, 5, + 1, 1, 5, 1, 1, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 1, 16, + 6, 4, 3, 1, 4, 3, 1, 4, + 3, 1, 4, 3, 1, 5, 1, 1, + 5, 1, 1, 5, 1, 1, 5, 1, + 1, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 4, 11, 11, 4, + 3, 4, 3, 1, 4, 3, 1, 4, + 3, 1, 1, 16, 6, 5, 1, 1, + 5, 1, 1, 5, 1, 1, 5, 1, + 1, 1, 18, 15, 15, 14, 16, 15, + 15, 14, 16, 15, 15, 14, 16, 15, + 15, 14, 16, 15, 15, 14, 10, 10, + 6, 2, 1, 2, 2, 1, 6, 11, + 8, 6, 8, 11, 12, 12, 11, 10, + 12, 11, 10, 12, 11, 10, 12, 11, + 10, 12, 16, 11, 15, 15, 16, 16, + 16, 16, 16, 15, 15, 16, 16, 16, + 16, 16, 15, 15, 16, 16, 16, 16, + 16, 15, 15, 16, 16, 16, 16, 16, + 15, 15, 15, 15, 14, 16, 15, 15, + 14, 16, 15, 15, 14, 16, 15, 15, + 14, 16, 15, 15, 14, 10, 10, 6, + 2, 1, 2, 2, 1, 6, 11, 8, + 6, 8, 11, 12, 12, 11, 10, 12, + 11, 10, 12, 11, 10, 12, 11, 10, + 12, 16, 11, 15, 15, 16, 16, 16, + 16, 16, 15, 15, 16, 16, 16, 16, + 16, 15, 15, 16, 16, 16, 16, 16, + 15, 15, 16, 16, 16, 16, 11, 16, + 15, 15, 14, 16, 15, 15, 14, 16, + 15, 15, 14, 16, 15, 15, 14, 16, + 15, 15, 14, 10, 10, 6, 2, 1, + 2, 2, 1, 6, 11, 8, 6, 8, + 11, 12, 12, 11, 10, 12, 11, 10, + 12, 11, 10, 12, 11, 10, 12, 16, + 11, 15, 15, 16, 16, 16, 16, 16, + 15, 15, 16, 16, 16, 16, 16, 15, + 15, 16, 16, 16, 16, 16, 15, 15, + 16, 16, 16, 16, 16, 11, 15, 11, + 15, 15, 14, 16, 15, 15, 14, 16, + 15, 15, 14, 16, 15, 15, 14, 16, + 15, 15, 14, 10, 10, 6, 2, 1, + 2, 2, 1, 6, 11, 8, 6, 8, + 11, 12, 12, 11, 10, 12, 11, 10, + 12, 11, 10, 12, 11, 10, 12, 16, + 11, 15, 15, 16, 16, 16, 16, 16, + 15, 15, 16, 16, 16, 16, 16, 15, + 15, 16, 16, 16, 16, 16, 15, 15, + 16, 16, 16, 16, 16, 15, 17, 15, + 17, 11, 6, 2, 1, 2, 2, 1, + 6, 16, 15, 15, 14, 15, 15, 16, + 12, 11, 10, 12, 11, 10, 12, 11, + 10, 12, 11, 10, 11, 8, 6, 8, + 11, 16, 8, 6, 6, 2, 1, 2, 2, 1, 6 }; static const short _indic_syllable_machine_index_offsets[] = { - 0, 2, 19, 26, 31, 35, 37, 42, - 46, 48, 53, 57, 59, 64, 68, 70, - 76, 78, 80, 86, 88, 90, 96, 98, - 100, 106, 108, 110, 122, 134, 146, 158, - 170, 182, 194, 206, 218, 230, 232, 249, - 256, 261, 265, 267, 272, 276, 278, 283, - 287, 289, 294, 298, 300, 306, 308, 310, - 316, 318, 320, 326, 328, 330, 336, 338, - 340, 352, 364, 376, 388, 400, 412, 424, - 436, 448, 460, 462, 479, 486, 491, 495, - 497, 502, 506, 508, 513, 517, 519, 524, - 528, 530, 536, 538, 540, 546, 548, 550, - 556, 558, 560, 566, 568, 570, 582, 594, - 606, 618, 630, 642, 654, 666, 678, 680, - 697, 704, 709, 713, 715, 720, 724, 726, - 731, 735, 737, 742, 746, 748, 754, 756, - 758, 764, 766, 768, 774, 776, 778, 784, - 786, 788, 800, 812, 824, 836, 848, 860, - 872, 884, 896, 908, 920, 925, 937, 949, - 954, 958, 963, 967, 969, 974, 978, 980, - 985, 989, 991, 993, 1010, 1017, 1023, 1025, - 1027, 1033, 1035, 1037, 1043, 1045, 1047, 1053, - 1055, 1057, 1059, 1078, 1094, 1110, 1125, 1142, - 1158, 1174, 1189, 1206, 1222, 1238, 1253, 1270, - 1286, 1302, 1317, 1334, 1350, 1366, 1381, 1392, - 1403, 1410, 1413, 1415, 1418, 1421, 1423, 1430, - 1442, 1451, 1458, 1467, 1479, 1492, 1505, 1517, - 1528, 1541, 1553, 1564, 1577, 1589, 1600, 1613, - 1625, 1636, 1649, 1666, 1678, 1694, 1710, 1727, - 1744, 1761, 1778, 1795, 1811, 1827, 1844, 1861, - 1878, 1895, 1912, 1928, 1944, 1961, 1978, 1995, - 2012, 2029, 2045, 2061, 2078, 2095, 2112, 2129, - 2146, 2162, 2178, 2194, 2210, 2225, 2242, 2258, - 2274, 2289, 2306, 2322, 2338, 2353, 2370, 2386, - 2402, 2417, 2434, 2450, 2466, 2481, 2492, 2503, - 2510, 2513, 2515, 2518, 2521, 2523, 2530, 2542, - 2551, 2558, 2567, 2579, 2592, 2605, 2617, 2628, - 2641, 2653, 2664, 2677, 2689, 2700, 2713, 2725, - 2736, 2749, 2766, 2778, 2794, 2810, 2827, 2844, - 2861, 2878, 2895, 2911, 2927, 2944, 2961, 2978, - 2995, 3012, 3028, 3044, 3061, 3078, 3095, 3112, - 3129, 3145, 3161, 3178, 3195, 3212, 3229, 3241, - 3258, 3274, 3290, 3305, 3322, 3338, 3354, 3369, - 3386, 3402, 3418, 3433, 3450, 3466, 3482, 3497, - 3514, 3530, 3546, 3561, 3572, 3583, 3590, 3593, - 3595, 3598, 3601, 3603, 3610, 3622, 3631, 3638, - 3647, 3659, 3672, 3685, 3697, 3708, 3721, 3733, - 3744, 3757, 3769, 3780, 3793, 3805, 3816, 3829, - 3846, 3858, 3874, 3890, 3907, 3924, 3941, 3958, - 3975, 3991, 4007, 4024, 4041, 4058, 4075, 4092, - 4108, 4124, 4141, 4158, 4175, 4192, 4209, 4225, - 4241, 4258, 4275, 4292, 4309, 4326, 4338, 4354, - 4366, 4382, 4398, 4413, 4430, 4446, 4462, 4477, - 4494, 4510, 4526, 4541, 4558, 4574, 4590, 4605, - 4622, 4638, 4654, 4669, 4680, 4691, 4698, 4701, - 4703, 4706, 4709, 4711, 4718, 4730, 4739, 4746, - 4755, 4767, 4780, 4793, 4805, 4816, 4829, 4841, - 4852, 4865, 4877, 4888, 4901, 4913, 4924, 4937, - 4954, 4966, 4982, 4998, 5015, 5032, 5049, 5066, - 5083, 5099, 5115, 5132, 5149, 5166, 5183, 5200, - 5216, 5232, 5249, 5266, 5283, 5300, 5317, 5333, - 5349, 5366, 5383, 5400, 5417, 5434, 5450, 5468, - 5484, 5502, 5514, 5521, 5524, 5526, 5529, 5532, - 5534, 5541, 5558, 5574, 5590, 5605, 5621, 5637, - 5654, 5667, 5679, 5690, 5703, 5715, 5726, 5739, - 5751, 5762, 5775, 5787, 5798, 5810, 5819, 5826, - 5835, 5847, 5864, 5873, 5880, 5887, 5890, 5892, + 0, 2, 19, 26, 31, 35, 37, 42, + 46, 48, 53, 57, 59, 64, 68, 70, + 76, 78, 80, 86, 88, 90, 96, 98, + 100, 106, 108, 110, 122, 134, 146, 158, + 170, 182, 194, 206, 218, 230, 232, 249, + 256, 261, 265, 267, 272, 276, 278, 283, + 287, 289, 294, 298, 300, 306, 308, 310, + 316, 318, 320, 326, 328, 330, 336, 338, + 340, 352, 364, 376, 388, 400, 412, 424, + 436, 448, 460, 462, 479, 486, 491, 495, + 497, 502, 506, 508, 513, 517, 519, 524, + 528, 530, 536, 538, 540, 546, 548, 550, + 556, 558, 560, 566, 568, 570, 582, 594, + 606, 618, 630, 642, 654, 666, 678, 680, + 697, 704, 709, 713, 715, 720, 724, 726, + 731, 735, 737, 742, 746, 748, 754, 756, + 758, 764, 766, 768, 774, 776, 778, 784, + 786, 788, 800, 812, 824, 836, 848, 860, + 872, 884, 896, 908, 920, 925, 937, 949, + 954, 958, 963, 967, 969, 974, 978, 980, + 985, 989, 991, 993, 1010, 1017, 1023, 1025, + 1027, 1033, 1035, 1037, 1043, 1045, 1047, 1053, + 1055, 1057, 1059, 1078, 1094, 1110, 1125, 1142, + 1158, 1174, 1189, 1206, 1222, 1238, 1253, 1270, + 1286, 1302, 1317, 1334, 1350, 1366, 1381, 1392, + 1403, 1410, 1413, 1415, 1418, 1421, 1423, 1430, + 1442, 1451, 1458, 1467, 1479, 1492, 1505, 1517, + 1528, 1541, 1553, 1564, 1577, 1589, 1600, 1613, + 1625, 1636, 1649, 1666, 1678, 1694, 1710, 1727, + 1744, 1761, 1778, 1795, 1811, 1827, 1844, 1861, + 1878, 1895, 1912, 1928, 1944, 1961, 1978, 1995, + 2012, 2029, 2045, 2061, 2078, 2095, 2112, 2129, + 2146, 2162, 2178, 2194, 2210, 2225, 2242, 2258, + 2274, 2289, 2306, 2322, 2338, 2353, 2370, 2386, + 2402, 2417, 2434, 2450, 2466, 2481, 2492, 2503, + 2510, 2513, 2515, 2518, 2521, 2523, 2530, 2542, + 2551, 2558, 2567, 2579, 2592, 2605, 2617, 2628, + 2641, 2653, 2664, 2677, 2689, 2700, 2713, 2725, + 2736, 2749, 2766, 2778, 2794, 2810, 2827, 2844, + 2861, 2878, 2895, 2911, 2927, 2944, 2961, 2978, + 2995, 3012, 3028, 3044, 3061, 3078, 3095, 3112, + 3129, 3145, 3161, 3178, 3195, 3212, 3229, 3241, + 3258, 3274, 3290, 3305, 3322, 3338, 3354, 3369, + 3386, 3402, 3418, 3433, 3450, 3466, 3482, 3497, + 3514, 3530, 3546, 3561, 3572, 3583, 3590, 3593, + 3595, 3598, 3601, 3603, 3610, 3622, 3631, 3638, + 3647, 3659, 3672, 3685, 3697, 3708, 3721, 3733, + 3744, 3757, 3769, 3780, 3793, 3805, 3816, 3829, + 3846, 3858, 3874, 3890, 3907, 3924, 3941, 3958, + 3975, 3991, 4007, 4024, 4041, 4058, 4075, 4092, + 4108, 4124, 4141, 4158, 4175, 4192, 4209, 4225, + 4241, 4258, 4275, 4292, 4309, 4326, 4338, 4354, + 4366, 4382, 4398, 4413, 4430, 4446, 4462, 4477, + 4494, 4510, 4526, 4541, 4558, 4574, 4590, 4605, + 4622, 4638, 4654, 4669, 4680, 4691, 4698, 4701, + 4703, 4706, 4709, 4711, 4718, 4730, 4739, 4746, + 4755, 4767, 4780, 4793, 4805, 4816, 4829, 4841, + 4852, 4865, 4877, 4888, 4901, 4913, 4924, 4937, + 4954, 4966, 4982, 4998, 5015, 5032, 5049, 5066, + 5083, 5099, 5115, 5132, 5149, 5166, 5183, 5200, + 5216, 5232, 5249, 5266, 5283, 5300, 5317, 5333, + 5349, 5366, 5383, 5400, 5417, 5434, 5450, 5468, + 5484, 5502, 5514, 5521, 5524, 5526, 5529, 5532, + 5534, 5541, 5558, 5574, 5590, 5605, 5621, 5637, + 5654, 5667, 5679, 5690, 5703, 5715, 5726, 5739, + 5751, 5762, 5775, 5787, 5798, 5810, 5819, 5826, + 5835, 5847, 5864, 5873, 5880, 5887, 5890, 5892, 5895, 5898, 5900 }; static const short _indic_syllable_machine_indicies[] = { - 1, 0, 2, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 1, 0, 0, 0, 0, - 4, 0, 5, 5, 6, 1, 0, 7, - 7, 6, 0, 6, 0, 8, 8, 9, - 1, 0, 10, 10, 9, 0, 9, 0, - 11, 11, 12, 1, 0, 13, 13, 12, - 0, 12, 0, 14, 14, 15, 1, 0, - 16, 16, 15, 0, 15, 0, 17, 0, - 0, 0, 1, 0, 18, 0, 19, 0, - 20, 14, 14, 15, 1, 0, 21, 0, - 22, 0, 23, 11, 11, 12, 1, 0, - 24, 0, 25, 0, 26, 8, 8, 9, - 1, 0, 27, 0, 28, 0, 29, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 29, 0, 29, 5, 5, 6, 1, 0, - 0, 0, 0, 30, 29, 0, 31, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 31, 0, 31, 5, 5, 6, 1, 0, - 0, 0, 0, 32, 31, 0, 33, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 33, 0, 33, 5, 5, 6, 1, 0, - 0, 0, 0, 34, 33, 0, 35, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 35, 0, 35, 5, 5, 6, 1, 0, - 0, 0, 0, 36, 35, 0, 37, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 37, 0, 37, 5, 5, 6, 1, 0, - 0, 0, 0, 38, 37, 0, 40, 39, - 41, 42, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 41, - 39, 40, 39, 39, 39, 39, 43, 39, - 44, 44, 45, 40, 39, 46, 46, 45, - 39, 45, 39, 47, 47, 48, 40, 39, - 49, 49, 48, 39, 48, 39, 50, 50, - 51, 40, 39, 52, 52, 51, 39, 51, - 39, 53, 53, 54, 40, 39, 55, 55, - 54, 39, 54, 39, 56, 39, 39, 39, - 40, 39, 57, 39, 58, 39, 59, 53, - 53, 54, 40, 39, 60, 39, 61, 39, - 62, 50, 50, 51, 40, 39, 63, 39, - 64, 39, 65, 47, 47, 48, 40, 39, - 66, 39, 67, 39, 68, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 68, 39, - 68, 44, 44, 45, 40, 39, 39, 39, - 39, 69, 68, 39, 70, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 70, 39, - 70, 44, 44, 45, 40, 39, 39, 39, - 39, 71, 70, 39, 72, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 72, 39, - 72, 44, 44, 45, 40, 39, 39, 39, - 39, 73, 72, 39, 74, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 74, 39, - 74, 44, 44, 45, 40, 39, 39, 39, - 39, 75, 74, 39, 76, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 76, 39, - 76, 44, 44, 45, 40, 39, 39, 39, - 39, 77, 76, 39, 79, 78, 80, 81, - 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 80, 78, 79, - 78, 78, 78, 78, 82, 78, 83, 83, - 84, 79, 78, 86, 86, 84, 85, 84, - 85, 87, 87, 88, 79, 78, 89, 89, - 88, 78, 88, 78, 90, 90, 91, 79, - 78, 92, 92, 91, 78, 91, 78, 93, - 93, 94, 79, 78, 95, 95, 94, 78, - 94, 78, 96, 78, 78, 78, 79, 78, - 97, 78, 98, 78, 99, 93, 93, 94, - 79, 78, 100, 78, 101, 78, 102, 90, - 90, 91, 79, 78, 103, 78, 104, 78, - 105, 87, 87, 88, 79, 78, 106, 78, - 107, 78, 108, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 108, 78, 108, 83, - 83, 84, 79, 78, 78, 78, 78, 109, - 108, 78, 110, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 110, 78, 110, 83, - 83, 84, 79, 78, 78, 78, 78, 111, - 110, 78, 112, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 112, 78, 112, 83, - 83, 84, 79, 78, 78, 78, 78, 113, - 112, 78, 114, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 114, 78, 114, 83, - 83, 84, 79, 78, 78, 78, 78, 115, - 114, 78, 116, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 116, 78, 118, 117, - 119, 120, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 119, - 117, 118, 117, 117, 117, 117, 121, 117, - 122, 122, 123, 118, 117, 124, 124, 123, - 117, 123, 117, 125, 125, 126, 118, 117, - 127, 127, 126, 117, 126, 117, 128, 128, - 129, 118, 117, 130, 130, 129, 117, 129, - 117, 131, 131, 132, 118, 117, 133, 133, - 132, 117, 132, 117, 134, 117, 117, 117, - 118, 117, 135, 117, 136, 117, 137, 131, - 131, 132, 118, 117, 138, 117, 139, 117, - 140, 128, 128, 129, 118, 117, 141, 117, - 142, 117, 143, 125, 125, 126, 118, 117, - 144, 117, 145, 117, 146, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 146, 117, - 146, 122, 122, 123, 118, 117, 117, 117, - 117, 147, 146, 117, 148, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 148, 117, - 148, 122, 122, 123, 118, 117, 117, 117, - 117, 149, 148, 117, 150, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 150, 117, - 150, 122, 122, 123, 118, 117, 117, 117, - 117, 151, 150, 117, 152, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 152, 117, - 152, 122, 122, 123, 118, 117, 117, 117, - 117, 153, 152, 117, 154, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 154, 117, - 154, 122, 122, 123, 118, 117, 117, 117, - 117, 155, 154, 117, 116, 83, 83, 84, - 79, 78, 78, 78, 78, 156, 116, 78, - 86, 86, 84, 1, 0, 114, 83, 83, - 84, 157, 0, 0, 0, 0, 0, 114, - 0, 114, 83, 83, 84, 157, 0, 0, - 0, 0, 158, 114, 0, 159, 159, 160, - 1, 0, 7, 7, 160, 0, 161, 161, - 162, 157, 0, 163, 163, 162, 0, 162, - 0, 164, 164, 165, 157, 0, 166, 166, - 165, 0, 165, 0, 167, 167, 168, 157, - 0, 169, 169, 168, 0, 168, 0, 157, - 0, 170, 171, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 170, 0, 157, 0, 0, 0, 0, 172, - 0, 173, 0, 0, 0, 157, 0, 174, - 0, 175, 0, 176, 167, 167, 168, 157, - 0, 177, 0, 178, 0, 179, 164, 164, - 165, 157, 0, 180, 0, 181, 0, 182, - 161, 161, 162, 157, 0, 183, 0, 184, - 0, 186, 185, 188, 189, 190, 191, 192, - 193, 84, 79, 194, 195, 196, 196, 156, - 197, 198, 199, 200, 201, 187, 203, 204, - 205, 206, 6, 1, 207, 208, 202, 202, - 38, 209, 202, 202, 210, 202, 211, 204, - 212, 212, 6, 1, 207, 208, 202, 202, - 202, 209, 202, 202, 210, 202, 204, 212, - 212, 6, 1, 207, 208, 202, 202, 202, - 209, 202, 202, 210, 202, 213, 202, 202, - 202, 19, 214, 202, 1, 207, 208, 202, - 202, 202, 215, 202, 213, 202, 216, 217, - 218, 219, 6, 1, 207, 208, 202, 202, - 36, 220, 202, 202, 210, 202, 221, 217, - 222, 222, 6, 1, 207, 208, 202, 202, - 202, 220, 202, 202, 210, 202, 217, 222, - 222, 6, 1, 207, 208, 202, 202, 202, - 220, 202, 202, 210, 202, 223, 202, 202, - 202, 19, 224, 202, 1, 207, 208, 202, - 202, 202, 215, 202, 223, 202, 225, 226, - 227, 228, 6, 1, 207, 208, 202, 202, - 34, 229, 202, 202, 210, 202, 230, 226, - 231, 231, 6, 1, 207, 208, 202, 202, - 202, 229, 202, 202, 210, 202, 226, 231, - 231, 6, 1, 207, 208, 202, 202, 202, - 229, 202, 202, 210, 202, 232, 202, 202, - 202, 19, 233, 202, 1, 207, 208, 202, - 202, 202, 215, 202, 232, 202, 234, 235, - 236, 237, 6, 1, 207, 208, 202, 202, - 32, 238, 202, 202, 210, 202, 239, 235, - 240, 240, 6, 1, 207, 208, 202, 202, - 202, 238, 202, 202, 210, 202, 235, 240, - 240, 6, 1, 207, 208, 202, 202, 202, - 238, 202, 202, 210, 202, 241, 202, 202, - 202, 19, 242, 202, 1, 207, 208, 202, - 202, 202, 215, 202, 241, 202, 243, 244, - 245, 246, 6, 1, 207, 208, 202, 202, - 30, 247, 202, 202, 210, 202, 248, 244, - 249, 249, 6, 1, 207, 208, 202, 202, - 202, 247, 202, 202, 210, 202, 244, 249, - 249, 6, 1, 207, 208, 202, 202, 202, - 247, 202, 202, 210, 202, 19, 250, 202, - 1, 207, 208, 202, 202, 202, 215, 202, - 251, 251, 202, 1, 207, 208, 202, 202, - 202, 215, 202, 252, 202, 202, 253, 207, - 208, 202, 207, 208, 202, 254, 202, 207, - 255, 202, 207, 256, 202, 207, 202, 252, - 202, 202, 202, 207, 208, 202, 257, 202, - 258, 259, 202, 1, 207, 208, 202, 202, - 4, 202, 3, 202, 251, 251, 202, 1, - 207, 208, 202, 251, 251, 202, 1, 207, - 208, 202, 257, 202, 251, 251, 202, 1, - 207, 208, 202, 257, 202, 258, 251, 202, - 1, 207, 208, 202, 202, 4, 202, 19, - 202, 260, 260, 6, 1, 207, 208, 202, - 202, 202, 215, 202, 261, 28, 262, 263, - 9, 1, 207, 208, 202, 202, 202, 215, - 202, 28, 262, 263, 9, 1, 207, 208, - 202, 202, 202, 215, 202, 262, 262, 9, - 1, 207, 208, 202, 202, 202, 215, 202, - 264, 25, 265, 266, 12, 1, 207, 208, - 202, 202, 202, 215, 202, 25, 265, 266, - 12, 1, 207, 208, 202, 202, 202, 215, - 202, 265, 265, 12, 1, 207, 208, 202, - 202, 202, 215, 202, 267, 22, 268, 269, - 15, 1, 207, 208, 202, 202, 202, 215, - 202, 22, 268, 269, 15, 1, 207, 208, - 202, 202, 202, 215, 202, 268, 268, 15, - 1, 207, 208, 202, 202, 202, 215, 202, - 270, 19, 251, 271, 202, 1, 207, 208, - 202, 202, 202, 215, 202, 19, 251, 271, - 202, 1, 207, 208, 202, 202, 202, 215, - 202, 251, 272, 202, 1, 207, 208, 202, - 202, 202, 215, 202, 19, 202, 251, 251, - 202, 1, 207, 208, 202, 202, 202, 215, - 202, 2, 3, 202, 202, 19, 250, 202, - 1, 207, 208, 202, 202, 202, 215, 202, - 2, 202, 244, 249, 249, 6, 1, 207, - 208, 202, 202, 202, 247, 202, 243, 244, - 249, 249, 6, 1, 207, 208, 202, 202, - 202, 247, 202, 202, 210, 202, 243, 244, - 245, 249, 6, 1, 207, 208, 202, 202, - 30, 247, 202, 202, 210, 202, 241, 202, - 273, 202, 260, 260, 6, 1, 207, 208, - 202, 202, 202, 215, 202, 241, 202, 241, - 202, 202, 202, 251, 251, 202, 1, 207, - 208, 202, 202, 202, 215, 202, 241, 202, - 241, 202, 202, 202, 251, 274, 202, 1, - 207, 208, 202, 202, 202, 215, 202, 241, - 202, 241, 202, 273, 202, 251, 251, 202, - 1, 207, 208, 202, 202, 202, 215, 202, - 241, 202, 241, 3, 202, 202, 19, 242, - 202, 1, 207, 208, 202, 202, 202, 215, - 202, 241, 202, 234, 235, 240, 240, 6, - 1, 207, 208, 202, 202, 202, 238, 202, - 202, 210, 202, 234, 235, 236, 240, 6, - 1, 207, 208, 202, 202, 32, 238, 202, - 202, 210, 202, 232, 202, 275, 202, 260, - 260, 6, 1, 207, 208, 202, 202, 202, - 215, 202, 232, 202, 232, 202, 202, 202, - 251, 251, 202, 1, 207, 208, 202, 202, - 202, 215, 202, 232, 202, 232, 202, 202, - 202, 251, 276, 202, 1, 207, 208, 202, - 202, 202, 215, 202, 232, 202, 232, 202, - 275, 202, 251, 251, 202, 1, 207, 208, - 202, 202, 202, 215, 202, 232, 202, 232, - 3, 202, 202, 19, 233, 202, 1, 207, - 208, 202, 202, 202, 215, 202, 232, 202, - 225, 226, 231, 231, 6, 1, 207, 208, - 202, 202, 202, 229, 202, 202, 210, 202, - 225, 226, 227, 231, 6, 1, 207, 208, - 202, 202, 34, 229, 202, 202, 210, 202, - 223, 202, 277, 202, 260, 260, 6, 1, - 207, 208, 202, 202, 202, 215, 202, 223, - 202, 223, 202, 202, 202, 251, 251, 202, - 1, 207, 208, 202, 202, 202, 215, 202, - 223, 202, 223, 202, 202, 202, 251, 278, - 202, 1, 207, 208, 202, 202, 202, 215, - 202, 223, 202, 223, 202, 277, 202, 251, - 251, 202, 1, 207, 208, 202, 202, 202, - 215, 202, 223, 202, 223, 3, 202, 202, - 19, 224, 202, 1, 207, 208, 202, 202, - 202, 215, 202, 223, 202, 216, 217, 222, - 222, 6, 1, 207, 208, 202, 202, 202, - 220, 202, 202, 210, 202, 216, 217, 218, - 222, 6, 1, 207, 208, 202, 202, 36, - 220, 202, 202, 210, 202, 213, 202, 279, - 202, 260, 260, 6, 1, 207, 208, 202, - 202, 202, 215, 202, 213, 202, 213, 202, - 202, 202, 251, 251, 202, 1, 207, 208, - 202, 202, 202, 215, 202, 213, 202, 213, - 202, 202, 202, 251, 280, 202, 1, 207, - 208, 202, 202, 202, 215, 202, 213, 202, - 213, 202, 279, 202, 251, 251, 202, 1, - 207, 208, 202, 202, 202, 215, 202, 213, - 202, 213, 3, 202, 202, 19, 214, 202, - 1, 207, 208, 202, 202, 202, 215, 202, - 213, 202, 203, 204, 212, 212, 6, 1, - 207, 208, 202, 202, 202, 209, 202, 202, - 210, 202, 203, 204, 205, 212, 6, 1, - 207, 208, 202, 202, 38, 209, 202, 202, - 210, 202, 282, 283, 284, 285, 45, 40, - 286, 287, 281, 281, 77, 288, 281, 281, - 289, 281, 290, 283, 291, 285, 45, 40, - 286, 287, 281, 281, 281, 288, 281, 281, - 289, 281, 283, 291, 285, 45, 40, 286, - 287, 281, 281, 281, 288, 281, 281, 289, - 281, 292, 281, 281, 281, 58, 293, 281, - 40, 286, 287, 281, 281, 281, 294, 281, - 292, 281, 295, 296, 297, 298, 45, 40, - 286, 287, 281, 281, 75, 299, 281, 281, - 289, 281, 300, 296, 301, 301, 45, 40, - 286, 287, 281, 281, 281, 299, 281, 281, - 289, 281, 296, 301, 301, 45, 40, 286, - 287, 281, 281, 281, 299, 281, 281, 289, - 281, 302, 281, 281, 281, 58, 303, 281, - 40, 286, 287, 281, 281, 281, 294, 281, - 302, 281, 304, 305, 306, 307, 45, 40, - 286, 287, 281, 281, 73, 308, 281, 281, - 289, 281, 309, 305, 310, 310, 45, 40, - 286, 287, 281, 281, 281, 308, 281, 281, - 289, 281, 305, 310, 310, 45, 40, 286, - 287, 281, 281, 281, 308, 281, 281, 289, - 281, 311, 281, 281, 281, 58, 312, 281, - 40, 286, 287, 281, 281, 281, 294, 281, - 311, 281, 313, 314, 315, 316, 45, 40, - 286, 287, 281, 281, 71, 317, 281, 281, - 289, 281, 318, 314, 319, 319, 45, 40, - 286, 287, 281, 281, 281, 317, 281, 281, - 289, 281, 314, 319, 319, 45, 40, 286, - 287, 281, 281, 281, 317, 281, 281, 289, - 281, 320, 281, 281, 281, 58, 321, 281, - 40, 286, 287, 281, 281, 281, 294, 281, - 320, 281, 322, 323, 324, 325, 45, 40, - 286, 287, 281, 281, 69, 326, 281, 281, - 289, 281, 327, 323, 328, 328, 45, 40, - 286, 287, 281, 281, 281, 326, 281, 281, - 289, 281, 323, 328, 328, 45, 40, 286, - 287, 281, 281, 281, 326, 281, 281, 289, - 281, 58, 329, 281, 40, 286, 287, 281, - 281, 281, 294, 281, 330, 330, 281, 40, - 286, 287, 281, 281, 281, 294, 281, 331, - 281, 281, 332, 286, 287, 281, 286, 287, - 281, 333, 281, 286, 334, 281, 286, 335, - 281, 286, 281, 331, 281, 281, 281, 286, - 287, 281, 336, 281, 337, 338, 281, 40, - 286, 287, 281, 281, 43, 281, 42, 281, - 330, 330, 281, 40, 286, 287, 281, 330, - 330, 281, 40, 286, 287, 281, 336, 281, - 330, 330, 281, 40, 286, 287, 281, 336, - 281, 337, 330, 281, 40, 286, 287, 281, - 281, 43, 281, 58, 281, 339, 339, 45, - 40, 286, 287, 281, 281, 281, 294, 281, - 340, 67, 341, 342, 48, 40, 286, 287, - 281, 281, 281, 294, 281, 67, 341, 342, - 48, 40, 286, 287, 281, 281, 281, 294, - 281, 341, 341, 48, 40, 286, 287, 281, - 281, 281, 294, 281, 343, 64, 344, 345, - 51, 40, 286, 287, 281, 281, 281, 294, - 281, 64, 344, 345, 51, 40, 286, 287, - 281, 281, 281, 294, 281, 344, 344, 51, - 40, 286, 287, 281, 281, 281, 294, 281, - 346, 61, 347, 348, 54, 40, 286, 287, - 281, 281, 281, 294, 281, 61, 347, 348, - 54, 40, 286, 287, 281, 281, 281, 294, - 281, 347, 347, 54, 40, 286, 287, 281, - 281, 281, 294, 281, 349, 58, 330, 350, - 281, 40, 286, 287, 281, 281, 281, 294, - 281, 58, 330, 350, 281, 40, 286, 287, - 281, 281, 281, 294, 281, 330, 351, 281, - 40, 286, 287, 281, 281, 281, 294, 281, - 58, 281, 330, 330, 281, 40, 286, 287, - 281, 281, 281, 294, 281, 41, 42, 281, - 281, 58, 329, 281, 40, 286, 287, 281, - 281, 281, 294, 281, 41, 281, 323, 328, - 328, 45, 40, 286, 287, 281, 281, 281, - 326, 281, 322, 323, 328, 328, 45, 40, - 286, 287, 281, 281, 281, 326, 281, 281, - 289, 281, 322, 323, 324, 328, 45, 40, - 286, 287, 281, 281, 69, 326, 281, 281, - 289, 281, 320, 281, 352, 281, 339, 339, - 45, 40, 286, 287, 281, 281, 281, 294, - 281, 320, 281, 320, 281, 281, 281, 330, - 330, 281, 40, 286, 287, 281, 281, 281, - 294, 281, 320, 281, 320, 281, 281, 281, - 330, 353, 281, 40, 286, 287, 281, 281, - 281, 294, 281, 320, 281, 320, 281, 352, - 281, 330, 330, 281, 40, 286, 287, 281, - 281, 281, 294, 281, 320, 281, 320, 42, - 281, 281, 58, 321, 281, 40, 286, 287, - 281, 281, 281, 294, 281, 320, 281, 313, - 314, 319, 319, 45, 40, 286, 287, 281, - 281, 281, 317, 281, 281, 289, 281, 313, - 314, 315, 319, 45, 40, 286, 287, 281, - 281, 71, 317, 281, 281, 289, 281, 311, - 281, 354, 281, 339, 339, 45, 40, 286, - 287, 281, 281, 281, 294, 281, 311, 281, - 311, 281, 281, 281, 330, 330, 281, 40, - 286, 287, 281, 281, 281, 294, 281, 311, - 281, 311, 281, 281, 281, 330, 355, 281, - 40, 286, 287, 281, 281, 281, 294, 281, - 311, 281, 311, 281, 354, 281, 330, 330, - 281, 40, 286, 287, 281, 281, 281, 294, - 281, 311, 281, 311, 42, 281, 281, 58, - 312, 281, 40, 286, 287, 281, 281, 281, - 294, 281, 311, 281, 304, 305, 310, 310, - 45, 40, 286, 287, 281, 281, 281, 308, - 281, 281, 289, 281, 304, 305, 306, 310, - 45, 40, 286, 287, 281, 281, 73, 308, - 281, 281, 289, 281, 302, 281, 356, 281, - 339, 339, 45, 40, 286, 287, 281, 281, - 281, 294, 281, 302, 281, 302, 281, 281, - 281, 330, 330, 281, 40, 286, 287, 281, - 281, 281, 294, 281, 302, 281, 302, 281, - 281, 281, 330, 357, 281, 40, 286, 287, - 281, 281, 281, 294, 281, 302, 281, 302, - 281, 356, 281, 330, 330, 281, 40, 286, - 287, 281, 281, 281, 294, 281, 302, 281, - 302, 42, 281, 281, 58, 303, 281, 40, - 286, 287, 281, 281, 281, 294, 281, 302, - 281, 295, 296, 301, 301, 45, 40, 286, - 287, 281, 281, 281, 299, 281, 281, 289, - 281, 295, 296, 297, 301, 45, 40, 286, - 287, 281, 281, 75, 299, 281, 281, 289, - 281, 292, 281, 358, 281, 339, 339, 45, - 40, 286, 287, 281, 281, 281, 294, 281, - 292, 281, 292, 281, 281, 281, 330, 330, - 281, 40, 286, 287, 281, 281, 281, 294, - 281, 292, 281, 292, 281, 281, 281, 330, - 359, 281, 40, 286, 287, 281, 281, 281, - 294, 281, 292, 281, 292, 281, 358, 281, - 330, 330, 281, 40, 286, 287, 281, 281, - 281, 294, 281, 292, 281, 76, 44, 44, - 45, 40, 281, 281, 281, 281, 281, 76, - 281, 292, 42, 281, 281, 58, 293, 281, - 40, 286, 287, 281, 281, 281, 294, 281, - 292, 281, 282, 283, 291, 285, 45, 40, - 286, 287, 281, 281, 281, 288, 281, 281, - 289, 281, 361, 191, 362, 362, 84, 79, - 194, 195, 360, 360, 360, 197, 360, 360, - 200, 360, 191, 362, 362, 84, 79, 194, - 195, 360, 360, 360, 197, 360, 360, 200, - 360, 363, 360, 360, 360, 98, 364, 360, - 79, 194, 195, 360, 360, 360, 365, 360, - 363, 360, 366, 367, 368, 369, 84, 79, - 194, 195, 360, 360, 115, 370, 360, 360, - 200, 360, 371, 367, 372, 372, 84, 79, - 194, 195, 360, 360, 360, 370, 360, 360, - 200, 360, 367, 372, 372, 84, 79, 194, - 195, 360, 360, 360, 370, 360, 360, 200, - 360, 373, 360, 360, 360, 98, 374, 360, - 79, 194, 195, 360, 360, 360, 365, 360, - 373, 360, 375, 376, 377, 378, 84, 79, - 194, 195, 360, 360, 113, 379, 360, 360, - 200, 360, 380, 376, 381, 381, 84, 79, - 194, 195, 360, 360, 360, 379, 360, 360, - 200, 360, 376, 381, 381, 84, 79, 194, - 195, 360, 360, 360, 379, 360, 360, 200, - 360, 382, 360, 360, 360, 98, 383, 360, - 79, 194, 195, 360, 360, 360, 365, 360, - 382, 360, 384, 385, 386, 387, 84, 79, - 194, 195, 360, 360, 111, 388, 360, 360, - 200, 360, 389, 385, 390, 390, 84, 79, - 194, 195, 360, 360, 360, 388, 360, 360, - 200, 360, 385, 390, 390, 84, 79, 194, - 195, 360, 360, 360, 388, 360, 360, 200, - 360, 391, 360, 360, 360, 98, 392, 360, - 79, 194, 195, 360, 360, 360, 365, 360, - 391, 360, 393, 394, 395, 396, 84, 79, - 194, 195, 360, 360, 109, 397, 360, 360, - 200, 360, 398, 394, 399, 399, 84, 79, - 194, 195, 360, 360, 360, 397, 360, 360, - 200, 360, 394, 399, 399, 84, 79, 194, - 195, 360, 360, 360, 397, 360, 360, 200, - 360, 98, 400, 360, 79, 194, 195, 360, - 360, 360, 365, 360, 401, 401, 360, 79, - 194, 195, 360, 360, 360, 365, 360, 402, - 360, 360, 403, 194, 195, 360, 194, 195, - 360, 404, 360, 194, 405, 360, 194, 406, - 360, 194, 360, 402, 360, 360, 360, 194, - 195, 360, 407, 360, 408, 409, 360, 79, - 194, 195, 360, 360, 82, 360, 81, 360, - 401, 401, 360, 79, 194, 195, 360, 401, - 401, 360, 79, 194, 195, 360, 407, 360, - 401, 401, 360, 79, 194, 195, 360, 407, - 360, 408, 401, 360, 79, 194, 195, 360, - 360, 82, 360, 98, 360, 410, 410, 84, - 79, 194, 195, 360, 360, 360, 365, 360, - 411, 107, 412, 413, 88, 79, 194, 195, - 360, 360, 360, 365, 360, 107, 412, 413, - 88, 79, 194, 195, 360, 360, 360, 365, - 360, 412, 412, 88, 79, 194, 195, 360, - 360, 360, 365, 360, 414, 104, 415, 416, - 91, 79, 194, 195, 360, 360, 360, 365, - 360, 104, 415, 416, 91, 79, 194, 195, - 360, 360, 360, 365, 360, 415, 415, 91, - 79, 194, 195, 360, 360, 360, 365, 360, - 417, 101, 418, 419, 94, 79, 194, 195, - 360, 360, 360, 365, 360, 101, 418, 419, - 94, 79, 194, 195, 360, 360, 360, 365, - 360, 418, 418, 94, 79, 194, 195, 360, - 360, 360, 365, 360, 420, 98, 401, 421, - 360, 79, 194, 195, 360, 360, 360, 365, - 360, 98, 401, 421, 360, 79, 194, 195, - 360, 360, 360, 365, 360, 401, 422, 360, - 79, 194, 195, 360, 360, 360, 365, 360, - 98, 360, 401, 401, 360, 79, 194, 195, - 360, 360, 360, 365, 360, 80, 81, 360, - 360, 98, 400, 360, 79, 194, 195, 360, - 360, 360, 365, 360, 80, 360, 394, 399, - 399, 84, 79, 194, 195, 360, 360, 360, - 397, 360, 393, 394, 399, 399, 84, 79, - 194, 195, 360, 360, 360, 397, 360, 360, - 200, 360, 393, 394, 395, 399, 84, 79, - 194, 195, 360, 360, 109, 397, 360, 360, - 200, 360, 391, 360, 423, 360, 410, 410, - 84, 79, 194, 195, 360, 360, 360, 365, - 360, 391, 360, 391, 360, 360, 360, 401, - 401, 360, 79, 194, 195, 360, 360, 360, - 365, 360, 391, 360, 391, 360, 360, 360, - 401, 424, 360, 79, 194, 195, 360, 360, - 360, 365, 360, 391, 360, 391, 360, 423, - 360, 401, 401, 360, 79, 194, 195, 360, - 360, 360, 365, 360, 391, 360, 391, 81, - 360, 360, 98, 392, 360, 79, 194, 195, - 360, 360, 360, 365, 360, 391, 360, 384, - 385, 390, 390, 84, 79, 194, 195, 360, - 360, 360, 388, 360, 360, 200, 360, 384, - 385, 386, 390, 84, 79, 194, 195, 360, - 360, 111, 388, 360, 360, 200, 360, 382, - 360, 425, 360, 410, 410, 84, 79, 194, - 195, 360, 360, 360, 365, 360, 382, 360, - 382, 360, 360, 360, 401, 401, 360, 79, - 194, 195, 360, 360, 360, 365, 360, 382, - 360, 382, 360, 360, 360, 401, 426, 360, - 79, 194, 195, 360, 360, 360, 365, 360, - 382, 360, 382, 360, 425, 360, 401, 401, - 360, 79, 194, 195, 360, 360, 360, 365, - 360, 382, 360, 382, 81, 360, 360, 98, - 383, 360, 79, 194, 195, 360, 360, 360, - 365, 360, 382, 360, 375, 376, 381, 381, - 84, 79, 194, 195, 360, 360, 360, 379, - 360, 360, 200, 360, 375, 376, 377, 381, - 84, 79, 194, 195, 360, 360, 113, 379, - 360, 360, 200, 360, 373, 360, 427, 360, - 410, 410, 84, 79, 194, 195, 360, 360, - 360, 365, 360, 373, 360, 373, 360, 360, - 360, 401, 401, 360, 79, 194, 195, 360, - 360, 360, 365, 360, 373, 360, 373, 360, - 360, 360, 401, 428, 360, 79, 194, 195, - 360, 360, 360, 365, 360, 373, 360, 373, - 360, 427, 360, 401, 401, 360, 79, 194, - 195, 360, 360, 360, 365, 360, 373, 360, - 373, 81, 360, 360, 98, 374, 360, 79, - 194, 195, 360, 360, 360, 365, 360, 373, - 360, 366, 367, 372, 372, 84, 79, 194, - 195, 360, 360, 360, 370, 360, 360, 200, - 360, 366, 367, 368, 372, 84, 79, 194, - 195, 360, 360, 115, 370, 360, 360, 200, - 360, 363, 360, 429, 360, 410, 410, 84, - 79, 194, 195, 360, 360, 360, 365, 360, - 363, 360, 363, 360, 360, 360, 401, 401, - 360, 79, 194, 195, 360, 360, 360, 365, - 360, 363, 360, 363, 360, 360, 360, 401, - 430, 360, 79, 194, 195, 360, 360, 360, - 365, 360, 363, 360, 363, 360, 429, 360, - 401, 401, 360, 79, 194, 195, 360, 360, - 360, 365, 360, 363, 360, 363, 81, 360, - 360, 98, 364, 360, 79, 194, 195, 360, - 360, 360, 365, 360, 363, 360, 116, 83, - 83, 84, 79, 431, 431, 431, 431, 156, - 116, 431, 190, 191, 362, 362, 84, 79, - 194, 195, 360, 360, 360, 197, 360, 360, - 200, 360, 116, 83, 83, 84, 79, 431, - 431, 431, 431, 431, 116, 431, 433, 434, - 435, 436, 123, 118, 437, 438, 432, 432, - 155, 439, 432, 432, 440, 432, 441, 434, - 436, 436, 123, 118, 437, 438, 432, 432, - 432, 439, 432, 432, 440, 432, 434, 436, - 436, 123, 118, 437, 438, 432, 432, 432, - 439, 432, 432, 440, 432, 442, 432, 432, - 432, 136, 443, 432, 118, 437, 438, 432, - 432, 432, 444, 432, 442, 432, 445, 446, - 447, 448, 123, 118, 437, 438, 432, 432, - 153, 449, 432, 432, 440, 432, 450, 446, - 451, 451, 123, 118, 437, 438, 432, 432, - 432, 449, 432, 432, 440, 432, 446, 451, - 451, 123, 118, 437, 438, 432, 432, 432, - 449, 432, 432, 440, 432, 452, 432, 432, - 432, 136, 453, 432, 118, 437, 438, 432, - 432, 432, 444, 432, 452, 432, 454, 455, - 456, 457, 123, 118, 437, 438, 432, 432, - 151, 458, 432, 432, 440, 432, 459, 455, - 460, 460, 123, 118, 437, 438, 432, 432, - 432, 458, 432, 432, 440, 432, 455, 460, - 460, 123, 118, 437, 438, 432, 432, 432, - 458, 432, 432, 440, 432, 461, 432, 432, - 432, 136, 462, 432, 118, 437, 438, 432, - 432, 432, 444, 432, 461, 432, 463, 464, - 465, 466, 123, 118, 437, 438, 432, 432, - 149, 467, 432, 432, 440, 432, 468, 464, - 469, 469, 123, 118, 437, 438, 432, 432, - 432, 467, 432, 432, 440, 432, 464, 469, - 469, 123, 118, 437, 438, 432, 432, 432, - 467, 432, 432, 440, 432, 470, 432, 432, - 432, 136, 471, 432, 118, 437, 438, 432, - 432, 432, 444, 432, 470, 432, 472, 473, - 474, 475, 123, 118, 437, 438, 432, 432, - 147, 476, 432, 432, 440, 432, 477, 473, - 478, 478, 123, 118, 437, 438, 432, 432, - 432, 476, 432, 432, 440, 432, 473, 478, - 478, 123, 118, 437, 438, 432, 432, 432, - 476, 432, 432, 440, 432, 136, 479, 432, - 118, 437, 438, 432, 432, 432, 444, 432, - 480, 480, 432, 118, 437, 438, 432, 432, - 432, 444, 432, 481, 432, 432, 482, 437, - 438, 432, 437, 438, 432, 483, 432, 437, - 484, 432, 437, 485, 432, 437, 432, 481, - 432, 432, 432, 437, 438, 432, 486, 432, - 487, 488, 432, 118, 437, 438, 432, 432, - 121, 432, 120, 432, 480, 480, 432, 118, - 437, 438, 432, 480, 480, 432, 118, 437, - 438, 432, 486, 432, 480, 480, 432, 118, - 437, 438, 432, 486, 432, 487, 480, 432, - 118, 437, 438, 432, 432, 121, 432, 136, - 432, 489, 489, 123, 118, 437, 438, 432, - 432, 432, 444, 432, 490, 145, 491, 492, - 126, 118, 437, 438, 432, 432, 432, 444, - 432, 145, 491, 492, 126, 118, 437, 438, - 432, 432, 432, 444, 432, 491, 491, 126, - 118, 437, 438, 432, 432, 432, 444, 432, - 493, 142, 494, 495, 129, 118, 437, 438, - 432, 432, 432, 444, 432, 142, 494, 495, - 129, 118, 437, 438, 432, 432, 432, 444, - 432, 494, 494, 129, 118, 437, 438, 432, - 432, 432, 444, 432, 496, 139, 497, 498, - 132, 118, 437, 438, 432, 432, 432, 444, - 432, 139, 497, 498, 132, 118, 437, 438, - 432, 432, 432, 444, 432, 497, 497, 132, - 118, 437, 438, 432, 432, 432, 444, 432, - 499, 136, 480, 500, 432, 118, 437, 438, - 432, 432, 432, 444, 432, 136, 480, 500, - 432, 118, 437, 438, 432, 432, 432, 444, - 432, 480, 501, 432, 118, 437, 438, 432, - 432, 432, 444, 432, 136, 432, 480, 480, - 432, 118, 437, 438, 432, 432, 432, 444, - 432, 119, 120, 432, 432, 136, 479, 432, - 118, 437, 438, 432, 432, 432, 444, 432, - 119, 432, 473, 478, 478, 123, 118, 437, - 438, 432, 432, 432, 476, 432, 472, 473, - 478, 478, 123, 118, 437, 438, 432, 432, - 432, 476, 432, 432, 440, 432, 472, 473, - 474, 478, 123, 118, 437, 438, 432, 432, - 147, 476, 432, 432, 440, 432, 470, 432, - 502, 432, 489, 489, 123, 118, 437, 438, - 432, 432, 432, 444, 432, 470, 432, 470, - 432, 432, 432, 480, 480, 432, 118, 437, - 438, 432, 432, 432, 444, 432, 470, 432, - 470, 432, 432, 432, 480, 503, 432, 118, - 437, 438, 432, 432, 432, 444, 432, 470, - 432, 470, 432, 502, 432, 480, 480, 432, - 118, 437, 438, 432, 432, 432, 444, 432, - 470, 432, 470, 120, 432, 432, 136, 471, - 432, 118, 437, 438, 432, 432, 432, 444, - 432, 470, 432, 463, 464, 469, 469, 123, - 118, 437, 438, 432, 432, 432, 467, 432, - 432, 440, 432, 463, 464, 465, 469, 123, - 118, 437, 438, 432, 432, 149, 467, 432, - 432, 440, 432, 461, 432, 504, 432, 489, - 489, 123, 118, 437, 438, 432, 432, 432, - 444, 432, 461, 432, 461, 432, 432, 432, - 480, 480, 432, 118, 437, 438, 432, 432, - 432, 444, 432, 461, 432, 461, 432, 432, - 432, 480, 505, 432, 118, 437, 438, 432, - 432, 432, 444, 432, 461, 432, 461, 432, - 504, 432, 480, 480, 432, 118, 437, 438, - 432, 432, 432, 444, 432, 461, 432, 461, - 120, 432, 432, 136, 462, 432, 118, 437, - 438, 432, 432, 432, 444, 432, 461, 432, - 454, 455, 460, 460, 123, 118, 437, 438, - 432, 432, 432, 458, 432, 432, 440, 432, - 454, 455, 456, 460, 123, 118, 437, 438, - 432, 432, 151, 458, 432, 432, 440, 432, - 452, 432, 506, 432, 489, 489, 123, 118, - 437, 438, 432, 432, 432, 444, 432, 452, - 432, 452, 432, 432, 432, 480, 480, 432, - 118, 437, 438, 432, 432, 432, 444, 432, - 452, 432, 452, 432, 432, 432, 480, 507, - 432, 118, 437, 438, 432, 432, 432, 444, - 432, 452, 432, 452, 432, 506, 432, 480, - 480, 432, 118, 437, 438, 432, 432, 432, - 444, 432, 452, 432, 452, 120, 432, 432, - 136, 453, 432, 118, 437, 438, 432, 432, - 432, 444, 432, 452, 432, 445, 446, 451, - 451, 123, 118, 437, 438, 432, 432, 432, - 449, 432, 432, 440, 432, 445, 446, 447, - 451, 123, 118, 437, 438, 432, 432, 153, - 449, 432, 432, 440, 432, 442, 432, 508, - 432, 489, 489, 123, 118, 437, 438, 432, - 432, 432, 444, 432, 442, 432, 442, 432, - 432, 432, 480, 480, 432, 118, 437, 438, - 432, 432, 432, 444, 432, 442, 432, 442, - 432, 432, 432, 480, 509, 432, 118, 437, - 438, 432, 432, 432, 444, 432, 442, 432, - 442, 432, 508, 432, 480, 480, 432, 118, - 437, 438, 432, 432, 432, 444, 432, 442, - 432, 442, 120, 432, 432, 136, 443, 432, - 118, 437, 438, 432, 432, 432, 444, 432, - 442, 432, 433, 434, 436, 436, 123, 118, - 437, 438, 432, 432, 432, 439, 432, 432, - 440, 432, 188, 189, 190, 191, 510, 362, - 84, 79, 194, 195, 196, 196, 156, 197, - 360, 188, 200, 360, 203, 511, 205, 206, - 6, 1, 207, 208, 202, 202, 38, 209, - 202, 202, 210, 202, 213, 189, 190, 191, - 512, 513, 84, 157, 514, 515, 202, 196, - 156, 516, 202, 213, 200, 202, 116, 517, - 517, 84, 157, 207, 208, 202, 202, 156, - 518, 202, 519, 202, 202, 520, 514, 515, - 202, 514, 515, 202, 254, 202, 514, 521, - 202, 514, 522, 202, 514, 202, 519, 202, - 202, 202, 514, 515, 202, 523, 3, 360, - 360, 401, 430, 360, 79, 194, 195, 360, - 360, 360, 365, 360, 523, 360, 524, 367, - 525, 526, 84, 157, 514, 515, 202, 202, - 158, 370, 202, 202, 200, 202, 527, 367, - 528, 528, 84, 157, 514, 515, 202, 202, - 202, 370, 202, 202, 200, 202, 367, 528, - 528, 84, 157, 514, 515, 202, 202, 202, - 370, 202, 202, 200, 202, 524, 367, 528, - 528, 84, 157, 514, 515, 202, 202, 202, - 370, 202, 202, 200, 202, 524, 367, 525, - 528, 84, 157, 514, 515, 202, 202, 158, - 370, 202, 202, 200, 202, 213, 202, 279, - 116, 529, 529, 160, 157, 207, 208, 202, - 202, 202, 518, 202, 213, 202, 530, 184, - 531, 532, 162, 157, 514, 515, 202, 202, - 202, 533, 202, 184, 531, 532, 162, 157, - 514, 515, 202, 202, 202, 533, 202, 531, - 531, 162, 157, 514, 515, 202, 202, 202, - 533, 202, 534, 181, 535, 536, 165, 157, - 514, 515, 202, 202, 202, 533, 202, 181, - 535, 536, 165, 157, 514, 515, 202, 202, - 202, 533, 202, 535, 535, 165, 157, 514, - 515, 202, 202, 202, 533, 202, 537, 178, - 538, 539, 168, 157, 514, 515, 202, 202, - 202, 533, 202, 178, 538, 539, 168, 157, - 514, 515, 202, 202, 202, 533, 202, 538, - 538, 168, 157, 514, 515, 202, 202, 202, - 533, 202, 540, 175, 541, 542, 202, 157, - 514, 515, 202, 202, 202, 533, 202, 175, - 541, 542, 202, 157, 514, 515, 202, 202, - 202, 533, 202, 541, 541, 202, 157, 514, - 515, 202, 202, 202, 533, 202, 543, 202, - 544, 545, 202, 157, 514, 515, 202, 202, - 172, 202, 171, 202, 541, 541, 202, 157, - 514, 515, 202, 541, 541, 202, 157, 514, - 515, 202, 543, 202, 541, 541, 202, 157, - 514, 515, 202, 543, 202, 544, 541, 202, - 157, 514, 515, 202, 202, 172, 202, 523, - 171, 360, 360, 98, 364, 360, 79, 194, - 195, 360, 360, 360, 365, 360, 523, 360, - 547, 546, 548, 548, 546, 186, 549, 550, - 546, 548, 548, 546, 186, 549, 550, 546, - 551, 546, 546, 552, 549, 550, 546, 549, - 550, 546, 553, 546, 549, 554, 546, 549, - 555, 546, 549, 546, 551, 546, 546, 546, + 1, 0, 2, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 0, 1, 0, 0, 0, 0, + 4, 0, 5, 5, 6, 1, 0, 7, + 7, 6, 0, 6, 0, 8, 8, 9, + 1, 0, 10, 10, 9, 0, 9, 0, + 11, 11, 12, 1, 0, 13, 13, 12, + 0, 12, 0, 14, 14, 15, 1, 0, + 16, 16, 15, 0, 15, 0, 17, 0, + 0, 0, 1, 0, 18, 0, 19, 0, + 20, 14, 14, 15, 1, 0, 21, 0, + 22, 0, 23, 11, 11, 12, 1, 0, + 24, 0, 25, 0, 26, 8, 8, 9, + 1, 0, 27, 0, 28, 0, 29, 5, + 5, 6, 1, 0, 0, 0, 0, 0, + 29, 0, 29, 5, 5, 6, 1, 0, + 0, 0, 0, 30, 29, 0, 31, 5, + 5, 6, 1, 0, 0, 0, 0, 0, + 31, 0, 31, 5, 5, 6, 1, 0, + 0, 0, 0, 32, 31, 0, 33, 5, + 5, 6, 1, 0, 0, 0, 0, 0, + 33, 0, 33, 5, 5, 6, 1, 0, + 0, 0, 0, 34, 33, 0, 35, 5, + 5, 6, 1, 0, 0, 0, 0, 0, + 35, 0, 35, 5, 5, 6, 1, 0, + 0, 0, 0, 36, 35, 0, 37, 5, + 5, 6, 1, 0, 0, 0, 0, 0, + 37, 0, 37, 5, 5, 6, 1, 0, + 0, 0, 0, 38, 37, 0, 40, 39, + 41, 42, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 41, + 39, 40, 39, 39, 39, 39, 43, 39, + 44, 44, 45, 40, 39, 46, 46, 45, + 39, 45, 39, 47, 47, 48, 40, 39, + 49, 49, 48, 39, 48, 39, 50, 50, + 51, 40, 39, 52, 52, 51, 39, 51, + 39, 53, 53, 54, 40, 39, 55, 55, + 54, 39, 54, 39, 56, 39, 39, 39, + 40, 39, 57, 39, 58, 39, 59, 53, + 53, 54, 40, 39, 60, 39, 61, 39, + 62, 50, 50, 51, 40, 39, 63, 39, + 64, 39, 65, 47, 47, 48, 40, 39, + 66, 39, 67, 39, 68, 44, 44, 45, + 40, 39, 39, 39, 39, 39, 68, 39, + 68, 44, 44, 45, 40, 39, 39, 39, + 39, 69, 68, 39, 70, 44, 44, 45, + 40, 39, 39, 39, 39, 39, 70, 39, + 70, 44, 44, 45, 40, 39, 39, 39, + 39, 71, 70, 39, 72, 44, 44, 45, + 40, 39, 39, 39, 39, 39, 72, 39, + 72, 44, 44, 45, 40, 39, 39, 39, + 39, 73, 72, 39, 74, 44, 44, 45, + 40, 39, 39, 39, 39, 39, 74, 39, + 74, 44, 44, 45, 40, 39, 39, 39, + 39, 75, 74, 39, 76, 44, 44, 45, + 40, 39, 39, 39, 39, 39, 76, 39, + 76, 44, 44, 45, 40, 39, 39, 39, + 39, 77, 76, 39, 79, 78, 80, 81, + 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 80, 78, 79, + 78, 78, 78, 78, 82, 78, 83, 83, + 84, 79, 78, 86, 86, 84, 85, 84, + 85, 87, 87, 88, 79, 78, 89, 89, + 88, 78, 88, 78, 90, 90, 91, 79, + 78, 92, 92, 91, 78, 91, 78, 93, + 93, 94, 79, 78, 95, 95, 94, 78, + 94, 78, 96, 78, 78, 78, 79, 78, + 97, 78, 98, 78, 99, 93, 93, 94, + 79, 78, 100, 78, 101, 78, 102, 90, + 90, 91, 79, 78, 103, 78, 104, 78, + 105, 87, 87, 88, 79, 78, 106, 78, + 107, 78, 108, 83, 83, 84, 79, 78, + 78, 78, 78, 78, 108, 78, 108, 83, + 83, 84, 79, 78, 78, 78, 78, 109, + 108, 78, 110, 83, 83, 84, 79, 78, + 78, 78, 78, 78, 110, 78, 110, 83, + 83, 84, 79, 78, 78, 78, 78, 111, + 110, 78, 112, 83, 83, 84, 79, 78, + 78, 78, 78, 78, 112, 78, 112, 83, + 83, 84, 79, 78, 78, 78, 78, 113, + 112, 78, 114, 83, 83, 84, 79, 78, + 78, 78, 78, 78, 114, 78, 114, 83, + 83, 84, 79, 78, 78, 78, 78, 115, + 114, 78, 116, 83, 83, 84, 79, 78, + 78, 78, 78, 78, 116, 78, 118, 117, + 119, 120, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 119, + 117, 118, 117, 117, 117, 117, 121, 117, + 122, 122, 123, 118, 117, 124, 124, 123, + 117, 123, 117, 125, 125, 126, 118, 117, + 127, 127, 126, 117, 126, 117, 128, 128, + 129, 118, 117, 130, 130, 129, 117, 129, + 117, 131, 131, 132, 118, 117, 133, 133, + 132, 117, 132, 117, 134, 117, 117, 117, + 118, 117, 135, 117, 136, 117, 137, 131, + 131, 132, 118, 117, 138, 117, 139, 117, + 140, 128, 128, 129, 118, 117, 141, 117, + 142, 117, 143, 125, 125, 126, 118, 117, + 144, 117, 145, 117, 146, 122, 122, 123, + 118, 117, 117, 117, 117, 117, 146, 117, + 146, 122, 122, 123, 118, 117, 117, 117, + 117, 147, 146, 117, 148, 122, 122, 123, + 118, 117, 117, 117, 117, 117, 148, 117, + 148, 122, 122, 123, 118, 117, 117, 117, + 117, 149, 148, 117, 150, 122, 122, 123, + 118, 117, 117, 117, 117, 117, 150, 117, + 150, 122, 122, 123, 118, 117, 117, 117, + 117, 151, 150, 117, 152, 122, 122, 123, + 118, 117, 117, 117, 117, 117, 152, 117, + 152, 122, 122, 123, 118, 117, 117, 117, + 117, 153, 152, 117, 154, 122, 122, 123, + 118, 117, 117, 117, 117, 117, 154, 117, + 154, 122, 122, 123, 118, 117, 117, 117, + 117, 155, 154, 117, 116, 83, 83, 84, + 79, 78, 78, 78, 78, 156, 116, 78, + 86, 86, 84, 1, 0, 114, 83, 83, + 84, 157, 0, 0, 0, 0, 0, 114, + 0, 114, 83, 83, 84, 157, 0, 0, + 0, 0, 158, 114, 0, 159, 159, 160, + 1, 0, 7, 7, 160, 0, 161, 161, + 162, 157, 0, 163, 163, 162, 0, 162, + 0, 164, 164, 165, 157, 0, 166, 166, + 165, 0, 165, 0, 167, 167, 168, 157, + 0, 169, 169, 168, 0, 168, 0, 157, + 0, 170, 171, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 170, 0, 157, 0, 0, 0, 0, 172, + 0, 173, 0, 0, 0, 157, 0, 174, + 0, 175, 0, 176, 167, 167, 168, 157, + 0, 177, 0, 178, 0, 179, 164, 164, + 165, 157, 0, 180, 0, 181, 0, 182, + 161, 161, 162, 157, 0, 183, 0, 184, + 0, 186, 185, 188, 189, 190, 191, 192, + 193, 84, 79, 194, 195, 196, 196, 156, + 197, 198, 199, 200, 201, 187, 203, 204, + 205, 206, 6, 1, 207, 208, 202, 202, + 38, 209, 202, 202, 210, 202, 211, 204, + 212, 212, 6, 1, 207, 208, 202, 202, + 202, 209, 202, 202, 210, 202, 204, 212, + 212, 6, 1, 207, 208, 202, 202, 202, + 209, 202, 202, 210, 202, 213, 202, 202, + 202, 19, 214, 202, 1, 207, 208, 202, + 202, 202, 215, 202, 213, 202, 216, 217, + 218, 219, 6, 1, 207, 208, 202, 202, + 36, 220, 202, 202, 210, 202, 221, 217, + 222, 222, 6, 1, 207, 208, 202, 202, + 202, 220, 202, 202, 210, 202, 217, 222, + 222, 6, 1, 207, 208, 202, 202, 202, + 220, 202, 202, 210, 202, 223, 202, 202, + 202, 19, 224, 202, 1, 207, 208, 202, + 202, 202, 215, 202, 223, 202, 225, 226, + 227, 228, 6, 1, 207, 208, 202, 202, + 34, 229, 202, 202, 210, 202, 230, 226, + 231, 231, 6, 1, 207, 208, 202, 202, + 202, 229, 202, 202, 210, 202, 226, 231, + 231, 6, 1, 207, 208, 202, 202, 202, + 229, 202, 202, 210, 202, 232, 202, 202, + 202, 19, 233, 202, 1, 207, 208, 202, + 202, 202, 215, 202, 232, 202, 234, 235, + 236, 237, 6, 1, 207, 208, 202, 202, + 32, 238, 202, 202, 210, 202, 239, 235, + 240, 240, 6, 1, 207, 208, 202, 202, + 202, 238, 202, 202, 210, 202, 235, 240, + 240, 6, 1, 207, 208, 202, 202, 202, + 238, 202, 202, 210, 202, 241, 202, 202, + 202, 19, 242, 202, 1, 207, 208, 202, + 202, 202, 215, 202, 241, 202, 243, 244, + 245, 246, 6, 1, 207, 208, 202, 202, + 30, 247, 202, 202, 210, 202, 248, 244, + 249, 249, 6, 1, 207, 208, 202, 202, + 202, 247, 202, 202, 210, 202, 244, 249, + 249, 6, 1, 207, 208, 202, 202, 202, + 247, 202, 202, 210, 202, 19, 250, 202, + 1, 207, 208, 202, 202, 202, 215, 202, + 251, 251, 202, 1, 207, 208, 202, 202, + 202, 215, 202, 252, 202, 202, 253, 207, + 208, 202, 207, 208, 202, 254, 202, 207, + 255, 202, 207, 256, 202, 207, 202, 252, + 202, 202, 202, 207, 208, 202, 257, 202, + 258, 259, 202, 1, 207, 208, 202, 202, + 4, 202, 3, 202, 251, 251, 202, 1, + 207, 208, 202, 251, 251, 202, 1, 207, + 208, 202, 257, 202, 251, 251, 202, 1, + 207, 208, 202, 257, 202, 258, 251, 202, + 1, 207, 208, 202, 202, 4, 202, 19, + 202, 260, 260, 6, 1, 207, 208, 202, + 202, 202, 215, 202, 261, 28, 262, 263, + 9, 1, 207, 208, 202, 202, 202, 215, + 202, 28, 262, 263, 9, 1, 207, 208, + 202, 202, 202, 215, 202, 262, 262, 9, + 1, 207, 208, 202, 202, 202, 215, 202, + 264, 25, 265, 266, 12, 1, 207, 208, + 202, 202, 202, 215, 202, 25, 265, 266, + 12, 1, 207, 208, 202, 202, 202, 215, + 202, 265, 265, 12, 1, 207, 208, 202, + 202, 202, 215, 202, 267, 22, 268, 269, + 15, 1, 207, 208, 202, 202, 202, 215, + 202, 22, 268, 269, 15, 1, 207, 208, + 202, 202, 202, 215, 202, 268, 268, 15, + 1, 207, 208, 202, 202, 202, 215, 202, + 270, 19, 251, 271, 202, 1, 207, 208, + 202, 202, 202, 215, 202, 19, 251, 271, + 202, 1, 207, 208, 202, 202, 202, 215, + 202, 251, 272, 202, 1, 207, 208, 202, + 202, 202, 215, 202, 19, 202, 251, 251, + 202, 1, 207, 208, 202, 202, 202, 215, + 202, 2, 3, 202, 202, 19, 250, 202, + 1, 207, 208, 202, 202, 202, 215, 202, + 2, 202, 244, 249, 249, 6, 1, 207, + 208, 202, 202, 202, 247, 202, 243, 244, + 249, 249, 6, 1, 207, 208, 202, 202, + 202, 247, 202, 202, 210, 202, 243, 244, + 245, 249, 6, 1, 207, 208, 202, 202, + 30, 247, 202, 202, 210, 202, 241, 202, + 273, 202, 260, 260, 6, 1, 207, 208, + 202, 202, 202, 215, 202, 241, 202, 241, + 202, 202, 202, 251, 251, 202, 1, 207, + 208, 202, 202, 202, 215, 202, 241, 202, + 241, 202, 202, 202, 251, 274, 202, 1, + 207, 208, 202, 202, 202, 215, 202, 241, + 202, 241, 202, 273, 202, 251, 251, 202, + 1, 207, 208, 202, 202, 202, 215, 202, + 241, 202, 241, 3, 202, 202, 19, 242, + 202, 1, 207, 208, 202, 202, 202, 215, + 202, 241, 202, 234, 235, 240, 240, 6, + 1, 207, 208, 202, 202, 202, 238, 202, + 202, 210, 202, 234, 235, 236, 240, 6, + 1, 207, 208, 202, 202, 32, 238, 202, + 202, 210, 202, 232, 202, 275, 202, 260, + 260, 6, 1, 207, 208, 202, 202, 202, + 215, 202, 232, 202, 232, 202, 202, 202, + 251, 251, 202, 1, 207, 208, 202, 202, + 202, 215, 202, 232, 202, 232, 202, 202, + 202, 251, 276, 202, 1, 207, 208, 202, + 202, 202, 215, 202, 232, 202, 232, 202, + 275, 202, 251, 251, 202, 1, 207, 208, + 202, 202, 202, 215, 202, 232, 202, 232, + 3, 202, 202, 19, 233, 202, 1, 207, + 208, 202, 202, 202, 215, 202, 232, 202, + 225, 226, 231, 231, 6, 1, 207, 208, + 202, 202, 202, 229, 202, 202, 210, 202, + 225, 226, 227, 231, 6, 1, 207, 208, + 202, 202, 34, 229, 202, 202, 210, 202, + 223, 202, 277, 202, 260, 260, 6, 1, + 207, 208, 202, 202, 202, 215, 202, 223, + 202, 223, 202, 202, 202, 251, 251, 202, + 1, 207, 208, 202, 202, 202, 215, 202, + 223, 202, 223, 202, 202, 202, 251, 278, + 202, 1, 207, 208, 202, 202, 202, 215, + 202, 223, 202, 223, 202, 277, 202, 251, + 251, 202, 1, 207, 208, 202, 202, 202, + 215, 202, 223, 202, 223, 3, 202, 202, + 19, 224, 202, 1, 207, 208, 202, 202, + 202, 215, 202, 223, 202, 216, 217, 222, + 222, 6, 1, 207, 208, 202, 202, 202, + 220, 202, 202, 210, 202, 216, 217, 218, + 222, 6, 1, 207, 208, 202, 202, 36, + 220, 202, 202, 210, 202, 213, 202, 279, + 202, 260, 260, 6, 1, 207, 208, 202, + 202, 202, 215, 202, 213, 202, 213, 202, + 202, 202, 251, 251, 202, 1, 207, 208, + 202, 202, 202, 215, 202, 213, 202, 213, + 202, 202, 202, 251, 280, 202, 1, 207, + 208, 202, 202, 202, 215, 202, 213, 202, + 213, 202, 279, 202, 251, 251, 202, 1, + 207, 208, 202, 202, 202, 215, 202, 213, + 202, 213, 3, 202, 202, 19, 214, 202, + 1, 207, 208, 202, 202, 202, 215, 202, + 213, 202, 203, 204, 212, 212, 6, 1, + 207, 208, 202, 202, 202, 209, 202, 202, + 210, 202, 203, 204, 205, 212, 6, 1, + 207, 208, 202, 202, 38, 209, 202, 202, + 210, 202, 282, 283, 284, 285, 45, 40, + 286, 287, 281, 281, 77, 288, 281, 281, + 289, 281, 290, 283, 291, 285, 45, 40, + 286, 287, 281, 281, 281, 288, 281, 281, + 289, 281, 283, 291, 285, 45, 40, 286, + 287, 281, 281, 281, 288, 281, 281, 289, + 281, 292, 281, 281, 281, 58, 293, 281, + 40, 286, 287, 281, 281, 281, 294, 281, + 292, 281, 295, 296, 297, 298, 45, 40, + 286, 287, 281, 281, 75, 299, 281, 281, + 289, 281, 300, 296, 301, 301, 45, 40, + 286, 287, 281, 281, 281, 299, 281, 281, + 289, 281, 296, 301, 301, 45, 40, 286, + 287, 281, 281, 281, 299, 281, 281, 289, + 281, 302, 281, 281, 281, 58, 303, 281, + 40, 286, 287, 281, 281, 281, 294, 281, + 302, 281, 304, 305, 306, 307, 45, 40, + 286, 287, 281, 281, 73, 308, 281, 281, + 289, 281, 309, 305, 310, 310, 45, 40, + 286, 287, 281, 281, 281, 308, 281, 281, + 289, 281, 305, 310, 310, 45, 40, 286, + 287, 281, 281, 281, 308, 281, 281, 289, + 281, 311, 281, 281, 281, 58, 312, 281, + 40, 286, 287, 281, 281, 281, 294, 281, + 311, 281, 313, 314, 315, 316, 45, 40, + 286, 287, 281, 281, 71, 317, 281, 281, + 289, 281, 318, 314, 319, 319, 45, 40, + 286, 287, 281, 281, 281, 317, 281, 281, + 289, 281, 314, 319, 319, 45, 40, 286, + 287, 281, 281, 281, 317, 281, 281, 289, + 281, 320, 281, 281, 281, 58, 321, 281, + 40, 286, 287, 281, 281, 281, 294, 281, + 320, 281, 322, 323, 324, 325, 45, 40, + 286, 287, 281, 281, 69, 326, 281, 281, + 289, 281, 327, 323, 328, 328, 45, 40, + 286, 287, 281, 281, 281, 326, 281, 281, + 289, 281, 323, 328, 328, 45, 40, 286, + 287, 281, 281, 281, 326, 281, 281, 289, + 281, 58, 329, 281, 40, 286, 287, 281, + 281, 281, 294, 281, 330, 330, 281, 40, + 286, 287, 281, 281, 281, 294, 281, 331, + 281, 281, 332, 286, 287, 281, 286, 287, + 281, 333, 281, 286, 334, 281, 286, 335, + 281, 286, 281, 331, 281, 281, 281, 286, + 287, 281, 336, 281, 337, 338, 281, 40, + 286, 287, 281, 281, 43, 281, 42, 281, + 330, 330, 281, 40, 286, 287, 281, 330, + 330, 281, 40, 286, 287, 281, 336, 281, + 330, 330, 281, 40, 286, 287, 281, 336, + 281, 337, 330, 281, 40, 286, 287, 281, + 281, 43, 281, 58, 281, 339, 339, 45, + 40, 286, 287, 281, 281, 281, 294, 281, + 340, 67, 341, 342, 48, 40, 286, 287, + 281, 281, 281, 294, 281, 67, 341, 342, + 48, 40, 286, 287, 281, 281, 281, 294, + 281, 341, 341, 48, 40, 286, 287, 281, + 281, 281, 294, 281, 343, 64, 344, 345, + 51, 40, 286, 287, 281, 281, 281, 294, + 281, 64, 344, 345, 51, 40, 286, 287, + 281, 281, 281, 294, 281, 344, 344, 51, + 40, 286, 287, 281, 281, 281, 294, 281, + 346, 61, 347, 348, 54, 40, 286, 287, + 281, 281, 281, 294, 281, 61, 347, 348, + 54, 40, 286, 287, 281, 281, 281, 294, + 281, 347, 347, 54, 40, 286, 287, 281, + 281, 281, 294, 281, 349, 58, 330, 350, + 281, 40, 286, 287, 281, 281, 281, 294, + 281, 58, 330, 350, 281, 40, 286, 287, + 281, 281, 281, 294, 281, 330, 351, 281, + 40, 286, 287, 281, 281, 281, 294, 281, + 58, 281, 330, 330, 281, 40, 286, 287, + 281, 281, 281, 294, 281, 41, 42, 281, + 281, 58, 329, 281, 40, 286, 287, 281, + 281, 281, 294, 281, 41, 281, 323, 328, + 328, 45, 40, 286, 287, 281, 281, 281, + 326, 281, 322, 323, 328, 328, 45, 40, + 286, 287, 281, 281, 281, 326, 281, 281, + 289, 281, 322, 323, 324, 328, 45, 40, + 286, 287, 281, 281, 69, 326, 281, 281, + 289, 281, 320, 281, 352, 281, 339, 339, + 45, 40, 286, 287, 281, 281, 281, 294, + 281, 320, 281, 320, 281, 281, 281, 330, + 330, 281, 40, 286, 287, 281, 281, 281, + 294, 281, 320, 281, 320, 281, 281, 281, + 330, 353, 281, 40, 286, 287, 281, 281, + 281, 294, 281, 320, 281, 320, 281, 352, + 281, 330, 330, 281, 40, 286, 287, 281, + 281, 281, 294, 281, 320, 281, 320, 42, + 281, 281, 58, 321, 281, 40, 286, 287, + 281, 281, 281, 294, 281, 320, 281, 313, + 314, 319, 319, 45, 40, 286, 287, 281, + 281, 281, 317, 281, 281, 289, 281, 313, + 314, 315, 319, 45, 40, 286, 287, 281, + 281, 71, 317, 281, 281, 289, 281, 311, + 281, 354, 281, 339, 339, 45, 40, 286, + 287, 281, 281, 281, 294, 281, 311, 281, + 311, 281, 281, 281, 330, 330, 281, 40, + 286, 287, 281, 281, 281, 294, 281, 311, + 281, 311, 281, 281, 281, 330, 355, 281, + 40, 286, 287, 281, 281, 281, 294, 281, + 311, 281, 311, 281, 354, 281, 330, 330, + 281, 40, 286, 287, 281, 281, 281, 294, + 281, 311, 281, 311, 42, 281, 281, 58, + 312, 281, 40, 286, 287, 281, 281, 281, + 294, 281, 311, 281, 304, 305, 310, 310, + 45, 40, 286, 287, 281, 281, 281, 308, + 281, 281, 289, 281, 304, 305, 306, 310, + 45, 40, 286, 287, 281, 281, 73, 308, + 281, 281, 289, 281, 302, 281, 356, 281, + 339, 339, 45, 40, 286, 287, 281, 281, + 281, 294, 281, 302, 281, 302, 281, 281, + 281, 330, 330, 281, 40, 286, 287, 281, + 281, 281, 294, 281, 302, 281, 302, 281, + 281, 281, 330, 357, 281, 40, 286, 287, + 281, 281, 281, 294, 281, 302, 281, 302, + 281, 356, 281, 330, 330, 281, 40, 286, + 287, 281, 281, 281, 294, 281, 302, 281, + 302, 42, 281, 281, 58, 303, 281, 40, + 286, 287, 281, 281, 281, 294, 281, 302, + 281, 295, 296, 301, 301, 45, 40, 286, + 287, 281, 281, 281, 299, 281, 281, 289, + 281, 295, 296, 297, 301, 45, 40, 286, + 287, 281, 281, 75, 299, 281, 281, 289, + 281, 292, 281, 358, 281, 339, 339, 45, + 40, 286, 287, 281, 281, 281, 294, 281, + 292, 281, 292, 281, 281, 281, 330, 330, + 281, 40, 286, 287, 281, 281, 281, 294, + 281, 292, 281, 292, 281, 281, 281, 330, + 359, 281, 40, 286, 287, 281, 281, 281, + 294, 281, 292, 281, 292, 281, 358, 281, + 330, 330, 281, 40, 286, 287, 281, 281, + 281, 294, 281, 292, 281, 76, 44, 44, + 45, 40, 281, 281, 281, 281, 281, 76, + 281, 292, 42, 281, 281, 58, 293, 281, + 40, 286, 287, 281, 281, 281, 294, 281, + 292, 281, 282, 283, 291, 285, 45, 40, + 286, 287, 281, 281, 281, 288, 281, 281, + 289, 281, 361, 191, 362, 362, 84, 79, + 194, 195, 360, 360, 360, 197, 360, 360, + 200, 360, 191, 362, 362, 84, 79, 194, + 195, 360, 360, 360, 197, 360, 360, 200, + 360, 363, 360, 360, 360, 98, 364, 360, + 79, 194, 195, 360, 360, 360, 365, 360, + 363, 360, 366, 367, 368, 369, 84, 79, + 194, 195, 360, 360, 115, 370, 360, 360, + 200, 360, 371, 367, 372, 372, 84, 79, + 194, 195, 360, 360, 360, 370, 360, 360, + 200, 360, 367, 372, 372, 84, 79, 194, + 195, 360, 360, 360, 370, 360, 360, 200, + 360, 373, 360, 360, 360, 98, 374, 360, + 79, 194, 195, 360, 360, 360, 365, 360, + 373, 360, 375, 376, 377, 378, 84, 79, + 194, 195, 360, 360, 113, 379, 360, 360, + 200, 360, 380, 376, 381, 381, 84, 79, + 194, 195, 360, 360, 360, 379, 360, 360, + 200, 360, 376, 381, 381, 84, 79, 194, + 195, 360, 360, 360, 379, 360, 360, 200, + 360, 382, 360, 360, 360, 98, 383, 360, + 79, 194, 195, 360, 360, 360, 365, 360, + 382, 360, 384, 385, 386, 387, 84, 79, + 194, 195, 360, 360, 111, 388, 360, 360, + 200, 360, 389, 385, 390, 390, 84, 79, + 194, 195, 360, 360, 360, 388, 360, 360, + 200, 360, 385, 390, 390, 84, 79, 194, + 195, 360, 360, 360, 388, 360, 360, 200, + 360, 391, 360, 360, 360, 98, 392, 360, + 79, 194, 195, 360, 360, 360, 365, 360, + 391, 360, 393, 394, 395, 396, 84, 79, + 194, 195, 360, 360, 109, 397, 360, 360, + 200, 360, 398, 394, 399, 399, 84, 79, + 194, 195, 360, 360, 360, 397, 360, 360, + 200, 360, 394, 399, 399, 84, 79, 194, + 195, 360, 360, 360, 397, 360, 360, 200, + 360, 98, 400, 360, 79, 194, 195, 360, + 360, 360, 365, 360, 401, 401, 360, 79, + 194, 195, 360, 360, 360, 365, 360, 402, + 360, 360, 403, 194, 195, 360, 194, 195, + 360, 404, 360, 194, 405, 360, 194, 406, + 360, 194, 360, 402, 360, 360, 360, 194, + 195, 360, 407, 360, 408, 409, 360, 79, + 194, 195, 360, 360, 82, 360, 81, 360, + 401, 401, 360, 79, 194, 195, 360, 401, + 401, 360, 79, 194, 195, 360, 407, 360, + 401, 401, 360, 79, 194, 195, 360, 407, + 360, 408, 401, 360, 79, 194, 195, 360, + 360, 82, 360, 98, 360, 410, 410, 84, + 79, 194, 195, 360, 360, 360, 365, 360, + 411, 107, 412, 413, 88, 79, 194, 195, + 360, 360, 360, 365, 360, 107, 412, 413, + 88, 79, 194, 195, 360, 360, 360, 365, + 360, 412, 412, 88, 79, 194, 195, 360, + 360, 360, 365, 360, 414, 104, 415, 416, + 91, 79, 194, 195, 360, 360, 360, 365, + 360, 104, 415, 416, 91, 79, 194, 195, + 360, 360, 360, 365, 360, 415, 415, 91, + 79, 194, 195, 360, 360, 360, 365, 360, + 417, 101, 418, 419, 94, 79, 194, 195, + 360, 360, 360, 365, 360, 101, 418, 419, + 94, 79, 194, 195, 360, 360, 360, 365, + 360, 418, 418, 94, 79, 194, 195, 360, + 360, 360, 365, 360, 420, 98, 401, 421, + 360, 79, 194, 195, 360, 360, 360, 365, + 360, 98, 401, 421, 360, 79, 194, 195, + 360, 360, 360, 365, 360, 401, 422, 360, + 79, 194, 195, 360, 360, 360, 365, 360, + 98, 360, 401, 401, 360, 79, 194, 195, + 360, 360, 360, 365, 360, 80, 81, 360, + 360, 98, 400, 360, 79, 194, 195, 360, + 360, 360, 365, 360, 80, 360, 394, 399, + 399, 84, 79, 194, 195, 360, 360, 360, + 397, 360, 393, 394, 399, 399, 84, 79, + 194, 195, 360, 360, 360, 397, 360, 360, + 200, 360, 393, 394, 395, 399, 84, 79, + 194, 195, 360, 360, 109, 397, 360, 360, + 200, 360, 391, 360, 423, 360, 410, 410, + 84, 79, 194, 195, 360, 360, 360, 365, + 360, 391, 360, 391, 360, 360, 360, 401, + 401, 360, 79, 194, 195, 360, 360, 360, + 365, 360, 391, 360, 391, 360, 360, 360, + 401, 424, 360, 79, 194, 195, 360, 360, + 360, 365, 360, 391, 360, 391, 360, 423, + 360, 401, 401, 360, 79, 194, 195, 360, + 360, 360, 365, 360, 391, 360, 391, 81, + 360, 360, 98, 392, 360, 79, 194, 195, + 360, 360, 360, 365, 360, 391, 360, 384, + 385, 390, 390, 84, 79, 194, 195, 360, + 360, 360, 388, 360, 360, 200, 360, 384, + 385, 386, 390, 84, 79, 194, 195, 360, + 360, 111, 388, 360, 360, 200, 360, 382, + 360, 425, 360, 410, 410, 84, 79, 194, + 195, 360, 360, 360, 365, 360, 382, 360, + 382, 360, 360, 360, 401, 401, 360, 79, + 194, 195, 360, 360, 360, 365, 360, 382, + 360, 382, 360, 360, 360, 401, 426, 360, + 79, 194, 195, 360, 360, 360, 365, 360, + 382, 360, 382, 360, 425, 360, 401, 401, + 360, 79, 194, 195, 360, 360, 360, 365, + 360, 382, 360, 382, 81, 360, 360, 98, + 383, 360, 79, 194, 195, 360, 360, 360, + 365, 360, 382, 360, 375, 376, 381, 381, + 84, 79, 194, 195, 360, 360, 360, 379, + 360, 360, 200, 360, 375, 376, 377, 381, + 84, 79, 194, 195, 360, 360, 113, 379, + 360, 360, 200, 360, 373, 360, 427, 360, + 410, 410, 84, 79, 194, 195, 360, 360, + 360, 365, 360, 373, 360, 373, 360, 360, + 360, 401, 401, 360, 79, 194, 195, 360, + 360, 360, 365, 360, 373, 360, 373, 360, + 360, 360, 401, 428, 360, 79, 194, 195, + 360, 360, 360, 365, 360, 373, 360, 373, + 360, 427, 360, 401, 401, 360, 79, 194, + 195, 360, 360, 360, 365, 360, 373, 360, + 373, 81, 360, 360, 98, 374, 360, 79, + 194, 195, 360, 360, 360, 365, 360, 373, + 360, 366, 367, 372, 372, 84, 79, 194, + 195, 360, 360, 360, 370, 360, 360, 200, + 360, 366, 367, 368, 372, 84, 79, 194, + 195, 360, 360, 115, 370, 360, 360, 200, + 360, 363, 360, 429, 360, 410, 410, 84, + 79, 194, 195, 360, 360, 360, 365, 360, + 363, 360, 363, 360, 360, 360, 401, 401, + 360, 79, 194, 195, 360, 360, 360, 365, + 360, 363, 360, 363, 360, 360, 360, 401, + 430, 360, 79, 194, 195, 360, 360, 360, + 365, 360, 363, 360, 363, 360, 429, 360, + 401, 401, 360, 79, 194, 195, 360, 360, + 360, 365, 360, 363, 360, 363, 81, 360, + 360, 98, 364, 360, 79, 194, 195, 360, + 360, 360, 365, 360, 363, 360, 116, 83, + 83, 84, 79, 431, 431, 431, 431, 156, + 116, 431, 190, 191, 362, 362, 84, 79, + 194, 195, 360, 360, 360, 197, 360, 360, + 200, 360, 116, 83, 83, 84, 79, 431, + 431, 431, 431, 431, 116, 431, 433, 434, + 435, 436, 123, 118, 437, 438, 432, 432, + 155, 439, 432, 432, 440, 432, 441, 434, + 436, 436, 123, 118, 437, 438, 432, 432, + 432, 439, 432, 432, 440, 432, 434, 436, + 436, 123, 118, 437, 438, 432, 432, 432, + 439, 432, 432, 440, 432, 442, 432, 432, + 432, 136, 443, 432, 118, 437, 438, 432, + 432, 432, 444, 432, 442, 432, 445, 446, + 447, 448, 123, 118, 437, 438, 432, 432, + 153, 449, 432, 432, 440, 432, 450, 446, + 451, 451, 123, 118, 437, 438, 432, 432, + 432, 449, 432, 432, 440, 432, 446, 451, + 451, 123, 118, 437, 438, 432, 432, 432, + 449, 432, 432, 440, 432, 452, 432, 432, + 432, 136, 453, 432, 118, 437, 438, 432, + 432, 432, 444, 432, 452, 432, 454, 455, + 456, 457, 123, 118, 437, 438, 432, 432, + 151, 458, 432, 432, 440, 432, 459, 455, + 460, 460, 123, 118, 437, 438, 432, 432, + 432, 458, 432, 432, 440, 432, 455, 460, + 460, 123, 118, 437, 438, 432, 432, 432, + 458, 432, 432, 440, 432, 461, 432, 432, + 432, 136, 462, 432, 118, 437, 438, 432, + 432, 432, 444, 432, 461, 432, 463, 464, + 465, 466, 123, 118, 437, 438, 432, 432, + 149, 467, 432, 432, 440, 432, 468, 464, + 469, 469, 123, 118, 437, 438, 432, 432, + 432, 467, 432, 432, 440, 432, 464, 469, + 469, 123, 118, 437, 438, 432, 432, 432, + 467, 432, 432, 440, 432, 470, 432, 432, + 432, 136, 471, 432, 118, 437, 438, 432, + 432, 432, 444, 432, 470, 432, 472, 473, + 474, 475, 123, 118, 437, 438, 432, 432, + 147, 476, 432, 432, 440, 432, 477, 473, + 478, 478, 123, 118, 437, 438, 432, 432, + 432, 476, 432, 432, 440, 432, 473, 478, + 478, 123, 118, 437, 438, 432, 432, 432, + 476, 432, 432, 440, 432, 136, 479, 432, + 118, 437, 438, 432, 432, 432, 444, 432, + 480, 480, 432, 118, 437, 438, 432, 432, + 432, 444, 432, 481, 432, 432, 482, 437, + 438, 432, 437, 438, 432, 483, 432, 437, + 484, 432, 437, 485, 432, 437, 432, 481, + 432, 432, 432, 437, 438, 432, 486, 432, + 487, 488, 432, 118, 437, 438, 432, 432, + 121, 432, 120, 432, 480, 480, 432, 118, + 437, 438, 432, 480, 480, 432, 118, 437, + 438, 432, 486, 432, 480, 480, 432, 118, + 437, 438, 432, 486, 432, 487, 480, 432, + 118, 437, 438, 432, 432, 121, 432, 136, + 432, 489, 489, 123, 118, 437, 438, 432, + 432, 432, 444, 432, 490, 145, 491, 492, + 126, 118, 437, 438, 432, 432, 432, 444, + 432, 145, 491, 492, 126, 118, 437, 438, + 432, 432, 432, 444, 432, 491, 491, 126, + 118, 437, 438, 432, 432, 432, 444, 432, + 493, 142, 494, 495, 129, 118, 437, 438, + 432, 432, 432, 444, 432, 142, 494, 495, + 129, 118, 437, 438, 432, 432, 432, 444, + 432, 494, 494, 129, 118, 437, 438, 432, + 432, 432, 444, 432, 496, 139, 497, 498, + 132, 118, 437, 438, 432, 432, 432, 444, + 432, 139, 497, 498, 132, 118, 437, 438, + 432, 432, 432, 444, 432, 497, 497, 132, + 118, 437, 438, 432, 432, 432, 444, 432, + 499, 136, 480, 500, 432, 118, 437, 438, + 432, 432, 432, 444, 432, 136, 480, 500, + 432, 118, 437, 438, 432, 432, 432, 444, + 432, 480, 501, 432, 118, 437, 438, 432, + 432, 432, 444, 432, 136, 432, 480, 480, + 432, 118, 437, 438, 432, 432, 432, 444, + 432, 119, 120, 432, 432, 136, 479, 432, + 118, 437, 438, 432, 432, 432, 444, 432, + 119, 432, 473, 478, 478, 123, 118, 437, + 438, 432, 432, 432, 476, 432, 472, 473, + 478, 478, 123, 118, 437, 438, 432, 432, + 432, 476, 432, 432, 440, 432, 472, 473, + 474, 478, 123, 118, 437, 438, 432, 432, + 147, 476, 432, 432, 440, 432, 470, 432, + 502, 432, 489, 489, 123, 118, 437, 438, + 432, 432, 432, 444, 432, 470, 432, 470, + 432, 432, 432, 480, 480, 432, 118, 437, + 438, 432, 432, 432, 444, 432, 470, 432, + 470, 432, 432, 432, 480, 503, 432, 118, + 437, 438, 432, 432, 432, 444, 432, 470, + 432, 470, 432, 502, 432, 480, 480, 432, + 118, 437, 438, 432, 432, 432, 444, 432, + 470, 432, 470, 120, 432, 432, 136, 471, + 432, 118, 437, 438, 432, 432, 432, 444, + 432, 470, 432, 463, 464, 469, 469, 123, + 118, 437, 438, 432, 432, 432, 467, 432, + 432, 440, 432, 463, 464, 465, 469, 123, + 118, 437, 438, 432, 432, 149, 467, 432, + 432, 440, 432, 461, 432, 504, 432, 489, + 489, 123, 118, 437, 438, 432, 432, 432, + 444, 432, 461, 432, 461, 432, 432, 432, + 480, 480, 432, 118, 437, 438, 432, 432, + 432, 444, 432, 461, 432, 461, 432, 432, + 432, 480, 505, 432, 118, 437, 438, 432, + 432, 432, 444, 432, 461, 432, 461, 432, + 504, 432, 480, 480, 432, 118, 437, 438, + 432, 432, 432, 444, 432, 461, 432, 461, + 120, 432, 432, 136, 462, 432, 118, 437, + 438, 432, 432, 432, 444, 432, 461, 432, + 454, 455, 460, 460, 123, 118, 437, 438, + 432, 432, 432, 458, 432, 432, 440, 432, + 454, 455, 456, 460, 123, 118, 437, 438, + 432, 432, 151, 458, 432, 432, 440, 432, + 452, 432, 506, 432, 489, 489, 123, 118, + 437, 438, 432, 432, 432, 444, 432, 452, + 432, 452, 432, 432, 432, 480, 480, 432, + 118, 437, 438, 432, 432, 432, 444, 432, + 452, 432, 452, 432, 432, 432, 480, 507, + 432, 118, 437, 438, 432, 432, 432, 444, + 432, 452, 432, 452, 432, 506, 432, 480, + 480, 432, 118, 437, 438, 432, 432, 432, + 444, 432, 452, 432, 452, 120, 432, 432, + 136, 453, 432, 118, 437, 438, 432, 432, + 432, 444, 432, 452, 432, 445, 446, 451, + 451, 123, 118, 437, 438, 432, 432, 432, + 449, 432, 432, 440, 432, 445, 446, 447, + 451, 123, 118, 437, 438, 432, 432, 153, + 449, 432, 432, 440, 432, 442, 432, 508, + 432, 489, 489, 123, 118, 437, 438, 432, + 432, 432, 444, 432, 442, 432, 442, 432, + 432, 432, 480, 480, 432, 118, 437, 438, + 432, 432, 432, 444, 432, 442, 432, 442, + 432, 432, 432, 480, 509, 432, 118, 437, + 438, 432, 432, 432, 444, 432, 442, 432, + 442, 432, 508, 432, 480, 480, 432, 118, + 437, 438, 432, 432, 432, 444, 432, 442, + 432, 442, 120, 432, 432, 136, 443, 432, + 118, 437, 438, 432, 432, 432, 444, 432, + 442, 432, 433, 434, 436, 436, 123, 118, + 437, 438, 432, 432, 432, 439, 432, 432, + 440, 432, 188, 189, 190, 191, 510, 362, + 84, 79, 194, 195, 196, 196, 156, 197, + 360, 188, 200, 360, 203, 511, 205, 206, + 6, 1, 207, 208, 202, 202, 38, 209, + 202, 202, 210, 202, 213, 189, 190, 191, + 512, 513, 84, 157, 514, 515, 202, 196, + 156, 516, 202, 213, 200, 202, 116, 517, + 517, 84, 157, 207, 208, 202, 202, 156, + 518, 202, 519, 202, 202, 520, 514, 515, + 202, 514, 515, 202, 254, 202, 514, 521, + 202, 514, 522, 202, 514, 202, 519, 202, + 202, 202, 514, 515, 202, 523, 3, 360, + 360, 401, 430, 360, 79, 194, 195, 360, + 360, 360, 365, 360, 523, 360, 524, 367, + 525, 526, 84, 157, 514, 515, 202, 202, + 158, 370, 202, 202, 200, 202, 527, 367, + 528, 528, 84, 157, 514, 515, 202, 202, + 202, 370, 202, 202, 200, 202, 367, 528, + 528, 84, 157, 514, 515, 202, 202, 202, + 370, 202, 202, 200, 202, 524, 367, 528, + 528, 84, 157, 514, 515, 202, 202, 202, + 370, 202, 202, 200, 202, 524, 367, 525, + 528, 84, 157, 514, 515, 202, 202, 158, + 370, 202, 202, 200, 202, 213, 202, 279, + 116, 529, 529, 160, 157, 207, 208, 202, + 202, 202, 518, 202, 213, 202, 530, 184, + 531, 532, 162, 157, 514, 515, 202, 202, + 202, 533, 202, 184, 531, 532, 162, 157, + 514, 515, 202, 202, 202, 533, 202, 531, + 531, 162, 157, 514, 515, 202, 202, 202, + 533, 202, 534, 181, 535, 536, 165, 157, + 514, 515, 202, 202, 202, 533, 202, 181, + 535, 536, 165, 157, 514, 515, 202, 202, + 202, 533, 202, 535, 535, 165, 157, 514, + 515, 202, 202, 202, 533, 202, 537, 178, + 538, 539, 168, 157, 514, 515, 202, 202, + 202, 533, 202, 178, 538, 539, 168, 157, + 514, 515, 202, 202, 202, 533, 202, 538, + 538, 168, 157, 514, 515, 202, 202, 202, + 533, 202, 540, 175, 541, 542, 202, 157, + 514, 515, 202, 202, 202, 533, 202, 175, + 541, 542, 202, 157, 514, 515, 202, 202, + 202, 533, 202, 541, 541, 202, 157, 514, + 515, 202, 202, 202, 533, 202, 543, 202, + 544, 545, 202, 157, 514, 515, 202, 202, + 172, 202, 171, 202, 541, 541, 202, 157, + 514, 515, 202, 541, 541, 202, 157, 514, + 515, 202, 543, 202, 541, 541, 202, 157, + 514, 515, 202, 543, 202, 544, 541, 202, + 157, 514, 515, 202, 202, 172, 202, 523, + 171, 360, 360, 98, 364, 360, 79, 194, + 195, 360, 360, 360, 365, 360, 523, 360, + 547, 546, 548, 548, 546, 186, 549, 550, + 546, 548, 548, 546, 186, 549, 550, 546, + 551, 546, 546, 552, 549, 550, 546, 549, + 550, 546, 553, 546, 549, 554, 546, 549, + 555, 546, 549, 546, 551, 546, 546, 546, 549, 550, 546, 0 }; static const short _indic_syllable_machine_trans_targs[] = { - 178, 200, 207, 209, 210, 4, 213, 5, - 7, 216, 8, 10, 219, 11, 13, 222, - 14, 16, 17, 199, 19, 20, 221, 22, - 23, 218, 25, 26, 215, 224, 228, 232, - 235, 239, 242, 246, 249, 253, 256, 178, - 279, 286, 288, 289, 41, 292, 42, 44, - 295, 45, 47, 298, 48, 50, 301, 51, - 53, 54, 278, 56, 57, 300, 59, 60, - 297, 62, 63, 294, 303, 307, 311, 314, - 318, 321, 325, 328, 332, 336, 178, 357, - 364, 366, 367, 78, 370, 178, 79, 81, - 373, 82, 84, 376, 85, 87, 379, 88, - 90, 91, 356, 93, 94, 378, 96, 97, - 375, 99, 100, 372, 381, 385, 389, 392, - 396, 399, 403, 406, 410, 178, 437, 444, - 446, 447, 114, 450, 115, 117, 453, 118, - 120, 456, 121, 123, 459, 124, 126, 127, - 436, 129, 130, 458, 132, 133, 455, 135, - 136, 452, 461, 465, 469, 472, 476, 479, - 483, 486, 490, 493, 414, 498, 509, 152, - 512, 154, 515, 155, 157, 518, 158, 160, - 521, 161, 524, 526, 527, 166, 167, 523, - 169, 170, 520, 172, 173, 517, 175, 176, - 514, 178, 532, 178, 179, 258, 337, 339, - 413, 415, 359, 360, 416, 412, 494, 495, - 384, 530, 178, 180, 182, 36, 257, 202, - 203, 255, 227, 181, 35, 183, 251, 1, - 184, 186, 34, 250, 248, 185, 33, 187, - 244, 188, 190, 32, 243, 241, 189, 31, - 191, 237, 192, 194, 30, 236, 234, 193, - 29, 195, 230, 196, 198, 28, 229, 226, - 197, 27, 212, 0, 201, 206, 178, 204, - 205, 208, 2, 211, 3, 214, 6, 24, - 217, 9, 21, 220, 12, 18, 223, 15, - 225, 231, 233, 238, 240, 245, 247, 252, - 254, 178, 259, 261, 73, 334, 281, 282, - 335, 306, 260, 72, 262, 330, 38, 263, - 265, 71, 329, 327, 264, 70, 266, 323, - 267, 269, 69, 322, 320, 268, 68, 270, - 316, 271, 273, 67, 315, 313, 272, 66, - 274, 309, 275, 277, 65, 308, 305, 276, - 64, 291, 37, 280, 285, 178, 283, 284, - 287, 39, 290, 40, 293, 43, 61, 296, - 46, 58, 299, 49, 55, 302, 52, 304, - 310, 312, 317, 319, 324, 326, 331, 333, - 178, 338, 109, 340, 408, 75, 341, 343, - 108, 407, 405, 342, 107, 344, 401, 345, - 347, 106, 400, 398, 346, 105, 348, 394, - 349, 351, 104, 393, 391, 350, 103, 352, - 387, 353, 355, 102, 386, 383, 354, 101, - 369, 74, 358, 363, 178, 361, 362, 365, - 76, 368, 77, 371, 80, 98, 374, 83, - 95, 377, 86, 92, 380, 89, 382, 388, - 390, 395, 397, 402, 404, 409, 411, 178, - 178, 417, 419, 146, 145, 439, 440, 492, - 464, 418, 420, 488, 111, 421, 423, 144, - 487, 485, 422, 143, 424, 481, 425, 427, - 142, 480, 478, 426, 141, 428, 474, 429, - 431, 140, 473, 471, 430, 139, 432, 467, - 433, 435, 138, 466, 463, 434, 137, 449, - 110, 438, 443, 178, 441, 442, 445, 112, - 448, 113, 451, 116, 134, 454, 119, 131, - 457, 122, 128, 460, 125, 462, 468, 470, - 475, 477, 482, 484, 489, 491, 147, 496, - 497, 511, 500, 501, 529, 148, 505, 499, - 504, 502, 503, 506, 507, 150, 510, 508, - 149, 151, 513, 153, 174, 163, 516, 156, - 171, 519, 159, 168, 522, 162, 165, 525, - 164, 528, 178, 531, 177, 534, 535, 533, + 178, 200, 207, 209, 210, 4, 213, 5, + 7, 216, 8, 10, 219, 11, 13, 222, + 14, 16, 17, 199, 19, 20, 221, 22, + 23, 218, 25, 26, 215, 224, 228, 232, + 235, 239, 242, 246, 249, 253, 256, 178, + 279, 286, 288, 289, 41, 292, 42, 44, + 295, 45, 47, 298, 48, 50, 301, 51, + 53, 54, 278, 56, 57, 300, 59, 60, + 297, 62, 63, 294, 303, 307, 311, 314, + 318, 321, 325, 328, 332, 336, 178, 357, + 364, 366, 367, 78, 370, 178, 79, 81, + 373, 82, 84, 376, 85, 87, 379, 88, + 90, 91, 356, 93, 94, 378, 96, 97, + 375, 99, 100, 372, 381, 385, 389, 392, + 396, 399, 403, 406, 410, 178, 437, 444, + 446, 447, 114, 450, 115, 117, 453, 118, + 120, 456, 121, 123, 459, 124, 126, 127, + 436, 129, 130, 458, 132, 133, 455, 135, + 136, 452, 461, 465, 469, 472, 476, 479, + 483, 486, 490, 493, 414, 498, 509, 152, + 512, 154, 515, 155, 157, 518, 158, 160, + 521, 161, 524, 526, 527, 166, 167, 523, + 169, 170, 520, 172, 173, 517, 175, 176, + 514, 178, 532, 178, 179, 258, 337, 339, + 413, 415, 359, 360, 416, 412, 494, 495, + 384, 530, 178, 180, 182, 36, 257, 202, + 203, 255, 227, 181, 35, 183, 251, 1, + 184, 186, 34, 250, 248, 185, 33, 187, + 244, 188, 190, 32, 243, 241, 189, 31, + 191, 237, 192, 194, 30, 236, 234, 193, + 29, 195, 230, 196, 198, 28, 229, 226, + 197, 27, 212, 0, 201, 206, 178, 204, + 205, 208, 2, 211, 3, 214, 6, 24, + 217, 9, 21, 220, 12, 18, 223, 15, + 225, 231, 233, 238, 240, 245, 247, 252, + 254, 178, 259, 261, 73, 334, 281, 282, + 335, 306, 260, 72, 262, 330, 38, 263, + 265, 71, 329, 327, 264, 70, 266, 323, + 267, 269, 69, 322, 320, 268, 68, 270, + 316, 271, 273, 67, 315, 313, 272, 66, + 274, 309, 275, 277, 65, 308, 305, 276, + 64, 291, 37, 280, 285, 178, 283, 284, + 287, 39, 290, 40, 293, 43, 61, 296, + 46, 58, 299, 49, 55, 302, 52, 304, + 310, 312, 317, 319, 324, 326, 331, 333, + 178, 338, 109, 340, 408, 75, 341, 343, + 108, 407, 405, 342, 107, 344, 401, 345, + 347, 106, 400, 398, 346, 105, 348, 394, + 349, 351, 104, 393, 391, 350, 103, 352, + 387, 353, 355, 102, 386, 383, 354, 101, + 369, 74, 358, 363, 178, 361, 362, 365, + 76, 368, 77, 371, 80, 98, 374, 83, + 95, 377, 86, 92, 380, 89, 382, 388, + 390, 395, 397, 402, 404, 409, 411, 178, + 178, 417, 419, 146, 145, 439, 440, 492, + 464, 418, 420, 488, 111, 421, 423, 144, + 487, 485, 422, 143, 424, 481, 425, 427, + 142, 480, 478, 426, 141, 428, 474, 429, + 431, 140, 473, 471, 430, 139, 432, 467, + 433, 435, 138, 466, 463, 434, 137, 449, + 110, 438, 443, 178, 441, 442, 445, 112, + 448, 113, 451, 116, 134, 454, 119, 131, + 457, 122, 128, 460, 125, 462, 468, 470, + 475, 477, 482, 484, 489, 491, 147, 496, + 497, 511, 500, 501, 529, 148, 505, 499, + 504, 502, 503, 506, 507, 150, 510, 508, + 149, 151, 513, 153, 174, 163, 516, 156, + 171, 519, 159, 168, 522, 162, 165, 525, + 164, 528, 178, 531, 177, 534, 535, 533, 538, 178, 536, 537 }; static const char _indic_syllable_machine_trans_actions[] = { - 1, 0, 2, 2, 2, 0, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 2, - 0, 0, 0, 2, 0, 0, 2, 0, - 0, 2, 0, 0, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 3, - 0, 2, 2, 2, 0, 2, 0, 0, - 2, 0, 0, 2, 0, 0, 2, 0, - 0, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 0, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 4, 0, - 2, 2, 2, 0, 2, 5, 0, 0, - 2, 0, 0, 2, 0, 0, 2, 0, - 0, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 0, 2, 2, 6, 2, 6, - 2, 6, 2, 6, 2, 7, 0, 2, - 2, 2, 0, 2, 0, 0, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 0, - 2, 0, 0, 2, 0, 0, 2, 0, - 0, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 6, 0, 8, 0, - 2, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 2, 2, 2, 0, 0, 2, - 0, 0, 2, 0, 0, 2, 0, 0, - 2, 9, 0, 12, 2, 2, 6, 2, - 13, 13, 0, 0, 2, 2, 6, 2, - 6, 2, 14, 2, 2, 0, 2, 0, - 0, 2, 2, 2, 0, 2, 2, 0, - 2, 2, 0, 2, 2, 2, 0, 2, - 2, 2, 2, 0, 2, 2, 2, 0, - 2, 2, 2, 2, 0, 2, 2, 2, - 0, 2, 2, 2, 2, 0, 2, 2, - 2, 0, 2, 0, 0, 0, 15, 0, - 0, 2, 0, 2, 0, 2, 0, 0, - 2, 0, 0, 2, 0, 0, 2, 0, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 16, 2, 2, 0, 2, 0, 0, - 2, 2, 2, 0, 2, 2, 0, 2, - 2, 0, 2, 2, 2, 0, 2, 2, - 2, 2, 0, 2, 2, 2, 0, 2, - 2, 2, 2, 0, 2, 2, 2, 0, - 2, 2, 2, 2, 0, 2, 2, 2, - 0, 2, 0, 0, 0, 17, 0, 0, - 2, 0, 2, 0, 2, 0, 0, 2, - 0, 0, 2, 0, 0, 2, 0, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 18, 6, 0, 6, 6, 0, 6, 2, - 0, 6, 2, 6, 0, 6, 6, 6, - 2, 0, 6, 2, 6, 0, 6, 6, - 6, 2, 0, 6, 2, 6, 0, 6, - 6, 6, 2, 0, 6, 2, 6, 0, - 6, 0, 0, 0, 19, 0, 0, 2, - 0, 2, 0, 2, 0, 0, 2, 0, - 0, 2, 0, 0, 2, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 20, - 21, 2, 2, 0, 0, 0, 0, 2, - 2, 2, 2, 2, 0, 2, 2, 0, - 2, 2, 2, 0, 2, 2, 2, 2, - 0, 2, 2, 2, 0, 2, 2, 2, - 2, 0, 2, 2, 2, 0, 2, 2, - 2, 2, 0, 2, 2, 2, 0, 2, - 0, 0, 0, 22, 0, 0, 2, 0, - 2, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 0, 2, 0, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 0, 0, - 8, 2, 0, 0, 2, 0, 2, 0, - 0, 0, 0, 8, 8, 0, 8, 8, - 0, 0, 2, 0, 0, 0, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 2, - 0, 2, 23, 2, 0, 0, 0, 0, + 1, 0, 2, 2, 2, 0, 2, 0, + 0, 2, 0, 0, 2, 0, 0, 2, + 0, 0, 0, 2, 0, 0, 2, 0, + 0, 2, 0, 0, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 3, + 0, 2, 2, 2, 0, 2, 0, 0, + 2, 0, 0, 2, 0, 0, 2, 0, + 0, 0, 2, 0, 0, 2, 0, 0, + 2, 0, 0, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 4, 0, + 2, 2, 2, 0, 2, 5, 0, 0, + 2, 0, 0, 2, 0, 0, 2, 0, + 0, 0, 2, 0, 0, 2, 0, 0, + 2, 0, 0, 2, 2, 6, 2, 6, + 2, 6, 2, 6, 2, 7, 0, 2, + 2, 2, 0, 2, 0, 0, 2, 0, + 0, 2, 0, 0, 2, 0, 0, 0, + 2, 0, 0, 2, 0, 0, 2, 0, + 0, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 6, 0, 8, 0, + 2, 0, 2, 0, 0, 2, 0, 0, + 2, 0, 2, 2, 2, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 0, 0, + 2, 9, 0, 12, 2, 2, 6, 2, + 13, 13, 0, 0, 2, 2, 6, 2, + 6, 2, 14, 2, 2, 0, 2, 0, + 0, 2, 2, 2, 0, 2, 2, 0, + 2, 2, 0, 2, 2, 2, 0, 2, + 2, 2, 2, 0, 2, 2, 2, 0, + 2, 2, 2, 2, 0, 2, 2, 2, + 0, 2, 2, 2, 2, 0, 2, 2, + 2, 0, 2, 0, 0, 0, 15, 0, + 0, 2, 0, 2, 0, 2, 0, 0, + 2, 0, 0, 2, 0, 0, 2, 0, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 16, 2, 2, 0, 2, 0, 0, + 2, 2, 2, 0, 2, 2, 0, 2, + 2, 0, 2, 2, 2, 0, 2, 2, + 2, 2, 0, 2, 2, 2, 0, 2, + 2, 2, 2, 0, 2, 2, 2, 0, + 2, 2, 2, 2, 0, 2, 2, 2, + 0, 2, 0, 0, 0, 17, 0, 0, + 2, 0, 2, 0, 2, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 0, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 18, 6, 0, 6, 6, 0, 6, 2, + 0, 6, 2, 6, 0, 6, 6, 6, + 2, 0, 6, 2, 6, 0, 6, 6, + 6, 2, 0, 6, 2, 6, 0, 6, + 6, 6, 2, 0, 6, 2, 6, 0, + 6, 0, 0, 0, 19, 0, 0, 2, + 0, 2, 0, 2, 0, 0, 2, 0, + 0, 2, 0, 0, 2, 0, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 20, + 21, 2, 2, 0, 0, 0, 0, 2, + 2, 2, 2, 2, 0, 2, 2, 0, + 2, 2, 2, 0, 2, 2, 2, 2, + 0, 2, 2, 2, 0, 2, 2, 2, + 2, 0, 2, 2, 2, 0, 2, 2, + 2, 2, 0, 2, 2, 2, 0, 2, + 0, 0, 0, 22, 0, 0, 2, 0, + 2, 0, 2, 0, 0, 2, 0, 0, + 2, 0, 0, 2, 0, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 0, 0, + 8, 2, 0, 0, 2, 0, 2, 0, + 0, 0, 0, 8, 8, 0, 8, 8, + 0, 0, 2, 0, 0, 0, 2, 0, + 0, 2, 0, 0, 2, 0, 0, 2, + 0, 2, 23, 2, 0, 0, 0, 0, 0, 24, 0, 0 }; static const char _indic_syllable_machine_to_state_actions[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 10, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 10, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char _indic_syllable_machine_from_state_actions[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 11, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 11, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const short _indic_syllable_machine_eof_trans[] = { - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 79, 79, 79, 79, 86, 86, - 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 79, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 186, 0, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 282, 282, 282, 282, 282, 282, 282, - 282, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 361, 361, 361, - 361, 361, 361, 361, 361, 432, 361, 432, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 361, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 361, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, - 203, 361, 547, 547, 547, 547, 547, 547, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 79, 79, 79, 79, 86, 86, + 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 118, 79, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 186, 0, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 361, 361, 361, + 361, 361, 361, 361, 361, 432, 361, 432, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 433, 433, + 433, 433, 433, 433, 433, 433, 361, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 361, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, + 203, 361, 547, 547, 547, 547, 547, 547, 547, 547, 547 }; @@ -1377,7 +1377,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; int cs; hb_glyph_info_t *info = buffer->info; - + #line 1382 "hb-ot-shape-complex-indic-machine.hh" { cs = indic_syllable_machine_start; @@ -1394,7 +1394,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; - + #line 1399 "hb-ot-shape-complex-indic-machine.hh" { int _slen; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic.cc index 6486e84f5d9..de0d177ba2e 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-indic.cc @@ -1713,33 +1713,28 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c, switch (ab) { /* Don't decompose these. */ - case 0x0931u : return false; - case 0x0B94u : return false; + case 0x0931u : return false; /* DEVANAGARI LETTER RRA */ + case 0x0B94u : return false; /* TAMIL LETTER AU */ /* * Decompose split matras that don't have Unicode decompositions. */ - case 0x0F77u : *a = 0x0FB2u; *b= 0x0F81u; return true; - case 0x0F79u : *a = 0x0FB3u; *b= 0x0F81u; return true; + /* Khmer */ case 0x17BEu : *a = 0x17C1u; *b= 0x17BEu; return true; case 0x17BFu : *a = 0x17C1u; *b= 0x17BFu; return true; case 0x17C0u : *a = 0x17C1u; *b= 0x17C0u; return true; case 0x17C4u : *a = 0x17C1u; *b= 0x17C4u; return true; case 0x17C5u : *a = 0x17C1u; *b= 0x17C5u; return true; - case 0x1925u : *a = 0x1920u; *b= 0x1923u; return true; - case 0x1926u : *a = 0x1920u; *b= 0x1924u; return true; - case 0x1B3Cu : *a = 0x1B42u; *b= 0x1B3Cu; return true; - case 0x1112Eu : *a = 0x11127u; *b= 0x11131u; return true; - case 0x1112Fu : *a = 0x11127u; *b= 0x11132u; return true; + #if 0 + /* Gujarati */ /* This one has no decomposition in Unicode, but needs no decomposition either. */ /* case 0x0AC9u : return false; */ + + /* Oriya */ case 0x0B57u : *a = no decomp, -> RIGHT; return true; - case 0x1C29u : *a = no decomp, -> LEFT; return true; - case 0xA9C0u : *a = no decomp, -> RIGHT; return true; - case 0x111BuF : *a = no decomp, -> ABOVE; return true; #endif } @@ -1819,6 +1814,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = decompose_indic, compose_indic, setup_masks_indic, + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh index c16b4fda39e..e2e91e73c2f 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh @@ -34,223 +34,223 @@ #line 36 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp" static const unsigned char _myanmar_syllable_machine_trans_keys[] = { - 1u, 31u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, - 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u, - 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u, 5u, 8u, - 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, - 3u, 30u, 3u, 29u, 1u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, + 1u, 31u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, + 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u, + 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u, 5u, 8u, + 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, + 3u, 30u, 3u, 29u, 1u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 8u, 8u, 0 }; static const char _myanmar_syllable_machine_key_spans[] = { - 31, 28, 25, 4, 25, 23, 21, 21, - 27, 27, 27, 27, 16, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 25, 4, - 25, 23, 21, 21, 27, 27, 27, 27, - 28, 27, 30, 27, 27, 27, 27, 27, + 31, 28, 25, 4, 25, 23, 21, 21, + 27, 27, 27, 27, 16, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 25, 4, + 25, 23, 21, 21, 27, 27, 27, 27, + 28, 27, 30, 27, 27, 27, 27, 27, 27, 27, 27, 27, 1 }; static const short _myanmar_syllable_machine_index_offsets[] = { - 0, 32, 61, 87, 92, 118, 142, 164, - 186, 214, 242, 270, 298, 315, 343, 371, - 399, 427, 455, 483, 511, 539, 567, 593, - 598, 624, 648, 670, 692, 720, 748, 776, - 804, 833, 861, 892, 920, 948, 976, 1004, + 0, 32, 61, 87, 92, 118, 142, 164, + 186, 214, 242, 270, 298, 315, 343, 371, + 399, 427, 455, 483, 511, 539, 567, 593, + 598, 624, 648, 670, 692, 720, 748, 776, + 804, 833, 861, 892, 920, 948, 976, 1004, 1032, 1060, 1088, 1116, 1144 }; static const char _myanmar_syllable_machine_indicies[] = { - 1, 1, 2, 3, 4, 4, 0, 5, - 0, 6, 1, 0, 0, 0, 0, 7, - 0, 8, 1, 0, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 0, - 21, 22, 23, 23, 20, 24, 20, 25, - 20, 20, 20, 20, 20, 20, 20, 26, - 20, 20, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 20, 23, 23, 20, - 24, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 37, 20, 20, 20, 20, 20, - 20, 31, 20, 20, 20, 35, 20, 23, - 23, 20, 24, 20, 23, 23, 20, 24, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 31, 20, 20, 20, 35, 20, 38, 20, - 23, 23, 20, 24, 20, 31, 20, 20, - 20, 20, 20, 20, 20, 39, 20, 20, - 20, 20, 20, 20, 31, 20, 23, 23, - 20, 24, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 39, 20, 20, 20, 20, - 20, 20, 31, 20, 23, 23, 20, 24, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 31, 20, 21, 20, 23, 23, 20, 24, - 20, 25, 20, 20, 20, 20, 20, 20, - 20, 40, 20, 20, 40, 20, 20, 20, - 31, 41, 20, 20, 35, 20, 21, 20, - 23, 23, 20, 24, 20, 25, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 31, 20, 20, 20, - 35, 20, 21, 20, 23, 23, 20, 24, - 20, 25, 20, 20, 20, 20, 20, 20, - 20, 40, 20, 20, 20, 20, 20, 20, - 31, 41, 20, 20, 35, 20, 21, 20, - 23, 23, 20, 24, 20, 25, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 31, 41, 20, 20, - 35, 20, 1, 1, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 1, 20, 21, 20, 23, 23, 20, - 24, 20, 25, 20, 20, 20, 20, 20, - 20, 20, 26, 20, 20, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 20, 21, - 20, 23, 23, 20, 24, 20, 25, 20, - 20, 20, 20, 20, 20, 20, 34, 20, - 20, 20, 20, 20, 20, 31, 32, 33, - 34, 35, 20, 21, 20, 23, 23, 20, - 24, 20, 25, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 31, 32, 33, 34, 35, 20, 21, - 20, 23, 23, 20, 24, 20, 25, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 31, 32, 33, - 20, 35, 20, 21, 20, 23, 23, 20, - 24, 20, 25, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, 31, 20, 33, 20, 35, 20, 21, - 20, 23, 23, 20, 24, 20, 25, 20, - 20, 20, 20, 20, 20, 20, 34, 20, - 20, 27, 20, 29, 20, 31, 32, 33, - 34, 35, 20, 21, 20, 23, 23, 20, - 24, 20, 25, 20, 20, 20, 20, 20, - 20, 20, 34, 20, 20, 27, 20, 20, - 20, 31, 32, 33, 34, 35, 20, 21, - 20, 23, 23, 20, 24, 20, 25, 20, - 20, 20, 20, 20, 20, 20, 34, 20, - 20, 27, 28, 29, 20, 31, 32, 33, - 34, 35, 20, 21, 22, 23, 23, 20, - 24, 20, 25, 20, 20, 20, 20, 20, - 20, 20, 26, 20, 20, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 20, 3, - 3, 42, 5, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 43, 42, 42, 42, - 42, 42, 42, 13, 42, 42, 42, 17, - 42, 3, 3, 42, 5, 42, 3, 3, - 42, 5, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 13, 42, 42, 42, 17, 42, - 44, 42, 3, 3, 42, 5, 42, 13, - 42, 42, 42, 42, 42, 42, 42, 45, - 42, 42, 42, 42, 42, 42, 13, 42, - 3, 3, 42, 5, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 45, 42, 42, - 42, 42, 42, 42, 13, 42, 3, 3, - 42, 5, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 13, 42, 2, 42, 3, 3, - 42, 5, 42, 6, 42, 42, 42, 42, - 42, 42, 42, 46, 42, 42, 46, 42, - 42, 42, 13, 47, 42, 42, 17, 42, - 2, 42, 3, 3, 42, 5, 42, 6, - 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 13, 42, - 42, 42, 17, 42, 2, 42, 3, 3, - 42, 5, 42, 6, 42, 42, 42, 42, - 42, 42, 42, 46, 42, 42, 42, 42, - 42, 42, 13, 47, 42, 42, 17, 42, - 2, 42, 3, 3, 42, 5, 42, 6, - 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 13, 47, - 42, 42, 17, 42, 21, 22, 23, 23, - 20, 24, 20, 25, 20, 20, 20, 20, - 20, 20, 20, 48, 20, 20, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, - 20, 21, 49, 23, 23, 20, 24, 20, - 25, 20, 20, 20, 20, 20, 20, 20, - 26, 20, 20, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 20, 1, 1, 2, - 3, 3, 3, 42, 5, 42, 6, 1, - 42, 42, 42, 42, 1, 42, 8, 1, - 42, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 42, 2, 42, 3, 3, - 42, 5, 42, 6, 42, 42, 42, 42, - 42, 42, 42, 8, 42, 42, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 42, - 2, 42, 3, 3, 42, 5, 42, 6, - 42, 42, 42, 42, 42, 42, 42, 16, - 42, 42, 42, 42, 42, 42, 13, 14, - 15, 16, 17, 42, 2, 42, 3, 3, - 42, 5, 42, 6, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 13, 14, 15, 16, 17, 42, - 2, 42, 3, 3, 42, 5, 42, 6, - 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 13, 14, - 15, 42, 17, 42, 2, 42, 3, 3, - 42, 5, 42, 6, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 13, 42, 15, 42, 17, 42, - 2, 42, 3, 3, 42, 5, 42, 6, - 42, 42, 42, 42, 42, 42, 42, 16, - 42, 42, 9, 42, 11, 42, 13, 14, - 15, 16, 17, 42, 2, 42, 3, 3, - 42, 5, 42, 6, 42, 42, 42, 42, - 42, 42, 42, 16, 42, 42, 9, 42, - 42, 42, 13, 14, 15, 16, 17, 42, - 2, 42, 3, 3, 42, 5, 42, 6, - 42, 42, 42, 42, 42, 42, 42, 16, - 42, 42, 9, 10, 11, 42, 13, 14, - 15, 16, 17, 42, 2, 3, 3, 3, - 42, 5, 42, 6, 42, 42, 42, 42, - 42, 42, 42, 8, 42, 42, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 42, + 1, 1, 2, 3, 4, 4, 0, 5, + 0, 6, 1, 0, 0, 0, 0, 7, + 0, 8, 1, 0, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 0, + 21, 22, 23, 23, 20, 24, 20, 25, + 20, 20, 20, 20, 20, 20, 20, 26, + 20, 20, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 20, 23, 23, 20, + 24, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 37, 20, 20, 20, 20, 20, + 20, 31, 20, 20, 20, 35, 20, 23, + 23, 20, 24, 20, 23, 23, 20, 24, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 31, 20, 20, 20, 35, 20, 38, 20, + 23, 23, 20, 24, 20, 31, 20, 20, + 20, 20, 20, 20, 20, 39, 20, 20, + 20, 20, 20, 20, 31, 20, 23, 23, + 20, 24, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 39, 20, 20, 20, 20, + 20, 20, 31, 20, 23, 23, 20, 24, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 31, 20, 21, 20, 23, 23, 20, 24, + 20, 25, 20, 20, 20, 20, 20, 20, + 20, 40, 20, 20, 40, 20, 20, 20, + 31, 41, 20, 20, 35, 20, 21, 20, + 23, 23, 20, 24, 20, 25, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 31, 20, 20, 20, + 35, 20, 21, 20, 23, 23, 20, 24, + 20, 25, 20, 20, 20, 20, 20, 20, + 20, 40, 20, 20, 20, 20, 20, 20, + 31, 41, 20, 20, 35, 20, 21, 20, + 23, 23, 20, 24, 20, 25, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 31, 41, 20, 20, + 35, 20, 1, 1, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 1, 20, 21, 20, 23, 23, 20, + 24, 20, 25, 20, 20, 20, 20, 20, + 20, 20, 26, 20, 20, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 20, 21, + 20, 23, 23, 20, 24, 20, 25, 20, + 20, 20, 20, 20, 20, 20, 34, 20, + 20, 20, 20, 20, 20, 31, 32, 33, + 34, 35, 20, 21, 20, 23, 23, 20, + 24, 20, 25, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 31, 32, 33, 34, 35, 20, 21, + 20, 23, 23, 20, 24, 20, 25, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 31, 32, 33, + 20, 35, 20, 21, 20, 23, 23, 20, + 24, 20, 25, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, + 20, 31, 20, 33, 20, 35, 20, 21, + 20, 23, 23, 20, 24, 20, 25, 20, + 20, 20, 20, 20, 20, 20, 34, 20, + 20, 27, 20, 29, 20, 31, 32, 33, + 34, 35, 20, 21, 20, 23, 23, 20, + 24, 20, 25, 20, 20, 20, 20, 20, + 20, 20, 34, 20, 20, 27, 20, 20, + 20, 31, 32, 33, 34, 35, 20, 21, + 20, 23, 23, 20, 24, 20, 25, 20, + 20, 20, 20, 20, 20, 20, 34, 20, + 20, 27, 28, 29, 20, 31, 32, 33, + 34, 35, 20, 21, 22, 23, 23, 20, + 24, 20, 25, 20, 20, 20, 20, 20, + 20, 20, 26, 20, 20, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 20, 3, + 3, 42, 5, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 43, 42, 42, 42, + 42, 42, 42, 13, 42, 42, 42, 17, + 42, 3, 3, 42, 5, 42, 3, 3, + 42, 5, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 13, 42, 42, 42, 17, 42, + 44, 42, 3, 3, 42, 5, 42, 13, + 42, 42, 42, 42, 42, 42, 42, 45, + 42, 42, 42, 42, 42, 42, 13, 42, + 3, 3, 42, 5, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 45, 42, 42, + 42, 42, 42, 42, 13, 42, 3, 3, + 42, 5, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 13, 42, 2, 42, 3, 3, + 42, 5, 42, 6, 42, 42, 42, 42, + 42, 42, 42, 46, 42, 42, 46, 42, + 42, 42, 13, 47, 42, 42, 17, 42, + 2, 42, 3, 3, 42, 5, 42, 6, + 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 13, 42, + 42, 42, 17, 42, 2, 42, 3, 3, + 42, 5, 42, 6, 42, 42, 42, 42, + 42, 42, 42, 46, 42, 42, 42, 42, + 42, 42, 13, 47, 42, 42, 17, 42, + 2, 42, 3, 3, 42, 5, 42, 6, + 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 13, 47, + 42, 42, 17, 42, 21, 22, 23, 23, + 20, 24, 20, 25, 20, 20, 20, 20, + 20, 20, 20, 48, 20, 20, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, + 20, 21, 49, 23, 23, 20, 24, 20, + 25, 20, 20, 20, 20, 20, 20, 20, + 26, 20, 20, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 20, 1, 1, 2, + 3, 3, 3, 42, 5, 42, 6, 1, + 42, 42, 42, 42, 1, 42, 8, 1, + 42, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 42, 2, 42, 3, 3, + 42, 5, 42, 6, 42, 42, 42, 42, + 42, 42, 42, 8, 42, 42, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 42, + 2, 42, 3, 3, 42, 5, 42, 6, + 42, 42, 42, 42, 42, 42, 42, 16, + 42, 42, 42, 42, 42, 42, 13, 14, + 15, 16, 17, 42, 2, 42, 3, 3, + 42, 5, 42, 6, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 13, 14, 15, 16, 17, 42, + 2, 42, 3, 3, 42, 5, 42, 6, + 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 13, 14, + 15, 42, 17, 42, 2, 42, 3, 3, + 42, 5, 42, 6, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 13, 42, 15, 42, 17, 42, + 2, 42, 3, 3, 42, 5, 42, 6, + 42, 42, 42, 42, 42, 42, 42, 16, + 42, 42, 9, 42, 11, 42, 13, 14, + 15, 16, 17, 42, 2, 42, 3, 3, + 42, 5, 42, 6, 42, 42, 42, 42, + 42, 42, 42, 16, 42, 42, 9, 42, + 42, 42, 13, 14, 15, 16, 17, 42, + 2, 42, 3, 3, 42, 5, 42, 6, + 42, 42, 42, 42, 42, 42, 42, 16, + 42, 42, 9, 10, 11, 42, 13, 14, + 15, 16, 17, 42, 2, 3, 3, 3, + 42, 5, 42, 6, 42, 42, 42, 42, + 42, 42, 42, 8, 42, 42, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 42, 51, 50, 0 }; static const char _myanmar_syllable_machine_trans_targs[] = { - 0, 1, 22, 0, 0, 23, 29, 32, - 35, 36, 40, 41, 42, 25, 38, 39, - 37, 28, 43, 44, 0, 2, 12, 0, - 3, 9, 13, 14, 18, 19, 20, 5, - 16, 17, 15, 8, 21, 4, 6, 7, - 10, 11, 0, 24, 26, 27, 30, 31, + 0, 1, 22, 0, 0, 23, 29, 32, + 35, 36, 40, 41, 42, 25, 38, 39, + 37, 28, 43, 44, 0, 2, 12, 0, + 3, 9, 13, 14, 18, 19, 20, 5, + 16, 17, 15, 8, 21, 4, 6, 7, + 10, 11, 0, 24, 26, 27, 30, 31, 33, 34, 0, 0 }; static const char _myanmar_syllable_machine_trans_actions[] = { - 3, 0, 0, 4, 5, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8, 0, 0, 0, 0, 0, + 3, 0, 0, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 0, 0, 7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 10 }; static const char _myanmar_syllable_machine_to_state_actions[] = { - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char _myanmar_syllable_machine_from_state_actions[] = { - 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const short _myanmar_syllable_machine_eof_trans[] = { - 0, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 21, 21, 43, 43, 43, 43, 43, 43, + 0, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, + 21, 21, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 51 }; @@ -284,7 +284,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; int cs; hb_glyph_info_t *info = buffer->info; - + #line 289 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp" { cs = myanmar_syllable_machine_start; @@ -301,7 +301,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; - + #line 306 "../../src/hb-ot-shape-complex-myanmar-machine.hh.tmp" { int _slen; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc index 6c6466275a6..0097a8e2b58 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc @@ -521,6 +521,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old = NULL, /* decompose */ NULL, /* compose */ NULL, /* setup_masks */ + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; @@ -538,6 +539,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = NULL, /* decompose */ NULL, /* compose */ setup_masks_myanmar, + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, false, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-private.hh index c1d08dc7145..b374babebcc 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-private.hh @@ -146,6 +146,14 @@ struct hb_ot_complex_shaper_t hb_buffer_t *buffer, hb_font_t *font); + /* disable_otl() + * Called during shape(). + * If set and returns true, GDEF/GSUB/GPOS of the font are ignored + * and fallback operations used. + * May be NULL. + */ + bool (*disable_otl) (const hb_ot_shape_plan_t *plan); + hb_ot_shape_zero_width_marks_type_t zero_width_marks; bool fallback_position; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-thai.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-thai.cc index e4889d4eff6..b0117369a64 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-thai.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-thai.cc @@ -376,6 +376,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai = NULL, /* decompose */ NULL, /* compose */ NULL, /* setup_masks */ + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, false,/* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-tibetan.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-tibetan.cc index a77b531daa5..aadf59f5add 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-tibetan.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-tibetan.cc @@ -57,6 +57,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_tibetan = NULL, /* decompose */ NULL, /* compose */ NULL, /* setup_masks */ + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-machine.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-machine.hh index 97409f15b0f..ab8df0694ff 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-machine.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use-machine.hh @@ -36,247 +36,247 @@ #line 38 "hb-ot-shape-complex-use-machine.hh" static const unsigned char _use_syllable_machine_trans_keys[] = { - 1u, 1u, 0u, 39u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u, - 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, - 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u, - 4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, - 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, - 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u, + 1u, 1u, 0u, 39u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u, + 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, + 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u, + 4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, + 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, + 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u, 42u, 42u, 0 }; static const char _use_syllable_machine_key_spans[] = { - 1, 40, 1, 32, 32, 1, 32, 32, - 32, 19, 19, 19, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 9, - 1, 1, 32, 32, 32, 32, 19, 19, - 19, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 1, 39, 32, 22, 2, + 1, 40, 1, 32, 32, 1, 32, 32, + 32, 19, 19, 19, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 9, + 1, 1, 32, 32, 32, 32, 19, 19, + 19, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 1, 39, 32, 22, 2, 1 }; static const short _use_syllable_machine_index_offsets[] = { - 0, 2, 43, 45, 78, 111, 113, 146, - 179, 212, 232, 252, 272, 305, 338, 371, - 404, 437, 470, 503, 536, 569, 602, 635, - 645, 647, 649, 682, 715, 748, 781, 801, - 821, 841, 874, 907, 940, 973, 1006, 1039, - 1072, 1105, 1138, 1171, 1173, 1213, 1246, 1269, + 0, 2, 43, 45, 78, 111, 113, 146, + 179, 212, 232, 252, 272, 305, 338, 371, + 404, 437, 470, 503, 536, 569, 602, 635, + 645, 647, 649, 682, 715, 748, 781, 801, + 821, 841, 874, 907, 940, 973, 1006, 1039, + 1072, 1105, 1138, 1171, 1173, 1213, 1246, 1269, 1272 }; static const char _use_syllable_machine_indicies[] = { - 1, 0, 2, 3, 4, 2, 5, 3, - 4, 4, 6, 4, 4, 1, 7, 4, - 4, 4, 2, 2, 8, 9, 4, 4, - 10, 11, 12, 13, 14, 15, 16, 10, - 17, 18, 19, 20, 21, 22, 4, 23, - 24, 25, 4, 27, 26, 29, 28, 28, - 30, 31, 28, 28, 28, 28, 28, 28, - 28, 28, 32, 33, 34, 35, 36, 37, - 38, 39, 33, 40, 32, 41, 42, 43, - 44, 28, 45, 46, 47, 28, 29, 28, - 28, 30, 31, 28, 28, 28, 28, 28, - 28, 28, 28, 48, 33, 34, 35, 36, - 37, 38, 39, 33, 40, 41, 41, 42, - 43, 44, 28, 45, 46, 47, 28, 30, - 49, 29, 28, 28, 30, 31, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 33, - 34, 35, 36, 37, 38, 39, 33, 40, - 41, 41, 42, 43, 44, 28, 45, 46, - 47, 28, 29, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 33, 34, 35, 36, 37, 28, 28, 28, - 28, 28, 28, 42, 43, 44, 28, 45, - 46, 47, 28, 29, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 34, 35, 36, 37, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 45, 46, 47, 28, 29, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 35, 36, 37, 28, - 29, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 36, 37, 28, 29, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 37, 28, - 29, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 35, 36, 37, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 45, 46, 47, - 28, 29, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 35, 36, 37, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 46, - 47, 28, 29, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 35, 36, 37, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 47, 28, 29, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 34, 35, 36, 37, 28, 28, - 28, 28, 28, 28, 42, 43, 44, 28, - 45, 46, 47, 28, 29, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 34, 35, 36, 37, 28, - 28, 28, 28, 28, 28, 28, 43, 44, - 28, 45, 46, 47, 28, 29, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 34, 35, 36, 37, - 28, 28, 28, 28, 28, 28, 28, 28, - 44, 28, 45, 46, 47, 28, 29, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 33, 34, 35, 36, - 37, 28, 39, 33, 28, 28, 28, 42, - 43, 44, 28, 45, 46, 47, 28, 29, - 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 33, 34, 35, - 36, 37, 28, 28, 33, 28, 28, 28, - 42, 43, 44, 28, 45, 46, 47, 28, - 29, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 33, 34, - 35, 36, 37, 38, 39, 33, 28, 28, - 28, 42, 43, 44, 28, 45, 46, 47, - 28, 29, 28, 28, 30, 31, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 33, - 34, 35, 36, 37, 38, 39, 33, 40, - 28, 41, 42, 43, 44, 28, 45, 46, - 47, 28, 29, 28, 28, 30, 31, 28, - 28, 28, 28, 28, 28, 28, 28, 28, - 33, 34, 35, 36, 37, 38, 39, 33, - 40, 32, 41, 42, 43, 44, 28, 45, - 46, 47, 28, 51, 50, 50, 50, 50, - 50, 50, 50, 52, 50, 5, 53, 51, - 50, 6, 54, 54, 1, 55, 54, 54, - 54, 54, 54, 54, 54, 54, 56, 10, - 11, 12, 13, 14, 15, 16, 10, 17, - 19, 19, 20, 21, 22, 54, 23, 24, - 25, 54, 6, 54, 54, 1, 55, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 10, 11, 12, 13, 14, 15, 16, 10, - 17, 19, 19, 20, 21, 22, 54, 23, - 24, 25, 54, 6, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 10, 11, 12, 13, 14, 54, 54, - 54, 54, 54, 54, 20, 21, 22, 54, - 23, 24, 25, 54, 6, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 11, 12, 13, 14, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 23, 24, 25, 54, 6, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 12, 13, 14, - 54, 6, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 13, 14, 54, 6, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 14, - 54, 6, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 12, 13, 14, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 23, 24, - 25, 54, 6, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 12, 13, 14, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 24, 25, 54, 6, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 12, 13, 14, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 25, 54, 6, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 11, 12, 13, 14, 54, - 54, 54, 54, 54, 54, 20, 21, 22, - 54, 23, 24, 25, 54, 6, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 11, 12, 13, 14, - 54, 54, 54, 54, 54, 54, 54, 21, - 22, 54, 23, 24, 25, 54, 6, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 11, 12, 13, - 14, 54, 54, 54, 54, 54, 54, 54, - 54, 22, 54, 23, 24, 25, 54, 6, - 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 10, 11, 12, - 13, 14, 54, 16, 10, 54, 54, 54, - 20, 21, 22, 54, 23, 24, 25, 54, - 6, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 10, 11, - 12, 13, 14, 54, 54, 10, 54, 54, - 54, 20, 21, 22, 54, 23, 24, 25, - 54, 6, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 10, - 11, 12, 13, 14, 15, 16, 10, 54, - 54, 54, 20, 21, 22, 54, 23, 24, - 25, 54, 6, 54, 54, 1, 55, 54, - 54, 54, 54, 54, 54, 54, 54, 54, - 10, 11, 12, 13, 14, 15, 16, 10, - 17, 54, 19, 20, 21, 22, 54, 23, - 24, 25, 54, 1, 57, 3, 54, 54, - 54, 3, 54, 54, 6, 54, 54, 1, - 55, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 10, 11, 12, 13, 14, 15, - 16, 10, 17, 18, 19, 20, 21, 22, - 54, 23, 24, 25, 54, 6, 54, 54, - 1, 55, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 10, 11, 12, 13, 14, - 15, 16, 10, 17, 18, 19, 20, 21, - 22, 54, 23, 24, 25, 54, 59, 58, - 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 59, 60, 58, 59, 60, 58, + 1, 0, 2, 3, 4, 2, 5, 3, + 4, 4, 6, 4, 4, 1, 7, 4, + 4, 4, 2, 2, 8, 9, 4, 4, + 10, 11, 12, 13, 14, 15, 16, 10, + 17, 18, 19, 20, 21, 22, 4, 23, + 24, 25, 4, 27, 26, 29, 28, 28, + 30, 31, 28, 28, 28, 28, 28, 28, + 28, 28, 32, 33, 34, 35, 36, 37, + 38, 39, 33, 40, 32, 41, 42, 43, + 44, 28, 45, 46, 47, 28, 29, 28, + 28, 30, 31, 28, 28, 28, 28, 28, + 28, 28, 28, 48, 33, 34, 35, 36, + 37, 38, 39, 33, 40, 41, 41, 42, + 43, 44, 28, 45, 46, 47, 28, 30, + 49, 29, 28, 28, 30, 31, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 33, + 34, 35, 36, 37, 38, 39, 33, 40, + 41, 41, 42, 43, 44, 28, 45, 46, + 47, 28, 29, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 33, 34, 35, 36, 37, 28, 28, 28, + 28, 28, 28, 42, 43, 44, 28, 45, + 46, 47, 28, 29, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 34, 35, 36, 37, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 45, 46, 47, 28, 29, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 35, 36, 37, 28, + 29, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 36, 37, 28, 29, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 37, 28, + 29, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 35, 36, 37, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 45, 46, 47, + 28, 29, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 35, 36, 37, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 46, + 47, 28, 29, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 35, 36, 37, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 47, 28, 29, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 34, 35, 36, 37, 28, 28, + 28, 28, 28, 28, 42, 43, 44, 28, + 45, 46, 47, 28, 29, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 34, 35, 36, 37, 28, + 28, 28, 28, 28, 28, 28, 43, 44, + 28, 45, 46, 47, 28, 29, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 34, 35, 36, 37, + 28, 28, 28, 28, 28, 28, 28, 28, + 44, 28, 45, 46, 47, 28, 29, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 33, 34, 35, 36, + 37, 28, 39, 33, 28, 28, 28, 42, + 43, 44, 28, 45, 46, 47, 28, 29, + 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 33, 34, 35, + 36, 37, 28, 28, 33, 28, 28, 28, + 42, 43, 44, 28, 45, 46, 47, 28, + 29, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 33, 34, + 35, 36, 37, 38, 39, 33, 28, 28, + 28, 42, 43, 44, 28, 45, 46, 47, + 28, 29, 28, 28, 30, 31, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 33, + 34, 35, 36, 37, 38, 39, 33, 40, + 28, 41, 42, 43, 44, 28, 45, 46, + 47, 28, 29, 28, 28, 30, 31, 28, + 28, 28, 28, 28, 28, 28, 28, 28, + 33, 34, 35, 36, 37, 38, 39, 33, + 40, 32, 41, 42, 43, 44, 28, 45, + 46, 47, 28, 51, 50, 50, 50, 50, + 50, 50, 50, 52, 50, 5, 53, 51, + 50, 6, 54, 54, 1, 55, 54, 54, + 54, 54, 54, 54, 54, 54, 56, 10, + 11, 12, 13, 14, 15, 16, 10, 17, + 19, 19, 20, 21, 22, 54, 23, 24, + 25, 54, 6, 54, 54, 1, 55, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 10, 11, 12, 13, 14, 15, 16, 10, + 17, 19, 19, 20, 21, 22, 54, 23, + 24, 25, 54, 6, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 10, 11, 12, 13, 14, 54, 54, + 54, 54, 54, 54, 20, 21, 22, 54, + 23, 24, 25, 54, 6, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 11, 12, 13, 14, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 23, 24, 25, 54, 6, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 12, 13, 14, + 54, 6, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 13, 14, 54, 6, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 14, + 54, 6, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 12, 13, 14, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 23, 24, + 25, 54, 6, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 12, 13, 14, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 24, 25, 54, 6, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 12, 13, 14, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 25, 54, 6, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 11, 12, 13, 14, 54, + 54, 54, 54, 54, 54, 20, 21, 22, + 54, 23, 24, 25, 54, 6, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 11, 12, 13, 14, + 54, 54, 54, 54, 54, 54, 54, 21, + 22, 54, 23, 24, 25, 54, 6, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 11, 12, 13, + 14, 54, 54, 54, 54, 54, 54, 54, + 54, 22, 54, 23, 24, 25, 54, 6, + 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 10, 11, 12, + 13, 14, 54, 16, 10, 54, 54, 54, + 20, 21, 22, 54, 23, 24, 25, 54, + 6, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 10, 11, + 12, 13, 14, 54, 54, 10, 54, 54, + 54, 20, 21, 22, 54, 23, 24, 25, + 54, 6, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 10, + 11, 12, 13, 14, 15, 16, 10, 54, + 54, 54, 20, 21, 22, 54, 23, 24, + 25, 54, 6, 54, 54, 1, 55, 54, + 54, 54, 54, 54, 54, 54, 54, 54, + 10, 11, 12, 13, 14, 15, 16, 10, + 17, 54, 19, 20, 21, 22, 54, 23, + 24, 25, 54, 1, 57, 3, 54, 54, + 54, 3, 54, 54, 6, 54, 54, 1, + 55, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 10, 11, 12, 13, 14, 15, + 16, 10, 17, 18, 19, 20, 21, 22, + 54, 23, 24, 25, 54, 6, 54, 54, + 1, 55, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 10, 11, 12, 13, 14, + 15, 16, 10, 17, 18, 19, 20, 21, + 22, 54, 23, 24, 25, 54, 59, 58, + 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 59, 60, 58, 59, 60, 58, 60, 58, 0 }; static const char _use_syllable_machine_trans_targs[] = { - 1, 26, 2, 3, 1, 23, 1, 43, - 44, 46, 28, 29, 30, 31, 32, 39, - 40, 41, 45, 42, 36, 37, 38, 33, - 34, 35, 1, 1, 1, 1, 4, 5, - 22, 7, 8, 9, 10, 11, 18, 19, - 20, 21, 15, 16, 17, 12, 13, 14, - 6, 1, 1, 24, 25, 1, 1, 0, + 1, 26, 2, 3, 1, 23, 1, 43, + 44, 46, 28, 29, 30, 31, 32, 39, + 40, 41, 45, 42, 36, 37, 38, 33, + 34, 35, 1, 1, 1, 1, 4, 5, + 22, 7, 8, 9, 10, 11, 18, 19, + 20, 21, 15, 16, 17, 12, 13, 14, + 6, 1, 1, 24, 25, 1, 1, 0, 27, 1, 1, 47, 48 }; static const char _use_syllable_machine_trans_actions[] = { - 1, 2, 0, 0, 5, 0, 6, 0, - 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 2, 0, 0, 0, 0, - 0, 0, 7, 8, 9, 10, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 11, 12, 0, 0, 13, 14, 0, + 1, 2, 0, 0, 5, 0, 6, 0, + 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 2, 0, 0, 0, 0, + 0, 0, 7, 8, 9, 10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 11, 12, 0, 0, 13, 14, 0, 2, 15, 16, 0, 0 }; static const char _use_syllable_machine_to_state_actions[] = { - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char _use_syllable_machine_from_state_actions[] = { - 0, 4, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const short _use_syllable_machine_eof_trans[] = { - 1, 0, 27, 29, 29, 50, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 51, - 54, 51, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 58, 55, 55, 59, 59, + 1, 0, 27, 29, 29, 50, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 51, + 54, 51, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 58, 55, 55, 59, 59, 59 }; @@ -310,7 +310,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; int cs; hb_glyph_info_t *info = buffer->info; - + #line 315 "hb-ot-shape-complex-use-machine.hh" { cs = use_syllable_machine_start; @@ -327,7 +327,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; - + #line 332 "hb-ot-shape-complex-use-machine.hh" { int _slen; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use.cc index eeca79ae443..9488d1a2c8b 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-use.cc @@ -558,6 +558,47 @@ reorder (const hb_ot_shape_plan_t *plan, HB_BUFFER_DEALLOCATE_VAR (buffer, use_category); } +static bool +decompose_use (const hb_ot_shape_normalize_context_t *c, + hb_codepoint_t ab, + hb_codepoint_t *a, + hb_codepoint_t *b) +{ + switch (ab) + { + /* Chakma: + * Special case where the Unicode decomp gives matras in the wrong order + * for cluster validation. + */ + case 0x1112Eu : *a = 0x11127u; *b= 0x11131u; return true; + case 0x1112Fu : *a = 0x11127u; *b= 0x11132u; return true; + + /* + * Decompose split matras that don't have Unicode decompositions. + */ + + /* Limbu */ + case 0x1925u : *a = 0x1920u; *b= 0x1923u; return true; + case 0x1926u : *a = 0x1920u; *b= 0x1924u; return true; + + /* Balinese */ + case 0x1B3Cu : *a = 0x1B42u; *b= 0x1B3Cu; return true; + +#if 0 + /* Lepcha */ + case 0x1C29u : *a = no decomp, -> LEFT; return true; + + /* Javanese */ + case 0xA9C0u : *a = no decomp, -> RIGHT; return true; + + /* Sharada */ + case 0x111BFu : *a = no decomp, -> ABOVE; return true; +#endif + } + + return (bool) c->unicode->decompose (ab, a, b); +} + static bool compose_use (const hb_ot_shape_normalize_context_t *c, hb_codepoint_t a, @@ -582,9 +623,10 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use = NULL, /* preprocess_text */ NULL, /* postprocess_glyphs */ HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, - NULL, /* decompose */ + decompose_use, compose_use, setup_masks_use, + NULL, /* disable_otl */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, false, /* fallback_position */ }; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-private.hh index 3734827ef58..775417de85c 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-private.hh @@ -77,11 +77,13 @@ struct hb_ot_shape_planner_t map (face, &props) {} ~hb_ot_shape_planner_t (void) { map.finish (); } - inline void compile (hb_ot_shape_plan_t &plan) + inline void compile (hb_ot_shape_plan_t &plan, + const int *coords, + unsigned int num_coords) { plan.props = props; plan.shaper = shaper; - map.compile (plan.map); + map.compile (plan.map, coords, num_coords); plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m')); plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c')); diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.cc index 35f2097d7ec..9e9b3fa3025 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape.cc @@ -69,6 +69,9 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, { hb_ot_map_builder_t *map = &planner->map; + map->add_global_bool_feature (HB_TAG('r','v','r','n')); + map->add_gsub_pause (NULL); + switch (props->direction) { case HB_DIRECTION_LTR: map->add_global_bool_feature (HB_TAG ('l','t','r','a')); @@ -163,7 +166,9 @@ _hb_ot_shaper_font_data_destroy (hb_ot_shaper_font_data_t *data) hb_ot_shaper_shape_plan_data_t * _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan, const hb_feature_t *user_features, - unsigned int num_user_features) + unsigned int num_user_features, + const int *coords, + unsigned int num_coords) { hb_ot_shape_plan_t *plan = (hb_ot_shape_plan_t *) calloc (1, sizeof (hb_ot_shape_plan_t)); if (unlikely (!plan)) @@ -173,9 +178,10 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan, planner.shaper = hb_ot_shape_complex_categorize (&planner); - hb_ot_shape_collect_features (&planner, &shape_plan->props, user_features, num_user_features); + hb_ot_shape_collect_features (&planner, &shape_plan->props, + user_features, num_user_features); - planner.compile (*plan); + planner.compile (*plan, coords, num_coords); if (plan->shaper->data_create) { plan->data = plan->shaper->data_create (plan); @@ -212,6 +218,8 @@ struct hb_ot_shape_context_t unsigned int num_user_features; /* Transient stuff */ + bool fallback_positioning; + bool fallback_glyph_classes; hb_direction_t target_direction; }; @@ -523,6 +531,32 @@ hb_ot_map_glyphs_fast (hb_buffer_t *buffer) buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS; } +static inline void +hb_synthesize_glyph_classes (hb_ot_shape_context_t *c) +{ + unsigned int count = c->buffer->len; + hb_glyph_info_t *info = c->buffer->info; + for (unsigned int i = 0; i < count; i++) + { + hb_ot_layout_glyph_props_flags_t klass; + + /* Never mark default-ignorables as marks. + * They won't get in the way of lookups anyway, + * but having them as mark will cause them to be skipped + * over if the lookup-flag says so, but at least for the + * Mongolian variation selectors, looks like Uniscribe + * marks them as non-mark. Some Mongolian fonts without + * GDEF rely on this. Another notable character that + * this applies to is COMBINING GRAPHEME JOINER. */ + klass = (_hb_glyph_info_get_general_category (&info[i]) != + HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK || + _hb_glyph_info_is_default_ignorable (&info[i])) ? + HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : + HB_OT_LAYOUT_GLYPH_PROPS_MARK; + _hb_glyph_info_set_glyph_props (&info[i], klass); + } +} + static inline void hb_ot_substitute_default (hb_ot_shape_context_t *c) { @@ -539,7 +573,7 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c) hb_ot_shape_setup_masks (c); /* This is unfortunate to go here, but necessary... */ - if (!hb_ot_layout_has_positioning (c->face)) + if (c->fallback_positioning) _hb_ot_shape_fallback_position_recategorize_marks (c->plan, c->font, buffer); hb_ot_map_glyphs_fast (buffer); @@ -554,6 +588,9 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c) hb_ot_layout_substitute_start (c->font, buffer); + if (!hb_ot_layout_has_glyph_classes (c->face)) + hb_synthesize_glyph_classes (c); + c->plan->substitute (c->font, buffer); return; @@ -632,14 +669,12 @@ hb_ot_position_default (hb_ot_shape_context_t *c) _hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer); } -static inline bool +static inline void hb_ot_position_complex (hb_ot_shape_context_t *c) { hb_ot_layout_position_start (c->font, c->buffer); - bool ret = false; unsigned int count = c->buffer->len; - bool has_positioning = (bool) hb_ot_layout_has_positioning (c->face); /* If the font has no GPOS, AND, no fallback positioning will * happen, AND, direction is forward, then when zeroing mark @@ -650,8 +685,9 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) * If fallback positinoing happens or GPOS is present, we don't * care. */ - bool adjust_offsets_when_zeroing = !(has_positioning || c->plan->shaper->fallback_position || - HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction)); + bool adjust_offsets_when_zeroing = c->fallback_positioning && + !c->plan->shaper->fallback_position && + HB_DIRECTION_IS_FORWARD (c->buffer->props.direction); switch (c->plan->shaper->zero_width_marks) { @@ -665,7 +701,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) break; } - if (has_positioning) + if (likely (!c->fallback_positioning)) { hb_glyph_info_t *info = c->buffer->info; hb_glyph_position_t *pos = c->buffer->pos; @@ -688,7 +724,6 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) &pos[i].x_offset, &pos[i].y_offset); - ret = true; } switch (c->plan->shaper->zero_width_marks) @@ -707,8 +742,6 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) hb_ot_layout_position_finish_advances (c->font, c->buffer); hb_ot_zero_width_default_ignorables (c); hb_ot_layout_position_finish_offsets (c->font, c->buffer); - - return ret; } static inline void @@ -718,9 +751,9 @@ hb_ot_position (hb_ot_shape_context_t *c) hb_ot_position_default (c); - hb_bool_t fallback = !hb_ot_position_complex (c); + hb_ot_position_complex (c); - if (fallback && c->plan->shaper->fallback_position) + if (c->fallback_positioning && c->plan->shaper->fallback_position) _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer); if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction)) @@ -728,7 +761,7 @@ hb_ot_position (hb_ot_shape_context_t *c) /* Visual fallback goes here. */ - if (fallback) + if (c->fallback_positioning) _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); _hb_buffer_deallocate_gsubgpos_vars (c->buffer); @@ -748,6 +781,11 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) (unsigned) HB_BUFFER_MAX_LEN_MIN); } + bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan); + //c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face); + c->fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (c->face); + c->fallback_glyph_classes = disable_otl || !hb_ot_layout_has_glyph_classes (c->face); + /* Save the original direction, we use it later. */ c->target_direction = c->buffer->props.direction; diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.cc index c790888d4c3..5989fb26a33 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-tag.cc @@ -826,16 +826,19 @@ static const LangTag ot_languages[] = { }; typedef struct { - char language[8]; + char language[11]; hb_tag_t tag; } LangTagLong; static const LangTagLong ot_languages_zh[] = { + /* Store longest-first, if one is a prefix of another. */ {"zh-cn", HB_TAG('Z','H','S',' ')}, /* Chinese (China) */ {"zh-hk", HB_TAG('Z','H','H',' ')}, /* Chinese (Hong Kong) */ - {"zh-mo", HB_TAG('Z','H','T',' ')}, /* Chinese (Macao) */ + {"zh-mo", HB_TAG('Z','H','H',' ')}, /* Chinese (Macao) */ {"zh-sg", HB_TAG('Z','H','S',' ')}, /* Chinese (Singapore) */ {"zh-tw", HB_TAG('Z','H','T',' ')}, /* Chinese (Taiwan) */ {"zh-hans", HB_TAG('Z','H','S',' ')}, /* Chinese (Simplified) */ + {"zh-hant-hk",HB_TAG('Z','H','H',' ')}, /* Chinese (Hong Kong) */ + {"zh-hant-mo",HB_TAG('Z','H','H',' ')}, /* Chinese (Macao) */ {"zh-hant", HB_TAG('Z','H','T',' ')}, /* Chinese (Traditional) */ }; @@ -889,13 +892,21 @@ hb_ot_tag_from_language (hb_language_t language) } /* - * The International Phonetic Alphabet is a variant tag in BCP-47, - * which can be applied to any language. + * "fonipa" is a variant tag in BCP-47, meaning the International Phonetic Alphabet. + * It can be applied to any language. */ if (strstr (lang_str, "-fonipa")) { return HB_TAG('I','P','P','H'); /* Phonetic transcription—IPA conventions */ } + /* + * "fonnapa" is a variant tag in BCP-47, meaning the North American Phonetic Alphabet + * also known as Americanist Phonetic Notation. It can be applied to any language. + */ + if (strstr (lang_str, "-fonnapa")) { + return HB_TAG('A','P','P','H'); /* Phonetic transcription—Americanist conventions */ + } + /* Find a language matching in the first component */ { const LangTag *lang_tag; @@ -937,7 +948,7 @@ hb_ot_tag_from_language (hb_language_t language) /** * hb_ot_tag_to_language: * - * + * * * Return value: (transfer none): * @@ -967,6 +978,8 @@ hb_ot_tag_to_language (hb_tag_t tag) /* struct LangTag has only room for 3-letter language tags. */ switch (tag) { + case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */ + return hb_language_from_string ("und-fonnapa", -1); case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */ return hb_language_from_string ("und-fonipa", -1); } diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot.h b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot.h index 47c92a58e4b..113e37b08ab 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot.h +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot.h @@ -32,6 +32,7 @@ #include "hb-ot-font.h" #include "hb-ot-layout.h" +#include "hb-ot-math.h" #include "hb-ot-tag.h" #include "hb-ot-shape.h" diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh index 1f270ee698c..a71665ba76b 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh @@ -689,17 +689,20 @@ _hb_debug_msg_va (const char *what, fprintf (stderr, " %*s ", (unsigned int) (2 * sizeof (void *)), ""); if (indented) { -/* One may want to add ASCII version of these. See: - * https://bugs.freedesktop.org/show_bug.cgi?id=50970 */ #define VBAR "\342\224\202" /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ #define VRBAR "\342\224\234" /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ #define DLBAR "\342\225\256" /* U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT */ #define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */ #define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */ - static const char bars[] = VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR; + static const char bars[] = + VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR + VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR + VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR + VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR + VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR; fprintf (stderr, "%2u %s" VRBAR "%s", level, - bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars), (unsigned int) (sizeof (VBAR) - 1) * level), + bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level), level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR); } else fprintf (stderr, " " VRBAR LBAR); diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set-private.hh index 6c0199c7b55..d4eee0e47fa 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set-private.hh @@ -313,7 +313,7 @@ struct hb_set_t for (unsigned int i = 0; i < ELTS; i++) if (elts[i]) for (unsigned int j = 0; j < BITS; j++) - if (elts[i] & (1 << j)) + if (elts[i] & (1u << j)) return i * BITS + j; return INVALID; } @@ -322,7 +322,7 @@ struct hb_set_t for (unsigned int i = ELTS; i; i--) if (elts[i - 1]) for (unsigned int j = BITS; j; j--) - if (elts[i - 1] & (1 << (j - 1))) + if (elts[i - 1] & (1u << (j - 1))) return (i - 1) * BITS + (j - 1); return INVALID; } diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set.cc index beb2910407b..766c18bd4ec 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-set.cc @@ -143,9 +143,9 @@ hb_set_get_user_data (hb_set_t *set, * hb_set_allocation_successful: * @set: a set. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -159,7 +159,7 @@ hb_set_allocation_successful (const hb_set_t *set HB_UNUSED) * hb_set_clear: * @set: a set. * - * + * * * Since: 0.9.2 **/ @@ -173,9 +173,9 @@ hb_set_clear (hb_set_t *set) * hb_set_is_empty: * @set: a set. * + * * - * - * Return value: + * Return value: * * Since: 0.9.7 **/ @@ -188,11 +188,11 @@ hb_set_is_empty (const hb_set_t *set) /** * hb_set_has: * @set: a set. - * @codepoint: + * @codepoint: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -206,9 +206,9 @@ hb_set_has (const hb_set_t *set, /** * hb_set_add: * @set: a set. - * @codepoint: - * + * @codepoint: * + * * * Since: 0.9.2 **/ @@ -222,10 +222,10 @@ hb_set_add (hb_set_t *set, /** * hb_set_add_range: * @set: a set. - * @first: - * @last: - * + * @first: + * @last: * + * * * Since: 0.9.7 **/ @@ -240,9 +240,9 @@ hb_set_add_range (hb_set_t *set, /** * hb_set_del: * @set: a set. - * @codepoint: - * + * @codepoint: * + * * * Since: 0.9.2 **/ @@ -256,10 +256,10 @@ hb_set_del (hb_set_t *set, /** * hb_set_del_range: * @set: a set. - * @first: - * @last: - * + * @first: + * @last: * + * * * Since: 0.9.7 **/ @@ -274,11 +274,11 @@ hb_set_del_range (hb_set_t *set, /** * hb_set_is_equal: * @set: a set. - * @other: + * @other: * + * * - * - * Return value: + * Return value: * * Since: 0.9.7 **/ @@ -292,9 +292,9 @@ hb_set_is_equal (const hb_set_t *set, /** * hb_set_set: * @set: a set. - * @other: - * + * @other: * + * * * Since: 0.9.2 **/ @@ -308,9 +308,9 @@ hb_set_set (hb_set_t *set, /** * hb_set_union: * @set: a set. - * @other: - * + * @other: * + * * * Since: 0.9.2 **/ @@ -324,9 +324,9 @@ hb_set_union (hb_set_t *set, /** * hb_set_intersect: * @set: a set. - * @other: - * + * @other: * + * * * Since: 0.9.2 **/ @@ -340,9 +340,9 @@ hb_set_intersect (hb_set_t *set, /** * hb_set_subtract: * @set: a set. - * @other: - * + * @other: * + * * * Since: 0.9.2 **/ @@ -356,9 +356,9 @@ hb_set_subtract (hb_set_t *set, /** * hb_set_symmetric_difference: * @set: a set. - * @other: - * + * @other: * + * * * Since: 0.9.2 **/ @@ -373,7 +373,7 @@ hb_set_symmetric_difference (hb_set_t *set, * hb_set_invert: * @set: a set. * - * + * * * Since: 0.9.10 **/ @@ -436,7 +436,7 @@ hb_set_get_max (const hb_set_t *set) * @set: a set. * @codepoint: (inout): * - * + * * * Return value: whether there was a next value. * diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan-private.hh b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan-private.hh index 5ecc96c74ba..6af20ced581 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan-private.hh +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan-private.hh @@ -47,12 +47,17 @@ struct hb_shape_plan_t hb_feature_t *user_features; unsigned int num_user_features; + int *coords; + unsigned int num_coords; + struct hb_shaper_data_t shaper_data; }; #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS \ - , const hb_feature_t *user_features \ - , unsigned int num_user_features + , const hb_feature_t *user_features \ + , unsigned int num_user_features \ + , const int *coords \ + , unsigned int num_coords #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, shape_plan); #include "hb-shaper-list.hh" #undef HB_SHAPER_IMPLEMENT diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.cc index d20912e8073..ac473b84d4d 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.cc @@ -46,11 +46,14 @@ static void hb_shape_plan_plan (hb_shape_plan_t *shape_plan, const hb_feature_t *user_features, unsigned int num_user_features, + const int *coords, + unsigned int num_coords, const char * const *shaper_list) { DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan, - "num_features=%d shaper_list=%p", + "num_features=%d num_coords=%d shaper_list=%p", num_user_features, + num_coords, shaper_list); const hb_shaper_pair_t *shapers = _hb_shapers_get (); @@ -59,7 +62,9 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan, HB_STMT_START { \ if (hb_##shaper##_shaper_face_data_ensure (shape_plan->face_unsafe)) { \ HB_SHAPER_DATA (shaper, shape_plan) = \ - HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, user_features, num_user_features); \ + HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, \ + user_features, num_user_features, \ + coords, num_coords); \ shape_plan->shaper_func = _hb_##shaper##_shape; \ shape_plan->shaper_name = #shaper; \ return; \ @@ -96,13 +101,13 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan, /** * hb_shape_plan_create: (Xconstructor) - * @face: - * @props: + * @face: + * @props: * @user_features: (array length=num_user_features): - * @num_user_features: + * @num_user_features: * @shaper_list: (array zero-terminated=1): * - * + * * * Return value: (transfer full): * @@ -114,15 +119,32 @@ hb_shape_plan_create (hb_face_t *face, const hb_feature_t *user_features, unsigned int num_user_features, const char * const *shaper_list) +{ + return hb_shape_plan_create2 (face, props, + user_features, num_user_features, + NULL, 0, + shaper_list); +} + +hb_shape_plan_t * +hb_shape_plan_create2 (hb_face_t *face, + const hb_segment_properties_t *props, + const hb_feature_t *user_features, + unsigned int num_user_features, + const int *orig_coords, + unsigned int num_coords, + const char * const *shaper_list) { DEBUG_MSG_FUNC (SHAPE_PLAN, NULL, - "face=%p num_features=%d shaper_list=%p", + "face=%p num_features=%d num_coords=%d shaper_list=%p", face, num_user_features, + num_coords, shaper_list); hb_shape_plan_t *shape_plan; hb_feature_t *features = NULL; + int *coords = NULL; if (unlikely (!face)) face = hb_face_get_empty (); @@ -130,7 +152,14 @@ hb_shape_plan_create (hb_face_t *face, return hb_shape_plan_get_empty (); if (num_user_features && !(features = (hb_feature_t *) calloc (num_user_features, sizeof (hb_feature_t)))) return hb_shape_plan_get_empty (); - if (!(shape_plan = hb_object_create ())) { + if (num_coords && !(coords = (int *) calloc (num_coords, sizeof (int)))) + { + free (features); + return hb_shape_plan_get_empty (); + } + if (!(shape_plan = hb_object_create ())) + { + free (coords); free (features); return hb_shape_plan_get_empty (); } @@ -145,8 +174,15 @@ hb_shape_plan_create (hb_face_t *face, shape_plan->user_features = features; if (num_user_features) memcpy (features, user_features, num_user_features * sizeof (hb_feature_t)); + shape_plan->num_coords = num_coords; + shape_plan->coords = coords; + if (num_coords) + memcpy (coords, orig_coords, num_coords * sizeof (int)); - hb_shape_plan_plan (shape_plan, user_features, num_user_features, shaper_list); + hb_shape_plan_plan (shape_plan, + user_features, num_user_features, + coords, num_coords, + shaper_list); return shape_plan; } @@ -154,7 +190,7 @@ hb_shape_plan_create (hb_face_t *face, /** * hb_shape_plan_get_empty: * - * + * * * Return value: (transfer full): * @@ -176,6 +212,9 @@ hb_shape_plan_get_empty (void) NULL, /* user_features */ 0, /* num_user_featurs */ + NULL, /* coords */ + 0, /* num_coords */ + { #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, #include "hb-shaper-list.hh" @@ -190,7 +229,7 @@ hb_shape_plan_get_empty (void) * hb_shape_plan_reference: (skip) * @shape_plan: a shape plan. * - * + * * * Return value: (transfer full): * @@ -206,7 +245,7 @@ hb_shape_plan_reference (hb_shape_plan_t *shape_plan) * hb_shape_plan_destroy: (skip) * @shape_plan: a shape plan. * - * + * * * Since: 0.9.7 **/ @@ -220,6 +259,7 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan) #undef HB_SHAPER_IMPLEMENT free (shape_plan->user_features); + free (shape_plan->coords); free (shape_plan); } @@ -227,14 +267,14 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan) /** * hb_shape_plan_set_user_data: (skip) * @shape_plan: a shape plan. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: * + * * - * - * Return value: + * Return value: * * Since: 0.9.7 **/ @@ -251,9 +291,9 @@ hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan, /** * hb_shape_plan_get_user_data: (skip) * @shape_plan: a shape plan. - * @key: - * + * @key: * + * * * Return value: (transfer none): * @@ -273,11 +313,11 @@ hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan, * @font: a font. * @buffer: a buffer. * @features: (array length=num_features): - * @num_features: + * @num_features: * + * * - * - * Return value: + * Return value: * * Since: 0.9.7 **/ @@ -289,9 +329,10 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan, unsigned int num_features) { DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan, - "num_features=%d shaper_func=%p", + "num_features=%d shaper_func=%p, shaper_name=%s", num_features, - shape_plan->shaper_func); + shape_plan->shaper_func, + shape_plan->shaper_name); if (unlikely (!buffer->len)) return true; @@ -350,6 +391,8 @@ struct hb_shape_plan_proposal_t const char * const *shaper_list; const hb_feature_t *user_features; unsigned int num_user_features; + const int *coords; + unsigned int num_coords; hb_shape_func_t *shaper_func; }; @@ -357,12 +400,26 @@ static inline hb_bool_t hb_shape_plan_user_features_match (const hb_shape_plan_t *shape_plan, const hb_shape_plan_proposal_t *proposal) { - if (proposal->num_user_features != shape_plan->num_user_features) return false; + if (proposal->num_user_features != shape_plan->num_user_features) + return false; for (unsigned int i = 0, n = proposal->num_user_features; i < n; i++) if (proposal->user_features[i].tag != shape_plan->user_features[i].tag || proposal->user_features[i].value != shape_plan->user_features[i].value || proposal->user_features[i].start != shape_plan->user_features[i].start || - proposal->user_features[i].end != shape_plan->user_features[i].end) return false; + proposal->user_features[i].end != shape_plan->user_features[i].end) + return false; + return true; +} + +static inline hb_bool_t +hb_shape_plan_coords_match (const hb_shape_plan_t *shape_plan, + const hb_shape_plan_proposal_t *proposal) +{ + if (proposal->num_coords != shape_plan->num_coords) + return false; + for (unsigned int i = 0, n = proposal->num_coords; i < n; i++) + if (proposal->coords[i] != shape_plan->coords[i]) + return false; return true; } @@ -372,6 +429,7 @@ hb_shape_plan_matches (const hb_shape_plan_t *shape_plan, { return hb_segment_properties_equal (&shape_plan->props, &proposal->props) && hb_shape_plan_user_features_match (shape_plan, proposal) && + hb_shape_plan_coords_match (shape_plan, proposal) && ((shape_plan->default_shaper_list && proposal->shaper_list == NULL) || (shape_plan->shaper_func == proposal->shaper_func)); } @@ -388,15 +446,22 @@ hb_non_global_user_features_present (const hb_feature_t *user_features, return false; } +static inline hb_bool_t +hb_coords_present (const int *coords, + unsigned int num_coords) +{ + return num_coords != 0; +} + /** * hb_shape_plan_create_cached: - * @face: - * @props: + * @face: + * @props: * @user_features: (array length=num_user_features): - * @num_user_features: + * @num_user_features: * @shaper_list: (array zero-terminated=1): * - * + * * * Return value: (transfer full): * @@ -408,6 +473,21 @@ hb_shape_plan_create_cached (hb_face_t *face, const hb_feature_t *user_features, unsigned int num_user_features, const char * const *shaper_list) +{ + return hb_shape_plan_create_cached2 (face, props, + user_features, num_user_features, + NULL, 0, + shaper_list); +} + +hb_shape_plan_t * +hb_shape_plan_create_cached2 (hb_face_t *face, + const hb_segment_properties_t *props, + const hb_feature_t *user_features, + unsigned int num_user_features, + const int *coords, + unsigned int num_coords, + const char * const *shaper_list) { DEBUG_MSG_FUNC (SHAPE_PLAN, NULL, "face=%p num_features=%d shaper_list=%p", @@ -455,16 +535,21 @@ retry: /* Not found. */ - hb_shape_plan_t *shape_plan = hb_shape_plan_create (face, props, user_features, num_user_features, shaper_list); + hb_shape_plan_t *shape_plan = hb_shape_plan_create2 (face, props, + user_features, num_user_features, + coords, num_coords, + shaper_list); /* Don't add to the cache if face is inert. */ if (unlikely (hb_object_is_inert (face))) return shape_plan; /* Don't add the plan to the cache if there were user features with non-global ranges */ - if (hb_non_global_user_features_present (user_features, num_user_features)) return shape_plan; + /* Don't add the plan to the cache if there were variation coordinates XXX Fix me. */ + if (hb_coords_present (coords, num_coords)) + return shape_plan; hb_face_t::plan_node_t *node = (hb_face_t::plan_node_t *) calloc (1, sizeof (hb_face_t::plan_node_t)); if (unlikely (!node)) @@ -487,7 +572,7 @@ retry: * hb_shape_plan_get_shaper: * @shape_plan: a shape plan. * - * + * * * Return value: (transfer none): * diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.h b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.h index a86d468181e..3fc6703fe90 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.h +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.h @@ -52,6 +52,25 @@ hb_shape_plan_create_cached (hb_face_t *face, unsigned int num_user_features, const char * const *shaper_list); +HB_EXTERN hb_shape_plan_t * +hb_shape_plan_create2 (hb_face_t *face, + const hb_segment_properties_t *props, + const hb_feature_t *user_features, + unsigned int num_user_features, + const int *coords, + unsigned int num_coords, + const char * const *shaper_list); + +HB_EXTERN hb_shape_plan_t * +hb_shape_plan_create_cached2 (hb_face_t *face, + const hb_segment_properties_t *props, + const hb_feature_t *user_features, + unsigned int num_user_features, + const int *coords, + unsigned int num_coords, + const char * const *shaper_list); + + HB_EXTERN hb_shape_plan_t * hb_shape_plan_get_empty (void); diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.cc index 2fbaf405a56..1feacaa8a35 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape.cc @@ -373,7 +373,10 @@ hb_shape_full (hb_font_t *font, unsigned int num_features, const char * const *shaper_list) { - hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props, features, num_features, shaper_list); + hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached2 (font->face, &buffer->props, + features, num_features, + font->coords, font->num_coords, + shaper_list); hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num_features); hb_shape_plan_destroy (shape_plan); diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.cc b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.cc index 81a474edcbd..91b4aa384ca 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.cc @@ -131,12 +131,12 @@ hb_unicode_funcs_get_default (void) #define HB_UNICODE_FUNCS_IMPLEMENT(set) \ return hb_##set##_get_unicode_funcs (); -#ifdef HAVE_GLIB +#if defined(HAVE_UCDN) + HB_UNICODE_FUNCS_IMPLEMENT(ucdn) +#elif defined(HAVE_GLIB) HB_UNICODE_FUNCS_IMPLEMENT(glib) #elif defined(HAVE_ICU) && defined(HAVE_ICU_BUILTIN) HB_UNICODE_FUNCS_IMPLEMENT(icu) -#elif defined(HAVE_UCDN) - HB_UNICODE_FUNCS_IMPLEMENT(ucdn) #else #define HB_UNICODE_FUNCS_NIL 1 HB_UNICODE_FUNCS_IMPLEMENT(nil) @@ -154,7 +154,7 @@ hb_unicode_funcs_get_default (void) * hb_unicode_funcs_create: (Xconstructor) * @parent: (nullable): * - * + * * * Return value: (transfer full): * @@ -200,7 +200,7 @@ const hb_unicode_funcs_t _hb_unicode_funcs_nil = { /** * hb_unicode_funcs_get_empty: * - * + * * * Return value: (transfer full): * @@ -216,7 +216,7 @@ hb_unicode_funcs_get_empty (void) * hb_unicode_funcs_reference: (skip) * @ufuncs: Unicode functions. * - * + * * * Return value: (transfer full): * @@ -232,7 +232,7 @@ hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs) * hb_unicode_funcs_destroy: (skip) * @ufuncs: Unicode functions. * - * + * * * Since: 0.9.2 **/ @@ -254,14 +254,14 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs) /** * hb_unicode_funcs_set_user_data: (skip) * @ufuncs: Unicode functions. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -278,9 +278,9 @@ hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_get_user_data: (skip) * @ufuncs: Unicode functions. - * @key: - * + * @key: * + * * * Return value: (transfer none): * @@ -298,7 +298,7 @@ hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, * hb_unicode_funcs_make_immutable: * @ufuncs: Unicode functions. * - * + * * * Since: 0.9.2 **/ @@ -315,9 +315,9 @@ hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs) * hb_unicode_funcs_is_immutable: * @ufuncs: Unicode functions. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -331,9 +331,9 @@ hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs) * hb_unicode_funcs_get_parent: * @ufuncs: Unicode functions. * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -387,13 +387,13 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE /** * hb_unicode_compose: * @ufuncs: Unicode functions. - * @a: - * @b: + * @a: + * @b: * @ab: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -409,13 +409,13 @@ hb_unicode_compose (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_decompose: * @ufuncs: Unicode functions. - * @ab: + * @ab: * @a: (out): * @b: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -431,12 +431,12 @@ hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_decompose_compatibility: * @ufuncs: Unicode functions. - * @u: + * @u: * @decomposed: (out): * + * * - * - * Return value: + * Return value: * * Since: 0.9.2 **/ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-version.h b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-version.h index 5bcd33c61a6..90d91c74988 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-version.h +++ b/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-version.h @@ -37,10 +37,10 @@ HB_BEGIN_DECLS #define HB_VERSION_MAJOR 1 -#define HB_VERSION_MINOR 3 -#define HB_VERSION_MICRO 0 +#define HB_VERSION_MINOR 4 +#define HB_VERSION_MICRO 1 -#define HB_VERSION_STRING "1.3.0" +#define HB_VERSION_STRING "1.4.1" #define HB_VERSION_ATLEAST(major,minor,micro) \ ((major)*10000+(minor)*100+(micro) <= \ diff --git a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc index 2e41293a08f..8d817243038 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc @@ -49,7 +49,7 @@ hb_jdk_get_glyph (hb_font_t *font HB_UNUSED, JNIEnv* env = jdkFontInfo->env; jobject font2D = jdkFontInfo->font2D; hb_codepoint_t u = (variation_selector==0) ? unicode : variation_selector; - + *glyph = (hb_codepoint_t) env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, u); return (*glyph != 0); @@ -61,7 +61,7 @@ hb_jdk_get_glyph_h_advance (hb_font_t *font HB_UNUSED, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - + float fadv = 0.0f; if ((glyph & 0xfffe) == 0xfffe) { return 0; // JDK uses this glyph code. @@ -72,7 +72,7 @@ hb_jdk_get_glyph_h_advance (hb_font_t *font HB_UNUSED, jobject fontStrike = jdkFontInfo->fontStrike; jobject pt = env->CallObjectMethod(fontStrike, sunFontIDs.getGlyphMetricsMID, glyph); - + if (pt == NULL) { return 0; } @@ -89,7 +89,7 @@ hb_jdk_get_glyph_v_advance (hb_font_t *font HB_UNUSED, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - + float fadv = 0.0f; if ((glyph & 0xfffe) == 0xfffe) { return 0; // JDK uses this glyph code. @@ -100,7 +100,7 @@ hb_jdk_get_glyph_v_advance (hb_font_t *font HB_UNUSED, jobject fontStrike = jdkFontInfo->fontStrike; jobject pt = env->CallObjectMethod(fontStrike, sunFontIDs.getGlyphMetricsMID, glyph); - + if (pt == NULL) { return 0; } @@ -108,7 +108,7 @@ hb_jdk_get_glyph_v_advance (hb_font_t *font HB_UNUSED, env->DeleteLocalRef(pt); return HBFloatToFixed(fadv); - + } static hb_bool_t @@ -196,7 +196,7 @@ hb_jdk_get_glyph_contour_point (hb_font_t *font HB_UNUSED, jobject pt = env->CallObjectMethod(fontStrike, sunFontIDs.getGlyphPointMID, glyph, point_index); - + if (pt == NULL) { *x = 0; *y = 0; return true; @@ -238,8 +238,8 @@ _hb_jdk_get_font_funcs (void) hb_font_funcs_t *ff; if (!jdk_ffuncs) { - ff = hb_font_funcs_create(); - + ff = hb_font_funcs_create(); + hb_font_funcs_set_glyph_func(ff, hb_jdk_get_glyph, NULL, NULL); hb_font_funcs_set_glyph_h_advance_func(ff, hb_jdk_get_glyph_h_advance, NULL, NULL); @@ -278,7 +278,7 @@ reference_table(hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) { jobject font2D = jdkFontInfo->font2D; jsize length; jbyte* buffer; - + // HB_TAG_NONE is 0 and is used to get the whole font file. // It is not expected not be needed for JDK. if (tag == 0) { From f82a7d2bdd0f44089aad7ecd1f4726f2e524a2d1 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 18 Jan 2017 08:02:53 +0800 Subject: [PATCH 35/71] 8172529: Use PKIXValidator in jarsigner Reviewed-by: xuelei, mullan, alanb --- .../java.base/share/classes/module-info.java | 2 + .../sun/security/tools/jarsigner/Main.java | 87 ++++++++++--------- .../tools/jarsigner/concise_jarsigner.sh | 45 ++++++++-- 3 files changed, 84 insertions(+), 50 deletions(-) diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 0c455f827a7..2fd479eb925 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -290,6 +290,8 @@ module java.base { jdk.crypto.token, jdk.jartool, jdk.security.auth; + exports sun.security.validator to + jdk.jartool; exports sun.text.resources to jdk.localedata; exports sun.util.cldr to diff --git a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java index 846be10405c..a42dfe21882 100644 --- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java +++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java @@ -26,6 +26,8 @@ package sun.security.tools.jarsigner; import java.io.*; +import java.security.cert.CertPathValidatorException; +import java.security.cert.PKIXBuilderParameters; import java.util.*; import java.util.zip.*; import java.util.jar.*; @@ -40,11 +42,9 @@ import java.security.*; import java.net.SocketTimeoutException; import java.net.URL; import java.security.cert.CertPath; -import java.security.cert.CertPathValidator; import java.security.cert.CertificateExpiredException; import java.security.cert.CertificateFactory; import java.security.cert.CertificateNotYetValidException; -import java.security.cert.PKIXParameters; import java.security.cert.TrustAnchor; import java.util.Map.Entry; @@ -54,6 +54,8 @@ import sun.security.pkcs.PKCS7; import sun.security.pkcs.SignerInfo; import sun.security.timestamp.TimestampToken; import sun.security.tools.KeyStoreUtil; +import sun.security.validator.Validator; +import sun.security.validator.ValidatorException; import sun.security.x509.*; import sun.security.util.*; @@ -177,9 +179,7 @@ public class Main { private boolean seeWeak = false; - CertificateFactory certificateFactory; - CertPathValidator validator; - PKIXParameters pkixParameters; + PKIXBuilderParameters pkixParameters; public void run(String args[]) { try { @@ -1623,19 +1623,10 @@ public class Main { try { validateCertChain(certs); } catch (Exception e) { - if (debug) { - e.printStackTrace(); - } - if (e.getCause() != null && - (e.getCause() instanceof CertificateExpiredException || - e.getCause() instanceof CertificateNotYetValidException)) { - // No more warning, we alreay have hasExpiredCert or notYetValidCert - } else { - chainNotValidated = true; - chainNotValidatedReason = e; - sb.append(tab).append(rb.getString(".CertPath.not.validated.")) - .append(e.getLocalizedMessage()).append("]\n"); // TODO - } + chainNotValidated = true; + chainNotValidatedReason = e; + sb.append(tab).append(rb.getString(".CertPath.not.validated.")) + .append(e.getLocalizedMessage()).append("]\n"); // TODO } if (certs.size() == 1 && KeyStoreUtil.isSelfSigned((X509Certificate)certs.get(0))) { @@ -1654,9 +1645,6 @@ public class Main { } try { - - certificateFactory = CertificateFactory.getInstance("X.509"); - validator = CertPathValidator.getInstance("PKIX"); Set tas = new HashSet<>(); try { KeyStore caks = KeyStoreUtil.getCacertsKeyStore(); @@ -1732,7 +1720,7 @@ public class Main { } } finally { try { - pkixParameters = new PKIXParameters(tas); + pkixParameters = new PKIXBuilderParameters(tas, null); pkixParameters.setRevocationEnabled(false); } catch (InvalidAlgorithmParameterException ex) { // Only if tas is empty @@ -1899,17 +1887,8 @@ public class Main { try { validateCertChain(Arrays.asList(certChain)); } catch (Exception e) { - if (debug) { - e.printStackTrace(); - } - if (e.getCause() != null && - (e.getCause() instanceof CertificateExpiredException || - e.getCause() instanceof CertificateNotYetValidException)) { - // No more warning, we already have hasExpiredCert or notYetValidCert - } else { - chainNotValidated = true; - chainNotValidatedReason = e; - } + chainNotValidated = true; + chainNotValidatedReason = e; } if (KeyStoreUtil.isSelfSigned(certChain[0])) { @@ -1966,18 +1945,40 @@ public class Main { } void validateCertChain(List certs) throws Exception { - int cpLen = 0; - out: for (; cpLen 0) { - CertPath cp = certificateFactory.generateCertPath( - (cpLen == certs.size())? certs: certs.subList(0, cpLen)); - validator.validate(cp, pkixParameters); + throw e; } } diff --git a/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh b/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh index 013f90c58c1..b9ec9e83232 100644 --- a/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh +++ b/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh @@ -22,7 +22,7 @@ # # @test -# @bug 6802846 +# @bug 6802846 8172529 # @summary jarsigner needs enhanced cert validation(options) # # @run shell/timeout=240 concise_jarsigner.sh @@ -52,7 +52,7 @@ TESTTOOLVMOPTS="$TESTTOOLVMOPTS -J-Duser.language=en -J-Duser.country=US" KS=js.ks KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit -keystore $KS -keyalg rsa -keysize 1024" JAR="$TESTJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS}" -JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS}" +JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -debug" JAVAC="$TESTJAVA${FS}bin${FS}javac ${TESTTOOLVMOPTS} ${TESTJAVACOPTS}" rm $KS @@ -138,7 +138,7 @@ LINES=`$JARSIGNER -verify a.jar -verbose:summary -certs | grep "more)" | wc -l` [ $LINES = 4 ] || exit $LINENO # ========================================================== -# Second part: exit code 2, 4, 8 +# Second part: exit code 2, 4, 8. # 16 and 32 already covered in the first part # ========================================================== @@ -174,11 +174,14 @@ $JARSIGNER -strict -keystore $KS -storepass changeit a.jar goodku $JARSIGNER -strict -keystore $KS -storepass changeit a.jar goodeku [ $? = 0 ] || exit $LINENO -# badchain signed by ca, but ca is removed later +# badchain signed by ca1, but ca1 is removed later $KT -genkeypair -alias badchain -dname CN=badchain -validity 365 -$KT -certreq -alias badchain | $KT -gencert -alias ca -validity 365 | \ +$KT -genkeypair -alias ca1 -dname CN=ca1 -ext bc -validity 365 +$KT -certreq -alias badchain | $KT -gencert -alias ca1 -validity 365 | \ $KT -importcert -alias badchain -$KT -delete -alias ca +# save ca1.cert for easy replay +$KT -exportcert -file ca1.cert -alias ca1 +$KT -delete -alias ca1 $JARSIGNER -strict -keystore $KS -storepass changeit a.jar badchain [ $? = 4 ] || exit $LINENO @@ -204,13 +207,41 @@ $JARSIGNER -strict -keystore $KS -storepass changeit a.jar altchain $JARSIGNER -strict -keystore $KS -storepass changeit -certchain certchain a.jar altchain [ $? = 0 ] || exit $LINENO -# but if ca2 is removed, -certchain does not work +# if ca2 is removed, -certchain still work because altchain is a self-signed entry and +# it is trusted by jarsigner +# save ca2.cert for easy replay +$KT -exportcert -file ca2.cert -alias ca2 $KT -delete -alias ca2 $JARSIGNER -strict -keystore $KS -storepass changeit -certchain certchain a.jar altchain +[ $? = 0 ] || exit $LINENO + +# if cert is imported, -certchain won't work because this certificate entry is not trusted +$KT -importcert -file certchain -alias altchain -noprompt +$JARSIGNER -strict -keystore $KS -storepass changeit -certchain certchain a.jar altchain [ $? = 4 ] || exit $LINENO $JARSIGNER -verify a.jar [ $? = 0 ] || exit $LINENO +# ========================================================== +# 8172529 +# ========================================================== + +$KT -genkeypair -alias ee -dname CN=ee +$KT -genkeypair -alias caone -dname CN=caone +$KT -genkeypair -alias catwo -dname CN=catwo + +$KT -certreq -alias ee | $KT -gencert -alias catwo -rfc > ee.cert +$KT -certreq -alias catwo | $KT -gencert -alias caone -sigalg MD5withRSA -rfc > catwo.cert + +# This certchain contains a cross-signed weak catwo.cert +cat ee.cert catwo.cert | $KT -importcert -alias ee + +$JAR cvf a.jar A1.class +$JARSIGNER -strict -keystore $KS -storepass changeit a.jar ee +[ $? = 0 ] || exit $LINENO +$JARSIGNER -strict -keystore $KS -storepass changeit -verify a.jar +[ $? = 0 ] || exit $LINENO + echo OK exit 0 From 140b10aedb1a2d03863f9628695a44a9a46e39b3 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Wed, 18 Jan 2017 11:35:31 +0530 Subject: [PATCH 36/71] 8172012: [TEST_BUG] delays needed in javax/swing/JTree/4633594/bug4633594.java Reviewed-by: yan, serb --- .../swing/JTree/4633594/JTreeFocusTest.java | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 jdk/test/javax/swing/JTree/4633594/JTreeFocusTest.java diff --git a/jdk/test/javax/swing/JTree/4633594/JTreeFocusTest.java b/jdk/test/javax/swing/JTree/4633594/JTreeFocusTest.java new file mode 100644 index 00000000000..800bf10be4d --- /dev/null +++ b/jdk/test/javax/swing/JTree/4633594/JTreeFocusTest.java @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2002, 2017, 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 4633594 8172012 + @summary No way to pass focus from a JTree to a GUI placed inside the tree node + @run main JTreeFocusTest +*/ +import java.awt.Component; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyEvent; +import java.util.EventObject; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.border.BevelBorder; +import javax.swing.border.CompoundBorder; +import javax.swing.border.LineBorder; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellEditor; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; + +public class JTreeFocusTest { + + private static DefaultMutableTreeNode root; + Robot robot; + static boolean passed = false; + boolean rootSelected = false; + boolean keysTyped = false; + private volatile Point p = null; + private static JFrame fr; + private static volatile JTree tree = null; + + public static void main(String[] args) throws Exception{ + new JTreeFocusTest(); + } + + void blockTillDisplayed(JComponent comp) throws Exception { + while (p == null) { + try { + SwingUtilities.invokeAndWait(() -> { + p = comp.getLocationOnScreen(); + }); + } catch (IllegalStateException e) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + } + + public JTreeFocusTest() throws Exception { + SwingUtilities.invokeAndWait(() -> { + fr = new JFrame("Test"); + + root = new DefaultMutableTreeNode("root"); + JPanel p = new JPanel(); + p.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.RAISED), + new LineBorder(UIManager.getColor("control"), 7))); + p.setLayout(new GridLayout(2,2)); + p.add(new JLabel("one")); + JTextField tf1 = new JTextField(10); + p.add(tf1); + p.add(new JLabel("two")); + p.add(new JTextField(10)); + root.add(new DefaultMutableTreeNode(p)); + + tf1.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + setPassed(true); + } + }); + + DefaultTreeModel model = new DefaultTreeModel(root); + tree = new JTree(model) { + public void processKeyEvent(KeyEvent e) { + super.processKeyEvent(e); + if (e.getKeyCode()==KeyEvent.VK_F2) { + synchronized (JTreeFocusTest.this) { + keysTyped = true; + JTreeFocusTest.this.notifyAll(); + } + } + } + }; + + tree.addTreeSelectionListener(new TreeSelectionListener() { + public void valueChanged(TreeSelectionEvent e) { + if ( root.equals(e.getPath().getLastPathComponent()) ) { + synchronized (JTreeFocusTest.this) { + rootSelected = true; + JTreeFocusTest.this.notifyAll(); + } + } + } + }); + + tree.setEditable(true); + DefaultTreeCellRenderer renderer = new FormRenderer(); + tree.setCellRenderer(renderer); + DefaultTreeCellEditor editor = new FormEditor(tree, renderer); + tree.setCellEditor(editor); + fr.getContentPane().add(tree); + + fr.setSize(300,400); + fr.setVisible(true); + }); + blockTillDisplayed(tree); + SwingUtilities.invokeAndWait(() -> { + tree.requestFocus(); + tree.setSelectionRow(0); + }); + + try { + synchronized (this) { + while (!rootSelected) { + JTreeFocusTest.this.wait(); + } + } + + robot = new Robot(); + robot.setAutoDelay(50); + robot.delay(150); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + robot.keyPress(KeyEvent.VK_F2); + robot.keyRelease(KeyEvent.VK_F2); + + synchronized (this) { + while (!keysTyped) { + JTreeFocusTest.this.wait(); + } + } + Thread.sleep(3000); + } catch(Throwable t) { + t.printStackTrace(); + } + destroy(); + } + + public void destroy() throws Exception { + SwingUtilities.invokeAndWait(()->fr.dispose()); + if ( !isPassed() ) { + throw new RuntimeException("Focus wasn't transferred to the proper component"); + } + } + + synchronized void setPassed(boolean passed) { + this.passed = passed; + } + + synchronized boolean isPassed() { + return passed; + } + + static JTree createTree() { + return tree; + } + + class FormRenderer extends DefaultTreeCellRenderer { + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean sel, + boolean expanded, + boolean leaf, int row, + boolean hasFocus) { + Object obj = ((DefaultMutableTreeNode)value).getUserObject(); + if (obj instanceof Component){ + return (Component)((DefaultMutableTreeNode)value).getUserObject(); + } + return super.getTreeCellRendererComponent(tree, value, sel, + expanded, leaf, row, + hasFocus); + } + } + + class FormEditor extends DefaultTreeCellEditor { + public FormEditor(JTree tree, DefaultTreeCellRenderer renderer) { + super(tree, renderer); + } + + public Component getTreeCellEditorComponent(JTree tree, Object value, + boolean sel, + boolean expanded, + boolean leaf, int row) { + Object obj = ((DefaultMutableTreeNode)value).getUserObject(); + if (obj instanceof Component){ + return (Component)((DefaultMutableTreeNode)value).getUserObject(); + } + return super.getTreeCellEditorComponent(tree, value, sel, + expanded, leaf, row); + } + + public boolean shouldSelectCell(EventObject anEvent) { + //return super.shouldSelectCell(anEvent); + return true; + } + } +} From 85b40fde0b30c1eed6766a4ac9e81891d3c69161 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Wed, 18 Jan 2017 10:24:47 +0100 Subject: [PATCH 37/71] 8037325: Class.getConstructor() performance regression Co-authored-by: Sean Mullan Reviewed-by: mchung --- .../share/classes/java/lang/Class.java | 256 ++++++++++-------- .../classes/sun/reflect/misc/ReflectUtil.java | 55 +++- 2 files changed, 184 insertions(+), 127 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index 589ba51089c..b0e3d3af0cd 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -508,8 +508,9 @@ public final class Class implements java.io.Serializable, public T newInstance() throws InstantiationException, IllegalAccessException { - if (System.getSecurityManager() != null) { - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), false); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), false); } // NOTE: the following code may not be strictly correct under @@ -1223,38 +1224,27 @@ public final class Class implements java.io.Serializable, // Perform access check final Class enclosingCandidate = enclosingInfo.getEnclosingClass(); - enclosingCandidate.checkMemberAccess(Member.DECLARED, - Reflection.getCallerClass(), true); - // Client is ok to access declared methods but j.l.Class might not be. - Method[] candidates = AccessController.doPrivileged( - new PrivilegedAction<>() { - @Override - public Method[] run() { - return enclosingCandidate.getDeclaredMethods(); - } - }); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + enclosingCandidate.checkMemberAccess(sm, Member.DECLARED, + Reflection.getCallerClass(), true); + } + Method[] candidates = enclosingCandidate.privateGetDeclaredMethods(false); + /* * Loop over all declared methods; match method name, * number of and type of parameters, *and* return * type. Matching return type is also necessary * because of covariant returns, etc. */ - for(Method m: candidates) { - if (m.getName().equals(enclosingInfo.getName()) ) { - Class[] candidateParamClasses = m.getParameterTypes(); - if (candidateParamClasses.length == parameterClasses.length) { - boolean matches = true; - for(int i = 0; i < candidateParamClasses.length; i++) { - if (!candidateParamClasses[i].equals(parameterClasses[i])) { - matches = false; - break; - } - } - - if (matches) { // finally, check return type - if (m.getReturnType().equals(returnType) ) - return m; - } + ReflectionFactory fact = getReflectionFactory(); + for (Method m : candidates) { + if (m.getName().equals(enclosingInfo.getName()) && + arrayContentsEq(parameterClasses, + fact.getExecutableSharedParameterTypes(m))) { + // finally, check return type + if (m.getReturnType().equals(returnType)) { + return fact.copyMethod(m); } } } @@ -1390,33 +1380,23 @@ public final class Class implements java.io.Serializable, // Perform access check final Class enclosingCandidate = enclosingInfo.getEnclosingClass(); - enclosingCandidate.checkMemberAccess(Member.DECLARED, - Reflection.getCallerClass(), true); - // Client is ok to access declared methods but j.l.Class might not be. - Constructor[] candidates = AccessController.doPrivileged( - new PrivilegedAction<>() { - @Override - public Constructor[] run() { - return enclosingCandidate.getDeclaredConstructors(); - } - }); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + enclosingCandidate.checkMemberAccess(sm, Member.DECLARED, + Reflection.getCallerClass(), true); + } + + Constructor[] candidates = enclosingCandidate + .privateGetDeclaredConstructors(false); /* * Loop over all declared constructors; match number * of and type of parameters. */ - for(Constructor c: candidates) { - Class[] candidateParamClasses = c.getParameterTypes(); - if (candidateParamClasses.length == parameterClasses.length) { - boolean matches = true; - for(int i = 0; i < candidateParamClasses.length; i++) { - if (!candidateParamClasses[i].equals(parameterClasses[i])) { - matches = false; - break; - } - } - - if (matches) - return c; + ReflectionFactory fact = getReflectionFactory(); + for (Constructor c : candidates) { + if (arrayContentsEq(parameterClasses, + fact.getExecutableSharedParameterTypes(c))) { + return fact.copyConstructor(c); } } @@ -1446,9 +1426,13 @@ public final class Class implements java.io.Serializable, public Class getDeclaringClass() throws SecurityException { final Class candidate = getDeclaringClass0(); - if (candidate != null) - candidate.checkPackageAccess( + if (candidate != null) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + candidate.checkPackageAccess(sm, ClassLoader.getClassLoader(Reflection.getCallerClass()), true); + } + } return candidate; } @@ -1496,9 +1480,13 @@ public final class Class implements java.io.Serializable, enclosingCandidate = enclosingClass; } - if (enclosingCandidate != null) - enclosingCandidate.checkPackageAccess( + if (enclosingCandidate != null) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + enclosingCandidate.checkPackageAccess(sm, ClassLoader.getClassLoader(Reflection.getCallerClass()), true); + } + } return enclosingCandidate; } @@ -1688,7 +1676,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Class[] getClasses() { - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), false); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), false); + } // Privileged so this implementation can look at DECLARED classes, // something the caller might not have privilege to do. The code here @@ -1754,7 +1745,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Field[] getFields() throws SecurityException { - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true); + } return copyFields(privateGetPublicFields(null)); } @@ -1841,7 +1835,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Method[] getMethods() throws SecurityException { - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true); + } return copyMethods(privateGetPublicMethods()); } @@ -1877,7 +1874,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Constructor[] getConstructors() throws SecurityException { - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true); + } return copyConstructors(privateGetDeclaredConstructors(true)); } @@ -1928,7 +1928,10 @@ public final class Class implements java.io.Serializable, public Field getField(String name) throws NoSuchFieldException, SecurityException { Objects.requireNonNull(name); - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true); + } Field field = getField0(name); if (field == null) { throw new NoSuchFieldException(name); @@ -2034,10 +2037,13 @@ public final class Class implements java.io.Serializable, public Method getMethod(String name, Class... parameterTypes) throws NoSuchMethodException, SecurityException { Objects.requireNonNull(name); - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true); + } Method method = getMethod0(name, parameterTypes); if (method == null) { - throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes)); + throw new NoSuchMethodException(methodToString(name, parameterTypes)); } return getReflectionFactory().copyMethod(method); } @@ -2092,8 +2098,12 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Constructor getConstructor(Class... parameterTypes) - throws NoSuchMethodException, SecurityException { - checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); + throws NoSuchMethodException, SecurityException + { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), true); + } return getReflectionFactory().copyConstructor( getConstructor0(parameterTypes, Member.PUBLIC)); } @@ -2136,7 +2146,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Class[] getDeclaredClasses() throws SecurityException { - checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), false); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), false); + } return getDeclaredClasses0(); } @@ -2185,7 +2198,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Field[] getDeclaredFields() throws SecurityException { - checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true); + } return copyFields(privateGetDeclaredFields(false)); } @@ -2244,7 +2260,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Method[] getDeclaredMethods() throws SecurityException { - checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true); + } return copyMethods(privateGetDeclaredMethods(false)); } @@ -2289,7 +2308,10 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Constructor[] getDeclaredConstructors() throws SecurityException { - checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true); + } return copyConstructors(privateGetDeclaredConstructors(false)); } @@ -2338,7 +2360,10 @@ public final class Class implements java.io.Serializable, public Field getDeclaredField(String name) throws NoSuchFieldException, SecurityException { Objects.requireNonNull(name); - checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true); + } Field field = searchFields(privateGetDeclaredFields(false), name); if (field == null) { throw new NoSuchFieldException(name); @@ -2399,10 +2424,13 @@ public final class Class implements java.io.Serializable, public Method getDeclaredMethod(String name, Class... parameterTypes) throws NoSuchMethodException, SecurityException { Objects.requireNonNull(name); - checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true); + } Method method = searchMethods(privateGetDeclaredMethods(false), name, parameterTypes); if (method == null) { - throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes)); + throw new NoSuchMethodException(methodToString(name, parameterTypes)); } return getReflectionFactory().copyMethod(method); } @@ -2448,8 +2476,13 @@ public final class Class implements java.io.Serializable, */ @CallerSensitive public Constructor getDeclaredConstructor(Class... parameterTypes) - throws NoSuchMethodException, SecurityException { - checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + throws NoSuchMethodException, SecurityException + { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true); + } + return getReflectionFactory().copyConstructor( getConstructor0(parameterTypes, Member.DECLARED)); } @@ -2697,51 +2730,49 @@ public final class Class implements java.io.Serializable, * *

Default policy: allow all clients access with normal Java access * control. + * + *

NOTE: should only be called if a SecurityManager is installed */ - private void checkMemberAccess(int which, Class caller, boolean checkProxyInterfaces) { - final SecurityManager s = System.getSecurityManager(); - if (s != null) { - /* Default policy allows access to all {@link Member#PUBLIC} members, - * as well as access to classes that have the same class loader as the caller. - * In all other cases, it requires RuntimePermission("accessDeclaredMembers") - * permission. - */ - final ClassLoader ccl = ClassLoader.getClassLoader(caller); + private void checkMemberAccess(SecurityManager sm, int which, + Class caller, boolean checkProxyInterfaces) { + /* Default policy allows access to all {@link Member#PUBLIC} members, + * as well as access to classes that have the same class loader as the caller. + * In all other cases, it requires RuntimePermission("accessDeclaredMembers") + * permission. + */ + final ClassLoader ccl = caller.getClassLoader0(); + if (which != Member.PUBLIC) { final ClassLoader cl = getClassLoader0(); - if (which != Member.PUBLIC) { - if (ccl != cl) { - s.checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION); - } + if (ccl != cl) { + sm.checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION); } - this.checkPackageAccess(ccl, checkProxyInterfaces); } + this.checkPackageAccess(sm, ccl, checkProxyInterfaces); } /* * Checks if a client loaded in ClassLoader ccl is allowed to access this * class under the current package access policy. If access is denied, * throw a SecurityException. + * + * NOTE: this method should only be called if a SecurityManager is active */ - private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { - final SecurityManager s = System.getSecurityManager(); - if (s != null) { - final ClassLoader cl = getClassLoader0(); + private void checkPackageAccess(SecurityManager sm, final ClassLoader ccl, + boolean checkProxyInterfaces) { + final ClassLoader cl = getClassLoader0(); - if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { - String name = this.getName(); - int i = name.lastIndexOf('.'); - if (i != -1) { - // skip the package access check on a proxy class in default proxy package - String pkg = name.substring(0, i); - if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { - s.checkPackageAccess(pkg); - } + if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { + String pkg = this.getPackageName(); + if (pkg != null && !pkg.isEmpty()) { + // skip the package access check on a proxy class in default proxy package + if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { + sm.checkPackageAccess(pkg); } } - // check package access on the proxy interfaces - if (checkProxyInterfaces && Proxy.isProxyClass(this)) { - ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); - } + } + // check package access on the proxy interfaces + if (checkProxyInterfaces && Proxy.isProxyClass(this)) { + ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } } @@ -2755,11 +2786,9 @@ public final class Class implements java.io.Serializable, while (c.isArray()) { c = c.getComponentType(); } - String baseName = c.getName(); - int index = baseName.lastIndexOf('.'); - if (index != -1) { - name = baseName.substring(0, index).replace('.', '/') - +"/"+name; + String baseName = c.getPackageName(); + if (baseName != null && !baseName.isEmpty()) { + name = baseName.replace('.', '/') + "/" + name; } } else { name = name.substring(1); @@ -3233,7 +3262,7 @@ public final class Class implements java.io.Serializable, return constructor; } } - throw new NoSuchMethodException(getName() + "." + argumentTypesToString(parameterTypes)); + throw new NoSuchMethodException(methodToString("", parameterTypes)); } // @@ -3294,8 +3323,11 @@ public final class Class implements java.io.Serializable, private native Constructor[] getDeclaredConstructors0(boolean publicOnly); private native Class[] getDeclaredClasses0(); - private static String argumentTypesToString(Class[] argTypes) { - StringJoiner sj = new StringJoiner(", ", "(", ")"); + /** + * Helper method to get the method name from arguments. + */ + private String methodToString(String name, Class[] argTypes) { + StringJoiner sj = new StringJoiner(", ", getName() + "." + name + "(", ")"); if (argTypes != null) { for (int i = 0; i < argTypes.length; i++) { Class c = argTypes[i]; diff --git a/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java b/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java index c275b0b91a6..738abcb9426 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java +++ b/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java @@ -96,7 +96,7 @@ public final class ReflectUtil { final Class declaringClass = m.getDeclaringClass(); - checkPackageAccess(declaringClass); + privateCheckPackageAccess(sm, declaringClass); if (Modifier.isPublic(m.getModifiers()) && Modifier.isPublic(declaringClass.getModifiers())) @@ -114,9 +114,27 @@ public final class ReflectUtil { * also check the package access on the proxy interfaces. */ public static void checkPackageAccess(Class clazz) { - checkPackageAccess(clazz.getName()); + SecurityManager s = System.getSecurityManager(); + if (s != null) { + privateCheckPackageAccess(s, clazz); + } + } + + /** + * NOTE: should only be called if a SecurityManager is installed + */ + private static void privateCheckPackageAccess(SecurityManager s, Class clazz) { + while (clazz.isArray()) { + clazz = clazz.getComponentType(); + } + + String pkg = clazz.getPackageName(); + if (pkg != null && !pkg.isEmpty()) { + s.checkPackageAccess(pkg); + } + if (isNonPublicProxyClass(clazz)) { - checkProxyPackageAccess(clazz); + privateCheckProxyPackageAccess(s, clazz); } } @@ -195,15 +213,21 @@ public final class ReflectUtil { public static void checkProxyPackageAccess(Class clazz) { SecurityManager s = System.getSecurityManager(); if (s != null) { - // check proxy interfaces if the given class is a proxy class - if (Proxy.isProxyClass(clazz)) { - for (Class intf : clazz.getInterfaces()) { - checkPackageAccess(intf); - } - } + privateCheckProxyPackageAccess(s, clazz); } } + /** + * NOTE: should only be called if a SecurityManager is installed + */ + private static void privateCheckProxyPackageAccess(SecurityManager s, Class clazz) { + // check proxy interfaces if the given class is a proxy class + if (Proxy.isProxyClass(clazz)) { + for (Class intf : clazz.getInterfaces()) { + privateCheckPackageAccess(s, intf); + } + } + } /** * Access check on the interfaces that a proxy class implements and throw * {@code SecurityException} if it accesses a restricted package from @@ -220,7 +244,7 @@ public final class ReflectUtil { for (Class intf : interfaces) { ClassLoader cl = intf.getClassLoader(); if (needsPackageAccessCheck(ccl, cl)) { - checkPackageAccess(intf); + privateCheckPackageAccess(sm, intf); } } } @@ -236,10 +260,11 @@ public final class ReflectUtil { * package that bypasses checkPackageAccess. */ public static boolean isNonPublicProxyClass(Class cls) { - String name = cls.getName(); - int i = name.lastIndexOf('.'); - String pkg = (i != -1) ? name.substring(0, i) : ""; - return Proxy.isProxyClass(cls) && !pkg.startsWith(PROXY_PACKAGE); + if (!Proxy.isProxyClass(cls)) { + return false; + } + String pkg = cls.getPackageName(); + return pkg == null || !pkg.startsWith(PROXY_PACKAGE); } /** @@ -255,7 +280,7 @@ public final class ReflectUtil { // check if it is a valid proxy instance if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) { throw new IllegalArgumentException("Not a Proxy instance"); -} + } if (Modifier.isStatic(method.getModifiers())) { throw new IllegalArgumentException("Can't handle static method"); } From 6862616001002283953d71a2cb1c6f82e01e0851 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Wed, 18 Jan 2017 09:35:03 +0000 Subject: [PATCH 38/71] 8171380: Remove all exports from jdk.jlink Reviewed-by: alanb, mchung, sundar --- make/Javadoc.gmk | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index e785f68b1d1..a2ac21f03c7 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -682,22 +682,6 @@ $(eval $(call SetupJavadocGeneration, jdknet, \ TARGETS += $(jdknet) -################################################################################ - -# TODO: Need to decide when the plugin API is ready to publish as experimental API. -# This target is temporarily added for internal use for now. -$(eval $(call SetupJavadocGeneration, jlinkplugins, \ - MODULES := jdk.jlink, \ - PACKAGES := jdk.tools.jlink.plugin, \ - API_ROOT := jdk, \ - DEST_DIR := jlink, \ - TITLE := JLink Plugin API - EXPERIMENTAL, \ - FIRST_COPYRIGHT_YEAR := 2015, \ - DISABLED_DOCLINT := html missing syntax, \ -)) - -TARGETS += $(jlinkplugins) - ################################################################################ # Copy JDWP html file From 208954cc4eb8b8d55877554873420ae9557f256e Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Wed, 18 Jan 2017 09:36:24 +0000 Subject: [PATCH 39/71] 8171380: Remove all exports from jdk.jlink Reviewed-by: alanb, mchung, sundar --- jdk/src/jdk.jlink/share/classes/module-info.java | 2 -- jdk/test/ProblemList.txt | 2 ++ jdk/test/TEST.ROOT | 4 ++-- jdk/test/tools/jlink/DefaultProviderTest.java | 1 + jdk/test/tools/jlink/ImageFileCreatorTest.java | 1 + jdk/test/tools/jlink/ImageFilePoolTest.java | 1 + jdk/test/tools/jlink/IntegrationTest.java | 1 + jdk/test/tools/jlink/JLink2Test.java | 1 + jdk/test/tools/jlink/JLinkOptionsTest.java | 1 + jdk/test/tools/jlink/JLinkPostProcessingTest.java | 1 + jdk/test/tools/jlink/JLinkTest.java | 1 + jdk/test/tools/jlink/ResourcePoolTest.java | 1 + jdk/test/tools/jlink/plugins/CompressorPluginTest.java | 1 + jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java | 1 + jdk/test/tools/jlink/plugins/ExcludePluginTest.java | 1 + jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java | 1 + jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java | 1 + jdk/test/tools/jlink/plugins/LastSorterTest.java | 5 +++-- jdk/test/tools/jlink/plugins/PluginsNegativeTest.java | 5 +++-- jdk/test/tools/jlink/plugins/PrevisitorTest.java | 5 +++-- jdk/test/tools/jlink/plugins/StringSharingPluginTest.java | 1 + jdk/test/tools/jlink/plugins/StripDebugPluginTest.java | 1 + jdk/test/tools/pack200/Utils.java | 1 + 23 files changed, 30 insertions(+), 10 deletions(-) diff --git a/jdk/src/jdk.jlink/share/classes/module-info.java b/jdk/src/jdk.jlink/share/classes/module-info.java index 69c4ae9952e..00140adb802 100644 --- a/jdk/src/jdk.jlink/share/classes/module-info.java +++ b/jdk/src/jdk.jlink/share/classes/module-info.java @@ -24,8 +24,6 @@ */ module jdk.jlink { - exports jdk.tools.jlink.plugin; - requires jdk.internal.opt; requires jdk.jdeps; diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 18cc959c84e..b0d21d7f918 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -258,6 +258,8 @@ tools/jimage/JImageVerifyTest.java 8169713 generic- tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java 8169971 windows-x64 +tools/jlink/CustomPluginTest.java 8172864 generic-all + ############################################################################ # jdk_jdi diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT index c61b9bca4e1..e822c4f2aae 100644 --- a/jdk/test/TEST.ROOT +++ b/jdk/test/TEST.ROOT @@ -26,8 +26,8 @@ groups=TEST.groups [closed/TEST.groups] # Allow querying of various System properties in @requires clauses requires.properties=sun.arch.data.model java.runtime.name -# Tests using jtreg 4.2 b04 features -requiredVersion=4.2 b04 +# Tests using jtreg 4.2 b05 features +requiredVersion=4.2 b05 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/jdk/test/tools/jlink/DefaultProviderTest.java b/jdk/test/tools/jlink/DefaultProviderTest.java index eb27d570301..47ad9c4b043 100644 --- a/jdk/test/tools/jlink/DefaultProviderTest.java +++ b/jdk/test/tools/jlink/DefaultProviderTest.java @@ -44,6 +44,7 @@ import tests.Helper; * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage * jdk.compiler diff --git a/jdk/test/tools/jlink/ImageFileCreatorTest.java b/jdk/test/tools/jlink/ImageFileCreatorTest.java index c88ae4bada1..84f77340f42 100644 --- a/jdk/test/tools/jlink/ImageFileCreatorTest.java +++ b/jdk/test/tools/jlink/ImageFileCreatorTest.java @@ -48,6 +48,7 @@ import jdk.tools.jlink.plugin.ResourcePool; * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.builder + * jdk.jlink/jdk.tools.jlink.plugin * java.base/jdk.internal.jimage * @run main/othervm -verbose:gc -Xmx1g ImageFileCreatorTest */ diff --git a/jdk/test/tools/jlink/ImageFilePoolTest.java b/jdk/test/tools/jlink/ImageFilePoolTest.java index 2c1b80f439e..9f7687eb4b5 100644 --- a/jdk/test/tools/jlink/ImageFilePoolTest.java +++ b/jdk/test/tools/jlink/ImageFilePoolTest.java @@ -26,6 +26,7 @@ * @summary Test a pool containing external files. * @author Andrei Eremeev * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * @run build ImageFilePoolTest * @run main ImageFilePoolTest */ diff --git a/jdk/test/tools/jlink/IntegrationTest.java b/jdk/test/tools/jlink/IntegrationTest.java index e9666676b25..9bf019069ba 100644 --- a/jdk/test/tools/jlink/IntegrationTest.java +++ b/jdk/test/tools/jlink/IntegrationTest.java @@ -62,6 +62,7 @@ import tests.JImageGenerator; * jdk.jlink/jdk.tools.jlink.builder * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage * jdk.compiler diff --git a/jdk/test/tools/jlink/JLink2Test.java b/jdk/test/tools/jlink/JLink2Test.java index 8106fadee32..df2873a28b2 100644 --- a/jdk/test/tools/jlink/JLink2Test.java +++ b/jdk/test/tools/jlink/JLink2Test.java @@ -29,6 +29,7 @@ * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage * jdk.compiler diff --git a/jdk/test/tools/jlink/JLinkOptionsTest.java b/jdk/test/tools/jlink/JLinkOptionsTest.java index d38de3a0488..5fcadd6d598 100644 --- a/jdk/test/tools/jlink/JLinkOptionsTest.java +++ b/jdk/test/tools/jlink/JLinkOptionsTest.java @@ -39,6 +39,7 @@ import tests.Helper; * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage * jdk.compiler diff --git a/jdk/test/tools/jlink/JLinkPostProcessingTest.java b/jdk/test/tools/jlink/JLinkPostProcessingTest.java index 61bf3463cee..b04b3b84286 100644 --- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java +++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java @@ -46,6 +46,7 @@ import tests.Helper; * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage * jdk.compiler diff --git a/jdk/test/tools/jlink/JLinkTest.java b/jdk/test/tools/jlink/JLinkTest.java index 874c9dfef32..e137ce426f6 100644 --- a/jdk/test/tools/jlink/JLinkTest.java +++ b/jdk/test/tools/jlink/JLinkTest.java @@ -48,6 +48,7 @@ import tests.JImageGenerator; * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jimage * jdk.compiler * @build tests.* diff --git a/jdk/test/tools/jlink/ResourcePoolTest.java b/jdk/test/tools/jlink/ResourcePoolTest.java index 2eda43333f3..3002161eee3 100644 --- a/jdk/test/tools/jlink/ResourcePoolTest.java +++ b/jdk/test/tools/jlink/ResourcePoolTest.java @@ -26,6 +26,7 @@ * @summary Test a pool containing jimage resources and classes. * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * @run build ResourcePoolTest * @run main ResourcePoolTest */ diff --git a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java index df3b7f7a49d..aea5c21424f 100644 --- a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java +++ b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java @@ -28,6 +28,7 @@ * @modules java.base/jdk.internal.jimage.decompressor * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * @run main CompressorPluginTest */ import java.net.URI; diff --git a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java index 01c31699e87..29ee71ff522 100644 --- a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java +++ b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java @@ -27,6 +27,7 @@ * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * @run main ExcludeFilesPluginTest */ diff --git a/jdk/test/tools/jlink/plugins/ExcludePluginTest.java b/jdk/test/tools/jlink/plugins/ExcludePluginTest.java index b45a453187c..fee21c97e43 100644 --- a/jdk/test/tools/jlink/plugins/ExcludePluginTest.java +++ b/jdk/test/tools/jlink/plugins/ExcludePluginTest.java @@ -27,6 +27,7 @@ * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * @run main ExcludePluginTest */ diff --git a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java index 48947c1f50e..f581e9bad90 100644 --- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java +++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java @@ -27,6 +27,7 @@ * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * @run main ExcludeVMPluginTest */ import java.io.ByteArrayInputStream; diff --git a/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java b/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java index 6e6b57f89dd..6766a1df256 100644 --- a/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java +++ b/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java @@ -48,6 +48,7 @@ import tests.Result; * jdk.jdeps/com.sun.tools.classfile * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage * jdk.compiler diff --git a/jdk/test/tools/jlink/plugins/LastSorterTest.java b/jdk/test/tools/jlink/plugins/LastSorterTest.java index 0415a431eef..276ce50bf01 100644 --- a/jdk/test/tools/jlink/plugins/LastSorterTest.java +++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java @@ -25,8 +25,9 @@ * @test * @summary Test last sorter property * @author Jean-Francois Denise - * @modules jdk.jlink/jdk.tools.jlink.internal - * jdk.jlink/jdk.tools.jlink + * @modules jdk.jlink/jdk.tools.jlink + * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * @run main/othervm LastSorterTest */ diff --git a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java index 7c7dc268697..6119fe41d92 100644 --- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java +++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java @@ -25,8 +25,9 @@ * @test * @summary Negative test for ImagePluginStack. * @author Andrei Eremeev - * @modules jdk.jlink/jdk.tools.jlink.internal - * jdk.jlink/jdk.tools.jlink + * @modules jdk.jlink/jdk.tools.jlink + * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * @run main/othervm PluginsNegativeTest */ import java.lang.reflect.Layer; diff --git a/jdk/test/tools/jlink/plugins/PrevisitorTest.java b/jdk/test/tools/jlink/plugins/PrevisitorTest.java index 8c42075d6c3..2545e88160a 100644 --- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java +++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java @@ -25,8 +25,9 @@ * @test * @summary Test previsitor * @author Andrei Eremeev - * @modules jdk.jlink/jdk.tools.jlink.internal - * jdk.jlink/jdk.tools.jlink + * @modules jdk.jlink/jdk.tools.jlink + * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * @run main/othervm PrevisitorTest */ import java.nio.ByteOrder; diff --git a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java index 9cd1da6f0e7..8919129bbc3 100644 --- a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java +++ b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java @@ -30,6 +30,7 @@ * java.base/jdk.internal.jimage.decompressor * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jmod * jdk.jlink/jdk.tools.jimage * jdk.jdeps/com.sun.tools.classfile diff --git a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java index 73028bd031d..5cfed46e2a2 100644 --- a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java +++ b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java @@ -30,6 +30,7 @@ * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins + * jdk.jlink/jdk.tools.jlink.plugin * jdk.jlink/jdk.tools.jimage * jdk.jlink/jdk.tools.jmod * jdk.jdeps/com.sun.tools.classfile diff --git a/jdk/test/tools/pack200/Utils.java b/jdk/test/tools/pack200/Utils.java index 76ab9aaba44..c0fe317ce84 100644 --- a/jdk/test/tools/pack200/Utils.java +++ b/jdk/test/tools/pack200/Utils.java @@ -111,6 +111,7 @@ class Utils { compiler("-d", XCLASSES.getName(), + "--add-modules=jdk.jdeps", "--add-exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED", "@" + tmpFile.getAbsolutePath()); From 433cd91ee2c75f2ec5def748fd1eee89609855e3 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Wed, 18 Jan 2017 11:47:36 +0000 Subject: [PATCH 40/71] 8172886: Add a test that shows how the LogManager can be implemented by a module Reviewed-by: mchung --- .../LogManagerInModuleTest.java | 87 +++++++++++++++++++ .../LogManagerInModule/logging.properties | 56 ++++++++++++ .../test.config/module-info.java | 31 +++++++ .../test.config/test/config/LogConfig.java | 51 +++++++++++ .../test.handlers/module-info.java | 31 +++++++ .../test/handlers/TestHandler.java | 47 ++++++++++ .../test.logmanager/module-info.java | 31 +++++++ .../test/logmanager/TestLogManager.java | 34 ++++++++ 8 files changed, 368 insertions(+) create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/LogManagerInModuleTest.java create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/logging.properties create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/test.config/module-info.java create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/test.config/test/config/LogConfig.java create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/module-info.java create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/test/handlers/TestHandler.java create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/module-info.java create mode 100644 jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/test/logmanager/TestLogManager.java diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/LogManagerInModuleTest.java b/jdk/test/java/util/logging/modules/LogManagerInModule/LogManagerInModuleTest.java new file mode 100644 index 00000000000..7dbe5213704 --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/LogManagerInModuleTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2017, 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.nio.file.Paths; +import java.util.logging.Handler; +import java.util.logging.LogManager; +import java.util.logging.Logger; + +/** + * @test + * @bug 8172886 + * @summary Verifies that a custom LogManager or custom Handler can be + * instantiated by the logging system if they are in a package + * that is exported to java.logging by a module. + * @build test.logmanager/test.logmanager.TestLogManager + * test.handlers/test.handlers.TestHandler + * test.config/test.config.LogConfig + * LogManagerInModuleTest + * @run main/othervm --add-modules test.logmanager,test.handlers + * -Djava.util.logging.manager=test.logmanager.TestLogManager + * LogManagerInModuleTest + * @run main/othervm --add-modules test.logmanager,test.handlers,test.config + * -Djava.util.logging.manager=test.logmanager.TestLogManager + * -Djava.util.logging.config.class=test.config.LogConfig + * LogManagerInModuleTest + * + * @author danielfuchs + */ +public class LogManagerInModuleTest { + + public static void main(String[] args) throws Exception { + if (System.getProperty("java.util.logging.config.class", null) == null) { + System.setProperty("java.util.logging.config.file", + Paths.get(System.getProperty("test.src", "src"), + "logging.properties").toString()); + } + // sanity check + if (LogManagerInModuleTest.class.getModule().isNamed()) { + throw new RuntimeException("Unexpected named module for " + + LogManagerInModuleTest.class + ": " + + LogManagerInModuleTest.class.getModule().getName()); + } + + // now check that the LogManager was correctly instantiated. + LogManager manager = LogManager.getLogManager(); + System.out.println("LogManager: " + manager); + Class logManagerClass = manager.getClass(); + if (!"test.logmanager".equals(logManagerClass.getModule().getName())) { + throw new RuntimeException("Bad module for log manager: " + + logManagerClass.getModule() + "; class is: " + + logManagerClass.getName()); + } + + Logger logger = Logger.getLogger("com.xyz.foo"); + Handler[] handlers = logger.getHandlers(); + if (handlers.length != 1) { + throw new RuntimeException("Expected 1 handler, found " + handlers.length); + } + Class handlerClass = handlers[0].getClass(); + if (!"test.handlers".equals(handlerClass.getModule().getName())) { + throw new RuntimeException("Bad module for handler: " + + handlerClass.getModule() + "; class is: " + + handlerClass.getName()); + } + } + +} diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/logging.properties b/jdk/test/java/util/logging/modules/LogManagerInModule/logging.properties new file mode 100644 index 00000000000..6b4bd6dbdf2 --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/logging.properties @@ -0,0 +1,56 @@ +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +# Note that these classes must be on the system classpath. +# By default we only configure a ConsoleHandler, which will only +# show messages at the INFO and above levels. +handlers= java.util.logging.ConsoleHandler + +# To also add the FileHandler, use the following line instead. +#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler + +# Default global logging level. +# This specifies which kinds of events are logged across +# all loggers. For any given facility this global level +# can be overriden by a facility specific level +# Note that the ConsoleHandler also has a separate level +# setting to limit messages printed to the console. +.level= INFO + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +# default file output is in user's home directory. +java.util.logging.FileHandler.pattern = %h/java%u.log +java.util.logging.FileHandler.limit = 50000 +java.util.logging.FileHandler.count = 1 +# Default number of locks FileHandler can obtain synchronously. +# This specifies maximum number of attempts to obtain lock file by FileHandler +# implemented by incrementing the unique field %u as per FileHandler API documentation. +java.util.logging.FileHandler.maxLocks = 100 +java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter + +# Limit the message that are printed on the console to INFO and above. +java.util.logging.ConsoleHandler.level = INFO +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter + +# Example to customize the SimpleFormatter output format +# to print one-line log message like this: +# : [] +# +# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n + +############################################################ +# Facility specific properties. +# Provides extra control for each logger. +############################################################ + +# For example, set the com.xyz.foo logger to only log SEVERE +# messages: +com.xyz.foo.level = SEVERE +com.xyz.foo.handlers = test.handlers.TestHandler diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/test.config/module-info.java b/jdk/test/java/util/logging/modules/LogManagerInModule/test.config/module-info.java new file mode 100644 index 00000000000..fb7cde07f6a --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/test.config/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017, 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. + */ + +module test.config { + requires java.logging; + requires test.handlers; + // makes it possible for java.logging to instantiate test.config.LogConfig; + // this doesn't need to be a qualified export, but making it so will prevent + // any other module from being able to instantiate the provided classes. + exports test.config to java.logging; +} diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/test.config/test/config/LogConfig.java b/jdk/test/java/util/logging/modules/LogManagerInModule/test.config/test/config/LogConfig.java new file mode 100644 index 00000000000..51e6281245b --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/test.config/test/config/LogConfig.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.config; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.LogManager; +import java.util.logging.Logger; +import test.handlers.TestHandler; + +/** + * A dummy class that configures the logging system. + * @author danielfuchs + */ +public class LogConfig { + private static final List LOGGERS = new ArrayList<>(); + public LogConfig() { + LogManager manager = LogManager.getLogManager(); + Logger logger = Logger.getLogger("com.xyz.foo"); + if (logger.getHandlers().length > 0) { + System.err.println(this.getClass().getName() + ": " + + "Unexpected handlers: " + + List.of(logger.getHandlers())); + throw new RuntimeException("Unexpected handlers: " + + List.of(logger.getHandlers())); + } + logger.addHandler(new TestHandler()); + LOGGERS.add(logger); + } +} diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/module-info.java b/jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/module-info.java new file mode 100644 index 00000000000..dd839738b48 --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017, 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. + */ + +module test.handlers { + requires transitive java.logging; + // makes it possible for java.logging and test.config to instantiate + // test.handlers.TestHandler; + // this doesn't need to be a qualified export, but making it so will prevent + // any other module from being able to instantiate the provided classes. + exports test.handlers to java.logging, test.config; +} diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/test/handlers/TestHandler.java b/jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/test/handlers/TestHandler.java new file mode 100644 index 00000000000..7a0442b57c6 --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/test.handlers/test/handlers/TestHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.handlers; + +import java.util.logging.Handler; +import java.util.logging.LogRecord; + +/** + * A dummy Handler that does nothing. + * @author danielfuchs + */ +public class TestHandler extends Handler { + + @Override + public void publish(LogRecord record) { + } + + @Override + public void flush() { + } + + @Override + public void close() throws SecurityException { + } + +} diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/module-info.java b/jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/module-info.java new file mode 100644 index 00000000000..db70f293f98 --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017, 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. + */ + +module test.logmanager { + requires java.logging; + // makes it possible for java.logging to instantiate + // test.logmanager.TestLogManager; + // this doesn't need to be a qualified export, but making it so will prevent + // any other module from being able to instantiate the provided classes. + exports test.logmanager to java.logging; +} diff --git a/jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/test/logmanager/TestLogManager.java b/jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/test/logmanager/TestLogManager.java new file mode 100644 index 00000000000..5be0edcedd4 --- /dev/null +++ b/jdk/test/java/util/logging/modules/LogManagerInModule/test.logmanager/test/logmanager/TestLogManager.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.logmanager; + +import java.util.logging.LogManager; + +/** + * A dummy LogManager that simply extends the standard class. + * @author danielfuchs + */ +public class TestLogManager extends LogManager { + +} From fc2d5da4d8c401c52edb9ab43708f2398e723eba Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Wed, 18 Jan 2017 19:35:41 +0530 Subject: [PATCH 41/71] 8168254: Detect duplicated resources in packaged modules Reviewed-by: mchung, jlaskey --- .../jlink/builder/DefaultImageBuilder.java | 43 ++++++---- .../jlink/ResourceDuplicateCheckTest.java | 84 +++++++++++++++++++ 2 files changed, 109 insertions(+), 18 deletions(-) create mode 100644 jdk/test/tools/jlink/ResourceDuplicateCheckTest.java diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java index 27f79dd74d1..fccb913f4fa 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java @@ -165,18 +165,9 @@ public final class DefaultImageBuilder implements ImageBuilder { throw new PluginException("TargetPlatform attribute is missing for java.base module"); } - Path bin = root.resolve(BIN_DIRNAME); + checkResourcePool(files); - // check any duplicated resource files - Map> duplicates = new HashMap<>(); - files.entries() - .filter(f -> f.type() != ResourcePoolEntry.Type.CLASS_OR_RESOURCE) - .collect(groupingBy(this::entryToImagePath, - mapping(ResourcePoolEntry::moduleName, toSet()))) - .entrySet() - .stream() - .filter(e -> e.getValue().size() > 1) - .forEach(e -> duplicates.put(e.getKey(), e.getValue())); + Path bin = root.resolve(BIN_DIRNAME); // write non-classes resource files to the image files.entries() @@ -185,13 +176,8 @@ public final class DefaultImageBuilder implements ImageBuilder { try { accept(f); } catch (FileAlreadyExistsException e) { - // error for duplicated entries - Path path = entryToImagePath(f); - UncheckedIOException x = - new UncheckedIOException(path + " duplicated in " + - duplicates.get(path), e); - x.addSuppressed(e); - throw x; + // Should not happen! Duplicates checking already done! + throw new AssertionError("Duplicate entry!", e); } catch (IOException ioExp) { throw new UncheckedIOException(ioExp); } @@ -242,6 +228,27 @@ public final class DefaultImageBuilder implements ImageBuilder { } } + private void checkResourcePool(ResourcePool pool) { + // For now, only duplicate resources check. Add more checks here (if any) + checkDuplicateResources(pool); + } + + private void checkDuplicateResources(ResourcePool pool) { + // check any duplicated resources + Map> duplicates = new HashMap<>(); + pool.entries() + .filter(f -> f.type() != ResourcePoolEntry.Type.CLASS_OR_RESOURCE) + .collect(groupingBy(this::entryToImagePath, + mapping(ResourcePoolEntry::moduleName, toSet()))) + .entrySet() + .stream() + .filter(e -> e.getValue().size() > 1) + .forEach(e -> duplicates.put(e.getKey(), e.getValue())); + if (!duplicates.isEmpty()) { + throw new PluginException("Duplicate resources: " + duplicates); + } + } + /** * Generates launcher scripts. * diff --git a/jdk/test/tools/jlink/ResourceDuplicateCheckTest.java b/jdk/test/tools/jlink/ResourceDuplicateCheckTest.java new file mode 100644 index 00000000000..3997ed18e83 --- /dev/null +++ b/jdk/test/tools/jlink/ResourceDuplicateCheckTest.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2017, 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 8168254 + * @summary Detect duplicated resources in packaged modules + * @modules jdk.jlink/jdk.tools.jlink.builder + * jdk.jlink/jdk.tools.jlink.internal + * @run build ResourceDuplicateCheckTest + * @run main ResourceDuplicateCheckTest + */ + +import java.net.URI; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; +import jdk.tools.jlink.builder.DefaultImageBuilder; +import jdk.tools.jlink.internal.ResourcePoolEntryFactory; +import jdk.tools.jlink.internal.ResourcePoolManager; +import jdk.tools.jlink.plugin.PluginException; +import jdk.tools.jlink.plugin.ResourcePoolEntry; + +public class ResourceDuplicateCheckTest { + public static void main(String[] args) throws Exception { + new ResourceDuplicateCheckTest().test(); + } + + public void test() throws Exception { + ResourcePoolManager input = new ResourcePoolManager(); + // need java.base module info because OS name is retrieved from it from storeFiles + input.add(ResourcePoolEntryFactory.create("/java.base/module-info.class", + ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo())); + + // same NATIVE_CMD from two different modules + input.add(newInMemoryImageFile("/com.acme/bin/myexec", + ResourcePoolEntry.Type.NATIVE_CMD, "mylib")); + input.add(newInMemoryImageFile("/com.foo/bin/myexec", + ResourcePoolEntry.Type.NATIVE_CMD, "mylib")); + Path root = Paths.get(System.getProperty("test.classes")); + DefaultImageBuilder writer = new DefaultImageBuilder(root, Collections.emptyMap()); + try { + writer.storeFiles(input.resourcePool()); + } catch (PluginException pe) { + if (! pe.getMessage().contains("Duplicate resources:")) { + throw new AssertionError("expected duplicate resources message"); + } + } + } + + private byte[] getJavaBaseModuleInfo() throws Exception { + Path path = FileSystems. + getFileSystem(URI.create("jrt:/")). + getPath("/modules/java.base/module-info.class"); + return Files.readAllBytes(path); + } + + private static ResourcePoolEntry newInMemoryImageFile(String path, + ResourcePoolEntry.Type type, String content) { + return ResourcePoolEntryFactory.create(path, type, content.getBytes()); + } +} From 35864e236ce535afc8bebe2518a187eb6bdd07c7 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Wed, 18 Jan 2017 13:56:50 +0000 Subject: [PATCH 42/71] 8172973: Remove add exports from ModuleSummary build Reviewed-by: ihse, redestad --- jdk/make/ModuleTools.gmk | 1 - 1 file changed, 1 deletion(-) diff --git a/jdk/make/ModuleTools.gmk b/jdk/make/ModuleTools.gmk index 30cf959e174..71ca1cf8eaa 100644 --- a/jdk/make/ModuleTools.gmk +++ b/jdk/make/ModuleTools.gmk @@ -39,7 +39,6 @@ TOOL_GENGRAPHS := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \ build.tools.jigsaw.GenGraphs TOOL_MODULESUMMARY := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \ - --add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \ build.tools.jigsaw.ModuleSummary TOOL_ADD_PACKAGES_ATTRIBUTE := $(BUILD_JAVA) $(JAVA_FLAGS_SMALL) \ From f66de31c2467927ac90a1dcea756a9908c5dd125 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Wed, 18 Jan 2017 08:03:04 -0800 Subject: [PATCH 43/71] 8171140: Re-examine ResourceBundle::clearCache method Reviewed-by: mchung, dfuchs --- .../classes/java/util/ResourceBundle.java | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java index a1f2779deef..d49ae25ee01 100644 --- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -2134,7 +2134,7 @@ public abstract class ResourceBundle { /** * Removes all resource bundles from the cache that have been loaded - * by the caller's module using the caller's class loader. + * by the caller's module. * * @since 1.6 * @see ResourceBundle.Control#getTimeToLive(String,Locale) @@ -2142,50 +2142,26 @@ public abstract class ResourceBundle { @CallerSensitive public static final void clearCache() { Class caller = Reflection.getCallerClass(); - clearCacheImpl(caller.getModule(), caller.getClassLoader()); + cacheList.keySet().removeIf( + key -> key.getCallerModule() == caller.getModule() + ); } /** * Removes all resource bundles from the cache that have been loaded - * by the caller's module using the given class loader. + * by the given class loader. * * @param loader the class loader * @exception NullPointerException if loader is null * @since 1.6 * @see ResourceBundle.Control#getTimeToLive(String,Locale) */ - @CallerSensitive public static final void clearCache(ClassLoader loader) { Objects.requireNonNull(loader); - Class caller = Reflection.getCallerClass(); - clearCacheImpl(caller.getModule(), loader); - } - - /** - * Removes all resource bundles from the cache that have been loaded by the - * given {@code module}. - * - * @param module the module - * @throws NullPointerException - * if {@code module} is {@code null} - * @throws SecurityException - * if the caller doesn't have the permission to - * {@linkplain Module#getClassLoader() get the class loader} - * of the given {@code module} - * @since 9 - * @see ResourceBundle.Control#getTimeToLive(String,Locale) - */ - public static final void clearCache(Module module) { - Objects.requireNonNull(module); - clearCacheImpl(module, module.getClassLoader()); - } - - private static void clearCacheImpl(Module callerModule, ClassLoader loader) { cacheList.keySet().removeIf( key -> { Module m; - return key.getCallerModule() == callerModule && - (m = key.getModule()) != null && + return (m = key.getModule()) != null && getLoader(m) == loader; } ); From dd3c2097011d10d7c933a7081efa8e04be45aedb Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Wed, 18 Jan 2017 20:36:15 +0300 Subject: [PATCH 44/71] 8071566: Improve testing for multi-version JAR file maker tool Reviewed-by: chegar --- .../jdk/test/lib/process/OutputAnalyzer.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/lib/jdk/test/lib/process/OutputAnalyzer.java b/test/lib/jdk/test/lib/process/OutputAnalyzer.java index 97d9ae0db50..572610d788d 100644 --- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java +++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java @@ -182,6 +182,23 @@ public final class OutputAnalyzer { return this; } + /** + * Verify that the stdout and stderr contents of output buffer does not contain the string + * + * @throws RuntimeException If the string was found + */ + public OutputAnalyzer shouldBeEmpty() { + if (!stdout.isEmpty()) { + reportDiagnosticSummary(); + throw new RuntimeException("stdout was not empty"); + } + if (!stderr.isEmpty()) { + reportDiagnosticSummary(); + throw new RuntimeException("stderr was not empty"); + } + return this; + } + /** * Verify that the stdout contents of output buffer does not contain the string * @@ -365,6 +382,21 @@ public final class OutputAnalyzer { return this; } + /** + * Verify the exit value of the process + * + * @param notExpectedExitValue Unexpected exit value from process + * @throws RuntimeException If the exit value from the process did match the expected value + */ + public OutputAnalyzer shouldNotHaveExitValue(int notExpectedExitValue) { + if (getExitValue() == notExpectedExitValue) { + reportDiagnosticSummary(); + throw new RuntimeException("Unexpected to get exit value of [" + + notExpectedExitValue + "]\n"); + } + return this; + } + /** * Report summary that will help to diagnose the problem From f1fa73dc65613fae211a164dff019ab57417c921 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Wed, 18 Jan 2017 20:39:08 +0300 Subject: [PATCH 45/71] 8071566: Improve testing for multi-version JAR file maker tool Reviewed-by: chegar --- .../jar/multiRelease/ApiValidatorTest.java | 193 +++++++ jdk/test/tools/jar/multiRelease/Basic.java | 481 +++++++----------- jdk/test/tools/jar/multiRelease/Basic1.java | 207 ++------ .../tools/jar/multiRelease/MRTestBase.java | 130 +++++ .../data/test04/v9/version/Version.java | 2 +- 5 files changed, 554 insertions(+), 459 deletions(-) create mode 100644 jdk/test/tools/jar/multiRelease/ApiValidatorTest.java create mode 100644 jdk/test/tools/jar/multiRelease/MRTestBase.java diff --git a/jdk/test/tools/jar/multiRelease/ApiValidatorTest.java b/jdk/test/tools/jar/multiRelease/ApiValidatorTest.java new file mode 100644 index 00000000000..b861321bceb --- /dev/null +++ b/jdk/test/tools/jar/multiRelease/ApiValidatorTest.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2017, 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 + * @summary Tests for API validator. + * @library /test/lib /lib/testlibrary + * @modules java.base/jdk.internal.misc + * jdk.compiler + * jdk.jartool + * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Utils jdk.test.lib.process.* + * @build jdk.testlibrary.FileUtils + * @build MRTestBase + * @run testng ApiValidatorTest + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.testlibrary.FileUtils; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.lang.reflect.Method; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class ApiValidatorTest extends MRTestBase { + + @Test(dataProvider = "signatureChange") + public void changeMethodSignature(String sigBase, String sigV10, + boolean isAcceptable, + Method method) throws Throwable { + Path root = Paths.get(method.getName()); + Path classes = root.resolve("classes"); + + String METHOD_SIG = "#SIG"; + String classTemplate = + "public class C { \n" + + " " + METHOD_SIG + "{ throw new RuntimeException(); };\n" + + "}\n"; + String base = classTemplate.replace(METHOD_SIG, sigBase); + String v10 = classTemplate.replace(METHOD_SIG, sigV10); + + compileTemplate(classes.resolve("base"), base); + compileTemplate(classes.resolve("v10"), v10); + + String jarfile = root.resolve("test.jar").toString(); + OutputAnalyzer result = jar("cf", jarfile, + "-C", classes.resolve("base").toString(), ".", + "--release", "10", "-C", classes.resolve("v10").toString(), + "."); + if (isAcceptable) { + result.shouldHaveExitValue(SUCCESS) + .shouldBeEmpty(); + } else { + result.shouldNotHaveExitValue(SUCCESS) + .shouldContain("contains a class with different api from earlier version"); + } + + FileUtils.deleteFileTreeWithRetry(root); + } + + @DataProvider + Object[][] signatureChange() { + return new Object[][]{ + {"public int m()", "protected int m()", false}, + {"protected int m()", "public int m()", false}, + {"public int m()", "int m()", false}, + {"protected int m()", "private int m()", false}, + {"private int m()", "int m()", true}, + {"int m()", "private int m()", true}, + {"int m()", "private int m(boolean b)", true}, + {"public int m()", "public int m(int i)", false}, + {"public int m()", "public int k()", false}, + {"public int m()", "private int k()", false}, +// @ignore JDK-8172147 {"public int m()", "public boolean m()", false}, +// @ignore JDK-8172147 {"public boolean", "public Boolean", false}, +// @ignore JDK-8172147 {"public T", "public T", false}, + }; + } + + @Test(dataProvider = "publicAPI") + public void introducingPublicMembers(String publicAPI, + Method method) throws Throwable { + Path root = Paths.get(method.getName()); + Path classes = root.resolve("classes"); + + String API = "#API"; + String classTemplate = + "public class C { \n" + + " " + API + "\n" + + " public void method(){ };\n" + + "}\n"; + String base = classTemplate.replace(API, ""); + String v10 = classTemplate.replace(API, publicAPI); + + compileTemplate(classes.resolve("base"), base); + compileTemplate(classes.resolve("v10"), v10); + + String jarfile = root.resolve("test.jar").toString(); + jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", + "--release", "10", "-C", classes.resolve("v10").toString(), ".") + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("contains a class with different api from earlier version"); + + FileUtils.deleteFileTreeWithRetry(root); + } + + @DataProvider + Object[][] publicAPI() { + return new Object[][]{ +// @ignore JDK-8172148 {"protected class Inner { public void m(){ } } "}, // protected inner class +// @ignore JDK-8172148 {"public class Inner { public void m(){ } }"}, // public inner class +// @ignore JDK-8172148 {"public enum E { A; }"}, // public enum + {"public void m(){ }"}, // public method + {"protected void m(){ }"}, // protected method + }; + } + + @Test(dataProvider = "privateAPI") + public void introducingPrivateMembers(String privateAPI, + Method method) throws Throwable { + Path root = Paths.get(method.getName()); + Path classes = root.resolve("classes"); + + String API = "#API"; + String classTemplate = + "public class C { \n" + + " " + API + "\n" + + " public void method(){ };\n" + + "}\n"; + String base = classTemplate.replace(API, ""); + String v10 = classTemplate.replace(API, privateAPI); + + compileTemplate(classes.resolve("base"), base); + compileTemplate(classes.resolve("v10"), v10); + + String jarfile = root.resolve("test.jar").toString(); + jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", + "--release", "10", "-C", classes.resolve("v10").toString(), ".") + .shouldHaveExitValue(SUCCESS); + // add release + jar("uf", jarfile, + "--release", "11", "-C", classes.resolve("v10").toString(), ".") + .shouldHaveExitValue(SUCCESS); + // replace release + jar("uf", jarfile, + "--release", "11", "-C", classes.resolve("v10").toString(), ".") + .shouldHaveExitValue(SUCCESS); + + FileUtils.deleteFileTreeWithRetry(root); + } + + @DataProvider + Object[][] privateAPI() { + return new Object[][]{ + {"private class Inner { public void m(){ } } "}, // private inner class + {"class Inner { public void m(){ } }"}, // package private inner class + {"enum E { A; }"}, // package private enum + // Local class and private method + {"private void m(){ class Inner { public void m(){} } Inner i = null; }"}, + {"void m(){ }"}, // package private method + }; + } + + private void compileTemplate(Path classes, String template) throws Throwable { + Path classSourceFile = Files.createDirectories( + classes.getParent().resolve("src").resolve(classes.getFileName())) + .resolve("C.java"); + Files.write(classSourceFile, template.getBytes()); + javac(classes, classSourceFile); + } +} \ No newline at end of file diff --git a/jdk/test/tools/jar/multiRelease/Basic.java b/jdk/test/tools/jar/multiRelease/Basic.java index 1d559ad1262..80f37950591 100644 --- a/jdk/test/tools/jar/multiRelease/Basic.java +++ b/jdk/test/tools/jar/multiRelease/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -23,69 +23,59 @@ /* * @test - * @library /test/lib + * @library /test/lib /lib/testlibrary * @modules java.base/jdk.internal.misc * jdk.compiler * jdk.jartool - * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Utils + * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Utils jdk.test.lib.process.* + * @build jdk.testlibrary.FileUtils + * @build MRTestBase * @run testng Basic */ import static org.testng.Assert.*; +import jdk.testlibrary.FileUtils; import org.testng.annotations.*; -import java.io.*; +import java.io.File; import java.nio.file.*; -import java.nio.file.attribute.*; import java.util.*; -import java.util.function.Consumer; -import java.util.jar.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.zip.*; +import java.util.jar.JarFile; +import java.util.zip.ZipFile; -import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.Utils; - - -import static java.lang.String.format; -import static java.lang.System.out; - -public class Basic { - private final String src = System.getProperty("test.src", "."); - private final String usr = System.getProperty("user.dir", "."); +public class Basic extends MRTestBase { @Test // create a regular, non-multi-release jar - public void test00() throws IOException { + public void test00() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 Path classes = Paths.get("classes"); jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".") - .assertSuccess(); + .shouldHaveExitValue(SUCCESS); checkMultiRelease(jarfile, false); - Map names = Map.of( + Map names = Map.of( "version/Main.class", - new String[] {"base", "version", "Main.class"}, + new String[]{"base", "version", "Main.class"}, "version/Version.class", - new String[] {"base", "version", "Version.class"} + new String[]{"base", "version", "Version.class"} ); compare(jarfile, names); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // create a multi-release jar - public void test01() throws IOException { + public void test01() throws Throwable { String jarfile = "test.jar"; compile("test01"); @@ -94,68 +84,96 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".", "--release", "10", "-C", classes.resolve("v10").toString(), ".") - .assertSuccess(); + .shouldHaveExitValue(SUCCESS); checkMultiRelease(jarfile, true); - Map names = Map.of( + Map names = Map.of( "version/Main.class", - new String[] {"base", "version", "Main.class"}, + new String[]{"base", "version", "Main.class"}, "version/Version.class", - new String[] {"base", "version", "Version.class"}, + new String[]{"base", "version", "Version.class"}, "META-INF/versions/9/version/Version.class", - new String[] {"v9", "version", "Version.class"}, + new String[]{"v9", "version", "Version.class"}, "META-INF/versions/10/version/Version.class", - new String[] {"v10", "version", "Version.class"} + new String[]{"v10", "version", "Version.class"} ); compare(jarfile, names); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); + } + + @Test + public void versionFormat() throws Throwable { + String jarfile = "test.jar"; + + compile("test01"); + + Path classes = Paths.get("classes"); + + // valid + for (String release : List.of("10000", "09", "00010", "10")) { + jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", + "--release", release, "-C", classes.resolve("v10").toString(), ".") + .shouldHaveExitValue(SUCCESS) + .shouldBeEmpty(); + } + // invalid + for (String release : List.of("9.0", "8", "v9", + "9v", "0", "-10")) { + jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", + "--release", release, "-C", classes.resolve("v10").toString(), ".") + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("release " + release + " not valid"); + } + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // update a regular jar to a multi-release jar - public void test02() throws IOException { + public void test02() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 Path classes = Paths.get("classes"); jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".") - .assertSuccess(); + .shouldHaveExitValue(SUCCESS); checkMultiRelease(jarfile, false); - jar("uf", jarfile, "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertSuccess(); + jar("uf", jarfile, + "--release", "9", "-C", classes.resolve("v9").toString(), ".") + .shouldHaveExitValue(SUCCESS); checkMultiRelease(jarfile, true); - Map names = Map.of( + Map names = Map.of( "version/Main.class", - new String[] {"base", "version", "Main.class"}, + new String[]{"base", "version", "Main.class"}, "version/Version.class", - new String[] {"base", "version", "Version.class"}, + new String[]{"base", "version", "Version.class"}, "META-INF/versions/9/version/Version.class", - new String[] {"v9", "version", "Version.class"} + new String[]{"v9", "version", "Version.class"} ); compare(jarfile, names); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // replace a base entry and a versioned entry - public void test03() throws IOException { + public void test03() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -163,19 +181,19 @@ public class Basic { Path classes = Paths.get("classes"); jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertSuccess(); + .shouldHaveExitValue(SUCCESS); checkMultiRelease(jarfile, true); - Map names = Map.of( + Map names = Map.of( "version/Main.class", - new String[] {"base", "version", "Main.class"}, + new String[]{"base", "version", "Main.class"}, "version/Version.class", - new String[] {"base", "version", "Version.class"}, + new String[]{"base", "version", "Version.class"}, "META-INF/versions/9/version/Version.class", - new String[] {"v9", "version", "Version.class"} + new String[]{"v9", "version", "Version.class"} ); compare(jarfile, names); @@ -184,25 +202,25 @@ public class Basic { // version/Version.class entry in versions/9 section jar("uf", jarfile, "-C", classes.resolve("v9").toString(), "version", "--release", "9", "-C", classes.resolve("v10").toString(), ".") - .assertSuccess(); + .shouldHaveExitValue(SUCCESS); checkMultiRelease(jarfile, true); names = Map.of( "version/Main.class", - new String[] {"base", "version", "Main.class"}, + new String[]{"base", "version", "Main.class"}, "version/Version.class", - new String[] {"v9", "version", "Version.class"}, + new String[]{"v9", "version", "Version.class"}, "META-INF/versions/9/version/Version.class", - new String[] {"v10", "version", "Version.class"} + new String[]{"v10", "version", "Version.class"} ); compare(jarfile, names); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } /* @@ -211,7 +229,7 @@ public class Basic { @Test // META-INF/versions/9 class has different api than base class - public void test04() throws IOException { + public void test04() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -224,18 +242,16 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertFailure() - .resultChecker(r -> - assertTrue(r.output.contains("different api from earlier"), r.output) - ); + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("different api from earlier"); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // META-INF/versions/9 contains an extra public class - public void test05() throws IOException { + public void test05() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -248,18 +264,16 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertFailure() - .resultChecker(r -> - assertTrue(r.output.contains("contains a new public class"), r.output) - ); + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("contains a new public class"); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // META-INF/versions/9 contains an extra package private class -- this is okay - public void test06() throws IOException { + public void test06() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -272,16 +286,16 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertSuccess(); + .shouldHaveExitValue(SUCCESS); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // META-INF/versions/9 contains an identical class to base entry class // this is okay but produces warning - public void test07() throws IOException { + public void test07() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -294,19 +308,42 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertSuccess() - .resultChecker(r -> - assertTrue(r.outputContains("contains a class that is identical"), r.output) - ); + .shouldHaveExitValue(SUCCESS) + .shouldContain("contains a class that") + .shouldContain("is identical"); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); + } + + @Test + // META-INF/versions/9 contains an identical class to previous version entry class + // this is okay but produces warning + public void identicalClassToPreviousVersion() throws Throwable { + String jarfile = "test.jar"; + + compile("test01"); //use same data as test01 + + Path classes = Paths.get("classes"); + + jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", + "--release", "9", "-C", classes.resolve("v9").toString(), ".") + .shouldHaveExitValue(SUCCESS) + .shouldBeEmpty(); + jar("uf", jarfile, + "--release", "10", "-C", classes.resolve("v9").toString(), ".") + .shouldHaveExitValue(SUCCESS) + .shouldContain("contains a class that") + .shouldContain("is identical"); + + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // resources with same name in different versions // this is okay but produces warning - public void test08() throws IOException { + public void test08() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -320,10 +357,8 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertSuccess() - .resultChecker(r -> - assertTrue(r.output.isEmpty(), r.output) - ); + .shouldHaveExitValue(SUCCESS) + .shouldBeEmpty(); // now add a different resource with same name to META-INF/version/9 Files.copy(source.resolve("Main.java"), classes.resolve("v9") @@ -331,18 +366,16 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertSuccess() - .resultChecker(r -> - assertTrue(r.output.contains("multiple resources with same name"), r.output) - ); + .shouldHaveExitValue(SUCCESS) + .shouldContain("multiple resources with same name"); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // a class with an internal name different from the external name - public void test09() throws IOException { + public void test09() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -355,18 +388,16 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertFailure() - .resultChecker(r -> - assertTrue(r.output.contains("names do not match"), r.output) - ); + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("names do not match"); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // assure that basic nested classes are acceptable - public void test10() throws IOException { + public void test10() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -383,15 +414,15 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertSuccess(); + .shouldHaveExitValue(SUCCESS); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // a base entry contains a nested class that doesn't have a matching top level class - public void test11() throws IOException { + public void test11() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -409,30 +440,29 @@ public class Basic { source = Paths.get(src, "data", "test10", "v9", "version"); javac(classes.resolve("v9"), source.resolve("Nested.java")); - jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", + List output = jar("cf", jarfile, + "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertFailure() - .resultChecker(r -> { - String[] msg = r.output.split("\\R"); - // There should be 3 error messages, cascading from the first. Once we - // remove the base top level class, the base nested class becomes isolated, - // also the versioned top level class becomes a new public class, thus ignored - // for subsequent checks, leading to the associated versioned nested class - // becoming an isolated nested class - assertTrue(msg.length == 4); - assertTrue(msg[0].contains("an isolated nested class"), msg[0]); - assertTrue(msg[1].contains("contains a new public class"), msg[1]); - assertTrue(msg[2].contains("an isolated nested class"), msg[2]); - assertTrue(msg[3].contains("invalid multi-release jar file"), msg[3]); - }); + .shouldNotHaveExitValue(SUCCESS) + .asLines(); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + assertTrue(output.size() == 4); + assertTrue(output.get(0).contains("an isolated nested class"), + output.get(0)); + assertTrue(output.get(1).contains("contains a new public class"), + output.get(1)); + assertTrue(output.get(2).contains("an isolated nested class"), + output.get(2)); + assertTrue(output.get(3).contains("invalid multi-release jar file"), + output.get(3)); + + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } @Test // a versioned entry contains a nested class that doesn't have a matching top level class - public void test12() throws IOException { + public void test12() throws Throwable { String jarfile = "test.jar"; compile("test01"); //use same data as test01 @@ -452,178 +482,59 @@ public class Basic { jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") - .assertFailure() - .resultChecker(r -> - assertTrue(r.outputContains("an isolated nested class"), r.output) - ); + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("an isolated nested class"); - delete(jarfile); - deleteDir(Paths.get(usr, "classes")); + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } - /* - * Test Infrastructure - */ - private void compile(String test) throws IOException { - Path classes = Paths.get(usr, "classes", "base"); - Files.createDirectories(classes); - Path source = Paths.get(src, "data", test, "base", "version"); - javac(classes, source.resolve("Main.java"), source.resolve("Version.java")); + @Test + public void testCustomManifest() throws Throwable { + String jarfile = "test.jar"; - classes = Paths.get(usr, "classes", "v9"); - Files.createDirectories(classes); - source = Paths.get(src, "data", test, "v9", "version"); - javac(classes, source.resolve("Version.java")); + compile("test01"); - classes = Paths.get(usr, "classes", "v10"); - Files.createDirectories(classes); - source = Paths.get(src, "data", test, "v10", "version"); - javac(classes, source.resolve("Version.java")); - } + Path classes = Paths.get("classes"); + Path manifest = Paths.get("Manifest.txt"); - private void checkMultiRelease(String jarFile, boolean expected) throws IOException { - try (JarFile jf = new JarFile(new File(jarFile), true, ZipFile.OPEN_READ, - JarFile.runtimeVersion())) { - assertEquals(jf.isMultiRelease(), expected); - } - } + // create + Files.write(manifest, "Class-Path: MyUtils.jar\n".getBytes()); - // compares the bytes found in the jar entries with the bytes found in the - // corresponding data files used to create the entries - private void compare(String jarfile, Map names) throws IOException { - try (JarFile jf = new JarFile(jarfile)) { - for (String name : names.keySet()) { - Path path = Paths.get("classes", names.get(name)); - byte[] b1 = Files.readAllBytes(path); - byte[] b2; - JarEntry je = jf.getJarEntry(name); - try (InputStream is = jf.getInputStream(je)) { - b2 = is.readAllBytes(); - } - assertEquals(b1,b2); - } - } - } + jar("cfm", jarfile, manifest.toString(), + "-C", classes.resolve("base").toString(), ".", + "--release", "10", "-C", classes.resolve("v10").toString(), ".") + .shouldHaveExitValue(SUCCESS) + .shouldBeEmpty(); - private void delete(String name) throws IOException { - Files.deleteIfExists(Paths.get(usr, name)); - } - - private void deleteDir(Path dir) throws IOException { - Files.walkFileTree(dir, new SimpleFileVisitor() { - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - Files.delete(file); - return FileVisitResult.CONTINUE; - } - - @Override - public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { - Files.delete(dir); - return FileVisitResult.CONTINUE; - } - }); - } - - /* - * The following methods were taken from modular jar and other jar tests - */ - - void javac(Path dest, Path... sourceFiles) throws IOException { - String javac = JDKToolFinder.getJDKTool("javac"); - - List commands = new ArrayList<>(); - commands.add(javac); - String opts = System.getProperty("test.compiler.opts"); - if (!opts.isEmpty()) { - commands.addAll(Arrays.asList(opts.split(" +"))); - } - commands.add("-d"); - commands.add(dest.toString()); - Stream.of(sourceFiles).map(Object::toString).forEach(x -> commands.add(x)); - - quickFail(run(new ProcessBuilder(commands))); - } - - Result jarWithStdin(File stdinSource, String... args) { - String jar = JDKToolFinder.getJDKTool("jar"); - List commands = new ArrayList<>(); - commands.add(jar); - commands.addAll(Utils.getForwardVmOptions()); - Stream.of(args).forEach(x -> commands.add(x)); - ProcessBuilder p = new ProcessBuilder(commands); - if (stdinSource != null) - p.redirectInput(stdinSource); - return run(p); - } - - Result jar(String... args) { - return jarWithStdin(null, args); - } - - void quickFail(Result r) { - if (r.ec != 0) - throw new RuntimeException(r.output); - } - - Result run(ProcessBuilder pb) { - Process p; - out.printf("Running: %s%n", pb.command()); - try { - p = pb.start(); - } catch (IOException e) { - throw new RuntimeException( - format("Couldn't start process '%s'", pb.command()), e); + try (JarFile jf = new JarFile(new File(jarfile), true, + ZipFile.OPEN_READ, JarFile.runtimeVersion())) { + assertTrue(jf.isMultiRelease(), "Not multi-release jar"); + assertEquals(jf.getManifest() + .getMainAttributes() + .getValue("Class-Path"), + "MyUtils.jar"); } - String output; - try { - output = toString(p.getInputStream(), p.getErrorStream()); - } catch (IOException e) { - throw new RuntimeException( - format("Couldn't read process output '%s'", pb.command()), e); + // update + Files.write(manifest, "Multi-release: false\n".getBytes()); + + jar("ufm", jarfile, manifest.toString(), + "-C", classes.resolve("base").toString(), ".", + "--release", "9", "-C", classes.resolve("v10").toString(), ".") + .shouldHaveExitValue(SUCCESS) + .shouldContain("WARNING: Duplicate name in Manifest: Multi-release."); + + try (JarFile jf = new JarFile(new File(jarfile), true, + ZipFile.OPEN_READ, JarFile.runtimeVersion())) { + assertTrue(jf.isMultiRelease(), "Not multi-release jar"); + assertEquals(jf.getManifest() + .getMainAttributes() + .getValue("Class-Path"), + "MyUtils.jar"); } - try { - p.waitFor(); - } catch (InterruptedException e) { - throw new RuntimeException( - format("Process hasn't finished '%s'", pb.command()), e); - } - return new Result(p.exitValue(), output); - } - - String toString(InputStream in1, InputStream in2) throws IOException { - try (ByteArrayOutputStream dst = new ByteArrayOutputStream(); - InputStream concatenated = new SequenceInputStream(in1, in2)) { - concatenated.transferTo(dst); - return new String(dst.toByteArray(), "UTF-8"); - } - } - - static class Result { - final int ec; - final String output; - - private Result(int ec, String output) { - this.ec = ec; - this.output = output; - } - - boolean outputContains(String msg) { - return Arrays.stream(output.split("\\R")) - .collect(Collectors.joining(" ")) - .contains(msg); - } - - Result assertSuccess() { - assertTrue(ec == 0, format("ec: %d, output: %s", ec, output)); - return this; - } - Result assertFailure() { - assertTrue(ec != 0, format("ec: %d, output: %s", ec, output)); - return this; - } - Result resultChecker(Consumer r) { r.accept(this); return this; } + FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); + FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); } } diff --git a/jdk/test/tools/jar/multiRelease/Basic1.java b/jdk/test/tools/jar/multiRelease/Basic1.java index 8c3788085ee..e01ce8fe2f8 100644 --- a/jdk/test/tools/jar/multiRelease/Basic1.java +++ b/jdk/test/tools/jar/multiRelease/Basic1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -28,76 +28,65 @@ * jdk.compiler * jdk.jartool * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Utils + * @build MRTestBase * @run testng Basic1 */ -import static org.testng.Assert.*; - import org.testng.annotations.*; -import java.io.*; import java.nio.file.*; import java.util.*; -import java.util.function.Consumer; -import java.util.jar.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.zip.*; -import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.Utils; - - -import static java.lang.String.format; -import static java.lang.System.out; - -public class Basic1 { - private final String src = System.getProperty("test.src", "."); +public class Basic1 extends MRTestBase { @BeforeTest - public void setup() throws IOException { + public void setup() throws Throwable { String test = "test01"; - Path classes = Paths.get("classes", "base"); - Files.createDirectories(classes); - Path source = Paths.get(src, "data", test, "base", "version"); - javac(classes, source.resolve("Main.java"), source.resolve("Version.java")); + Path classes = Paths.get("classes"); - Path v9 = Paths.get("v9"); + Path base = classes.resolve("base"); + Files.createDirectories(base); + Path source = Paths.get(src, "data", test, "base", "version"); + javac(base, source.resolve("Main.java"), source.resolve("Version.java")); + + Path v9 = classes.resolve("v9"); Files.createDirectories(v9); source = Paths.get(src, "data", test, "v9", "version"); javac(v9, source.resolve("Version.java")); - Path v10 = Paths.get("v10"); + Path v10 = classes.resolve("v10"); Files.createDirectories(v10); source = Paths.get(src, "data", test, "v10", "version"); javac(v10, source.resolve("Version.java")); - Path v10_1 = Paths.get("v10_1").resolve("META-INF").resolve("versions").resolve("v10"); + Path v10_1 = classes.resolve("v10_1").resolve("META-INF").resolve("versions").resolve("v10"); Files.createDirectories(v10_1); source = Paths.get(src, "data", test, "v10", "version"); javac(v10_1, source.resolve("Version.java")); } @Test - public void test() throws IOException { + public void test() throws Throwable { String jarfile = "test.jar"; Path classes = Paths.get("classes"); - Path v9 = Paths.get("v9"); - Path v10 = Paths.get("v10"); - jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", - "--release", "9", "-C", v9.toString(), ".", - "--release", "10", "-C", v10.toString(), ".") - .assertSuccess(); + Path base = classes.resolve("base"); + Path v9 = classes.resolve("v9"); + Path v10 = classes.resolve("v10"); + + jar("cf", jarfile, "-C", base.toString(), ".", + "--release", "9", "-C", v9.toString(), ".", + "--release", "10", "-C", v10.toString(), ".") + .shouldHaveExitValue(SUCCESS); checkMultiRelease(jarfile, true); - Map names = Map.of( - "version/Main.class", - new String[] {"classes", "base", "version", "Main.class"}, + Map names = Map.of( + "version/Main.class", + new String[]{"base", "version", "Main.class"}, - "version/Version.class", - new String[] {"classes", "base", "version", "Version.class"}, + "version/Version.class", + new String[]{"base", "version", "Version.class"}, "META-INF/versions/9/version/Version.class", new String[] {"v9", "version", "Version.class"}, @@ -109,144 +98,16 @@ public class Basic1 { compare(jarfile, names); } - @Test - public void testFail() throws IOException { + public void testFail() throws Throwable { String jarfile = "test.jar"; Path classes = Paths.get("classes"); - Path v10 = Paths.get("v10_1"); + Path base = classes.resolve("base"); + Path v10 = classes.resolve("v10_1"); - jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", - "--release", "10", "-C", v10.toString(), ".") - .assertFailure() - .outputContains("unexpected versioned entry META-INF/versions/"); - } - - - - private void checkMultiRelease(String jarFile, boolean expected) throws IOException { - try (JarFile jf = new JarFile(new File(jarFile), true, ZipFile.OPEN_READ, - JarFile.runtimeVersion())) { - assertEquals(jf.isMultiRelease(), expected); - } - } - - // compares the bytes found in the jar entries with the bytes found in the - // corresponding data files used to create the entries - private void compare(String jarfile, Map names) throws IOException { - try (JarFile jf = new JarFile(jarfile)) { - for (String name : names.keySet()) { - Path path = Paths.get("", names.get(name)); - byte[] b1 = Files.readAllBytes(path); - byte[] b2; - JarEntry je = jf.getJarEntry(name); - try (InputStream is = jf.getInputStream(je)) { - b2 = is.readAllBytes(); - } - assertEquals(b1,b2); - } - } - } - - /* - * The following methods were taken from modular jar and other jar tests - */ - - void javac(Path dest, Path... sourceFiles) throws IOException { - String javac = JDKToolFinder.getJDKTool("javac"); - - List commands = new ArrayList<>(); - commands.add(javac); - String opts = System.getProperty("test.compiler.opts"); - if (!opts.isEmpty()) { - commands.addAll(Arrays.asList(opts.split(" +"))); - } - commands.add("-d"); - commands.add(dest.toString()); - Stream.of(sourceFiles).map(Object::toString).forEach(x -> commands.add(x)); - - quickFail(run(new ProcessBuilder(commands))); - } - - Result jarWithStdin(File stdinSource, String... args) { - String jar = JDKToolFinder.getJDKTool("jar"); - List commands = new ArrayList<>(); - commands.add(jar); - commands.addAll(Utils.getForwardVmOptions()); - Stream.of(args).forEach(x -> commands.add(x)); - ProcessBuilder p = new ProcessBuilder(commands); - if (stdinSource != null) - p.redirectInput(stdinSource); - return run(p); - } - - Result jar(String... args) { - return jarWithStdin(null, args); - } - - void quickFail(Result r) { - if (r.ec != 0) - throw new RuntimeException(r.output); - } - - Result run(ProcessBuilder pb) { - Process p; - out.printf("Running: %s%n", pb.command()); - try { - p = pb.start(); - } catch (IOException e) { - throw new RuntimeException( - format("Couldn't start process '%s'", pb.command()), e); - } - - String output; - try { - output = toString(p.getInputStream(), p.getErrorStream()); - } catch (IOException e) { - throw new RuntimeException( - format("Couldn't read process output '%s'", pb.command()), e); - } - - try { - p.waitFor(); - } catch (InterruptedException e) { - throw new RuntimeException( - format("Process hasn't finished '%s'", pb.command()), e); - } - return new Result(p.exitValue(), output); - } - - String toString(InputStream in1, InputStream in2) throws IOException { - try (ByteArrayOutputStream dst = new ByteArrayOutputStream(); - InputStream concatenated = new SequenceInputStream(in1, in2)) { - concatenated.transferTo(dst); - return new String(dst.toByteArray(), "UTF-8"); - } - } - - static class Result { - final int ec; - final String output; - - private Result(int ec, String output) { - this.ec = ec; - this.output = output; - } - - boolean outputContains(String msg) { - return Arrays.stream(output.split("\\R")) - .collect(Collectors.joining(" ")) - .contains(msg); - } - - Result assertSuccess() { - assertTrue(ec == 0, format("ec: %d, output: %s", ec, output)); - return this; - } - Result assertFailure() { - assertTrue(ec != 0, format("ec: %d, output: %s", ec, output)); - return this; - } - Result resultChecker(Consumer r) { r.accept(this); return this; } + jar("cf", jarfile, "-C", base.toString(), ".", + "--release", "10", "-C", v10.toString(), ".") + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("unexpected versioned entry META-INF/versions/"); } } diff --git a/jdk/test/tools/jar/multiRelease/MRTestBase.java b/jdk/test/tools/jar/multiRelease/MRTestBase.java new file mode 100644 index 00000000000..248498e386c --- /dev/null +++ b/jdk/test/tools/jar/multiRelease/MRTestBase.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2017, 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 jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Utils; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +import java.io.*; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.stream.Stream; +import java.util.zip.ZipFile; + +import static org.testng.Assert.assertEquals; + +public class MRTestBase { + + public static final int SUCCESS = 0; + + protected final String src = System.getProperty("test.src", "."); + protected final String usr = System.getProperty("user.dir", "."); + + protected void compile(String test) throws Throwable { + Path classes = Paths.get(usr, "classes", "base"); + Files.createDirectories(classes); + Path source = Paths.get(src, "data", test, "base", "version"); + javac(classes, source.resolve("Main.java"), source.resolve("Version.java")); + + classes = Paths.get(usr, "classes", "v9"); + Files.createDirectories(classes); + source = Paths.get(src, "data", test, "v9", "version"); + javac(classes, source.resolve("Version.java")); + + classes = Paths.get(usr, "classes", "v10"); + Files.createDirectories(classes); + source = Paths.get(src, "data", test, "v10", "version"); + javac(classes, source.resolve("Version.java")); + } + + protected void checkMultiRelease(String jarFile, + boolean expected) throws IOException { + try (JarFile jf = new JarFile(new File(jarFile), true, + ZipFile.OPEN_READ, JarFile.runtimeVersion())) { + assertEquals(jf.isMultiRelease(), expected); + } + } + + // compares the bytes found in the jar entries with the bytes found in the + // corresponding data files used to create the entries + protected void compare(String jarfile, + Map names) throws IOException { + try (JarFile jf = new JarFile(jarfile)) { + for (String name : names.keySet()) { + Path path = Paths.get("classes", names.get(name)); + byte[] b1 = Files.readAllBytes(path); + byte[] b2; + JarEntry je = jf.getJarEntry(name); + try (InputStream is = jf.getInputStream(je)) { + b2 = is.readAllBytes(); + } + assertEquals(b1, b2); + } + } + } + + void javac(Path dest, Path... sourceFiles) throws Throwable { + String javac = JDKToolFinder.getJDKTool("javac"); + + List commands = new ArrayList<>(); + commands.add(javac); + String opts = System.getProperty("test.compiler.opts"); + if (!opts.isEmpty()) { + commands.addAll(Arrays.asList(opts.split(" +"))); + } + commands.addAll(Utils.getForwardVmOptions()); + commands.add("-d"); + commands.add(dest.toString()); + Stream.of(sourceFiles) + .map(Object::toString) + .forEach(x -> commands.add(x)); + + ProcessTools.executeCommand(new ProcessBuilder(commands)) + .shouldHaveExitValue(SUCCESS); + } + + OutputAnalyzer jarWithStdin(File stdinSource, + String... args) throws Throwable { + + String jar = JDKToolFinder.getJDKTool("jar"); + List commands = new ArrayList<>(); + commands.add(jar); + commands.addAll(Utils.getForwardVmOptions()); + Stream.of(args).forEach(x -> commands.add(x)); + ProcessBuilder p = new ProcessBuilder(commands); + if (stdinSource != null) + p.redirectInput(stdinSource); + return ProcessTools.executeCommand(p); + } + + OutputAnalyzer jar(String... args) throws Throwable { + return jarWithStdin(null, args); + } +} \ No newline at end of file diff --git a/jdk/test/tools/jar/multiRelease/data/test04/v9/version/Version.java b/jdk/test/tools/jar/multiRelease/data/test04/v9/version/Version.java index c4731163178..d4ea69b3b05 100644 --- a/jdk/test/tools/jar/multiRelease/data/test04/v9/version/Version.java +++ b/jdk/test/tools/jar/multiRelease/data/test04/v9/version/Version.java @@ -8,7 +8,7 @@ public class Version { protected void doNothing() { } - // extra publc method + // extra public method public void anyName() { } } From 7f74bcf6bcda9015acfb65856106706cb367c55f Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Wed, 18 Jan 2017 17:43:10 +0000 Subject: [PATCH 46/71] 8172982: tools/jlink/ResourceDuplicateCheckTest.java requires jdk.tools.jlink.plugin to be exported Reviewed-by: mchung, sundar --- jdk/test/tools/jlink/ResourceDuplicateCheckTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/test/tools/jlink/ResourceDuplicateCheckTest.java b/jdk/test/tools/jlink/ResourceDuplicateCheckTest.java index 3997ed18e83..25d4d83718a 100644 --- a/jdk/test/tools/jlink/ResourceDuplicateCheckTest.java +++ b/jdk/test/tools/jlink/ResourceDuplicateCheckTest.java @@ -27,6 +27,7 @@ * @summary Detect duplicated resources in packaged modules * @modules jdk.jlink/jdk.tools.jlink.builder * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin * @run build ResourceDuplicateCheckTest * @run main ResourceDuplicateCheckTest */ From ded129adbf0624f2535f256594f23262a7de2e7b Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Wed, 18 Jan 2017 11:08:46 -0800 Subject: [PATCH 47/71] 8172870: test/tools/jmod/JmodTest.java fails on windows with AccessDeniedException Reviewed-by: alanb, chegar --- jdk/test/tools/jmod/JmodTest.java | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/jdk/test/tools/jmod/JmodTest.java b/jdk/test/tools/jmod/JmodTest.java index f253b491af9..ccf333511cb 100644 --- a/jdk/test/tools/jmod/JmodTest.java +++ b/jdk/test/tools/jmod/JmodTest.java @@ -29,7 +29,7 @@ * @modules jdk.compiler * jdk.jlink * @build jdk.testlibrary.FileUtils CompilerUtils - * @run testng JmodTest + * @run testng/othervm -Djava.io.tmpdir=. JmodTest */ import java.io.*; @@ -40,8 +40,10 @@ import java.util.*; import java.util.function.Consumer; import java.util.regex.Pattern; import java.util.spi.ToolProvider; +import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.testlibrary.FileUtils; +import jdk.testlibrary.JDKToolFinder; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -593,9 +595,7 @@ public class JmodTest { findTmpFiles(filename).forEach(tmp -> { try { FileUtils.deleteFileIfExistsWithRetry(tmp); - } catch (IOException e) { - throw new UncheckedIOException(e); - } + } catch (IOException e) {} }); String cp = EXPLODED_DIR.resolve("foo").resolve("classes") + File.pathSeparator + @@ -608,17 +608,25 @@ public class JmodTest { .assertFailure() .resultChecker(r -> { assertContains(r.output, "unnamed package"); - Set tmpfiles = findTmpFiles(filename).collect(toSet()); + List tmpfiles = findTmpFiles(filename); assertTrue(tmpfiles.isEmpty(), "Unexpected tmp file:" + tmpfiles); }); } - private Stream findTmpFiles(String prefix) { - try { - Path tmpdir = Paths.get(System.getProperty("java.io.tmpdir")); - return Files.find(tmpdir, 1, (p, attrs) -> - p.getFileName().toString().startsWith(prefix) - && p.getFileName().toString().endsWith(".tmp")); + /* + * Returns the list of writeable tmp files with the given prefix. + * + * Ignore the non-writeable tmp files because this test is possibly + * running by another user. + */ + private List findTmpFiles(String prefix) { + Path tmpdir = Paths.get(System.getProperty("java.io.tmpdir")); + try (Stream stream = Files.list(tmpdir)) { + return stream.filter(p -> { + String fn = p.getFileName().toString(); + return Files.isWritable(p) + && fn.startsWith(prefix) && fn.endsWith(".tmp"); + }).collect(Collectors.toList()); } catch (IOException e) { throw new UncheckedIOException(e); } From 95a45889e9e52dfeed37689ca5bd06b6a81222aa Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Wed, 18 Jan 2017 11:18:13 -0800 Subject: [PATCH 48/71] 8172921: Zip filesystem performance improvement and code cleanup Reviewed-by: redestad --- .../classes/jdk/nio/zipfs/JarFileSystem.java | 6 +- .../share/classes/jdk/nio/zipfs/ZipCoder.java | 128 +++++++------ .../classes/jdk/nio/zipfs/ZipFileSystem.java | 174 ++++++------------ .../share/classes/jdk/nio/zipfs/ZipPath.java | 96 +++++----- jdk/test/jdk/nio/zipfs/PathOps.java | 33 +++- 5 files changed, 207 insertions(+), 230 deletions(-) diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java index 2826f96f4ff..4c0dcc97f7a 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java @@ -135,7 +135,7 @@ class JarFileSystem extends ZipFileSystem { TreeMap map = new TreeMap<>(); IndexNode child = metaInfVersions.child; while (child != null) { - Integer key = getVersion(child.name, metaInfVersions.name.length); + Integer key = getVersion(child.name, metaInfVersions.name.length + 1); if (key != null && key <= version) { map.put(key, child); } @@ -149,7 +149,7 @@ class JarFileSystem extends ZipFileSystem { */ private Integer getVersion(byte[] name, int offset) { try { - return Integer.parseInt(getString(Arrays.copyOfRange(name, offset, name.length-1))); + return Integer.parseInt(getString(Arrays.copyOfRange(name, offset, name.length))); } catch (NumberFormatException x) { // ignore this even though it might indicate issues with the JAR structure return null; @@ -176,7 +176,7 @@ class JarFileSystem extends ZipFileSystem { * returns foo/bar.class */ private byte[] getRootName(IndexNode prefix, IndexNode inode) { - int offset = prefix.name.length - 1; + int offset = prefix.name.length; byte[] fullName = inode.name; return Arrays.copyOfRange(fullName, offset, fullName.length); } diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java index 08f97cc61b1..77bfa5b81e0 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2017, 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 @@ -34,33 +34,64 @@ import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; import java.util.Arrays; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.nio.charset.StandardCharsets.ISO_8859_1; + /** * Utility class for zipfile name and comment decoding and encoding * * @author Xueming Shen */ -final class ZipCoder { +class ZipCoder { - String toString(byte[] ba, int length) { - CharsetDecoder cd = decoder().reset(); - int len = (int)(length * cd.maxCharsPerByte()); - char[] ca = new char[len]; - if (len == 0) - return new String(ca); - ByteBuffer bb = ByteBuffer.wrap(ba, 0, length); - CharBuffer cb = CharBuffer.wrap(ca); - CoderResult cr = cd.decode(bb, cb, true); - if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); - cr = cd.flush(cb); - if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); - return new String(ca, 0, cb.position()); + static class UTF8 extends ZipCoder { + UTF8() { + super(UTF_8); + } + + @Override + byte[] getBytes(String s) { // fast pass for ascii + for (int i = 0; i < s.length(); i++) { + if (s.charAt(i) > 0x7f) return super.getBytes(s); + } + return s.getBytes(ISO_8859_1); + } + + @Override + String toString(byte[] ba) { + for (byte b : ba) { + if (b < 0) return super.toString(ba); + } + return new String(ba, ISO_8859_1); + } + } + + private static ZipCoder utf8 = new UTF8(); + + public static ZipCoder get(String csn) { + Charset cs = Charset.forName(csn); + if (cs.name().equals("UTF-8")) { + return utf8; + } + return new ZipCoder(cs); } String toString(byte[] ba) { - return toString(ba, ba.length); + CharsetDecoder cd = decoder().reset(); + int clen = (int)(ba.length * cd.maxCharsPerByte()); + char[] ca = new char[clen]; + if (clen == 0) + return new String(ca); + ByteBuffer bb = ByteBuffer.wrap(ba, 0, ba.length); + CharBuffer cb = CharBuffer.wrap(ca); + CoderResult cr = cd.decode(bb, cb, true); + if (!cr.isUnderflow()) + throw new IllegalArgumentException(cr.toString()); + cr = cd.flush(cb); + if (!cr.isUnderflow()) + throw new IllegalArgumentException(cr.toString()); + return new String(ca, 0, cb.position()); } byte[] getBytes(String s) { @@ -69,62 +100,29 @@ final class ZipCoder { int len = (int)(ca.length * ce.maxBytesPerChar()); byte[] ba = new byte[len]; if (len == 0) - return ba; + return ba; ByteBuffer bb = ByteBuffer.wrap(ba); CharBuffer cb = CharBuffer.wrap(ca); CoderResult cr = ce.encode(cb, bb, true); if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); + throw new IllegalArgumentException(cr.toString()); cr = ce.flush(bb); if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); + throw new IllegalArgumentException(cr.toString()); if (bb.position() == ba.length) // defensive copy? - return ba; + return ba; else - return Arrays.copyOf(ba, bb.position()); - } - - // assume invoked only if "this" is not utf8 - byte[] getBytesUTF8(String s) { - if (isutf8) - return getBytes(s); - if (utf8 == null) - utf8 = new ZipCoder(Charset.forName("UTF-8")); - return utf8.getBytes(s); - } - - String toStringUTF8(byte[] ba, int len) { - if (isutf8) - return toString(ba, len); - if (utf8 == null) - utf8 = new ZipCoder(Charset.forName("UTF-8")); - return utf8.toString(ba, len); + return Arrays.copyOf(ba, bb.position()); } boolean isUTF8() { - return isutf8; + return cs == UTF_8; } private Charset cs; - private boolean isutf8; - private ZipCoder utf8; private ZipCoder(Charset cs) { this.cs = cs; - this.isutf8 = cs.name().equals("UTF-8"); - } - - static ZipCoder get(Charset charset) { - return new ZipCoder(charset); - } - - static ZipCoder get(String csn) { - try { - return new ZipCoder(Charset.forName(csn)); - } catch (Throwable t) { - t.printStackTrace(); - } - return new ZipCoder(Charset.defaultCharset()); } private final ThreadLocal decTL = new ThreadLocal<>(); @@ -133,10 +131,10 @@ final class ZipCoder { private CharsetDecoder decoder() { CharsetDecoder dec = decTL.get(); if (dec == null) { - dec = cs.newDecoder() - .onMalformedInput(CodingErrorAction.REPORT) - .onUnmappableCharacter(CodingErrorAction.REPORT); - decTL.set(dec); + dec = cs.newDecoder() + .onMalformedInput(CodingErrorAction.REPORT) + .onUnmappableCharacter(CodingErrorAction.REPORT); + decTL.set(dec); } return dec; } @@ -144,10 +142,10 @@ final class ZipCoder { private CharsetEncoder encoder() { CharsetEncoder enc = encTL.get(); if (enc == null) { - enc = cs.newEncoder() - .onMalformedInput(CodingErrorAction.REPORT) - .onUnmappableCharacter(CodingErrorAction.REPORT); - encTL.set(enc); + enc = cs.newEncoder() + .onMalformedInput(CodingErrorAction.REPORT) + .onUnmappableCharacter(CodingErrorAction.REPORT); + encTL.set(enc); } return enc; } diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java index 3d9f82ba77c..0aac8a3f14f 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2017, 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 @@ -314,8 +314,8 @@ class ZipFileSystem extends FileSystem { IndexNode inode = getInode(path); if (inode == null) return null; - e = new Entry(inode.name); // pseudo directory - e.method = METHOD_STORED; // STORED for dir + e = new Entry(inode.name, inode.isdir); // pseudo directory + e.method = METHOD_STORED; // STORED for dir e.mtime = e.atime = e.ctime = zfsDefaultTimeStamp; } } finally { @@ -400,7 +400,8 @@ class ZipFileSystem extends FileSystem { List list = new ArrayList<>(); IndexNode child = inode.child; while (child != null) { - ZipPath zp = new ZipPath(this, child.name); + // assume all path from zip file itself is "normalized" + ZipPath zp = new ZipPath(this, child.name, true); if (filter == null || filter.accept(zp)) list.add(zp); child = child.sibling; @@ -415,14 +416,14 @@ class ZipFileSystem extends FileSystem { throws IOException { checkWritable(); - dir = toDirectoryPath(dir); + // dir = toDirectoryPath(dir); beginWrite(); try { ensureOpen(); if (dir.length == 0 || exists(dir)) // root dir, or exiting dir throw new FileAlreadyExistsException(getString(dir)); checkParents(dir); - Entry e = new Entry(dir, Entry.NEW); + Entry e = new Entry(dir, Entry.NEW, true); e.method = METHOD_STORED; // STORED for dir update(e); } finally { @@ -463,7 +464,7 @@ class ZipFileSystem extends FileSystem { } else { checkParents(dst); } - Entry u = new Entry(eSrc, Entry.COPY); // copy eSrc entry + Entry u = new Entry(eSrc, Entry.COPY); // copy eSrc entry u.name(dst); // change name if (eSrc.type == Entry.NEW || eSrc.type == Entry.FILECH) { @@ -533,7 +534,7 @@ class ZipFileSystem extends FileSystem { if (!hasCreate && !hasCreateNew) throw new NoSuchFileException(getString(path)); checkParents(path); - return getOutputStream(new Entry(path, Entry.NEW)); + return getOutputStream(new Entry(path, Entry.NEW, false)); } } finally { endRead(); @@ -887,7 +888,7 @@ class ZipFileSystem extends FileSystem { int off = getParentOff(path); if (off <= 1) return ROOTPATH; - return Arrays.copyOf(path, off + 1); + return Arrays.copyOf(path, off); } private static int getParentOff(byte[] path) { @@ -1075,11 +1076,9 @@ class ZipFileSystem extends FileSystem { if (pos + CENHDR + nlen > limit) { zerror("invalid CEN header (bad header size)"); } - byte[] name = new byte[nlen + 1]; - System.arraycopy(cen, pos + CENHDR, name, 1, nlen); - name[0] = '/'; - IndexNode inode = new IndexNode(name, pos); + IndexNode inode = new IndexNode(cen, pos + CENHDR, nlen, pos); inodes.put(inode, inode); + // skip ext and comment pos += (CENHDR + nlen + elen + clen); } @@ -1112,7 +1111,7 @@ class ZipFileSystem extends FileSystem { private boolean hasUpdate = false; // shared key. consumer guarantees the "writeLock" before use it. - private final IndexNode LOOKUPKEY = IndexNode.keyOf(null); + private final IndexNode LOOKUPKEY = new IndexNode(null, -1); private void updateDelete(IndexNode inode) { beginWrite(); @@ -1312,16 +1311,7 @@ class ZipFileSystem extends FileSystem { IndexNode getInode(byte[] path) { if (path == null) throw new NullPointerException("path"); - IndexNode key = IndexNode.keyOf(path); - IndexNode inode = inodes.get(key); - if (inode == null && - (path.length == 0 || path[path.length -1] != '/')) { - // if does not ends with a slash - path = Arrays.copyOf(path, path.length + 1); - path[path.length - 1] = '/'; - inode = inodes.get(key.as(path)); - } - return inode; + return inodes.get(IndexNode.keyOf(path)); } Entry getEntry(byte[] path) throws IOException { @@ -1782,8 +1772,11 @@ class ZipFileSystem extends FileSystem { int hashcode; // node is hashable/hashed by its name int pos = -1; // position in cen table, -1 menas the // entry does not exists in zip file - IndexNode(byte[] name) { + boolean isdir; + + IndexNode(byte[] name, boolean isdir) { name(name); + this.isdir = isdir; this.pos = -1; } @@ -1792,8 +1785,28 @@ class ZipFileSystem extends FileSystem { this.pos = pos; } + // constructor for cenInit() + IndexNode(byte[] cen, int noff, int nlen, int pos) { + if (cen[noff + nlen - 1] == '/') { + isdir = true; + nlen--; + } + name = new byte[nlen + 1]; + System.arraycopy(cen, pos + CENHDR, name, 1, nlen); + name[0] = '/'; + name(name); + this.pos = pos; + } + + private static final ThreadLocal cachedKey = new ThreadLocal<>(); + final static IndexNode keyOf(byte[] name) { // get a lookup key; - return new IndexNode(name, -1); + IndexNode key = cachedKey.get(); + if (key == null) { + key = new IndexNode(name, -1); + cachedKey.set(key); + } + return key.as(name); } final void name(byte[] name) { @@ -1807,8 +1820,7 @@ class ZipFileSystem extends FileSystem { } boolean isDir() { - return name != null && - (name.length == 0 || name[name.length - 1] == '/'); + return isdir; } public boolean equals(Object other) { @@ -1865,8 +1877,9 @@ class ZipFileSystem extends FileSystem { Entry() {} - Entry(byte[] name) { + Entry(byte[] name, boolean isdir) { name(name); + this.isdir = isdir; this.mtime = this.ctime = this.atime = System.currentTimeMillis(); this.crc = 0; this.size = 0; @@ -1874,13 +1887,14 @@ class ZipFileSystem extends FileSystem { this.method = METHOD_DEFLATED; } - Entry(byte[] name, int type) { - this(name); + Entry(byte[] name, int type, boolean isdir) { + this(name, isdir); this.type = type; } Entry (Entry e, int type) { name(e.name); + this.isdir = e.isdir; this.version = e.version; this.ctime = e.ctime; this.atime = e.atime; @@ -1902,7 +1916,7 @@ class ZipFileSystem extends FileSystem { } Entry (byte[] name, Path file, int type) { - this(name, type); + this(name, type, false); this.file = file; this.method = METHOD_STORED; } @@ -1948,6 +1962,7 @@ class ZipFileSystem extends FileSystem { locoff = CENOFF(cen, pos); pos += CENHDR; this.name = inode.name; + this.isdir = inode.isdir; this.hashcode = inode.hashcode; pos += nlen; @@ -1974,9 +1989,10 @@ class ZipFileSystem extends FileSystem { int elenEXTT = 0; // extra for Extended Timestamp boolean foundExtraTime = false; // if time stamp NTFS, EXTT present - // confirm size/length + byte[] zname = isdir ? toDirectoryPath(name) : name; - int nlen = (name != null) ? name.length - 1 : 0; // name has [0] as "slash" + // confirm size/length + int nlen = (zname != null) ? zname.length - 1 : 0; // name has [0] as "slash" int elen = (extra != null) ? extra.length : 0; int eoff = 0; int clen = (comment != null) ? comment.length : 0; @@ -2037,7 +2053,7 @@ class ZipFileSystem extends FileSystem { writeShort(os, 0); // internal file attributes (unused) writeInt(os, 0); // external file attributes (unused) writeInt(os, locoff0); // relative offset of local header - writeBytes(os, name, 1, nlen); + writeBytes(os, zname, 1, nlen); if (elen64 != 0) { writeShort(os, EXTID_ZIP64);// Zip64 extra writeShort(os, elen64 - 4); // size of "this" extra block @@ -2075,87 +2091,13 @@ class ZipFileSystem extends FileSystem { } ///////////////////// LOC ////////////////////// - static Entry readLOC(ZipFileSystem zipfs, long pos) - throws IOException - { - return readLOC(zipfs, pos, new byte[1024]); - } - - static Entry readLOC(ZipFileSystem zipfs, long pos, byte[] buf) - throws IOException - { - return new Entry().loc(zipfs, pos, buf); - } - - Entry loc(ZipFileSystem zipfs, long pos, byte[] buf) - throws IOException - { - assert (buf.length >= LOCHDR); - if (zipfs.readFullyAt(buf, 0, LOCHDR , pos) != LOCHDR) - throw new ZipException("loc: reading failed"); - if (!locSigAt(buf, 0)) - throw new ZipException("loc: wrong sig ->" - + Long.toString(getSig(buf, 0), 16)); - //startPos = pos; - version = LOCVER(buf); - flag = LOCFLG(buf); - method = LOCHOW(buf); - mtime = dosToJavaTime(LOCTIM(buf)); - crc = LOCCRC(buf); - csize = LOCSIZ(buf); - size = LOCLEN(buf); - int nlen = LOCNAM(buf); - int elen = LOCEXT(buf); - - name = new byte[nlen + 1]; - name[0] = '/'; - if (zipfs.readFullyAt(name, 1, nlen, pos + LOCHDR) != nlen) { - throw new ZipException("loc: name reading failed"); - } - if (elen > 0) { - extra = new byte[elen]; - if (zipfs.readFullyAt(extra, 0, elen, pos + LOCHDR + nlen) - != elen) { - throw new ZipException("loc: ext reading failed"); - } - } - pos += (LOCHDR + nlen + elen); - if ((flag & FLAG_DATADESCR) != 0) { - // Data Descriptor - Entry e = zipfs.getEntry(name); // get the size/csize from cen - if (e == null) - throw new ZipException("loc: name not found in cen"); - size = e.size; - csize = e.csize; - pos += (method == METHOD_STORED ? size : csize); - if (size >= ZIP64_MINVAL || csize >= ZIP64_MINVAL) - pos += 24; - else - pos += 16; - } else { - if (extra != null && - (size == ZIP64_MINVAL || csize == ZIP64_MINVAL)) { - // zip64 ext: must include both size and csize - int off = 0; - while (off + 20 < elen) { // HeaderID+DataSize+Data - int sz = SH(extra, off + 2); - if (SH(extra, off) == EXTID_ZIP64 && sz == 16) { - size = LL(extra, off + 4); - csize = LL(extra, off + 12); - break; - } - off += (sz + 4); - } - } - pos += (method == METHOD_STORED ? size : csize); - } - return this; - } int writeLOC(OutputStream os) throws IOException { writeInt(os, LOCSIG); // LOC header signature int version = version(); - int nlen = (name != null) ? name.length - 1 : 0; // [0] is slash + + byte[] zname = isdir ? toDirectoryPath(name) : name; + int nlen = (zname != null) ? zname.length - 1 : 0; // [0] is slash int elen = (extra != null) ? extra.length : 0; boolean foundExtraTime = false; // if extra timestamp present int eoff = 0; @@ -2214,7 +2156,7 @@ class ZipFileSystem extends FileSystem { } writeShort(os, nlen); writeShort(os, elen + elen64 + elenNTFS + elenEXTT); - writeBytes(os, name, 1, nlen); + writeBytes(os, zname, 1, nlen); if (elen64 != 0) { writeShort(os, EXTID_ZIP64); writeShort(os, 16); @@ -2551,7 +2493,7 @@ class ZipFileSystem extends FileSystem { private void buildNodeTree() throws IOException { beginWrite(); try { - IndexNode root = new IndexNode(ROOTPATH); + IndexNode root = new IndexNode(ROOTPATH, true); IndexNode[] nodes = inodes.keySet().toArray(new IndexNode[0]); inodes.put(root, root); ParentLookup lookup = new ParentLookup(); @@ -2564,7 +2506,7 @@ class ZipFileSystem extends FileSystem { root.child = node; break; } - lookup = lookup.as(node.name, off + 1); + lookup = lookup.as(node.name, off); if (inodes.containsKey(lookup)) { parent = inodes.get(lookup); node.sibling = parent.child; @@ -2572,7 +2514,7 @@ class ZipFileSystem extends FileSystem { break; } // add new pseudo directory entry - parent = new IndexNode(Arrays.copyOf(node.name, off + 1)); + parent = new IndexNode(Arrays.copyOf(node.name, off), true); inodes.put(parent, parent); node.sibling = parent.child; parent.child = node; diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java index 120017d78e2..75a58bacd66 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2017, 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 @@ -59,8 +59,7 @@ final class ZipPath implements Path { } else { if (zfs.zc.isUTF8()) { this.path = normalize(path); - } else { - // see normalize(String); + } else { // see normalize(String); this.path = normalize(zfs.getString(path)); } } @@ -68,12 +67,7 @@ final class ZipPath implements Path { ZipPath(ZipFileSystem zfs, String path) { this.zfs = zfs; - if (zfs.zc.isUTF8()) { - this.path = normalize(zfs.getBytes(path)); - } else { - // see normalize(String); - this.path = normalize(path); - } + this.path = normalize(path); } @Override @@ -84,33 +78,31 @@ final class ZipPath implements Path { return null; } - @Override + @Override public Path getFileName() { - initOffsets(); - int count = offsets.length; - if (count == 0) - return null; // no elements so no name - if (count == 1 && path[0] != '/') + int off = path.length; + if (off == 0 || off == 1 && path[0] == '/') + return null; + while (--off >= 0 && path[off] != '/') {} + if (off < 0) return this; - int lastOffset = offsets[count-1]; - int len = path.length - lastOffset; - byte[] result = new byte[len]; - System.arraycopy(path, lastOffset, result, 0, len); - return new ZipPath(zfs, result); + off++; + byte[] result = new byte[path.length - off]; + System.arraycopy(path, off, result, 0, result.length); + return new ZipPath(getFileSystem(), result, true); } @Override public ZipPath getParent() { - initOffsets(); - int count = offsets.length; - if (count == 0) // no elements so no parent + int off = path.length; + if (off == 0 || off == 1 && path[0] == '/') return null; - int len = offsets[count-1] - 1; - if (len <= 0) // parent is root only (may be null) + while (--off >= 0 && path[off] != '/') {} + if (off <= 0) return getRoot(); - byte[] result = new byte[len]; - System.arraycopy(path, 0, result, 0, len); - return new ZipPath(zfs, result); + byte[] result = new byte[off]; + System.arraycopy(path, 0, result, 0, off); + return new ZipPath(getFileSystem(), result, true); } @Override @@ -277,30 +269,36 @@ final class ZipPath implements Path { @Override public boolean isAbsolute() { - return (this.path.length > 0 && path[0] == '/'); + return path.length > 0 && path[0] == '/'; } @Override public ZipPath resolve(Path other) { - final ZipPath o = checkPath(other); - int tlen = this.path.length; - if (tlen == 0 || o.isAbsolute()) - return o; - int olen = o.path.length; - if (olen == 0) + ZipPath o = checkPath(other); + if (o.path.length == 0) return this; + if (o.isAbsolute() || this.path.length == 0) + return o; + return resolve(o.path); + } + + // opath is normalized, just concat + private ZipPath resolve(byte[] opath) { byte[] resolved = null; - if (this.path[tlen - 1] == '/') { + byte[] tpath = this.path; + int tlen = tpath.length; + int olen = opath.length; + if (path[tlen - 1] == '/') { resolved = new byte[tlen + olen]; - System.arraycopy(path, 0, resolved, 0, tlen); - System.arraycopy(o.path, 0, resolved, tlen, olen); + System.arraycopy(tpath, 0, resolved, 0, tlen); + System.arraycopy(opath, 0, resolved, tlen, olen); } else { resolved = new byte[tlen + 1 + olen]; - System.arraycopy(path, 0, resolved, 0, tlen); + System.arraycopy(tpath, 0, resolved, 0, tlen); resolved[tlen] = '/'; - System.arraycopy(o.path, 0, resolved, tlen + 1, olen); + System.arraycopy(opath, 0, resolved, tlen + 1, olen); } - return new ZipPath(zfs, resolved); + return new ZipPath(zfs, resolved, true); } @Override @@ -351,7 +349,12 @@ final class ZipPath implements Path { @Override public ZipPath resolve(String other) { - return resolve(zfs.getPath(other)); + byte[] opath = normalize(other); + if (opath.length == 0) + return this; + if (opath[0] == '/' || this.path.length == 0) + return new ZipPath(zfs, opath, true); + return resolve(opath); } @Override @@ -455,8 +458,9 @@ final class ZipPath implements Path { return normalize(path, i - 1); prevC = c; } - if (len > 1 && prevC == '/') + if (len > 1 && prevC == '/') { return Arrays.copyOf(path, len - 1); + } return path; } @@ -490,6 +494,8 @@ final class ZipPath implements Path { // to avoid incorrectly normalizing byte '0x5c' (as '\') // to '/'. private byte[] normalize(String path) { + if (zfs.zc.isUTF8()) + return normalize(zfs.getBytes(path)); int len = path.length(); if (len == 0) return new byte[0]; @@ -533,7 +539,8 @@ final class ZipPath implements Path { // Remove DotSlash(./) and resolve DotDot (..) components private byte[] getResolved() { for (int i = 0; i < path.length; i++) { - if (path[i] == (byte)'.') { + if (path[i] == (byte)'.' && + (i + 1 == path.length || path[i + 1] == '/')) { return resolve0(); } } @@ -976,5 +983,4 @@ final class ZipPath implements Path { } return sb.toString(); } - } diff --git a/jdk/test/jdk/nio/zipfs/PathOps.java b/jdk/test/jdk/nio/zipfs/PathOps.java index 1bd72f7bf9c..271aa97e383 100644 --- a/jdk/test/jdk/nio/zipfs/PathOps.java +++ b/jdk/test/jdk/nio/zipfs/PathOps.java @@ -31,7 +31,7 @@ import java.nio.file.Path; /** * * @test - * @bug 8038500 8040059 8139956 8146754 + * @bug 8038500 8040059 8139956 8146754 8172921 * @summary Tests path operations for zip provider. * * @run main PathOps @@ -180,6 +180,13 @@ public class PathOps { return this; } + PathOps resolvePath(String other, String expected) { + out.format("test resolve %s\n", other); + checkPath(); + check(path.resolve(fs.getPath(other)), expected); + return this; + } + PathOps resolveSibling(String other, String expected) { out.format("test resolveSibling %s\n", other); checkPath(); @@ -384,6 +391,30 @@ public class PathOps { .resolve("", "") .resolve("foo", "foo") .resolve("/foo", "/foo"); + test("/") + .resolve("", "/") + .resolve("foo", "/foo") + .resolve("/foo", "/foo") + .resolve("/foo/", "/foo"); + + // resolve(Path) + test("/tmp") + .resolvePath("foo", "/tmp/foo") + .resolvePath("/foo", "/foo") + .resolvePath("", "/tmp"); + test("tmp") + .resolvePath("foo", "tmp/foo") + .resolvePath("/foo", "/foo") + .resolvePath("", "tmp"); + test("") + .resolvePath("", "") + .resolvePath("foo", "foo") + .resolvePath("/foo", "/foo"); + test("/") + .resolvePath("", "/") + .resolvePath("foo", "/foo") + .resolvePath("/foo", "/foo") + .resolvePath("/foo/", "/foo"); // resolveSibling test("foo") From ced9c19693461e2b0312432e445cea26dec637d6 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Thu, 19 Jan 2017 13:37:05 +0100 Subject: [PATCH 49/71] 8172905: Minor startup cleanup of CallSite and MethodType Reviewed-by: psandoz, jrose --- .../classes/java/lang/invoke/CallSite.java | 55 +++++++++++++------ .../classes/java/lang/invoke/MethodType.java | 4 +- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java index c24f94951f0..53899611f59 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java @@ -28,6 +28,8 @@ package java.lang.invoke; import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; +import jdk.internal.vm.annotation.Stable; + /** * A {@code CallSite} is a holder for a variable {@link MethodHandle}, * which is called its {@code target}. @@ -215,19 +217,36 @@ public class CallSite { public abstract MethodHandle dynamicInvoker(); /*non-public*/ MethodHandle makeDynamicInvoker() { - MethodHandle getTarget = GET_TARGET.bindArgumentL(0, this); + MethodHandle getTarget = getTargetHandle().bindArgumentL(0, this); MethodHandle invoker = MethodHandles.exactInvoker(this.type()); return MethodHandles.foldArguments(invoker, getTarget); } - private static final MethodHandle GET_TARGET; - private static final MethodHandle THROW_UCS; - static { + private static @Stable MethodHandle GET_TARGET; + private static MethodHandle getTargetHandle() { + MethodHandle handle = GET_TARGET; + if (handle != null) { + return handle; + } try { - GET_TARGET = IMPL_LOOKUP. - findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class)); - THROW_UCS = IMPL_LOOKUP. - findStatic(CallSite.class, "uninitializedCallSite", MethodType.methodType(Object.class, Object[].class)); + return GET_TARGET = IMPL_LOOKUP. + findVirtual(CallSite.class, "getTarget", + MethodType.methodType(MethodHandle.class)); + } catch (ReflectiveOperationException e) { + throw newInternalError(e); + } + } + + private static @Stable MethodHandle THROW_UCS; + private static MethodHandle uninitializedCallSiteHandle() { + MethodHandle handle = THROW_UCS; + if (handle != null) { + return handle; + } + try { + return THROW_UCS = IMPL_LOOKUP. + findStatic(CallSite.class, "uninitializedCallSite", + MethodType.methodType(Object.class, Object[].class)); } catch (ReflectiveOperationException e) { throw newInternalError(e); } @@ -242,7 +261,7 @@ public class CallSite { MethodType basicType = targetType.basicType(); MethodHandle invoker = basicType.form().cachedMethodHandle(MethodTypeForm.MH_UNINIT_CS); if (invoker == null) { - invoker = THROW_UCS.asType(basicType); + invoker = uninitializedCallSiteHandle().asType(basicType); invoker = basicType.form().setCachedMethodHandle(MethodTypeForm.MH_UNINIT_CS, invoker); } // unchecked view is OK since no values will be received or returned @@ -250,12 +269,16 @@ public class CallSite { } // unsafe stuff: - private static final long TARGET_OFFSET; - private static final long CONTEXT_OFFSET; - static { + private static @Stable long TARGET_OFFSET; + private static long getTargetOffset() { + long offset = TARGET_OFFSET; + if (offset > 0) { + return offset; + } try { - TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target")); - CONTEXT_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("context")); + offset = TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target")); + assert(offset > 0); + return offset; } catch (Exception ex) { throw newInternalError(ex); } } @@ -265,7 +288,7 @@ public class CallSite { } /*package-private*/ MethodHandle getTargetVolatile() { - return (MethodHandle) UNSAFE.getObjectVolatile(this, TARGET_OFFSET); + return (MethodHandle) UNSAFE.getObjectVolatile(this, getTargetOffset()); } /*package-private*/ void setTargetVolatile(MethodHandle newTarget) { @@ -324,7 +347,7 @@ public class CallSite { final int NON_SPREAD_ARG_COUNT = 3; // (caller, name, type) if (NON_SPREAD_ARG_COUNT + argv.length > MethodType.MAX_MH_ARITY) throw new BootstrapMethodError("too many bootstrap method arguments"); - MethodType bsmType = bootstrapMethod.type(); + MethodType invocationType = MethodType.genericMethodType(NON_SPREAD_ARG_COUNT + argv.length); MethodHandle typedBSM = bootstrapMethod.asType(invocationType); MethodHandle spreader = invocationType.invokers().spreadInvoker(NON_SPREAD_ARG_COUNT); diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java index ffb8a6a7859..53e88de34f2 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java @@ -1128,7 +1128,7 @@ class MethodType implements java.io.Serializable { public String toMethodDescriptorString() { String desc = methodDescriptor; if (desc == null) { - desc = BytecodeDescriptor.unparse(this); + desc = BytecodeDescriptor.unparseMethod(this.rtype, this.ptypes); methodDescriptor = desc; } return desc; @@ -1256,7 +1256,7 @@ s.writeObject(this.parameterArray()); private final ReferenceQueue stale; public ConcurrentWeakInternSet() { - this.map = new ConcurrentHashMap<>(); + this.map = new ConcurrentHashMap<>(512); this.stale = new ReferenceQueue<>(); } From 8f93cf0a46e0256c22f84f398cdff53d7679dfad Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Thu, 19 Jan 2017 12:06:58 -0500 Subject: [PATCH 50/71] 8172350: Typo in Timestamp.toString() Reviewed-by: dfuchs --- jdk/src/java.sql/share/classes/java/sql/Timestamp.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.sql/share/classes/java/sql/Timestamp.java b/jdk/src/java.sql/share/classes/java/sql/Timestamp.java index 9192ed7df1b..8421f955db6 100644 --- a/jdk/src/java.sql/share/classes/java/sql/Timestamp.java +++ b/jdk/src/java.sql/share/classes/java/sql/Timestamp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -259,7 +259,7 @@ public class Timestamp extends java.util.Date { /** * Formats a timestamp in JDBC timestamp escape format. * {@code yyyy-mm-dd hh:mm:ss.fffffffff}, - * where {@code ffffffffff} indicates nanoseconds. + * where {@code fffffffff} indicates nanoseconds. * * @return a {@code String} object in * {@code yyyy-mm-dd hh:mm:ss.fffffffff} format From 6b84b1d30ab89b7af907f202ad82cce0669370f4 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Thu, 19 Jan 2017 09:27:24 -0800 Subject: [PATCH 51/71] 8160710: Enable Thread to grant VarHandle field access to ThreadLocalRandom/Striped64 Reviewed-by: martin, dl, chegar --- .../java/lang/invoke/MethodHandles.java | 9 +- .../util/concurrent/ForkJoinWorkerThread.java | 10 +- .../util/concurrent/ThreadLocalRandom.java | 111 ++++++++---------- .../util/concurrent/atomic/Striped64.java | 29 +++-- .../util/concurrent/locks/LockSupport.java | 42 ++++--- 5 files changed, 107 insertions(+), 94 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index d195d3d3db8..16a9e8a941d 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, 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 @@ -846,8 +846,11 @@ public class MethodHandles { // that does not bluntly restrict classes under packages within // java.base from looking up MethodHandles or VarHandles. if (allowedModes == ALL_MODES && lookupClass.getClassLoader() == null) { - if ((name.startsWith("java.") && !name.startsWith("java.util.concurrent.")) || - (name.startsWith("sun.") && !name.startsWith("sun.invoke."))) { + if ((name.startsWith("java.") && + !name.equals("java.lang.Thread") && + !name.startsWith("java.util.concurrent.")) || + (name.startsWith("sun.") && + !name.startsWith("sun.invoke."))) { throw newIllegalArgumentException("illegal lookupClass: " + lookupClass); } } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java index 5e56fe1b05e..93bb08dd48f 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java @@ -185,7 +185,14 @@ public class ForkJoinWorkerThread extends Thread { static final class InnocuousForkJoinWorkerThread extends ForkJoinWorkerThread { /** The ThreadGroup for all InnocuousForkJoinWorkerThreads */ private static final ThreadGroup innocuousThreadGroup = - ThreadLocalRandom.createThreadGroup("InnocuousForkJoinWorkerThreadGroup"); + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction<>() { + public ThreadGroup run() { + ThreadGroup group = Thread.currentThread().getThreadGroup(); + for (ThreadGroup p; (p = group.getParent()) != null; ) + group = p; + return new ThreadGroup(group, "InnocuousForkJoinWorkerThreadGroup"); + }}); /** An AccessControlContext supporting no privileges */ private static final AccessControlContext INNOCUOUS_ACC = @@ -215,6 +222,5 @@ public class ForkJoinWorkerThread extends Thread { public void setContextClassLoader(ClassLoader cl) { throw new SecurityException("setContextClassLoader"); } - } } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java index cb1b4f260f5..e42d041a033 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java @@ -36,6 +36,8 @@ package java.util.concurrent; import java.io.ObjectStreamField; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; import java.security.AccessControlContext; import java.util.Random; import java.util.Spliterator; @@ -48,7 +50,6 @@ import java.util.stream.DoubleStream; import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.StreamSupport; -import jdk.internal.misc.Unsafe; /** * A random number generator isolated to the current thread. Like the @@ -108,7 +109,7 @@ public class ThreadLocalRandom extends Random { * though, we use only a single 64bit gamma. * * Because this class is in a different package than class Thread, - * field access methods use Unsafe to bypass access control rules. + * field access methods use VarHandles to bypass access control rules. * To conform to the requirements of the Random superclass * constructor, the common static ThreadLocalRandom maintains an * "initialized" field for the sake of rejecting user calls to @@ -163,8 +164,8 @@ public class ThreadLocalRandom extends Random { int probe = (p == 0) ? 1 : p; // skip 0 long seed = mix64(seeder.getAndAdd(SEEDER_INCREMENT)); Thread t = Thread.currentThread(); - U.putLong(t, SEED, seed); - U.putInt(t, PROBE, probe); + SEED.set(t, seed); + PROBE.set(t, probe); } /** @@ -173,7 +174,7 @@ public class ThreadLocalRandom extends Random { * @return the current thread's {@code ThreadLocalRandom} */ public static ThreadLocalRandom current() { - if (U.getInt(Thread.currentThread(), PROBE) == 0) + if ((int) PROBE.get(Thread.currentThread()) == 0) localInit(); return instance; } @@ -192,8 +193,8 @@ public class ThreadLocalRandom extends Random { final long nextSeed() { Thread t; long r; // read and update per-thread seed - U.putLong(t = Thread.currentThread(), SEED, - r = U.getLong(t, SEED) + GAMMA); + SEED.set(t = Thread.currentThread(), + (r = (long) SEED.get(t)) + GAMMA); return r; } @@ -938,7 +939,7 @@ public class ThreadLocalRandom extends Random { * can be used to force initialization on zero return. */ static final int getProbe() { - return U.getInt(Thread.currentThread(), PROBE); + return (int) PROBE.get(Thread.currentThread()); } /** @@ -949,7 +950,7 @@ public class ThreadLocalRandom extends Random { probe ^= probe << 13; // xorshift probe ^= probe >>> 17; probe ^= probe << 5; - U.putInt(Thread.currentThread(), PROBE, probe); + PROBE.set(Thread.currentThread(), probe); return probe; } @@ -959,14 +960,14 @@ public class ThreadLocalRandom extends Random { static final int nextSecondarySeed() { int r; Thread t = Thread.currentThread(); - if ((r = U.getInt(t, SECONDARY)) != 0) { + if ((r = (int) SECONDARY.get(t)) != 0) { r ^= r << 13; // xorshift r ^= r >>> 17; r ^= r << 5; } else if ((r = mix32(seeder.getAndAdd(SEEDER_INCREMENT))) == 0) r = 1; // avoid zero - U.putInt(t, SECONDARY, r); + SECONDARY.set(t, r); return r; } @@ -976,41 +977,13 @@ public class ThreadLocalRandom extends Random { * Erases ThreadLocals by nulling out Thread maps. */ static final void eraseThreadLocals(Thread thread) { - U.putObject(thread, THREADLOCALS, null); - U.putObject(thread, INHERITABLETHREADLOCALS, null); + THREADLOCALS.set(thread, null); + INHERITABLETHREADLOCALS.set(thread, null); } static final void setInheritedAccessControlContext(Thread thread, AccessControlContext acc) { - U.putObjectRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc); - } - - /** - * Returns a new group with the system ThreadGroup (the - * topmost, parent-less group) as parent. Uses Unsafe to - * traverse Thread.group and ThreadGroup.parent fields. - */ - static final ThreadGroup createThreadGroup(String name) { - if (name == null) - throw new NullPointerException(); - try { - long tg = U.objectFieldOffset - (Thread.class.getDeclaredField("group")); - long gp = U.objectFieldOffset - (ThreadGroup.class.getDeclaredField("parent")); - ThreadGroup group = (ThreadGroup) - U.getObject(Thread.currentThread(), tg); - while (group != null) { - ThreadGroup parent = (ThreadGroup)U.getObject(group, gp); - if (parent == null) - return new ThreadGroup(group, name); - group = parent; - } - } catch (ReflectiveOperationException e) { - throw new Error(e); - } - // fall through if null as cannot-happen safeguard - throw new Error("Cannot create ThreadGroup"); + INHERITEDACCESSCONTROLCONTEXT.setRelease(thread, acc); } // Serialization support @@ -1037,7 +1010,7 @@ public class ThreadLocalRandom extends Random { throws java.io.IOException { java.io.ObjectOutputStream.PutField fields = s.putFields(); - fields.put("rnd", U.getLong(Thread.currentThread(), SEED)); + fields.put("rnd", (long) SEED.get(Thread.currentThread())); fields.put("initialized", true); s.writeFields(); } @@ -1076,28 +1049,38 @@ public class ThreadLocalRandom extends Random { static final String BAD_RANGE = "bound must be greater than origin"; static final String BAD_SIZE = "size must be non-negative"; - // Unsafe mechanics - private static final Unsafe U = Unsafe.getUnsafe(); - private static final long SEED; - private static final long PROBE; - private static final long SECONDARY; - private static final long THREADLOCALS; - private static final long INHERITABLETHREADLOCALS; - private static final long INHERITEDACCESSCONTROLCONTEXT; + // VarHandle mechanics + private static final VarHandle SEED; + private static final VarHandle PROBE; + private static final VarHandle SECONDARY; + private static final VarHandle THREADLOCALS; + private static final VarHandle INHERITABLETHREADLOCALS; + private static final VarHandle INHERITEDACCESSCONTROLCONTEXT; static { try { - SEED = U.objectFieldOffset - (Thread.class.getDeclaredField("threadLocalRandomSeed")); - PROBE = U.objectFieldOffset - (Thread.class.getDeclaredField("threadLocalRandomProbe")); - SECONDARY = U.objectFieldOffset - (Thread.class.getDeclaredField("threadLocalRandomSecondarySeed")); - THREADLOCALS = U.objectFieldOffset - (Thread.class.getDeclaredField("threadLocals")); - INHERITABLETHREADLOCALS = U.objectFieldOffset - (Thread.class.getDeclaredField("inheritableThreadLocals")); - INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset - (Thread.class.getDeclaredField("inheritedAccessControlContext")); + MethodHandles.Lookup l = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction<>() { + public MethodHandles.Lookup run() { + try { + return MethodHandles.privateLookupIn(Thread.class, + MethodHandles.lookup()); + } catch (ReflectiveOperationException e) { + throw new Error(e); + } + }}); + SEED = l.findVarHandle(Thread.class, + "threadLocalRandomSeed", long.class); + PROBE = l.findVarHandle(Thread.class, + "threadLocalRandomProbe", int.class); + SECONDARY = l.findVarHandle(Thread.class, + "threadLocalRandomSecondarySeed", int.class); + Class tlm = Class.forName("java.lang.ThreadLocal$ThreadLocalMap"); + THREADLOCALS = l.findVarHandle(Thread.class, + "threadLocals", tlm); + INHERITABLETHREADLOCALS = l.findVarHandle(Thread.class, + "inheritableThreadLocals", tlm); + INHERITEDACCESSCONTROLCONTEXT = l.findVarHandle(Thread.class, + "inheritedAccessControlContext", AccessControlContext.class); } catch (ReflectiveOperationException e) { throw new Error(e); } @@ -1123,7 +1106,7 @@ public class ThreadLocalRandom extends Random { // at end of to survive static initialization circularity static { if (java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction<>() { public Boolean run() { return Boolean.getBoolean("java.util.secureRandomSeed"); }})) { diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/Striped64.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/Striped64.java index a70094e3623..95030782a71 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/Striped64.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/Striped64.java @@ -41,7 +41,6 @@ import java.util.Arrays; import java.util.concurrent.ThreadLocalRandom; import java.util.function.DoubleBinaryOperator; import java.util.function.LongBinaryOperator; -import jdk.internal.misc.Unsafe; /** * A package-local class holding common representation and mechanics @@ -191,7 +190,7 @@ abstract class Striped64 extends Number { * Duplicated from ThreadLocalRandom because of packaging restrictions. */ static final int getProbe() { - return U.getInt(Thread.currentThread(), PROBE); + return (int) THREAD_PROBE.get(Thread.currentThread()); } /** @@ -203,7 +202,7 @@ abstract class Striped64 extends Number { probe ^= probe << 13; // xorshift probe ^= probe >>> 17; probe ^= probe << 5; - U.putInt(Thread.currentThread(), PROBE, probe); + THREAD_PROBE.set(Thread.currentThread(), probe); return probe; } @@ -373,18 +372,28 @@ abstract class Striped64 extends Number { } } - // Unsafe and VarHandle mechanics - private static final Unsafe U = Unsafe.getUnsafe(); + // VarHandle mechanics private static final VarHandle BASE; private static final VarHandle CELLSBUSY; - private static final long PROBE; + private static final VarHandle THREAD_PROBE; static { try { MethodHandles.Lookup l = MethodHandles.lookup(); - BASE = l.findVarHandle(Striped64.class, "base", long.class); - CELLSBUSY = l.findVarHandle(Striped64.class, "cellsBusy", int.class); - PROBE = U.objectFieldOffset - (Thread.class.getDeclaredField("threadLocalRandomProbe")); + BASE = l.findVarHandle(Striped64.class, + "base", long.class); + CELLSBUSY = l.findVarHandle(Striped64.class, + "cellsBusy", int.class); + l = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction<>() { + public MethodHandles.Lookup run() { + try { + return MethodHandles.privateLookupIn(Thread.class, MethodHandles.lookup()); + } catch (ReflectiveOperationException e) { + throw new Error(e); + } + }}); + THREAD_PROBE = l.findVarHandle(Thread.class, + "threadLocalRandomProbe", int.class); } catch (ReflectiveOperationException e) { throw new Error(e); } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java b/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java index 7bf6e8a54cd..772318496f7 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java @@ -37,6 +37,9 @@ package java.util.concurrent.locks; import jdk.internal.misc.Unsafe; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + /** * Basic thread blocking primitives for creating locks and other * synchronization classes. @@ -139,7 +142,7 @@ public class LockSupport { private static void setBlocker(Thread t, Object arg) { // Even though volatile, hotspot doesn't need a write barrier here. - U.putObject(t, PARKBLOCKER, arg); + THREAD_PARKBLOCKER.set(t, arg); } /** @@ -289,7 +292,7 @@ public class LockSupport { public static Object getBlocker(Thread t) { if (t == null) throw new NullPointerException(); - return U.getObjectVolatile(t, PARKBLOCKER); + return THREAD_PARKBLOCKER.getVolatile(t); } /** @@ -396,14 +399,14 @@ public class LockSupport { static final int nextSecondarySeed() { int r; Thread t = Thread.currentThread(); - if ((r = U.getInt(t, SECONDARY)) != 0) { + if ((r = (int) THREAD_SECONDARY.get(t)) != 0) { r ^= r << 13; // xorshift r ^= r >>> 17; r ^= r << 5; } else if ((r = java.util.concurrent.ThreadLocalRandom.current().nextInt()) == 0) r = 1; // avoid zero - U.putInt(t, SECONDARY, r); + THREAD_SECONDARY.set(t, r); return r; } @@ -414,23 +417,32 @@ public class LockSupport { * ways that do not preserve unique mappings. */ static final long getThreadId(Thread thread) { - return U.getLongVolatile(thread, TID); + return (long) THREAD_TID.getVolatile(thread); } // Hotspot implementation via intrinsics API private static final Unsafe U = Unsafe.getUnsafe(); - private static final long PARKBLOCKER; - private static final long SECONDARY; - private static final long TID; + // VarHandle mechanics + private static final VarHandle THREAD_PARKBLOCKER; + private static final VarHandle THREAD_SECONDARY; + private static final VarHandle THREAD_TID; static { try { - PARKBLOCKER = U.objectFieldOffset - (Thread.class.getDeclaredField("parkBlocker")); - SECONDARY = U.objectFieldOffset - (Thread.class.getDeclaredField("threadLocalRandomSecondarySeed")); - TID = U.objectFieldOffset - (Thread.class.getDeclaredField("tid")); - + MethodHandles.Lookup l = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction<>() { + public MethodHandles.Lookup run() { + try { + return MethodHandles.privateLookupIn(Thread.class, MethodHandles.lookup()); + } catch (ReflectiveOperationException e) { + throw new Error(e); + } + }}); + THREAD_PARKBLOCKER = l.findVarHandle(Thread.class, + "parkBlocker", Object.class); + THREAD_SECONDARY = l.findVarHandle(Thread.class, + "threadLocalRandomSecondarySeed", int.class); + THREAD_TID = l.findVarHandle(Thread.class, + "tid", long.class); } catch (ReflectiveOperationException e) { throw new Error(e); } From 69369c305a2996b1bfd8d11cb0bab78bb25e74b1 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 19 Jan 2017 18:03:24 +0000 Subject: [PATCH 52/71] 8173066: More verbose debug output for selection of X509 certs Reviewed-by: coffeys --- .../classes/sun/security/ssl/X509KeyManagerImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java b/jdk/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java index 256720a7b93..b6ed37cc5a3 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, 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 @@ -818,6 +818,11 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager checker.init(false); } catch (CertPathValidatorException cpve) { // unlikely to happen + if (useDebug) { + debug.println( + "Cannot initialize algorithm constraints checker: " + cpve); + } + return false; } @@ -828,6 +833,11 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager // We don't care about the unresolved critical extensions. checker.check(cert, Collections.emptySet()); } catch (CertPathValidatorException cpve) { + if (useDebug) { + debug.println("Certificate (" + cert + + ") does not conform to algorithm constraints: " + cpve); + } + return false; } } From d9d9d8701a2089cf744ccd9e0c9afb7ab10efd3f Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Thu, 19 Jan 2017 13:50:02 -0500 Subject: [PATCH 53/71] 8055206: Update SecurityManager::checkPackageAccess to restrict non-exported JDK packages by default Reviewed-by: mchung --- .../classes/java/lang/SecurityManager.java | 196 +++++++++++++----- .../share/classes/java/lang/System.java | 15 +- .../java.base/share/classes/module-info.java | 1 - .../share/conf/security/java.security | 111 ++-------- .../share/lib/security/default.policy | 17 ++ .../com/sun/rowset/CachedRowSetImpl.java | 17 +- .../Cipher/AES/TestAESCiphers/testAES.policy | 6 +- .../LdapLoginModule/CheckConfigs.policy | 4 +- .../SecurityManager/CheckPackageAccess.java | 187 ++++++++++++----- .../SecurityManager/CheckPackageMatching.java | 51 +++-- .../SecurityManager/RestrictedPackages.java | 155 -------------- .../lambda/LogGeneratedClassesTest.java | 9 +- .../java/security/KeyRep/SerialOld.policy | 4 +- .../8146975/jtreg.test.policy | 29 +-- .../PortableRemoteObject/jtreg.test.policy | 23 +- 15 files changed, 377 insertions(+), 448 deletions(-) delete mode 100644 jdk/test/java/lang/SecurityManager/RestrictedPackages.java diff --git a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java index f004feea821..8a819ee6db7 100644 --- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java +++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,18 +25,30 @@ package java.lang; -import java.security.*; +import java.lang.RuntimePermission; +import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleDescriptor.Exports; +import java.lang.module.ModuleDescriptor.Opens; +import java.lang.reflect.Layer; +import java.lang.reflect.Member; +import java.lang.reflect.Module; import java.io.FileDescriptor; import java.io.File; import java.io.FilePermission; -import java.util.PropertyPermission; -import java.lang.RuntimePermission; -import java.net.SocketPermission; -import java.net.NetPermission; -import java.util.Hashtable; import java.net.InetAddress; -import java.lang.reflect.*; -import java.net.URL; +import java.net.SocketPermission; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.security.Permission; +import java.security.PrivilegedAction; +import java.security.Security; +import java.security.SecurityPermission; +import java.util.HashSet; +import java.util.Objects; +import java.util.PropertyPermission; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; import jdk.internal.reflect.CallerSensitive; import sun.security.util.SecurityConstants; @@ -1415,46 +1427,108 @@ class SecurityManager { } } - if (packages == null) + if (packages == null) { packages = new String[0]; + } return packages; } + // The non-exported packages of the modules in the boot layer that are + // loaded by the platform class loader or its ancestors. A non-exported + // package is a package that either is not exported at all by its containing + // module or is exported in a qualified fashion by its containing module. + private static final Set nonExportedPkgs; + + static { + // Get the modules in the boot layer + Stream bootLayerModules = Layer.boot().modules().stream(); + + // Filter out the modules loaded by the boot or platform loader + PrivilegedAction> pa = () -> + bootLayerModules.filter(SecurityManager::isBootOrPlatformModule) + .collect(Collectors.toSet()); + Set modules = AccessController.doPrivileged(pa); + + // Filter out the non-exported packages + nonExportedPkgs = modules.stream() + .map(Module::getDescriptor) + .map(SecurityManager::nonExportedPkgs) + .flatMap(Set::stream) + .collect(Collectors.toSet()); + } + /** - * Throws a SecurityException if the - * calling thread is not allowed to access the package specified by - * the argument. + * Returns true if the module's loader is the boot or platform loader. + */ + private static boolean isBootOrPlatformModule(Module m) { + return m.getClassLoader() == null || + m.getClassLoader() == ClassLoader.getPlatformClassLoader(); + } + + /** + * Returns the non-exported packages of the specified module. + */ + private static Set nonExportedPkgs(ModuleDescriptor md) { + // start with all packages in the module + Set pkgs = new HashSet<>(md.packages()); + + // remove the non-qualified exported packages + md.exports().stream() + .filter(p -> !p.isQualified()) + .map(Exports::source) + .forEach(pkgs::remove); + + // remove the non-qualified open packages + md.opens().stream() + .filter(p -> !p.isQualified()) + .map(Opens::source) + .forEach(pkgs::remove); + + return pkgs; + } + + /** + * Throws a {@code SecurityException} if the calling thread is not allowed + * to access the specified package. *

- * This method is used by the loadClass method of class - * loaders. + * This method is called by the {@code loadClass} method of class loaders. *

- * This method first gets a list of - * restricted packages by obtaining a comma-separated list from - * a call to - * java.security.Security.getProperty("package.access"), - * and checks to see if pkg starts with or equals - * any of the restricted packages. If it does, then - * checkPermission gets called with the - * RuntimePermission("accessClassInPackage."+pkg) - * permission. + * This method checks if the specified package starts with or equals + * any of the packages in the {@code package.access} Security Property. + * An implementation may also check the package against an additional + * list of restricted packages as noted below. If the package is restricted, + * {@link #checkPermission(Permission)} is called with a + * {@code RuntimePermission("accessClassInPackage."+pkg)} permission. *

- * If this method is overridden, then - * super.checkPackageAccess should be called - * as the first line in the overridden method. + * If this method is overridden, then {@code super.checkPackageAccess} + * should be called as the first line in the overridden method. + * + * @implNote + * This implementation also restricts all non-exported packages of modules + * loaded by {@linkplain ClassLoader#getPlatformClassLoader + * the platform class loader} or its ancestors. A "non-exported package" + * refers to a package that is not exported to all modules. Specifically, + * it refers to a package that either is not exported at all by its + * containing module or is exported in a qualified fashion by its + * containing module. * * @param pkg the package name. - * @exception SecurityException if the calling thread does not have + * @throws SecurityException if the calling thread does not have * permission to access the specified package. - * @exception NullPointerException if the package name argument is - * null. - * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean) - * loadClass + * @throws NullPointerException if the package name argument is + * {@code null}. + * @see java.lang.ClassLoader#loadClass(String, boolean) loadClass * @see java.security.Security#getProperty getProperty - * @see #checkPermission(java.security.Permission) checkPermission + * @see #checkPermission(Permission) checkPermission */ public void checkPackageAccess(String pkg) { - if (pkg == null) { - throw new NullPointerException("package name can't be null"); + Objects.requireNonNull(pkg, "package name can't be null"); + + // check if pkg is not exported to all modules + if (nonExportedPkgs.contains(pkg)) { + checkPermission( + new RuntimePermission("accessClassInPackage." + pkg)); + return; } String[] restrictedPkgs; @@ -1512,36 +1586,48 @@ class SecurityManager { } /** - * Throws a SecurityException if the - * calling thread is not allowed to define classes in the package - * specified by the argument. + * Throws a {@code SecurityException} if the calling thread is not + * allowed to define classes in the specified package. *

- * This method is used by the loadClass method of some + * This method is called by the {@code loadClass} method of some * class loaders. *

- * This method first gets a list of restricted packages by - * obtaining a comma-separated list from a call to - * java.security.Security.getProperty("package.definition"), - * and checks to see if pkg starts with or equals - * any of the restricted packages. If it does, then - * checkPermission gets called with the - * RuntimePermission("defineClassInPackage."+pkg) - * permission. + * This method checks if the specified package starts with or equals + * any of the packages in the {@code package.definition} Security + * Property. An implementation may also check the package against an + * additional list of restricted packages as noted below. If the package + * is restricted, {@link #checkPermission(Permission)} is called with a + * {@code RuntimePermission("defineClassInPackage."+pkg)} permission. *

- * If this method is overridden, then - * super.checkPackageDefinition should be called - * as the first line in the overridden method. + * If this method is overridden, then {@code super.checkPackageDefinition} + * should be called as the first line in the overridden method. + * + * @implNote + * This implementation also restricts all non-exported packages of modules + * loaded by {@linkplain ClassLoader#getPlatformClassLoader + * the platform class loader} or its ancestors. A "non-exported package" + * refers to a package that is not exported to all modules. Specifically, + * it refers to a package that either is not exported at all by its + * containing module or is exported in a qualified fashion by its + * containing module. * * @param pkg the package name. - * @exception SecurityException if the calling thread does not have + * @throws SecurityException if the calling thread does not have * permission to define classes in the specified package. - * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean) + * @throws NullPointerException if the package name argument is + * {@code null}. + * @see java.lang.ClassLoader#loadClass(String, boolean) * @see java.security.Security#getProperty getProperty - * @see #checkPermission(java.security.Permission) checkPermission + * @see #checkPermission(Permission) checkPermission */ public void checkPackageDefinition(String pkg) { - if (pkg == null) { - throw new NullPointerException("package name can't be null"); + Objects.requireNonNull(pkg, "package name can't be null"); + + // check if pkg is not exported to all modules + if (nonExportedPkgs.contains(pkg)) { + checkPermission( + new RuntimePermission("defineClassInPackage." + pkg)); + return; } String[] pkgs; diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java index 18620771d20..1577e215e35 100644 --- a/jdk/src/java.base/share/classes/java/lang/System.java +++ b/jdk/src/java.base/share/classes/java/lang/System.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, 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 @@ -310,12 +310,13 @@ public final class System { * @see SecurityManager#checkPermission * @see java.lang.RuntimePermission */ - public static - void setSecurityManager(final SecurityManager s) { - try { - s.checkPackageAccess("java.lang"); - } catch (Exception e) { - // no-op + public static void setSecurityManager(final SecurityManager s) { + if (s != null) { + try { + s.checkPackageAccess("java.lang"); + } catch (Exception e) { + // no-op + } } setSecurityManager0(s); } diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 1f62f7e6751..1114d513687 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -249,7 +249,6 @@ module java.base { jdk.crypto.token; exports sun.security.jca to java.smartcardio, - java.xml.crypto, jdk.crypto.ec, jdk.crypto.token, jdk.naming.dns; diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security index 61a5169322c..5e778810bb7 100644 --- a/jdk/src/java.base/share/conf/security/java.security +++ b/jdk/src/java.base/share/conf/security/java.security @@ -298,111 +298,24 @@ keystore.type.compat=true # # List of comma-separated packages that start with or equal this string -# will cause a security exception to be thrown when -# passed to checkPackageAccess unless the -# corresponding RuntimePermission ("accessClassInPackage."+package) has -# been granted. -package.access=sun.,\ - com.sun.xml.internal.,\ - com.sun.imageio.,\ - com.sun.istack.internal.,\ - com.sun.jmx.,\ - com.sun.media.sound.,\ - com.sun.naming.internal.,\ - com.sun.proxy.,\ - com.sun.corba.se.,\ - com.sun.org.apache.bcel.internal.,\ - com.sun.org.apache.regexp.internal.,\ - com.sun.org.apache.xerces.internal.,\ - com.sun.org.apache.xpath.internal.,\ - com.sun.org.apache.xalan.internal.extensions.,\ - com.sun.org.apache.xalan.internal.lib.,\ - com.sun.org.apache.xalan.internal.res.,\ - com.sun.org.apache.xalan.internal.templates.,\ - com.sun.org.apache.xalan.internal.utils.,\ - com.sun.org.apache.xalan.internal.xslt.,\ - com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ - com.sun.org.apache.xalan.internal.xsltc.compiler.,\ - com.sun.org.apache.xalan.internal.xsltc.trax.,\ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.security.,\ - com.sun.org.apache.xml.internal.serializer.dom3.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ - com.sun.org.apache.xml.internal.utils.,\ - com.sun.org.glassfish.,\ - com.sun.tools.script.,\ - com.oracle.xmlns.internal.,\ - com.oracle.webservices.internal.,\ - org.jcp.xml.dsig.internal.,\ - jdk.internal.,\ - jdk.nashorn.internal.,\ - jdk.nashorn.tools.,\ - jdk.tools.jimage.,\ - com.sun.activation.registries.,\ - com.sun.java.accessibility.util.internal.,\ -#ifdef windows - com.sun.java.accessibility.internal.,\ -#endif -#ifdef macosx - apple.,\ -#endif +# will cause a security exception to be thrown when passed to the +# SecurityManager::checkPackageAccess method unless the corresponding +# RuntimePermission("accessClassInPackage."+package) has been granted. +# +package.access=sun.misc.,\ + sun.reflect.,\ # # List of comma-separated packages that start with or equal this string -# will cause a security exception to be thrown when -# passed to checkPackageDefinition unless the -# corresponding RuntimePermission ("defineClassInPackage."+package) has -# been granted. +# will cause a security exception to be thrown when passed to the +# SecurityManager::checkPackageDefinition method unless the corresponding +# RuntimePermission("defineClassInPackage."+package) has been granted. # -# by default, none of the class loaders supplied with the JDK call +# By default, none of the class loaders supplied with the JDK call # checkPackageDefinition. # -package.definition=sun.,\ - com.sun.xml.internal.,\ - com.sun.imageio.,\ - com.sun.istack.internal.,\ - com.sun.jmx.,\ - com.sun.media.sound.,\ - com.sun.naming.internal.,\ - com.sun.proxy.,\ - com.sun.corba.se.,\ - com.sun.org.apache.bcel.internal.,\ - com.sun.org.apache.regexp.internal.,\ - com.sun.org.apache.xerces.internal.,\ - com.sun.org.apache.xpath.internal.,\ - com.sun.org.apache.xalan.internal.extensions.,\ - com.sun.org.apache.xalan.internal.lib.,\ - com.sun.org.apache.xalan.internal.res.,\ - com.sun.org.apache.xalan.internal.templates.,\ - com.sun.org.apache.xalan.internal.utils.,\ - com.sun.org.apache.xalan.internal.xslt.,\ - com.sun.org.apache.xalan.internal.xsltc.cmdline.,\ - com.sun.org.apache.xalan.internal.xsltc.compiler.,\ - com.sun.org.apache.xalan.internal.xsltc.trax.,\ - com.sun.org.apache.xalan.internal.xsltc.util.,\ - com.sun.org.apache.xml.internal.res.,\ - com.sun.org.apache.xml.internal.security.,\ - com.sun.org.apache.xml.internal.serializer.dom3.,\ - com.sun.org.apache.xml.internal.serializer.utils.,\ - com.sun.org.apache.xml.internal.utils.,\ - com.sun.org.glassfish.,\ - com.sun.tools.script.,\ - com.oracle.xmlns.internal.,\ - com.oracle.webservices.internal.,\ - org.jcp.xml.dsig.internal.,\ - jdk.internal.,\ - jdk.nashorn.internal.,\ - jdk.nashorn.tools.,\ - jdk.tools.jimage.,\ - com.sun.activation.registries.,\ - com.sun.java.accessibility.util.internal.,\ -#ifdef windows - com.sun.java.accessibility.internal.,\ -#endif -#ifdef macosx - apple.,\ -#endif +package.definition=sun.misc.,\ + sun.reflect.,\ # # Determines whether this properties file can be appended to diff --git a/jdk/src/java.base/share/lib/security/default.policy b/jdk/src/java.base/share/lib/security/default.policy index 1f445078c6b..4d890704195 100644 --- a/jdk/src/java.base/share/lib/security/default.policy +++ b/jdk/src/java.base/share/lib/security/default.policy @@ -93,9 +93,19 @@ grant codeBase "jrt:/java.xml.crypto" { "com.sun.org.apache.xml.internal.security.register"; permission java.security.SecurityPermission "getProperty.jdk.xml.dsig.secureValidationPolicy"; + permission java.lang.RuntimePermission + "accessClassInPackage.com.sun.org.apache.xml.internal.*"; + permission java.lang.RuntimePermission + "accessClassInPackage.com.sun.org.apache.xpath.internal"; + permission java.lang.RuntimePermission + "accessClassInPackage.com.sun.org.apache.xpath.internal.*"; }; grant codeBase "jrt:/java.xml.ws" { + permission java.lang.RuntimePermission + "accessClassInPackage.com.sun.org.apache.xml.internal.resolver"; + permission java.lang.RuntimePermission + "accessClassInPackage.com.sun.org.apache.xml.internal.resolver.tools"; permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.*"; permission java.lang.RuntimePermission @@ -188,3 +198,10 @@ grant codeBase "jrt:/jdk.zipfs" { permission java.util.PropertyPermission "os.name", "read"; }; +grant codeBase "jrt:/jdk.accessibility" { + permission java.lang.RuntimePermission "accessClassInPackage.sun.awt"; +}; + +grant codeBase "jrt:/jdk.desktop" { + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.awt"; +}; diff --git a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java index 0326f57639c..37d7f8d4f3f 100644 --- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java +++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -31,6 +31,9 @@ import java.io.*; import java.math.*; import java.util.*; import java.text.*; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import javax.sql.rowset.*; import javax.sql.rowset.spi.*; @@ -357,8 +360,16 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern } // set the Reader, this maybe overridden latter - provider = - SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER); + try { + provider = AccessController.doPrivileged(new PrivilegedExceptionAction<>() { + @Override + public SyncProvider run() throws SyncFactoryException { + return SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER); + } + }, null, new RuntimePermission("accessClassInPackage.com.sun.rowset.providers")); + } catch (PrivilegedActionException pae) { + throw (SyncFactoryException) pae.getException(); + } if (!(provider instanceof RIOptimisticProvider)) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidp").toString()); diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy index a138a577ff7..175e9cb86e5 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy @@ -1,6 +1,6 @@ -grant -{ +grant codeBase "file:${test.classes}/*" { permission java.security.SecurityPermission "removeProvider.SunJCE"; permission java.security.SecurityPermission "insertProvider.SunJCE"; - permission java.security.SecurityPermission "putProviderProperty.SunJCE"; + permission java.lang.RuntimePermission + "accessClassInPackage.com.sun.crypto.provider"; }; diff --git a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy index 71362da17dc..87f7b627fdd 100644 --- a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy +++ b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy @@ -1,9 +1,9 @@ - -grant { +grant codeBase "file:${test.classes}/*" { // The following permissions are not required because the test is // not expected to connect to an LDAP server // //permission java.net.SocketPermission "*:389", "connect"; //permission java.net.SocketPermission "*:636", "connect"; //permission javax.security.auth.AuthPermission "modifyPrincipals"; + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.jndi.ldap"; }; diff --git a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java index b6f8a096db7..61d07b40d58 100644 --- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java +++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, 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 @@ -23,87 +23,174 @@ /* * @test - * @bug 6741606 7146431 8000450 8019830 8022945 8027144 8041633 8078427 - * @summary Make sure all restricted packages listed in the package.access + * @bug 6741606 7146431 8000450 8019830 8022945 8027144 8041633 8078427 8055206 + * @summary Check that various restricted packages that are supposed to be + * restricted by default or are listed in the package.access * property in the java.security file are blocked + * @modules java.xml.ws java.corba * @run main/othervm CheckPackageAccess */ -import java.util.Collections; -import java.util.ArrayList; +import java.lang.module.ModuleFinder; +import java.lang.module.ModuleReference; +import java.util.Arrays; import java.util.List; +import java.util.Optional; -/* - * The main benefit of this test is to catch merge errors or other types - * of issues where one or more of the packages are accidentally - * removed. This is why the packages that are known to be restricted have to - * be explicitly listed below. - */ public class CheckPackageAccess { - public static void main(String[] args) throws Exception { - // get expected list of restricted packages - List pkgs = RestrictedPackages.expected(); + private static final SecurityManager sm = new SecurityManager(); + private static final ModuleFinder mf = ModuleFinder.ofSystem(); - // get actual list of restricted packages - List jspkgs = RestrictedPackages.actual(); + /* + * The expected list of restricted packages of the package.access property. + * + * This array should be updated whenever new packages are added to the + * package.access property in the java.security file + * NOTE: it should be in the same order as the java.security file + */ + private static final String[] EXPECTED = { + "sun.misc.", + "sun.reflect.", + }; - if (!isOpenJDKOnly()) { - String lastPkg = pkgs.get(pkgs.size() - 1); + /** + * Tests access to various packages of a module. + */ + private static class Test { + String moduleName; // name of module + ModuleReference moduleRef; // module reference + String exports; // exported pkg + Optional opens; // opened pkg + String conceals; // concealed pkg + Optional qualExports; // qualified export pkg + Optional qualOpens; // qualified open pkg + // qual open and non-qualified export pkg + Optional qualOpensAndExports; + Test(String module, String exports, String opens, String conceals, + String qualExports, String qualOpens, String qualOpensAndExports) { + this.moduleName = module; + this.moduleRef = mf.find(moduleName).get(); + this.exports = exports; + this.opens = Optional.ofNullable(opens); + this.conceals = conceals; + this.qualExports = Optional.ofNullable(qualExports); + this.qualOpens = Optional.ofNullable(qualOpens); + this.qualOpensAndExports = Optional.ofNullable(qualOpensAndExports); + } - // Remove any closed packages from list before comparing - int index = jspkgs.indexOf(lastPkg); - if (index != -1 && index != jspkgs.size() - 1) { - jspkgs.subList(index + 1, jspkgs.size()).clear(); + void test() { + System.out.println("Testing module " + moduleName); + + // access to exported pkg should pass + testNonRestricted(exports); + + // access to opened pkg should pass + opens.ifPresent(Test::testNonRestricted); + + // access to concealed pkg should fail + testRestricted(conceals); + + // access to qualified export pkg should fail + qualExports.ifPresent(Test::testRestricted); + + // access to qualified open pkg should fail + qualOpens.ifPresent(Test::testRestricted); + + // access to qualified opened pkg that is also exported should pass + qualOpensAndExports.ifPresent(Test::testNonRestricted); + } + + private static void testRestricted(String pkg) { + try { + sm.checkPackageAccess(pkg); + throw new RuntimeException("Able to access restricted package: " + + pkg); + } catch (SecurityException se) {} + try { + sm.checkPackageDefinition(pkg); + throw new RuntimeException("Able to access restricted package: " + + pkg); + } catch (SecurityException se) {} + } + + private static void testNonRestricted(String pkg) { + try { + sm.checkPackageAccess(pkg); + } catch (SecurityException se) { + throw new RuntimeException("Unable to access exported package: " + + pkg, se); + } + try { + sm.checkPackageDefinition(pkg); + } catch (SecurityException se) { + throw new RuntimeException("Unable to access exported package: " + + pkg, se); } } + } - // Sort to ensure lists are comparable - Collections.sort(pkgs); - Collections.sort(jspkgs); + private static final Test[] tests = new Test[] { + // java.base module loaded by boot loader + new Test("java.base", "java.security", null, "jdk.internal.jrtfs", + "jdk.internal.loader", null, null), + // java.desktop module loaded by boot loader and has an openQual pkg + // that is exported + new Test("java.desktop", "java.applet", null, "sun.applet", + "sun.awt", "com.sun.java.swing.plaf.windows", + "javax.swing.plaf.basic"), + // java.security.jgss module loaded by platform loader + new Test("java.security.jgss", "org.ietf.jgss", null, + "sun.security.krb5.internal.crypto", "sun.security.krb5", + null, null), + // java.xml.ws module loaded by platform loader but needs to be added + // and has an openQual pkg that is exported + new Test("java.xml.ws", "javax.xml.soap", null, + "com.sun.xml.internal.stream.buffer", + "com.sun.xml.internal.ws.api", null, + "javax.xml.ws.wsaddressing"), + // java.xml.ws module loaded by platform loader but needs to be added + // and has an openQual pkg + new Test("java.corba", "javax.rmi", null, "sun.corba", + "com.sun.corba.se.impl.util", "com.sun.jndi.cosnaming", null), + }; - if (!pkgs.equals(jspkgs)) { - for (String p : pkgs) - if (!jspkgs.contains(p)) - System.out.println("In golden set, but not in j.s file: " + p); - for (String p : jspkgs) - if (!pkgs.contains(p)) - System.out.println("In j.s file, but not in golden set: " + p); + public static void main(String[] args) throws Exception { + // check expected list of restricted packages in java.security file + checkPackages(Arrays.asList(EXPECTED)); - throw new RuntimeException("restricted packages are not " + - "consistent with java.security file"); + // check access to each module's packages + for (Test test : tests) { + test.test(); } - System.setSecurityManager(new SecurityManager()); - SecurityManager sm = System.getSecurityManager(); + + System.out.println("Test passed"); + } + + private static void checkPackages(List pkgs) { for (String pkg : pkgs) { - String subpkg = pkg + "foo"; try { sm.checkPackageAccess(pkg); throw new RuntimeException("Able to access " + pkg + " package"); } catch (SecurityException se) { } - try { - sm.checkPackageAccess(subpkg); - throw new RuntimeException("Able to access " + subpkg + - " package"); - } catch (SecurityException se) { } try { sm.checkPackageDefinition(pkg); throw new RuntimeException("Able to define class in " + pkg + " package"); } catch (SecurityException se) { } + String subpkg = pkg + "foo"; try { - sm.checkPackageDefinition(subpkg); - throw new RuntimeException("Able to define class in " + subpkg + + sm.checkPackageAccess(subpkg); + throw new RuntimeException("Able to access " + subpkg + " package"); } catch (SecurityException se) { } + try { + sm.checkPackageDefinition(subpkg); + throw new RuntimeException("Able to define class in " + + subpkg + " package"); + } catch (SecurityException se) { } } - System.out.println("Test passed"); - } - - private static boolean isOpenJDKOnly() { - String prop = System.getProperty("java.runtime.name"); - return prop != null && prop.startsWith("OpenJDK"); } } diff --git a/jdk/test/java/lang/SecurityManager/CheckPackageMatching.java b/jdk/test/java/lang/SecurityManager/CheckPackageMatching.java index 915ea7995ab..418a04a6857 100644 --- a/jdk/test/java/lang/SecurityManager/CheckPackageMatching.java +++ b/jdk/test/java/lang/SecurityManager/CheckPackageMatching.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -28,11 +28,13 @@ * @run main/othervm CheckPackageMatching */ +import java.security.Security; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.StringTokenizer; /* * The purpose of this test is not to verify the content of the package @@ -46,10 +48,23 @@ public class CheckPackageMatching { * The restricted packages listed in the package.access property of the * java.security file. */ - private static final String[] packages = - RestrictedPackages.actual().toArray(new String[0]); + private static final String[] packages = actual().toArray(new String[0]); - private static final boolean OPEN_JDK = isOpenJDKOnly(); + /** + * Returns the list of restricted packages in the package.access property. + */ + private static List actual() { + String prop = Security.getProperty("package.access"); + List packages = new ArrayList<>(); + if (prop != null && !prop.equals("")) { + StringTokenizer tok = new StringTokenizer(prop, ","); + while (tok.hasMoreElements()) { + String s = tok.nextToken().trim(); + packages.add(s); + } + } + return packages; + } /** * PackageMatcher implements a state machine that matches package @@ -326,13 +341,8 @@ public class CheckPackageMatching { System.getSecurityManager().checkPackageAccess("com.sun.jmxa"); System.getSecurityManager().checkPackageAccess("jmx"); List actual = Arrays.asList(packages); - for (String p : actual) { - if (!actual.contains(p)) { - System.err.println("Warning: '" + p + " not in package.access"); - } - } - if (!actual.contains("sun.")) { - throw new Error("package.access does not contain 'sun.'"); + if (!actual.contains("sun.misc.")) { + throw new Error("package.access does not contain 'sun.misc.'"); } } @@ -447,17 +457,15 @@ public class CheckPackageMatching { // These should not match. for (String pkg : new String[] {"gloups.machin", "su", - "org.jcp.xml.dsig.interna", + "org.jcp.xml.dsig.inter", "com.sun.jm", "com.sun.jmxa"}) { testMatch(matcher, pkg, false, true); } // These should match. for (String pkg : Arrays.asList( - new String[] {"sun.gloups.machin", "sun", "sun.com", - "com.sun.jmx", "com.sun.jmx.a", - "org.jcp.xml.dsig.internal", - "org.jcp.xml.dsig.internal.foo"})) { + new String[] {"sun.misc.gloups.machin", "sun.misc", + "sun.reflect"})) { testMatch(matcher, pkg, true, true); } @@ -486,12 +494,6 @@ public class CheckPackageMatching { } for (String pkg : pkgs) { - if (!OPEN_JDK && pkg.equals("com.sun.media.sound.")) { - // don't test com.sun.media.sound since there is an entry - // for com.sun.media in non OpenJDK builds. Otherwise, - // the test for this package will fail unexpectedly. - continue; - } String candidate = pkg.substring(0, pkg.length() - 2); boolean expected = pkglist.contains(candidate + "."); testMatch(matcher, candidate, expected, @@ -537,9 +539,4 @@ public class CheckPackageMatching { } } } - - private static boolean isOpenJDKOnly() { - String prop = System.getProperty("java.runtime.name"); - return prop != null && prop.startsWith("OpenJDK"); - } } diff --git a/jdk/test/java/lang/SecurityManager/RestrictedPackages.java b/jdk/test/java/lang/SecurityManager/RestrictedPackages.java deleted file mode 100644 index 546df6b1661..00000000000 --- a/jdk/test/java/lang/SecurityManager/RestrictedPackages.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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.security.Security; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.StringTokenizer; - -/** - * A collection of utility methods and constants for testing the package - * access and package definition security checks. - */ -final class RestrictedPackages { - - /* - * The expected list of restricted packages. - * - * This array should be updated whenever new packages are added to the - * package.access property in the java.security file - * NOTE: it should be in the same order as the java.security file - */ - static final String[] EXPECTED = { - "sun.", - "com.sun.xml.internal.", - "com.sun.imageio.", - "com.sun.istack.internal.", - "com.sun.jmx.", - "com.sun.media.sound.", - "com.sun.naming.internal.", - "com.sun.proxy.", - "com.sun.corba.se.", - "com.sun.org.apache.bcel.internal.", - "com.sun.org.apache.regexp.internal.", - "com.sun.org.apache.xerces.internal.", - "com.sun.org.apache.xpath.internal.", - "com.sun.org.apache.xalan.internal.extensions.", - "com.sun.org.apache.xalan.internal.lib.", - "com.sun.org.apache.xalan.internal.res.", - "com.sun.org.apache.xalan.internal.templates.", - "com.sun.org.apache.xalan.internal.utils.", - "com.sun.org.apache.xalan.internal.xslt.", - "com.sun.org.apache.xalan.internal.xsltc.cmdline.", - "com.sun.org.apache.xalan.internal.xsltc.compiler.", - "com.sun.org.apache.xalan.internal.xsltc.trax.", - "com.sun.org.apache.xalan.internal.xsltc.util.", - "com.sun.org.apache.xml.internal.res.", - "com.sun.org.apache.xml.internal.security.", - "com.sun.org.apache.xml.internal.serializer.dom3.", - "com.sun.org.apache.xml.internal.serializer.utils.", - "com.sun.org.apache.xml.internal.utils.", - "com.sun.org.glassfish.", - "com.sun.tools.script.", - "com.oracle.xmlns.internal.", - "com.oracle.webservices.internal.", - "org.jcp.xml.dsig.internal.", - "jdk.internal.", - "jdk.nashorn.internal.", - "jdk.nashorn.tools.", - "jdk.tools.jimage.", - "com.sun.activation.registries.", - "com.sun.java.accessibility.util.internal." - }; - - /* - * A non-exhaustive list of restricted packages. - * - * Contrary to what is in the EXPECTED list, this list does not need - * to be exhaustive. - */ - static final String[] EXPECTED_NONEXHAUSTIVE = { - "sun.", - "com.sun.xml.internal.", - "com.sun.imageio.", - "com.sun.istack.internal.", - "com.sun.jmx.", - "com.sun.proxy.", - "com.sun.org.apache.bcel.internal.", - "com.sun.org.apache.regexp.internal.", - "com.sun.org.apache.xerces.internal.", - "com.sun.org.apache.xpath.internal.", - "com.sun.org.apache.xalan.internal.extensions.", - "com.sun.org.apache.xalan.internal.lib.", - "com.sun.org.apache.xalan.internal.res.", - "com.sun.org.apache.xalan.internal.templates.", - "com.sun.org.apache.xalan.internal.utils.", - "com.sun.org.apache.xalan.internal.xslt.", - "com.sun.org.apache.xalan.internal.xsltc.cmdline.", - "com.sun.org.apache.xalan.internal.xsltc.compiler.", - "com.sun.org.apache.xalan.internal.xsltc.trax.", - "com.sun.org.apache.xalan.internal.xsltc.util.", - "com.sun.org.apache.xml.internal.res.", - "com.sun.org.apache.xml.internal.serializer.utils.", - "com.sun.org.apache.xml.internal.utils.", - "com.sun.org.apache.xml.internal.security.", - "com.sun.org.glassfish.", - "org.jcp.xml.dsig.internal." - }; - - private static final String OS_NAME = System.getProperty("os.name"); - - /** - * Returns a list of expected restricted packages, including any - * OS specific packages. The returned list is mutable. - */ - static List expected() { - List pkgs = new ArrayList<>(Arrays.asList(EXPECTED)); - if (OS_NAME.contains("OS X")) { - pkgs.add("apple."); // add apple package for OS X - } - if (OS_NAME.contains("Win")) { - pkgs.add("com.sun.java.accessibility.internal."); // add Win only package - } - return pkgs; - } - - /** - * Returns a list of actual restricted packages. The returned list - * is mutable. - */ - static List actual() { - String prop = Security.getProperty("package.access"); - List packages = new ArrayList<>(); - if (prop != null && !prop.equals("")) { - StringTokenizer tok = new StringTokenizer(prop, ","); - while (tok.hasMoreElements()) { - String s = tok.nextToken().trim(); - packages.add(s); - } - } - return packages; - } - - private RestrictedPackages() { } -} diff --git a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java index dc088b374bc..047c128e9d5 100644 --- a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java +++ b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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 @@ -63,6 +63,7 @@ public class LogGeneratedClassesTest extends LUtils { scratch.add(" int foo();"); scratch.add(" }"); scratch.add(" public static void main(String[] args) {"); + scratch.add(" System.setSecurityManager(new SecurityManager());"); scratch.add(" I lam = () -> 10;"); scratch.add(" Runnable r = () -> {"); scratch.add(" System.out.println(\"Runnable\");"); @@ -114,7 +115,6 @@ public class LogGeneratedClassesTest extends LUtils { public void testNotLogging() { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", - "-Djava.security.manager", "com.example.TestLambda"); tr.assertZero("Should still return 0"); } @@ -125,7 +125,6 @@ public class LogGeneratedClassesTest extends LUtils { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", "-Djdk.internal.lambda.dumpProxyClasses=dump", - "-Djava.security.manager", "com.example.TestLambda"); // 2 our own class files. We don't care about the others assertEquals(Files.find( @@ -143,7 +142,6 @@ public class LogGeneratedClassesTest extends LUtils { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", "-Djdk.internal.lambda.dumpProxyClasses=notExist", - "-Djava.security.manager", "com.example.TestLambda"); assertEquals(tr.testOutput.stream() .filter(s -> s.startsWith("WARNING")) @@ -159,7 +157,6 @@ public class LogGeneratedClassesTest extends LUtils { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", "-Djdk.internal.lambda.dumpProxyClasses=file", - "-Djava.security.manager", "com.example.TestLambda"); assertEquals(tr.testOutput.stream() .filter(s -> s.startsWith("WARNING")) @@ -218,7 +215,6 @@ public class LogGeneratedClassesTest extends LUtils { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", "-Djdk.internal.lambda.dumpProxyClasses=readOnly", - "-Djava.security.manager", "com.example.TestLambda"); assertEquals(tr.testOutput.stream() .filter(s -> s.startsWith("WARNING")) @@ -237,7 +233,6 @@ public class LogGeneratedClassesTest extends LUtils { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", "-Djdk.internal.lambda.dumpProxyClasses=dumpLong", - "-Djava.security.manager", longFQCN); assertEquals(tr.testOutput.stream() .filter(s -> s.startsWith("WARNING: Exception")) diff --git a/jdk/test/java/security/KeyRep/SerialOld.policy b/jdk/test/java/security/KeyRep/SerialOld.policy index e029d09a4e9..4ab31832721 100644 --- a/jdk/test/java/security/KeyRep/SerialOld.policy +++ b/jdk/test/java/security/KeyRep/SerialOld.policy @@ -1,4 +1,4 @@ -grant { +grant codeBase "file:${test.classes}/*" { permission java.io.FilePermission "${test.src}${file.separator}*", "read"; permission java.util.PropertyPermission "test.src", "read"; @@ -11,4 +11,6 @@ grant { "accessClassInPackage.sun.security.x509"; permission java.lang.RuntimePermission "accessClassInPackage.sun.security.rsa"; + permission java.lang.RuntimePermission + "accessClassInPackage.com.sun.crypto.provider"; }; diff --git a/jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy b/jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy index 52d9247b846..d2a3b1a4e42 100644 --- a/jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -21,25 +21,12 @@ * questions. */ -grant codeBase "jrt:/java.corba" { - permission java.security.AllPermission; -}; - - - grant { - permission java.io.FilePermission "./-", "read,write,execute"; - permission java.io.FilePermission "*", "read"; - permission java.net.SocketPermission "*:*", "connect, accept, listen, resolve"; - permission java.util.PropertyPermission "*", "read, write"; - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.io.SerializablePermission "enableSubclassImplementation"; - permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.corba"; - permission java.lang.RuntimePermission "defineClassInPackage.sun.corba"; - permission java.lang.RuntimePermission "reflectionFactoryAccess"; - permission sun.corba.BridgePermission "getBridge"; - permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect"; - permission java.util.PropertyPermission "*", "read, write"; - permission java.io.FilePermission "<>", "read,write,execute"; + permission java.util.PropertyPermission "*", "read"; + permission java.io.FilePermission "<>", "read, execute"; +}; + +grant codeBase "file:${test.classes}/*" { + permission java.net.SocketPermission "*:*", "connect, accept, listen, resolve"; + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.jndi.cosnaming"; }; diff --git a/jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy b/jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy index 73477e5d250..d2a3b1a4e42 100644 --- a/jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy +++ b/jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -21,23 +21,12 @@ * questions. */ -grant codeBase "jrt:/java.corba" { - permission java.security.AllPermission; +grant { + permission java.util.PropertyPermission "*", "read"; + permission java.io.FilePermission "<>", "read, execute"; }; -grant { - permission java.io.FilePermission "./-", "read,write,execute"; - permission java.io.FilePermission "*", "read"; +grant codeBase "file:${test.classes}/*" { permission java.net.SocketPermission "*:*", "connect, accept, listen, resolve"; - permission java.util.PropertyPermission "*", "read, write"; - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.io.SerializablePermission "enableSubclassImplementation"; - permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.corba"; - permission java.lang.RuntimePermission "defineClassInPackage.sun.corba"; - permission java.lang.RuntimePermission "reflectionFactoryAccess"; - permission sun.corba.BridgePermission "getBridge"; - permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect"; - permission java.util.PropertyPermission "*", "read, write"; - permission java.io.FilePermission "<>", "read,write,execute"; + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.jndi.cosnaming"; }; From 5aa0f30214646ade5ce2656c1667ed8f6816e9e6 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 19 Jan 2017 13:46:45 -0800 Subject: [PATCH 54/71] 8172547: (se) Selector.select(Long.MAX_VALUE) fires repeatedly Clamp the jlong-valued select() timeout to INT_MAX for struct timeval Reviewed-by: rriggs, clanger, alanb --- .../native/libnio/ch/WindowsSelectorImpl.c | 17 +++- .../nio/channels/Selector/SelectTimeout.java | 82 +++++++++++-------- 2 files changed, 63 insertions(+), 36 deletions(-) diff --git a/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c b/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c index 7d5e1e77875..4d9432845ea 100644 --- a/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c +++ b/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -32,6 +32,7 @@ #define FD_SETSIZE 1024 +#include #include #include @@ -75,8 +76,18 @@ Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject tv = NULL; } else { tv = &timevalue; - tv->tv_sec = (long)(timeout / 1000); - tv->tv_usec = (long)((timeout % 1000) * 1000); + jlong sec = timeout / 1000; + // + // struct timeval members are signed 32-bit integers so the + // signed 64-bit jlong needs to be clamped + // + if (sec > INT_MAX) { + tv->tv_sec = INT_MAX; + tv->tv_usec = 0; + } else { + tv->tv_sec = (long)sec; + tv->tv_usec = (long)((timeout % 1000) * 1000); + } } /* Set FD_SET structures required for select */ diff --git a/jdk/test/java/nio/channels/Selector/SelectTimeout.java b/jdk/test/java/nio/channels/Selector/SelectTimeout.java index aaeff367d84..797a36386ae 100644 --- a/jdk/test/java/nio/channels/Selector/SelectTimeout.java +++ b/jdk/test/java/nio/channels/Selector/SelectTimeout.java @@ -1,46 +1,50 @@ /* -* Copyright (c) 2016, 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. -*/ + * Copyright (c) 2016, 2017, 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 8165000 - * @summary Verify no IOException on OS X for large timeout value in select(). - * @requires (os.family == "mac") + * @bug 8165000 8172547 + * @summary Verify no IOException on OS X for large timeout value in select() + * and that timeout does not occur too early on Windows. + * @requires (os.family == "mac" | os.family == "windows") */ import java.io.IOException; import java.nio.channels.Selector; public class SelectTimeout { - private static final long HUGE_TIMEOUT = 100000001000L; - private static final long SLEEP_MILLIS = 10000; + private static final long BIG_TIMEOUT = 100_000_001_000L; // 8165000 + private static final long BIGGER_TIMEOUT = 850_000_000_000_000L; // 8172547 + private static final long SLEEP_MILLIS = 10000; - private static Exception theException; + private static volatile Exception theException; + private static volatile boolean isTimedOut; public static void main(String[] args) throws IOException, InterruptedException { int failures = 0; long[] timeouts = - new long[] {0, HUGE_TIMEOUT/2, HUGE_TIMEOUT - 1, HUGE_TIMEOUT}; + new long[] {1, BIG_TIMEOUT/2, BIG_TIMEOUT - 1, BIG_TIMEOUT, + BIGGER_TIMEOUT}; for (long t : timeouts) { if (!test(t)) { failures++; @@ -61,23 +65,35 @@ public class SelectTimeout { Thread t = new Thread(() -> { try { + isTimedOut = false; selector.select(timeout); + isTimedOut = true; } catch (IOException ioe) { theException = ioe; } }); t.start(); - Thread.currentThread().sleep(SLEEP_MILLIS); - t.interrupt(); + t.join(SLEEP_MILLIS); + boolean result; if (theException == null) { - System.out.printf("Test succeeded with timeout %d%n", timeout); - return true; + if (timeout > SLEEP_MILLIS && isTimedOut) { + System.err.printf("Test timed out early with timeout %d%n", + timeout); + result = false; + } else { + System.out.printf("Test succeeded with timeout %d%n", timeout); + result = true; + } } else { System.err.printf("Test failed with timeout %d%n", timeout); theException.printStackTrace(); - return false; + result = false; } + + t.interrupt(); + + return result; } } From be58d38ea38caab4cbecfa4e0f6bf055be84f61e Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 19 Jan 2017 15:45:36 -0800 Subject: [PATCH 55/71] 8173085: Warning module name in --add-exports not found: jdk.jdeps when compiling for BUILD_JIGSAW_TOOLS Reviewed-by: jjg --- jdk/make/CompileModuleTools.gmk | 1 - 1 file changed, 1 deletion(-) diff --git a/jdk/make/CompileModuleTools.gmk b/jdk/make/CompileModuleTools.gmk index b366182e507..2bfe520b233 100644 --- a/jdk/make/CompileModuleTools.gmk +++ b/jdk/make/CompileModuleTools.gmk @@ -37,6 +37,5 @@ $(eval $(call SetupJavaCompilation,BUILD_JIGSAW_TOOLS, \ build/tools/jigsaw, \ BIN := $(TOOLS_CLASSES_DIR), \ ADD_JAVAC_FLAGS := \ - --add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \ --add-exports java.base/jdk.internal.module=ALL-UNNAMED \ )) From 248778d27a5f8a16e4c90a4f5a6632a7ca8e9a89 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Thu, 19 Jan 2017 16:38:24 -0800 Subject: [PATCH 56/71] 8173072: zipfs fails to handle incorrect info-zip "extended timestamp extra field" Reviewed-by: redestad --- .../share/classes/jdk/nio/zipfs/ZipCoder.java | 18 +++++++++--------- .../classes/jdk/nio/zipfs/ZipFileSystem.java | 7 ++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java index 77bfa5b81e0..ea5ca6a4f63 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java @@ -67,7 +67,7 @@ class ZipCoder { } } - private static ZipCoder utf8 = new UTF8(); + private static final ZipCoder utf8 = new UTF8(); public static ZipCoder get(String csn) { Charset cs = Charset.forName(csn); @@ -82,15 +82,15 @@ class ZipCoder { int clen = (int)(ba.length * cd.maxCharsPerByte()); char[] ca = new char[clen]; if (clen == 0) - return new String(ca); + return new String(ca); ByteBuffer bb = ByteBuffer.wrap(ba, 0, ba.length); CharBuffer cb = CharBuffer.wrap(ca); CoderResult cr = cd.decode(bb, cb, true); if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); + throw new IllegalArgumentException(cr.toString()); cr = cd.flush(cb); if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); + throw new IllegalArgumentException(cr.toString()); return new String(ca, 0, cb.position()); } @@ -100,19 +100,19 @@ class ZipCoder { int len = (int)(ca.length * ce.maxBytesPerChar()); byte[] ba = new byte[len]; if (len == 0) - return ba; + return ba; ByteBuffer bb = ByteBuffer.wrap(ba); CharBuffer cb = CharBuffer.wrap(ca); CoderResult cr = ce.encode(cb, bb, true); if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); + throw new IllegalArgumentException(cr.toString()); cr = ce.flush(bb); if (!cr.isUnderflow()) - throw new IllegalArgumentException(cr.toString()); + throw new IllegalArgumentException(cr.toString()); if (bb.position() == ba.length) // defensive copy? - return ba; + return ba; else - return Arrays.copyOf(ba, bb.position()); + return Arrays.copyOf(ba, bb.position()); } boolean isUTF8() { diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java index 0aac8a3f14f..498a93dc902 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java @@ -2294,16 +2294,17 @@ class ZipFileSystem extends FileSystem { locPos += locSZ; continue; } + int end = locPos + locSZ - 4; int flag = CH(buf, locPos++); - if ((flag & 0x1) != 0) { + if ((flag & 0x1) != 0 && locPos <= end) { mtime = unixToJavaTime(LG(buf, locPos)); locPos += 4; } - if ((flag & 0x2) != 0) { + if ((flag & 0x2) != 0 && locPos <= end) { atime = unixToJavaTime(LG(buf, locPos)); locPos += 4; } - if ((flag & 0x4) != 0) { + if ((flag & 0x4) != 0 && locPos <= end) { ctime = unixToJavaTime(LG(buf, locPos)); locPos += 4; } From 4b9bc4ffe63ae9019e3f9daf9085a5749acae434 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Fri, 20 Jan 2017 19:12:46 +0530 Subject: [PATCH 57/71] 8172659: PluginException("TargetPlatform attribute is missing ...") - should be ModuleTarget Reviewed-by: alanb, jlaskey --- .../classes/jdk/tools/jlink/builder/DefaultImageBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java index fccb913f4fa..3c2cfbd8e90 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java @@ -162,7 +162,7 @@ public final class DefaultImageBuilder implements ImageBuilder { }); if (this.targetOsName == null) { - throw new PluginException("TargetPlatform attribute is missing for java.base module"); + throw new PluginException("ModuleTarget attribute is missing for java.base module"); } checkResourcePool(files); From 0a56b1da9566a71d677570cdb3d2021834f4604d Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 20 Jan 2017 14:44:17 +0100 Subject: [PATCH 58/71] 8173120: Preserve command line at build failure Reviewed-by: erikj --- make/InitSupport.gmk | 15 ++++++++------- make/common/MakeBase.gmk | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index 77ee2d0da92..92b34d72f02 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2017, 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 @@ -460,27 +460,28 @@ else # $(HAS_SPEC)=true endef define PrintFailureReports - $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*), \ - $(PRINTF) "=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \ - $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*)), \ + $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \ + $(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \ + $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \ $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \ ($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \ if test `$(WC) -l < $(logfile)` -gt 12; then \ $(ECHO) " ... (rest of output omitted)" ; \ fi $(NEWLINE) \ ) \ + $(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \ $(PRINTF) "=== End of repeated output ===\n" \ ) endef define PrintBuildLogFailures if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \ - $(PRINTF) "=== Make failure sequence repeated here ===\n" ; \ + $(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \ $(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \ $(PRINTF) "=== End of repeated output ===\n" ; \ - $(PRINTF) "Hint: Try searching the build log for the name of the first failed target.\n" ; \ + $(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \ else \ - $(PRINTF) "No indication of failed target found.\n" ; \ + $(PRINTF) "\nNo indication of failed target found.\n" ; \ $(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \ fi endef diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 6996ff3712c..dce01ffa060 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2017, 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 @@ -862,6 +862,7 @@ ExecuteWithLog = \ ( $(strip $2) > >($(TEE) $(strip $1).log) 2> >($(TEE) $(strip $1).log >&2) || \ ( exitcode=$(DOLLAR)? && \ $(CP) $(strip $1).log $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).log && \ + $(CP) $(strip $1).cmdline $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).cmdline && \ exit $(DOLLAR)exitcode ) ) ################################################################################ From bef071156dfa68b816143f69ee0cb53045a1525d Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Fri, 20 Jan 2017 08:01:43 -0800 Subject: [PATCH 59/71] 8173083: VarHandle usages in LockSupport and ThreadLocalRandom result in circularity issues Reviewed-by: martin --- .../util/concurrent/ThreadLocalRandom.java | 81 ++++++++----------- .../util/concurrent/locks/LockSupport.java | 42 ++++------ 2 files changed, 50 insertions(+), 73 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java index e42d041a033..e76f2d10597 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java @@ -36,8 +36,6 @@ package java.util.concurrent; import java.io.ObjectStreamField; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; import java.security.AccessControlContext; import java.util.Random; import java.util.Spliterator; @@ -50,6 +48,7 @@ import java.util.stream.DoubleStream; import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.StreamSupport; +import jdk.internal.misc.Unsafe; /** * A random number generator isolated to the current thread. Like the @@ -109,7 +108,7 @@ public class ThreadLocalRandom extends Random { * though, we use only a single 64bit gamma. * * Because this class is in a different package than class Thread, - * field access methods use VarHandles to bypass access control rules. + * field access methods use Unsafe to bypass access control rules. * To conform to the requirements of the Random superclass * constructor, the common static ThreadLocalRandom maintains an * "initialized" field for the sake of rejecting user calls to @@ -164,8 +163,8 @@ public class ThreadLocalRandom extends Random { int probe = (p == 0) ? 1 : p; // skip 0 long seed = mix64(seeder.getAndAdd(SEEDER_INCREMENT)); Thread t = Thread.currentThread(); - SEED.set(t, seed); - PROBE.set(t, probe); + U.putLong(t, SEED, seed); + U.putInt(t, PROBE, probe); } /** @@ -174,7 +173,7 @@ public class ThreadLocalRandom extends Random { * @return the current thread's {@code ThreadLocalRandom} */ public static ThreadLocalRandom current() { - if ((int) PROBE.get(Thread.currentThread()) == 0) + if (U.getInt(Thread.currentThread(), PROBE) == 0) localInit(); return instance; } @@ -193,8 +192,8 @@ public class ThreadLocalRandom extends Random { final long nextSeed() { Thread t; long r; // read and update per-thread seed - SEED.set(t = Thread.currentThread(), - (r = (long) SEED.get(t)) + GAMMA); + U.putLong(t = Thread.currentThread(), SEED, + r = U.getLong(t, SEED) + GAMMA); return r; } @@ -939,7 +938,7 @@ public class ThreadLocalRandom extends Random { * can be used to force initialization on zero return. */ static final int getProbe() { - return (int) PROBE.get(Thread.currentThread()); + return U.getInt(Thread.currentThread(), PROBE); } /** @@ -950,7 +949,7 @@ public class ThreadLocalRandom extends Random { probe ^= probe << 13; // xorshift probe ^= probe >>> 17; probe ^= probe << 5; - PROBE.set(Thread.currentThread(), probe); + U.putInt(Thread.currentThread(), PROBE, probe); return probe; } @@ -960,14 +959,14 @@ public class ThreadLocalRandom extends Random { static final int nextSecondarySeed() { int r; Thread t = Thread.currentThread(); - if ((r = (int) SECONDARY.get(t)) != 0) { + if ((r = U.getInt(t, SECONDARY)) != 0) { r ^= r << 13; // xorshift r ^= r >>> 17; r ^= r << 5; } else if ((r = mix32(seeder.getAndAdd(SEEDER_INCREMENT))) == 0) r = 1; // avoid zero - SECONDARY.set(t, r); + U.putInt(t, SECONDARY, r); return r; } @@ -977,13 +976,13 @@ public class ThreadLocalRandom extends Random { * Erases ThreadLocals by nulling out Thread maps. */ static final void eraseThreadLocals(Thread thread) { - THREADLOCALS.set(thread, null); - INHERITABLETHREADLOCALS.set(thread, null); + U.putObject(thread, THREADLOCALS, null); + U.putObject(thread, INHERITABLETHREADLOCALS, null); } static final void setInheritedAccessControlContext(Thread thread, AccessControlContext acc) { - INHERITEDACCESSCONTROLCONTEXT.setRelease(thread, acc); + U.putObjectRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc); } // Serialization support @@ -1010,7 +1009,7 @@ public class ThreadLocalRandom extends Random { throws java.io.IOException { java.io.ObjectOutputStream.PutField fields = s.putFields(); - fields.put("rnd", (long) SEED.get(Thread.currentThread())); + fields.put("rnd", U.getLong(Thread.currentThread(), SEED)); fields.put("initialized", true); s.writeFields(); } @@ -1049,38 +1048,28 @@ public class ThreadLocalRandom extends Random { static final String BAD_RANGE = "bound must be greater than origin"; static final String BAD_SIZE = "size must be non-negative"; - // VarHandle mechanics - private static final VarHandle SEED; - private static final VarHandle PROBE; - private static final VarHandle SECONDARY; - private static final VarHandle THREADLOCALS; - private static final VarHandle INHERITABLETHREADLOCALS; - private static final VarHandle INHERITEDACCESSCONTROLCONTEXT; + // Unsafe mechanics + private static final Unsafe U = Unsafe.getUnsafe(); + private static final long SEED; + private static final long PROBE; + private static final long SECONDARY; + private static final long THREADLOCALS; + private static final long INHERITABLETHREADLOCALS; + private static final long INHERITEDACCESSCONTROLCONTEXT; static { try { - MethodHandles.Lookup l = java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction<>() { - public MethodHandles.Lookup run() { - try { - return MethodHandles.privateLookupIn(Thread.class, - MethodHandles.lookup()); - } catch (ReflectiveOperationException e) { - throw new Error(e); - } - }}); - SEED = l.findVarHandle(Thread.class, - "threadLocalRandomSeed", long.class); - PROBE = l.findVarHandle(Thread.class, - "threadLocalRandomProbe", int.class); - SECONDARY = l.findVarHandle(Thread.class, - "threadLocalRandomSecondarySeed", int.class); - Class tlm = Class.forName("java.lang.ThreadLocal$ThreadLocalMap"); - THREADLOCALS = l.findVarHandle(Thread.class, - "threadLocals", tlm); - INHERITABLETHREADLOCALS = l.findVarHandle(Thread.class, - "inheritableThreadLocals", tlm); - INHERITEDACCESSCONTROLCONTEXT = l.findVarHandle(Thread.class, - "inheritedAccessControlContext", AccessControlContext.class); + SEED = U.objectFieldOffset + (Thread.class.getDeclaredField("threadLocalRandomSeed")); + PROBE = U.objectFieldOffset + (Thread.class.getDeclaredField("threadLocalRandomProbe")); + SECONDARY = U.objectFieldOffset + (Thread.class.getDeclaredField("threadLocalRandomSecondarySeed")); + THREADLOCALS = U.objectFieldOffset + (Thread.class.getDeclaredField("threadLocals")); + INHERITABLETHREADLOCALS = U.objectFieldOffset + (Thread.class.getDeclaredField("inheritableThreadLocals")); + INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset + (Thread.class.getDeclaredField("inheritedAccessControlContext")); } catch (ReflectiveOperationException e) { throw new Error(e); } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java b/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java index 772318496f7..b1e40a338b9 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java @@ -37,9 +37,6 @@ package java.util.concurrent.locks; import jdk.internal.misc.Unsafe; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - /** * Basic thread blocking primitives for creating locks and other * synchronization classes. @@ -142,7 +139,7 @@ public class LockSupport { private static void setBlocker(Thread t, Object arg) { // Even though volatile, hotspot doesn't need a write barrier here. - THREAD_PARKBLOCKER.set(t, arg); + U.putObject(t, PARKBLOCKER, arg); } /** @@ -292,7 +289,7 @@ public class LockSupport { public static Object getBlocker(Thread t) { if (t == null) throw new NullPointerException(); - return THREAD_PARKBLOCKER.getVolatile(t); + return U.getObjectVolatile(t, PARKBLOCKER); } /** @@ -399,14 +396,14 @@ public class LockSupport { static final int nextSecondarySeed() { int r; Thread t = Thread.currentThread(); - if ((r = (int) THREAD_SECONDARY.get(t)) != 0) { + if ((r = U.getInt(t, SECONDARY)) != 0) { r ^= r << 13; // xorshift r ^= r >>> 17; r ^= r << 5; } else if ((r = java.util.concurrent.ThreadLocalRandom.current().nextInt()) == 0) r = 1; // avoid zero - THREAD_SECONDARY.set(t, r); + U.putInt(t, SECONDARY, r); return r; } @@ -417,32 +414,23 @@ public class LockSupport { * ways that do not preserve unique mappings. */ static final long getThreadId(Thread thread) { - return (long) THREAD_TID.getVolatile(thread); + return U.getLongVolatile(thread, TID); } // Hotspot implementation via intrinsics API private static final Unsafe U = Unsafe.getUnsafe(); - // VarHandle mechanics - private static final VarHandle THREAD_PARKBLOCKER; - private static final VarHandle THREAD_SECONDARY; - private static final VarHandle THREAD_TID; + private static final long PARKBLOCKER; + private static final long SECONDARY; + private static final long TID; static { try { - MethodHandles.Lookup l = java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction<>() { - public MethodHandles.Lookup run() { - try { - return MethodHandles.privateLookupIn(Thread.class, MethodHandles.lookup()); - } catch (ReflectiveOperationException e) { - throw new Error(e); - } - }}); - THREAD_PARKBLOCKER = l.findVarHandle(Thread.class, - "parkBlocker", Object.class); - THREAD_SECONDARY = l.findVarHandle(Thread.class, - "threadLocalRandomSecondarySeed", int.class); - THREAD_TID = l.findVarHandle(Thread.class, - "tid", long.class); + PARKBLOCKER = U.objectFieldOffset + (Thread.class.getDeclaredField("parkBlocker")); + SECONDARY = U.objectFieldOffset + (Thread.class.getDeclaredField("threadLocalRandomSecondarySeed")); + TID = U.objectFieldOffset + (Thread.class.getDeclaredField("tid")); + } catch (ReflectiveOperationException e) { throw new Error(e); } From 45be416036506b1d731cb9bf61dbd43567129505 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Fri, 20 Jan 2017 18:41:12 +0000 Subject: [PATCH 60/71] 8172971: java.management could use System.Logger Java.management is updated to use System.Logger instead of java.util.logging.Logger. Reviewed-by: mchung, rriggs --- .../com/sun/jmx/defaults/JmxProperties.java | 20 +- .../DefaultMBeanServerInterceptor.java | 127 ++-- .../ClassLoaderRepositorySupport.java | 43 +- .../sun/jmx/mbeanserver/JmxMBeanServer.java | 14 +- .../jmx/mbeanserver/MBeanInstantiator.java | 28 +- .../mbeanserver/MBeanServerDelegateImpl.java | 10 +- .../com/sun/jmx/mbeanserver/Repository.java | 26 +- .../com/sun/jmx/remote/util/ClassLogger.java | 160 ++--- .../javax/management/MBeanServerDelegate.java | 6 +- .../javax/management/MBeanServerFactory.java | 17 +- .../javax/management/StandardMBean.java | 19 +- .../loading/DefaultLoaderRepository.java | 12 +- .../javax/management/loading/MLet.java | 167 +++--- .../javax/management/loading/MLetParser.java | 29 +- .../modelmbean/DescriptorSupport.java | 282 ++++----- .../modelmbean/ModelMBeanAttributeInfo.java | 62 +- .../modelmbean/ModelMBeanConstructorInfo.java | 73 +-- .../modelmbean/ModelMBeanInfoSupport.java | 173 ++---- .../ModelMBeanNotificationInfo.java | 51 +- .../modelmbean/ModelMBeanOperationInfo.java | 75 +-- .../modelmbean/RequiredModelMBean.java | 567 ++++++------------ .../management/monitor/CounterMonitor.java | 19 +- .../management/monitor/GaugeMonitor.java | 16 +- .../javax/management/monitor/Monitor.java | 107 ++-- .../management/monitor/StringMonitor.java | 7 +- .../MBeanServerNotificationFilter.java | 61 +- .../management/relation/RelationService.java | 322 ++++------ .../management/relation/RelationSupport.java | 137 ++--- .../relation/RelationTypeSupport.java | 34 +- .../classes/javax/management/timer/Timer.java | 76 +-- .../management/timer/TimerAlarmClock.java | 6 +- .../share/classes/module-info.java | 4 +- .../management/LoggingTest/LoggingTest.java | 109 ++++ .../LoggingTest/LoggingWithJULTest.java | 51 ++ .../LoggingWithLoggerFinderTest.java | 46 ++ .../management/LoggingTest/logging.properties | 55 ++ .../test.loggerfinder/module-info.java | 28 + .../test/loggerfinder/TestLoggerFinder.java | 177 ++++++ 38 files changed, 1500 insertions(+), 1716 deletions(-) create mode 100644 jdk/test/sun/management/LoggingTest/LoggingTest.java create mode 100644 jdk/test/sun/management/LoggingTest/LoggingWithJULTest.java create mode 100644 jdk/test/sun/management/LoggingTest/LoggingWithLoggerFinderTest.java create mode 100644 jdk/test/sun/management/LoggingTest/logging.properties create mode 100644 jdk/test/sun/management/LoggingTest/test.loggerfinder/module-info.java create mode 100644 jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java b/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java index 5c7f7dc3f2d..566d0f9d5cd 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ package com.sun.jmx.defaults; -import java.util.logging.Logger; +import java.lang.System.Logger; /** * This contains the property list defined for this @@ -120,7 +120,7 @@ public class JmxProperties { * Logger for MBean Server information. */ public static final Logger MBEANSERVER_LOGGER = - Logger.getLogger(MBEANSERVER_LOGGER_NAME); + System.getLogger(MBEANSERVER_LOGGER_NAME); /** * Logger name for MLet service information. @@ -132,7 +132,7 @@ public class JmxProperties { * Logger for MLet service information. */ public static final Logger MLET_LOGGER = - Logger.getLogger(MLET_LOGGER_NAME); + System.getLogger(MLET_LOGGER_NAME); /** * Logger name for Monitor information. @@ -144,7 +144,7 @@ public class JmxProperties { * Logger for Monitor information. */ public static final Logger MONITOR_LOGGER = - Logger.getLogger(MONITOR_LOGGER_NAME); + System.getLogger(MONITOR_LOGGER_NAME); /** * Logger name for Timer information. @@ -156,7 +156,7 @@ public class JmxProperties { * Logger for Timer information. */ public static final Logger TIMER_LOGGER = - Logger.getLogger(TIMER_LOGGER_NAME); + System.getLogger(TIMER_LOGGER_NAME); /** * Logger name for Event Management information. @@ -168,7 +168,7 @@ public class JmxProperties { * Logger for Event Management information. */ public static final Logger NOTIFICATION_LOGGER = - Logger.getLogger(NOTIFICATION_LOGGER_NAME); + System.getLogger(NOTIFICATION_LOGGER_NAME); /** * Logger name for Relation Service. @@ -180,7 +180,7 @@ public class JmxProperties { * Logger for Relation Service. */ public static final Logger RELATION_LOGGER = - Logger.getLogger(RELATION_LOGGER_NAME); + System.getLogger(RELATION_LOGGER_NAME); /** * Logger name for Model MBean. @@ -192,7 +192,7 @@ public class JmxProperties { * Logger for Model MBean. */ public static final Logger MODELMBEAN_LOGGER = - Logger.getLogger(MODELMBEAN_LOGGER_NAME); + System.getLogger(MODELMBEAN_LOGGER_NAME); /** * Logger name for all other JMX classes. @@ -204,5 +204,5 @@ public class JmxProperties { * Logger for all other JMX classes. */ public static final Logger MISC_LOGGER = - Logger.getLogger(MISC_LOGGER_NAME); + System.getLogger(MISC_LOGGER_NAME); } diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java index 350eb0218a0..b6a5b53b703 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -50,7 +50,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.WeakHashMap; -import java.util.logging.Level; +import java.lang.System.Logger.Level; // JMX import import javax.management.Attribute; @@ -258,19 +258,16 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { /* Load the appropriate class. */ if (withDefaultLoaderRepository) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "createMBean", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ClassName = " + className + ", ObjectName = " + name); } theClass = instantiator.findClassWithDefaultLoaderRepository(className); } else if (loaderName == null) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "createMBean", "ClassName = " + className + + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + "ClassName = " + className + ", ObjectName = " + name + ", Loader name = null"); } @@ -279,10 +276,9 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { } else { loaderName = nonDefaultDomain(loaderName); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "createMBean", "ClassName = " + className + + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + "ClassName = " + className + ", ObjectName = " + name + ", Loader name = " + loaderName); } @@ -633,10 +629,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { name = nonDefaultDomain(name); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "getAttribute", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "Attribute = " + attribute + ", ObjectName = " + name); } @@ -670,10 +664,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { name = nonDefaultDomain(name); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "getAttributes", "ObjectName = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name); } final DynamicMBean instance = getMBean(name); @@ -732,10 +724,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { name = nonDefaultDomain(name); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "setAttribute", "ObjectName = " + name + + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name + ", Attribute = " + attribute.getName()); } @@ -910,10 +900,9 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { name = nonDefaultDomain(name); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "registerMBean", "ObjectName = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + "ObjectName = " + name); } ObjectName logicalName = preRegister(mbean, server, name); @@ -1023,14 +1012,14 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { if (mbean instanceof MBeanRegistration) ((MBeanRegistration) mbean).postRegister(registrationDone); } catch (RuntimeException e) { - MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+ + MBEANSERVER_LOGGER.log(Level.DEBUG, "While registering MBean ["+logicalName+ "]: " + "Exception thrown by postRegister: " + "rethrowing <"+e+">, but keeping the MBean registered"); throw new RuntimeMBeanException(e, "RuntimeException thrown in postRegister method: "+ "rethrowing <"+e+">, but keeping the MBean registered"); } catch (Error er) { - MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+ + MBEANSERVER_LOGGER.log(Level.DEBUG, "While registering MBean ["+logicalName+ "]: " + "Error thrown by postRegister: " + "rethrowing <"+er+">, but keeping the MBean registered"); throw new RuntimeErrorException(er, @@ -1053,7 +1042,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { try { moi.postDeregister(); } catch (RuntimeException e) { - MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+ + MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+ "]: " + "Exception thrown by postDeregister: " + "rethrowing <"+e+">, although the MBean is succesfully " + "unregistered"); @@ -1062,7 +1051,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { "rethrowing <"+e+ ">, although the MBean is sucessfully unregistered"); } catch (Error er) { - MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+ + MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+ "]: " + "Error thrown by postDeregister: " + "rethrowing <"+er+">, although the MBean is succesfully " + "unregistered"); @@ -1087,10 +1076,9 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { } DynamicMBean obj = repository.retrieve(name); if (obj == null) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "getMBean", name + " : Found no object"); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + name + " : Found no object"); } throw new InstanceNotFoundException(name.toString()); } @@ -1176,10 +1164,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { // ------------------------------ // ------------------------------ - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "addNotificationListener", "ObjectName = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name); } DynamicMBean instance = getMBean(name); @@ -1226,10 +1212,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { // ---------------- // Add a listener on an MBean // ---------------- - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "addNotificationListener", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name + ", Listener = " + listener); } server.addNotificationListener(name,(NotificationListener) resource, @@ -1255,10 +1239,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { throws InstanceNotFoundException, ListenerNotFoundException { NotificationListener instance = getListener(listener); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "removeNotificationListener", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name + ", Listener = " + listener); } server.removeNotificationListener(name, instance); @@ -1272,10 +1254,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { NotificationListener instance = getListener(listener); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "removeNotificationListener", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name + ", Listener = " + listener); } server.removeNotificationListener(name, instance, filter, handback); @@ -1313,10 +1293,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { boolean removeAll) throws InstanceNotFoundException, ListenerNotFoundException { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "removeNotificationListener", "ObjectName = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name); } DynamicMBean instance = getMBean(name); @@ -1421,10 +1399,9 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { return classNameClass.isAssignableFrom(resourceClass); } catch (Exception x) { /* Could be SecurityException or ClassNotFoundException */ - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - DefaultMBeanServerInterceptor.class.getName(), - "isInstanceOf", "Exception calling isInstanceOf", x); + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, + "Exception calling isInstanceOf", x); } return false; } @@ -1489,10 +1466,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { MBeanServerNotification notif = new MBeanServerNotification( NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "sendNotification", NotifType + " " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, NotifType + " " + name); } delegate.sendNotification(notif); @@ -1594,10 +1569,8 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { try { return getClassName(mbean); } catch (Exception e) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - DefaultMBeanServerInterceptor.class.getName(), - "safeGetClassName", + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, "Exception getting MBean class name", e); } return null; @@ -1885,10 +1858,9 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { // --------------------- // Send create event // --------------------- - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "addObject", "Send create notification of object " + + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + "Send create notification of object " + logicalName.getCanonicalName()); } @@ -1926,10 +1898,9 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor { // --------------------- // Send deletion event // --------------------- - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - DefaultMBeanServerInterceptor.class.getName(), - "unregisterMBean", "Send delete notification of object " + + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + "Send delete notification of object " + logicalName.getCanonicalName()); } diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java index 1d76705e581..9cc7721659d 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ import java.util.Arrays; import java.util.Hashtable; import java.util.List; import java.util.Map; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.MBeanPermission; import javax.management.ObjectName; @@ -148,10 +148,9 @@ final class ClassLoaderRepositorySupport // from javax.management.loading.DefaultLoaderRepository public final Class loadClassWithout(ClassLoader without, String className) throws ClassNotFoundException { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - ClassLoaderRepositorySupport.class.getName(), - "loadClassWithout", className + " without " + without); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + className + " without " + without); } // without is null => just behave as loadClass @@ -172,10 +171,9 @@ final class ClassLoaderRepositorySupport public final Class loadClassBefore(ClassLoader stop, String className) throws ClassNotFoundException { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - ClassLoaderRepositorySupport.class.getName(), - "loadClassBefore", className + " before " + stop); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + className + " before " + stop); } if (stop == null) @@ -206,10 +204,8 @@ final class ClassLoaderRepositorySupport continue; if (cl == stop) break; - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - ClassLoaderRepositorySupport.class.getName(), - "loadClass", "Trying loader = " + cl); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "Trying loader = " + cl); } /* We used to have a special case for "instanceof MLet" here, where we invoked the method @@ -239,10 +235,9 @@ final class ClassLoaderRepositorySupport // List excluded = search.get(className); if ((excluded!= null) && (excluded.contains(aloader))) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - ClassLoaderRepositorySupport.class.getName(), - "startValidSearch", "Already requested loader = " + + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, + "Already requested loader = " + aloader + " class = " + className); } throw new ClassNotFoundException(className); @@ -255,10 +250,8 @@ final class ClassLoaderRepositorySupport search.put(className, excluded); } excluded.add(aloader); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - ClassLoaderRepositorySupport.class.getName(), - "startValidSearch", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "loader = " + aloader + " class = " + className); } } @@ -271,10 +264,8 @@ final class ClassLoaderRepositorySupport List excluded = search.get(className); if (excluded != null) { excluded.remove(aloader); - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, - ClassLoaderRepositorySupport.class.getName(), - "stopValidSearch", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "loader = " + aloader + " class = " + className); } } diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java index b7f1444acaf..4e63cb36d0e 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -36,7 +36,7 @@ import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.util.List; import java.util.Set; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Attribute; import javax.management.AttributeList; @@ -1229,16 +1229,14 @@ public final class JmxMBeanServer } }); } catch (SecurityException e) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - JmxMBeanServer.class.getName(), "initialize", + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, "Unexpected security exception occurred", e); } throw e; } catch (Exception e) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - JmxMBeanServer.class.getName(), "initialize", + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, "Unexpected exception occurred", e); } throw new diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java index 38740044f76..2a99a3b9b0a 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -40,7 +40,7 @@ import java.security.Permissions; import java.security.PrivilegedAction; import java.security.ProtectionDomain; import java.util.Map; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.InstanceNotFoundException; import javax.management.MBeanException; @@ -186,19 +186,15 @@ public class MBeanInstantiator { } } } catch (ClassNotFoundException e) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - MBeanInstantiator.class.getName(), - "findSignatureClasses", + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, "The parameter class could not be found", e); } throw new ReflectionException(e, "The parameter class could not be found"); } catch (RuntimeException e) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - MBeanInstantiator.class.getName(), - "findSignatureClasses", + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, "Unexpected exception", e); } throw e; @@ -696,19 +692,15 @@ public class MBeanInstantiator { tab[i] = Class.forName(signature[i], false, aLoader); } } catch (ClassNotFoundException e) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - MBeanInstantiator.class.getName(), - "findSignatureClasses", + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, "The parameter class could not be found", e); } throw new ReflectionException(e, "The parameter class could not be found"); } catch (RuntimeException e) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - MBeanInstantiator.class.getName(), - "findSignatureClasses", + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { + MBEANSERVER_LOGGER.log(Level.DEBUG, "Unexpected exception", e); } throw e; diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java index f4fdc827be5..fc9a4ad10f4 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -24,7 +24,7 @@ */ package com.sun.jmx.mbeanserver; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Attribute; import javax.management.AttributeList; @@ -244,10 +244,8 @@ final class MBeanServerDelegateImpl } catch (Exception x) { // Skip the attribute that couldn't be obtained. // - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { - MBEANSERVER_LOGGER.logp(Level.FINEST, - MBeanServerDelegateImpl.class.getName(), - "getAttributes", + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "Attribute " + attn[i] + " not found"); } } diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java index 4693a44ae11..bbab04fc880 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -34,7 +34,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import java.util.Map; import java.util.Set; import javax.management.DynamicMBean; @@ -264,7 +264,7 @@ public class Repository { context.unregistered(); } catch (Exception x) { // shouldn't come here... - MBEANSERVER_LOGGER.log(Level.FINE, + MBEANSERVER_LOGGER.log(Level.DEBUG, "Unexpected exception while unregistering "+name, x); } @@ -385,9 +385,8 @@ public class Repository { final RegistrationContext context) throws InstanceAlreadyExistsException { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(), - "addMBean", "name = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name); } // Extract the domain name. @@ -456,9 +455,8 @@ public class Repository { * false otherwise. */ public boolean contains(ObjectName name) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(), - "contains", " name = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name); } lock.readLock().lock(); try { @@ -478,9 +476,8 @@ public class Repository { * null otherwise. */ public DynamicMBean retrieve(ObjectName name) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(), - "retrieve", "name = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name); } // Calls internal retrieve method to get the named object @@ -609,9 +606,8 @@ public class Repository { throws InstanceNotFoundException { // Debugging stuff - if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { - MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(), - "remove", "name = " + name); + if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) { + MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name); } // Extract domain name. diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/ClassLogger.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/ClassLogger.java index a0f7a4c1c8e..91d8cbc9de3 100644 --- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/ClassLogger.java +++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/ClassLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,222 +25,188 @@ package com.sun.jmx.remote.util; -import java.util.logging.Logger; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; +import java.util.ResourceBundle; -public class ClassLogger { +public class ClassLogger implements System.Logger { - private static final boolean ok; private final String className; private final Logger logger; - static { - /* We attempt to work even if we are running in J2SE 1.3, where - there is no java.util.logging. The technique we use here is - not strictly portable, but it does work with Sun's J2SE 1.3 - at least. This is just a best effort: the Right Thing is for - people to use at least J2SE 1.4. */ - boolean loaded = false; - try { - Class c = java.util.logging.Logger.class; - loaded = true; - } catch (Error e) { - // OK. - // java.util.logger package is not available in this jvm. - } - ok = loaded; - } - public ClassLogger(String subsystem, String className) { - if (ok) - logger = Logger.getLogger(subsystem); - else - logger = null; + logger = System.getLogger(subsystem); this.className = className; } public final boolean traceOn() { - return finerOn(); + return logger.isLoggable(Level.TRACE); } public final boolean debugOn() { - return finestOn(); + return logger.isLoggable(Level.DEBUG); } public final boolean warningOn() { - return ok && logger.isLoggable(java.util.logging.Level.WARNING); + return logger.isLoggable(Level.WARNING); } public final boolean infoOn() { - return ok && logger.isLoggable(java.util.logging.Level.INFO); + return logger.isLoggable(Level.INFO); } public final boolean configOn() { - return ok && logger.isLoggable(java.util.logging.Level.CONFIG); + return logger.isLoggable(Level.DEBUG); } public final boolean fineOn() { - return ok && logger.isLoggable(java.util.logging.Level.FINE); + return logger.isLoggable(Level.DEBUG); } public final boolean finerOn() { - return ok && logger.isLoggable(java.util.logging.Level.FINER); + return logger.isLoggable(Level.TRACE); } public final boolean finestOn() { - return ok && logger.isLoggable(java.util.logging.Level.FINEST); + return logger.isLoggable(Level.TRACE); } public final void debug(String func, String msg) { - finest(func,msg); + logger.log(Level.DEBUG, msg); } public final void debug(String func, Throwable t) { - finest(func,t); + logger.log(Level.DEBUG, className + "::" + func, t); } public final void debug(String func, String msg, Throwable t) { - finest(func,msg,t); + logger.log(Level.DEBUG, msg, t); } public final void trace(String func, String msg) { - finer(func,msg); + logger.log(Level.TRACE, msg); } public final void trace(String func, Throwable t) { - finer(func,t); + logger.log(Level.TRACE, className + "::" + func, t); } public final void trace(String func, String msg, Throwable t) { - finer(func,msg,t); + logger.log(Level.TRACE, msg, t); } public final void error(String func, String msg) { - severe(func,msg); + logger.log(Level.ERROR, msg); } public final void error(String func, Throwable t) { - severe(func,t); + logger.log(Level.ERROR, className + "::" + func, t); } public final void error(String func, String msg, Throwable t) { - severe(func,msg,t); + logger.log(Level.ERROR, msg, t); } public final void finest(String func, String msg) { - if (ok) - logger.logp(java.util.logging.Level.FINEST, className, func, msg); + logger.log(Level.TRACE, msg); } public final void finest(String func, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.FINEST, className, func, - t.toString(), t); + logger.log(Level.TRACE, className + "::" + func, t); } public final void finest(String func, String msg, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.FINEST, className, func, msg, - t); + logger.log(Level.TRACE, msg, t); } public final void finer(String func, String msg) { - if (ok) - logger.logp(java.util.logging.Level.FINER, className, func, msg); + logger.log(Level.TRACE, msg); } public final void finer(String func, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.FINER, className, func, - t.toString(), t); + logger.log(Level.TRACE, className + "::" + func, t); } public final void finer(String func, String msg, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.FINER, className, func, msg,t); + logger.log(Level.DEBUG, msg, t); } public final void fine(String func, String msg) { - if (ok) - logger.logp(java.util.logging.Level.FINE, className, func, msg); + logger.log(Level.DEBUG, msg); } public final void fine(String func, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.FINE, className, func, - t.toString(), t); + logger.log(Level.DEBUG, className + "::" + func, t); } public final void fine(String func, String msg, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.FINE, className, func, msg, - t); + logger.log(Level.DEBUG, msg, t); } public final void config(String func, String msg) { - if (ok) - logger.logp(java.util.logging.Level.CONFIG, className, func, msg); + logger.log(Level.DEBUG, msg); } public final void config(String func, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.CONFIG, className, func, - t.toString(), t); + logger.log(Level.DEBUG, className + "::" + func, t); } public final void config(String func, String msg, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.CONFIG, className, func, msg, - t); + logger.log(Level.DEBUG, msg, t); } public final void info(String func, String msg) { - if (ok) - logger.logp(java.util.logging.Level.INFO, className, func, msg); + logger.log(Level.INFO, msg); } public final void info(String func, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.INFO, className, func, - t.toString(), t); + logger.log(Level.INFO, className + "::" + func, t); } public final void info(String func, String msg, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.INFO, className, func, msg, - t); + logger.log(Level.INFO, msg, t); } public final void warning(String func, String msg) { - if (ok) - logger.logp(java.util.logging.Level.WARNING, className, func, msg); + logger.log(Level.WARNING, msg); } public final void warning(String func, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.WARNING, className, func, - t.toString(), t); + logger.log(Level.WARNING, className + "::" + func, t); } public final void warning(String func, String msg, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.WARNING, className, func, msg, - t); + logger.log(Level.WARNING, msg, t); } public final void severe(String func, String msg) { - if (ok) - logger.logp(java.util.logging.Level.SEVERE, className, func, msg); + logger.log(Level.ERROR, msg); } public final void severe(String func, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.SEVERE, className, func, - t.toString(), t); + logger.log(Level.ERROR, className + "::" + func, t); } public final void severe(String func, String msg, Throwable t) { - if (ok) - logger.logp(java.util.logging.Level.SEVERE, className, func, msg, - t); + logger.log(Level.ERROR, msg, t); } + + public final String getName() { + return logger.getName(); + } + + public final boolean isLoggable(Level level) { + return logger.isLoggable(level); + } + + public final void log(Level level, ResourceBundle bundle, String msg, + Throwable thrown) { + logger.log(level, bundle, msg, thrown); + } + + public final void log(Level level, ResourceBundle bundle, String format, + Object... params) { + logger.log(level, bundle, format, params); + } + } diff --git a/jdk/src/java.management/share/classes/javax/management/MBeanServerDelegate.java b/jdk/src/java.management/share/classes/javax/management/MBeanServerDelegate.java index b9db8a1b7f0..443e9a7a06c 100644 --- a/jdk/src/java.management/share/classes/javax/management/MBeanServerDelegate.java +++ b/jdk/src/java.management/share/classes/javax/management/MBeanServerDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ package javax.management; +import java.lang.System.Logger.Level; import com.sun.jmx.defaults.JmxProperties; import com.sun.jmx.defaults.ServiceName; import com.sun.jmx.mbeanserver.Util; @@ -84,7 +85,8 @@ public class MBeanServerDelegate implements MBeanServerDelegateMBean, try { localHost = java.net.InetAddress.getLocalHost().getHostName(); } catch (java.net.UnknownHostException e) { - JmxProperties.MISC_LOGGER.finest("Can't get local host name, " + + JmxProperties.MISC_LOGGER.log(Level.TRACE, + "Can't get local host name, " + "using \"localhost\" instead. Cause is: "+e); localHost = "localhost"; } diff --git a/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java b/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java index 756811a072f..1d4fc131169 100644 --- a/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java +++ b/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -32,7 +32,7 @@ import com.sun.jmx.mbeanserver.GetPropertyAction; import java.security.AccessController; import java.security.Permission; import java.util.ArrayList; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.loading.ClassLoaderRepository; import sun.reflect.misc.ReflectUtil; @@ -399,7 +399,7 @@ public class MBeanServerFactory { return (String) mbs.getAttribute(MBeanServerDelegate.DELEGATE_NAME, "MBeanServerId"); } catch (JMException e) { - JmxProperties.MISC_LOGGER.finest( + JmxProperties.MISC_LOGGER.log(Level.TRACE, "Ignoring exception while getting MBeanServerId: "+e); return null; } @@ -421,9 +421,7 @@ public class MBeanServerFactory { private static synchronized void removeMBeanServer(MBeanServer mbs) { boolean removed = mBeanServerList.remove(mbs); if (!removed) { - MBEANSERVER_LOGGER.logp(Level.FINER, - MBeanServerFactory.class.getName(), - "removeMBeanServer(MBeanServer)", + MBEANSERVER_LOGGER.log(Level.TRACE, "MBeanServer was not in list!"); throw new IllegalArgumentException("MBeanServer was not in list!"); } @@ -504,15 +502,12 @@ public class MBeanServerFactory { throw new JMRuntimeException(msg, x); } } catch (RuntimeException x) { - if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { + if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) { StringBuilder strb = new StringBuilder() .append("Failed to instantiate MBeanServerBuilder: ").append(x) .append("\n\t\tCheck the value of the ") .append(JMX_INITIAL_BUILDER).append(" property."); - MBEANSERVER_LOGGER.logp(Level.FINEST, - MBeanServerFactory.class.getName(), - "checkMBeanServerBuilder", - strb.toString()); + MBEANSERVER_LOGGER.log(Level.DEBUG, strb::toString); } throw x; } diff --git a/jdk/src/java.management/share/classes/javax/management/StandardMBean.java b/jdk/src/java.management/share/classes/javax/management/StandardMBean.java index 42affd8b96e..e908836b0b8 100644 --- a/jdk/src/java.management/share/classes/javax/management/StandardMBean.java +++ b/jdk/src/java.management/share/classes/javax/management/StandardMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Map; import java.util.WeakHashMap; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.openmbean.OpenMBeanAttributeInfo; import javax.management.openmbean.OpenMBeanAttributeInfoSupport; import javax.management.openmbean.OpenMBeanConstructorInfo; @@ -432,16 +432,14 @@ public class StandardMBean implements DynamicMBean, MBeanRegistration { final MBeanInfo cached = getCachedMBeanInfo(); if (cached != null) return cached; } catch (RuntimeException x) { - if (MISC_LOGGER.isLoggable(Level.FINEST)) { - MISC_LOGGER.logp(Level.FINEST, - MBeanServerFactory.class.getName(), "getMBeanInfo", + if (MISC_LOGGER.isLoggable(Level.DEBUG)) { + MISC_LOGGER.log(Level.DEBUG, "Failed to get cached MBeanInfo", x); } } - if (MISC_LOGGER.isLoggable(Level.FINER)) { - MISC_LOGGER.logp(Level.FINER, - MBeanServerFactory.class.getName(), "getMBeanInfo", + if (MISC_LOGGER.isLoggable(Level.TRACE)) { + MISC_LOGGER.log(Level.TRACE, "Building MBeanInfo for " + getImplementationClass().getName()); } @@ -465,9 +463,8 @@ public class StandardMBean implements DynamicMBean, MBeanRegistration { try { cacheMBeanInfo(nmbi); } catch (RuntimeException x) { - if (MISC_LOGGER.isLoggable(Level.FINEST)) { - MISC_LOGGER.logp(Level.FINEST, - MBeanServerFactory.class.getName(), "getMBeanInfo", + if (MISC_LOGGER.isLoggable(Level.DEBUG)) { + MISC_LOGGER.log(Level.DEBUG, "Failed to cache MBeanInfo", x); } } diff --git a/jdk/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java b/jdk/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java index 5cf3ad143b2..b7cee08cbe7 100644 --- a/jdk/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java +++ b/jdk/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,7 +28,7 @@ package javax.management.loading; import static com.sun.jmx.defaults.JmxProperties.MBEANSERVER_LOGGER; import java.util.Iterator; import java.util.List; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; @@ -71,9 +71,7 @@ public class DefaultLoaderRepository { */ public static Class loadClass(String className) throws ClassNotFoundException { - MBEANSERVER_LOGGER.logp(Level.FINEST, - DefaultLoaderRepository.class.getName(), - "loadClass", className); + MBEANSERVER_LOGGER.log(Level.TRACE, className); return load(null, className); } @@ -96,9 +94,7 @@ public class DefaultLoaderRepository { public static Class loadClassWithout(ClassLoader loader, String className) throws ClassNotFoundException { - MBEANSERVER_LOGGER.logp(Level.FINEST, - DefaultLoaderRepository.class.getName(), - "loadClassWithout", className); + MBEANSERVER_LOGGER.log(Level.TRACE, className); return load(loader, className); } diff --git a/jdk/src/java.management/share/classes/javax/management/loading/MLet.java b/jdk/src/java.management/share/classes/javax/management/loading/MLet.java index 1a3fb18527b..500b773abf7 100644 --- a/jdk/src/java.management/share/classes/javax/management/loading/MLet.java +++ b/jdk/src/java.management/share/classes/javax/management/loading/MLet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -52,7 +52,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; @@ -412,9 +412,8 @@ public class MLet extends java.net.URLClassLoader if (!Arrays.asList(getURLs()).contains(ur)) super.addURL(ur); } catch (MalformedURLException e) { - if (MLET_LOGGER.isLoggable(Level.FINEST)) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "addUrl", "Malformed URL: " + url, e); + if (MLET_LOGGER.isLoggable(Level.DEBUG)) { + MLET_LOGGER.log(Level.DEBUG, "Malformed URL: " + url, e); } throw new ServiceNotFoundException("The specified URL is malformed"); @@ -481,23 +480,19 @@ public class MLet extends java.net.URLClassLoader public Set getMBeansFromURL(String url) throws ServiceNotFoundException { - String mth = "getMBeansFromURL"; - if (server == null) { throw new IllegalStateException("This MLet MBean is not " + "registered with an MBeanServer."); } // Parse arguments if (url == null) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), - mth, "URL is null"); + MLET_LOGGER.log(Level.TRACE, "URL is null"); throw new ServiceNotFoundException("The specified URL is null"); } else { url = url.replace(File.separatorChar,'/'); } - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), - mth, ""); + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, ""); } // Parse URL @@ -508,7 +503,7 @@ public class MLet extends java.net.URLClassLoader final String msg = "Problems while parsing URL [" + url + "], got exception [" + e.toString() + "]"; - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg); + MLET_LOGGER.log(Level.TRACE, msg); throw EnvHelp.initCause(new ServiceNotFoundException(msg), e); } @@ -516,7 +511,7 @@ public class MLet extends java.net.URLClassLoader if (mletList.size() == 0) { final String msg = "File " + url + " not found or MLET tag not defined in file"; - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg); + MLET_LOGGER.log(Level.TRACE, msg); throw new ServiceNotFoundException(msg); } @@ -538,7 +533,7 @@ public class MLet extends java.net.URLClassLoader URL documentBase = elmt.getDocumentBase(); // Display debug information - if (MLET_LOGGER.isLoggable(Level.FINER)) { + if (MLET_LOGGER.isLoggable(Level.TRACE)) { final StringBuilder strb = new StringBuilder() .append("\n\tMLET TAG = ").append(elmt.getAttributes()) .append("\n\tCODEBASE = ").append(codebase) @@ -548,16 +543,15 @@ public class MLet extends java.net.URLClassLoader .append("\n\tNAME = ").append(name) .append("\n\tVERSION = ").append(version) .append("\n\tDOCUMENT URL = ").append(documentBase); - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), - mth, strb.toString()); + MLET_LOGGER.log(Level.TRACE, strb::toString); } // Load classes from JAR files StringTokenizer st = new StringTokenizer(jarFiles, ",", false); while (st.hasMoreTokens()) { String tok = st.nextToken().trim(); - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "Load archive for codebase <" + codebase + ">, file <" + tok + ">"); } @@ -570,8 +564,8 @@ public class MLet extends java.net.URLClassLoader try { codebase = check(version, codebase, tok, elmt); } catch (Exception ex) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - mth, "Got unexpected exception", ex); + MLET_LOGGER.log(Level.DEBUG, + "Got unexpected exception", ex); mbeans.add(ex); continue; } @@ -599,7 +593,7 @@ public class MLet extends java.net.URLClassLoader final String msg = "CODE and OBJECT parameters cannot be specified at the " + "same time in tag MLET"; - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg); + MLET_LOGGER.log(Level.TRACE, msg); mbeans.add(new Error(msg)); continue; } @@ -607,7 +601,7 @@ public class MLet extends java.net.URLClassLoader final String msg = "Either CODE or OBJECT parameter must be specified in " + "tag MLET"; - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg); + MLET_LOGGER.log(Level.TRACE, msg); mbeans.add(new Error(msg)); continue; } @@ -635,7 +629,7 @@ public class MLet extends java.net.URLClassLoader Object[] parms = objectPars.toArray(); String[] signature = new String[signat.size()]; signat.toArray(signature); - if (MLET_LOGGER.isLoggable(Level.FINEST)) { + if (MLET_LOGGER.isLoggable(Level.TRACE)) { final StringBuilder strb = new StringBuilder(); for (int i = 0; i < signature.length; i++) { strb.append("\n\tSignature = ") @@ -643,9 +637,7 @@ public class MLet extends java.net.URLClassLoader .append("\t\nParams = ") .append(parms[i]); } - MLET_LOGGER.logp(Level.FINEST, - MLet.class.getName(), - mth, strb.toString()); + MLET_LOGGER.log(Level.TRACE, strb::toString); } if (name == null) { objInst = @@ -668,53 +660,46 @@ public class MLet extends java.net.URLClassLoader objInst = new ObjectInstance(name, o.getClass().getName()); } } catch (ReflectionException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, - "ReflectionException", ex); + MLET_LOGGER.log(Level.TRACE, "ReflectionException", ex); mbeans.add(ex); continue; } catch (InstanceAlreadyExistsException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + MLET_LOGGER.log(Level.TRACE, "InstanceAlreadyExistsException", ex); mbeans.add(ex); continue; } catch (MBeanRegistrationException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, - "MBeanRegistrationException", ex); + MLET_LOGGER.log(Level.TRACE, "MBeanRegistrationException", ex); mbeans.add(ex); continue; } catch (MBeanException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, - "MBeanException", ex); + MLET_LOGGER.log(Level.TRACE, "MBeanException", ex); mbeans.add(ex); continue; } catch (NotCompliantMBeanException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + MLET_LOGGER.log(Level.TRACE, "NotCompliantMBeanException", ex); mbeans.add(ex); continue; } catch (InstanceNotFoundException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + MLET_LOGGER.log(Level.TRACE, "InstanceNotFoundException", ex); mbeans.add(ex); continue; } catch (IOException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, - "IOException", ex); + MLET_LOGGER.log(Level.TRACE, "IOException", ex); mbeans.add(ex); continue; } catch (SecurityException ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, - "SecurityException", ex); + MLET_LOGGER.log(Level.TRACE, "SecurityException", ex); mbeans.add(ex); continue; } catch (Exception ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, - "Exception", ex); + MLET_LOGGER.log(Level.TRACE, "Exception", ex); mbeans.add(ex); continue; } catch (Error ex) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, - "Error", ex); + MLET_LOGGER.log(Level.TRACE, "Error", ex); mbeans.add(ex); continue; } @@ -937,20 +922,18 @@ public class MLet extends java.net.URLClassLoader Class findClass(String name, ClassLoaderRepository clr) throws ClassNotFoundException { Class c = null; - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), "findClass", name); + MLET_LOGGER.log(Level.TRACE, name); // Try looking in the JAR: try { c = super.findClass(name); - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), - "findClass", + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "Class " + name + " loaded through MLet classloader"); } } catch (ClassNotFoundException e) { // Drop through - if (MLET_LOGGER.isLoggable(Level.FINEST)) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "findClass", + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "Class " + name + " not found locally"); } } @@ -959,32 +942,28 @@ public class MLet extends java.net.URLClassLoader // Try the classloader repository: // try { - if (MLET_LOGGER.isLoggable(Level.FINEST)) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "findClass", + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "Class " + name + " : looking in CLR"); } c = clr.loadClassBefore(this, name); // The loadClassBefore method never returns null. // If the class is not found we get an exception. - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), - "findClass", + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "Class " + name + " loaded through " + "the default classloader repository"); } } catch (ClassNotFoundException e) { // Drop through - if (MLET_LOGGER.isLoggable(Level.FINEST)) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "findClass", + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "Class " + name + " not found in CLR"); } } } if (c == null) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "findClass", "Failed to load class " + name); + MLET_LOGGER.log(Level.TRACE, "Failed to load class " + name); throw new ClassNotFoundException(name); } return c; @@ -1041,8 +1020,8 @@ public class MLet extends java.net.URLClassLoader // // See if the native library is accessible as a resource through the JAR file. // - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "Search " + libname + " in all JAR files"); } @@ -1051,14 +1030,14 @@ public class MLet extends java.net.URLClassLoader // for "foo" on Solaris SPARC 5.7 we try to load "libfoo.so" // from the JAR file. // - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "loadLibraryAsResource(" + nativelibname + ")"); } abs_path = loadLibraryAsResource(nativelibname); if (abs_path != null) { - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, nativelibname + " loaded, absolute path = " + abs_path); } return abs_path; @@ -1073,15 +1052,15 @@ public class MLet extends java.net.URLClassLoader removeSpace(System.getProperty("os.arch")) + File.separator + removeSpace(System.getProperty("os.version")) + File.separator + "lib" + File.separator + nativelibname; - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, "loadLibraryAsResource(" + nativelibname + ")"); } abs_path = loadLibraryAsResource(nativelibname); if (abs_path != null) { - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, nativelibname + " loaded, absolute path = " + abs_path); } return abs_path; @@ -1091,10 +1070,10 @@ public class MLet extends java.net.URLClassLoader // All paths exhausted, library not found in JAR file. // - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, libname + " not found in any JAR file"); - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, + MLET_LOGGER.log(Level.TRACE, "Search " + libname + " along the path " + "specified as the java.library.path property"); } @@ -1127,8 +1106,8 @@ public class MLet extends java.net.URLClassLoader if (tmpDirFile == null) return null; return tmpDirFile.getAbsolutePath(); } catch (Exception x) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "getTmpDir", "Failed to determine system temporary dir"); + MLET_LOGGER.log(Level.DEBUG, + "Failed to determine system temporary dir"); return null; } finally { // Cleanup ... @@ -1136,12 +1115,12 @@ public class MLet extends java.net.URLClassLoader try { boolean deleted = tmpFile.delete(); if (!deleted) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "getTmpDir", "Failed to delete temp file"); + MLET_LOGGER.log(Level.DEBUG, + "Failed to delete temp file"); } } catch (Exception x) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "getTmpDir", "Failed to delete temporary file", x); + MLET_LOGGER.log(Level.DEBUG, + "Failed to delete temporary file", x); } } } @@ -1183,8 +1162,7 @@ public class MLet extends java.net.URLClassLoader } } } catch (Exception e) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "loadLibraryAsResource", + MLET_LOGGER.log(Level.DEBUG, "Failed to load library : " + libname, e); return null; } @@ -1248,9 +1226,8 @@ public class MLet extends java.net.URLClassLoader if (filename != null) { filename = filename.replace(File.separatorChar,'/'); } - if (MLET_LOGGER.isLoggable(Level.FINER)) { - MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), - "loadSerializedObject", codebase.toString() + filename); + if (MLET_LOGGER.isLoggable(Level.TRACE)) { + MLET_LOGGER.log(Level.TRACE, codebase.toString() + filename); } InputStream is = getResourceAsStream(filename); if (is != null) { @@ -1260,24 +1237,21 @@ public class MLet extends java.net.URLClassLoader ois.close(); return serObject; } catch (IOException e) { - if (MLET_LOGGER.isLoggable(Level.FINEST)) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "loadSerializedObject", + if (MLET_LOGGER.isLoggable(Level.DEBUG)) { + MLET_LOGGER.log(Level.DEBUG, "Exception while deserializing " + filename, e); } throw e; } catch (ClassNotFoundException e) { - if (MLET_LOGGER.isLoggable(Level.FINEST)) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "loadSerializedObject", + if (MLET_LOGGER.isLoggable(Level.DEBUG)) { + MLET_LOGGER.log(Level.DEBUG, "Exception while deserializing " + filename, e); } throw e; } } else { - if (MLET_LOGGER.isLoggable(Level.FINEST)) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "loadSerializedObject", "Error: File " + filename + + if (MLET_LOGGER.isLoggable(Level.DEBUG)) { + MLET_LOGGER.log(Level.DEBUG, "Error: File " + filename + " containing serialized object not found"); } throw new Error("File " + filename + " containing serialized object not found"); @@ -1300,8 +1274,7 @@ public class MLet extends java.net.URLClassLoader return(cons.newInstance(oo)); } catch (Exception e) { - MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(), - "constructParameter", "Got unexpected exception", e); + MLET_LOGGER.log(Level.DEBUG, "Got unexpected exception", e); } } if (type.compareTo("java.lang.Boolean") == 0) diff --git a/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java index ff261f39235..a067a281403 100644 --- a/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java +++ b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -39,7 +39,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.logging.Level; +import java.lang.System.Logger.Level; /** * This class is used for parsing URLs. @@ -153,7 +153,6 @@ class MLetParser { * Scan an html file for {@literal } tags. */ public List parse(URL url) throws IOException { - String mth = "parse"; // Warning Messages String requiresTypeWarning = " tag requires type parameter."; String requiresValueWarning = " tag requires value parameter."; @@ -204,33 +203,25 @@ class MLetParser { Map t = scanTag(in); String att = t.get("type"); if (att == null) { - MLET_LOGGER.logp(Level.FINER, - MLetParser.class.getName(), - mth, requiresTypeWarning); + MLET_LOGGER.log(Level.TRACE, requiresTypeWarning); throw new IOException(requiresTypeWarning); } else { if (atts != null) { types.add(att); } else { - MLET_LOGGER.logp(Level.FINER, - MLetParser.class.getName(), - mth, paramOutsideWarning); + MLET_LOGGER.log(Level.TRACE, paramOutsideWarning); throw new IOException(paramOutsideWarning); } } String val = t.get("value"); if (val == null) { - MLET_LOGGER.logp(Level.FINER, - MLetParser.class.getName(), - mth, requiresValueWarning); + MLET_LOGGER.log(Level.TRACE, requiresValueWarning); throw new IOException(requiresValueWarning); } else { if (atts != null) { values.add(val); } else { - MLET_LOGGER.logp(Level.FINER, - MLetParser.class.getName(), - mth, paramOutsideWarning); + MLET_LOGGER.log(Level.TRACE, paramOutsideWarning); throw new IOException(paramOutsideWarning); } } @@ -238,15 +229,11 @@ class MLetParser { if (nm.equalsIgnoreCase(tag)) { atts = scanTag(in); if (atts.get("code") == null && atts.get("object") == null) { - MLET_LOGGER.logp(Level.FINER, - MLetParser.class.getName(), - mth, requiresCodeWarning); + MLET_LOGGER.log(Level.TRACE, requiresCodeWarning); throw new IOException(requiresCodeWarning); } if (atts.get("archive") == null) { - MLET_LOGGER.logp(Level.FINER, - MLetParser.class.getName(), - mth, requiresJarsWarning); + MLET_LOGGER.log(Level.TRACE, requiresJarsWarning); throw new IOException(requiresJarsWarning); } } diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java index 8499be40cc8..769a6159d1d 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -51,7 +51,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.StringTokenizer; import java.util.TreeMap; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Descriptor; import javax.management.ImmutableDescriptor; @@ -164,10 +164,8 @@ public class DescriptorSupport * (the method {@link #isValid isValid} returns false) */ public DescriptorSupport() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "DescriptorSupport()" , "Constructor"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Constructor"); } init(null); } @@ -188,17 +186,14 @@ public class DescriptorSupport */ public DescriptorSupport(int initNumFields) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(initNumFields = " + initNumFields + ")", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(initNumFields = " + initNumFields + ") " + "Constructor"); } if (initNumFields <= 0) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(initNumFields)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Illegal arguments: initNumFields <= 0"); } final String msg = @@ -219,10 +214,9 @@ public class DescriptorSupport * fields, an empty Descriptor will be created. */ public DescriptorSupport(DescriptorSupport inDescr) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(Descriptor)", "Constructor"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(Descriptor) Constructor"); } if (inDescr == null) init(null); @@ -268,16 +262,14 @@ public class DescriptorSupport XMLParseException { /* parse an XML-formatted string and populate internal * structure with it */ - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(String = '" + inStr + "')", "Constructor"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(String = '" + inStr + "') Constructor"); } if (inStr == null) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(String = null)", "Illegal arguments"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(String = null) Illegal arguments"); } final String msg = "String in parameter is null"; final RuntimeException iae = new IllegalArgumentException(msg); @@ -350,10 +342,9 @@ public class DescriptorSupport } } } // while tokens - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(XMLString)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(XMLString) Exit"); } } @@ -380,19 +371,17 @@ public class DescriptorSupport */ public DescriptorSupport(String[] fieldNames, Object[] fieldValues) throws RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(fieldNames,fieldObjects)", "Constructor"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(fieldNames,fieldObjects) Constructor"); } if ((fieldNames == null) || (fieldValues == null) || (fieldNames.length != fieldValues.length)) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(fieldNames,fieldObjects)", - "Illegal arguments"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(fieldNames,fieldObjects)" + + " Illegal arguments"); } final String msg = @@ -408,10 +397,9 @@ public class DescriptorSupport // the fieldName and fieldValue will be validated in setField. setField(fieldNames[i], fieldValues[i]); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(fieldNames,fieldObjects)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(fieldNames,fieldObjects) Exit"); } } @@ -444,10 +432,9 @@ public class DescriptorSupport */ public DescriptorSupport(String... fields) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(String... fields)", "Constructor"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(String... fields) Constructor"); } init(null); if (( fields == null ) || ( fields.length == 0)) @@ -462,10 +449,9 @@ public class DescriptorSupport int eq_separator = fields[i].indexOf('='); if (eq_separator < 0) { // illegal if no = or is first character - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(String... fields)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(String... fields) " + "Illegal arguments: field does not have " + "'=' as a name and value separator"); } @@ -482,10 +468,9 @@ public class DescriptorSupport } if (fieldName.equals("")) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(String... fields)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(String... fields) " + "Illegal arguments: fieldName is empty"); } @@ -496,10 +481,9 @@ public class DescriptorSupport setField(fieldName,fieldValue); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(String... fields)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor(String... fields) Exit"); } } @@ -517,10 +501,8 @@ public class DescriptorSupport throws RuntimeOperationsException { if ((fieldName == null) || (fieldName.equals(""))) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldValue(String fieldName)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Illegal arguments: null field name"); } final String msg = "Fieldname requested is null"; @@ -528,10 +510,9 @@ public class DescriptorSupport throw new RuntimeOperationsException(iae, msg); } Object retValue = descriptorMap.get(fieldName); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldValue(String fieldName = " + fieldName + ")", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "getFieldValue(String fieldName = " + fieldName + ") " + "Returns '" + retValue + "'"); } return(retValue); @@ -542,10 +523,8 @@ public class DescriptorSupport // field name cannot be null or empty if ((fieldName == null) || (fieldName.equals(""))) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "setField(fieldName,fieldValue)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Illegal arguments: null or empty field name"); } @@ -555,10 +534,8 @@ public class DescriptorSupport } if (!validateField(fieldName, fieldValue)) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "setField(fieldName,fieldValue)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Illegal arguments"); } @@ -568,10 +545,8 @@ public class DescriptorSupport throw new RuntimeOperationsException(iae, msg); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "setField(fieldName,fieldValue)", "Entry: setting '" + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry: setting '" + fieldName + "' to '" + fieldValue + "'"); } @@ -582,10 +557,8 @@ public class DescriptorSupport } public synchronized String[] getFields() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFields()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } int numberOfEntries = descriptorMap.size(); @@ -594,20 +567,18 @@ public class DescriptorSupport int i = 0; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFields()", "Returning " + numberOfEntries + " fields"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Returning " + numberOfEntries + " fields"); } for (Iterator> iter = returnedSet.iterator(); iter.hasNext(); i++) { Map.Entry currElement = iter.next(); if (currElement == null) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFields()", "Element is null"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Element is null"); } } else { Object currValue = currElement.getValue(); @@ -626,20 +597,16 @@ public class DescriptorSupport } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFields()", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return responseFields; } public synchronized String[] getFieldNames() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldNames()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } int numberOfEntries = descriptorMap.size(); @@ -648,10 +615,8 @@ public class DescriptorSupport int i = 0; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldNames()", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Returning " + numberOfEntries + " fields"); } @@ -660,20 +625,16 @@ public class DescriptorSupport Map.Entry currElement = iter.next(); if (( currElement == null ) || (currElement.getKey() == null)) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldNames()", "Field is null"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Field is null"); } } else { responseFields[i] = currElement.getKey().toString(); } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldNames()", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return responseFields; @@ -681,10 +642,8 @@ public class DescriptorSupport public synchronized Object[] getFieldValues(String... fieldNames) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldValues(String... fieldNames)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } // if fieldNames == null return all values // if fieldNames is String[0] return no values @@ -695,10 +654,8 @@ public class DescriptorSupport int i = 0; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldValues(String... fieldNames)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Returning " + numberOfEntries + " fields"); } @@ -715,10 +672,8 @@ public class DescriptorSupport } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "getFieldValues(String... fieldNames)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return responseFields; @@ -728,18 +683,14 @@ public class DescriptorSupport Object[] fieldValues) throws RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "setFields(fieldNames,fieldValues)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if ((fieldNames == null) || (fieldValues == null) || (fieldNames.length != fieldValues.length)) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "setFields(fieldNames,fieldValues)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Illegal arguments"); } @@ -750,10 +701,8 @@ public class DescriptorSupport for (int i=0; i < fieldNames.length; i++) { if (( fieldNames[i] == null) || (fieldNames[i].equals(""))) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "setFields(fieldNames,fieldValues)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Null field name encountered at element " + i); } final String msg = "fieldNames is null or invalid"; @@ -762,10 +711,8 @@ public class DescriptorSupport } setField(fieldNames[i], fieldValues[i]); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "setFields(fieldNames,fieldValues)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -779,10 +726,8 @@ public class DescriptorSupport @Override public synchronized Object clone() throws RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "clone()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } return(new DescriptorSupport(this)); } @@ -898,20 +843,17 @@ public class DescriptorSupport */ public synchronized boolean isValid() throws RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "isValid()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } // verify that the descriptor is valid, by iterating over each field... Set> returnedSet = descriptorMap.entrySet(); if (returnedSet == null) { // null descriptor, not valid - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "isValid()", "Returns false (null set)"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "isValid() Returns false (null set)"); } return false; } @@ -934,10 +876,8 @@ public class DescriptorSupport (currElement.getValue()).toString())) { continue; } else { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "isValid()", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Field " + currElement.getKey() + "=" + currElement.getValue() + " is not valid"); } @@ -948,10 +888,9 @@ public class DescriptorSupport } // fell through, all fields OK - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "isValid()", "Returns true"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "isValid() Returns true"); } return true; } @@ -1287,28 +1226,23 @@ public class DescriptorSupport */ @Override public synchronized String toString() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "toString()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } String respStr = ""; String[] fields = getFields(); if ((fields == null) || (fields.length == 0)) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "toString()", "Empty Descriptor"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Empty Descriptor"); } return respStr; } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "toString()", "Printing " + fields.length + " fields"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Printing " + fields.length + " fields"); } for (int i=0; i < fields.length; i++) { @@ -1319,10 +1253,8 @@ public class DescriptorSupport } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "toString()", "Exit returning " + respStr); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit returning " + respStr); } return respStr; diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java index b1a68c42722..447273ed9be 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -39,7 +39,7 @@ import java.io.ObjectOutputStream; import java.io.ObjectStreamField; import java.lang.reflect.Method; import java.security.AccessController; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Descriptor; import javax.management.DescriptorKey; @@ -201,12 +201,11 @@ public class ModelMBeanAttributeInfo throws javax.management.IntrospectionException { super(name, description, getter, setter); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanAttributeInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanAttributeInfo(" + - "String,String,Method,Method)", - "Entry", name); + "String,String,Method,Method) " + + "Entry " + name); } attrDescriptor = validDescriptor(null); @@ -251,12 +250,11 @@ public class ModelMBeanAttributeInfo super(name, description, getter, setter); // put getter and setter methods in operations list - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanAttributeInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanAttributeInfo(" + - "String,String,Method,Method,Descriptor)", - "Entry", name); + "String,String,Method,Method,Descriptor) " + + "Entry " + name); } attrDescriptor = validDescriptor(descriptor); } @@ -282,8 +280,8 @@ public class ModelMBeanAttributeInfo super(name, type, description, isReadable, isWritable, isIs); // create default descriptor - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, ModelMBeanAttributeInfo.class.getName(), "ModelMBeanAttributeInfo(" + "String,String,String,boolean,boolean,boolean)", @@ -321,12 +319,11 @@ public class ModelMBeanAttributeInfo Descriptor descriptor) { super(name, type, description, isReadable, isWritable, isIs); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanAttributeInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanAttributeInfo(String,String,String," + - "boolean,boolean,boolean,Descriptor)", - "Entry", name); + "boolean,boolean,boolean,Descriptor)" + + "Entry " + name); } attrDescriptor = validDescriptor(descriptor); } @@ -347,10 +344,9 @@ public class ModelMBeanAttributeInfo inInfo.isReadable(), inInfo.isWritable(), inInfo.isIs()); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanAttributeInfo.class.getName(), - "ModelMBeanAttributeInfo(ModelMBeanAttributeInfo)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "ModelMBeanAttributeInfo(ModelMBeanAttributeInfo) " + "Entry"); } Descriptor newDesc = inInfo.getDescriptor(); @@ -368,10 +364,8 @@ public class ModelMBeanAttributeInfo */ public Descriptor getDescriptor() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanAttributeInfo.class.getName(), - "getDescriptor()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (attrDescriptor == null) { attrDescriptor = validDescriptor(null); @@ -411,10 +405,8 @@ public class ModelMBeanAttributeInfo @Override public Object clone() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanAttributeInfo.class.getName(), - "clone()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } return(new ModelMBeanAttributeInfo(this)); } @@ -454,7 +446,7 @@ public class ModelMBeanAttributeInfo boolean defaulted = (in == null); if (defaulted) { clone = new DescriptorSupport(); - MODELMBEAN_LOGGER.finer("Null Descriptor, creating new."); + MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new."); } else { clone = (Descriptor) in.clone(); } @@ -462,15 +454,15 @@ public class ModelMBeanAttributeInfo //Setting defaults. if (defaulted && clone.getFieldValue("name")==null) { clone.setField("name", this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName()); } if (defaulted && clone.getFieldValue("descriptorType")==null) { clone.setField("descriptorType", "attribute"); - MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"attribute\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"attribute\""); } if (clone.getFieldValue("displayName") == null) { clone.setField("displayName",this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName()); } //Checking validity diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java index 24f6b12091f..9bec078f6f3 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -39,7 +39,7 @@ import java.io.ObjectOutputStream; import java.io.ObjectStreamField; import java.lang.reflect.Constructor; import java.security.AccessController; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Descriptor; import javax.management.DescriptorAccess; @@ -164,10 +164,9 @@ public class ModelMBeanConstructorInfo Constructor constructorMethod) { super(description, constructorMethod); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), - "ModelMBeanConstructorInfo(String,Constructor)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "ModelMBeanConstructorInfo(String,Constructor) " + "Entry"); } consDescriptor = validDescriptor(null); @@ -209,11 +208,10 @@ public class ModelMBeanConstructorInfo super(description, constructorMethod); // put getter and setter methods in constructors list - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanConstructorInfo(" + - "String,Constructor,Descriptor)", "Entry"); + "String,Constructor,Descriptor) Entry"); } consDescriptor = validDescriptor(descriptor); } @@ -232,11 +230,10 @@ public class ModelMBeanConstructorInfo super(name, description, signature); // create default descriptor - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanConstructorInfo(" + - "String,String,MBeanParameterInfo[])", "Entry"); + "String,String,MBeanParameterInfo[]) Entry"); } consDescriptor = validDescriptor(null); } @@ -265,11 +262,10 @@ public class ModelMBeanConstructorInfo Descriptor descriptor) { super(name, description, signature); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanConstructorInfo(" + - "String,String,MBeanParameterInfo[],Descriptor)", + "String,String,MBeanParameterInfo[],Descriptor) " + "Entry"); } consDescriptor = validDescriptor(descriptor); @@ -284,11 +280,10 @@ public class ModelMBeanConstructorInfo ModelMBeanConstructorInfo(ModelMBeanConstructorInfo old) { super(old.getName(), old.getDescription(), old.getSignature()); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanConstructorInfo(" + - "ModelMBeanConstructorInfo)", "Entry"); + "ModelMBeanConstructorInfo) Entry"); } consDescriptor = validDescriptor(consDescriptor); } @@ -300,10 +295,8 @@ public class ModelMBeanConstructorInfo @Override public Object clone () { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), - "clone()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } return(new ModelMBeanConstructorInfo(this)) ; } @@ -321,10 +314,8 @@ public class ModelMBeanConstructorInfo @Override public Descriptor getDescriptor() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), - "getDescriptor()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (consDescriptor == null){ consDescriptor = validDescriptor(null); @@ -356,10 +347,8 @@ public class ModelMBeanConstructorInfo */ public void setDescriptor(Descriptor inDescriptor) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), - "setDescriptor()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } consDescriptor = validDescriptor(inDescriptor); } @@ -370,10 +359,8 @@ public class ModelMBeanConstructorInfo @Override public String toString() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanConstructorInfo.class.getName(), - "toString()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } String retStr = "ModelMBeanConstructorInfo: " + this.getName() + @@ -408,7 +395,7 @@ public class ModelMBeanConstructorInfo boolean defaulted = (in == null); if (defaulted) { clone = new DescriptorSupport(); - MODELMBEAN_LOGGER.finer("Null Descriptor, creating new."); + MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new."); } else { clone = (Descriptor) in.clone(); } @@ -416,19 +403,19 @@ public class ModelMBeanConstructorInfo //Setting defaults. if (defaulted && clone.getFieldValue("name")==null) { clone.setField("name", this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName()); } if (defaulted && clone.getFieldValue("descriptorType")==null) { clone.setField("descriptorType", "operation"); - MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"operation\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"operation\""); } if (clone.getFieldValue("displayName") == null) { clone.setField("displayName",this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName()); } if (clone.getFieldValue("role") == null) { clone.setField("role","constructor"); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor role field to \"constructor\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor role field to \"constructor\""); } //Checking validity diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java index 4adcbf1273c..b5ae6ca08b9 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamField; import java.security.AccessController; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Descriptor; import javax.management.MBeanAttributeInfo; @@ -231,19 +231,16 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { modelMBeanDescriptor = validDescriptor(mbeandescriptor); } catch (MBeanException mbe) { modelMBeanDescriptor = validDescriptor(null); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "ModelMBeanInfo(ModelMBeanInfo)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "ModelMBeanInfo(ModelMBeanInfo) " + "Could not get a valid modelMBeanDescriptor, " + "setting a default Descriptor"); } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "ModelMBeanInfo(ModelMBeanInfo)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -330,12 +327,11 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { modelMBeanOperations = operations; modelMBeanNotifications = notifications; modelMBeanDescriptor = validDescriptor(mbeandescriptor); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanInfoSupport(String,String,ModelMBeanAttributeInfo[]," + "ModelMBeanConstructorInfo[],ModelMBeanOperationInfo[]," + - "ModelMBeanNotificationInfo[],Descriptor)", + "ModelMBeanNotificationInfo[],Descriptor) " + "Exit"); } } @@ -367,10 +363,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public Descriptor[] getDescriptors(String inDescriptorType) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getDescriptors(String)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if ((inDescriptorType == null) || (inDescriptorType.equals(""))) { @@ -474,10 +468,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { " the descriptors of the MBean"; throw new RuntimeOperationsException(iae,msg); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getDescriptors(String)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return retList; @@ -486,10 +478,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public void setDescriptors(Descriptor[] inDescriptors) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setDescriptors(Descriptor[])", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inDescriptors==null) { // throw RuntimeOperationsException - invalid descriptor @@ -504,10 +494,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { for (int j=0; j < inDescriptors.length; j++) { setDescriptor(inDescriptors[j],null); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setDescriptors(Descriptor[])", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -530,10 +518,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public Descriptor getDescriptor(String inDescriptorName) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getDescriptor(String)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } return(getDescriptor(inDescriptorName, null)); } @@ -606,10 +592,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { throws MBeanException, RuntimeOperationsException { final String excMsg = "Exception occurred trying to set the descriptors of the MBean"; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setDescriptor(Descriptor,String)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inDescriptor==null) { @@ -621,10 +605,9 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { (String) inDescriptor.getFieldValue("descriptorType"); if (inDescriptorType == null) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setDescriptor(Descriptor,String)", - "descriptorType null in both String parameter and Descriptor, defaulting to "+ MMB); + MODELMBEAN_LOGGER.log(Level.TRACE, + "descriptorType null in both String parameter " + + "and Descriptor, defaulting to "+ MMB); inDescriptorType = MMB; } } @@ -632,10 +615,9 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { String inDescriptorName = (String) inDescriptor.getFieldValue("name"); if (inDescriptorName == null) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setDescriptor(Descriptor,String)", - "descriptor name null, defaulting to "+ this.getClassName()); + MODELMBEAN_LOGGER.log(Level.TRACE, + "descriptor name null, defaulting to " + + this.getClassName()); inDescriptorName = this.getClassName(); } boolean found = false; @@ -653,17 +635,14 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { ModelMBeanAttributeInfo mmbai = (ModelMBeanAttributeInfo) attrList[i]; mmbai.setDescriptor(inDescriptor); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { StringBuilder strb = new StringBuilder() .append("Setting descriptor to ").append(inDescriptor) .append("\t\n local: AttributeInfo descriptor is ") .append(mmbai.getDescriptor()) .append("\t\n modelMBeanInfo: AttributeInfo descriptor is ") .append(this.getDescriptor(inDescriptorName,"attribute")); - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setDescriptor(Descriptor,String)", - strb.toString()); + MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString); } } } @@ -720,10 +699,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { "; name=" + inDescriptorName); throw new RuntimeOperationsException(iae, excMsg); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setDescriptor(Descriptor,String)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -732,10 +709,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public ModelMBeanAttributeInfo getAttribute(String inName) throws MBeanException, RuntimeOperationsException { ModelMBeanAttributeInfo retInfo = null; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getAttribute(String)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inName == null) { throw new RuntimeOperationsException( @@ -748,7 +723,7 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { if (attrList != null) numAttrs = attrList.length; for (int i=0; (i < numAttrs) && (retInfo == null); i++) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { final StringBuilder strb = new StringBuilder() .append("\t\n this.getAttributes() MBeanAttributeInfo Array ") .append(i).append(":") @@ -756,18 +731,14 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { .append("\t\n this.modelMBeanAttributes MBeanAttributeInfo Array ") .append(i).append(":") .append(((ModelMBeanAttributeInfo)modelMBeanAttributes[i]).getDescriptor()); - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getAttribute(String)", strb.toString()); + MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString); } if (inName.equals(attrList[i].getName())) { retInfo = ((ModelMBeanAttributeInfo)attrList[i].clone()); } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getAttribute(String)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return retInfo; @@ -778,10 +749,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public ModelMBeanOperationInfo getOperation(String inName) throws MBeanException, RuntimeOperationsException { ModelMBeanOperationInfo retInfo = null; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getOperation(String)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inName == null) { throw new RuntimeOperationsException( @@ -798,10 +767,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { retInfo = ((ModelMBeanOperationInfo) operList[i].clone()); } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getOperation(String)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return retInfo; @@ -824,10 +791,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public ModelMBeanConstructorInfo getConstructor(String inName) throws MBeanException, RuntimeOperationsException { ModelMBeanConstructorInfo retInfo = null; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getConstructor(String)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inName == null) { throw new RuntimeOperationsException( @@ -844,10 +809,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { retInfo = ((ModelMBeanConstructorInfo) consList[i].clone()); } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getConstructor(String)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return retInfo; @@ -857,10 +820,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public ModelMBeanNotificationInfo getNotification(String inName) throws MBeanException, RuntimeOperationsException { ModelMBeanNotificationInfo retInfo = null; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getNotification(String)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inName == null) { throw new RuntimeOperationsException( @@ -877,10 +838,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { retInfo = ((ModelMBeanNotificationInfo) notifList[i].clone()); } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getNotification(String)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return retInfo; @@ -901,19 +860,15 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { } private Descriptor getMBeanDescriptorNoException() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getMBeanDescriptorNoException()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (modelMBeanDescriptor == null) modelMBeanDescriptor = validDescriptor(null); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "getMBeanDescriptorNoException()", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit, returning: " + modelMBeanDescriptor); } return (Descriptor) modelMBeanDescriptor.clone(); @@ -921,10 +876,8 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { public void setMBeanDescriptor(Descriptor inMBeanDescriptor) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanInfoSupport.class.getName(), - "setMBeanDescriptor(Descriptor)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } modelMBeanDescriptor = validDescriptor(inMBeanDescriptor); } @@ -948,7 +901,7 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { boolean defaulted = (in == null); if (defaulted) { clone = new DescriptorSupport(); - MODELMBEAN_LOGGER.finer("Null Descriptor, creating new."); + MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new."); } else { clone = (Descriptor) in.clone(); } @@ -956,27 +909,27 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo { //Setting defaults. if (defaulted && clone.getFieldValue("name")==null) { clone.setField("name", this.getClassName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getClassName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getClassName()); } if (defaulted && clone.getFieldValue("descriptorType")==null) { clone.setField("descriptorType", MMB); - MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"" + MMB + "\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"" + MMB + "\""); } if (clone.getFieldValue("displayName") == null) { clone.setField("displayName",this.getClassName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getClassName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getClassName()); } if (clone.getFieldValue("persistPolicy") == null) { clone.setField("persistPolicy","never"); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor persistPolicy to \"never\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor persistPolicy to \"never\""); } if (clone.getFieldValue("log") == null) { clone.setField("log","F"); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor \"log\" field to \"F\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor \"log\" field to \"F\""); } if (clone.getFieldValue("visibility") == null) { clone.setField("visibility","1"); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor visibility to 1"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor visibility to 1"); } //Checking validity diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java index a05d82d5e99..507ba1a34a6 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamField; import java.security.AccessController; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Descriptor; import javax.management.DescriptorAccess; @@ -199,10 +199,8 @@ public class ModelMBeanNotificationInfo String description, Descriptor descriptor) { super(notifTypes, name, description); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanNotificationInfo.class.getName(), - "ModelMBeanNotificationInfo", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } notificationDescriptor = validDescriptor(descriptor); } @@ -225,10 +223,8 @@ public class ModelMBeanNotificationInfo * duplicate of this ModelMBeanNotificationInfo. **/ public Object clone () { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanNotificationInfo.class.getName(), - "clone()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } return(new ModelMBeanNotificationInfo(this)); } @@ -243,18 +239,15 @@ public class ModelMBeanNotificationInfo * @see #setDescriptor **/ public Descriptor getDescriptor() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanNotificationInfo.class.getName(), - "getDescriptor()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (notificationDescriptor == null) { // Dead code. Should never happen. - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanNotificationInfo.class.getName(), - "getDescriptor()", "Descriptor value is null, " + + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Descriptor value is null, " + "setting descriptor to default values"); } notificationDescriptor = validDescriptor(null); @@ -281,10 +274,8 @@ public class ModelMBeanNotificationInfo * @see #getDescriptor **/ public void setDescriptor(Descriptor inDescriptor) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanNotificationInfo.class.getName(), - "setDescriptor(Descriptor)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } notificationDescriptor = validDescriptor(inDescriptor); } @@ -296,10 +287,8 @@ public class ModelMBeanNotificationInfo * @return a string describing this object. **/ public String toString() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanNotificationInfo.class.getName(), - "toString()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } final StringBuilder retStr = new StringBuilder(); @@ -342,7 +331,7 @@ public class ModelMBeanNotificationInfo boolean defaulted = (in == null); if (defaulted) { clone = new DescriptorSupport(); - MODELMBEAN_LOGGER.finer("Null Descriptor, creating new."); + MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new."); } else { clone = (Descriptor) in.clone(); } @@ -350,19 +339,19 @@ public class ModelMBeanNotificationInfo //Setting defaults. if (defaulted && clone.getFieldValue("name")==null) { clone.setField("name", this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName()); } if (defaulted && clone.getFieldValue("descriptorType")==null) { clone.setField("descriptorType", "notification"); - MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"notification\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"notification\""); } if (clone.getFieldValue("displayName") == null) { clone.setField("displayName",this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName()); } if (clone.getFieldValue("severity") == null) { clone.setField("severity", "6"); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor severity field to 6"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor severity field to 6"); } //Checking validity diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java index ba047efde93..a0541b678f3 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -39,7 +39,7 @@ import java.io.ObjectOutputStream; import java.io.ObjectStreamField; import java.lang.reflect.Method; import java.security.AccessController; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Descriptor; import javax.management.DescriptorAccess; @@ -185,10 +185,9 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo { super(description, operationMethod); // create default descriptor - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), - "ModelMBeanOperationInfo(String,Method)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "ModelMBeanOperationInfo(String,Method) " + "Entry"); } operationDescriptor = validDescriptor(null); @@ -228,11 +227,10 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo { super(description, operationMethod); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), - "ModelMBeanOperationInfo(String,Method,Descriptor)", - "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "ModelMBeanOperationInfo(String,Method,Descriptor) " + + "Entry"); } operationDescriptor = validDescriptor(descriptor); } @@ -258,11 +256,10 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo super(name, description, signature, type, impact); // create default descriptor - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanOperationInfo(" + - "String,String,MBeanParameterInfo[],String,int)", + "String,String,MBeanParameterInfo[],String,int) " + "Entry"); } operationDescriptor = validDescriptor(null); @@ -302,11 +299,10 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo Descriptor descriptor) { super(name, description, signature, type, impact); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanOperationInfo(String,String," + - "MBeanParameterInfo[],String,int,Descriptor)", + "MBeanParameterInfo[],String,int,Descriptor) " + "Entry"); } operationDescriptor = validDescriptor(descriptor); @@ -327,10 +323,9 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo inInfo.getSignature(), inInfo.getReturnType(), inInfo.getImpact()); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), - "ModelMBeanOperationInfo(ModelMBeanOperationInfo)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "ModelMBeanOperationInfo(ModelMBeanOperationInfo)" + "Entry"); } Descriptor newDesc = inInfo.getDescriptor(); @@ -345,10 +340,8 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo public Object clone () { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), - "clone()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } return(new ModelMBeanOperationInfo(this)) ; } @@ -365,10 +358,8 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo public Descriptor getDescriptor() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), - "getDescriptor()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (operationDescriptor == null) { operationDescriptor = validDescriptor(null); @@ -396,10 +387,8 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo */ public void setDescriptor(Descriptor inDescriptor) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), - "setDescriptor(Descriptor)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } operationDescriptor = validDescriptor(inDescriptor); } @@ -410,10 +399,8 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo */ public String toString() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - ModelMBeanOperationInfo.class.getName(), - "toString()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } String retStr = "ModelMBeanOperationInfo: " + this.getName() + @@ -449,7 +436,7 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo boolean defaulted = (in == null); if (defaulted) { clone = new DescriptorSupport(); - MODELMBEAN_LOGGER.finer("Null Descriptor, creating new."); + MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new."); } else { clone = (Descriptor) in.clone(); } @@ -457,19 +444,19 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo //Setting defaults. if (defaulted && clone.getFieldValue("name")==null) { clone.setField("name", this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName()); } if (defaulted && clone.getFieldValue("descriptorType")==null) { clone.setField("descriptorType", "operation"); - MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"operation\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"operation\""); } if (clone.getFieldValue("displayName") == null) { clone.setField("displayName",this.getName()); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName()); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName()); } if (clone.getFieldValue("role") == null) { clone.setField("role","operation"); - MODELMBEAN_LOGGER.finer("Defaulting Descriptor role field to \"operation\""); + MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor role field to \"operation\""); } //Checking validity diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java index 9f50196219b..a757876c245 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -46,7 +46,7 @@ import java.security.PrivilegedAction; import java.util.Date; import java.util.HashMap; import java.util.HashSet; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import java.util.Map; import java.util.Set; @@ -166,16 +166,12 @@ public class RequiredModelMBean **/ public RequiredModelMBean() throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "RequiredModelMBean()", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } modelMBeanInfo = createDefaultModelMBeanInfo(); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "RequiredModelMBean()", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -202,17 +198,13 @@ public class RequiredModelMBean public RequiredModelMBean(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "RequiredModelMBean(MBeanInfo)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } setModelMBeanInfo(mbi); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "RequiredModelMBean(MBeanInfo)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -257,17 +249,13 @@ public class RequiredModelMBean public void setModelMBeanInfo(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setModelMBeanInfo(ModelMBeanInfo)","Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (mbi == null) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setModelMBeanInfo(ModelMBeanInfo)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanInfo is null: Raising exception."); } final RuntimeException x = new @@ -279,10 +267,8 @@ public class RequiredModelMBean } if (registered) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setModelMBeanInfo(ModelMBeanInfo)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "RequiredMBean is registered: Raising exception."); } final String exceptionText = @@ -293,32 +279,24 @@ public class RequiredModelMBean throw new RuntimeOperationsException(x,exceptionText); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setModelMBeanInfo(ModelMBeanInfo)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Setting ModelMBeanInfo to " + printModelMBeanInfo(mbi)); int noOfNotifications = 0; if (mbi.getNotifications() != null) { noOfNotifications = mbi.getNotifications().length; } - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setModelMBeanInfo(ModelMBeanInfo)", + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanInfo notifications has " + noOfNotifications + " elements"); } modelMBeanInfo = (ModelMBeanInfo)mbi.clone(); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setModelMBeanInfo(ModelMBeanInfo)","set mbeanInfo to: "+ + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "set mbeanInfo to: "+ printModelMBeanInfo(modelMBeanInfo)); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setModelMBeanInfo(ModelMBeanInfo)","Exit"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -346,37 +324,29 @@ public class RequiredModelMBean public void setManagedResource(Object mr, String mr_type) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setManagedResource(Object,String)","Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } // check that the mr_type is supported by this JMXAgent // only "objectReference" is supported if ((mr_type == null) || (! mr_type.equalsIgnoreCase("objectReference"))) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setManagedResource(Object,String)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Managed Resource Type is not supported: " + mr_type); } throw new InvalidTargetObjectTypeException(mr_type); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setManagedResource(Object,String)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Managed Resource is valid"); } managedResource = mr; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setManagedResource(Object, String)", "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -482,11 +452,9 @@ public class RequiredModelMBean private Object resolveForCacheValue(Descriptor descr) throws MBeanException, RuntimeOperationsException { - final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER); - final String mth = "resolveForCacheValue(Descriptor)"; + final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth,"Entry"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } Object response = null; @@ -495,25 +463,22 @@ public class RequiredModelMBean if (descr == null) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "Input Descriptor is null"); } return response; } if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "descriptor is " + descr); + MODELMBEAN_LOGGER.log(Level.TRACE, + "descriptor is " + descr); } final Descriptor mmbDescr = modelMBeanInfo.getMBeanDescriptor(); if (mmbDescr == null) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth,"MBean Descriptor is null"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "MBean Descriptor is null"); } //return response; } @@ -538,9 +503,8 @@ public class RequiredModelMBean if (expTime != null) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth,"currencyTimeLimit: " + expTime); + MODELMBEAN_LOGGER.log(Level.TRACE, + "currencyTimeLimit: " + expTime); } // convert seconds to milliseconds for time comparison @@ -550,8 +514,7 @@ public class RequiredModelMBean returnCachedValue = false; resetValue = true; if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, currencyPeriod + ": never Cached"); } } else if (currencyPeriod == 0) { @@ -559,9 +522,7 @@ public class RequiredModelMBean returnCachedValue = true; resetValue = false; if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, - "always valid Cache"); + MODELMBEAN_LOGGER.log(Level.TRACE, "always valid Cache"); } } else { Object objtStamp = @@ -572,8 +533,7 @@ public class RequiredModelMBean else tStamp = null; if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "lastUpdatedTimeStamp: " + tStamp); } @@ -583,8 +543,7 @@ public class RequiredModelMBean long lastTime = Long.parseLong(tStamp); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "currencyPeriod:" + currencyPeriod + " lastUpdatedTimeStamp:" + lastTime); } @@ -595,8 +554,7 @@ public class RequiredModelMBean returnCachedValue = true; resetValue = false; if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, " timed valid Cache for " + now + " < " + (lastTime + currencyPeriod)); } @@ -604,16 +562,14 @@ public class RequiredModelMBean returnCachedValue = false; resetValue = true; if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "timed expired cache for " + now + " > " + (lastTime + currencyPeriod)); } } } if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "returnCachedValue:" + returnCachedValue + " resetValue: " + resetValue); } @@ -625,17 +581,15 @@ public class RequiredModelMBean response = currValue; /* need to cast string cached value to type */ if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "valid Cache value: " + currValue); } } else { response = null; if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth,"no Cached value"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "no Cached value"); } } } @@ -647,16 +601,14 @@ public class RequiredModelMBean response = null; modelMBeanInfo.setDescriptor(descr,null); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth,"reset cached value to null"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "reset cached value to null"); } } } if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth,"Exit"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return response; @@ -672,31 +624,24 @@ public class RequiredModelMBean **/ public MBeanInfo getMBeanInfo() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getMBeanInfo()","Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (modelMBeanInfo == null) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getMBeanInfo()","modelMBeanInfo is null"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "modelMBeanInfo is null"); } modelMBeanInfo = createDefaultModelMBeanInfo(); //return new ModelMBeanInfo(" ", "", null, null, null, null); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getMBeanInfo()","ModelMBeanInfo is " + + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanInfo is " + modelMBeanInfo.getClassName() + " for " + modelMBeanInfo.getDescription()); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getMBeanInfo()",printModelMBeanInfo(modelMBeanInfo)); + MODELMBEAN_LOGGER.log(Level.TRACE, + printModelMBeanInfo(modelMBeanInfo)); } return((MBeanInfo) modelMBeanInfo.clone()); @@ -705,10 +650,8 @@ public class RequiredModelMBean private String printModelMBeanInfo(ModelMBeanInfo info) { final StringBuilder retStr = new StringBuilder(); if (info == null) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "printModelMBeanInfo(ModelMBeanInfo)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanInfo to print is null, " + "printing local ModelMBeanInfo"); } @@ -909,12 +852,10 @@ public class RequiredModelMBean public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException { - final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER); - final String mth = "invoke(String, Object[], String[])"; + final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Entry"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (opName == null) { @@ -943,9 +884,8 @@ public class RequiredModelMBean opMethodName = opMethodName.substring(0,opSplitter); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "Finding operation " + opName + " as " + opMethodName); + MODELMBEAN_LOGGER.log(Level.TRACE, + "Finding operation " + opName + " as " + opMethodName); } ModelMBeanOperationInfo opInfo = @@ -965,10 +905,7 @@ public class RequiredModelMBean final Object cached = resolveForCacheValue(opDescr); if (cached != null) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, - "Returning cached value"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Returning cached value"); } return cached; } @@ -996,9 +933,8 @@ public class RequiredModelMBean final Object targetObjectField = opDescr.getFieldValue("targetObject"); if (tracing && targetObjectField != null) - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "Found target object in descriptor"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "Found target object in descriptor"); /* Now look for the method, either in RequiredModelMBean itself or in the target object. Set "method" and "targetObject" @@ -1013,9 +949,8 @@ public class RequiredModelMBean targetObject = this; else { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "looking for method in managedResource class"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "looking for method in managedResource class"); } if (targetObjectField != null) targetObject = targetObjectField; @@ -1071,18 +1006,15 @@ public class RequiredModelMBean } if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "found " + opMethodName + ", now invoking"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "found " + opMethodName + ", now invoking"); } final Object result = invokeMethod(opName, method, targetObject, opArgs); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "successfully invoked method"); + MODELMBEAN_LOGGER.log(Level.TRACE, "successfully invoked method"); } if (result != null) @@ -1095,12 +1027,11 @@ public class RequiredModelMBean String opMethodName, final String[] sig) throws ReflectionException { - final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER); + final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),"resolveMethod", - "resolving " + targetClass.getName() + "." + opMethodName); + MODELMBEAN_LOGGER.log(Level.TRACE, + "resolving " + targetClass.getName() + "." + opMethodName); } final Class[] argClasses; @@ -1119,8 +1050,7 @@ public class RequiredModelMBean public Void run() { for (int i = 0; i < sig.length; i++) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),"resolveMethod", + MODELMBEAN_LOGGER.log(Level.TRACE, "resolve type " + sig[i]); } argClasses[i] = (Class) primitiveClassMap.get(sig[i]); @@ -1131,9 +1061,7 @@ public class RequiredModelMBean Class.forName(sig[i], false, targetClassLoader); } catch (ClassNotFoundException e) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "resolveMethod", + MODELMBEAN_LOGGER.log(Level.TRACE, "class not found"); } final String msg = "Parameter class not found"; @@ -1182,12 +1110,10 @@ public class RequiredModelMBean Object targetObjectField, String opClassName, String[] sig) { - final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER); + final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "invoke(String, Object[], String[])", + MODELMBEAN_LOGGER.log(Level.TRACE, "looking for method in RequiredModelMBean class"); } @@ -1340,10 +1266,8 @@ public class RequiredModelMBean modelMBeanInfo.setDescriptor(opDescr, "operation"); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "invoke(String,Object[],Object[])", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "new descriptor is " + opDescr); } } @@ -1495,12 +1419,9 @@ public class RequiredModelMBean IllegalArgumentException("attributeName must not be null"), "Exception occurred trying to get attribute of a " + "RequiredModelMBean"); - final String mth = "getAttribute(String)"; - final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER); + final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "Entry with " + attrName); + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry with " + attrName); } /* Check attributeDescriptor for getMethod */ @@ -1530,16 +1451,14 @@ public class RequiredModelMBean /* return current cached value */ if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, - "*** cached value is " + response); + MODELMBEAN_LOGGER.log(Level.TRACE, + "*** cached value is " + response); } if (response == null) { /* no cached value, run getMethod */ if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "**** cached value is null - getting getMethod"); } String attrGetMethod = @@ -1548,9 +1467,8 @@ public class RequiredModelMBean if (attrGetMethod != null) { /* run method from operations descriptor */ if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "invoking a getMethod for " + attrName); + MODELMBEAN_LOGGER.log(Level.TRACE, + "invoking a getMethod for " + attrName); } Object getResponse = @@ -1560,9 +1478,8 @@ public class RequiredModelMBean if (getResponse != null) { // error/validity check return value here if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "got a non-null response " + + MODELMBEAN_LOGGER.log(Level.TRACE, + "got a non-null response " + "from getMethod\n"); } @@ -1585,9 +1502,7 @@ public class RequiredModelMBean if ((ctl != null) && !(ctl.equals("-1"))) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "setting cached value and " + "lastUpdatedTime in descriptor"); } @@ -1600,19 +1515,15 @@ public class RequiredModelMBean modelMBeanInfo.setDescriptor(attrDescr, "attribute"); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth,"new descriptor is " +attrDescr); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth,"AttributeInfo descriptor is " + + MODELMBEAN_LOGGER.log(Level.TRACE, + "new descriptor is " +attrDescr); + MODELMBEAN_LOGGER.log(Level.TRACE, + "AttributeInfo descriptor is " + attrInfo.getDescriptor()); final String attStr = modelMBeanInfo. getDescriptor(attrName,"attribute"). toString(); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "modelMBeanInfo: AttributeInfo " + "descriptor is " + attStr); } @@ -1620,8 +1531,7 @@ public class RequiredModelMBean } else { // response was invalid or really returned null if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "got a null response from getMethod\n"); } response = null; @@ -1635,8 +1545,7 @@ public class RequiredModelMBean response = attrDescr.getFieldValue("default"); } if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "could not find getMethod for " +attrName + ", returning descriptor " +qualifier + "value"); } @@ -1698,9 +1607,8 @@ public class RequiredModelMBean subtype = false; if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - mth, "Exception: ",e); + MODELMBEAN_LOGGER.log(Level.TRACE, + "Exception: ", e); } } if (!subtype) @@ -1708,9 +1616,8 @@ public class RequiredModelMBean } if (wrongType) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, - "Wrong response type '" + respType + "'"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "Wrong response type '" + respType + "'"); } // throw exception, didn't get // back right attribute type @@ -1724,8 +1631,7 @@ public class RequiredModelMBean } } else { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "getMethod failed " + attrName + " not in attributeDescriptor\n"); } @@ -1743,8 +1649,7 @@ public class RequiredModelMBean throw t; } catch (Exception e) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "getMethod failed with " + e.getMessage() + " exception type " + (e.getClass()).toString()); } @@ -1753,8 +1658,7 @@ public class RequiredModelMBean } if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Exit"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return response; @@ -1777,10 +1681,9 @@ public class RequiredModelMBean * @see #setAttributes(javax.management.AttributeList) */ public AttributeList getAttributes(String[] attrNames) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getAttributes(String[])","Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + RequiredModelMBean.class.getName(), "Entry"); } if (attrNames == null) @@ -1797,19 +1700,15 @@ public class RequiredModelMBean } catch (Exception e) { // eat exceptions because interface doesn't have an // exception on it - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getAttributes(String[])", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Failed to get \"" + attrNames[i] + "\": ", e); } } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getAttributes(String[])","Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return responseList; @@ -1894,11 +1793,9 @@ public class RequiredModelMBean public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { - final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER); + final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE); if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute()","Entry"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (attribute == null) @@ -1958,11 +1855,9 @@ public class RequiredModelMBean attrValue.getClass().getName() + " received."); } catch (ClassNotFoundException x) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute(Attribute)","Class " + - attrType + " for attribute " + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Class " + attrType + " for attribute " + attrName + " not found: ", x); } } @@ -1996,9 +1891,7 @@ public class RequiredModelMBean if (updateCache || updateDescriptor) { if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute(Attribute)", + MODELMBEAN_LOGGER.log(Level.TRACE, "setting cached value of " + attrName + " to " + attrValue); } @@ -2022,26 +1915,22 @@ public class RequiredModelMBean .append(attrInfo.getDescriptor()) .append(". AttributeInfo descriptor is ") .append(modelMBeanInfo.getDescriptor(attrName,"attribute")); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute(Attribute)",strb.toString()); + MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString); } } if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute(Attribute)","sending sendAttributeNotification"); + MODELMBEAN_LOGGER.log(Level.TRACE, + "sending sendAttributeNotification"); } sendAttributeChangeNotification(oldAttr,attribute); } else { // if descriptor ... else no descriptor if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute(Attribute)","setMethod failed "+attrName+ + MODELMBEAN_LOGGER.log(Level.TRACE, + "setMethod failed " + attrName + " not in attributeDescriptor\n"); } @@ -2051,9 +1940,7 @@ public class RequiredModelMBean } // else no descriptor if (tracing) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute(Attribute)", "Exit"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -2076,10 +1963,8 @@ public class RequiredModelMBean **/ public AttributeList setAttributes(AttributeList attributes) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "setAttribute(Attribute)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (attributes == null) @@ -2118,17 +2003,13 @@ public class RequiredModelMBean private synchronized void writeToLog(String logFileName, String logEntry) throws Exception { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "writeToLog(String, String)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Notification Logging to " + logFileName + ": " + logEntry); } if ((logFileName == null) || (logEntry == null)) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "writeToLog(String, String)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Bad input parameters, will not log this entry."); } return; @@ -2139,17 +2020,13 @@ public class RequiredModelMBean PrintStream logOut = new PrintStream(fos); logOut.println(logEntry); logOut.close(); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "writeToLog(String, String)","Successfully opened log " + - logFileName); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + "Successfully opened log " + logFileName); } } catch (Exception e) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "writeToLog(String, String)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exception " + e.toString() + " trying to write to the Notification log file " + logFileName); @@ -2184,11 +2061,8 @@ public class RequiredModelMBean NotificationFilter filter, Object handback) throws java.lang.IllegalArgumentException { - final String mth = "addNotificationListener(" + - "NotificationListener, NotificationFilter, Object)"; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (listener == null) @@ -2200,12 +2074,10 @@ public class RequiredModelMBean generalBroadcaster.addNotificationListener(listener, filter, handback); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "NotificationListener added"); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Exit"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -2227,10 +2099,8 @@ public class RequiredModelMBean throw new ListenerNotFoundException( "Notification listener is null"); - final String mth="removeNotificationListener(NotificationListener)"; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (generalBroadcaster == null) @@ -2239,9 +2109,8 @@ public class RequiredModelMBean generalBroadcaster.removeNotificationListener(listener); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -2255,12 +2124,8 @@ public class RequiredModelMBean throw new ListenerNotFoundException( "Notification listener is null"); - final String mth = "removeNotificationListener(" + - "NotificationListener, NotificationFilter, Object)"; - - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (generalBroadcaster == null) @@ -2271,19 +2136,16 @@ public class RequiredModelMBean generalBroadcaster.removeNotificationListener(listener,filter, handback); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } public void sendNotification(Notification ntfyObj) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "sendNotification(Notification)", "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (ntfyObj == null) @@ -2324,10 +2186,8 @@ public class RequiredModelMBean ntfyObj.getMessage() + " Severity = " + (String)ntfyDesc.getFieldValue("severity")); } catch (Exception e) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINE)) { - MODELMBEAN_LOGGER.logp(Level.FINE, - RequiredModelMBean.class.getName(), - "sendNotification(Notification)", + if (MODELMBEAN_LOGGER.isLoggable(Level.DEBUG)) { + MODELMBEAN_LOGGER.log(Level.DEBUG, "Failed to log " + ntfyObj.getType() + " notification: ", e); } @@ -2339,14 +2199,10 @@ public class RequiredModelMBean generalBroadcaster.sendNotification(ntfyObj); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "sendNotification(Notification)", + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "sendNotification sent provided notification object"); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "sendNotification(Notification)"," Exit"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -2354,10 +2210,8 @@ public class RequiredModelMBean public void sendNotification(String ntfyText) throws MBeanException, RuntimeOperationsException { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "sendNotification(String)","Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (ntfyText == null) @@ -2370,13 +2224,9 @@ public class RequiredModelMBean Notification myNtfyObj = new Notification("jmx.modelmbean.generic", this, 1, ntfyText); sendNotification(myNtfyObj); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "sendNotification(String)","Notification sent"); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "sendNotification(String)","Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Notification sent"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -2456,10 +2306,8 @@ public class RequiredModelMBean * **/ public MBeanNotificationInfo[] getNotificationInfo() { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getNotificationInfo()","Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } // Using hasNotification() is not optimal, but shouldn't really @@ -2518,10 +2366,8 @@ public class RequiredModelMBean respInfo[offset+j] = currInfo[j]; } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), - "getNotificationInfo()","Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } return respInfo; @@ -2535,12 +2381,8 @@ public class RequiredModelMBean Object inhandback) throws MBeanException, RuntimeOperationsException, IllegalArgumentException { - final String mth="addAttributeChangeNotificationListener(" + - "NotificationListener, String, Object)"; - - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth,"Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (inlistener == null) @@ -2581,24 +2423,21 @@ public class RequiredModelMBean } } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { Vector enabledAttrs = currFilter.getEnabledAttributes(); String s = (enabledAttrs.size() > 1) ? "[" + enabledAttrs.firstElement() + ", ...]" : enabledAttrs.toString(); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(), mth, + MODELMBEAN_LOGGER.log(Level.TRACE, "Set attribute change filter to " + s); } attributeBroadcaster.addNotificationListener(inlistener,currFilter, inhandback); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Notification listener added for " + inAttributeName); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth,"Exit"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } @@ -2609,12 +2448,9 @@ public class RequiredModelMBean if (inlistener == null) throw new ListenerNotFoundException("Notification listener is null"); - final String mth = "removeAttributeChangeNotificationListener(" + - "NotificationListener, String)"; - - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth,"Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, + RequiredModelMBean.class.getName(), "Entry"); } @@ -2648,21 +2484,17 @@ public class RequiredModelMBean attributeBroadcaster.removeNotificationListener(inlistener); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth,"Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } public void sendAttributeChangeNotification(AttributeChangeNotification ntfyObj) throws MBeanException, RuntimeOperationsException { - final String mth = "sendAttributeChangeNotification(" + - "AttributeChangeNotification)"; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth,"Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } if (ntfyObj == null) @@ -2678,9 +2510,8 @@ public class RequiredModelMBean if (oldv == null) oldv = "null"; if (newv == null) newv = "null"; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Sending AttributeChangeNotification with " + ntfyObj.getAttributeName() + ntfyObj.getAttributeType() + ntfyObj.getNewValue() + ntfyObj.getOldValue()); @@ -2718,9 +2549,8 @@ public class RequiredModelMBean " Old value = " + oldv + " New value = " + newv); } catch (Exception e) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINE)) { - MODELMBEAN_LOGGER.logp(Level.FINE, - RequiredModelMBean.class.getName(),mth, + if (MODELMBEAN_LOGGER.isLoggable(Level.DEBUG)) { + MODELMBEAN_LOGGER.log(Level.DEBUG, "Failed to log " + ntfyObj.getType() + " notification: ", e); } @@ -2744,9 +2574,8 @@ public class RequiredModelMBean " Old value = " + oldv + " New value = " + newv); } catch (Exception e) { - if (MODELMBEAN_LOGGER.isLoggable(Level.FINE)) { - MODELMBEAN_LOGGER.logp(Level.FINE, - RequiredModelMBean.class.getName(),mth, + if (MODELMBEAN_LOGGER.isLoggable(Level.DEBUG)) { + MODELMBEAN_LOGGER.log(Level.DEBUG, "Failed to log " + ntfyObj.getType() + " notification: ", e); } @@ -2768,25 +2597,17 @@ public class RequiredModelMBean generalBroadcaster.sendNotification(ntfyObj); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, - "sent notification"); - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, - "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "sent notification"); + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } public void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal) throws MBeanException, RuntimeOperationsException { - final String mth = - "sendAttributeChangeNotification(Attribute, Attribute)"; - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, - "Entry"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); } // do we really want to do this? @@ -2824,10 +2645,8 @@ public class RequiredModelMBean sendAttributeChangeNotification(myNtfyObj); - if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { - MODELMBEAN_LOGGER.logp(Level.FINER, - RequiredModelMBean.class.getName(),mth, - "Exit"); + if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { + MODELMBEAN_LOGGER.log(Level.TRACE, "Exit"); } } diff --git a/jdk/src/java.management/share/classes/javax/management/monitor/CounterMonitor.java b/jdk/src/java.management/share/classes/javax/management/monitor/CounterMonitor.java index f025e98fdaf..4b5db2cb087 100644 --- a/jdk/src/java.management/share/classes/javax/management/monitor/CounterMonitor.java +++ b/jdk/src/java.management/share/classes/javax/management/monitor/CounterMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -26,7 +26,7 @@ package javax.management.monitor; import static com.sun.jmx.defaults.JmxProperties.MONITOR_LOGGER; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.ObjectName; import javax.management.MBeanNotificationInfo; import static javax.management.monitor.Monitor.NumericalType.*; @@ -228,8 +228,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { */ public synchronized void start() { if (isActive()) { - MONITOR_LOGGER.logp(Level.FINER, CounterMonitor.class.getName(), - "start", "the monitor is already active"); + MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active"); return; } // Reset values. @@ -696,7 +695,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { } } } else { - if (MONITOR_LOGGER.isLoggable(Level.FINER)) { + if (MONITOR_LOGGER.isLoggable(Level.TRACE)) { final StringBuilder strb = new StringBuilder() .append("The notification:") .append("\n\tNotification observed object = ") @@ -708,8 +707,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { .append("\n\tNotification derived gauge = ") .append(o.getDerivedGauge()) .append("\nhas already been sent"); - MONITOR_LOGGER.logp(Level.FINER, CounterMonitor.class.getName(), - "updateNotifications", strb.toString()); + MONITOR_LOGGER.log(Level.TRACE, strb::toString); } } @@ -756,9 +754,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { break; default: // Should never occur... - MONITOR_LOGGER.logp(Level.FINEST, - CounterMonitor.class.getName(), - "updateThreshold", + MONITOR_LOGGER.log(Level.TRACE, "the threshold type is invalid"); break; } @@ -819,8 +815,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { case LONG: o.setDerivedGauge(Long.valueOf(derived)); break; default: // Should never occur... - MONITOR_LOGGER.logp(Level.FINEST, CounterMonitor.class.getName(), - "setDerivedGaugeWithDifference", + MONITOR_LOGGER.log(Level.TRACE, "the threshold type is invalid"); break; } diff --git a/jdk/src/java.management/share/classes/javax/management/monitor/GaugeMonitor.java b/jdk/src/java.management/share/classes/javax/management/monitor/GaugeMonitor.java index 926cc4e0a8d..9c050c6f408 100644 --- a/jdk/src/java.management/share/classes/javax/management/monitor/GaugeMonitor.java +++ b/jdk/src/java.management/share/classes/javax/management/monitor/GaugeMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -26,7 +26,7 @@ package javax.management.monitor; import static com.sun.jmx.defaults.JmxProperties.MONITOR_LOGGER; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.MBeanNotificationInfo; import javax.management.ObjectName; import static javax.management.monitor.Monitor.NumericalType.*; @@ -224,8 +224,7 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean { */ public synchronized void start() { if (isActive()) { - MONITOR_LOGGER.logp(Level.FINER, GaugeMonitor.class.getName(), - "start", "the monitor is already active"); + MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active"); return; } // Reset values. @@ -664,8 +663,7 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean { break; default: // Should never occur... - MONITOR_LOGGER.logp(Level.FINEST, GaugeMonitor.class.getName(), - "setDerivedGaugeWithDifference", + MONITOR_LOGGER.log(Level.TRACE, "the threshold type is invalid"); return; } @@ -698,8 +696,7 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean { return (greater.doubleValue() >= less.doubleValue()); default: // Should never occur... - MONITOR_LOGGER.logp(Level.FINEST, GaugeMonitor.class.getName(), - "isFirstGreaterThanLast", + MONITOR_LOGGER.log(Level.TRACE, "the threshold type is invalid"); return false; } @@ -733,8 +730,7 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean { } else { // Should never occur... - MONITOR_LOGGER.logp(Level.FINEST, GaugeMonitor.class.getName(), - "isFirstStrictlyGreaterThanLast", + MONITOR_LOGGER.log(Level.TRACE, "the threshold type is invalid"); return false; } diff --git a/jdk/src/java.management/share/classes/javax/management/monitor/Monitor.java b/jdk/src/java.management/share/classes/javax/management/monitor/Monitor.java index eb2a59ac14a..db4907b9e94 100644 --- a/jdk/src/java.management/share/classes/javax/management/monitor/Monitor.java +++ b/jdk/src/java.management/share/classes/javax/management/monitor/Monitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -47,7 +47,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.AttributeNotFoundException; import javax.management.InstanceNotFoundException; import javax.management.IntrospectionException; @@ -205,13 +205,11 @@ public abstract class Monitor try { maximumPoolSizeTmp = Integer.parseInt(maximumPoolSizeStr); } catch (NumberFormatException e) { - if (MONITOR_LOGGER.isLoggable(Level.FINER)) { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "", + if (MONITOR_LOGGER.isLoggable(Level.TRACE)) { + MONITOR_LOGGER.log(Level.TRACE, "Wrong value for " + maximumPoolSizeSysProp + " system property", e); - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "", + MONITOR_LOGGER.log(Level.TRACE, maximumPoolSizeSysProp + " defaults to 10"); } maximumPoolSizeTmp = 10; @@ -391,8 +389,7 @@ public abstract class Monitor public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "preRegister(MBeanServer, ObjectName)", + MONITOR_LOGGER.log(Level.TRACE, "initialize the reference on the MBean server"); this.server = server; @@ -419,8 +416,7 @@ public abstract class Monitor */ public void preDeregister() throws Exception { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "preDeregister()", "stop the monitor"); + MONITOR_LOGGER.log(Level.TRACE, "stop the monitor"); // Stop the Monitor. // @@ -693,13 +689,11 @@ public abstract class Monitor * Starts the monitor. */ void doStart() { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "doStart()", "start the monitor"); + MONITOR_LOGGER.log(Level.TRACE, "start the monitor"); synchronized (this) { if (isActive()) { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "doStart()", "the monitor is already active"); + MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active"); return; } @@ -729,13 +723,11 @@ public abstract class Monitor * Stops the monitor. */ void doStop() { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "doStop()", "stop the monitor"); + MONITOR_LOGGER.log(Level.TRACE, "stop the monitor"); synchronized (this) { if (!isActive()) { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "doStop()", "the monitor is not active"); + MONITOR_LOGGER.log(Level.TRACE, "the monitor is not active"); return; } @@ -1089,9 +1081,8 @@ public abstract class Monitor if (!isActive()) return; - if (MONITOR_LOGGER.isLoggable(Level.FINER)) { - MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(), - "sendNotification", "send notification: " + + if (MONITOR_LOGGER.isLoggable(Level.TRACE)) { + MONITOR_LOGGER.log(Level.TRACE, "send notification: " + "\n\tNotification observed object = " + object + "\n\tNotification observed attribute = " + observedAttribute + "\n\tNotification derived gauge = " + derGauge); @@ -1163,8 +1154,7 @@ public abstract class Monitor setAlreadyNotified( o, index, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, an); msg = "The observed attribute value is null."; - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); + MONITOR_LOGGER.log(Level.TRACE, msg); } } catch (NullPointerException np_ex) { if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED)) @@ -1176,10 +1166,8 @@ public abstract class Monitor "The monitor must be registered in the MBean " + "server or an MBeanServerConnection must be " + "explicitly supplied."; - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", np_ex.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, np_ex::toString); } } catch (InstanceNotFoundException inf_ex) { if (isAlreadyNotified(o, OBSERVED_OBJECT_ERROR_NOTIFIED)) @@ -1191,10 +1179,8 @@ public abstract class Monitor msg = "The observed object must be accessible in " + "the MBeanServerConnection."; - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", inf_ex.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, inf_ex::toString); } } catch (AttributeNotFoundException anf_ex) { if (isAlreadyNotified(o, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED)) @@ -1206,10 +1192,8 @@ public abstract class Monitor msg = "The observed attribute must be accessible in " + "the observed object."; - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", anf_ex.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, anf_ex::toString); } } catch (MBeanException mb_ex) { if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED)) @@ -1218,10 +1202,8 @@ public abstract class Monitor notifType = RUNTIME_ERROR; setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an); msg = mb_ex.getMessage() == null ? "" : mb_ex.getMessage(); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", mb_ex.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, mb_ex::toString); } } catch (ReflectionException ref_ex) { if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED)) { @@ -1230,10 +1212,8 @@ public abstract class Monitor notifType = RUNTIME_ERROR; setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an); msg = ref_ex.getMessage() == null ? "" : ref_ex.getMessage(); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", ref_ex.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, ref_ex::toString); } } catch (IOException io_ex) { if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED)) @@ -1242,10 +1222,8 @@ public abstract class Monitor notifType = RUNTIME_ERROR; setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an); msg = io_ex.getMessage() == null ? "" : io_ex.getMessage(); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", io_ex.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, io_ex::toString); } } catch (RuntimeException rt_ex) { if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED)) @@ -1254,10 +1232,8 @@ public abstract class Monitor notifType = RUNTIME_ERROR; setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an); msg = rt_ex.getMessage() == null ? "" : rt_ex.getMessage(); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(), - "monitor", rt_ex.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, rt_ex::toString); } } @@ -1297,10 +1273,8 @@ public abstract class Monitor msg = "The observed attribute value does not " + "implement the Comparable interface."; - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", e.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, e::toString); } } catch (AttributeNotFoundException e) { if (isAlreadyNotified(o, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED)) @@ -1312,10 +1286,8 @@ public abstract class Monitor msg = "The observed attribute must be accessible in " + "the observed object."; - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", e.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, e::toString); } } catch (RuntimeException e) { if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED)) @@ -1325,10 +1297,8 @@ public abstract class Monitor setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an); msg = e.getMessage() == null ? "" : e.getMessage(); - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", msg); - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", e.toString()); + MONITOR_LOGGER.log(Level.TRACE, msg); + MONITOR_LOGGER.log(Level.TRACE, e::toString); } } } @@ -1346,8 +1316,7 @@ public abstract class Monitor setAlreadyNotified(o, index, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, an); msg = "The observed attribute type is not valid."; - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", msg); + MONITOR_LOGGER.log(Level.TRACE, msg); } } } @@ -1363,8 +1332,7 @@ public abstract class Monitor setAlreadyNotified(o, index, THRESHOLD_ERROR_NOTIFIED, an); msg = "The threshold type is not valid."; - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", msg); + MONITOR_LOGGER.log(Level.TRACE, msg); } } } @@ -1381,8 +1349,7 @@ public abstract class Monitor notifType = RUNTIME_ERROR; setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an); - MONITOR_LOGGER.logp(Level.FINEST, - Monitor.class.getName(), "monitor", msg); + MONITOR_LOGGER.log(Level.TRACE, msg); } } } diff --git a/jdk/src/java.management/share/classes/javax/management/monitor/StringMonitor.java b/jdk/src/java.management/share/classes/javax/management/monitor/StringMonitor.java index cf47fa16af3..f92e29673c0 100644 --- a/jdk/src/java.management/share/classes/javax/management/monitor/StringMonitor.java +++ b/jdk/src/java.management/share/classes/javax/management/monitor/StringMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -26,7 +26,7 @@ package javax.management.monitor; import static com.sun.jmx.defaults.JmxProperties.MONITOR_LOGGER; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.ObjectName; import javax.management.MBeanNotificationInfo; import static javax.management.monitor.MonitorNotification.*; @@ -151,8 +151,7 @@ public class StringMonitor extends Monitor implements StringMonitorMBean { */ public synchronized void start() { if (isActive()) { - MONITOR_LOGGER.logp(Level.FINER, StringMonitor.class.getName(), - "start", "the monitor is already active"); + MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active"); return; } // Reset values. diff --git a/jdk/src/java.management/share/classes/javax/management/relation/MBeanServerNotificationFilter.java b/jdk/src/java.management/share/classes/javax/management/relation/MBeanServerNotificationFilter.java index b3997964961..545712a0287 100644 --- a/jdk/src/java.management/share/classes/javax/management/relation/MBeanServerNotificationFilter.java +++ b/jdk/src/java.management/share/classes/javax/management/relation/MBeanServerNotificationFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -45,7 +45,7 @@ import javax.management.NotificationFilterSupport; import javax.management.ObjectName; import java.util.List; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import java.util.Vector; /** @@ -160,14 +160,12 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { public MBeanServerNotificationFilter() { super(); - RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(), - "MBeanServerNotificationFilter"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION); enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION); - RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(), - "MBeanServerNotificationFilter"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -181,14 +179,12 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { */ public synchronized void disableAllObjectNames() { - RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(), - "disableAllObjectNames"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); selectedNames = new Vector(); deselectedNames = null; - RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(), - "disableAllObjectNames"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -207,8 +203,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(), - "disableObjectName", objectName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}" + objectName); // Removes from selected ObjectNames, if present if (selectedNames != null) { @@ -226,8 +221,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { } } - RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(), - "disableObjectName"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -236,14 +230,12 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { */ public synchronized void enableAllObjectNames() { - RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(), - "enableAllObjectNames"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); selectedNames = null; deselectedNames = new Vector(); - RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(), - "enableAllObjectNames"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -262,8 +254,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(), - "enableObjectName", objectName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", objectName); // Removes from deselected ObjectNames, if present if (deselectedNames != null) { @@ -281,8 +272,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { } } - RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(), - "enableObjectName"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -349,16 +339,13 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(), - "isNotificationEnabled", notif); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", notif); // Checks the type first String ntfType = notif.getType(); Vector enabledTypes = getEnabledTypes(); if (!(enabledTypes.contains(ntfType))) { - RELATION_LOGGER.logp(Level.FINER, - MBeanServerNotificationFilter.class.getName(), - "isNotificationEnabled", + RELATION_LOGGER.log(Level.TRACE, "Type not selected, exiting"); return false; } @@ -375,9 +362,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { // checks for explicit selection if (selectedNames.size() == 0) { // All are explicitly not selected - RELATION_LOGGER.logp(Level.FINER, - MBeanServerNotificationFilter.class.getName(), - "isNotificationEnabled", + RELATION_LOGGER.log(Level.TRACE, "No ObjectNames selected, exiting"); return false; } @@ -385,9 +370,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { isSelectedFlg = selectedNames.contains(objName); if (!isSelectedFlg) { // Not in the explicit selected list - RELATION_LOGGER.logp(Level.FINER, - MBeanServerNotificationFilter.class.getName(), - "isNotificationEnabled", + RELATION_LOGGER.log(Level.TRACE, "ObjectName not in selected list, exiting"); return false; } @@ -399,26 +382,20 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { if (deselectedNames == null) { // All are implicitly deselected and it is not explicitly // selected - RELATION_LOGGER.logp(Level.FINER, - MBeanServerNotificationFilter.class.getName(), - "isNotificationEnabled", + RELATION_LOGGER.log(Level.TRACE, "ObjectName not selected, and all " + "names deselected, exiting"); return false; } else if (deselectedNames.contains(objName)) { // Explicitly deselected - RELATION_LOGGER.logp(Level.FINER, - MBeanServerNotificationFilter.class.getName(), - "isNotificationEnabled", + RELATION_LOGGER.log(Level.TRACE, "ObjectName explicitly not selected, exiting"); return false; } } - RELATION_LOGGER.logp(Level.FINER, - MBeanServerNotificationFilter.class.getName(), - "isNotificationEnabled", + RELATION_LOGGER.log(Level.TRACE, "ObjectName selected, exiting"); return true; } diff --git a/jdk/src/java.management/share/classes/javax/management/relation/RelationService.java b/jdk/src/java.management/share/classes/javax/management/relation/RelationService.java index 44d93e9baad..e6e3c56fcd6 100644 --- a/jdk/src/java.management/share/classes/javax/management/relation/RelationService.java +++ b/jdk/src/java.management/share/classes/javax/management/relation/RelationService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -36,7 +36,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import javax.management.Attribute; import javax.management.AttributeNotFoundException; @@ -157,13 +157,11 @@ public class RelationService extends NotificationBroadcasterSupport */ public RelationService(boolean immediatePurgeFlag) { - RELATION_LOGGER.entering(RelationService.class.getName(), - "RelationService"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); setPurgeFlag(immediatePurgeFlag); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "RelationService"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -286,8 +284,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "createRelationType", relationTypeName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); // Can throw an InvalidRelationTypeException RelationType relType = @@ -295,8 +292,7 @@ public class RelationService extends NotificationBroadcasterSupport addRelationTypeInt(relType); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "createRelationType"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -325,8 +321,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "addRelationType"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); // Checks the role infos List roleInfoList = relationTypeObj.getRoleInfos(); @@ -346,8 +341,7 @@ public class RelationService extends NotificationBroadcasterSupport addRelationTypeInt(relationTypeObj); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "addRelationType"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -385,14 +379,12 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRoleInfos", relationTypeName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); // Can throw a RelationTypeNotFoundException RelationType relType = getRelationType(relationTypeName); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getRoleInfos"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return relType.getRoleInfos(); } @@ -421,8 +413,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRoleInfo", new Object[] {relationTypeName, roleInfoName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + relationTypeName, roleInfoName); // Can throw a RelationTypeNotFoundException RelationType relType = getRelationType(relationTypeName); @@ -430,8 +422,7 @@ public class RelationService extends NotificationBroadcasterSupport // Can throw a RoleInfoNotFoundException RoleInfo roleInfo = relType.getRoleInfo(roleInfoName); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getRoleInfo"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return roleInfo; } @@ -461,8 +452,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "removeRelationType", relationTypeName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); // Checks if the relation type to be removed exists // Can throw a RelationTypeNotFoundException @@ -504,8 +494,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "removeRelationType"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -566,9 +555,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "createRelation", - new Object[] {relationId, relationTypeName, roleList}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + relationId, relationTypeName, roleList); // Creates RelationSupport object // Can throw InvalidRoleValueException @@ -588,8 +576,7 @@ public class RelationService extends NotificationBroadcasterSupport relationId, relationTypeName, roleList); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "createRelation"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -654,8 +641,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "addRelation", relationObjectName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationObjectName); // Can throw RelationServiceNotRegisteredException isActive(); @@ -791,8 +777,7 @@ public class RelationService extends NotificationBroadcasterSupport newRefList.add(relationObjectName); updateUnregistrationListener(newRefList, null); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "addRelation"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -819,8 +804,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "isRelationMBean", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); // Can throw RelationNotFoundException Object result = getRelation(relationId); @@ -850,8 +834,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "isRelation", objectName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", objectName); String result = null; synchronized(myRelMBeanObjName2RelIdMap) { @@ -881,8 +864,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "hasRelation", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); try { // Can throw RelationNotFoundException @@ -933,8 +915,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "checkRoleReading", new Object[] {roleName, relationTypeName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + roleName, relationTypeName); Integer result; @@ -956,8 +938,7 @@ public class RelationService extends NotificationBroadcasterSupport result = Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME); } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleReading"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -995,9 +976,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "checkRoleWriting", - new Object[] {role, relationTypeName, initFlag}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + role, relationTypeName, initFlag); // Can throw a RelationTypeNotFoundException RelationType relType = getRelationType(relationTypeName); @@ -1013,8 +993,7 @@ public class RelationService extends NotificationBroadcasterSupport try { roleInfo = relType.getRoleInfo(roleName); } catch (RoleInfoNotFoundException exc) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleWriting"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME); } @@ -1024,8 +1003,7 @@ public class RelationService extends NotificationBroadcasterSupport roleInfo, writeChkFlag); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleWriting"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1055,8 +1033,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "sendRelationCreationNotification", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); // Message StringBuilder ntfMsg = new StringBuilder("Creation of relation "); @@ -1071,8 +1048,7 @@ public class RelationService extends NotificationBroadcasterSupport null, null); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "sendRelationCreationNotification"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1114,9 +1090,8 @@ public class RelationService extends NotificationBroadcasterSupport if (!(oldValue instanceof ArrayList)) oldValue = new ArrayList(oldValue); - RELATION_LOGGER.entering(RelationService.class.getName(), - "sendRoleUpdateNotification", - new Object[] {relationId, newRole, oldValue}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + relationId, newRole, oldValue); String roleName = newRole.getRoleName(); List newRoleVal = newRole.getRoleValue(); @@ -1140,8 +1115,7 @@ public class RelationService extends NotificationBroadcasterSupport newRoleVal, oldValue); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "sendRoleUpdateNotification"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); } /** @@ -1172,9 +1146,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "sendRelationRemovalNotification", - new Object[] {relationId, unregMBeanList}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + relationId, unregMBeanList); // Can throw RelationNotFoundException sendNotificationInt(3, @@ -1186,8 +1159,7 @@ public class RelationService extends NotificationBroadcasterSupport null); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "sendRelationRemovalNotification"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1226,8 +1198,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "updateRoleMap", new Object[] {relationId, newRole, oldValue}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + relationId, newRole, oldValue); // Can throw RelationServiceNotRegisteredException isActive(); @@ -1303,8 +1275,7 @@ public class RelationService extends NotificationBroadcasterSupport // all ObjectNames of interest updateUnregistrationListener(newRefList, obsRefList); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "updateRoleMap"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1338,8 +1309,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "removeRelation", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); // Checks there is a relation with this id // Can throw RelationNotFoundException @@ -1442,8 +1412,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "removeRelation"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1476,8 +1445,7 @@ public class RelationService extends NotificationBroadcasterSupport public void purgeRelations() throws RelationServiceNotRegisteredException { - RELATION_LOGGER.entering(RelationService.class.getName(), - "purgeRelations"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); // Can throw RelationServiceNotRegisteredException isActive(); @@ -1574,8 +1542,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "purgeRelations"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1610,9 +1577,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "findReferencingRelations", - new Object[] {mbeanName, relationTypeName, roleName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + mbeanName, relationTypeName, roleName); Map> result = new HashMap>(); @@ -1684,8 +1650,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "findReferencingRelations"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1720,9 +1685,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "findAssociatedMBeans", - new Object[] {mbeanName, relationTypeName, roleName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + mbeanName, relationTypeName, roleName); // Retrieves the map -> for those // criterias @@ -1769,8 +1733,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "findAssociatedMBeans"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1794,8 +1757,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "findRelationsOfType"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); // Can throw RelationTypeNotFoundException RelationType relType = getRelationType(relationTypeName); @@ -1809,8 +1771,7 @@ public class RelationService extends NotificationBroadcasterSupport result = new ArrayList(result1); } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "findRelationsOfType"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1845,8 +1806,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRole", new Object[] {relationId, roleName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + relationId, roleName); // Can throw RelationServiceNotRegisteredException isActive(); @@ -1899,7 +1860,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), "getRole"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1931,8 +1892,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRoles", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); // Can throw RelationServiceNotRegisteredException isActive(); @@ -1976,7 +1936,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), "getRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -2004,8 +1964,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRoles", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); // Can throw a RelationNotFoundException Object relObj = getRelation(relationId); @@ -2028,7 +1987,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), "getRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -2055,8 +2014,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRoleCardinality", new Object[] {relationId, roleName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + relationId, roleName); // Can throw a RelationNotFoundException Object relObj = getRelation(relationId); @@ -2098,8 +2057,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getRoleCardinality"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -2147,8 +2105,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "setRole", new Object[] {relationId, role}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + relationId, role); // Can throw RelationServiceNotRegisteredException isActive(); @@ -2211,7 +2169,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), "setRole"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -2247,8 +2205,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "setRoles", new Object[] {relationId, roleList}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + relationId, roleList); // Can throw RelationServiceNotRegisteredException isActive(); @@ -2296,7 +2254,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), "setRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -2322,8 +2280,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getReferencedMBeans", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", + relationId); // Can throw a RelationNotFoundException Object relObj = getRelation(relationId); @@ -2346,8 +2304,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getReferencedMBeans"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -2371,8 +2328,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRelationTypeName", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); // Can throw a RelationNotFoundException Object relObj = getRelation(relationId); @@ -2395,8 +2351,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getRelationTypeName"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -2421,8 +2376,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "handleNotification", notif); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", notif); if (notif instanceof MBeanServerNotification) { @@ -2480,8 +2434,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "handleNotification"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -2495,8 +2448,7 @@ public class RelationService extends NotificationBroadcasterSupport */ public MBeanNotificationInfo[] getNotificationInfo() { - RELATION_LOGGER.entering(RelationService.class.getName(), - "getNotificationInfo"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); String ntfClass = "javax.management.relation.RelationNotification"; @@ -2514,8 +2466,7 @@ public class RelationService extends NotificationBroadcasterSupport MBeanNotificationInfo ntfInfo = new MBeanNotificationInfo(ntfTypes, ntfClass, ntfDesc); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getNotificationInfo"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return new MBeanNotificationInfo[] {ntfInfo}; } @@ -2539,8 +2490,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "addRelationTypeInt"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); String relTypeName = relationTypeObj.getRelationTypeName(); @@ -2570,8 +2520,7 @@ public class RelationService extends NotificationBroadcasterSupport ((RelationTypeSupport)relationTypeObj).setRelationServiceFlag(true); } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "addRelationTypeInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -2595,8 +2544,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRelationType", relationTypeName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); // No null relation type accepted, so can use get() RelationType relType; @@ -2611,8 +2559,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new RelationTypeNotFoundException(excMsgStrB.toString()); } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getRelationType"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return relType; } @@ -2639,8 +2586,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "getRelation", relationId); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId); // No null relation accepted, so can use get() Object rel; @@ -2653,8 +2599,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new RelationNotFoundException(excMsg); } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "getRelation"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return rel; } @@ -2684,9 +2629,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "addNewMBeanReference", - new Object[] {objectName, relationId, roleName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + objectName, relationId, roleName); boolean isNewFlag = false; @@ -2739,8 +2683,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "addNewMBeanReference"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return isNewFlag; } @@ -2772,9 +2715,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "removeMBeanReference", - new Object[] {objectName, relationId, roleName, allRolesFlag}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}", + objectName, relationId, roleName, allRolesFlag); boolean noLongerRefFlag = false; @@ -2790,8 +2732,7 @@ public class RelationService extends NotificationBroadcasterSupport if (mbeanRefMap == null) { // The MBean is no longer referenced - RELATION_LOGGER.exiting(RelationService.class.getName(), - "removeMBeanReference"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return true; } @@ -2824,8 +2765,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "removeMBeanReference"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return noLongerRefFlag; } @@ -2850,9 +2790,8 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.entering(RelationService.class.getName(), - "updateUnregistrationListener", - new Object[] {newRefList, obsoleteRefList}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", + newRefList, obsoleteRefList); // Can throw RelationServiceNotRegisteredException isActive(); @@ -2936,8 +2875,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "updateUnregistrationListener"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -3003,9 +2941,10 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "addRelationInt", new Object[] {relationBaseFlag, relationObj, - relationObjName, relationId, relationTypeName, roleList}); + RELATION_LOGGER.log(Level.TRACE, + "ENTRY {0} {1} {2} {3} {4} {5}", + relationBaseFlag, relationObj, relationObjName, + relationId, relationTypeName, roleList); // Can throw RelationServiceNotRegisteredException isActive(); @@ -3144,8 +3083,7 @@ public class RelationService extends NotificationBroadcasterSupport // OK : The Relation could not be found. } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "addRelationInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -3185,15 +3123,13 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "checkRoleInt", new Object[] {chkType, roleName, - roleValue, roleInfo, writeChkFlag}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4}", + chkType, roleName, roleValue, roleInfo, writeChkFlag); // Compares names String expName = roleInfo.getName(); if (!(roleName.equals(expName))) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME); } @@ -3201,13 +3137,11 @@ public class RelationService extends NotificationBroadcasterSupport if (chkType == 1) { boolean isReadable = roleInfo.isReadable(); if (!isReadable) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return Integer.valueOf(RoleStatus.ROLE_NOT_READABLE); } else { // End of check :) - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return 0; } } @@ -3216,8 +3150,7 @@ public class RelationService extends NotificationBroadcasterSupport if (writeChkFlag) { boolean isWritable = roleInfo.isWritable(); if (!isWritable) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return RoleStatus.ROLE_NOT_WRITABLE; } } @@ -3227,16 +3160,14 @@ public class RelationService extends NotificationBroadcasterSupport // Checks minimum cardinality boolean chkMinFlag = roleInfo.checkMinDegree(refNbr); if (!chkMinFlag) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return RoleStatus.LESS_THAN_MIN_ROLE_DEGREE; } // Checks maximum cardinality boolean chkMaxFlag = roleInfo.checkMaxDegree(refNbr); if (!chkMaxFlag) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return RoleStatus.MORE_THAN_MAX_ROLE_DEGREE; } @@ -3252,8 +3183,7 @@ public class RelationService extends NotificationBroadcasterSupport // Checks it is registered if (currObjName == null) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return RoleStatus.REF_MBEAN_NOT_REGISTERED; } @@ -3263,20 +3193,17 @@ public class RelationService extends NotificationBroadcasterSupport boolean classSts = myMBeanServer.isInstanceOf(currObjName, expClassName); if (!classSts) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS; } } catch (InstanceNotFoundException exc) { - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return RoleStatus.REF_MBEAN_NOT_REGISTERED; } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "checkRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return 0; } @@ -3328,10 +3255,9 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "initializeMissingRoles", new Object[] {relationBaseFlag, - relationObj, relationObjName, relationId, relationTypeName, - roleInfoList}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4} {5}", + relationBaseFlag, relationObj, relationObjName, + relationId, relationTypeName, roleInfoList); // Can throw RelationServiceNotRegisteredException isActive(); @@ -3410,8 +3336,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "initializeMissingRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -3528,9 +3453,9 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "sendNotificationInt", new Object[] {intNtfType, message, - relationId, unregMBeanList, roleName, roleNewValue, oldValue}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4} {5} {6}", + intNtfType, message, relationId, unregMBeanList, + roleName, roleNewValue, oldValue); // Relation type name // Note: do not use getRelationTypeName() as if it is a relation MBean @@ -3616,8 +3541,7 @@ public class RelationService extends NotificationBroadcasterSupport sendNotification(ntf); - RELATION_LOGGER.exiting(RelationService.class.getName(), - "sendNotificationInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -3654,9 +3578,8 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationService.class.getName(), - "handleReferenceUnregistration", - new Object[] {relationId, objectName, roleNameList}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + relationId, objectName, roleNameList); // Can throw RelationServiceNotRegisteredException isActive(); @@ -3782,8 +3705,7 @@ public class RelationService extends NotificationBroadcasterSupport } } - RELATION_LOGGER.exiting(RelationService.class.getName(), - "handleReferenceUnregistration"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } } diff --git a/jdk/src/java.management/share/classes/javax/management/relation/RelationSupport.java b/jdk/src/java.management/share/classes/javax/management/relation/RelationSupport.java index 09f8b93e754..30a6ec50309 100644 --- a/jdk/src/java.management/share/classes/javax/management/relation/RelationSupport.java +++ b/jdk/src/java.management/share/classes/javax/management/relation/RelationSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -27,8 +27,8 @@ package javax.management.relation; +import java.lang.System.Logger.Level; import java.util.ArrayList; - import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -162,8 +162,7 @@ public class RelationSupport super(); - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "RelationSupport"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); // Can throw InvalidRoleValueException and IllegalArgumentException initMembers(relationId, @@ -172,8 +171,7 @@ public class RelationSupport relationTypeName, list); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "RelationSupport"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); } /** @@ -239,8 +237,7 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "RelationSupport"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); // Can throw InvalidRoleValueException and // IllegalArgumentException @@ -250,8 +247,7 @@ public class RelationSupport relationTypeName, list); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "RelationSupport"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); } // @@ -286,15 +282,14 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "getRole", roleName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleName); // Can throw RoleNotFoundException and // RelationServiceNotRegisteredException List result = cast( getRoleInt(roleName, false, null, false)); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getRole"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -324,12 +319,12 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), "getRoles"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); // Can throw RelationServiceNotRegisteredException RoleResult result = getRolesInt(roleNameArray, false, null); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -346,8 +341,7 @@ public class RelationSupport public RoleResult getAllRoles() throws RelationServiceNotRegisteredException { - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "getAllRoles"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); RoleResult result = null; try { @@ -356,7 +350,7 @@ public class RelationSupport // OK : Invalid parameters, ignore... } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getAllRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -367,8 +361,7 @@ public class RelationSupport */ public RoleList retrieveAllRoles() { - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "retrieveAllRoles"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); RoleList result; synchronized(myRoleName2ValueMap) { @@ -376,8 +369,7 @@ public class RelationSupport new RoleList(new ArrayList(myRoleName2ValueMap.values())); } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "retrieveAllRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -400,8 +392,7 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "getRoleCardinality", roleName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleName); // Try to retrieve the role Role role; @@ -426,8 +417,7 @@ public class RelationSupport List roleValue = role.getRoleValue(); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "getRoleCardinality"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return roleValue.size(); } @@ -476,13 +466,12 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "setRole", role); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", role); // Will return null :) Object result = setRoleInt(role, false, null, false); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRole"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -521,12 +510,11 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "setRoles", list); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", list); RoleResult result = setRolesInt(list, false, null); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRoles"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -570,9 +558,7 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "handleMBeanUnregistration", - new Object[]{objectName, roleName}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", objectName, roleName); // Can throw RoleNotFoundException, InvalidRoleValueException, // or RelationTypeNotFoundException @@ -581,8 +567,7 @@ public class RelationSupport false, null); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "handleMBeanUnregistration"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -594,8 +579,7 @@ public class RelationSupport */ public Map> getReferencedMBeans() { - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "getReferencedMBeans"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); Map> refMBeanMap = new HashMap>(); @@ -628,8 +612,7 @@ public class RelationSupport } } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "getReferencedMBeans"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return refMBeanMap; } @@ -779,8 +762,7 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "getRoleInt", roleName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleName); int pbType = 0; @@ -885,7 +867,7 @@ public class RelationSupport } } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -921,8 +903,7 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "getRolesInt"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); RoleList roleList = new RoleList(); RoleUnresolvedList roleUnresList = new RoleUnresolvedList(); @@ -966,8 +947,7 @@ public class RelationSupport } RoleResult result = new RoleResult(roleList, roleUnresList); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "getRolesInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -991,8 +971,7 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "getAllRolesInt"); + RELATION_LOGGER.log(Level.TRACE, "ENTRY"); List roleNameList; synchronized(myRoleName2ValueMap) { @@ -1006,8 +985,7 @@ public class RelationSupport relationServCallFlg, relationServ); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "getAllRolesInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1083,9 +1061,9 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "setRoleInt", new Object[] {aRole, relationServCallFlg, - relationServ, multiRoleFlg}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}", + aRole, relationServCallFlg, relationServ, + multiRoleFlg); String roleName = aRole.getRoleName(); int pbType = 0; @@ -1244,7 +1222,7 @@ public class RelationSupport } } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRoleInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1286,9 +1264,9 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "sendRoleUpdateNotification", new Object[] {newRole, - oldRoleValue, relationServCallFlg, relationServ}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}", + newRole, oldRoleValue, relationServCallFlg, + relationServ); if (relationServCallFlg) { // Direct call to the Relation Service @@ -1341,8 +1319,7 @@ public class RelationSupport } } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "sendRoleUpdateNotification"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1383,9 +1360,9 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "updateRelationServiceMap", new Object[] {newRole, - oldRoleValue, relationServCallFlg, relationServ}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}", + newRole, oldRoleValue, relationServCallFlg, + relationServ); if (relationServCallFlg) { // Direct call to the Relation Service @@ -1433,8 +1410,7 @@ public class RelationSupport } } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "updateRelationServiceMap"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1484,9 +1460,8 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "setRolesInt", - new Object[] {list, relationServCallFlg, relationServ}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}", + list, relationServCallFlg, relationServ); RoleList roleList = new RoleList(); RoleUnresolvedList roleUnresList = new RoleUnresolvedList(); @@ -1534,7 +1509,7 @@ public class RelationSupport RoleResult result = new RoleResult(roleList, roleUnresList); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRolesInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -1578,9 +1553,9 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "initMembers", new Object[] {relationId, relationServiceName, - relationServiceMBeanServer, relationTypeName, list}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4}", + relationId, relationServiceName, + relationServiceMBeanServer, relationTypeName, list); myRelId = relationId; myRelServiceName = relationServiceName; @@ -1589,7 +1564,7 @@ public class RelationSupport // Can throw InvalidRoleValueException initRoleMap(list); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "initMembers"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1608,8 +1583,7 @@ public class RelationSupport return; } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "initRoleMap", list); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", list); synchronized(myRoleName2ValueMap) { @@ -1632,7 +1606,7 @@ public class RelationSupport } } - RELATION_LOGGER.exiting(RelationSupport.class.getName(), "initRoleMap"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -1692,9 +1666,9 @@ public class RelationSupport throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationSupport.class.getName(), - "handleMBeanUnregistrationInt", new Object[] {objectName, - roleName, relationServCallFlg, relationServ}); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}", + objectName, roleName, relationServCallFlg, + relationServ); // Retrieves current role value Role role; @@ -1723,8 +1697,7 @@ public class RelationSupport Object result = setRoleInt(newRole, relationServCallFlg, relationServ, false); - RELATION_LOGGER.exiting(RelationSupport.class.getName(), - "handleMBeanUnregistrationInt"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } diff --git a/jdk/src/java.management/share/classes/javax/management/relation/RelationTypeSupport.java b/jdk/src/java.management/share/classes/javax/management/relation/RelationTypeSupport.java index b6fb9c459b2..60e3612278b 100644 --- a/jdk/src/java.management/share/classes/javax/management/relation/RelationTypeSupport.java +++ b/jdk/src/java.management/share/classes/javax/management/relation/RelationTypeSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -42,7 +42,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.logging.Level; +import java.lang.System.Logger.Level; /** * A RelationTypeSupport object implements the RelationType interface. @@ -173,15 +173,13 @@ public class RelationTypeSupport implements RelationType { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationTypeSupport.class.getName(), - "RelationTypeSupport", relationTypeName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); // Can throw InvalidRelationTypeException, ClassNotFoundException // and NotCompliantMBeanException initMembers(relationTypeName, roleInfoArray); - RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(), - "RelationTypeSupport"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -199,13 +197,11 @@ public class RelationTypeSupport implements RelationType { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationTypeSupport.class.getName(), - "RelationTypeSupport", relationTypeName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); typeName = relationTypeName; - RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(), - "RelationTypeSupport"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -251,8 +247,7 @@ public class RelationTypeSupport implements RelationType { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationTypeSupport.class.getName(), - "getRoleInfo", roleInfoName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleInfoName); // No null RoleInfo allowed, so use get() RoleInfo result = roleName2InfoMap.get(roleInfoName); @@ -265,8 +260,7 @@ public class RelationTypeSupport implements RelationType { throw new RoleInfoNotFoundException(excMsgStrB.toString()); } - RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(), - "getRoleInfo"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return result; } @@ -297,8 +291,7 @@ public class RelationTypeSupport implements RelationType { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationTypeSupport.class.getName(), - "addRoleInfo", roleInfo); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleInfo); if (isInRelationService) { // Trying to update a declared relation type @@ -319,8 +312,7 @@ public class RelationTypeSupport implements RelationType { roleName2InfoMap.put(roleName, new RoleInfo(roleInfo)); - RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(), - "addRoleInfo"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } @@ -351,8 +343,7 @@ public class RelationTypeSupport implements RelationType { throw new IllegalArgumentException(excMsg); } - RELATION_LOGGER.entering(RelationTypeSupport.class.getName(), - "initMembers", relationTypeName); + RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName); typeName = relationTypeName; @@ -366,8 +357,7 @@ public class RelationTypeSupport implements RelationType { new RoleInfo(currRoleInfo)); } - RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(), - "initMembers"); + RELATION_LOGGER.log(Level.TRACE, "RETURN"); return; } diff --git a/jdk/src/java.management/share/classes/javax/management/timer/Timer.java b/jdk/src/java.management/share/classes/javax/management/timer/Timer.java index b199e8e258a..edbf85e8627 100644 --- a/jdk/src/java.management/share/classes/javax/management/timer/Timer.java +++ b/jdk/src/java.management/share/classes/javax/management/timer/Timer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.Vector; -import java.util.logging.Level; +import java.lang.System.Logger.Level; // jmx imports // @@ -221,8 +221,7 @@ public class Timer extends NotificationBroadcasterSupport */ public void preDeregister() throws java.lang.Exception { - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "preDeregister", "stop the timer"); + TIMER_LOGGER.log(Level.TRACE, "stop the timer"); // Stop the timer. // @@ -273,8 +272,7 @@ public class Timer extends NotificationBroadcasterSupport */ public synchronized void start() { - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "start", "starting the timer"); + TIMER_LOGGER.log(Level.TRACE, "starting the timer"); // Start the TimerAlarmClock. // @@ -323,11 +321,9 @@ public class Timer extends NotificationBroadcasterSupport // isActive = true; - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "start", "timer started"); + TIMER_LOGGER.log(Level.TRACE, "timer started"); } else { - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "start", "the timer is already activated"); + TIMER_LOGGER.log(Level.TRACE, "the timer is already activated"); } } @@ -336,8 +332,7 @@ public class Timer extends NotificationBroadcasterSupport */ public synchronized void stop() { - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "stop", "stopping the timer"); + TIMER_LOGGER.log(Level.TRACE, "stopping the timer"); // Stop the TimerAlarmClock. // @@ -370,11 +365,9 @@ public class Timer extends NotificationBroadcasterSupport // isActive = false; - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "stop", "timer stopped"); + TIMER_LOGGER.log(Level.TRACE, "timer stopped"); } else { - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "stop", "the timer is already deactivated"); + TIMER_LOGGER.log(Level.TRACE, "the timer is already deactivated"); } } @@ -444,9 +437,8 @@ public class Timer extends NotificationBroadcasterSupport if (currentDate.after(date)) { date.setTime(currentDate.getTime()); - if (TIMER_LOGGER.isLoggable(Level.FINER)) { - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "addNotification", + if (TIMER_LOGGER.isLoggable(Level.TRACE)) { + TIMER_LOGGER.log(Level.TRACE, "update timer notification to add with:" + "\n\tNotification date = " + date); } @@ -486,7 +478,7 @@ public class Timer extends NotificationBroadcasterSupport obj[ALARM_CLOCK_INDEX] = (Object)alarmClock; obj[FIXED_RATE_INDEX] = Boolean.valueOf(fixedRate); - if (TIMER_LOGGER.isLoggable(Level.FINER)) { + if (TIMER_LOGGER.isLoggable(Level.TRACE)) { StringBuilder strb = new StringBuilder() .append("adding timer notification:\n\t") .append("Notification source = ") @@ -503,8 +495,7 @@ public class Timer extends NotificationBroadcasterSupport .append(nbOccurences) .append("\n\tNotification executes at fixed rate = ") .append(fixedRate); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "addNotification", strb.toString()); + TIMER_LOGGER.log(Level.TRACE, strb::toString); } timerTable.put(notifID, obj); @@ -522,8 +513,7 @@ public class Timer extends NotificationBroadcasterSupport } } - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "addNotification", "timer notification added"); + TIMER_LOGGER.log(Level.TRACE, "timer notification added"); return notifID; } @@ -677,7 +667,7 @@ public class Timer extends NotificationBroadcasterSupport // Remove the timer notification from the timer table. // - if (TIMER_LOGGER.isLoggable(Level.FINER)) { + if (TIMER_LOGGER.isLoggable(Level.TRACE)) { StringBuilder strb = new StringBuilder() .append("removing timer notification:") .append("\n\tNotification source = ") @@ -694,14 +684,12 @@ public class Timer extends NotificationBroadcasterSupport .append(obj[TIMER_NB_OCCUR_INDEX]) .append("\n\tNotification executes at fixed rate = ") .append(obj[FIXED_RATE_INDEX]); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "removeNotification", strb.toString()); + TIMER_LOGGER.log(Level.TRACE, strb::toString); } timerTable.remove(id); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "removeNotification", "timer notification removed"); + TIMER_LOGGER.log(Level.TRACE, "timer notification removed"); } /** @@ -752,19 +740,16 @@ public class Timer extends NotificationBroadcasterSupport } // Remove all the timer notifications from the timer table. - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "removeAllNotifications", "removing all timer notifications"); + TIMER_LOGGER.log(Level.TRACE, "removing all timer notifications"); timerTable.clear(); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "removeAllNotifications", "all timer notifications removed"); + TIMER_LOGGER.log(Level.TRACE, "all timer notifications removed"); // Reset the counterID. // counterID = 0; - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "removeAllNotifications", "timer notification counter ID reset"); + TIMER_LOGGER.log(Level.TRACE, "timer notification counter ID reset"); } // GETTERS AND SETTERS @@ -1021,7 +1006,7 @@ public class Timer extends NotificationBroadcasterSupport while ( (currentDate.after(date)) && (timerTable.containsKey(notifID)) ) { if (currentFlag == true) { - if (TIMER_LOGGER.isLoggable(Level.FINER)) { + if (TIMER_LOGGER.isLoggable(Level.TRACE)) { StringBuilder strb = new StringBuilder() .append("sending past timer notification:") .append("\n\tNotification source = ") @@ -1038,13 +1023,11 @@ public class Timer extends NotificationBroadcasterSupport .append(obj[TIMER_NB_OCCUR_INDEX]) .append("\n\tNotification executes at fixed rate = ") .append(obj[FIXED_RATE_INDEX]); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "sendPastNotifications", strb.toString()); + TIMER_LOGGER.log(Level.TRACE, strb::toString); } sendNotification(date, notif); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "sendPastNotifications", "past timer notification sent"); + TIMER_LOGGER.log(Level.TRACE, "past timer notification sent"); } // Update the date and the number of occurrences of the timer notification. @@ -1107,7 +1090,7 @@ public class Timer extends NotificationBroadcasterSupport timer.schedule(alarmClock, alarmClock.timeout); } } - if (TIMER_LOGGER.isLoggable(Level.FINER)) { + if (TIMER_LOGGER.isLoggable(Level.TRACE)) { TimerNotification notif = (TimerNotification)obj[TIMER_NOTIF_INDEX]; StringBuilder strb = new StringBuilder() .append("update timer notification with:") @@ -1125,8 +1108,7 @@ public class Timer extends NotificationBroadcasterSupport .append(nbOccurences) .append("\n\tNotification executes at fixed rate = ") .append(fixedRate); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "updateTimerTable", strb.toString()); + TIMER_LOGGER.log(Level.TRACE, strb::toString); } } else { @@ -1211,7 +1193,7 @@ public class Timer extends NotificationBroadcasterSupport */ void sendNotification(Date timeStamp, TimerNotification notification) { - if (TIMER_LOGGER.isLoggable(Level.FINER)) { + if (TIMER_LOGGER.isLoggable(Level.TRACE)) { StringBuilder strb = new StringBuilder() .append("sending timer notification:") .append("\n\tNotification source = ") @@ -1222,8 +1204,7 @@ public class Timer extends NotificationBroadcasterSupport .append(notification.getNotificationID()) .append("\n\tNotification date = ") .append(timeStamp); - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "sendNotification", strb.toString()); + TIMER_LOGGER.log(Level.TRACE, strb::toString); } long curSeqNumber; synchronized(this) { @@ -1236,7 +1217,6 @@ public class Timer extends NotificationBroadcasterSupport this.sendNotification((TimerNotification)notification.cloneTimerNotification()); } - TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(), - "sendNotification", "timer notification sent"); + TIMER_LOGGER.log(Level.TRACE, "timer notification sent"); } } diff --git a/jdk/src/java.management/share/classes/javax/management/timer/TimerAlarmClock.java b/jdk/src/java.management/share/classes/javax/management/timer/TimerAlarmClock.java index 9ae8080ab6a..06007415afe 100644 --- a/jdk/src/java.management/share/classes/javax/management/timer/TimerAlarmClock.java +++ b/jdk/src/java.management/share/classes/javax/management/timer/TimerAlarmClock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -26,7 +26,7 @@ package javax.management.timer; import java.util.Date; -import java.util.logging.Level; +import java.lang.System.Logger.Level; import static com.sun.jmx.defaults.JmxProperties.TIMER_LOGGER; /** @@ -73,7 +73,7 @@ class TimerAlarmClock extends java.util.TimerTask { TimerAlarmClockNotification notif = new TimerAlarmClockNotification(this); listener.notifyAlarmClock(notif); } catch (Exception e) { - TIMER_LOGGER.logp(Level.FINEST, Timer.class.getName(), "run", + TIMER_LOGGER.log(Level.TRACE, "Got unexpected exception when sending a notification", e); } } diff --git a/jdk/src/java.management/share/classes/module-info.java b/jdk/src/java.management/share/classes/module-info.java index 705e3ef2098..c130350387a 100644 --- a/jdk/src/java.management/share/classes/module-info.java +++ b/jdk/src/java.management/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -31,7 +31,6 @@ */ module java.management { requires transitive java.rmi; - requires java.logging; requires java.naming; exports java.lang.management; @@ -55,4 +54,3 @@ module java.management { provides javax.security.auth.spi.LoginModule with com.sun.jmx.remote.security.FileLoginModule; } - diff --git a/jdk/test/sun/management/LoggingTest/LoggingTest.java b/jdk/test/sun/management/LoggingTest/LoggingTest.java new file mode 100644 index 00000000000..18f28526a23 --- /dev/null +++ b/jdk/test/sun/management/LoggingTest/LoggingTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2017, 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.IOException; +import java.io.PrintStream; +import java.lang.management.ManagementFactory; +import java.util.List; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +public class LoggingTest { + + static class TestStream extends PrintStream { + final ByteArrayOutputStream bos = new ByteArrayOutputStream(); + private volatile boolean recording; + public TestStream(PrintStream wrapped) { + super(wrapped); + } + + void startRecording() { + recording = true; + } + + void stopRecording() { + recording = false; + } + + @Override + public void write(int b) { + if (recording) { + bos.write(b); + } + super.write(b); + } + + @Override + public void write(byte[] buf, int off, int len) { + if (recording) { + bos.write(buf, off, len); + } + super.write(buf, off, len); + } + + @Override + public void write(byte[] buf) throws IOException { + if (recording) { + bos.write(buf); + } + super.write(buf); + } + + } + + public void run(TestStream ts) { + + // start recording traces and trigger creation of the platform + // MBeanServer to produce some. This won't work if the platform + // MBeanServer was already initialized - so it's important to + // run this test in its own JVM. + ts.startRecording(); + MBeanServer platform = ManagementFactory.getPlatformMBeanServer(); + ts.stopRecording(); + String printed = ts.bos.toString(); + ts.bos.reset(); + + // Check that the Platform MBeanServer is emitting the expected + // log traces. This can be a bit fragile because debug traces + // could be changed without notice - in which case this test will + // need to be updated. + // For each registered MBean we expect to see three traces. + // If the messages logged by the MBeanServer change then these checks + // may need to be revisited. + List checkTraces = + List.of("ObjectName = %s", "name = %s", "JMX.mbean.registered %s"); + + for (ObjectName o : platform.queryNames(ObjectName.WILDCARD, null)) { + String n = o.toString(); + System.out.println("Checking log for: " + n); + for (String check : checkTraces) { + String s = String.format(check, n); + if (!printed.contains(s)) { + throw new RuntimeException("Trace not found: " + s); + } + } + } + } + +} diff --git a/jdk/test/sun/management/LoggingTest/LoggingWithJULTest.java b/jdk/test/sun/management/LoggingTest/LoggingWithJULTest.java new file mode 100644 index 00000000000..a15e5296ec7 --- /dev/null +++ b/jdk/test/sun/management/LoggingTest/LoggingWithJULTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2017, 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.nio.file.Paths; + +/** + * @test + * @bug 8172971 + * @modules java.management java.logging + * @summary Smoke test to check that logging in java.management works as expected. + * @build LoggingTest LoggingWithJULTest + * @run main/othervm LoggingWithJULTest + * @author danielfuchs + */ +public class LoggingWithJULTest { + + public static void main(String[] args) { + // Replace System.err + LoggingTest.TestStream ts = new LoggingTest.TestStream(System.err); + System.setErr(ts); + + // activate the javax.management traces + String properties = Paths.get(System.getProperty("test.src", "src"), + "logging.properties").toString(); + System.setProperty("java.util.logging.config.file", properties); + + // run the test + new LoggingTest().run(ts); + } + +} diff --git a/jdk/test/sun/management/LoggingTest/LoggingWithLoggerFinderTest.java b/jdk/test/sun/management/LoggingTest/LoggingWithLoggerFinderTest.java new file mode 100644 index 00000000000..feec435db2b --- /dev/null +++ b/jdk/test/sun/management/LoggingTest/LoggingWithLoggerFinderTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2017, 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 8172971 + * @modules java.management + * @summary Smoke test to check that logging in java.management is performed + * through System.Logger. This test installs a LoggerFinder service + * provider and verifies that it gets the traces. + * @build test.loggerfinder/test.loggerfinder.TestLoggerFinder LoggingTest LoggingWithLoggerFinderTest + * @run main/othervm --add-modules test.loggerfinder LoggingWithLoggerFinderTest + * @author danielfuchs + */ +public class LoggingWithLoggerFinderTest { + + public static void main(String[] args) { + // Replace System.err + LoggingTest.TestStream ts = new LoggingTest.TestStream(System.err); + System.setErr(ts); + + // run the test + new LoggingTest().run(ts); + } + +} diff --git a/jdk/test/sun/management/LoggingTest/logging.properties b/jdk/test/sun/management/LoggingTest/logging.properties new file mode 100644 index 00000000000..b2b2ab67557 --- /dev/null +++ b/jdk/test/sun/management/LoggingTest/logging.properties @@ -0,0 +1,55 @@ +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +# Note that these classes must be on the system classpath. +# By default we only configure a ConsoleHandler, which will only +# show messages at the INFO and above levels. +handlers= java.util.logging.ConsoleHandler + +# To also add the FileHandler, use the following line instead. +#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler + +# Default global logging level. +# This specifies which kinds of events are logged across +# all loggers. For any given facility this global level +# can be overriden by a facility specific level +# Note that the ConsoleHandler also has a separate level +# setting to limit messages printed to the console. +.level= INFO + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +# default file output is in user's home directory. +java.util.logging.FileHandler.pattern = %h/java%u.log +java.util.logging.FileHandler.limit = 50000 +java.util.logging.FileHandler.count = 1 +# Default number of locks FileHandler can obtain synchronously. +# This specifies maximum number of attempts to obtain lock file by FileHandler +# implemented by incrementing the unique field %u as per FileHandler API documentation. +java.util.logging.FileHandler.maxLocks = 100 +java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter + +# Limit the message that are printed on the console to INFO and above. +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter + +# Example to customize the SimpleFormatter output format +# to print one-line log message like this: +# : [] +# +# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n + +############################################################ +# Facility specific properties. +# Provides extra control for each logger. +############################################################ + +# For example, set the com.xyz.foo logger to only log SEVERE +# messages: +javax.management.level = ALL diff --git a/jdk/test/sun/management/LoggingTest/test.loggerfinder/module-info.java b/jdk/test/sun/management/LoggingTest/test.loggerfinder/module-info.java new file mode 100644 index 00000000000..08fd6642169 --- /dev/null +++ b/jdk/test/sun/management/LoggingTest/test.loggerfinder/module-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017, 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. + */ + +module test.loggerfinder { + // Install a LoggerFinder that will direct traces directly to System.err, + // without involving java.util.logging + provides java.lang.System.LoggerFinder with test.loggerfinder.TestLoggerFinder; +} diff --git a/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java b/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java new file mode 100644 index 00000000000..39c555eee9e --- /dev/null +++ b/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.loggerfinder; + +import java.lang.System.Logger; +import java.lang.System.Logger.Level; +import java.lang.System.LoggerFinder; +import java.lang.reflect.Module; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Optional; +import java.util.ResourceBundle; +import java.util.function.Predicate; +import java.lang.StackWalker.StackFrame; +import java.text.MessageFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/** + * A LoggerFinder that provides System.Logger which print directly + * on System.err, without involving java.logging. + * For the purpose of the test, loggers whose name start with java.management. + * will log all messages, and other loggers will only log level > INFO. + * @author danielfuchs + */ +public class TestLoggerFinder extends LoggerFinder { + + static class TestLogger implements Logger { + + final String name; + + public TestLogger(String name) { + this.name = name; + } + + + @Override + public String getName() { + return name; + } + + @Override + public boolean isLoggable(Level level) { + return name.equals("javax.management") + || name.startsWith("javax.management.") + || level.getSeverity() >= Level.INFO.getSeverity(); + } + + @Override + public void log(Level level, ResourceBundle bundle, String msg, Throwable thrown) { + if (!isLoggable(level)) return; + publish(level, bundle, msg, thrown); + } + + @Override + public void log(Level level, ResourceBundle bundle, String format, Object... params) { + if (!isLoggable(level)) return; + publish(level, bundle, format, params); + } + + static void publish(Level level, ResourceBundle bundle, String msg, Throwable thrown) { + StackFrame sf = new CallerFinder().get().get(); + + if (bundle != null && msg != null) { + msg = bundle.getString(msg); + } + if (msg == null) msg = ""; + LocalDateTime ldt = LocalDateTime.now(); + String date = DateTimeFormatter.ISO_DATE_TIME.format(ldt); + System.err.println(date + " " + + sf.getClassName() + " " + sf.getMethodName() + "\n" + + String.valueOf(level) + ": " + msg); + thrown.printStackTrace(System.err); + } + + static void publish(Level level, ResourceBundle bundle, String format, Object... params) { + StackFrame sf = new CallerFinder().get().get(); + if (bundle != null && format != null) { + format = bundle.getString(format); + } + String msg = format(format, params); + LocalDateTime ldt = LocalDateTime.now(); + String date = DateTimeFormatter.ISO_DATE_TIME.format(ldt); + System.err.println(date + " " + + sf.getClassName() + " " + sf.getMethodName() + "\n" + + String.valueOf(level) + ": " + msg); + } + + static String format(String format, Object... args) { + if (format == null) return ""; + int index = 0, len = format.length(); + while ((index = format.indexOf(index, '{')) >= 0) { + if (index >= len - 2) break; + char c = format.charAt(index+1); + if (c >= '0' && c <= '9') { + return MessageFormat.format(format, args); + } + index++; + } + return format; + } + + } + + /* + * CallerFinder is a stateful predicate. + */ + static final class CallerFinder implements Predicate { + private static final StackWalker WALKER; + static { + PrivilegedAction pa = + () -> StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); + WALKER = AccessController.doPrivileged(pa); + } + + /** + * Returns StackFrame of the caller's frame. + * @return StackFrame of the caller's frame. + */ + Optional get() { + return WALKER.walk((s) -> s.filter(this).findFirst()); + } + + private boolean lookingForLogger = true; + /** + * Returns true if we have found the caller's frame, false if the frame + * must be skipped. + * + * @param t The frame info. + * @return true if we have found the caller's frame, false if the frame + * must be skipped. + */ + @Override + public boolean test(StackWalker.StackFrame s) { + // We should skip all frames until we have found the logger, + // because these frames could be frames introduced by e.g. custom + // sub classes of Handler. + Class c = s.getDeclaringClass(); + boolean isLogger = System.Logger.class.isAssignableFrom(c); + if (lookingForLogger) { + // Skip all frames until we have found the first logger frame. + lookingForLogger = c != TestLogger.class; + return false; + } + // Continue walking until we've found the relevant calling frame. + // Skips logging/logger infrastructure. + return !isLogger; + } + } + + @Override + public Logger getLogger(String name, Module module) { + return new TestLogger(name); + } + +} From 1a27d2430d412e16871adbbacae3ddb62073c894 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Fri, 20 Jan 2017 14:11:08 -0500 Subject: [PATCH 61/71] 8173134: Add failing java/bean tests in JDK-8173082 to the ProblemList Reviewed-by: darcy --- jdk/test/ProblemList.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index b0d21d7f918..787ba9dcea3 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -118,6 +118,35 @@ java/beans/Introspector/8132566/OverridePropertyInfoTest.java 8132565 generic-all java/beans/Introspector/8132566/OverrideUserDefPropertyInfoTest.java 8132565 generic-all +java/beans/PropertyEditor/TestBooleanClass.java 8173082 generic-all +java/beans/PropertyEditor/TestByteClass.java 8173082 generic-all +java/beans/PropertyEditor/TestColorClass.java 8173082 generic-all +java/beans/PropertyEditor/TestDoubleClass.java 8173082 generic-all +java/beans/PropertyEditor/TestFloatClass.java 8173082 generic-all +java/beans/PropertyEditor/TestFontClass.java 8173082 generic-all +java/beans/PropertyEditor/TestIntegerClass.java 8173082 generic-all +java/beans/PropertyEditor/TestLongClass.java 8173082 generic-all +java/beans/PropertyEditor/TestShortClass.java 8173082 generic-all +java/beans/PropertyEditor/TestStringClass.java 8173082 generic-all +java/beans/XMLEncoder/Test6570354.java 8173082 generic-all +java/beans/XMLDecoder/spec/TestObject.java 8173082 macosx-all +java/beans/XMLEncoder/Test4631471.java 8173082 macosx-all +java/beans/XMLEncoder/Test4652928.java 8173082 macosx-all +java/beans/XMLEncoder/Test4903007.java 8173082 macosx-all +java/beans/XMLEncoder/Test6437265.java 8173082 macosx-all +java/beans/XMLEncoder/Test6501431.java 8173082 macosx-all +java/beans/XMLEncoder/java_awt_BorderLayout.java 8173082 macosx-all +java/beans/XMLEncoder/java_awt_CardLayout.java 8173082 macosx-all +java/beans/XMLEncoder/java_awt_GridBagLayout.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_BoxLayout.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_JButton.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_JLayeredPane.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_JSplitPane.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_JTree.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_OverlayLayout.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_border_TitledBorder.java 8173082 macosx-all +java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java 8173082 macosx-all ############################################################################ From 8d7694562cc4a43ab978f8df272778af0f2e59be Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Sat, 21 Jan 2017 08:38:51 +0800 Subject: [PATCH 62/71] 8172975: SecurityTools.keytool() needs to accept user input Reviewed-by: asmotrak --- .../sun/security/tools/keytool/Main.java | 5 +- .../security/tools/keytool/ImportPrompt.java | 88 +++++++++++++++++++ .../sun/security/tools/keytool/ReadJar.java | 9 +- 3 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 jdk/test/sun/security/tools/keytool/ImportPrompt.java diff --git a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java index 9730938c927..b73773f5711 100644 --- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java +++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -3522,7 +3522,8 @@ public final class Main { System.err.flush(); reply = (new BufferedReader(new InputStreamReader (System.in))).readLine(); - if (collator.compare(reply, "") == 0 || + if (reply == null || + collator.compare(reply, "") == 0 || collator.compare(reply, rb.getString("n")) == 0 || collator.compare(reply, rb.getString("no")) == 0) { reply = "NO"; diff --git a/jdk/test/sun/security/tools/keytool/ImportPrompt.java b/jdk/test/sun/security/tools/keytool/ImportPrompt.java new file mode 100644 index 00000000000..50bd690371e --- /dev/null +++ b/jdk/test/sun/security/tools/keytool/ImportPrompt.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2017, 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 jdk.test.lib.Asserts; +import jdk.test.lib.SecurityTools; +import jdk.test.lib.process.OutputAnalyzer; + +import java.io.File; +import java.security.KeyStore; + +/** + * @test + * @bug 8172975 + * @summary SecurityTools.keytool() needs to accept user input + * @library /test/lib + */ + +public class ImportPrompt { + + private static final String COMMON = + "-storetype jks -storepass changeit -keypass changeit -debug"; + + public static void main(String[] args) throws Throwable { + + kt("-keystore ks1 -genkeypair -alias a -dname CN=A"); + kt("-keystore ks1 -exportcert -alias a -file a.cert"); + + // Just create a keystore + kt("-keystore ks2 -genkeypair -alias b -dname CN=B"); + + // no response text, assume no + kt("-keystore ks2 -importcert -alias a -file a.cert"); + Asserts.assertFalse(hasA()); + + // no reply is no + SecurityTools.setResponse("no"); + kt("-keystore ks2 -importcert -alias a -file a.cert"); + Asserts.assertFalse(hasA()); + + // explicit yes + SecurityTools.setResponse("yes"); + kt("-keystore ks2 -importcert -alias a -file a.cert"); + Asserts.assertTrue(hasA()); + + // remove it + kt("-keystore ks2 -delete -alias a"); + Asserts.assertFalse(hasA()); + + // the previous "yes" will not be remembered + kt("-keystore ks2 -importcert -alias a -file a.cert"); + Asserts.assertFalse(hasA()); + + // add with -noprompt + SecurityTools.setResponse(""); + kt("-keystore ks2 -importcert -alias a -file a.cert -noprompt"); + Asserts.assertTrue(hasA()); + } + + private static OutputAnalyzer kt(String cmd) throws Throwable { + return SecurityTools.keytool(COMMON + " " + cmd) + .shouldHaveExitValue(0); + } + + private static boolean hasA() throws Exception { + return KeyStore.getInstance(new File("ks2"), "changeit".toCharArray()) + .containsAlias("a"); + } +} diff --git a/jdk/test/sun/security/tools/keytool/ReadJar.java b/jdk/test/sun/security/tools/keytool/ReadJar.java index 5400db17e31..644033cc1fa 100644 --- a/jdk/test/sun/security/tools/keytool/ReadJar.java +++ b/jdk/test/sun/security/tools/keytool/ReadJar.java @@ -57,16 +57,15 @@ public class ReadJar { System.out.println(out.getOutput()); out.shouldHaveExitValue(0); - out = SecurityTools.jarsigner("test_rsa.jar", "rsa_alias", - "-keystore keystore -storepass password "); + out = SecurityTools.jarsigner("-keystore keystore -storepass password " + + "test_rsa.jar rsa_alias"); System.out.println(out.getOutput()); out.shouldHaveExitValue(0); printCert("test_rsa.jar"); - out = SecurityTools.jarsigner("test_md5.jar", "rsa_alias", - "-keystore keystore -storepass password " - + "-sigalg MD5withRSA -digestalg MD5"); + out = SecurityTools.jarsigner("-keystore keystore -storepass password " + + "-sigalg MD5withRSA -digestalg MD5 test_md5.jar rsa_alias"); System.out.println(out.getOutput()); out.shouldHaveExitValue(0); From b99aeee96af10e6cda30f5ddddae273c52d64ad7 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Sat, 21 Jan 2017 08:38:52 +0800 Subject: [PATCH 63/71] 8172975: SecurityTools.keytool() needs to accept user input Reviewed-by: asmotrak --- test/lib/jdk/test/lib/SecurityTools.java | 139 +++++++++++------------ 1 file changed, 67 insertions(+), 72 deletions(-) diff --git a/test/lib/jdk/test/lib/SecurityTools.java b/test/lib/jdk/test/lib/SecurityTools.java index 37dd1104f74..8e8e6cf83ed 100644 --- a/test/lib/jdk/test/lib/SecurityTools.java +++ b/test/lib/jdk/test/lib/SecurityTools.java @@ -23,102 +23,97 @@ package jdk.test.lib; -import java.util.ArrayList; -import java.util.Collections; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; public class SecurityTools { - public static final String NO_ALIAS = null; + public static final String RESPONSE_FILE = "security_tools_response.txt"; + + private static ProcessBuilder getProcessBuilder(String tool, List args) { + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(tool) + .addVMArg("-Duser.language=en") + .addVMArg("-Duser.country=US") + .addVMArg("-Djava.security.egd=file:/dev/./urandom"); + for (String arg : args) { + if (arg.startsWith("-J")) { + launcher.addVMArg(arg.substring(2)); + } else { + launcher.addToolArg(arg); + } + } + String[] cmds = launcher.getCommand(); + String cmdLine = Arrays.stream(cmds).collect(Collectors.joining(" ")); + System.out.println("Command line: [" + cmdLine + "]"); + return new ProcessBuilder(cmds); + } // keytool - public static OutputAnalyzer keytool(List options) - throws Throwable { + public static OutputAnalyzer keytool(List args) + throws Exception { - JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("keytool") - .addVMArg("-Duser.language=en") - .addVMArg("-Duser.country=US"); - for (String option : options) { - if (option.startsWith("-J")) { - launcher.addVMArg(option.substring(2)); - } else { - launcher.addToolArg(option); - } + ProcessBuilder pb = getProcessBuilder("keytool", args); + + Path p = Paths.get(RESPONSE_FILE); + if (!Files.exists(p)) { + Files.createFile(p); + } + pb.redirectInput(ProcessBuilder.Redirect.from(new File(RESPONSE_FILE))); + + try { + return ProcessTools.executeProcess(pb); + } finally { + Files.delete(p); } - return ProcessTools.executeCommand(launcher.getCommand()); } - public static OutputAnalyzer keytool(String options) throws Throwable { - return keytool(options.split("\\s+")); + // Only call this if there is no white space in every argument + public static OutputAnalyzer keytool(String args) throws Exception { + return keytool(args.split("\\s+")); } - public static OutputAnalyzer keytool(String... options) throws Throwable { - return keytool(List.of(options)); + public static OutputAnalyzer keytool(String... args) throws Exception { + return keytool(List.of(args)); + } + + public static void setResponse(String... responses) throws IOException { + String text; + if (responses.length > 0) { + text = Stream.of(responses).collect( + Collectors.joining("\n", "", "\n")); + } else { + text = ""; + } + Files.write(Paths.get(RESPONSE_FILE), text.getBytes()); } // jarsigner - public static OutputAnalyzer jarsigner(String jar, String alias, - List options) throws Throwable { - JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jarsigner") - .addVMArg("-Duser.language=en") - .addVMArg("-Duser.country=US"); - for (String option : options) { - if (option.startsWith("-J")) { - launcher.addVMArg(option.substring(2)); - } else { - launcher.addToolArg(option); - } - } - launcher.addToolArg(jar); - if (alias != null) { - launcher.addToolArg(alias); - } - return ProcessTools.executeCommand(launcher.getCommand()); + public static OutputAnalyzer jarsigner(List args) + throws Exception { + return ProcessTools.executeProcess( + getProcessBuilder("jarsigner", args)); } - public static OutputAnalyzer jarsigner(String jar, String alias, - String options) throws Throwable { + // Only call this if there is no white space in every argument + public static OutputAnalyzer jarsigner(String args) throws Exception { - return jarsigner(jar, alias, options.split("\\s+")); + return jarsigner(args.split("\\s+")); } - public static OutputAnalyzer jarsigner(String jar, String alias, - String... options) throws Throwable { - - return jarsigner(jar, alias, List.of(options)); - } - - public static OutputAnalyzer sign(String jar, String alias, String... options) - throws Throwable { - - return jarsigner(jar, alias, - mergeOptions("-J-Djava.security.egd=file:/dev/./urandom", options)); - } - - public static OutputAnalyzer verify(String jar, String... options) - throws Throwable { - - return jarsigner(jar, NO_ALIAS, mergeOptions("-verify", options)); - } - - // helper methods - - private static List mergeOptions( - String firstOption, String... secondPart) { - - return mergeOptions(List.of(firstOption), secondPart); - } - - private static List mergeOptions( - List firstPart, String... secondPart) { - - List options = new ArrayList<>(firstPart); - Collections.addAll(options, secondPart); - return options; + public static OutputAnalyzer jarsigner(String... args) throws Exception { + return jarsigner(List.of(args)); } } From a5a732dbbd71a92ae7b440c0217a01a7181055c4 Mon Sep 17 00:00:00 2001 From: Felix Yang Date: Sat, 21 Jan 2017 08:45:45 -0800 Subject: [PATCH 64/71] 8173159: Problem list java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java on Windows Reviewed-by: dfuchs --- jdk/test/ProblemList.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 0714babb88a..e86989d33df 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -228,6 +228,8 @@ java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java 7191877 generic- java/rmi/activation/Activatable/extLoadedImpl/ext.sh 8062724 generic-all +java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java 8169569 windows-all + sun/rmi/rmic/newrmic/equivalence/run.sh 8145980 generic-all ############################################################################ From 20bcdb3a1c891d7a972f84b7302bbe42becdad15 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Sat, 21 Jan 2017 10:12:29 -0800 Subject: [PATCH 65/71] 8173156: Remove JmodTest.java from the probelm list on windows Reviewed-by: mchung --- jdk/test/ProblemList.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index e86989d33df..17ec47cc25e 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -291,8 +291,6 @@ tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java 8169971 windows- tools/jlink/CustomPluginTest.java 8172864 generic-all -tools/jmod/JmodTest.java 8172870 windows-all - ############################################################################ # jdk_jdi From ea6b99d73082d82628d23d0155dd44a7d922f3f3 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Sat, 21 Jan 2017 14:31:57 -0800 Subject: [PATCH 66/71] 8173096: jmod files are not world-readable Reviewed-by: alanb --- .../classes/jdk/tools/jmod/JmodTask.java | 32 +++++++------- jdk/test/tools/jmod/JmodTest.java | 44 ++++--------------- 2 files changed, 25 insertions(+), 51 deletions(-) diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java index 31e76e294ec..3ed482b7d99 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java @@ -73,7 +73,6 @@ import java.util.ResourceBundle; import java.util.Set; import java.util.TreeSet; import java.util.function.Consumer; -import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.jar.JarEntry; @@ -395,25 +394,30 @@ public class JmodTask { // create jmod with temporary name to avoid it being examined // when scanning the module path Path target = options.jmodFile; - Path tempTarget = Files.createTempFile(target.getFileName().toString(), ".tmp"); + Path tempTarget = jmodTempFilePath(target); try { try (JmodOutputStream jos = JmodOutputStream.newOutputStream(tempTarget)) { jmod.write(jos); } Files.move(tempTarget, target); } catch (Exception e) { - if (Files.exists(tempTarget)) { - try { - Files.delete(tempTarget); - } catch (IOException ioe) { - e.addSuppressed(ioe); - } + try { + Files.deleteIfExists(tempTarget); + } catch (IOException ioe) { + e.addSuppressed(ioe); } throw e; } return true; } + /* + * Create a JMOD .tmp file for the given target JMOD file + */ + private static Path jmodTempFilePath(Path target) throws IOException { + return target.resolveSibling("." + target.getFileName() + ".tmp"); + } + private class JmodFileWriter { final List cmds = options.cmds; final List libs = options.libs; @@ -908,7 +912,7 @@ public class JmodTask { throws IOException { Path target = moduleToPath(name); - Path tempTarget = Files.createTempFile(target.getFileName().toString(), ".tmp"); + Path tempTarget = jmodTempFilePath(target); try { if (target.getFileName().toString().endsWith(".jmod")) { updateJmodFile(target, tempTarget, moduleHashes); @@ -916,12 +920,10 @@ public class JmodTask { updateModularJar(target, tempTarget, moduleHashes); } } catch (IOException|RuntimeException e) { - if (Files.exists(tempTarget)) { - try { - Files.delete(tempTarget); - } catch (IOException ioe) { - e.addSuppressed(ioe); - } + try { + Files.deleteIfExists(tempTarget); + } catch (IOException ioe) { + e.addSuppressed(ioe); } throw e; } diff --git a/jdk/test/tools/jmod/JmodTest.java b/jdk/test/tools/jmod/JmodTest.java index ccf333511cb..27dc8396e74 100644 --- a/jdk/test/tools/jmod/JmodTest.java +++ b/jdk/test/tools/jmod/JmodTest.java @@ -43,7 +43,6 @@ import java.util.spi.ToolProvider; import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.testlibrary.FileUtils; -import jdk.testlibrary.JDKToolFinder; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -587,17 +586,10 @@ public class JmodTest { // Ensure that it is removed in the event of a failure. // The failure in this case is a class in the unnamed package. - String filename = "testTmpFileRemoved.jmod"; - Path jmod = MODS_DIR.resolve(filename); - - // clean up files + Path jmod = MODS_DIR.resolve("testTmpFileRemoved.jmod"); + Path tmp = MODS_DIR.resolve(".testTmpFileRemoved.jmod.tmp"); FileUtils.deleteFileIfExistsWithRetry(jmod); - findTmpFiles(filename).forEach(tmp -> { - try { - FileUtils.deleteFileIfExistsWithRetry(tmp); - } catch (IOException e) {} - }); - + FileUtils.deleteFileIfExistsWithRetry(tmp); String cp = EXPLODED_DIR.resolve("foo").resolve("classes") + File.pathSeparator + EXPLODED_DIR.resolve("foo").resolve("classes") .resolve("jdk").resolve("test").resolve("foo").toString(); @@ -605,31 +597,11 @@ public class JmodTest { jmod("create", "--class-path", cp, jmod.toString()) - .assertFailure() - .resultChecker(r -> { - assertContains(r.output, "unnamed package"); - List tmpfiles = findTmpFiles(filename); - assertTrue(tmpfiles.isEmpty(), "Unexpected tmp file:" + tmpfiles); - }); - } - - /* - * Returns the list of writeable tmp files with the given prefix. - * - * Ignore the non-writeable tmp files because this test is possibly - * running by another user. - */ - private List findTmpFiles(String prefix) { - Path tmpdir = Paths.get(System.getProperty("java.io.tmpdir")); - try (Stream stream = Files.list(tmpdir)) { - return stream.filter(p -> { - String fn = p.getFileName().toString(); - return Files.isWritable(p) - && fn.startsWith(prefix) && fn.endsWith(".tmp"); - }).collect(Collectors.toList()); - } catch (IOException e) { - throw new UncheckedIOException(e); - } + .assertFailure() + .resultChecker(r -> { + assertContains(r.output, "unnamed package"); + assertTrue(Files.notExists(tmp), "Unexpected tmp file:" + tmp); + }); } // --- From 472c73df438dc130f152463cc5e819e3f1004f8d Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Mon, 23 Jan 2017 07:34:11 -0500 Subject: [PATCH 67/71] 8173082: java/bean/* tests fail since change of JDK-8055206 Reviewed-by: mchung, ahgross, alanb --- .../share/lib/security/default.policy | 8 +++++ jdk/test/ProblemList.txt | 29 ------------------- .../SecurityManager/CheckPackageAccess.java | 3 +- .../provider/PolicyFile/TokenStore.java | 7 ++--- 4 files changed, 12 insertions(+), 35 deletions(-) diff --git a/jdk/src/java.base/share/lib/security/default.policy b/jdk/src/java.base/share/lib/security/default.policy index 4d890704195..ae4a1e2db54 100644 --- a/jdk/src/java.base/share/lib/security/default.policy +++ b/jdk/src/java.base/share/lib/security/default.policy @@ -205,3 +205,11 @@ grant codeBase "jrt:/jdk.accessibility" { grant codeBase "jrt:/jdk.desktop" { permission java.lang.RuntimePermission "accessClassInPackage.com.sun.awt"; }; + +// permissions needed by applications using java.desktop module +grant { + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.beans"; + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.beans.*"; + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.java.swing.plaf.*"; + permission java.lang.RuntimePermission "accessClassInPackage.com.apple.*"; +}; diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 17ec47cc25e..12aeaade647 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -118,35 +118,6 @@ java/beans/Introspector/8132566/OverridePropertyInfoTest.java 8132565 generic-all java/beans/Introspector/8132566/OverrideUserDefPropertyInfoTest.java 8132565 generic-all -java/beans/PropertyEditor/TestBooleanClass.java 8173082 generic-all -java/beans/PropertyEditor/TestByteClass.java 8173082 generic-all -java/beans/PropertyEditor/TestColorClass.java 8173082 generic-all -java/beans/PropertyEditor/TestDoubleClass.java 8173082 generic-all -java/beans/PropertyEditor/TestFloatClass.java 8173082 generic-all -java/beans/PropertyEditor/TestFontClass.java 8173082 generic-all -java/beans/PropertyEditor/TestIntegerClass.java 8173082 generic-all -java/beans/PropertyEditor/TestLongClass.java 8173082 generic-all -java/beans/PropertyEditor/TestShortClass.java 8173082 generic-all -java/beans/PropertyEditor/TestStringClass.java 8173082 generic-all -java/beans/XMLEncoder/Test6570354.java 8173082 generic-all -java/beans/XMLDecoder/spec/TestObject.java 8173082 macosx-all -java/beans/XMLEncoder/Test4631471.java 8173082 macosx-all -java/beans/XMLEncoder/Test4652928.java 8173082 macosx-all -java/beans/XMLEncoder/Test4903007.java 8173082 macosx-all -java/beans/XMLEncoder/Test6437265.java 8173082 macosx-all -java/beans/XMLEncoder/Test6501431.java 8173082 macosx-all -java/beans/XMLEncoder/java_awt_BorderLayout.java 8173082 macosx-all -java/beans/XMLEncoder/java_awt_CardLayout.java 8173082 macosx-all -java/beans/XMLEncoder/java_awt_GridBagLayout.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_BoxLayout.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_JButton.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_JLayeredPane.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_JSplitPane.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_JTree.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_OverlayLayout.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_border_TitledBorder.java 8173082 macosx-all -java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java 8173082 macosx-all ############################################################################ diff --git a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java index 61d07b40d58..1cf7c484f29 100644 --- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java +++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java @@ -137,8 +137,7 @@ public class CheckPackageAccess { // java.desktop module loaded by boot loader and has an openQual pkg // that is exported new Test("java.desktop", "java.applet", null, "sun.applet", - "sun.awt", "com.sun.java.swing.plaf.windows", - "javax.swing.plaf.basic"), + "sun.awt", null, "javax.swing.plaf.basic"), // java.security.jgss module loaded by platform loader new Test("java.security.jgss", "org.ietf.jgss", null, "sun.security.krb5.internal.crypto", "sun.security.krb5", diff --git a/jdk/test/sun/security/provider/PolicyFile/TokenStore.java b/jdk/test/sun/security/provider/PolicyFile/TokenStore.java index ac2d70b5e18..67c8205b1ad 100644 --- a/jdk/test/sun/security/provider/PolicyFile/TokenStore.java +++ b/jdk/test/sun/security/provider/PolicyFile/TokenStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -250,10 +250,9 @@ public class TokenStore { Enumeration perms = p.getPermissions(pd).elements(); while (perms.hasMoreElements()) { Permission perm = (Permission)perms.nextElement(); - if (!(perm instanceof AllPermission)) { - throw new SecurityException("expected AllPermission"); - } else { + if (perm instanceof AllPermission) { foundIt = true; + break; } } if (!foundIt) { From eedfb7acfdc97fb616b6bf9ab68d51fa4f4394f7 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Mon, 23 Jan 2017 14:04:44 +0100 Subject: [PATCH 68/71] 8173197: (se) WindowsSelectorImpl.c does not compile with VS2010 Reviewed-by: alanb, chegar --- .../java.base/windows/native/libnio/ch/WindowsSelectorImpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c b/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c index 4d9432845ea..c6b5fa9b368 100644 --- a/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c +++ b/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c @@ -75,8 +75,8 @@ Java_sun_nio_ch_WindowsSelectorImpl_00024SubSelector_poll0(JNIEnv *env, jobject } else if (timeout < 0) { tv = NULL; } else { - tv = &timevalue; jlong sec = timeout / 1000; + tv = &timevalue; // // struct timeval members are signed 32-bit integers so the // signed 64-bit jlong needs to be clamped From 698d82f0b075113d551ad07182febd862db2bd2b Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Mon, 23 Jan 2017 11:49:01 -0800 Subject: [PATCH 69/71] 8172527: Rename jdk.crypto.token to jdk.crypto.cryptoki Reviewed-by: mchung, wetmore --- ....token.gmk => Copy-jdk.crypto.cryptoki.gmk} | 4 ++-- ...o.token.gmk => Lib-jdk.crypto.cryptoki.gmk} | 8 ++++---- .../java.base/share/classes/module-info.java | 18 +++++++++--------- .../share/lib/security/default.policy | 2 +- .../share/classes/module-info.java | 4 ++-- .../classes/sun/security/pkcs11/Config.java | 0 .../classes/sun/security/pkcs11/KeyCache.java | 0 .../classes/sun/security/pkcs11/P11Cipher.java | 0 .../sun/security/pkcs11/P11DHKeyFactory.java | 0 .../sun/security/pkcs11/P11DSAKeyFactory.java | 0 .../classes/sun/security/pkcs11/P11Digest.java | 0 .../security/pkcs11/P11ECDHKeyAgreement.java | 0 .../sun/security/pkcs11/P11ECKeyFactory.java | 0 .../classes/sun/security/pkcs11/P11Key.java | 0 .../sun/security/pkcs11/P11KeyAgreement.java | 0 .../sun/security/pkcs11/P11KeyFactory.java | 0 .../sun/security/pkcs11/P11KeyGenerator.java | 0 .../security/pkcs11/P11KeyPairGenerator.java | 0 .../sun/security/pkcs11/P11KeyStore.java | 0 .../classes/sun/security/pkcs11/P11Mac.java | 0 .../sun/security/pkcs11/P11RSACipher.java | 0 .../sun/security/pkcs11/P11RSAKeyFactory.java | 0 .../security/pkcs11/P11SecretKeyFactory.java | 0 .../sun/security/pkcs11/P11SecureRandom.java | 0 .../sun/security/pkcs11/P11Signature.java | 0 .../pkcs11/P11TlsKeyMaterialGenerator.java | 0 .../pkcs11/P11TlsMasterSecretGenerator.java | 0 .../security/pkcs11/P11TlsPrfGenerator.java | 0 .../P11TlsRsaPremasterSecretGenerator.java | 0 .../classes/sun/security/pkcs11/P11Util.java | 0 .../classes/sun/security/pkcs11/Secmod.java | 0 .../classes/sun/security/pkcs11/Session.java | 0 .../sun/security/pkcs11/SessionManager.java | 0 .../classes/sun/security/pkcs11/SunPKCS11.java | 0 .../sun/security/pkcs11/TemplateManager.java | 0 .../classes/sun/security/pkcs11/Token.java | 0 .../pkcs11/wrapper/CK_AES_CTR_PARAMS.java | 0 .../security/pkcs11/wrapper/CK_ATTRIBUTE.java | 0 .../pkcs11/wrapper/CK_CREATEMUTEX.java | 0 .../pkcs11/wrapper/CK_C_INITIALIZE_ARGS.java | 0 .../sun/security/pkcs11/wrapper/CK_DATE.java | 0 .../pkcs11/wrapper/CK_DESTROYMUTEX.java | 0 .../pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS.java | 0 .../pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS.java | 0 .../sun/security/pkcs11/wrapper/CK_INFO.java | 0 .../security/pkcs11/wrapper/CK_LOCKMUTEX.java | 0 .../security/pkcs11/wrapper/CK_MECHANISM.java | 0 .../pkcs11/wrapper/CK_MECHANISM_INFO.java | 0 .../sun/security/pkcs11/wrapper/CK_NOTIFY.java | 0 .../security/pkcs11/wrapper/CK_PBE_PARAMS.java | 0 .../pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java | 0 .../wrapper/CK_RSA_PKCS_OAEP_PARAMS.java | 0 .../pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java | 0 .../pkcs11/wrapper/CK_SESSION_INFO.java | 0 .../security/pkcs11/wrapper/CK_SLOT_INFO.java | 0 .../pkcs11/wrapper/CK_SSL3_KEY_MAT_OUT.java | 0 .../pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS.java | 0 .../CK_SSL3_MASTER_KEY_DERIVE_PARAMS.java | 0 .../pkcs11/wrapper/CK_SSL3_RANDOM_DATA.java | 0 .../pkcs11/wrapper/CK_TLS_PRF_PARAMS.java | 0 .../security/pkcs11/wrapper/CK_TOKEN_INFO.java | 0 .../pkcs11/wrapper/CK_UNLOCKMUTEX.java | 0 .../security/pkcs11/wrapper/CK_VERSION.java | 0 .../wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java | 0 .../wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java | 0 .../sun/security/pkcs11/wrapper/Constants.java | 0 .../sun/security/pkcs11/wrapper/Functions.java | 0 .../sun/security/pkcs11/wrapper/PKCS11.java | 0 .../pkcs11/wrapper/PKCS11Constants.java | 0 .../pkcs11/wrapper/PKCS11Exception.java | 0 .../pkcs11/wrapper/PKCS11RuntimeException.java | 0 .../share/legal/pkcs11cryptotoken.md | 0 .../share/legal/pkcs11wrapper.md | 0 .../share/native/libj2pkcs11/j2secmod.c | 0 .../share/native/libj2pkcs11/j2secmod.h | 0 .../share/native/libj2pkcs11/p11_convert.c | 0 .../share/native/libj2pkcs11/p11_crypt.c | 0 .../share/native/libj2pkcs11/p11_digest.c | 0 .../share/native/libj2pkcs11/p11_dual.c | 0 .../share/native/libj2pkcs11/p11_general.c | 0 .../share/native/libj2pkcs11/p11_keymgmt.c | 0 .../share/native/libj2pkcs11/p11_mutex.c | 0 .../share/native/libj2pkcs11/p11_objmgmt.c | 0 .../share/native/libj2pkcs11/p11_sessmgmt.c | 0 .../share/native/libj2pkcs11/p11_sign.c | 0 .../share/native/libj2pkcs11/p11_util.c | 0 .../share/native/libj2pkcs11/pkcs-11v2-20a3.h | 0 .../share/native/libj2pkcs11/pkcs11.h | 0 .../share/native/libj2pkcs11/pkcs11f.h | 0 .../share/native/libj2pkcs11/pkcs11t.h | 0 .../share/native/libj2pkcs11/pkcs11wrapper.h | 0 .../conf/security/sunpkcs11-solaris.cfg | 0 .../unix/native/libj2pkcs11/j2secmod_md.c | 0 .../unix/native/libj2pkcs11/j2secmod_md.h | 0 .../unix/native/libj2pkcs11/p11_md.c | 0 .../unix/native/libj2pkcs11/p11_md.h | 0 .../windows/native/libj2pkcs11/j2secmod_md.c | 0 .../windows/native/libj2pkcs11/j2secmod_md.h | 0 .../windows/native/libj2pkcs11/p11_md.c | 0 .../windows/native/libj2pkcs11/p11_md.h | 0 .../SecurityManager/CheckSecurityProvider.java | 6 +++--- jdk/test/sun/security/ec/TestEC.java | 6 +++--- .../security/pkcs11/Cipher/ReinitCipher.java | 4 ++-- .../pkcs11/Cipher/TestPKCS5PaddingError.java | 4 ++-- .../security/pkcs11/Cipher/TestRSACipher.java | 4 ++-- .../pkcs11/Cipher/TestRSACipherWrap.java | 4 ++-- .../pkcs11/Cipher/TestRawRSACipher.java | 4 ++-- .../pkcs11/Cipher/TestSymmCiphers.java | 4 ++-- .../pkcs11/Cipher/TestSymmCiphersNoPad.java | 4 ++-- .../pkcs11/KeyAgreement/SupportedDHKeys.java | 4 ++-- .../security/pkcs11/KeyAgreement/TestDH.java | 4 ++-- .../pkcs11/KeyAgreement/TestInterop.java | 4 ++-- .../pkcs11/KeyAgreement/TestShort.java | 4 ++-- .../pkcs11/KeyAgreement/UnsupportedDHKeys.java | 4 ++-- .../pkcs11/KeyGenerator/DESParity.java | 4 ++-- .../pkcs11/KeyGenerator/TestKeyGenerator.java | 4 ++-- .../pkcs11/KeyPairGenerator/TestDH2048.java | 4 ++-- jdk/test/sun/security/pkcs11/Mac/MacKAT.java | 4 ++-- .../sun/security/pkcs11/Mac/MacSameTest.java | 4 ++-- .../sun/security/pkcs11/Mac/ReinitMac.java | 4 ++-- .../pkcs11/MessageDigest/ByteBuffers.java | 4 ++-- .../pkcs11/MessageDigest/DigestKAT.java | 4 ++-- .../pkcs11/MessageDigest/ReinitDigest.java | 4 ++-- .../pkcs11/MessageDigest/TestCloning.java | 4 ++-- .../sun/security/pkcs11/Provider/Absolute.java | 4 ++-- jdk/test/sun/security/pkcs11/SampleTest.java | 4 ++-- .../security/pkcs11/Secmod/AddPrivateKey.java | 4 ++-- .../security/pkcs11/Secmod/AddTrustedCert.java | 4 ++-- .../sun/security/pkcs11/Secmod/Crypto.java | 4 ++-- .../security/pkcs11/Secmod/GetPrivateKey.java | 4 ++-- .../pkcs11/Secmod/JksSetPrivateKey.java | 4 ++-- .../security/pkcs11/Secmod/LoadKeystore.java | 4 ++-- .../security/pkcs11/Secmod/TrustAnchors.java | 4 ++-- .../security/pkcs11/SecureRandom/Basic.java | 4 ++-- .../SecureRandom/TestDeserialization.java | 4 ++-- .../pkcs11/Serialize/SerializeProvider.java | 4 ++-- .../security/pkcs11/Signature/ByteBuffers.java | 4 ++-- .../pkcs11/Signature/ReinitSignature.java | 4 ++-- .../sun/security/pkcs11/Signature/TestDSA.java | 4 ++-- .../pkcs11/Signature/TestDSAKeyLength.java | 4 ++-- .../pkcs11/Signature/TestRSAKeyLength.java | 4 ++-- .../security/pkcs11/ec/ReadCertificates.java | 4 ++-- .../sun/security/pkcs11/ec/ReadPKCS12.java | 4 ++-- .../sun/security/pkcs11/ec/TestCurves.java | 6 +++--- jdk/test/sun/security/pkcs11/ec/TestECDH.java | 4 ++-- jdk/test/sun/security/pkcs11/ec/TestECDH2.java | 4 ++-- jdk/test/sun/security/pkcs11/ec/TestECDSA.java | 4 ++-- .../sun/security/pkcs11/ec/TestECDSA2.java | 4 ++-- .../sun/security/pkcs11/ec/TestECGenSpec.java | 4 ++-- .../sun/security/pkcs11/ec/TestKeyFactory.java | 4 ++-- jdk/test/sun/security/pkcs11/rsa/KeyWrap.java | 4 ++-- .../sun/security/pkcs11/rsa/TestCACerts.java | 4 ++-- .../security/pkcs11/rsa/TestKeyFactory.java | 4 ++-- .../pkcs11/rsa/TestKeyPairGenerator.java | 4 ++-- .../security/pkcs11/rsa/TestSignatures.java | 4 ++-- .../pkcs11/sslecc/ClientJSSEServerJSSE.java | 4 ++-- .../security/pkcs11/tls/TestKeyMaterial.java | 4 ++-- .../pkcs11/tls/TestLeadingZeroesP11.java | 4 ++-- .../security/pkcs11/tls/TestMasterSecret.java | 4 ++-- jdk/test/sun/security/pkcs11/tls/TestPRF.java | 4 ++-- .../sun/security/pkcs11/tls/TestPremaster.java | 4 ++-- jdk/test/tools/launcher/MiscTests.java | 6 +++--- 162 files changed, 146 insertions(+), 146 deletions(-) rename jdk/make/copy/{Copy-jdk.crypto.token.gmk => Copy-jdk.crypto.cryptoki.gmk} (90%) rename jdk/make/lib/{Lib-jdk.crypto.token.gmk => Lib-jdk.crypto.cryptoki.gmk} (87%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/module-info.java (93%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/Config.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/KeyCache.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11Cipher.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11DHKeyFactory.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11Digest.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11ECKeyFactory.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11Key.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11KeyAgreement.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11KeyFactory.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11KeyGenerator.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11KeyStore.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11Mac.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11RSACipher.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11SecureRandom.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11Signature.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/P11Util.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/Secmod.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/Session.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/SessionManager.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/SunPKCS11.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/TemplateManager.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/Token.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_ATTRIBUTE.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_C_INITIALIZE_ARGS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_DATE.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_DESTROYMUTEX.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_INFO.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_LOCKMUTEX.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM_INFO.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_NOTIFY.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_PBE_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_SESSION_INFO.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_SLOT_INFO.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_OUT.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_MASTER_KEY_DERIVE_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_RANDOM_DATA.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_TOKEN_INFO.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_UNLOCKMUTEX.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_VERSION.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/Constants.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/Functions.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/PKCS11.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/classes/sun/security/pkcs11/wrapper/PKCS11RuntimeException.java (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/legal/pkcs11cryptotoken.md (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/legal/pkcs11wrapper.md (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/j2secmod.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/j2secmod.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_convert.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_crypt.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_digest.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_dual.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_general.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_keymgmt.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_mutex.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_objmgmt.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_sessmgmt.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_sign.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/p11_util.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/pkcs-11v2-20a3.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/pkcs11.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/pkcs11f.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/pkcs11t.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/share/native/libj2pkcs11/pkcs11wrapper.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/solaris/conf/security/sunpkcs11-solaris.cfg (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/unix/native/libj2pkcs11/j2secmod_md.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/unix/native/libj2pkcs11/j2secmod_md.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/unix/native/libj2pkcs11/p11_md.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/unix/native/libj2pkcs11/p11_md.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/windows/native/libj2pkcs11/j2secmod_md.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/windows/native/libj2pkcs11/j2secmod_md.h (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/windows/native/libj2pkcs11/p11_md.c (100%) rename jdk/src/{jdk.crypto.token => jdk.crypto.cryptoki}/windows/native/libj2pkcs11/p11_md.h (100%) diff --git a/jdk/make/copy/Copy-jdk.crypto.token.gmk b/jdk/make/copy/Copy-jdk.crypto.cryptoki.gmk similarity index 90% rename from jdk/make/copy/Copy-jdk.crypto.token.gmk rename to jdk/make/copy/Copy-jdk.crypto.cryptoki.gmk index d35f655818e..fafbeef0a14 100644 --- a/jdk/make/copy/Copy-jdk.crypto.token.gmk +++ b/jdk/make/copy/Copy-jdk.crypto.cryptoki.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2017, 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 @@ -30,7 +30,7 @@ include CopyCommon.gmk ifeq ($(OPENJDK_TARGET_OS), solaris) SUNPKCS11_CFG_SRC := \ - $(JDK_TOPDIR)/src/jdk.crypto.token/solaris/conf/security/sunpkcs11-solaris.cfg + $(JDK_TOPDIR)/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg SUNPKCS11_CFG_DST := $(CONF_DST_DIR)/security/sunpkcs11-solaris.cfg $(SUNPKCS11_CFG_DST): $(SUNPKCS11_CFG_SRC) diff --git a/jdk/make/lib/Lib-jdk.crypto.token.gmk b/jdk/make/lib/Lib-jdk.crypto.cryptoki.gmk similarity index 87% rename from jdk/make/lib/Lib-jdk.crypto.token.gmk rename to jdk/make/lib/Lib-jdk.crypto.cryptoki.gmk index 9e015be9f89..5abb592fd27 100644 --- a/jdk/make/lib/Lib-jdk.crypto.token.gmk +++ b/jdk/make/lib/Lib-jdk.crypto.cryptoki.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2017, 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 @@ -27,8 +27,8 @@ include LibCommon.gmk ################################################################################ -LIBJ2PKCS11_SRC := $(JDK_TOPDIR)/src/jdk.crypto.token/share/native/libj2pkcs11 \ - $(JDK_TOPDIR)/src/jdk.crypto.token/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pkcs11 +LIBJ2PKCS11_SRC := $(JDK_TOPDIR)/src/jdk.crypto.cryptoki/share/native/libj2pkcs11 \ + $(JDK_TOPDIR)/src/jdk.crypto.cryptoki/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pkcs11 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \ LIBRARY := j2pkcs11, \ @@ -37,7 +37,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \ $(LIBJAVA_HEADER_FLAGS) \ - -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.token, \ + -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.cryptoki, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index b831d9a3549..3b5d5695e5d 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -219,7 +219,7 @@ module java.base { java.security.jgss; exports sun.nio.ch to java.management, - jdk.crypto.token, + jdk.crypto.cryptoki, jdk.sctp, jdk.unsupported; exports sun.nio.cs to @@ -244,13 +244,13 @@ module java.base { java.desktop, java.security.jgss; exports sun.security.internal.interfaces to - jdk.crypto.token; + jdk.crypto.cryptoki; exports sun.security.internal.spec to - jdk.crypto.token; + jdk.crypto.cryptoki; exports sun.security.jca to java.smartcardio, jdk.crypto.ec, - jdk.crypto.token, + jdk.crypto.cryptoki, jdk.naming.dns; exports sun.security.pkcs to jdk.crypto.ec, @@ -258,13 +258,13 @@ module java.base { exports sun.security.provider to java.rmi, java.security.jgss, - jdk.crypto.token, + jdk.crypto.cryptoki, jdk.policytool, jdk.security.auth; exports sun.security.provider.certpath to java.naming; exports sun.security.rsa to - jdk.crypto.token; + jdk.crypto.cryptoki; exports sun.security.ssl to java.security.jgss; exports sun.security.timestamp to @@ -280,14 +280,14 @@ module java.base { java.smartcardio, java.xml.crypto, jdk.crypto.ec, - jdk.crypto.token, + jdk.crypto.cryptoki, jdk.jartool, jdk.policytool, jdk.security.auth, jdk.security.jgss; exports sun.security.x509 to jdk.crypto.ec, - jdk.crypto.token, + jdk.crypto.cryptoki, jdk.jartool, jdk.security.auth; exports sun.security.validator to diff --git a/jdk/src/java.base/share/lib/security/default.policy b/jdk/src/java.base/share/lib/security/default.policy index ae4a1e2db54..7f7ad4ff4b3 100644 --- a/jdk/src/java.base/share/lib/security/default.policy +++ b/jdk/src/java.base/share/lib/security/default.policy @@ -137,7 +137,7 @@ grant codeBase "jrt:/jdk.crypto.ec" { permission java.security.SecurityPermission "removeProviderProperty.SunEC"; }; -grant codeBase "jrt:/jdk.crypto.token" { +grant codeBase "jrt:/jdk.crypto.cryptoki" { permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*"; permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; diff --git a/jdk/src/jdk.crypto.token/share/classes/module-info.java b/jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java similarity index 93% rename from jdk/src/jdk.crypto.token/share/classes/module-info.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java index b587d0d4a33..845ae002c77 100644 --- a/jdk/src/jdk.crypto.token/share/classes/module-info.java +++ b/jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -23,7 +23,7 @@ * questions. */ -module jdk.crypto.token { +module jdk.crypto.cryptoki { // Depends on SunEC provider for EC related functionality requires jdk.crypto.ec; provides java.security.Provider with sun.security.pkcs11.SunPKCS11; diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Config.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Config.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/KeyCache.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/KeyCache.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/KeyCache.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/KeyCache.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Cipher.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Cipher.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Cipher.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Cipher.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11DHKeyFactory.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11DHKeyFactory.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11DHKeyFactory.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11DHKeyFactory.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Digest.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Digest.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Digest.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Digest.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11ECKeyFactory.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11ECKeyFactory.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Key.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Key.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyAgreement.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyAgreement.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyFactory.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyFactory.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyFactory.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyFactory.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyGenerator.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyGenerator.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyStore.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11KeyStore.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Mac.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Mac.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Mac.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Mac.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11RSACipher.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSACipher.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11RSACipher.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSACipher.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11SecureRandom.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11SecureRandom.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11SecureRandom.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11SecureRandom.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Signature.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Signature.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Signature.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Signature.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Util.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Util.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/P11Util.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Util.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Secmod.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Secmod.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Secmod.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Secmod.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Session.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Session.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Session.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Session.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/SessionManager.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SessionManager.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/SessionManager.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SessionManager.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/SunPKCS11.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/SunPKCS11.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/TemplateManager.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/TemplateManager.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/TemplateManager.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/TemplateManager.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Token.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Token.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/Token.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Token.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_ATTRIBUTE.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_ATTRIBUTE.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_ATTRIBUTE.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_ATTRIBUTE.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_C_INITIALIZE_ARGS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_C_INITIALIZE_ARGS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_C_INITIALIZE_ARGS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_C_INITIALIZE_ARGS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_DATE.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_DATE.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_DATE.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_DATE.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_DESTROYMUTEX.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_DESTROYMUTEX.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_DESTROYMUTEX.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_DESTROYMUTEX.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_INFO.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_INFO.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_INFO.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_INFO.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_LOCKMUTEX.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_LOCKMUTEX.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_LOCKMUTEX.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_LOCKMUTEX.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM_INFO.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM_INFO.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM_INFO.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM_INFO.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_NOTIFY.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_NOTIFY.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_NOTIFY.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_NOTIFY.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_PBE_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_PBE_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_PBE_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_PBE_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SESSION_INFO.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SESSION_INFO.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SESSION_INFO.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SESSION_INFO.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SLOT_INFO.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SLOT_INFO.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SLOT_INFO.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SLOT_INFO.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_OUT.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_OUT.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_OUT.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_OUT.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_MASTER_KEY_DERIVE_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_MASTER_KEY_DERIVE_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_MASTER_KEY_DERIVE_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_MASTER_KEY_DERIVE_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_RANDOM_DATA.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_RANDOM_DATA.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_RANDOM_DATA.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_SSL3_RANDOM_DATA.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_TOKEN_INFO.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TOKEN_INFO.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_TOKEN_INFO.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TOKEN_INFO.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_UNLOCKMUTEX.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_UNLOCKMUTEX.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_UNLOCKMUTEX.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_UNLOCKMUTEX.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_VERSION.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_VERSION.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_VERSION.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_VERSION.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/Constants.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/Constants.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/Constants.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/Constants.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/Functions.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/Functions.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/Functions.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/Functions.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java diff --git a/jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11RuntimeException.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11RuntimeException.java similarity index 100% rename from jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11/wrapper/PKCS11RuntimeException.java rename to jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11RuntimeException.java diff --git a/jdk/src/jdk.crypto.token/share/legal/pkcs11cryptotoken.md b/jdk/src/jdk.crypto.cryptoki/share/legal/pkcs11cryptotoken.md similarity index 100% rename from jdk/src/jdk.crypto.token/share/legal/pkcs11cryptotoken.md rename to jdk/src/jdk.crypto.cryptoki/share/legal/pkcs11cryptotoken.md diff --git a/jdk/src/jdk.crypto.token/share/legal/pkcs11wrapper.md b/jdk/src/jdk.crypto.cryptoki/share/legal/pkcs11wrapper.md similarity index 100% rename from jdk/src/jdk.crypto.token/share/legal/pkcs11wrapper.md rename to jdk/src/jdk.crypto.cryptoki/share/legal/pkcs11wrapper.md diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/j2secmod.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/j2secmod.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/j2secmod.h b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.h similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/j2secmod.h rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.h diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_convert.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_convert.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_crypt.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_crypt.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_digest.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_digest.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_digest.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_digest.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_dual.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_dual.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_dual.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_dual.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_general.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_general.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_keymgmt.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_keymgmt.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_mutex.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_mutex.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_mutex.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_mutex.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_objmgmt.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_objmgmt.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_objmgmt.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_objmgmt.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_sessmgmt.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sessmgmt.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_sessmgmt.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sessmgmt.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_sign.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_sign.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_util.c b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_util.c rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs-11v2-20a3.h b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs-11v2-20a3.h similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs-11v2-20a3.h rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs-11v2-20a3.h diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11.h b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11.h similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11.h rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11.h diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11f.h b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11f.h similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11f.h rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11f.h diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11t.h b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11t.h similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11t.h rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11t.h diff --git a/jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11wrapper.h b/jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h similarity index 100% rename from jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11wrapper.h rename to jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h diff --git a/jdk/src/jdk.crypto.token/solaris/conf/security/sunpkcs11-solaris.cfg b/jdk/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg similarity index 100% rename from jdk/src/jdk.crypto.token/solaris/conf/security/sunpkcs11-solaris.cfg rename to jdk/src/jdk.crypto.cryptoki/solaris/conf/security/sunpkcs11-solaris.cfg diff --git a/jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/j2secmod_md.c b/jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/j2secmod_md.c similarity index 100% rename from jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/j2secmod_md.c rename to jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/j2secmod_md.c diff --git a/jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/j2secmod_md.h b/jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/j2secmod_md.h similarity index 100% rename from jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/j2secmod_md.h rename to jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/j2secmod_md.h diff --git a/jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/p11_md.c b/jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c similarity index 100% rename from jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/p11_md.c rename to jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c diff --git a/jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/p11_md.h b/jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.h similarity index 100% rename from jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/p11_md.h rename to jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.h diff --git a/jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/j2secmod_md.c b/jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/j2secmod_md.c similarity index 100% rename from jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/j2secmod_md.c rename to jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/j2secmod_md.c diff --git a/jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/j2secmod_md.h b/jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/j2secmod_md.h similarity index 100% rename from jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/j2secmod_md.h rename to jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/j2secmod_md.h diff --git a/jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/p11_md.c b/jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c similarity index 100% rename from jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/p11_md.c rename to jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c diff --git a/jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/p11_md.h b/jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.h similarity index 100% rename from jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/p11_md.h rename to jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.h diff --git a/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java b/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java index 722ccd788d5..6aa14ca9342 100644 --- a/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java +++ b/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -62,7 +62,7 @@ public class CheckSecurityProvider { if (os.equals("SunOS")) { layer.findModule("jdk.crypto.ucrypto") .ifPresent(m -> expected.add("com.oracle.security.ucrypto.UcryptoProvider")); - layer.findModule("jdk.crypto.token") + layer.findModule("jdk.crypto.cryptoki") .ifPresent(m -> expected.add("sun.security.pkcs11.SunPKCS11")); } expected.add("sun.security.provider.Sun"); @@ -91,7 +91,7 @@ public class CheckSecurityProvider { expected.add("apple.security.AppleProvider"); } if (!os.equals("SunOS")) { - layer.findModule("jdk.crypto.token") + layer.findModule("jdk.crypto.cryptoki") .ifPresent(m -> expected.add("sun.security.pkcs11.SunPKCS11")); } diff --git a/jdk/test/sun/security/ec/TestEC.java b/jdk/test/sun/security/ec/TestEC.java index 93ad04e6618..eb4202ad510 100644 --- a/jdk/test/sun/security/ec/TestEC.java +++ b/jdk/test/sun/security/ec/TestEC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2017, 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 @@ -34,8 +34,8 @@ * @library ../pkcs11/ec * @library ../pkcs11/sslecc * @library ../../../java/security/testlibrary - * @modules jdk.crypto.token/sun.security.pkcs11.wrapper - * @compile --add-modules jdk.crypto.token TestEC.java + * @modules jdk.crypto.cryptoki/sun.security.pkcs11.wrapper + * @compile --add-modules jdk.crypto.cryptoki TestEC.java * @run main/othervm -Djdk.tls.namedGroups="secp256r1,sect193r1" TestEC * @run main/othervm/java.security.policy=TestEC.policy -Djdk.tls.namedGroups="secp256r1,sect193r1" TestEC */ diff --git a/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java b/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java index 643134bf76d..6f1a64f4806 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java +++ b/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm ReinitCipher * @run main/othervm ReinitCipher sm */ diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java b/jdk/test/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java index 7804116aea4..bf658e00e5f 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, 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 @@ -27,7 +27,7 @@ * @summary Test internal PKCS5Padding impl with various error conditions. * @author Valerie Peng * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestPKCS5PaddingError * @run main/othervm TestPKCS5PaddingError sm */ diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java b/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java index abf5818ef77..4acf285efb9 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestRSACipher * @run main/othervm TestRSACipher sm */ diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java b/jdk/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java index d1c5485954c..dd22ff9c163 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, 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 @@ -27,7 +27,7 @@ * @summary basic test for RSA cipher key wrapping functionality * @author Valerie Peng * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestRSACipherWrap * @run main/othervm TestRSACipherWrap sm */ diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java b/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java index 7444c7684bf..be3e0f32c15 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -28,7 +28,7 @@ * @author Valerie Peng * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestRawRSACipher * @run main/othervm TestRawRSACipher sm */ diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java index 3ba5dabdcbc..aa944c2b7f4 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, 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 @@ -28,7 +28,7 @@ * @author Valerie Peng * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestSymmCiphers * @run main/othervm TestSymmCiphers sm */ diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java index f96c4a08e3f..2e3aa69584e 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -28,7 +28,7 @@ * @author Valerie Peng * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestSymmCiphersNoPad * @run main/othervm TestSymmCiphersNoPad sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java b/jdk/test/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java index 7e3ceae5384..2401b40d3ad 100644 --- a/jdk/test/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java +++ b/jdk/test/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -26,7 +26,7 @@ * @bug 8072452 * @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm SupportedDHKeys * @run main/othervm SupportedDHKeys sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyAgreement/TestDH.java b/jdk/test/sun/security/pkcs11/KeyAgreement/TestDH.java index 18a526dbe97..9dba311bf3a 100644 --- a/jdk/test/sun/security/pkcs11/KeyAgreement/TestDH.java +++ b/jdk/test/sun/security/pkcs11/KeyAgreement/TestDH.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary Verify that DH works properly * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestDH * @run main/othervm TestDH sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyAgreement/TestInterop.java b/jdk/test/sun/security/pkcs11/KeyAgreement/TestInterop.java index d231efd95bd..0dfa28ee3da 100644 --- a/jdk/test/sun/security/pkcs11/KeyAgreement/TestInterop.java +++ b/jdk/test/sun/security/pkcs11/KeyAgreement/TestInterop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, 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 @@ -26,7 +26,7 @@ * @bug 7146728 * @summary Interop test for DH with secret that has a leading 0x00 byte * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestInterop * @run main/othervm TestInterop sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyAgreement/TestShort.java b/jdk/test/sun/security/pkcs11/KeyAgreement/TestShort.java index 687daff0147..2fd8228454a 100644 --- a/jdk/test/sun/security/pkcs11/KeyAgreement/TestShort.java +++ b/jdk/test/sun/security/pkcs11/KeyAgreement/TestShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary KAT test for DH (normal and with secret that has leading a 0x00 byte) * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestShort * @run main/othervm TestShort sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java b/jdk/test/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java index df0853ce04c..255fe015fdc 100644 --- a/jdk/test/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java +++ b/jdk/test/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -26,7 +26,7 @@ * @bug 8072452 * @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm UnsupportedDHKeys * @run main/othervm UnsupportedDHKeys sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java b/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java index 3b5d831fcf7..3cf835837c5 100644 --- a/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java +++ b/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm DESParity * @run main/othervm DESParity sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java b/jdk/test/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java index ee2ccaa47d1..04ebbfee205 100644 --- a/jdk/test/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java +++ b/jdk/test/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary test the KeyGenerator * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestKeyGenerator * @run main/othervm TestKeyGenerator sm */ diff --git a/jdk/test/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java b/jdk/test/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java index 4c04226e3ee..c4773ca72ea 100644 --- a/jdk/test/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java +++ b/jdk/test/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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 @@ -27,7 +27,7 @@ * @summary Ensure that DH key pairs can be generated for 512 - 8192 bits * @author Valerie Peng * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestDH2048 * @run main/othervm TestDH2048 sm */ diff --git a/jdk/test/sun/security/pkcs11/Mac/MacKAT.java b/jdk/test/sun/security/pkcs11/Mac/MacKAT.java index 0894ea96efe..9fc525c8285 100644 --- a/jdk/test/sun/security/pkcs11/Mac/MacKAT.java +++ b/jdk/test/sun/security/pkcs11/Mac/MacKAT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary Basic known-answer-test for Hmac algorithms * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm MacKAT * @run main/othervm MacKAT sm */ diff --git a/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java b/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java index 818f1737af2..3730ee44086 100644 --- a/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java +++ b/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -27,7 +27,7 @@ * @summary Check if doFinal and update operation result in same Mac * @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm MacSameTest * @run main/othervm MacSameTest sm * @key randomness diff --git a/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java b/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java index 9973f46230a..a4a4d5001b2 100644 --- a/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java +++ b/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm ReinitMac * @run main/othervm ReinitMac sm */ diff --git a/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java b/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java index 3226442c71c..41002a82e85 100644 --- a/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java +++ b/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm ByteBuffers * @run main/othervm ByteBuffers sm */ diff --git a/jdk/test/sun/security/pkcs11/MessageDigest/DigestKAT.java b/jdk/test/sun/security/pkcs11/MessageDigest/DigestKAT.java index 42aa231a05f..7023b052e2c 100644 --- a/jdk/test/sun/security/pkcs11/MessageDigest/DigestKAT.java +++ b/jdk/test/sun/security/pkcs11/MessageDigest/DigestKAT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary Basic known-answer-test for all our MessageDigest algorithms * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm DigestKAT * @run main/othervm DigestKAT sm */ diff --git a/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java b/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java index 04e43bb3fce..ac2fdcf9498 100644 --- a/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java +++ b/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm ReinitDigest * @run main/othervm ReinitDigest sm */ diff --git a/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java b/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java index 2374e9bda79..8fe826f3f51 100644 --- a/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java +++ b/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, 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 @@ -28,7 +28,7 @@ * @author Valerie Peng * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestCloning * @run main/othervm TestCloning sm */ diff --git a/jdk/test/sun/security/pkcs11/Provider/Absolute.java b/jdk/test/sun/security/pkcs11/Provider/Absolute.java index 05d0e7860aa..573ff827192 100644 --- a/jdk/test/sun/security/pkcs11/Provider/Absolute.java +++ b/jdk/test/sun/security/pkcs11/Provider/Absolute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -24,7 +24,7 @@ * @test * @bug 7003952 7191662 * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @summary load DLLs and launch executables using fully qualified path */ diff --git a/jdk/test/sun/security/pkcs11/SampleTest.java b/jdk/test/sun/security/pkcs11/SampleTest.java index f3ee5bdaab6..a8ed1e14ed0 100644 --- a/jdk/test/sun/security/pkcs11/SampleTest.java +++ b/jdk/test/sun/security/pkcs11/SampleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary XXX todo * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki */ import java.security.Provider; diff --git a/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java b/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java index b6875a78c1c..affef730ab3 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java +++ b/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -27,7 +27,7 @@ * @summary Test that the PKCS#11 KeyStore handles RSA, DSA, and EC keys * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm AddPrivateKey * @run main/othervm AddPrivateKey sm policy */ diff --git a/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java b/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java index c03cb861497..da83c49a603 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java +++ b/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -27,7 +27,7 @@ * @summary make sure we can add a trusted cert to the NSS KeyStore module * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm AddTrustedCert * @run main/othervm AddTrustedCert sm policy */ diff --git a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java index da57418e32b..dacec1435eb 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java +++ b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -27,7 +27,7 @@ * @summary verify that NSS no-db mode works correctly * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm Crypto * @run main/othervm Crypto sm policy */ diff --git a/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java b/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java index 39db0a3f81f..d7bf3e8556b 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java +++ b/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -28,7 +28,7 @@ * and use a private key * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm GetPrivateKey * @run main/othervm GetPrivateKey sm policy */ diff --git a/jdk/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java b/jdk/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java index c02a98aea8e..9abb4584c67 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java +++ b/jdk/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -27,7 +27,7 @@ * @summary store a NSS PKCS11 PrivateKeyEntry to JKS KeyStore throws confusing NPE * @author Wang Weijun * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm JksSetPrivateKey * @run main/othervm JksSetPrivateKey sm policy */ diff --git a/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java b/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java index e4218834924..78f7b60d331 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java +++ b/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -26,7 +26,7 @@ * @bug 8048622 8134232 * @summary Checks that PKCS#11 keystore can't be loaded with wrong password * @library ../ - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm LoadKeystore * @run main/othervm LoadKeystore sm policy */ diff --git a/jdk/test/sun/security/pkcs11/Secmod/TrustAnchors.java b/jdk/test/sun/security/pkcs11/Secmod/TrustAnchors.java index 8735bc6fcb2..9e17ec83577 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/TrustAnchors.java +++ b/jdk/test/sun/security/pkcs11/Secmod/TrustAnchors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -27,7 +27,7 @@ * @summary make sure we can access the NSS trust anchor module * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TrustAnchors * @run main/othervm TrustAnchors sm policy */ diff --git a/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java b/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java index 19949777584..65128ff13c0 100644 --- a/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java +++ b/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm Basic * @run main/othervm Basic sm */ diff --git a/jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java b/jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java index 27a3575df3e..8ba16e13db4 100644 --- a/jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java +++ b/jdk/test/sun/security/pkcs11/SecureRandom/TestDeserialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, 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 @@ -26,7 +26,7 @@ * @bug 6837847 * @summary Ensure a deserialized PKCS#11 SecureRandom is functional. * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki */ import java.io.ByteArrayInputStream; diff --git a/jdk/test/sun/security/pkcs11/Serialize/SerializeProvider.java b/jdk/test/sun/security/pkcs11/Serialize/SerializeProvider.java index b22465f0425..405a6361706 100644 --- a/jdk/test/sun/security/pkcs11/Serialize/SerializeProvider.java +++ b/jdk/test/sun/security/pkcs11/Serialize/SerializeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary Test that the SunPKCS11 provider can be serialized * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki */ import java.io.ByteArrayInputStream; diff --git a/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java b/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java index 854da848f28..56022513a49 100644 --- a/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java +++ b/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm ByteBuffers * @run main/othervm ByteBuffers sm */ diff --git a/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java b/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java index 9a072269f99..adf45f42df9 100644 --- a/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java +++ b/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main ReinitSignature * @run main ReinitSignature * @run main ReinitSignature diff --git a/jdk/test/sun/security/pkcs11/Signature/TestDSA.java b/jdk/test/sun/security/pkcs11/Signature/TestDSA.java index 11bfbfde324..0e888d35336 100644 --- a/jdk/test/sun/security/pkcs11/Signature/TestDSA.java +++ b/jdk/test/sun/security/pkcs11/Signature/TestDSA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestDSA * @run main/othervm TestDSA sm */ diff --git a/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java b/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java index 673098e4d21..93aab80f8c6 100644 --- a/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java +++ b/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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 @@ -28,7 +28,7 @@ * with unsupported key sizes * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestDSAKeyLength * @run main/othervm TestDSAKeyLength sm */ diff --git a/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java b/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java index 8e70e224bf1..1801e7559f0 100644 --- a/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java +++ b/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, 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 @@ -27,7 +27,7 @@ * @summary Make sure initSign/initVerify() check RSA key lengths * @author Yu-Ching Valerie Peng * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestRSAKeyLength * @run main/othervm TestRSAKeyLength sm */ diff --git a/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java b/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java index 46d44f446e2..d0906e5194e 100644 --- a/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java +++ b/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -29,7 +29,7 @@ * @author Andreas Sterbenz * @library .. * @library ../../../../java/security/testlibrary - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm ReadCertificates * @run main/othervm ReadCertificates sm policy */ diff --git a/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java b/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java index 8efbb0a9aea..de5e8289898 100644 --- a/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java +++ b/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -29,7 +29,7 @@ * @library .. * @library ../../../../java/security/testlibrary * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm ReadPKCS12 * @run main/othervm ReadPKCS12 sm policy */ diff --git a/jdk/test/sun/security/pkcs11/ec/TestCurves.java b/jdk/test/sun/security/pkcs11/ec/TestCurves.java index b07900153ec..6cf32c4c9d9 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestCurves.java +++ b/jdk/test/sun/security/pkcs11/ec/TestCurves.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -27,8 +27,8 @@ * @summary Basic consistency test for all curves using ECDSA and ECDH * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token/sun.security.pkcs11.wrapper - * @compile --add-modules jdk.crypto.token TestCurves.java + * @modules jdk.crypto.cryptoki/sun.security.pkcs11.wrapper + * @compile --add-modules jdk.crypto.cryptoki TestCurves.java * @run main/othervm TestCurves * @run main/othervm TestCurves sm * @key randomness diff --git a/jdk/test/sun/security/pkcs11/ec/TestECDH.java b/jdk/test/sun/security/pkcs11/ec/TestECDH.java index a967f8e2eff..340d1cc0ed8 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestECDH.java +++ b/jdk/test/sun/security/pkcs11/ec/TestECDH.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @library ../../../../java/security/testlibrary - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestECDH * @run main/othervm TestECDH sm policy */ diff --git a/jdk/test/sun/security/pkcs11/ec/TestECDH2.java b/jdk/test/sun/security/pkcs11/ec/TestECDH2.java index 2da9fbc333b..cb243a8e03f 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestECDH2.java +++ b/jdk/test/sun/security/pkcs11/ec/TestECDH2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, 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 @@ -29,7 +29,7 @@ * @library .. * @library ../../../../java/security/testlibrary * @modules java.base/sun.security.util - * jdk.crypto.token + * jdk.crypto.cryptoki * @compile -XDignore.symbol.file TestECDH2.java * @run main/othervm TestECDH2 * @run main/othervm TestECDH2 sm diff --git a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java index 8b516cc6f27..774aa827c99 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java +++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -29,7 +29,7 @@ * @library .. * @library ../../../../java/security/testlibrary * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestECDSA * @run main/othervm TestECDSA sm policy */ diff --git a/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java b/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java index 0a9b9c66b31..b08f490d997 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java +++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, 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 @@ -29,7 +29,7 @@ * @library .. * @library ../../../../java/security/testlibrary * @modules java.base/sun.security.util - * jdk.crypto.token + * jdk.crypto.cryptoki * @compile -XDignore.symbol.file TestECDSA2.java * @run main/othervm TestECDSA2 * @run main/othervm TestECDSA2 sm diff --git a/jdk/test/sun/security/pkcs11/ec/TestECGenSpec.java b/jdk/test/sun/security/pkcs11/ec/TestECGenSpec.java index 9d50c9522e1..9b4853da995 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestECGenSpec.java +++ b/jdk/test/sun/security/pkcs11/ec/TestECGenSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -27,7 +27,7 @@ * @summary Verify that we can use ECGenParameterSpec * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestECGenSpec * @run main/othervm TestECGenSpec sm */ diff --git a/jdk/test/sun/security/pkcs11/ec/TestKeyFactory.java b/jdk/test/sun/security/pkcs11/ec/TestKeyFactory.java index 524c0485a91..585701a7c62 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestKeyFactory.java +++ b/jdk/test/sun/security/pkcs11/ec/TestKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -27,7 +27,7 @@ * @summary Test the P11ECKeyFactory * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestKeyFactory * @run main/othervm TestKeyFactory sm */ diff --git a/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java b/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java index 00c7199b7e3..026731d453a 100644 --- a/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java +++ b/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm KeyWrap * @run main/othervm KeyWrap sm */ diff --git a/jdk/test/sun/security/pkcs11/rsa/TestCACerts.java b/jdk/test/sun/security/pkcs11/rsa/TestCACerts.java index 012142e2776..9ecba138ca6 100644 --- a/jdk/test/sun/security/pkcs11/rsa/TestCACerts.java +++ b/jdk/test/sun/security/pkcs11/rsa/TestCACerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @library ../../../../java/security/testlibrary - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestCACerts * @run main/othervm TestCACerts sm TestCACerts.policy */ diff --git a/jdk/test/sun/security/pkcs11/rsa/TestKeyFactory.java b/jdk/test/sun/security/pkcs11/rsa/TestKeyFactory.java index f999afae4e6..c4f391a0c01 100644 --- a/jdk/test/sun/security/pkcs11/rsa/TestKeyFactory.java +++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -27,7 +27,7 @@ * @summary Test KeyFactory of the new RSA provider * @author Andreas Sterbenz * @library .. - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestKeyFactory * @run main/othervm TestKeyFactory sm rsakeys.ks.policy */ diff --git a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java index 6671509b1e1..78e305e1880 100644 --- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java +++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -29,7 +29,7 @@ * @library .. * @library /lib/testlibrary * @build jdk.testlibrary.* - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator * sm TestKeyPairGenerator.policy diff --git a/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java b/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java index e0c61d80901..68ea8c6740d 100644 --- a/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java +++ b/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @key randomness - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestSignatures * @run main/othervm TestSignatures sm rsakeys.ks.policy */ diff --git a/jdk/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java b/jdk/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java index a1689656057..f19b2e3e2c1 100644 --- a/jdk/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java +++ b/jdk/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ * @author Andreas Sterbenz * @library .. * @library ../../../../java/security/testlibrary - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm -Djdk.tls.namedGroups="secp256r1,sect193r1" * ClientJSSEServerJSSE * @run main/othervm -Djdk.tls.namedGroups="secp256r1,sect193r1" diff --git a/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java b/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java index c0b58d03d0d..40f579df5dd 100644 --- a/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java +++ b/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @modules java.base/sun.security.internal.spec - * jdk.crypto.token + * jdk.crypto.cryptoki * @run main/othervm TestKeyMaterial * @run main/othervm TestKeyMaterial sm policy */ diff --git a/jdk/test/sun/security/pkcs11/tls/TestLeadingZeroesP11.java b/jdk/test/sun/security/pkcs11/tls/TestLeadingZeroesP11.java index e455cce5377..67753d8a932 100644 --- a/jdk/test/sun/security/pkcs11/tls/TestLeadingZeroesP11.java +++ b/jdk/test/sun/security/pkcs11/tls/TestLeadingZeroesP11.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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 @@ -27,7 +27,7 @@ * @summary Need to strip leading zeros in TlsPremasterSecret of DHKeyAgreement * @library .. * @author Pasi Eronen - * @modules jdk.crypto.token + * @modules jdk.crypto.cryptoki * @run main/othervm TestLeadingZeroesP11 * @run main/othervm TestLeadingZeroesP11 sm */ diff --git a/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java b/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java index abaceb35268..15b058a6fa6 100644 --- a/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java +++ b/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -29,7 +29,7 @@ * @library .. * @modules java.base/sun.security.internal.interfaces * java.base/sun.security.internal.spec - * jdk.crypto.token + * jdk.crypto.cryptoki * @run main/othervm TestMasterSecret * @run main/othervm TestMasterSecret sm TestMasterSecret.policy */ diff --git a/jdk/test/sun/security/pkcs11/tls/TestPRF.java b/jdk/test/sun/security/pkcs11/tls/TestPRF.java index 9efdb0063b3..695fab90062 100644 --- a/jdk/test/sun/security/pkcs11/tls/TestPRF.java +++ b/jdk/test/sun/security/pkcs11/tls/TestPRF.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @modules java.base/sun.security.internal.spec - * jdk.crypto.token + * jdk.crypto.cryptoki * @run main/othervm TestPRF * @run main/othervm TestPRF sm policy */ diff --git a/jdk/test/sun/security/pkcs11/tls/TestPremaster.java b/jdk/test/sun/security/pkcs11/tls/TestPremaster.java index 6bdace21519..2566508133b 100644 --- a/jdk/test/sun/security/pkcs11/tls/TestPremaster.java +++ b/jdk/test/sun/security/pkcs11/tls/TestPremaster.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @modules java.base/sun.security.internal.spec - * jdk.crypto.token + * jdk.crypto.cryptoki * @run main/othervm TestPremaster * @run main/othervm TestPremaster sm policy */ diff --git a/jdk/test/tools/launcher/MiscTests.java b/jdk/test/tools/launcher/MiscTests.java index dbd6255bc3a..2cc6a529e72 100644 --- a/jdk/test/tools/launcher/MiscTests.java +++ b/jdk/test/tools/launcher/MiscTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, 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 @@ -80,8 +80,8 @@ public class MiscTests extends TestHelper { createFile(new File(mainClass + ".java"), scratch); compile(mainClass + ".java", - "--add-modules=jdk.crypto.token", - "--add-exports=jdk.crypto.token/sun.security.pkcs11=ALL-UNNAMED"); + "--add-modules=jdk.crypto.cryptoki", + "--add-exports=jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED"); File testJar = new File("Foo.jar"); testJar.delete(); From 946541ac579430772d4a83724964b7624cc2b27f Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Mon, 23 Jan 2017 11:49:50 -0800 Subject: [PATCH 70/71] 8172527: Rename jdk.crypto.token to jdk.crypto.cryptoki Reviewed-by: mchung, wetmore --- common/bin/unshuffle_list.txt | 56 ++++----- common/nb_native/nbproject/configurations.xml | 116 +++++++++--------- make/Images.gmk | 4 +- make/ZipSecurity.gmk | 6 +- make/common/Modules.gmk | 4 +- 5 files changed, 93 insertions(+), 93 deletions(-) diff --git a/common/bin/unshuffle_list.txt b/common/bin/unshuffle_list.txt index a43b049fce4..a217a8f01f8 100644 --- a/common/bin/unshuffle_list.txt +++ b/common/bin/unshuffle_list.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2017, 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 @@ -1266,33 +1266,33 @@ jdk/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp : jdk/src/share/native/s jdk/src/jdk.crypto.ec/share/native/libsunec/impl : jdk/src/share/native/sun/security/ec/impl jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi : jdk/src/windows/classes/sun/security/mscapi jdk/src/jdk.crypto.mscapi/windows/native/libsunmscapi : jdk/src/windows/native/sun/security/mscapi -jdk/src/jdk.crypto.token/share/classes/sun/security/pkcs11 : jdk/src/share/classes/sun/security/pkcs11 -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/j2secmod.c : jdk/src/share/native/sun/security/pkcs11/j2secmod.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/j2secmod.h : jdk/src/share/native/sun/security/pkcs11/j2secmod.h -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_convert.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_crypt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_digest.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_digest.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_dual.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_dual.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_general.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_general.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_keymgmt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_keymgmt.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_mutex.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_mutex.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_objmgmt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_objmgmt.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_sessmgmt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sessmgmt.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_sign.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sign.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/p11_util.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_util.c -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11f.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11f.h -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11.h -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11t.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11t.h -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs-11v2-20a3.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs-11v2-20a3.h -jdk/src/jdk.crypto.token/share/native/libj2pkcs11/pkcs11wrapper.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h -jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/j2secmod_md.c : jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c -jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/j2secmod_md.h : jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.h -jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/p11_md.c : jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c -jdk/src/jdk.crypto.token/unix/native/libj2pkcs11/p11_md.h : jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.h -jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/j2secmod_md.c : jdk/src/windows/native/sun/security/pkcs11/j2secmod_md.c -jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/j2secmod_md.h : jdk/src/windows/native/sun/security/pkcs11/j2secmod_md.h -jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/p11_md.c : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.c -jdk/src/jdk.crypto.token/windows/native/libj2pkcs11/p11_md.h : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.h +jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11 : jdk/src/share/classes/sun/security/pkcs11 +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.c : jdk/src/share/native/sun/security/pkcs11/j2secmod.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.h : jdk/src/share/native/sun/security/pkcs11/j2secmod.h +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_digest.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_digest.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_dual.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_dual.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_general.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_keymgmt.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_mutex.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_mutex.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_objmgmt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_objmgmt.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sessmgmt.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sessmgmt.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sign.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c : jdk/src/share/native/sun/security/pkcs11/wrapper/p11_util.c +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11f.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11f.h +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11.h +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11t.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11t.h +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs-11v2-20a3.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs-11v2-20a3.h +jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h : jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h +jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/j2secmod_md.c : jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c +jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/j2secmod_md.h : jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.h +jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c : jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c +jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.h : jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.h +jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/j2secmod_md.c : jdk/src/windows/native/sun/security/pkcs11/j2secmod_md.c +jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/j2secmod_md.h : jdk/src/windows/native/sun/security/pkcs11/j2secmod_md.h +jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.c +jdk/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.h : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.h jdk/src/java.desktop/macosx/native/libosx/CFileManager.m : jdk/src/macosx/native/com/apple/eio/CFileManager.m jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m jdk/src/jdk.hprof.agent/share/classes/com/sun/demo/jvmti/hprof : jdk/src/share/classes/com/sun/demo/jvmti/hprof diff --git a/common/nb_native/nbproject/configurations.xml b/common/nb_native/nbproject/configurations.xml index 026734b8a14..170dc36b3b8 100644 --- a/common/nb_native/nbproject/configurations.xml +++ b/common/nb_native/nbproject/configurations.xml @@ -2166,7 +2166,7 @@ - + @@ -29422,35 +29422,35 @@ - - - - - @@ -29460,63 +29460,63 @@ - - - - - - - - - @@ -31752,7 +31752,7 @@ - + ../../jdk/src/java.base/share/native/include @@ -31760,10 +31760,10 @@ ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/jdk.crypto.token/share/native/libj2pkcs11 - ../../jdk/src/jdk.crypto.token/unix/native/libj2pkcs11 + ../../jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11 + ../../jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11 ../../jdk/src/java.base/macosx/native/libjava - ../../build/support/headers/jdk.crypto.token + ../../build/support/headers/jdk.crypto.cryptoki ../../make @@ -31772,7 +31772,7 @@ - + THIS_FILE="j2secmod_md.c" @@ -44741,14 +44741,14 @@ - - @@ -44758,7 +44758,7 @@ - @@ -44768,7 +44768,7 @@ - @@ -44778,7 +44778,7 @@ - @@ -44788,7 +44788,7 @@ - @@ -44798,7 +44798,7 @@ - @@ -44808,7 +44808,7 @@ - @@ -44818,7 +44818,7 @@ - @@ -44828,7 +44828,7 @@ - @@ -44838,7 +44838,7 @@ - @@ -44848,7 +44848,7 @@ - @@ -44858,14 +44858,14 @@ - - @@ -47795,7 +47795,7 @@ - + ../../jdk/src/java.base/share/native/include @@ -47803,10 +47803,10 @@ ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/jdk.crypto.token/share/native/libj2pkcs11 - ../../jdk/src/jdk.crypto.token/unix/native/libj2pkcs11 + ../../jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11 + ../../jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11 ../../jdk/src/java.base/linux/native/libjava - ../../build/support/headers/jdk.crypto.token + ../../build/support/headers/jdk.crypto.cryptoki ../../make @@ -47815,7 +47815,7 @@ - + THIS_FILE="j2secmod_md.c" @@ -62728,14 +62728,14 @@ - - @@ -62745,7 +62745,7 @@ - @@ -62755,7 +62755,7 @@ - @@ -62765,7 +62765,7 @@ - @@ -62775,7 +62775,7 @@ - @@ -62785,7 +62785,7 @@ - @@ -62795,7 +62795,7 @@ - @@ -62805,7 +62805,7 @@ - @@ -62815,7 +62815,7 @@ - @@ -62825,7 +62825,7 @@ - @@ -62835,7 +62835,7 @@ - @@ -62845,14 +62845,14 @@ - - @@ -66281,7 +66281,7 @@ - + ../../jdk/src/java.base/share/native/include @@ -66289,10 +66289,10 @@ ../../jdk/src/java.base/unix/native/include ../../jdk/src/java.base/share/native/libjava ../../jdk/src/java.base/unix/native/libjava - ../../jdk/src/jdk.crypto.token/share/native/libj2pkcs11 - ../../jdk/src/jdk.crypto.token/unix/native/libj2pkcs11 + ../../jdk/src/jdk.crypto.cryptoki/share/native/libj2pkcs11 + ../../jdk/src/jdk.crypto.cryptoki/unix/native/libj2pkcs11 ../../jdk/src/java.base/solaris/native/libjava - ../../build/support/headers/jdk.crypto.token + ../../build/support/headers/jdk.crypto.cryptoki ../../make @@ -66301,7 +66301,7 @@ - + THIS_FILE="j2secmod_md.c" diff --git a/make/Images.gmk b/make/Images.gmk index f2c469f0404..815168af063 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2017, 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 @@ -52,7 +52,7 @@ JRE_COMPACT1_MODULES := \ java.logging \ java.scripting \ jdk.localedata \ - jdk.crypto.token \ + jdk.crypto.cryptoki \ jdk.crypto.ec \ jdk.unsupported \ # diff --git a/make/ZipSecurity.gmk b/make/ZipSecurity.gmk index 465171ac6d6..ba5664122ce 100644 --- a/make/ZipSecurity.gmk +++ b/make/ZipSecurity.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2017, 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 @@ -43,8 +43,8 @@ $(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \ modules/java.base/com/sun/crypto/provider \ modules/jdk.crypto.ec/sun/security/ec \ modules/jdk.crypto.mscapi/sun/security/mscapi \ - modules/jdk.crypto.token/sun/security/pkcs11 \ - modules/jdk.crypto.token/sun/security/pkcs11/wrapper \ + modules/jdk.crypto.cryptoki/sun/security/pkcs11 \ + modules/jdk.crypto.cryptoki/sun/security/pkcs11/wrapper \ modules/jdk.crypto.ucrypto/com/oracle/security/ucrypto \ modules/java.base/javax/net \ modules/java.base/javax/security/cert \ diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index 9749420276f..c3c032ce542 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2017, 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 @@ -104,7 +104,7 @@ PLATFORM_MODULES += \ jdk.accessibility \ jdk.charsets \ jdk.crypto.ec \ - jdk.crypto.token \ + jdk.crypto.cryptoki \ jdk.desktop \ jdk.dynalink \ jdk.jsobject \ From 1d8cd10db54a6606379bae76946edb22c48b405d Mon Sep 17 00:00:00 2001 From: Peter Levart Date: Mon, 23 Jan 2017 23:56:02 +0100 Subject: [PATCH 71/71] 8173201: java/lang/reflect/PublicMethods/PublicMethodsTest.java fails because of too many open files Explicitly close StandardJavaFileManager(s) as soon as they are not needed any more Reviewed-by: redestad --- .../PublicMethods/PublicMethodsTest.java | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/jdk/test/java/lang/reflect/PublicMethods/PublicMethodsTest.java b/jdk/test/java/lang/reflect/PublicMethods/PublicMethodsTest.java index 381cb60c6a9..0859c8d7747 100644 --- a/jdk/test/java/lang/reflect/PublicMethods/PublicMethodsTest.java +++ b/jdk/test/java/lang/reflect/PublicMethods/PublicMethodsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import javax.tools.StandardLocation; import javax.tools.ToolProvider; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; +import java.io.Closeable; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; @@ -209,7 +210,7 @@ public class PublicMethodsTest { /** * compile expanded template into a ClassLoader that sees compiled classes */ - static ClassLoader compile(String source) throws CompileException { + static TestClassLoader compile(String source) throws CompileException { JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); if (javac == null) { throw new AssertionError("No Java compiler tool found."); @@ -367,7 +368,7 @@ public class PublicMethodsTest { } } - static class TestClassLoader extends ClassLoader { + static class TestClassLoader extends ClassLoader implements Closeable { private final TestFileManager fileManager; public TestClassLoader(ClassLoader parent, TestFileManager fileManager) { @@ -383,6 +384,11 @@ public class PublicMethodsTest { } return defineClass(name, classBytes, 0, classBytes.length); } + + @Override + public void close() throws IOException { + fileManager.close(); + } } static Map generateResult(Case c, ClassLoader cl) { @@ -424,18 +430,21 @@ public class PublicMethodsTest { return combinations(c) .flatMap(comb -> { String src = expandTemplate(c, comb); - ClassLoader cl; try { - cl = compile(src); - } catch (CompileException e) { - // ignore uncompilable combinations - return Stream.empty(); + try (TestClassLoader cl = compile(src)) { + // compilation was successful -> generate result + return Stream.of(Map.entry( + comb, + generateResult(c, cl) + )); + } catch (CompileException e) { + // ignore uncompilable combinations + return Stream.empty(); + } + } catch (IOException ioe) { + // from TestClassLoader.close() + throw new UncheckedIOException(ioe); } - // compilation was successful -> generate result - return Stream.of(Map.entry( - comb, - generateResult(c, cl) - )); }); } @@ -500,15 +509,20 @@ public class PublicMethodsTest { Map expected = exp.getValue(); String src = expandTemplate(c, comb); - ClassLoader cl; + Map actual; try { - cl = compile(src); - } catch (CompileException ce) { + try (TestClassLoader cl = compile(src)) { + actual = generateResult(c, cl); + } catch (CompileException ce) { + return Stream.of(src + "\n" + + "got compilation error: " + ce); + } + } catch (IOException ioe) { + // from TestClassLoader.close() return Stream.of(src + "\n" + - "got compilation error: " + ce); + "got IOException: " + ioe); } - Map actual = generateResult(c, cl); if (actual.equals(expected)) { return Stream.empty(); } else {