Merge
authorjwilhelm
Wed, 09 Nov 2016 13:37:19 +0100
changeset 42107 34cb644a6c91
parent 42094 c0cb9b0980be (current diff)
parent 42106 90fc3dc00723 (diff)
child 42108 1542d48cebeb
Merge
jdk/test/ProblemList.txt
jdk/test/sun/tools/jps/JpsBase.java
jdk/test/sun/tools/jps/TestJpsClass.java
jdk/test/sun/tools/jps/TestJpsJar.java
jdk/test/sun/tools/jps/TestJpsJarRelative.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Wed Nov 09 13:37:19 2016 +0100
@@ -80,7 +80,7 @@
             default : throw newInternalError("unexpected xtype: " + xtype);
             }
         } catch (Throwable t) {
-            throw newInternalError(t);
+            throw uncaughtException(t);
         }
     }
 
@@ -188,7 +188,7 @@
             case D_TYPE: return (double) speciesData().getters[i].invokeBasic(this);
             }
         } catch (Throwable ex) {
-            throw newInternalError(ex);
+            throw uncaughtException(ex);
         }
         throw new InternalError("unexpected type: " + speciesData().typeChars+"."+i);
     }
@@ -408,18 +408,14 @@
          */
         static boolean speciesDataCachePopulated() {
             Class<BoundMethodHandle> rootCls = BoundMethodHandle.class;
-            try {
-                for (Class<?> c : rootCls.getDeclaredClasses()) {
-                    if (rootCls.isAssignableFrom(c)) {
-                        final Class<? extends BoundMethodHandle> cbmh = c.asSubclass(BoundMethodHandle.class);
-                        SpeciesData d = Factory.getSpeciesDataFromConcreteBMHClass(cbmh);
-                        assert(d != null) : cbmh.getName();
-                        assert(d.clazz == cbmh);
-                        assert(CACHE.get(d.typeChars) == d);
-                    }
+            for (Class<?> c : rootCls.getDeclaredClasses()) {
+                if (rootCls.isAssignableFrom(c)) {
+                    final Class<? extends BoundMethodHandle> cbmh = c.asSubclass(BoundMethodHandle.class);
+                    SpeciesData d = Factory.getSpeciesDataFromConcreteBMHClass(cbmh);
+                    assert(d != null) : cbmh.getName();
+                    assert(d.clazz == cbmh);
+                    assert(CACHE.get(d.typeChars) == d);
                 }
-            } catch (Throwable e) {
-                throw newInternalError(e);
             }
             return true;
         }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java	Wed Nov 09 13:37:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -272,7 +272,7 @@
         MethodHandleNatives.setCallSiteTargetVolatile(this, newTarget);
     }
 
-    // this implements the upcall from the JVM, MethodHandleNatives.makeDynamicCallSite:
+    // this implements the upcall from the JVM, MethodHandleNatives.linkCallSite:
     static CallSite makeSite(MethodHandle bootstrapMethod,
                              // Callee information:
                              String name, MethodType type,
@@ -293,59 +293,72 @@
                 Object[] argv = (Object[]) info;
                 maybeReBoxElements(argv);
                 switch (argv.length) {
-                case 0:
-                    binding = bootstrapMethod.invoke(caller, name, type);
-                    break;
-                case 1:
-                    binding = bootstrapMethod.invoke(caller, name, type,
-                                                     argv[0]);
-                    break;
-                case 2:
-                    binding = bootstrapMethod.invoke(caller, name, type,
-                                                     argv[0], argv[1]);
-                    break;
-                case 3:
-                    binding = bootstrapMethod.invoke(caller, name, type,
-                                                     argv[0], argv[1], argv[2]);
-                    break;
-                case 4:
-                    binding = bootstrapMethod.invoke(caller, name, type,
-                                                     argv[0], argv[1], argv[2], argv[3]);
-                    break;
-                case 5:
-                    binding = bootstrapMethod.invoke(caller, name, type,
-                                                     argv[0], argv[1], argv[2], argv[3], argv[4]);
-                    break;
-                case 6:
-                    binding = bootstrapMethod.invoke(caller, name, type,
-                                                     argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
-                    break;
-                default:
-                    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);
-                    binding = spreader.invokeExact(typedBSM, (Object)caller, (Object)name, (Object)type, argv);
+                    case 0:
+                        binding = bootstrapMethod.invoke(caller, name, type);
+                        break;
+                    case 1:
+                        binding = bootstrapMethod.invoke(caller, name, type,
+                                                         argv[0]);
+                        break;
+                    case 2:
+                        binding = bootstrapMethod.invoke(caller, name, type,
+                                                         argv[0], argv[1]);
+                        break;
+                    case 3:
+                        binding = bootstrapMethod.invoke(caller, name, type,
+                                                         argv[0], argv[1], argv[2]);
+                        break;
+                    case 4:
+                        binding = bootstrapMethod.invoke(caller, name, type,
+                                                         argv[0], argv[1], argv[2], argv[3]);
+                        break;
+                    case 5:
+                        binding = bootstrapMethod.invoke(caller, name, type,
+                                                         argv[0], argv[1], argv[2], argv[3], argv[4]);
+                        break;
+                    case 6:
+                        binding = bootstrapMethod.invoke(caller, name, type,
+                                                         argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
+                        break;
+                    default:
+                        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);
+                        binding = spreader.invokeExact(typedBSM, (Object) caller, (Object) name, (Object) type, argv);
                 }
             }
-            //System.out.println("BSM for "+name+type+" => "+binding);
             if (binding instanceof CallSite) {
                 site = (CallSite) binding;
-            }  else {
+            } else {
+                // See the "Linking Exceptions" section for the invokedynamic
+                // instruction in JVMS 6.5.
+                // Throws a runtime exception defining the cause that is then
+                // in the "catch (Throwable ex)" a few lines below wrapped in
+                // BootstrapMethodError
                 throw new ClassCastException("bootstrap method failed to produce a CallSite");
             }
-            if (!site.getTarget().type().equals(type))
+            if (!site.getTarget().type().equals(type)) {
+                // See the "Linking Exceptions" section for the invokedynamic
+                // instruction in JVMS 6.5.
+                // Throws a runtime exception defining the cause that is then
+                // in the "catch (Throwable ex)" a few lines below wrapped in
+                // BootstrapMethodError
                 throw wrongTargetType(site.getTarget(), type);
+            }
+        } catch (Error e) {
+            // Pass through an Error, including BootstrapMethodError, any other
+            // form of linkage error, such as IllegalAccessError if the bootstrap
+            // method is inaccessible, or say ThreadDeath/OutOfMemoryError
+            // See the "Linking Exceptions" section for the invokedynamic
+            // instruction in JVMS 6.5.
+            throw e;
         } catch (Throwable ex) {
-            BootstrapMethodError bex;
-            if (ex instanceof BootstrapMethodError)
-                bex = (BootstrapMethodError) ex;
-            else
-                bex = new BootstrapMethodError("call site initialization exception", ex);
-            throw bex;
+            // Wrap anything else in BootstrapMethodError
+            throw new BootstrapMethodError("call site initialization exception", ex);
         }
         return site;
     }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Nov 09 13:37:19 2016 +0100
