This commit is contained in:
Prasanta Sadhukhan 2020-07-26 14:46:36 +05:30
commit 831e98327b
29 changed files with 484 additions and 372 deletions

View File

@ -1121,8 +1121,9 @@ void java_lang_Class::archive_basic_type_mirrors(TRAPS) {
assert(HeapShared::is_heap_object_archiving_allowed(),
"HeapShared::is_heap_object_archiving_allowed() must be true");
for (int t = 0; t <= T_VOID; t++) {
oop m = Universe::_mirrors[t];
for (int t = T_BOOLEAN; t < T_VOID+1; t++) {
BasicType bt = (BasicType)t;
oop m = Universe::_mirrors[t].resolve();
if (m != NULL) {
// Update the field at _array_klass_offset to point to the relocated array klass.
oop archived_m = HeapShared::archive_heap_object(m, THREAD);
@ -1142,33 +1143,12 @@ void java_lang_Class::archive_basic_type_mirrors(TRAPS) {
log_trace(cds, heap, mirror)(
"Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT,
type2name((BasicType)t), p2i(Universe::_mirrors[t]), p2i(archived_m));
type2name(bt), p2i(m), p2i(archived_m));
Universe::_mirrors[t] = archived_m;
Universe::replace_mirror(bt, archived_m);
}
}
assert(Universe::_mirrors[T_INT] != NULL &&
Universe::_mirrors[T_FLOAT] != NULL &&
Universe::_mirrors[T_DOUBLE] != NULL &&
Universe::_mirrors[T_BYTE] != NULL &&
Universe::_mirrors[T_BOOLEAN] != NULL &&
Universe::_mirrors[T_CHAR] != NULL &&
Universe::_mirrors[T_LONG] != NULL &&
Universe::_mirrors[T_SHORT] != NULL &&
Universe::_mirrors[T_VOID] != NULL, "sanity");
Universe::set_int_mirror(Universe::_mirrors[T_INT]);
Universe::set_float_mirror(Universe::_mirrors[T_FLOAT]);
Universe::set_double_mirror(Universe::_mirrors[T_DOUBLE]);
Universe::set_byte_mirror(Universe::_mirrors[T_BYTE]);
Universe::set_bool_mirror(Universe::_mirrors[T_BOOLEAN]);
Universe::set_char_mirror(Universe::_mirrors[T_CHAR]);
Universe::set_long_mirror(Universe::_mirrors[T_LONG]);
Universe::set_short_mirror(Universe::_mirrors[T_SHORT]);
Universe::set_void_mirror(Universe::_mirrors[T_VOID]);
}
//
// After the mirror object is successfully archived, the archived
// klass is set with _has_archived_raw_mirror flag.

View File

@ -714,19 +714,6 @@ static void remove_java_mirror_in_classes() {
}
}
static void clear_basic_type_mirrors() {
assert(!HeapShared::is_heap_object_archiving_allowed(), "Sanity");
Universe::set_int_mirror(NULL);
Universe::set_float_mirror(NULL);
Universe::set_double_mirror(NULL);
Universe::set_byte_mirror(NULL);
Universe::set_bool_mirror(NULL);
Universe::set_char_mirror(NULL);
Universe::set_long_mirror(NULL);
Universe::set_short_mirror(NULL);
Universe::set_void_mirror(NULL);
}
static void rewrite_nofast_bytecode(const methodHandle& method) {
BytecodeStream bcs(method);
while (!bcs.is_last_bytecode()) {
@ -1540,7 +1527,7 @@ char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
log_info(cds)("Removing java_mirror ... ");
if (!HeapShared::is_heap_object_archiving_allowed()) {
clear_basic_type_mirrors();
Universe::clear_basic_type_mirrors();
}
remove_java_mirror_in_classes();
log_info(cds)("done. ");
@ -2092,7 +2079,7 @@ void ReadClosure::do_tag(int tag) {
void ReadClosure::do_oop(oop *p) {
narrowOop o = (narrowOop)nextPtr();
if (o == 0 || !HeapShared::open_archive_heap_region_mapped()) {
p = NULL;
*p = NULL;
} else {
assert(HeapShared::is_heap_object_archiving_allowed(),
"Archived heap object is not allowed");

View File

@ -88,25 +88,10 @@
#include "utilities/ostream.hpp"
#include "utilities/preserveException.hpp"
#define PRIMITIVE_MIRRORS_DO(func) \
func(_int_mirror) \
func(_float_mirror) \
func(_double_mirror) \
func(_byte_mirror) \
func(_bool_mirror) \
func(_char_mirror) \
func(_long_mirror) \
func(_short_mirror) \
func(_void_mirror)
#define DEFINE_PRIMITIVE_MIRROR(m) \
oop Universe::m = NULL;
// Known objects
PRIMITIVE_MIRRORS_DO(DEFINE_PRIMITIVE_MIRROR)
Klass* Universe::_typeArrayKlassObjs[T_LONG+1] = { NULL /*, NULL...*/ };
Klass* Universe::_objectArrayKlassObj = NULL;
oop Universe::_mirrors[T_VOID+1] = { NULL /*, NULL...*/ };
OopHandle Universe::_mirrors[T_VOID+1];
OopHandle Universe::_main_thread_group;
OopHandle Universe::_system_thread_group;
@ -197,6 +182,35 @@ oop Universe::virtual_machine_error_instance() { return _virtual_machine_erro
oop Universe::the_null_sentinel() { return _the_null_sentinel.resolve(); }
oop Universe::int_mirror() { return check_mirror(_mirrors[T_INT].resolve()); }
oop Universe::float_mirror() { return check_mirror(_mirrors[T_FLOAT].resolve()); }
oop Universe::double_mirror() { return check_mirror(_mirrors[T_DOUBLE].resolve()); }
oop Universe::byte_mirror() { return check_mirror(_mirrors[T_BYTE].resolve()); }
oop Universe::bool_mirror() { return check_mirror(_mirrors[T_BOOLEAN].resolve()); }
oop Universe::char_mirror() { return check_mirror(_mirrors[T_CHAR].resolve()); }
oop Universe::long_mirror() { return check_mirror(_mirrors[T_LONG].resolve()); }
oop Universe::short_mirror() { return check_mirror(_mirrors[T_SHORT].resolve()); }
oop Universe::void_mirror() { return check_mirror(_mirrors[T_VOID].resolve()); }
oop Universe::java_mirror(BasicType t) {
assert((uint)t < T_VOID+1, "range check");
return check_mirror(_mirrors[t].resolve());
}
// Used by CDS dumping
void Universe::replace_mirror(BasicType t, oop new_mirror) {
Universe::_mirrors[t].replace(new_mirror);
}
// Not sure why CDS has to do this
void Universe::clear_basic_type_mirrors() {
for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
if (!is_reference_type((BasicType)i)) {
Universe::_mirrors[i].replace(NULL);
}
}
}
void Universe::basic_type_classes_do(void f(Klass*)) {
for (int i = T_BOOLEAN; i < T_LONG+1; i++) {
f(_typeArrayKlassObjs[i]);
@ -209,16 +223,7 @@ void Universe::basic_type_classes_do(KlassClosure *closure) {
}
}
#define DO_PRIMITIVE_MIRROR(m) \
f->do_oop((oop*) &m);
void Universe::oops_do(OopClosure* f) {
PRIMITIVE_MIRRORS_DO(DO_PRIMITIVE_MIRROR);
for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
f->do_oop(&_mirrors[i]);
}
assert(_mirrors[0] == NULL && _mirrors[T_BOOLEAN - 1] == NULL, "checking");
f->do_oop(&_reference_pending_list);
ThreadsSMRSupport::exiting_threads_oops_do(f);
@ -248,29 +253,36 @@ void Universe::metaspace_pointers_do(MetaspaceClosure* it) {
_do_stack_walk_cache->metaspace_pointers_do(it);
}
#define ASSERT_MIRROR_NULL(m) \
assert(m == NULL, "archived mirrors should be NULL");
#define SERIALIZE_MIRROR(m) \
f->do_oop(&m); \
if (m != NULL) { java_lang_Class::update_archived_primitive_mirror_native_pointers(m); }
// Serialize metadata and pointers to primitive type mirrors in and out of CDS archive
void Universe::serialize(SerializeClosure* f) {
#if INCLUDE_CDS_JAVA_HEAP
{
oop mirror_oop;
for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
if (f->reading()) {
f->do_oop(&mirror_oop); // read from archive
assert(oopDesc::is_oop_or_null(mirror_oop), "is oop");
// Only create an OopHandle for non-null mirrors
if (mirror_oop != NULL) {
_mirrors[i] = OopHandle(vm_global(), mirror_oop);
}
} else {
mirror_oop = _mirrors[i].resolve();
f->do_oop(&mirror_oop); // write to archive
}
if (mirror_oop != NULL) { // may be null if archived heap is disabled
java_lang_Class::update_archived_primitive_mirror_native_pointers(mirror_oop);
}
}
}
#endif
for (int i = 0; i < T_LONG+1; i++) {
f->do_ptr((void**)&_typeArrayKlassObjs[i]);
}
f->do_ptr((void**)&_objectArrayKlassObj);
#if INCLUDE_CDS_JAVA_HEAP
DEBUG_ONLY(if (DumpSharedSpaces && !HeapShared::is_heap_object_archiving_allowed()) {
PRIMITIVE_MIRRORS_DO(ASSERT_MIRROR_NULL);
});
PRIMITIVE_MIRRORS_DO(SERIALIZE_MIRROR);
#endif
f->do_ptr((void**)&_the_array_interfaces_array);
f->do_ptr((void**)&_the_empty_int_array);
f->do_ptr((void**)&_the_empty_short_array);
@ -284,6 +296,7 @@ void Universe::serialize(SerializeClosure* f) {
_do_stack_walk_cache->serialize(f);
}
void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
if (size < alignment || size % alignment != 0) {
vm_exit_during_initialization(
@ -435,51 +448,32 @@ void Universe::genesis(TRAPS) {
#endif
}
#define ASSERT_MIRROR_NOT_NULL(m) \
assert(m != NULL, "archived mirrors should not be NULL");
void Universe::initialize_basic_type_mirrors(TRAPS) {
#if INCLUDE_CDS_JAVA_HEAP
if (UseSharedSpaces &&
HeapShared::open_archive_heap_region_mapped() &&
_int_mirror != NULL) {
_mirrors[T_INT].resolve() != NULL) {
assert(HeapShared::is_heap_object_archiving_allowed(), "Sanity");
PRIMITIVE_MIRRORS_DO(ASSERT_MIRROR_NOT_NULL);
// check that all mirrors are mapped also
for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
if (!is_reference_type((BasicType)i)) {
oop m = _mirrors[i].resolve();
assert(m != NULL, "archived mirrors should not be NULL");
}
}
} else
// _int_mirror could be NULL if archived heap is not mapped.
// _mirror[T_INT} could be NULL if archived heap is not mapped.
#endif
{
_int_mirror =
java_lang_Class::create_basic_type_mirror("int", T_INT, CHECK);
_float_mirror =
java_lang_Class::create_basic_type_mirror("float", T_FLOAT, CHECK);
_double_mirror =
java_lang_Class::create_basic_type_mirror("double", T_DOUBLE, CHECK);
_byte_mirror =
java_lang_Class::create_basic_type_mirror("byte", T_BYTE, CHECK);
_bool_mirror =
java_lang_Class::create_basic_type_mirror("boolean",T_BOOLEAN, CHECK);
_char_mirror =
java_lang_Class::create_basic_type_mirror("char", T_CHAR, CHECK);
_long_mirror =
java_lang_Class::create_basic_type_mirror("long", T_LONG, CHECK);
_short_mirror =
java_lang_Class::create_basic_type_mirror("short", T_SHORT, CHECK);
_void_mirror =
java_lang_Class::create_basic_type_mirror("void", T_VOID, CHECK);
for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
BasicType bt = (BasicType)i;
if (!is_reference_type(bt)) {
oop m = java_lang_Class::create_basic_type_mirror(type2name(bt), bt, CHECK);
_mirrors[i] = OopHandle(vm_global(), m);
}
}
}
_mirrors[T_INT] = _int_mirror;
_mirrors[T_FLOAT] = _float_mirror;
_mirrors[T_DOUBLE] = _double_mirror;
_mirrors[T_BYTE] = _byte_mirror;
_mirrors[T_BOOLEAN] = _bool_mirror;
_mirrors[T_CHAR] = _char_mirror;
_mirrors[T_LONG] = _long_mirror;
_mirrors[T_SHORT] = _short_mirror;
_mirrors[T_VOID] = _void_mirror;
//_mirrors[T_OBJECT] = _object_klass->java_mirror();
//_mirrors[T_ARRAY] = _object_klass->java_mirror();
}
void Universe::fixup_mirrors(TRAPS) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -95,18 +95,6 @@ class Universe: AllStatic {
static Klass* _objectArrayKlassObj;
// Known objects in the VM
// Primitive objects
static oop _int_mirror;
static oop _float_mirror;
static oop _double_mirror;
static oop _byte_mirror;
static oop _bool_mirror;
static oop _char_mirror;
static oop _long_mirror;
static oop _short_mirror;
static oop _void_mirror;
static OopHandle _main_thread_group; // Reference to the main thread group object
static OopHandle _system_thread_group; // Reference to the system thread group object
@ -232,33 +220,24 @@ class Universe: AllStatic {
}
// Known objects in the VM
static oop int_mirror() { return check_mirror(_int_mirror); }
static oop float_mirror() { return check_mirror(_float_mirror); }
static oop double_mirror() { return check_mirror(_double_mirror); }
static oop byte_mirror() { return check_mirror(_byte_mirror); }
static oop bool_mirror() { return check_mirror(_bool_mirror); }
static oop char_mirror() { return check_mirror(_char_mirror); }
static oop long_mirror() { return check_mirror(_long_mirror); }
static oop short_mirror() { return check_mirror(_short_mirror); }
static oop void_mirror() { return check_mirror(_void_mirror); }
static oop int_mirror();
static oop float_mirror();
static oop double_mirror();
static oop byte_mirror();
static oop bool_mirror();
static oop char_mirror();
static oop long_mirror();
static oop short_mirror();
static oop void_mirror();
static void set_int_mirror(oop m) { _int_mirror = m; }
static void set_float_mirror(oop m) { _float_mirror = m; }
static void set_double_mirror(oop m) { _double_mirror = m; }
static void set_byte_mirror(oop m) { _byte_mirror = m; }
static void set_bool_mirror(oop m) { _bool_mirror = m; }
static void set_char_mirror(oop m) { _char_mirror = m; }
static void set_long_mirror(oop m) { _long_mirror = m; }
static void set_short_mirror(oop m) { _short_mirror = m; }
static void set_void_mirror(oop m) { _void_mirror = m; }
// Table of primitive type mirrors, excluding T_OBJECT and T_ARRAY
// but including T_VOID, hence the index including T_VOID
static OopHandle _mirrors[T_VOID+1];
// table of same
static oop _mirrors[T_VOID+1];
static oop java_mirror(BasicType t);
static void replace_mirror(BasicType t, oop obj);
static void clear_basic_type_mirrors();
static oop java_mirror(BasicType t) {
assert((uint)t < T_VOID+1, "range check");
return check_mirror(_mirrors[t]);
}
static oop main_thread_group();
static void set_main_thread_group(oop group);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -74,6 +74,11 @@ class Authenticator {
private RequestorType requestingAuthType;
private final String key = AuthenticatorKeys.computeKey(this);
/**
* Constructor for subclasses to call.
*/
public Authenticator() {}
/**
* The type of the entity requesting authentication.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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,6 +43,11 @@ import java.io.IOException;
*/
public abstract class CacheRequest {
/**
* Constructor for subclasses to call.
*/
public CacheRequest() {}
/**
* Returns an OutputStream to which the response body can be
* written.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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,6 +41,11 @@ import java.io.IOException;
*/
public abstract class CacheResponse {
/**
* Constructor for subclasses to call.
*/
public CacheResponse() {}
/**
* Returns the response headers as a Map.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2020, 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
@ -83,6 +83,11 @@ import java.io.IOException;
*/
public abstract class ContentHandler {
/**
* Constructor for subclasses to call.
*/
public ContentHandler() {}
/**
* Given a URL connect stream positioned at the beginning of the
* representation of an object, this method reads that stream and

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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,6 +50,11 @@ import sun.security.util.SecurityConstants;
* @since 1.5
*/
public abstract class CookieHandler {
/**
* Constructor for subclasses to call.
*/
public CookieHandler() {}
/**
* The system-wide cookie handler that will apply cookies to the
* request headers and manage cookies from the response headers.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -57,6 +57,11 @@ import java.util.Set;
public abstract class DatagramSocketImpl implements SocketOptions {
/**
* Constructor for subclasses to call.
*/
public DatagramSocketImpl() {}
/**
* The local port number.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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,6 +80,11 @@ public abstract class ProxySelector {
}
}
/**
* Constructor for subclasses to call.
*/
public ProxySelector() {}
/**
* Gets the system-wide proxy selector.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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,6 +60,11 @@ import sun.security.util.SecurityConstants;
*/
public abstract class ResponseCache {
/**
* Constructor for subclasses to call.
*/
public ResponseCache() {}
/**
* The system wide cache that provides access to a url
* caching mechanism.

View File

@ -39,6 +39,11 @@ import java.util.Optional;
* @since 1.5
*/
public abstract class SecureCacheResponse extends CacheResponse {
/**
* Constructor for subclasses to call.
*/
public SecureCacheResponse() {}
/**
* Returns the cipher suite in use on the original connection that
* retrieved the network resource.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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,4 +43,8 @@ public abstract class SocketAddress implements java.io.Serializable {
@java.io.Serial
static final long serialVersionUID = 5215720748342549866L;
/**
* Constructor for subclasses to call.
*/
public SocketAddress() {}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -81,6 +81,12 @@ import java.util.Objects;
public class URLDecoder {
/**
* Do not call.
*/
@Deprecated(since="16", forRemoval=true)
public URLDecoder() {}
// The platform default encoding
static String dfltEncName = URLEncoder.dfltEncName;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2020, 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,6 +51,11 @@ import sun.net.www.ParseUtil;
* @since 1.0
*/
public abstract class URLStreamHandler {
/**
* Constructor for subclasses to call.
*/
public URLStreamHandler() {}
/**
* Opens a connection to the object referenced by the
* {@code URL} argument.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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,6 +50,10 @@ public class AttributeChangeNotificationFilter implements NotificationFilter {
*/
private Vector<String> enabledAttributes = new Vector<String>();
/**
* Constructs an {@code AttributeChangeNotificationFilter}.
*/
public AttributeChangeNotificationFilter() {}
/**
* Invoked before sending the specified notification to the listener.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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,6 +50,11 @@ import javax.management.loading.ClassLoaderRepository;
*/
@Deprecated
public class DefaultLoaderRepository {
/**
* Constructs an {@code DefaultLoaderRepository}.
*/
public DefaultLoaderRepository() {}
/**
* Go through the list of class loaders and try to load the requested class.
* The method will stop as soon as the class is found. If the class

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -68,6 +68,11 @@ public class NotificationFilterSupport implements NotificationFilter {
private List<String> enabledTypes = new Vector<String>();
/**
* Constructs a {@code NotificationFilterSupport}.
*/
public NotificationFilterSupport() {}
/**
* Invoked before sending the specified notification to the listener.
* <BR>This filter compares the type of the specified notification with each enabled type.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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,6 +41,11 @@ public abstract class QueryEval implements Serializable {
private static ThreadLocal<MBeanServer> server =
new InheritableThreadLocal<MBeanServer>();
/**
* Constructor for subclasses to call.
*/
public QueryEval() {}
/**
* <p>Sets the MBean server on which the query is to be performed.
* The setting is valid for the thread performing the set.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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
@ -55,6 +55,11 @@ import javax.management.MBeanServerFactory;
@Deprecated
public class DefaultLoaderRepository {
/**
* Constructs a {@code DefaultLoaderRepository}.
*/
public DefaultLoaderRepository() {}
/**
* Go through the list of class loaders and try to load the requested
* class.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -76,6 +76,11 @@ public abstract class Monitor
extends NotificationBroadcasterSupport
implements MonitorMBean, MBeanRegistration {
/**
* Constructor for subclasses to call.
*/
public Monitor() {}
/*
* ------------------------------------------
* PACKAGE CLASSES

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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,12 @@ package javax.management.relation;
*/
public class RoleStatus {
/**
* Do not call.
*/
@Deprecated(since="16", forRemoval=true)
public RoleStatus() {}
//
// Possible problems
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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,6 +52,10 @@ import java.lang.reflect.*;
* @since 1.5
*/
public class RowSetMetaDataImpl implements RowSetMetaData, Serializable {
/**
* Constructs a {@code RowSetMetaDataImpl} object.
*/
public RowSetMetaDataImpl() {}
/**
* The number of columns in the <code>RowSet</code> object that created

View File

@ -24,14 +24,24 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include "AppLauncher.h"
#include "FileUtils.h"
#include "UnixSysInfo.h"
#include "Package.h"
#include "Log.h"
#include "ErrorHandling.h"
namespace {
size_t hash(const std::string& str) {
size_t h = 0;
for(std::string::const_iterator it = str.begin(); it != str.end(); ++it) {
h = 31 * h + (*it & 0xff);
}
return h;
}
void launchApp() {
setlocale(LC_ALL, "en_US.utf8");
@ -57,6 +67,56 @@ void launchApp() {
ownerPackage.initAppLauncher(appLauncher);
}
const std::string _JPACKAGE_LAUNCHER = "_JPACKAGE_LAUNCHER";
std::string launchInfo = SysInfo::getEnvVariable(std::nothrow,
_JPACKAGE_LAUNCHER, "");
const std::string thisLdLibraryPath = SysInfo::getEnvVariable(std::nothrow,
"LD_LIBRARY_PATH", "");
const size_t thisHash = hash(thisLdLibraryPath);
if (!launchInfo.empty()) {
LOG_TRACE(tstrings::any() << "Found "
<< _JPACKAGE_LAUNCHER << "=[" << launchInfo << "]");
tistringstream iss(launchInfo);
iss.exceptions(std::ios::failbit | std::ios::badbit);
size_t hash = 0;
iss >> hash;
launchInfo = "";
if (thisHash != hash) {
// This launcher execution is the result of execve() call from
// withing JVM.
// This means all JVM arguments are already configured in launcher
// process command line.
// No need to construct command line for JVM.
LOG_TRACE("Not building JVM arguments from cfg file");
appLauncher.setInitJvmFromCmdlineOnly(true);
}
} else {
// Changed LD_LIBRARY_PATH environment variable might result in
// execve() call from within JVM.
// Set _JPACKAGE_LAUNCHER environment variable accordingly so that
// restarted launcher process can detect a restart.
launchInfo = (tstrings::any() << thisHash).str();
}
JP_TRY;
if (0 != setenv(_JPACKAGE_LAUNCHER.c_str(), launchInfo.c_str(), 1)) {
JP_THROW(tstrings::any() << "setenv(" << _JPACKAGE_LAUNCHER
<< ", " << launchInfo << ") failed. Error: " << lastCRTError());
} else {
LOG_TRACE(tstrings::any() << "Set "
<< _JPACKAGE_LAUNCHER << "=[" << launchInfo << "]");
}
JP_CATCH_ALL;
appLauncher.launch();
}

View File

@ -35,6 +35,7 @@
AppLauncher::AppLauncher() {
setInitJvmFromCmdlineOnly(false);
launcherPath = SysInfo::getProcessModulePath();
args = SysInfo::getCommandArgs();
}
@ -116,8 +117,17 @@ Jvm* AppLauncher::createJvmLauncher() const {
(*jvm)
.setPath(findJvmLib(cfgFile, defaultRuntimePath, jvmLibNames))
.addArgument(launcherPath)
.initFromConfigFile(cfgFile);
.addArgument(launcherPath);
if (initJvmFromCmdlineOnly) {
tstring_array::const_iterator argIt = args.begin();
const tstring_array::const_iterator argEnd = args.end();
for (; argIt != argEnd; ++argIt) {
(*jvm).addArgument(*argIt);
}
} else {
(*jvm).initFromConfigFile(cfgFile);
}
return jvm.release();
}

View File

@ -51,6 +51,11 @@ public:
return *this;
}
AppLauncher& setInitJvmFromCmdlineOnly(bool v) {
initJvmFromCmdlineOnly = v;
return *this;
}
AppLauncher& addJvmLibName(const tstring& v) {
jvmLibNames.push_back(v);
return *this;
@ -78,6 +83,7 @@ private:
tstring appDirPath;
tstring imageRoot;
tstring_array jvmLibNames;
bool initJvmFromCmdlineOnly;
};
#endif // AppLauncher_h

View File

@ -1059,177 +1059,155 @@ public class Main {
boolean signerNotExpired = expireDate == null
|| expireDate.after(new Date());
if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
notYetValidCert || chainNotValidated || hasExpiredCert ||
hasUnsignedEntry || signerSelfSigned || (legacyAlg != 0) ||
(disabledAlg != 0) || aliasNotInStore || notSignedByAlias ||
tsaChainNotValidated ||
(hasExpiredTsaCert && !signerNotExpired)) {
if (strict) {
result = isSigning
? rb.getString("jar.signed.with.signer.errors.")
: rb.getString("jar.verified.with.signer.errors.");
} else {
result = isSigning
? rb.getString("jar.signed.")
: rb.getString("jar.verified.");
}
if (badKeyUsage) {
errors.add(isSigning
? rb.getString("The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing."));
}
if (badExtendedKeyUsage) {
errors.add(isSigning
? rb.getString("The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing."));
}
if (badNetscapeCertType) {
errors.add(isSigning
? rb.getString("The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing."));
}
// only in verifying
if (hasUnsignedEntry) {
errors.add(rb.getString(
"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked."));
}
if (hasExpiredCert) {
errors.add(isSigning
? rb.getString("The.signer.certificate.has.expired.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.has.expired."));
}
if (notYetValidCert) {
errors.add(isSigning
? rb.getString("The.signer.certificate.is.not.yet.valid.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid."));
}
if (chainNotValidated) {
errors.add(String.format(isSigning
? rb.getString("The.signer.s.certificate.chain.is.invalid.reason.1")
: rb.getString("This.jar.contains.entries.whose.certificate.chain.is.invalid.reason.1"),
chainNotValidatedReason.getLocalizedMessage()));
}
if (hasExpiredTsaCert) {
errors.add(rb.getString("The.timestamp.has.expired."));
}
if (tsaChainNotValidated) {
errors.add(String.format(isSigning
? rb.getString("The.tsa.certificate.chain.is.invalid.reason.1")
: rb.getString("This.jar.contains.entries.whose.tsa.certificate.chain.is.invalid.reason.1"),
tsaChainNotValidatedReason.getLocalizedMessage()));
}
// only in verifying
if (notSignedByAlias) {
errors.add(
rb.getString("This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es."));
}
// only in verifying
if (aliasNotInStore) {
errors.add(rb.getString("This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore."));
}
if (signerSelfSigned) {
errors.add(isSigning
? rb.getString("The.signer.s.certificate.is.self.signed.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.is.self.signed."));
}
if (isSigning) {
if ((legacyAlg & 1) == 1) {
warnings.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
digestalg, "-digestalg"));
}
if ((disabledAlg & 1) == 1) {
errors.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is.disabled."),
digestalg, "-digestalg"));
}
if ((legacyAlg & 2) == 2) {
warnings.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
sigalg, "-sigalg"));
}
if ((disabledAlg & 2) == 2) {
errors.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is.disabled."),
sigalg, "-sigalg"));
}
if ((legacyAlg & 4) == 4) {
warnings.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
tSADigestAlg, "-tsadigestalg"));
}
if ((disabledAlg & 4) == 4) {
errors.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is.disabled."),
tSADigestAlg, "-tsadigestalg"));
}
if ((legacyAlg & 8) == 8) {
warnings.add(String.format(
rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."),
privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey)));
}
if ((disabledAlg & 8) == 8) {
errors.add(String.format(
rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk.and.is.disabled."),
privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey)));
}
} else {
if ((legacyAlg & 1) != 0) {
warnings.add(String.format(
rb.getString("The.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
legacyDigestAlg));
}
if ((legacyAlg & 2) == 2) {
warnings.add(String.format(
rb.getString("The.signature.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
legacySigAlg));
}
if ((legacyAlg & 4) != 0) {
warnings.add(String.format(
rb.getString("The.timestamp.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
legacyTsaDigestAlg));
}
if ((legacyAlg & 8) == 8) {
warnings.add(String.format(
rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."),
weakPublicKey.getAlgorithm(), KeyUtil.getKeySize(weakPublicKey)));
}
}
} else {
result = isSigning ? rb.getString("jar.signed.") : rb.getString("jar.verified.");
if (badKeyUsage) {
errors.add(isSigning
? rb.getString("The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing."));
}
if (badExtendedKeyUsage) {
errors.add(isSigning
? rb.getString("The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing."));
}
if (badNetscapeCertType) {
errors.add(isSigning
? rb.getString("The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing."));
}
// only in verifying
if (hasUnsignedEntry) {
errors.add(rb.getString(
"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked."));
}
if (hasExpiredCert) {
errors.add(isSigning
? rb.getString("The.signer.certificate.has.expired.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.has.expired."));
}
if (notYetValidCert) {
errors.add(isSigning
? rb.getString("The.signer.certificate.is.not.yet.valid.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid."));
}
if (chainNotValidated) {
errors.add(String.format(isSigning
? rb.getString("The.signer.s.certificate.chain.is.invalid.reason.1")
: rb.getString("This.jar.contains.entries.whose.certificate.chain.is.invalid.reason.1"),
chainNotValidatedReason.getLocalizedMessage()));
}
if (tsaChainNotValidated) {
errors.add(String.format(isSigning
? rb.getString("The.tsa.certificate.chain.is.invalid.reason.1")
: rb.getString("This.jar.contains.entries.whose.tsa.certificate.chain.is.invalid.reason.1"),
tsaChainNotValidatedReason.getLocalizedMessage()));
}
// only in verifying
if (notSignedByAlias) {
errors.add(
rb.getString("This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es."));
}
// only in verifying
if (aliasNotInStore) {
errors.add(rb.getString("This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore."));
}
if (signerSelfSigned) {
errors.add(isSigning
? rb.getString("The.signer.s.certificate.is.self.signed.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.is.self.signed."));
}
if (isSigning) {
if ((legacyAlg & 1) == 1) {
warnings.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
digestalg, "-digestalg"));
}
if ((disabledAlg & 1) == 1) {
errors.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is.disabled."),
digestalg, "-digestalg"));
}
if ((legacyAlg & 2) == 2) {
warnings.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
sigalg, "-sigalg"));
}
if ((disabledAlg & 2) == 2) {
errors.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is.disabled."),
sigalg, "-sigalg"));
}
if ((legacyAlg & 4) == 4) {
warnings.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
tSADigestAlg, "-tsadigestalg"));
}
if ((disabledAlg & 4) == 4) {
errors.add(String.format(
rb.getString("The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is.disabled."),
tSADigestAlg, "-tsadigestalg"));
}
if ((legacyAlg & 8) == 8) {
warnings.add(String.format(
rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."),
privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey)));
}
if ((disabledAlg & 8) == 8) {
errors.add(String.format(
rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk.and.is.disabled."),
privateKey.getAlgorithm(), KeyUtil.getKeySize(privateKey)));
}
} else {
if ((legacyAlg & 1) != 0) {
warnings.add(String.format(
rb.getString("The.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
legacyDigestAlg));
}
if ((legacyAlg & 2) == 2) {
warnings.add(String.format(
rb.getString("The.signature.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
legacySigAlg));
}
if ((legacyAlg & 4) != 0) {
warnings.add(String.format(
rb.getString("The.timestamp.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update."),
legacyTsaDigestAlg));
}
if ((legacyAlg & 8) == 8) {
warnings.add(String.format(
rb.getString("The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk..This.key.size.will.be.disabled.in.a.future.update."),
weakPublicKey.getAlgorithm(), KeyUtil.getKeySize(weakPublicKey)));
}
}
// This check must be placed after all other "errors.add()" calls were done.
if (hasExpiredTsaCert) {
// No need to warn about expiring if already expired
hasExpiringTsaCert = false;
}
if (hasExpiringCert ||
(hasExpiringTsaCert && expireDate != null) ||
(noTimestamp && expireDate != null) ||
(hasExpiredTsaCert && signerNotExpired) ||
permsDetected) {
if (hasExpiredTsaCert && signerNotExpired) {
// If there are already another errors, we just say it expired.
if (!signerNotExpired || !errors.isEmpty()) {
errors.add(rb.getString("The.timestamp.has.expired."));
} else if (signerNotExpired) {
if (expireDate != null) {
warnings.add(String.format(
rb.getString("The.timestamp.expired.1.but.usable.2"),
@ -1239,37 +1217,51 @@ public class Main {
// Reset the flag so exit code is 0
hasExpiredTsaCert = false;
}
if (hasExpiringCert) {
warnings.add(isSigning
? rb.getString("The.signer.certificate.will.expire.within.six.months.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months."));
}
if (hasExpiringTsaCert && expireDate != null) {
if (expireDate.after(tsaExpireDate)) {
warnings.add(String.format(rb.getString(
"The.timestamp.will.expire.within.one.year.on.1.but.2"), tsaExpireDate, expireDate));
} else {
warnings.add(String.format(rb.getString(
"The.timestamp.will.expire.within.one.year.on.1"), tsaExpireDate));
}
}
if (noTimestamp && expireDate != null) {
if (hasTimestampBlock) {
warnings.add(String.format(isSigning
? rb.getString("invalid.timestamp.signing")
: rb.getString("bad.timestamp.verifying"), expireDate));
} else {
warnings.add(String.format(isSigning
? rb.getString("no.timestamp.signing")
: rb.getString("no.timestamp.verifying"), expireDate));
}
}
if (permsDetected) {
warnings.add(rb.getString("posix.attributes.detected"));
}
if (hasExpiringCert) {
warnings.add(isSigning
? rb.getString("The.signer.certificate.will.expire.within.six.months.")
: rb.getString("This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months."));
}
if (hasExpiringTsaCert && expireDate != null) {
if (expireDate.after(tsaExpireDate)) {
warnings.add(String.format(rb.getString(
"The.timestamp.will.expire.within.one.year.on.1.but.2"), tsaExpireDate, expireDate));
} else {
warnings.add(String.format(rb.getString(
"The.timestamp.will.expire.within.one.year.on.1"), tsaExpireDate));
}
}
if (noTimestamp && expireDate != null) {
if (hasTimestampBlock) {
warnings.add(String.format(isSigning
? rb.getString("invalid.timestamp.signing")
: rb.getString("bad.timestamp.verifying"), expireDate));
} else {
warnings.add(String.format(isSigning
? rb.getString("no.timestamp.signing")
: rb.getString("no.timestamp.verifying"), expireDate));
}
}
if (permsDetected) {
warnings.add(rb.getString("posix.attributes.detected"));
}
if ((strict) && (!errors.isEmpty())) {
result = isSigning
? rb.getString("jar.signed.with.signer.errors.")
: rb.getString("jar.verified.with.signer.errors.");
} else {
result = isSigning
? rb.getString("jar.signed.")
: rb.getString("jar.verified.");
}
System.out.println(result);
if (strict) {
if (!errors.isEmpty()) {
System.out.println();
@ -1289,6 +1281,7 @@ public class Main {
warnings.forEach(System.out::println);
}
}
if (!isSigning && (!errors.isEmpty() || !warnings.isEmpty())) {
if (! (verbose != null && showcerts)) {
System.out.println();

View File

@ -57,7 +57,7 @@ import sun.security.timestamp.TimestampToken;
/*
* @test
* @bug 6543842 6543440 6939248 8009636 8024302 8163304 8169911 8180289 8172404
* @bug 6543842 6543440 6939248 8009636 8024302 8163304 8169911 8180289 8172404 8247960
* @summary checking response of timestamp
* @modules java.base/sun.security.pkcs
* java.base/sun.security.timestamp
@ -293,23 +293,27 @@ public class TimestampCheck {
signVerbose(null, "unsigned.jar", "sha1alg.jar", "signer",
"-strict", "-digestalg", "SHA-1")
.shouldHaveExitValue(0)
.shouldContain("jar signed, with signer errors")
.shouldContain("jar signed")
.shouldNotContain("with signer errors")
.shouldMatch("SHA-1.*-digestalg.*will be disabled");
verify("sha1alg.jar", "-strict")
.shouldHaveExitValue(0)
.shouldContain("jar verified, with signer errors")
.shouldContain("jar verified")
.shouldNotContain("with signer errors")
.shouldContain("SHA-1 digest algorithm is considered a security risk")
.shouldContain("This algorithm will be disabled in a future update")
.shouldNotContain("is disabled");
sign("sha1tsaalg", "-tsadigestalg", "SHA-1", "-strict")
.shouldHaveExitValue(0)
.shouldContain("jar signed, with signer errors")
.shouldContain("jar signed")
.shouldNotContain("with signer errors")
.shouldMatch("SHA-1.*-tsadigestalg.*will be disabled")
.shouldNotContain("is disabled");
verify("sha1tsaalg.jar", "-strict")
.shouldHaveExitValue(0)
.shouldContain("jar verified, with signer errors")
.shouldContain("jar verified")
.shouldNotContain("with signer errors")
.shouldContain("SHA-1 timestamp digest algorithm is considered a security risk")
.shouldNotContain("is disabled");