Merge
This commit is contained in:
commit
e37cc00a49
jdk
src
java.base/share
java.management/share/classes/sun/management
java.naming/share/classes/javax/naming
jdk.attach/share/classes
jdk.internal.jvmstat/share/classes
module-info.java
sun/jvmstat
monitor
AbstractMonitor.javaBufferedMonitoredVm.javaByteArrayMonitor.javaHostIdentifier.javaIntegerMonitor.javaLongMonitor.javaMonitor.javaMonitorException.javaMonitoredHost.javaMonitoredHostService.javaMonitoredVm.javaMonitoredVmUtil.javaStringMonitor.javaUnits.javaVariability.javaVmIdentifier.java
event
HostEvent.javaHostListener.javaMonitorStatusChangeEvent.javaVmEvent.javaVmListener.javaVmStatusChangeEvent.javapackage.html
package.htmlperfdata
monitor
AbstractMonitoredVm.javaAbstractPerfDataBuffer.javaAbstractPerfDataBufferPrologue.javaAliasFileParser.javaCountedTimerTask.javaCountedTimerTaskUtils.javaMonitorDataException.javaMonitorStatus.javaMonitorStructureException.javaMonitorTypeException.javaMonitorVersionException.javaPerfByteArrayMonitor.javaPerfDataBufferImpl.javaPerfIntegerMonitor.javaPerfLongMonitor.javaPerfStringConstantMonitor.javaPerfStringMonitor.javaPerfStringVariableMonitor.javaSyntaxException.javapackage.html
protocol
file
FileMonitoredVm.javaMonitoredHostFileService.javaMonitoredHostProvider.javaPerfDataBuffer.javapackage.html
local
v1_0
v2_0
resources
jdk.jcmd/share/classes
jdk.jconsole/share/classes
jdk.jstatd/share/classes
test
ProblemList.txt
com/sun/jdi
java/lang/invoke/LFCaching
lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292
sun
jvmstat
monitor
HostIdentifier
MonitoredVm
VmIdentifier
perfdata/PrologSanity
management/jdp
tools/launcher
@ -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
|
||||
@ -458,7 +458,7 @@ public final class Layer {
|
||||
loader.initRemotePackageMap(cf, parents);
|
||||
Layer layer = new Layer(cf, parents, mn -> loader);
|
||||
return new Controller(layer);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException | IllegalStateException e) {
|
||||
throw new LayerInstantiationException(e.getMessage());
|
||||
}
|
||||
}
|
||||
@ -526,7 +526,7 @@ public final class Layer {
|
||||
try {
|
||||
Layer layer = new Layer(cf, parents, pool::loaderFor);
|
||||
return new Controller(layer);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException | IllegalStateException e) {
|
||||
throw new LayerInstantiationException(e.getMessage());
|
||||
}
|
||||
}
|
||||
@ -610,9 +610,8 @@ public final class Layer {
|
||||
try {
|
||||
Layer layer = new Layer(cf, parents, clf);
|
||||
return new Controller(layer);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// IAE is thrown by VM when defining the module fails
|
||||
throw new LayerInstantiationException(iae.getMessage());
|
||||
} catch (IllegalArgumentException | IllegalStateException e) {
|
||||
throw new LayerInstantiationException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,14 +128,8 @@ public final class Module implements AnnotatedElement {
|
||||
Version version = descriptor.version().orElse(null);
|
||||
String vs = Objects.toString(version, null);
|
||||
String loc = Objects.toString(uri, null);
|
||||
Set<String> packages = descriptor.packages();
|
||||
int n = packages.size();
|
||||
String[] array = new String[n];
|
||||
int i = 0;
|
||||
for (String pn : packages) {
|
||||
array[i++] = pn.replace('.', '/');
|
||||
}
|
||||
defineModule0(this, isOpen, vs, loc, array);
|
||||
String[] packages = descriptor.packages().toArray(new String[0]);
|
||||
defineModule0(this, isOpen, vs, loc, packages);
|
||||
}
|
||||
|
||||
|
||||
@ -789,13 +783,12 @@ public final class Module implements AnnotatedElement {
|
||||
|
||||
// update VM first, just in case it fails
|
||||
if (syncVM) {
|
||||
String pkgInternalForm = pn.replace('.', '/');
|
||||
if (other == EVERYONE_MODULE) {
|
||||
addExportsToAll0(this, pkgInternalForm);
|
||||
addExportsToAll0(this, pn);
|
||||
} else if (other == ALL_UNNAMED_MODULE) {
|
||||
addExportsToAllUnnamed0(this, pkgInternalForm);
|
||||
addExportsToAllUnnamed0(this, pn);
|
||||
} else {
|
||||
addExports0(this, pkgInternalForm, other);
|
||||
addExports0(this, pn, other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1021,7 +1014,7 @@ public final class Module implements AnnotatedElement {
|
||||
|
||||
// update VM first, just in case it fails
|
||||
if (syncVM)
|
||||
addPackage0(this, pn.replace('.', '/'));
|
||||
addPackage0(this, pn);
|
||||
|
||||
// replace with new set
|
||||
this.extraPackages = extraPackages; // volatile write
|
||||
@ -1180,8 +1173,7 @@ public final class Module implements AnnotatedElement {
|
||||
if (descriptor.isOpen()) {
|
||||
assert descriptor.opens().isEmpty();
|
||||
for (String source : descriptor.packages()) {
|
||||
String sourceInternalForm = source.replace('.', '/');
|
||||
addExportsToAll0(m, sourceInternalForm);
|
||||
addExportsToAll0(m, source);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1192,7 +1184,6 @@ public final class Module implements AnnotatedElement {
|
||||
// process the open packages first
|
||||
for (Opens opens : descriptor.opens()) {
|
||||
String source = opens.source();
|
||||
String sourceInternalForm = source.replace('.', '/');
|
||||
|
||||
if (opens.isQualified()) {
|
||||
// qualified opens
|
||||
@ -1201,7 +1192,7 @@ public final class Module implements AnnotatedElement {
|
||||
// only open to modules that are in this configuration
|
||||
Module m2 = nameToModule.get(target);
|
||||
if (m2 != null) {
|
||||
addExports0(m, sourceInternalForm, m2);
|
||||
addExports0(m, source, m2);
|
||||
targets.add(m2);
|
||||
}
|
||||
}
|
||||
@ -1210,7 +1201,7 @@ public final class Module implements AnnotatedElement {
|
||||
}
|
||||
} else {
|
||||
// unqualified opens
|
||||
addExportsToAll0(m, sourceInternalForm);
|
||||
addExportsToAll0(m, source);
|
||||
openPackages.put(source, EVERYONE_SET);
|
||||
}
|
||||
}
|
||||
@ -1218,7 +1209,6 @@ public final class Module implements AnnotatedElement {
|
||||
// next the exports, skipping exports when the package is open
|
||||
for (Exports exports : descriptor.exports()) {
|
||||
String source = exports.source();
|
||||
String sourceInternalForm = source.replace('.', '/');
|
||||
|
||||
// skip export if package is already open to everyone
|
||||
Set<Module> openToTargets = openPackages.get(source);
|
||||
@ -1234,7 +1224,7 @@ public final class Module implements AnnotatedElement {
|
||||
if (m2 != null) {
|
||||
// skip qualified export if already open to m2
|
||||
if (openToTargets == null || !openToTargets.contains(m2)) {
|
||||
addExports0(m, sourceInternalForm, m2);
|
||||
addExports0(m, source, m2);
|
||||
targets.add(m2);
|
||||
}
|
||||
}
|
||||
@ -1245,7 +1235,7 @@ public final class Module implements AnnotatedElement {
|
||||
|
||||
} else {
|
||||
// unqualified exports
|
||||
addExportsToAll0(m, sourceInternalForm);
|
||||
addExportsToAll0(m, source);
|
||||
exportedPackages.put(source, EVERYONE_SET);
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ module java.base {
|
||||
exports jdk.internal.perf to
|
||||
java.desktop,
|
||||
java.management,
|
||||
jdk.jvmstat;
|
||||
jdk.internal.jvmstat;
|
||||
exports jdk.internal.ref to
|
||||
java.desktop,
|
||||
jdk.unsupported;
|
||||
@ -197,7 +197,7 @@ module java.base {
|
||||
jdk.jlink;
|
||||
exports jdk.internal.vm to
|
||||
java.management,
|
||||
jdk.jvmstat;
|
||||
jdk.internal.jvmstat;
|
||||
exports sun.net to
|
||||
jdk.incubator.httpclient;
|
||||
exports sun.net.ext to
|
||||
|
@ -401,30 +401,67 @@ JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
|
||||
* Module support funcions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define a module with the specified packages and bind the module to the
|
||||
* given class loader.
|
||||
* module: module to define
|
||||
* is_open: specifies if module is open (currently ignored)
|
||||
* version: the module version
|
||||
* location: the module location
|
||||
* packages: list of packages in the module
|
||||
* num_packages: number of packages in the module
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version,
|
||||
jstring location, jobjectArray packages);
|
||||
jstring location, const char* const* packages, jsize num_packages);
|
||||
|
||||
/*
|
||||
* Set the boot loader's unnamed module.
|
||||
* module: boot loader's unnamed module
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module);
|
||||
|
||||
/*
|
||||
* Do a qualified export of a package.
|
||||
* from_module: module containing the package to export
|
||||
* package: name of the package to export
|
||||
* to_module: module to export the package to
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject to_module);
|
||||
JVM_AddModuleExports(JNIEnv *env, jobject from_module, const char* package, jobject to_module);
|
||||
|
||||
/*
|
||||
* Do an export of a package to all unnamed modules.
|
||||
* from_module: module containing the package to export
|
||||
* package: name of the package to export to all unnamed modules
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_AddModuleExports(JNIEnv *env, jobject from_module, jstring package, jobject to_module);
|
||||
JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, const char* package);
|
||||
|
||||
/*
|
||||
* Do an unqualified export of a package.
|
||||
* from_module: module containing the package to export
|
||||
* package: name of the package to export
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, jstring package);
|
||||
JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, const char* package);
|
||||
|
||||
/*
|
||||
* Add a module to the list of modules that a given module can read.
|
||||
* from_module: module requesting read access
|
||||
* source_module: module that from_module wants to read
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, jstring package);
|
||||
JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module);
|
||||
|
||||
/*
|
||||
* Add a package to a module.
|
||||
* module: module that will contain the package
|
||||
* package: package to add to the module
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
JVM_AddModulePackage(JNIEnv* env, jobject module, jstring package);
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
JVM_GetModuleByPackageName(JNIEnv *env, jobject cl, jstring pkg);
|
||||
JVM_AddModulePackage(JNIEnv* env, jobject module, const char* package);
|
||||
|
||||
/*
|
||||
* Reflection support functions
|
||||
|
@ -22,18 +22,88 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni_util.h"
|
||||
#include "jvm.h"
|
||||
|
||||
#include "java_lang_reflect_Module.h"
|
||||
|
||||
/*
|
||||
* Gets the UTF-8 chars for the string and translates '.' to '/'. Does no
|
||||
* further validation, assumption being that both calling code in
|
||||
* java.lang.reflect.Module and VM will do deeper validation.
|
||||
*/
|
||||
static char*
|
||||
GetInternalPackageName(JNIEnv *env, jstring pkg, char* buf, jsize buf_size)
|
||||
{
|
||||
jsize len;
|
||||
jsize unicode_len;
|
||||
char* p;
|
||||
char* utf_str;
|
||||
|
||||
len = (*env)->GetStringUTFLength(env, pkg);
|
||||
unicode_len = (*env)->GetStringLength(env, pkg);
|
||||
if (len >= buf_size) {
|
||||
utf_str = malloc(len + 1);
|
||||
if (utf_str == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
utf_str = buf;
|
||||
}
|
||||
(*env)->GetStringUTFRegion(env, pkg, 0, unicode_len, utf_str);
|
||||
|
||||
p = utf_str;
|
||||
while (*p != '\0') {
|
||||
if (*p == '.') {
|
||||
*p = '/';
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return utf_str;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_lang_reflect_Module_defineModule0(JNIEnv *env, jclass cls, jobject module,
|
||||
jboolean is_open, jstring version,
|
||||
jstring location, jobjectArray packages)
|
||||
{
|
||||
JVM_DefineModule(env, module, is_open, version, location, packages);
|
||||
char** pkgs = NULL;
|
||||
jsize idx;
|
||||
jsize num_packages = (*env)->GetArrayLength(env, packages);
|
||||
|
||||
if (num_packages != 0 && (pkgs = calloc(num_packages, sizeof(char*))) == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||
return;
|
||||
} else {
|
||||
int valid = 1;
|
||||
for (idx = 0; idx < num_packages; idx++) {
|
||||
jstring pkg = (*env)->GetObjectArrayElement(env, packages, idx);
|
||||
pkgs[idx] = GetInternalPackageName(env, pkg, NULL, 0);
|
||||
if (pkgs[idx] == NULL) {
|
||||
valid = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid != 0) {
|
||||
JVM_DefineModule(env, module, is_open, version, location,
|
||||
(const char* const*)pkgs, num_packages);
|
||||
}
|
||||
}
|
||||
|
||||
if (num_packages > 0) {
|
||||
for (idx = 0; idx < num_packages; idx++) {
|
||||
if (pkgs[idx] != NULL) {
|
||||
free(pkgs[idx]);
|
||||
}
|
||||
}
|
||||
free(pkgs);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
@ -46,25 +116,81 @@ JNIEXPORT void JNICALL
|
||||
Java_java_lang_reflect_Module_addExports0(JNIEnv *env, jclass cls, jobject from,
|
||||
jstring pkg, jobject to)
|
||||
{
|
||||
JVM_AddModuleExports(env, from, pkg, to);
|
||||
char buf[128];
|
||||
char* pkg_name;
|
||||
|
||||
if (pkg == NULL) {
|
||||
JNU_ThrowNullPointerException(env, "package is null");
|
||||
return;
|
||||
}
|
||||
|
||||
pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
|
||||
if (pkg_name != NULL) {
|
||||
JVM_AddModuleExports(env, from, pkg_name, to);
|
||||
if (pkg_name != buf) {
|
||||
free(pkg_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_lang_reflect_Module_addExportsToAll0(JNIEnv *env, jclass cls, jobject from,
|
||||
jstring pkg)
|
||||
{
|
||||
JVM_AddModuleExportsToAll(env, from, pkg);
|
||||
char buf[128];
|
||||
char* pkg_name;
|
||||
|
||||
if (pkg == NULL) {
|
||||
JNU_ThrowNullPointerException(env, "package is null");
|
||||
return;
|
||||
}
|
||||
|
||||
pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
|
||||
if (pkg_name != NULL) {
|
||||
JVM_AddModuleExportsToAll(env, from, pkg_name);
|
||||
if (pkg_name != buf) {
|
||||
free(pkg_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_lang_reflect_Module_addExportsToAllUnnamed0(JNIEnv *env, jclass cls,
|
||||
jobject from, jstring pkg)
|
||||
{
|
||||
JVM_AddModuleExportsToAllUnnamed(env, from, pkg);
|
||||
char buf[128];
|
||||
char* pkg_name;
|
||||
|
||||
if (pkg == NULL) {
|
||||
JNU_ThrowNullPointerException(env, "package is null");
|
||||
return;
|
||||
}
|
||||
|
||||
pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
|
||||
if (pkg_name != NULL) {
|
||||
JVM_AddModuleExportsToAllUnnamed(env, from, pkg_name);
|
||||
if (pkg_name != buf) {
|
||||
free(pkg_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_lang_reflect_Module_addPackage0(JNIEnv *env, jclass cls, jobject m, jstring pkg)
|
||||
{
|
||||
JVM_AddModulePackage(env, m, pkg);
|
||||
char buf[128];
|
||||
char* pkg_name;
|
||||
|
||||
if (pkg == NULL) {
|
||||
JNU_ThrowNullPointerException(env, "package is null");
|
||||
return;
|
||||
}
|
||||
|
||||
pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
|
||||
if (pkg_name != NULL) {
|
||||
JVM_AddModulePackage(env, m, pkg_name);
|
||||
if (pkg_name != buf) {
|
||||
free(pkg_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@ -502,19 +502,9 @@ public class Agent {
|
||||
}
|
||||
}
|
||||
|
||||
// Rebuilding service URL to broadcast it
|
||||
String jmxremotePort = props.getProperty(JMXREMOTE_PORT);
|
||||
String rmiPort = props.getProperty(RMI_PORT);
|
||||
|
||||
JMXServiceURL url = jmxServer.getAddress();
|
||||
String hostname = url.getHost();
|
||||
|
||||
String jmxUrlStr = (rmiPort != null)
|
||||
? String.format(
|
||||
"service:jmx:rmi://%s:%s/jndi/rmi://%s:%s/jmxrmi",
|
||||
hostname, rmiPort, hostname, jmxremotePort)
|
||||
: String.format(
|
||||
"service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmi", hostname, jmxremotePort);
|
||||
// Get service URL to broadcast it
|
||||
Map<String,String> remoteProps = ConnectorAddressLink.importRemoteFrom(0);
|
||||
String jmxUrlStr = remoteProps.get("sun.management.JMXConnectorServer.0.remoteAddress");
|
||||
|
||||
String instanceName = props.getProperty("com.sun.management.jdp.name");
|
||||
|
||||
|
@ -149,11 +149,10 @@ import java.util.Properties;
|
||||
public class CompoundName implements Name {
|
||||
|
||||
/**
|
||||
* Implementation of this compound name.
|
||||
* This field is initialized by the constructors and cannot be null.
|
||||
* It should be treated as a read-only variable by subclasses.
|
||||
*/
|
||||
protected transient NameImpl impl;
|
||||
* Implementation of this compound name. This field is initialized by the
|
||||
* constructors and cannot be null.
|
||||
*/
|
||||
private transient NameImpl impl;
|
||||
/**
|
||||
* Syntax properties for this compound name.
|
||||
* This field is initialized by the constructors and cannot be null.
|
||||
|
@ -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
|
||||
@ -27,7 +27,7 @@
|
||||
* Defines the attach API.
|
||||
*/
|
||||
module jdk.attach {
|
||||
requires jdk.jvmstat;
|
||||
requires jdk.internal.jvmstat;
|
||||
|
||||
exports com.sun.tools.attach;
|
||||
exports com.sun.tools.attach.spi;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module jdk.jvmstat {
|
||||
module jdk.internal.jvmstat {
|
||||
exports sun.jvmstat.monitor to
|
||||
jdk.attach,
|
||||
jdk.jcmd,
|
@ -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
|
||||
@ -25,5 +25,5 @@
|
||||
|
||||
module jdk.jcmd {
|
||||
requires jdk.attach;
|
||||
requires jdk.jvmstat;
|
||||
requires jdk.internal.jvmstat;
|
||||
}
|
||||
|
@ -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
|
||||
@ -29,7 +29,7 @@ module jdk.jconsole {
|
||||
requires java.logging;
|
||||
requires java.rmi;
|
||||
requires jdk.attach;
|
||||
requires jdk.jvmstat;
|
||||
requires jdk.internal.jvmstat;
|
||||
requires jdk.management;
|
||||
exports com.sun.tools.jconsole;
|
||||
uses com.sun.tools.jconsole.JConsolePlugin;
|
||||
|
@ -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
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
module jdk.jstatd {
|
||||
requires java.rmi;
|
||||
requires jdk.jvmstat;
|
||||
requires jdk.internal.jvmstat;
|
||||
|
||||
// RMI needs to serialize types in this package
|
||||
exports sun.jvmstat.monitor.remote to java.rmi;
|
||||
|
@ -148,8 +148,6 @@ java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-
|
||||
com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java 8030957 aix-all
|
||||
com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java 8030957 aix-all
|
||||
|
||||
com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java 8169575 generic-all
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_jmx
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright (c) 2002, 2014, 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
|
||||
@ -276,10 +276,10 @@ setup()
|
||||
# treat them as control chars on mks (eg \t is tab)
|
||||
# Oops; windows mks really seems to want this cat line
|
||||
# to start in column 1
|
||||
if [ -w "$SystemRoot" ] ; then
|
||||
tmpFile=$SystemRoot/tmp.$$
|
||||
elif [ -w "$SYSTEMROOT" ] ; then
|
||||
tmpFile=$SYSTEMROOT/tmp.$$
|
||||
if [ -w "$Temp" ] ; then
|
||||
tmpFile=$Temp/tmp.$$
|
||||
elif [ -w "$TEMP" ] ; then
|
||||
tmpFile=$TEMP/tmp.$$
|
||||
else
|
||||
tmpFile=tmp.$$
|
||||
fi
|
||||
|
@ -141,16 +141,6 @@ public abstract class LambdaFormTestCase {
|
||||
doneIterations++;
|
||||
return true;
|
||||
}
|
||||
|
||||
void checkPassed() {
|
||||
if (!passed) {
|
||||
throw new Error(String.format("%d of %d test cases FAILED! %n"
|
||||
+ "Rerun the test with the same \"-Dseed=\" option as in the log file!",
|
||||
failCounter, testCounter));
|
||||
} else {
|
||||
System.err.printf("All %d test cases PASSED!%n", testCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -195,6 +185,12 @@ public abstract class LambdaFormTestCase {
|
||||
System.err.println("FAILED");
|
||||
throw new Error("Unexpected error!", ex);
|
||||
}
|
||||
run.checkPassed();
|
||||
if (!run.passed) {
|
||||
throw new Error(String.format("%d of %d test cases FAILED! %n"
|
||||
+ "Rerun the test with the same \"-Dseed=\" option as in the log file!",
|
||||
run.failCounter, run.testCounter));
|
||||
} else {
|
||||
System.err.printf("All %d test cases PASSED!%n", run.testCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ public class CodeCacheOverflowProcessor {
|
||||
if (t != null) {
|
||||
System.err.printf("%nNon-critical exception caught becuse of"
|
||||
+ " code cache size is not enough to run all test cases.%n%n");
|
||||
t.printStackTrace();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, 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
|
||||
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4990825
|
||||
* @modules jdk.jvmstat/sun.jvmstat.monitor
|
||||
* @modules jdk.internal.jvmstat/sun.jvmstat.monitor
|
||||
* @summary test that HostIdentifier objects get created as expected
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, 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
|
||||
@ -68,8 +68,8 @@ import sun.jvmstat.monitor.event.VmStatusChangeEvent;
|
||||
* @summary attach to external but local JVM processes
|
||||
* @library /lib/testlibrary
|
||||
* @modules java.management
|
||||
* jdk.jvmstat/sun.jvmstat.monitor
|
||||
* jdk.jvmstat/sun.jvmstat.monitor.event
|
||||
* jdk.internal.jvmstat/sun.jvmstat.monitor
|
||||
* jdk.internal.jvmstat/sun.jvmstat.monitor.event
|
||||
* @build jdk.testlibrary.*
|
||||
* @run main/othervm MonitorVmStartTerminate
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2016, 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
|
||||
@ -40,7 +40,7 @@ import sun.jvmstat.monitor.VmIdentifier;
|
||||
* @test
|
||||
* @bug 6672135
|
||||
* @summary setInterval() for local MonitoredHost and local MonitoredVm
|
||||
* @modules jdk.jvmstat/sun.jvmstat.monitor
|
||||
* @modules jdk.internal.jvmstat/sun.jvmstat.monitor
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @build jdk.testlibrary.*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, 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
|
||||
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4990825
|
||||
* @modules jdk.jvmstat/sun.jvmstat.monitor
|
||||
* @modules jdk.internal.jvmstat/sun.jvmstat.monitor
|
||||
* @summary test that VmIdentifier objects get created as expected
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, 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
|
||||
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4990825
|
||||
* @modules jdk.jvmstat/sun.jvmstat.monitor
|
||||
* @modules jdk.internal.jvmstat/sun.jvmstat.monitor
|
||||
* @run main/othervm -XX:+UsePerfData PrologSizeSanityCheck
|
||||
* @summary prolog size and overflow sanity checks
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, 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
|
||||
@ -38,19 +38,19 @@ import java.util.UUID;
|
||||
public abstract class DynamicLauncher {
|
||||
|
||||
final String jdpName = UUID.randomUUID().toString();
|
||||
OutputAnalyzer output;
|
||||
int jmxPort;
|
||||
|
||||
protected void run() throws Exception {
|
||||
OutputAnalyzer out;
|
||||
int retries = 1;
|
||||
boolean tryAgain;
|
||||
|
||||
do {
|
||||
tryAgain = false;
|
||||
jmxPort = Utils.getFreePort();
|
||||
out = runVM();
|
||||
output = runVM();
|
||||
try {
|
||||
out.shouldNotContain("Port already in use");
|
||||
output.shouldNotContain("Port already in use");
|
||||
} catch (RuntimeException e) {
|
||||
if (retries < 3) {
|
||||
retries++;
|
||||
@ -71,4 +71,7 @@ public abstract class DynamicLauncher {
|
||||
|
||||
protected abstract String[] options();
|
||||
|
||||
protected OutputAnalyzer getProcessOutpoutAnalyzer() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
60
jdk/test/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java
Normal file
60
jdk/test/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 JdpJmxRemoteDynamicPortTest.java
|
||||
* @bug 8167337
|
||||
* @summary Verify a non-zero value is assigned to jmxremote.port
|
||||
* when VM is started with jmxremote.port=0.
|
||||
* @library /lib/testlibrary
|
||||
* @modules java.management/sun.management.jdp
|
||||
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpJmxRemoteDynamicPortTestCase DynamicLauncher
|
||||
* @run main JdpJmxRemoteDynamicPortTest
|
||||
*/
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
public class JdpJmxRemoteDynamicPortTest extends DynamicLauncher {
|
||||
final String testName = "JdpJmxRemoteDynamicPortTestCase";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
DynamicLauncher launcher = new JdpJmxRemoteDynamicPortTest();
|
||||
launcher.run();
|
||||
launcher.getProcessOutpoutAnalyzer().stderrShouldNotContain("java.lang.Exception:");
|
||||
}
|
||||
|
||||
protected String[] options() {
|
||||
String[] options = {
|
||||
"-Dcom.sun.management.jmxremote.authenticate=false",
|
||||
"-Dcom.sun.management.jmxremote.ssl=false",
|
||||
"-Dcom.sun.management.jmxremote=true",
|
||||
"-Dcom.sun.management.jmxremote.port=0",
|
||||
"-Dcom.sun.management.jmxremote.autodiscovery=true",
|
||||
"-Dcom.sun.management.jdp.pause=1",
|
||||
"-Dcom.sun.management.jdp.name=" + jdpName,
|
||||
"-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'",
|
||||
testName
|
||||
};
|
||||
return options;
|
||||
}
|
||||
}
|
106
jdk/test/sun/management/jdp/JdpJmxRemoteDynamicPortTestCase.java
Normal file
106
jdk/test/sun/management/jdp/JdpJmxRemoteDynamicPortTestCase.java
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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.net.SocketTimeoutException;
|
||||
import java.util.Map;
|
||||
|
||||
public class JdpJmxRemoteDynamicPortTestCase extends JdpTestCase {
|
||||
|
||||
private int receivedJDPpackets = 0;
|
||||
|
||||
public JdpJmxRemoteDynamicPortTestCase(ClientConnection connection) {
|
||||
super(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String initialLogMessage() {
|
||||
return "Starting test case JdpJmxRemoteDynamicPortTestCase";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is executed after a correct Jdp packet (coming from this VM) has been received.
|
||||
*
|
||||
* @param payload A dictionary containing the Jdp packet data.
|
||||
*/
|
||||
protected void packetFromThisVMReceived(Map<String, String> payload) throws Exception {
|
||||
receivedJDPpackets++;
|
||||
final String jmxServiceurl = payload.get("JMX_SERVICE_URL");
|
||||
int lastcolon = jmxServiceurl.lastIndexOf(':');
|
||||
int nextslash = jmxServiceurl.indexOf('/', lastcolon);
|
||||
int jmxRemotePort = Integer.parseInt(jmxServiceurl, lastcolon + 1, nextslash, 10);
|
||||
|
||||
log.fine("Received #" + String.valueOf(receivedJDPpackets) +
|
||||
", jmxStringUrl=" + jmxServiceurl + ", jmxRemotePort=" + jmxRemotePort);
|
||||
|
||||
if (0 == jmxRemotePort) {
|
||||
throw new Exception("JmxRemotePort value is zero. Test case failed.");
|
||||
}
|
||||
|
||||
log.fine("Test case passed");
|
||||
}
|
||||
|
||||
/**
|
||||
* The socket should not timeout.
|
||||
* It is set to wait for 10 times the defined pause between Jdp packet. See JdpOnTestCase.TIME_OUT_FACTOR.
|
||||
*/
|
||||
@Override
|
||||
protected void onSocketTimeOut(SocketTimeoutException e) throws Exception {
|
||||
String message = "Timed out waiting for JDP packet. Should arrive within " +
|
||||
connection.pauseInSeconds + " seconds, but waited for " +
|
||||
timeOut + " seconds.";
|
||||
log.severe(message);
|
||||
throw new Exception(message, e);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* After receiving one Jdp packets the test should end.
|
||||
*/
|
||||
@Override
|
||||
protected boolean shouldContinue() {
|
||||
return receivedJDPpackets < 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* To run this test manually you might need the following VM options:
|
||||
* <p/>
|
||||
* -Dcom.sun.management.jmxremote.authenticate=false
|
||||
* -Dcom.sun.management.jmxremote.ssl=false
|
||||
* -Dcom.sun.management.jmxremote.port=0
|
||||
* -Dcom.sun.management.jmxremote=true
|
||||
* -Dcom.sun.management.jmxremote.autodiscovery=true
|
||||
* -Dcom.sun.management.jdp.pause=1
|
||||
* -Dcom.sun.management.jdp.name=alex (or some other string to identify this VM)
|
||||
* <p/>
|
||||
* Recommended for nice output:
|
||||
* -Djava.util.logging.SimpleFormatter.format="%1$tF %1$tT %4$-7s %5$s %n"
|
||||
*
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
JdpTestCase client = new JdpJmxRemoteDynamicPortTestCase(new ClientConnection());
|
||||
client.run();
|
||||
}
|
||||
|
||||
}
|
@ -36,6 +36,8 @@ import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class VersionCheck extends TestHelper {
|
||||
|
||||
@ -146,31 +148,44 @@ public class VersionCheck extends TestHelper {
|
||||
}
|
||||
|
||||
/*
|
||||
* this tests if the tool can take a version string and returns
|
||||
* a 0 exit code, it is not possible to validate the contents
|
||||
* of the -version output as they are inconsistent.
|
||||
* Checks if the tools accept "-version" option (exit code is zero).
|
||||
* The output of the tools run with "-version" is not verified.
|
||||
*/
|
||||
static boolean testToolVersion() {
|
||||
TestHelper.testExitValue = 0;
|
||||
static String testToolVersion() {
|
||||
System.out.println("=== testToolVersion === ");
|
||||
Set<String> failed = new HashSet<>();
|
||||
for (File f : new File(JAVA_BIN).listFiles(new ToolFilter(BLACKLIST_VERSION))) {
|
||||
String x = f.getAbsolutePath();
|
||||
System.out.println("Testing (-version): " + x);
|
||||
TestResult tr = doExec(x, "-version");
|
||||
tr.checkPositive();
|
||||
System.out.println("Testing " + f.getName());
|
||||
System.out.println("#> " + x + " -version");
|
||||
tr.testOutput.forEach(System.out::println);
|
||||
System.out.println("#> echo $?");
|
||||
System.out.println(tr.exitValue);
|
||||
if (!tr.isOK()) {
|
||||
System.out.println("failed");
|
||||
failed.add(f.getName());
|
||||
}
|
||||
}
|
||||
return TestHelper.testExitValue == 0;
|
||||
if (failed.isEmpty()) {
|
||||
System.out.println("testToolVersion passed");
|
||||
return "";
|
||||
} else {
|
||||
System.out.println("testToolVersion failed");
|
||||
return "testToolVersion: " + failed + "; ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static boolean compareJVersionStrings() {
|
||||
int failcount = 0;
|
||||
static String testJVersionStrings() {
|
||||
System.out.println("=== testJVersionStrings === ");
|
||||
Set<String> failed = new HashSet<>();
|
||||
for (File f : new File(JAVA_BIN).listFiles(new ToolFilter(BLACKLIST_JOPTION))) {
|
||||
System.out.println("Testing " + f.getName());
|
||||
String x = f.getAbsolutePath();
|
||||
System.out.println("Testing (-J-version): " + x);
|
||||
String testStr;
|
||||
|
||||
testStr = getVersion(x, "-J-version");
|
||||
String testStr = getVersion(x, "-J-version");
|
||||
if (refVersion.compareTo(testStr) != 0) {
|
||||
failcount++;
|
||||
failed.add(f.getName());
|
||||
System.out.println("Error: " + x +
|
||||
" fails -J-version comparison");
|
||||
System.out.println("Expected:");
|
||||
@ -181,7 +196,7 @@ public class VersionCheck extends TestHelper {
|
||||
|
||||
testStr = getVersion(x, "-J-fullversion");
|
||||
if (refFullVersion.compareTo(testStr) != 0) {
|
||||
failcount++;
|
||||
failed.add(f.getName());
|
||||
System.out.println("Error: " + x +
|
||||
" fails -J-fullversion comparison");
|
||||
System.out.println("Expected:");
|
||||
@ -190,12 +205,17 @@ public class VersionCheck extends TestHelper {
|
||||
System.out.print(testStr);
|
||||
}
|
||||
}
|
||||
System.out.println("Version Test: " + failcount);
|
||||
return failcount == 0;
|
||||
if (failed.isEmpty()) {
|
||||
System.out.println("testJVersionStrings passed");
|
||||
return "";
|
||||
} else {
|
||||
System.out.println("testJVersionStrings failed");
|
||||
return "testJVersionStrings: " + failed + "; ";
|
||||
}
|
||||
}
|
||||
|
||||
static boolean compareInternalStrings() {
|
||||
int failcount = 0;
|
||||
static String testInternalStrings() {
|
||||
System.out.println("=== testInternalStrings === ");
|
||||
String bStr = refVersion.substring(refVersion.indexOf("build") +
|
||||
"build".length() + 1,
|
||||
refVersion.lastIndexOf(")"));
|
||||
@ -206,20 +226,21 @@ public class VersionCheck extends TestHelper {
|
||||
envMap.put(TestHelper.JLDEBUG_KEY, "true");
|
||||
TestHelper.TestResult tr = doExec(envMap, javaCmd, "-version");
|
||||
List<String> alist = new ArrayList<>();
|
||||
alist.addAll(tr.testOutput);
|
||||
for (String x : tr.testOutput) {
|
||||
alist.add(x.trim());
|
||||
}
|
||||
tr.testOutput.stream().map(String::trim).forEach(alist::add);
|
||||
|
||||
if (!alist.contains(expectedFullVersion)) {
|
||||
if (alist.contains(expectedFullVersion)) {
|
||||
System.out.println("testInternalStrings passed");
|
||||
return "";
|
||||
} else {
|
||||
System.out.println("Error: could not find " + expectedFullVersion);
|
||||
failcount++;
|
||||
tr.testOutput.forEach(System.out::println);
|
||||
System.out.println("testInternalStrings failed");
|
||||
return "testInternalStrings; ";
|
||||
}
|
||||
System.out.println("Internal Strings Test: " + failcount);
|
||||
return failcount == 0;
|
||||
}
|
||||
|
||||
static boolean testDebugVersion() {
|
||||
static String testDebugVersion() {
|
||||
System.out.println("=== testInternalStrings === ");
|
||||
String jdkType = System.getProperty("jdk.debug", "release");
|
||||
String versionLines = getAllVersionLines(javaCmd, "-version");
|
||||
if ("release".equals(jdkType)) {
|
||||
@ -227,18 +248,23 @@ public class VersionCheck extends TestHelper {
|
||||
} else {
|
||||
jdkType = jdkType + " ";
|
||||
}
|
||||
|
||||
String tofind = "(" + jdkType + "build";
|
||||
|
||||
int idx = versionLines.indexOf(tofind);
|
||||
if (idx < 0) {
|
||||
System.out.println("versionLines " + versionLines);
|
||||
System.out.println("Did not find first instance of " + tofind);
|
||||
return false;
|
||||
return "testDebugVersion; ";
|
||||
}
|
||||
idx = versionLines.indexOf(tofind, idx + 1);
|
||||
if (idx < 0) {
|
||||
System.out.println("Did not find first instance of " + tofind);
|
||||
return false;
|
||||
System.out.println("versionLines " + versionLines);
|
||||
System.out.println("Did not find second instance of " + tofind);
|
||||
return "testDebugVersion; ";
|
||||
}
|
||||
return true;
|
||||
System.out.println("testDebugVersion passed");
|
||||
return "";
|
||||
}
|
||||
|
||||
// Initialize
|
||||
@ -249,13 +275,15 @@ public class VersionCheck extends TestHelper {
|
||||
|
||||
public static void main(String[] args) {
|
||||
init();
|
||||
if (compareJVersionStrings() &&
|
||||
compareInternalStrings() &&
|
||||
testToolVersion() &&
|
||||
testDebugVersion()) {
|
||||
String errorMessage = "";
|
||||
errorMessage += testJVersionStrings();
|
||||
errorMessage += testInternalStrings();
|
||||
errorMessage += testToolVersion();
|
||||
errorMessage += testDebugVersion();
|
||||
if (errorMessage.isEmpty()) {
|
||||
System.out.println("All Version string comparisons: PASS");
|
||||
} else {
|
||||
throw new AssertionError("Some tests failed");
|
||||
throw new AssertionError("VersionCheck failed: " + errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user