@@ -1021,7 +1021,7 @@
             try {
                 emptyArray = name.function.resolvedHandle().invoke();
             } catch (Throwable ex) {
-                throw newInternalError(ex);
+                throw uncaughtException(ex);
             }
             assert(java.lang.reflect.Array.getLength(emptyArray) == 0);
             assert(emptyArray.getClass() == rtype);  // exact typing
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Wed Nov 09 13:37:19 2016 +0100
@@ -855,7 +855,11 @@
                 System.out.println("LambdaForm compilation failed: " + this);
                 bge.printStackTrace(System.out);
             }
-        } catch (Error | Exception e) {
+        } catch (Error e) {
+            // Pass through any error
+            throw e;
+        } catch (Exception e) {
+            // Wrap any exception
             throw newInternalError(this.toString(), e);
         }
     }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Wed Nov 09 13:37:19 2016 +0100
@@ -957,7 +957,7 @@
         if (!fail)  return needType;
         // elicit an error:
         this.asType(needType);
-        throw newInternalError("should not return", null);
+        throw newInternalError("should not return");
     }
 
     private void spreadArrayChecks(Class<?> arrayType, int arrayLength) {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Wed Nov 09 13:37:19 2016 +0100
@@ -379,11 +379,13 @@
                             name, fixMethodType(callerClass, type), appendixResult);
                 }
             }
+        } catch (Error e) {
+            // Pass through an Error, including say StackOverflowError or
+            // OutOfMemoryError
+            throw e;
         } catch (Throwable ex) {
-            if (ex instanceof LinkageError)
-                throw (LinkageError) ex;
-            else
-                throw new LinkageError(ex.getMessage(), ex);
+            // Wrap anything else in LinkageError
+            throw new LinkageError(ex.getMessage(), ex);
         }
         throw new LinkageError("no such method "+defc.getName()+"."+name+type);
     }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java	Wed Nov 09 13:37:19 2016 +0100
@@ -107,10 +107,10 @@
     /*non-public*/ static InternalError newInternalError(String message) {
         return new InternalError(message);
     }
-    /*non-public*/ static InternalError newInternalError(String message, Throwable cause) {
+    /*non-public*/ static InternalError newInternalError(String message, Exception cause) {
         return new InternalError(message, cause);
     }
-    /*non-public*/ static InternalError newInternalError(Throwable cause) {
+    /*non-public*/ static InternalError newInternalError(Exception cause) {
         return new InternalError(cause);
     }
     /*non-public*/ static RuntimeException newIllegalStateException(String message) {
@@ -132,7 +132,7 @@
     /*non-public*/ static Error uncaughtException(Throwable ex) {
         if (ex instanceof Error)  throw (Error) ex;
         if (ex instanceof RuntimeException)  throw (RuntimeException) ex;
-        throw newInternalError("uncaught exception", ex);
+        throw new InternalError("uncaught exception", ex);
     }
     private static String message(String message, Object obj) {
         if (obj != null)  message = message + ": " + obj;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Wed Nov 09 13:37:19 2016 +0100
@@ -723,6 +723,9 @@
                 default:
                     throw new StringConcatException("Concatenation strategy " + STRATEGY + " is not implemented");
             }
+        } catch (Error | StringConcatException e) {
+            // Pass through any error or existing StringConcatException
+            throw e;
         } catch (Throwable t) {
             throw new StringConcatException("Generator failed", t);
         }
@@ -1092,9 +1095,9 @@
                 UNSAFE.ensureClassInitialized(innerClass);
                 dumpIfEnabled(innerClass.getName(), classBytes);
                 return Lookup.IMPL_LOOKUP.findStatic(innerClass, METHOD_NAME, args);
-            } catch (Throwable e) {
+            } catch (Exception e) {
                 dumpIfEnabled(className + "$$FAILED", classBytes);
-                throw new StringConcatException("Error while spinning the class", e);
+                throw new StringConcatException("Exception while spinning the class", e);
             }
         }
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/package-info.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/package-info.java	Wed Nov 09 13:37:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -84,20 +84,21 @@
  * </ul>
  * Invocation is as if by
  * {@link java.lang.invoke.MethodHandle#invoke MethodHandle.invoke}.
- * The returned result must be a {@link java.lang.invoke.CallSite CallSite} (or a subclass).
+ * The returned result must be a {@link java.lang.invoke.CallSite CallSite}
+ * (or a subclass), otherwise a
+ * {@link java.lang.BootstrapMethodError BootstrapMethodError} is thrown.
  * The type of the call site's target must be exactly equal to the type
  * derived from the dynamic call site's type descriptor and passed to
- * the bootstrap method.
- * The call site then becomes permanently linked to the dynamic call site.
+ * the bootstrap method, otherwise a {@code BootstrapMethodError} is thrown.
+ * On success the call site then becomes permanently linked to the dynamic call
+ * site.
  * <p>
- * As documented in the JVM specification, all failures arising from
- * the linkage of a dynamic call site are reported
- * by a {@link java.lang.BootstrapMethodError BootstrapMethodError},
- * which is thrown as the abnormal termination of the dynamic call
- * site execution.
- * If this happens, the same error will the thrown for all subsequent
- * attempts to execute the dynamic call site.
- *
+ * If an exception, {@code E} say, occurs when linking the call site then the
+ * linkage fails and terminates abnormally. {@code E} is rethrown if the type of
+ * {@code E} is {@code Error} or a subclass, otherwise a
+ * {@code BootstrapMethodError} that wraps {@code E} is thrown.
+ * If this happens, the same {@code Error} or subclass will the thrown for all
+ * subsequent attempts to execute the dynamic call site.
  * <h2>timing of linkage</h2>
  * A dynamic call site is linked just before its first execution.
  * The bootstrap method call implementing the linkage occurs within
--- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java	Wed Nov 09 13:37:19 2016 +0100
@@ -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
@@ -554,7 +554,7 @@
      * @return an array of {@code StackTraceElement} objects of the thread.
      */
     public StackTraceElement[] getStackTrace() {
-        return stackTrace;
+        return stackTrace.clone();
     }
 
     /**
@@ -868,7 +868,7 @@
      * @since 1.6
      */
     public MonitorInfo[] getLockedMonitors() {
-        return lockedMonitors;
+        return lockedMonitors.clone();
     }
 
     /**
@@ -885,7 +885,7 @@
      * @since 1.6
      */
     public LockInfo[] getLockedSynchronizers() {
-        return lockedSynchronizers;
+        return lockedSynchronizers.clone();
     }
 
     private static final StackTraceElement[] NO_STACK_TRACE =
--- a/jdk/src/java.management/share/classes/javax/management/MXBean.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/MXBean.java	Wed Nov 09 13:37:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -916,14 +916,14 @@
       <li><p>Otherwise, <em>J</em> is not reconstructible.</p></li>
     </ol>
 
-    <p>When only {@code @java.beans.ConstructorProperties} is present then
-    rule 2 is not applicable to subset Profiles of Java SE that do not include
-    the {@code java.beans} package. When targeting a runtime that does
-    not include the {@code java.beans} package, and where there is a mismatch
-    between the compile-time and runtime environment whereby <em>J</em> is
-    compiled with a public constructor and the {@code ConstructorProperties}
-    annotation, then <em>J</em> is not reconstructible unless another rule
-    applies.</p>
+    <p>Rule 2 is not applicable when {@code java.beans.ConstructorProperties}
+    is not visible (e.g. when the java.desktop module is not readable or when
+    the runtime image does not contain the java.desktop module). When
+    targeting a runtime that does not include the {@code java.beans} package,
+    and where there is a mismatch between the compile-time and runtime
+    environment whereby <em>J</em> is compiled with a public constructor
+    and the {@code ConstructorProperties} annotation, then <em>J</em> is
+    not reconstructible unless another rule applies.</p>
 
     <p>Here are examples showing different ways to code a type {@code
       NamedNumber} that consists of an {@code int} and a {@code
--- a/jdk/src/java.management/share/classes/sun/management/VMManagementImpl.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/VMManagementImpl.java	Wed Nov 09 13:37:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, 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
@@ -102,7 +102,13 @@
     }
 
     public boolean isGcNotificationSupported() {
-        return gcNotificationSupport;
+        boolean isSupported = true;
+        try {
+            Class.forName("com.sun.management.GarbageCollectorMXBean");
+        } catch (ClassNotFoundException x) {
+            isSupported = false;
+        }
+        return isSupported;
     }
 
     public boolean isRemoteDiagnosticCommandsSupported() {
--- a/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c	Wed Nov 09 13:37:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, 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
@@ -96,13 +96,6 @@
 
     value = mos.isRemoteDiagnosticCommandsSupported;
     setStaticBooleanField(env, cls, "remoteDiagnosticCommandsSupport", value);
-
-    if ((jmm_version > JMM_VERSION_1_2) ||
-        (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF) >= 1))) {
-        setStaticBooleanField(env, cls, "gcNotificationSupport", JNI_TRUE);
-    } else {
-        setStaticBooleanField(env, cls, "gcNotificationSupport", JNI_FALSE);
-    }
 }
 
 JNIEXPORT jobjectArray JNICALL
