--- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java 2018-11-21 22:00:13.184000000 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java 2018-11-21 22:00:12.868000000 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, 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 @@ -182,7 +182,7 @@ hgw.write(fileName); System.out.println("heap written to " + fileName); return true; - } catch (IOException exp) { + } catch (IOException | RuntimeException exp) { System.err.println(exp.getMessage()); return false; } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java 2018-11-21 22:00:13.876000000 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java 2018-11-21 22:00:13.580000000 +0530 @@ -32,6 +32,7 @@ import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.classfile.*; +import sun.jvm.hotspot.gc.z.ZCollectedHeap; /* * This class writes Java heap in hprof binary format. This format is @@ -393,6 +394,10 @@ out = new DataOutputStream(new BufferedOutputStream(fos)); VM vm = VM.getVM(); + if (vm.getUniverse().heap() instanceof ZCollectedHeap) { + throw new RuntimeException("This operation is not supported with ZGC."); + } + dbg = vm.getDebugger(); objectHeap = vm.getObjectHeap(); --- old/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java 2018-11-21 22:00:14.620000000 +0530 +++ new/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java 2018-11-21 22:00:14.300000000 +0530 @@ -24,7 +24,7 @@ /** * @test TestJmapCore * @summary Test verifies that jhsdb jmap could generate heap dump from core when heap is full - * @requires vm.hasSA + * @requires vm.hasSA & vm.gc != "Z" * @library /test/lib * @run driver/timeout=240 TestJmapCore run heap */ --- old/test/hotspot/jtreg/serviceability/sa/TestJmapCoreMetaspace.java 2018-11-21 22:00:15.340000000 +0530 +++ new/test/hotspot/jtreg/serviceability/sa/TestJmapCoreMetaspace.java 2018-11-21 22:00:15.060000000 +0530 @@ -24,7 +24,7 @@ /** * @test TestJmapCoreMetaspace * @summary Test verifies that jhsdb jmap could generate heap dump from core when metspace is full - * @requires vm.hasSA + * @requires vm.hasSA & vm.gc != "Z" * @library /test/lib * @run driver/timeout=240 TestJmapCore run metaspace */