diff --git a/src/share/native/sun/management/MemoryPoolImpl.c b/src/share/native/sun/management/MemoryPoolImpl.c
--- a/src/share/native/sun/management/MemoryPoolImpl.c
+++ b/src/share/native/sun/management/MemoryPoolImpl.c
@@ -31,39 +31,21 @@
 Java_sun_management_MemoryPoolImpl_getMemoryManagers0
   (JNIEnv *env, jobject pool)
 {
-    jobject mgrs = jmm_interface->GetMemoryManagers(env, pool);
-    if (mgrs == NULL) {
-        // Throw internal error since this implementation expects the
-        // pool will never become invalid.
-        JNU_ThrowInternalError(env, "Memory Pool not found");
-    }
-    return mgrs;
+    return jmm_interface->GetMemoryManagers(env, pool);
 }
 
 JNIEXPORT jobject JNICALL
 Java_sun_management_MemoryPoolImpl_getUsage0
   (JNIEnv *env, jobject pool)
 {
-    jobject usage = jmm_interface->GetMemoryPoolUsage(env, pool);
-    if (usage == NULL) {
-        // Throw internal error since this implementation expects the
-        // pool will never become invalid.
-        JNU_ThrowInternalError(env, "Memory Pool not found");
-    }
-    return usage;
+    return jmm_interface->GetMemoryPoolUsage(env, pool);
 }
 
 JNIEXPORT jobject JNICALL
 Java_sun_management_MemoryPoolImpl_getPeakUsage0
   (JNIEnv *env, jobject pool)
 {
-    jobject usage = jmm_interface->GetPeakMemoryPoolUsage(env, pool);
-    if (usage == NULL) {
-        // Throw internal error since this implementation expects the
-        // pool will never become invalid.
-        JNU_ThrowInternalError(env, "Memory Pool not found");
-    }
-    return usage;
+    return jmm_interface->GetPeakMemoryPoolUsage(env, pool);
 }
 
 JNIEXPORT void JNICALL
diff --git a/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java b/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java
--- a/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java
+++ b/test/java/lang/management/MemoryMXBean/LowMemoryTest2.java
@@ -26,7 +26,7 @@
  *
  * The test set a listener to be notified when any of the non-heap pools
  * exceed 80%. It then starts a thread that continuously loads classes.
- * In the HotSpot implementation this causes perm space to be consumed.
+ * In the HotSpot implementation this causes metaspace to be consumed.
  * Test completes when we the notification is received or an OutOfMemory
  * is generated.
  */
@@ -133,8 +133,9 @@
          * Note: Once the usage threshold has been exceeded the low memory
          * detector thread will attempt to deliver its notification - this can
          * potentially create a race condition with this thread contining to
-         * fill up perm space. To avoid the low memory detector getting an OutOfMemory
-         * we throttle this thread once the threshold has been exceeded.
+         * fill up metaspace. To avoid the low memory detector getting an
+         * OutOfMemory we throttle this thread once the threshold has been
+         * exceeded.
          */
         public void run() {
             List pools = ManagementFactory.getMemoryPoolMXBeans();
@@ -180,7 +181,7 @@
 
         // Set threshold of 80% of all NON_HEAP memory pools
         // In the Hotspot implementation this means we should get a notification
-        // if the CodeCache or perm generation fills up.
+        // if the CodeCache or metaspace fills up.
 
         while (iter.hasNext()) {
             MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
@@ -188,7 +189,12 @@
 
                 // set threshold
                 MemoryUsage mu = p.getUsage();
-                long threshold = (mu.getMax() * 80) / 100;
+                long max = mu.getMax();
+                if (max < 0) {
+                  throw new RuntimeException("There is no maximum set for " 
+                       + p.getName() + " memory pool so the test is invalid");
+                }
+                long threshold = (max * 80) / 100;
 
                 p.setUsageThreshold(threshold);
 
diff --git a/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh b/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh
--- a/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh
+++ b/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh
@@ -51,14 +51,17 @@
 
 # Run test with each GC configuration
 # 
-# Notes: To ensure that perm gen fills up we disable class unloading.
-# Also we set the max perm space to 8MB - otherwise the test takes too
+# Notes: To ensure that metaspace fills up we disable class unloading.
+# Also we set the max metaspace to 8MB - otherwise the test takes too
 # long to run. 
 
-go -noclassgc -XX:PermSize=8m -XX:MaxPermSize=8m -XX:+UseSerialGC LowMemoryTest2
-go -noclassgc -XX:PermSize=8m -XX:MaxPermSize=8m -XX:+UseParallelGC LowMemoryTest2
-go -noclassgc -XX:PermSize=8m -XX:MaxPermSize=8m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC \
-    LowMemoryTest2
+go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseSerialGC LowMemoryTest2
+go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseParallelGC LowMemoryTest2
+go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC LowMemoryTest2
+
+# Test class metaspace - might be hit MetaspaceSize instead if
+# UseCompressedKlassPointers is off or if 32 bit.
+go -noclassgc -XX:MaxMetaspaceSize=16m -XX:CompressedClassSpaceSize=4m LowMemoryTest2
 
 echo ''
 if [ $failures -gt 0 ];