--- a/jdk/src/jdk.jdi/share/native/libdt_shmem/SharedMemoryConnection.c	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/src/jdk.jdi/share/native/libdt_shmem/SharedMemoryConnection.c	Wed Nov 09 13:37:19 2016 +0100
@@ -174,9 +174,20 @@
      * Get the packet header
      */
     (*env)->GetByteArrayRegion(env, b, 0, sizeof(pktHeader), pktHeader);
+    if ((*env)->ExceptionOccurred(env)) {
+        /* b shorter than sizeof(pktHeader) */
+        return;
+    }
 
     total_length = (int)pktHeader[3] | ((int)pktHeader[2] << 8) |
                    ((int)pktHeader[1] << 16) | ((int)pktHeader[0] << 24);
+
+    if (total_length < sizeof(pktHeader)) {
+        throwException(env, "java/lang/IllegalArgumentException",
+                            "JDWP header is incorrect");
+        return;
+    }
+
     /*
      * The id field is in big endian (also errorCode field in the case
      * of reply packets).
@@ -195,9 +206,9 @@
     }
 
     /*
-     * The length of the JDWP packet is 11 + data
+     * The length of the JDWP packet is sizeof(pktHeader) + data
      */
-    data_length = total_length - 11;
+    data_length = total_length - sizeof(pktHeader);
 
     if (data_length == 0) {
         data = NULL;
@@ -209,7 +220,7 @@
             return;
         }
 
-        (*env)->GetByteArrayRegion(env, b, 11, /*sizeof(CmdPacket)+4*/ data_length, data);
+        (*env)->GetByteArrayRegion(env, b, sizeof(pktHeader), /*sizeof(CmdPacket)+4*/ data_length, data);
         if ((*env)->ExceptionOccurred(env)) {
             free(data);
             return;
--- a/jdk/test/Makefile	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/test/Makefile	Wed Nov 09 13:37:19 2016 +0100
@@ -143,7 +143,8 @@
       -timeoutHandlerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
       -observerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
       -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
-      -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver
+      -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
+      -timeoutHandlerTimeout:0
   ifeq ($(UNAME_S), CYGWIN)
     JTREG_FAILURE_HANDLER_OPTIONS += -J-Djava.library.path="$(FAILURE_HANDLER_DIR_MIXED)"
   endif
--- a/jdk/test/ProblemList.txt	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/test/ProblemList.txt	Wed Nov 09 13:37:19 2016 +0100
@@ -292,16 +292,6 @@
 
 sun/tools/jcmd/TestJcmdSanity.java                              8031482 windows-all
 
-sun/tools/jhsdb/BasicLauncherTest.java                          8160376 macosx-all
-
-sun/tools/jhsdb/HeapDumpTest.java                               8160376 macosx-all
-
-sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java              8160376 macosx-all
-
-sun/tools/jps/TestJpsJar.java                                   8165500 generic-all
-
-sun/tools/jps/TestJpsJarRelative.java                           6456333 generic-all
-
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    8057732 generic-all
 
 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java       8151899 generic-all
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java	Wed Nov 09 13:37:19 2016 +0100
@@ -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
@@ -72,22 +72,9 @@
 
     public static void main(String[] args) throws Exception {
         MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        final Boolean isNotificationSupported = AccessController.doPrivileged (new PrivilegedAction<Boolean>() {
-                public Boolean run() {
-                    try {
-                        Class cl = Class.forName("sun.management.VMManagementImpl");
-                        Field f = cl.getDeclaredField("gcNotificationSupport");
-                        f.setAccessible(true);
-                        return f.getBoolean(null);
-                    } catch(ClassNotFoundException e) {
-                        return false;
-                    } catch(NoSuchFieldException e) {
-                        return false;
-                    } catch(IllegalAccessException e) {
-                        return false;
-                    }
-                }
-            });
+        final boolean isNotificationSupported =
+                 sun.management.ManagementFactoryHelper.getVMManagement().isGcNotificationSupported();
+
         if(!isNotificationSupported) {
             System.out.println("GC Notification not supported by the JVM, test skipped");
             return;
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java	Wed Nov 09 13:37:19 2016 +0100
@@ -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
@@ -71,22 +71,9 @@
 
     public static void main(String[] args) throws Exception {
         MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        final Boolean isNotificationSupported = AccessController.doPrivileged (new PrivilegedAction<Boolean>() {
-                public Boolean run() {
-                    try {
-                        Class cl = Class.forName("sun.management.VMManagementImpl");
-                        Field f = cl.getDeclaredField("gcNotificationSupport");
-                        f.setAccessible(true);
-                        return f.getBoolean(null);
-                    } catch(ClassNotFoundException e) {
-                        return false;
-                    } catch(NoSuchFieldException e) {
-                        return false;
-                    } catch(IllegalAccessException e) {
-                        return false;
-                    }
-                }
-            });
+        final boolean isNotificationSupported =
+                 sun.management.ManagementFactoryHelper.getVMManagement().isGcNotificationSupported();
+
         if(!isNotificationSupported) {
             System.out.println("GC Notification not supported by the JVM, test skipped");
             return;
--- a/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java	Wed Nov 09 13:37:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -37,18 +37,11 @@
             failures++;
         } catch (InvocationTargetException e) {
             Throwable c = e.getCause();
-            if (BootstrapMethodError.class.isInstance(c)) {
-                c = c.getCause();
-                if (expected.isInstance(c))
-                    System.out.println("EXPECTED: " + expected.getName() + ", "+ c);
-                else {
-                    failures++;
-                    System.out.println("FAIL: Unexpected wrapped exception " + c);
-                    e.printStackTrace(System.out);
-                }
-            } else {
+            if (expected.isInstance(c))
+                System.out.println("EXPECTED: " + expected.getName() + ", "+ c);
+            else {
                 failures++;
-                System.out.println("FAIL: Exception from MethodHandle invocation not wrapped in BootstrapMethodError " + c);
+                System.out.println("FAIL: Unexpected wrapped exception " + c);
                 e.printStackTrace(System.out);
             }
         } catch (Throwable e) {
@@ -80,19 +73,14 @@
             Invoker.invoke();
             System.out.println("FAIL: No exception throw, probably failed to load modified bytecodes for MethodSupplier");
             failures++;
-        } catch (BootstrapMethodError e) {
-            Throwable c = e.getCause();
-            if (expected.isInstance(c))
-                System.out.println("EXPECTED: " + expected.getName() + ", "+ c);
+        } catch (Throwable e) {
+            if (expected.isInstance(e))
+                System.out.println("EXPECTED: " + expected.getName() + ", "+ e);
             else {
                 failures++;
-                System.out.println("FAIL: Unexpected exception has been caught " + c);
+                System.out.println("FAIL: Unexpected exception has been caught " + e);
                 e.printStackTrace(System.out);
             }
-        } catch (Throwable e) {
-            failures++;
-            System.out.println("FAIL: Exception from MethodHandle invocation not wrapped in BootstrapMethodError " + e);
-            e.printStackTrace(System.out);
         }
         System.out.println();
         try {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/DefaultManagementProviderTest.java	Wed Nov 09 13:37:19 2016 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8151099
+ * @summary Verify platform MXBeans initialized properly with java.management
+ *          module only. No other management provider
+ * @run main/othervm --limit-modules=java.management DefaultManagementProviderTest
+ */
+import java.lang.management.ManagementFactory;
+
+public class DefaultManagementProviderTest {
+    public static void main(String[] argv) {
+        ManagementFactory.getPlatformMBeanServer();
+        System.out.println("Test case passed");
+    }
+}
--- a/jdk/test/sun/tools/jps/JpsBase.java	Tue Nov 15 13:31:52 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2014, 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.File;
-import java.net.URL;
-import java.util.List;
-
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
-
-/**
- * The base class for testing the jps utility.
- * The test sequence is to start jps with different combinations of arguments
- * and verify the output contains proper values.
- */
-public final class JpsBase {
-
-    /**
-     * The jps output should contain processes' names
-     * (except when jps is started in quite mode).
-     * The expected name of the test process is prepared here.
-     */
-
-    private static String getShortProcessName() {
-        URL url = JpsBase.class.getResource("JpsBase.class");
-        boolean isJar = url.getProtocol().equals("jar");
-        return (isJar) ? JpsBase.class.getSimpleName() + ".jar" : JpsBase.class.getSimpleName();
-    }
-
-    private static String getFullProcessName() {
-        URL url = JpsBase.class.getResource("JpsBase.class");
-        boolean isJar = url.getProtocol().equals("jar");
-        if (isJar) {
-            String urlPath = url.getPath();
-            File jar = new File(urlPath.substring(urlPath.indexOf("file:") + 5, urlPath.indexOf("jar!") + 3));
-            return jar.getAbsolutePath();
-        }
-
-        return JpsBase.class.getName();
-    }
-
-    private static boolean userDirSanityCheck(String fullProcessName) {
-        String userDir = System.getProperty("user.dir");
-        if (!fullProcessName.startsWith(userDir)) {
-            System.err.printf("Test skipped. user.dir '%s' is not a prefix of '%s'\n", userDir, fullProcessName);
-            return false;
-        }
-        return true;
-    }
-
-    public static void main(String[] args) throws Exception {
-        System.out.printf("INFO: user.dir:  '%s''\n", System.getProperty("user.dir"));
-        long pid = ProcessTools.getProcessId();
-
-        List<List<JpsHelper.JpsArg>> combinations = JpsHelper.JpsArg.generateCombinations();
-        for (List<JpsHelper.JpsArg> combination : combinations) {
-            OutputAnalyzer output = JpsHelper.jps(JpsHelper.JpsArg.asCmdArray(combination));
-            output.shouldHaveExitValue(0);
-
-            boolean isQuiet = false;
-            boolean isFull = false;
-            String pattern;
-            for (JpsHelper.JpsArg jpsArg : combination) {
-                switch (jpsArg) {
-                case q:
-                    // If '-q' is specified output should contain only a list of local VM identifiers:
-                    // 30673
-                    isQuiet = true;
-                    JpsHelper.verifyJpsOutput(output, "^\\d+$");
-                    output.shouldContain(Long.toString(pid));
-                    break;
-                case l:
-                    // If '-l' is specified output should contain the full package name for the application's main class
-                    // or the full path name to the application's JAR file:
-                    // 30673 /tmp/jtreg/jtreg-workdir/scratch/JpsBase.jar ...
-                    isFull = true;
-                    String fullProcessName = getFullProcessName();
-                    // Skip the test if user.dir is not a prefix of the current path
-                    // It's possible if the test is run from symlinked dir or windows alias drive
-                    if (userDirSanityCheck(fullProcessName)) {
-                        pattern = "^" + pid + "\\s+" + replaceSpecialChars(fullProcessName) + ".*";
-                        output.shouldMatch(pattern);
-                    }
-                    break;
-                case m:
-                    // If '-m' is specified output should contain the arguments passed to the main method:
-                    // 30673 JpsBase monkey ...
-                    for (String arg : args) {
-                        pattern = "^" + pid + ".*" + replaceSpecialChars(arg) + ".*";
-                        output.shouldMatch(pattern);
-                    }
-                    break;
-                case v:
-                    // If '-v' is specified output should contain VM arguments:
-                    // 30673 JpsBase -Xmx512m -XX:+UseParallelGC -XX:Flags=/tmp/jtreg/jtreg-workdir/scratch/vmflags ...
-                    for (String vmArg : JpsHelper.getVmArgs()) {
-                        pattern = "^" + pid + ".*" + replaceSpecialChars(vmArg) + ".*";
-                        output.shouldMatch(pattern);
-                    }
-                    break;
-                case V:
-                    // If '-V' is specified output should contain VM flags:
-                    // 30673 JpsBase +DisableExplicitGC ...
-                    pattern = "^" + pid + ".*" + replaceSpecialChars(JpsHelper.VM_FLAG) + ".*";
-                    output.shouldMatch(pattern);
-                    break;
-                }
-
-                if (isQuiet) {
-                    break;
-                }
-            }
-
-            if (!isQuiet) {
-                // Verify output line by line.
-                // Output should only contain lines with pids after the first line with pid.
-                JpsHelper.verifyJpsOutput(output, "^\\d+\\s+.*");
-                if (!isFull) {
-                    String shortProcessName = getShortProcessName();
-                    pattern = "^" + pid + "\\s+" + replaceSpecialChars(shortProcessName);
-                    if (combination.isEmpty()) {
-                        // If no arguments are specified output should only contain
-                        // pid and process name
-                        pattern += "$";
-                    } else {
-                        pattern += ".*";
-                    }
-                    output.shouldMatch(pattern);
-                }
-            }
-        }
-    }
-
-    private static String replaceSpecialChars(String str) {
-        String tmp = str.replace("\\", "\\\\");
-        tmp = tmp.replace("+", "\\+");
-        tmp = tmp.replace(".", "\\.");
-        tmp = tmp.replace("\n", "\\\\n");
-        tmp = tmp.replace("\r", "\\\\r");
-        return tmp;
-    }
-
-}
--- a/jdk/test/sun/tools/jps/JpsHelper.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Wed Nov 09 13:37:19 2016 +0100
@@ -204,44 +204,85 @@
                 "The ouput should contain all content of " + path.toAbsolutePath());
     }
 
-    private static File getManifest(String className) throws IOException {
-        if (manifestFile == null) {
-            manifestFile = new File(className + ".mf");
-            try (BufferedWriter output = new BufferedWriter(new FileWriter(manifestFile))) {
-                output.write("Main-Class: " + className + Utils.NEW_LINE);
+    public static void runJpsVariants(Long pid, String processName, String fullProcessName, String argument) throws Exception {
+        System.out.printf("INFO: user.dir:  '%s''\n", System.getProperty("user.dir"));
+        List<List<JpsHelper.JpsArg>> combinations = JpsHelper.JpsArg.generateCombinations();
+        for (List<JpsHelper.JpsArg> combination : combinations) {
+            OutputAnalyzer output = JpsHelper.jps(JpsHelper.JpsArg.asCmdArray(combination));
+            output.shouldHaveExitValue(0);
+
+            boolean isQuiet = false;
+            boolean isFull = false;
+            String pattern;
+            for (JpsHelper.JpsArg jpsArg : combination) {
+                switch (jpsArg) {
+                case q:
+                    // If '-q' is specified output should contain only a list of local VM identifiers:
+                    // 30673
+                    isQuiet = true;
+                    JpsHelper.verifyJpsOutput(output, "^\\d+$");
+                    output.shouldContain(Long.toString(pid));
+                    break;
+                case l:
+                    // If '-l' is specified output should contain the full package name for the application's main class
+                    // or the full path name to the application's JAR file:
+                    // 30673 /tmp/jtreg/jtreg-workdir/scratch/LingeredAppForJps.jar ...
+                    isFull = true;
+                    pattern = "^" + pid + "\\s+" + replaceSpecialChars(fullProcessName) + ".*";
+                    output.shouldMatch(pattern);
+                    break;
+                case m:
+                    // If '-m' is specified output should contain the arguments passed to the main method:
+                    // 30673 LingeredAppForJps lockfilename ...
+                    pattern = "^" + pid + ".*" + replaceSpecialChars(argument) + ".*";
+                    output.shouldMatch(pattern);
+                    break;
+                case v:
+                    // If '-v' is specified output should contain VM arguments:
+                    // 30673 LingeredAppForJps -Xmx512m -XX:+UseParallelGC -XX:Flags=/tmp/jtreg/jtreg-workdir/scratch/vmflags ...
+                    for (String vmArg : JpsHelper.getVmArgs()) {
+                        pattern = "^" + pid + ".*" + replaceSpecialChars(vmArg) + ".*";
+                        output.shouldMatch(pattern);
+                    }
+                    break;
+                case V:
+                    // If '-V' is specified output should contain VM flags:
+                    // 30673 LingeredAppForJps +DisableExplicitGC ...
+                    pattern = "^" + pid + ".*" + replaceSpecialChars(JpsHelper.VM_FLAG) + ".*";
+                    output.shouldMatch(pattern);
+                    break;
+                }
+
+                if (isQuiet) {
+                    break;
+                }
+            }
+
+            if (!isQuiet) {
+                // Verify output line by line.
+                // Output should only contain lines with pids after the first line with pid.
+                JpsHelper.verifyJpsOutput(output, "^\\d+\\s+.*");
+                if (!isFull) {
+                    pattern = "^" + pid + "\\s+" + replaceSpecialChars(processName);
+                    if (combination.isEmpty()) {
+                        // If no arguments are specified output should only contain
+                        // pid and process name
+                        pattern += "$";
+                    } else {
+                        pattern += ".*";
+                    }
+                    output.shouldMatch(pattern);
+                }
             }
         }
-        return manifestFile;
     }
 
-    /**
-     * Build a jar of test classes in runtime
-     */
-    public static File buildJar(String className) throws Exception {
-        File jar = new File(className + ".jar");
-
-        List<String> jarArgs = new ArrayList<>();
-        jarArgs.add("-cfm");
-        jarArgs.add(jar.getAbsolutePath());
-        File manifestFile = getManifest(className);
-        jarArgs.add(manifestFile.getAbsolutePath());
-        String testClassPath = System.getProperty("test.class.path", "?");
-        for (String path : testClassPath.split(File.pathSeparator)) {
-            jarArgs.add("-C");
-            jarArgs.add(path);
-            jarArgs.add(".");
-        }
-
-        System.out.println("Running jar " + jarArgs.toString());
-        sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
-        if (!jarTool.run(jarArgs.toArray(new String[jarArgs.size()]))) {
-            throw new Exception("jar failed: args=" + jarArgs.toString());
-        }
-
-        manifestFile.delete();
-        jar.deleteOnExit();
-
-        return jar;
+    private static String replaceSpecialChars(String str) {
+        String tmp = str.replace("\\", "\\\\");
+        tmp = tmp.replace("+", "\\+");
+        tmp = tmp.replace(".", "\\.");
+        tmp = tmp.replace("\n", "\\\\n");
+        tmp = tmp.replace("\r", "\\\\r");
+        return tmp;
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jps/LingeredApp.java	Wed Nov 09 13:37:19 2016 +0100
@@ -0,0 +1,489 @@
+/*
+ * 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
+ * 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.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * This is a framework to launch an app that could be synchronized with caller
+ * to make further attach actions reliable across supported platforms
+
+ * Caller example:
+ *   SmartTestApp a = SmartTestApp.startApp(cmd);
+ *     // do something
+ *   a.stopApp();
+ *
+ *   or fine grained control
+ *
+ *   a = new SmartTestApp("MyLock.lck");
+ *   a.createLock();
+ *   a.runApp();
+ *   a.waitAppReady();
+ *     // do something
+ *   a.deleteLock();
+ *   a.waitAppTerminate();
+ *
+ *  Then you can work with app output and process object
+ *
+ *   output = a.getAppOutput();
+ *   process = a.getProcess();
+ *
+ */
+public class LingeredApp {
+
+    private static final long spinDelay = 1000;
+
+    private long lockCreationTime;
+    private final ArrayList<String> storedAppOutput;
+
+    protected Process appProcess;
+    protected static final int appWaitTime = 100;
+    protected final String lockFileName;
+
+    /*
+     * Drain child process output, store it into string array
+     */
+    class InputGobbler extends Thread {
+
+        InputStream is;
+        List<String> astr;
+
+        InputGobbler(InputStream is, List<String> astr) {
+            this.is = is;
+            this.astr = astr;
+        }
+
+        public void run() {
+            try {
+                InputStreamReader isr = new InputStreamReader(is);
+                BufferedReader br = new BufferedReader(isr);
+                String line = null;
+                while ((line = br.readLine()) != null) {
+                    astr.add(line);
+                }
+            } catch (IOException ex) {
+                // pass
+            }
+        }
+    }
+
+    /**
+     * Create LingeredApp object on caller side. Lock file have be a valid filename
+     * at writable location
+     *
+     * @param lockFileName - the name of lock file
+     */
+    public LingeredApp(String lockFileName) {
+        this.lockFileName = lockFileName;
+        this.storedAppOutput = new ArrayList<String>();
+    }
+
+    public LingeredApp() {
+        final String lockName = UUID.randomUUID().toString() + ".lck";
+        this.lockFileName = lockName;
+        this.storedAppOutput = new ArrayList<String>();
+    }
+
+    /**
+     *
+     * @return name of lock file
+     */
+    public String getLockFileName() {
+        return this.lockFileName;
+    }
+
+    /**
+     *
+     * @return name of testapp
+     */
+    public String getAppName() {
+        return this.getClass().getName();
+    }
+
+    /**
+     *
+     *  @return pid of java process running testapp
+     */
+    public long getPid() {
+        if (appProcess == null) {
+            throw new RuntimeException("Process is not alive");
+        }
+        return appProcess.getPid();
+    }
+
+    /**
+     *
+     * @return process object
+     */
+    public Process getProcess() {
+        return appProcess;
+    }
+
+    /**
+     *
+     * @return application output as string array. Empty array if application produced no output
+     */
+    public List<String> getAppOutput() {
+        if (appProcess.isAlive()) {
+            throw new RuntimeException("Process is still alive. Can't get its output.");
+        }
+        return storedAppOutput;
+    }
+
+    /* Make sure all part of the app use the same method to get dates,
+     as different methods could produce different results
+     */
+    private static long epoch() {
+        return new Date().getTime();
+    }
+
+    private static long lastModified(String fileName) throws IOException {
+        Path path = Paths.get(fileName);
+        BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class);
+        return attr.lastModifiedTime().toMillis();
+    }
+
+    private static void setLastModified(String fileName, long newTime) throws IOException {
+        Path path = Paths.get(fileName);
+        FileTime fileTime = FileTime.fromMillis(newTime);
+        Files.setLastModifiedTime(path, fileTime);
+    }
+
+    /**
+     * create lock
+     *
+     * @throws IOException
+     */
+    public void createLock() throws IOException {
+        Path path = Paths.get(lockFileName);
+        // Files.deleteIfExists(path);
+        Files.createFile(path);
+        lockCreationTime = lastModified(lockFileName);
+    }
+
+    /**
+     * Delete lock
+     *
+     * @throws IOException
+     */
+    public void deleteLock() throws IOException {
+        try {
+            Path path = Paths.get(lockFileName);
+            Files.delete(path);
+        } catch (NoSuchFileException ex) {
+            // Lock already deleted. Ignore error
+        }
+    }
+
+    public void waitAppTerminate() {
+        while (true) {
+            try {
+                appProcess.waitFor();
+                break;
+            } catch (InterruptedException ex) {
+                // pass
+            }
+        }
+    }
+
+    /**
+     * The app touches the lock file when it's started
+     * wait while it happens. Caller have to delete lock on wait error.
+     *
+     * @param timeout
+     * @throws java.io.IOException
+     */
+    public void waitAppReady(long timeout) throws IOException {
+        long here = epoch();
+        while (true) {
+            long epoch = epoch();
+            if (epoch - here > (timeout * 1000)) {
+                throw new IOException("App waiting timeout");
+            }
+
+            // Live process should touch lock file every second
+            long lm = lastModified(lockFileName);
+            if (lm > lockCreationTime) {
+                break;
+            }
+
+            // Make sure process didn't already exit
+            if (!appProcess.isAlive()) {
+                throw new IOException("App exited unexpectedly with " + appProcess.exitValue());
+            }
+
+            try {
+                Thread.sleep(spinDelay);
+            } catch (InterruptedException ex) {
+                // pass
+            }
+        }
+    }
+
+    /**
+     * Analyze an environment and prepare a command line to
+     * run the app, app name should be added explicitly
+     */
+    public List<String> runAppPrepare(List<String> vmArguments) {
+        // We should always use testjava or throw an exception,
+        // so we can't use JDKToolFinder.getJDKTool("java");
+        // that falls back to compile java on error
+        String jdkPath = System.getProperty("test.jdk");
+        if (jdkPath == null) {
+            // we are not under jtreg, try env
+            Map<String, String> env = System.getenv();
+            jdkPath = env.get("TESTJAVA");
+        }
+
+        if (jdkPath == null) {
+            throw new RuntimeException("Can't determine jdk path neither test.jdk property no TESTJAVA env are set");
+        }
+
+        String osname = System.getProperty("os.name");
+        String javapath = jdkPath + ((osname.startsWith("window")) ? "/bin/java.exe" : "/bin/java");
+
+        List<String> cmd = new ArrayList<String>();
+        cmd.add(javapath);
+
+
+        if (vmArguments == null) {
+            // Propagate test.vm.options to LingeredApp, filter out possible empty options
+            String testVmOpts[] = System.getProperty("test.vm.opts","").split("\\s+");
+            for (String s : testVmOpts) {
+                if (!s.equals("")) {
+                    cmd.add(s);
+                }
+            }
+        }
+        else{
+            // Lets user manage LingeredApp options
+            cmd.addAll(vmArguments);
+        }
+
+        // Make sure we set correct classpath to run the app
+        cmd.add("-cp");
+        String classpath = System.getProperty("test.class.path");
+        cmd.add((classpath == null) ? "." : classpath);
+
+        return cmd;
+    }
+
+    /**
+     * Assemble command line to a printable string
+     */
+    public void printCommandLine(List<String> cmd) {
+        // A bit of verbosity
+        StringBuilder cmdLine = new StringBuilder();
+        for (String strCmd : cmd) {
+            cmdLine.append("'").append(strCmd).append("' ");
+        }
+
+        System.out.println("Command line: [" + cmdLine.toString() + "]");
+    }
+
+    public void startGobblerPipe() {
+      // Create pipe reader for process, and read stdin and stderr to array of strings
+      InputGobbler gb = new InputGobbler(appProcess.getInputStream(), storedAppOutput);
+      gb.start();
+    }
+
+    /**
+     * Run the app.
+     *
+     * @param vmArguments
+     * @throws IOException
+     */
+    public void runApp(List<String> vmArguments)
+            throws IOException {
+
+        List<String> cmd = runAppPrepare(vmArguments);
+
+        cmd.add(this.getAppName());
+        cmd.add(lockFileName);
+
+        printCommandLine(cmd);
+
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        // we don't expect any error output but make sure we are not stuck on pipe
+        // pb.redirectErrorStream(false);
+        // ProcessBuilder.start can throw IOException
+        pb.redirectError(ProcessBuilder.Redirect.INHERIT);
+        appProcess = pb.start();
+
+        startGobblerPipe();
+    }
+
+    /**
+     * Delete lock file that signals app to terminate, then
+     * wait until app is actually terminated.
+     * @throws IOException
+     */
+    public void stopApp() throws IOException {
+        deleteLock();
+        // The startApp() of the derived app can throw
+        // an exception before the LA actually starts
+        if (appProcess != null) {
+            waitAppTerminate();
+            int exitcode = appProcess.exitValue();
+            if (exitcode != 0) {
+                throw new IOException("LingeredApp terminated with non-zero exit code " + exitcode);
+            }
+        }
+    }
+
+    /**
+     *  High level interface for test writers
+     */
+    /**
+     * Factory method that creates LingeredApp object with ready to use application
+     * lock name is autogenerated
+     * @param cmd - vm options, could be null to auto add testvm.options
+     * @return LingeredApp object
+     * @throws IOException
+     */
+    public static LingeredApp startApp(List<String> cmd) throws IOException {
+        LingeredApp a = new LingeredApp();
+        a.createLock();
+        try {
+            a.runApp(cmd);
+            a.waitAppReady(appWaitTime);
+        } catch (Exception ex) {
+            a.deleteLock();
+            throw ex;
+        }
+
+        return a;
+    }
+
+    /**
+     * Factory method that starts pre-created LingeredApp
+     * lock name is autogenerated
+     * @param cmd - vm options, could be null to auto add testvm.options
+     * @param theApp - app to start
+     * @return LingeredApp object
+     * @throws IOException
+     */
+
+    public static void startApp(List<String> cmd, LingeredApp theApp) throws IOException {
+        theApp.createLock();
+        try {
+            theApp.runApp(cmd);
+            theApp.waitAppReady(appWaitTime);
+        } catch (Exception ex) {
+            theApp.deleteLock();
+            throw ex;
+        }
+    }
+
+    public static LingeredApp startApp() throws IOException {
+        return startApp(null);
+    }
+
+    public static void stopApp(LingeredApp app) throws IOException {
+        if (app != null) {
+            // LingeredApp can throw an exception during the intialization,
+            // make sure we don't have cascade NPE
+            app.stopApp();
+        }
+    }
+
+    /**
+     * LastModified time might not work correctly in some cases it might
+     * cause later failures
+     */
+
+    public static boolean isLastModifiedWorking() {
+        boolean sane = true;
+        try {
+            long lm = lastModified(".");
+            if (lm == 0) {
+                System.err.println("SANITY Warning! The lastModifiedTime() doesn't work on this system, it returns 0");
+                sane = false;
+            }
+
+            long now = epoch();
+            if (lm > now) {
+                System.err.println("SANITY Warning! The Clock is wrong on this system lastModifiedTime() > getTime()");
+                sane = false;
+            }
+
+            setLastModified(".", epoch());
+            long lm1 = lastModified(".");
+            if (lm1 <= lm) {
+                System.err.println("SANITY Warning! The setLastModified doesn't work on this system");
+                sane = false;
+            }
+        }
+        catch(IOException e) {
+            System.err.println("SANITY Warning! IOException during sanity check " + e);
+            sane = false;
+        }
+
+        return sane;
+    }
+
+    /**
+     * This part is the application it self
+     */
+    public static void main(String args[]) {
+
+        if (args.length != 1) {
+            System.err.println("Lock file name is not specified");
+            System.exit(7);
+        }
+
+        String theLockFileName = args[0];
+
+        try {
+            Path path = Paths.get(theLockFileName);
+
+            while (Files.exists(path)) {
+                // Touch the lock to indicate our readiness
+                setLastModified(theLockFileName, epoch());
+                Thread.sleep(spinDelay);
+            }
+        } catch (NoSuchFileException ex) {
+            // Lock deleted while we are setting last modified time.
+            // Ignore error and lets the app exits
+        } catch (Exception ex) {
+            System.err.println("LingeredApp ERROR: " + ex);
+            // Leave exit_code = 1 to Java launcher
+            System.exit(3);
+        }
+
+        System.exit(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jps/LingeredAppForJps.java	Wed Nov 09 13:37:19 2016 +0100
@@ -0,0 +1,147 @@
+/*
+ * 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.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.net.URL;
+
+public class LingeredAppForJps extends LingeredApp {
+
+    // Copy runApp logic here to be able to run an app from JarFile
+    public void runAppWithName(List<String> vmArguments, String runName)
+            throws IOException {
+
+        List<String> cmd = runAppPrepare(vmArguments);
+        if (runName.endsWith(".jar")) {
+            cmd.add("-Xdiag");
+            cmd.add("-jar");
+        }
+        cmd.add(runName);
+        cmd.add(lockFileName);
+
+        printCommandLine(cmd);
+
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        // we don't expect any error output but make sure we are not stuck on pipe
+        pb.redirectError(ProcessBuilder.Redirect.INHERIT);
+        appProcess = pb.start();
+        startGobblerPipe();
+    }
+
+    public static LingeredApp startAppJar(List<String> cmd, LingeredAppForJps app, File jar) throws IOException {
+        app.createLock();
+        try {
+            app.runAppWithName(cmd, jar.getAbsolutePath());
+            app.waitAppReady(appWaitTime);
+        } catch (Exception ex) {
+            app.deleteLock();
+            throw ex;
+        }
+
+        return app;
+    }
+
+    /**
+     * The jps output should contain processes' names
+     * (except when jps is started in quite mode).
+     * The expected name of the test process is prepared here.
+     */
+    public static String getProcessName() {
+        return LingeredAppForJps.class.getSimpleName();
+    }
+
+    public static String getProcessName(File jar) {
+        return jar.getName();
+    }
+
+    // full package name for the application's main class or the full path
+    // name to the application's JAR file:
+
+    public static String getFullProcessName() {
+        return LingeredAppForJps.class.getCanonicalName();
+    }
+
+    public static String getFullProcessName(File jar) {
+        return jar.getAbsolutePath();
+    }
+
+    public static File buildJar() throws IOException {
+        String className = LingeredAppForJps.class.getName();
+        File jar = new File(className + ".jar");
+        String testClassPath = System.getProperty("test.class.path", "?");
+
+        File manifestFile = new File(className + ".mf");
+        String nl = System.getProperty("line.separator");
+        try (BufferedWriter output = new BufferedWriter(new FileWriter(manifestFile))) {
+            output.write("Main-Class: " + className + nl);
+        }
+
+        List<String> jarArgs = new ArrayList<>();
+        jarArgs.add("-cfm");
+        jarArgs.add(jar.getAbsolutePath());
+        jarArgs.add(manifestFile.getAbsolutePath());
+
+        for (String path : testClassPath.split(File.pathSeparator)) {
+            String classFullName = path + File.separator + className + ".class";
+            File f = new File(classFullName);
+            if (f.exists()) {
+              jarArgs.add("-C");
+              jarArgs.add(path);
+              jarArgs.add(".");
+              System.out.println("INFO: scheduled to jar " + path);
+              break;
+            }
+        }
+
+        System.out.println("Running jar " + jarArgs.toString());
+        sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
+        if (!jarTool.run(jarArgs.toArray(new String[jarArgs.size()]))) {
+            throw new IOException("jar failed: args=" + jarArgs.toString());
+        }
+
+        manifestFile.delete();
+        jar.deleteOnExit();
+
+        // Print content of jar file
+        System.out.println("Content of jar file" + jar.getAbsolutePath());
+
+        jarArgs = new ArrayList<>();
+        jarArgs.add("-tvf");
+        jarArgs.add(jar.getAbsolutePath());
+
+        jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
+        if (!jarTool.run(jarArgs.toArray(new String[jarArgs.size()]))) {
+            throw new IOException("jar failed: args=" + jarArgs.toString());
+        }
+
+        return jar;
+    }
+
+    public static void main(String args[]) {
+        LingeredApp.main(args);
+    }
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jps/TestJps.java	Wed Nov 09 13:37:19 2016 +0100
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/*
+ * @test
+ * @library /lib/testlibrary /test/lib
+ * @modules jdk.jartool/sun.tools.jar
+ * @build LingeredAppForJps
+ * @build LingeredApp
+ * @run main/othervm TestJps
+ */
+
+ /*
+  * Notes:
+  *   @modules tag is ignored in driver mode, so need main/othervm
+  *
+  *   Launching the process with relative path to an app jar file is not tested
+  *
+  *   This test resides in default package, so correct appearance
+  *   of the full package name actually is not tested.
+  */
+
+import java.util.List;
+import java.io.File;
+
+public class TestJps {
+
+    public static void testJpsClass() throws Throwable {
+        LingeredApp app = new LingeredAppForJps();
+        try {
+            LingeredApp.startApp(JpsHelper.getVmArgs(), app);
+            JpsHelper.runJpsVariants(app.getPid(),
+                LingeredAppForJps.getProcessName(), LingeredAppForJps.getFullProcessName(), app.getLockFileName());
+
+        } finally {
+            LingeredApp.stopApp(app);
+        }
+    }
+
+    public static void testJpsJar() throws Throwable {
+        // Get any jar exception as early as possible
+        File jar = LingeredAppForJps.buildJar();
+
+        // Jar created go to the main test
+        LingeredAppForJps app = new LingeredAppForJps();
+        try {
+            LingeredAppForJps.startAppJar(JpsHelper.getVmArgs(), app, jar);
+            JpsHelper.runJpsVariants(app.getPid(),
+                LingeredAppForJps.getProcessName(jar), LingeredAppForJps.getFullProcessName(jar), app.getLockFileName());
+        } finally {
+            LingeredAppForJps.stopApp(app);
+        }
+
+    }
+
+    public static void main(String[] args) throws Throwable {
+        testJpsClass();
+        testJpsJar();
+    }
+}
--- a/jdk/test/sun/tools/jps/TestJpsClass.java	Tue Nov 15 13:31:52 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2014, 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.util.ArrayList;
-import java.util.List;
-
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
-
-/*
- * @test
- * @summary The test application will be started with java class:
- *          java JpsBase
- *          For all possible combinations of jps arguments a jps process
- *          will be started from within the test application.
- *          The output should contain proper values.
- * @library /lib/testlibrary
- * @modules jdk.jartool/sun.tools.jar
- *          java.management
- * @build jdk.testlibrary.* JpsHelper JpsBase
- * @run driver TestJpsClass
- */
-public class TestJpsClass {
-
-    public static void main(String[] args) throws Throwable {
-        String testJdk = System.getProperty("test.jdk", "?");
-        String testSrc = System.getProperty("test.src", "?");
-        String testClassPath = System.getProperty("test.class.path", "?");
-
-        List<String> cmd = new ArrayList<>();
-        cmd.addAll(JpsHelper.getVmArgs());
-        cmd.add("-Dtest.jdk=" + testJdk);
-        cmd.add("-Dtest.src=" + testSrc);
-        cmd.add("-cp");
-        cmd.add(testClassPath);
-        cmd.add("JpsBase");
-        cmd.add("monkey");
-
-        ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()]));
-        OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
-        System.out.println(output.getOutput());
-        output.shouldHaveExitValue(0);
-    }
-
-}
--- a/jdk/test/sun/tools/jps/TestJpsJar.java	Tue Nov 15 13:31:52 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2014, 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.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
-
-/*
- * @test
- * @summary The test application will be started with absolute jar:
- *          java -jar /tmp/jtreg/jtreg-workdir/scratch/JpsBase.jar
- *          For all possible combinations of jps arguments a jps process
- *          will be started from within the test application.
- *          The output should contain proper values.
- * @library /lib/testlibrary
- * @modules jdk.jartool/sun.tools.jar
- *          java.management
- * @build JpsHelper JpsBase
- * @run main/othervm TestJpsJar
- */
-public class TestJpsJar {
-
-    public static void main(String[] args) throws Throwable {
-        String testJdk = System.getProperty("test.jdk", "?");
-        String testSrc = System.getProperty("test.src", "?");
-        File jar = JpsHelper.buildJar("JpsBase");
-
-        List<String> cmd = new ArrayList<>();
-        cmd.addAll(JpsHelper.getVmArgs());
-        cmd.add("-Dtest.jdk=" + testJdk);
-        cmd.add("-Dtest.src=" + testSrc);
-        cmd.add("-Duser.dir=" + System.getProperty("user.dir"));
-        cmd.add("-jar");
-        cmd.add(jar.getAbsolutePath());
-        cmd.add("monkey");
-
-        ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()]));
-        OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
-        System.out.println(output.getOutput());
-        output.shouldHaveExitValue(0);
-    }
-
-}
--- a/jdk/test/sun/tools/jps/TestJpsJarRelative.java	Tue Nov 15 13:31:52 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
-
-/*
- * @test
- * @summary The test application will be started with relative jar:
- *          java -jar ./JpsBase.jar
- *          For all possible combinations of jps arguments a jps process
- *          will be started from within the test application.
- *          The output should contain proper values.
- * @library /lib/testlibrary
- * @modules jdk.jartool/sun.tools.jar
- *          java.management
- * @build jdk.testlibrary.* JpsHelper JpsBase
- * @run main/othervm TestJpsJarRelative
- */
-public class TestJpsJarRelative {
-
-    public static void main(String[] args) throws Throwable {
-        String testJdk = System.getProperty("test.jdk", "?");
-        String testSrc = System.getProperty("test.src", "?");
-        File jar = JpsHelper.buildJar("JpsBase");
-
-        List<String> cmd = new ArrayList<>();
-        cmd.addAll(JpsHelper.getVmArgs());
-        cmd.add("-Dtest.jdk=" + testJdk);
-        cmd.add("-Dtest.src=" + testSrc);
-        cmd.add("-jar");
-        cmd.add("." + File.separator + jar.getName());
-        cmd.add("monkey");
-
-        ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()]));
-        OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
-        System.out.println(output.getOutput());
-        output.shouldHaveExitValue(0);
-    }
-
-}
--- a/jdk/test/sun/tools/jps/TestJpsSanity.java	Tue Nov 15 13:31:52 2016 -0800
+++ b/jdk/test/sun/tools/jps/TestJpsSanity.java	Wed Nov 09 13:37:19 2016 +0100
@@ -96,7 +96,7 @@
     }
 
     private static void testJpsUnknownHost() throws Exception {
-        String invalidHostName = "Oja781nh2ev7vcvbajdg-Sda1-C";
+        String invalidHostName = "Oja781nh2ev7vcvbajdg-Sda1-C.invalid";
         OutputAnalyzer output = JpsHelper.jps(invalidHostName);
         Asserts.assertNotEquals(output.getExitValue(), 0, "Exit code shouldn't be 0");
         Asserts.assertFalse(output.getStderr().isEmpty(), "Error output should not be empty");