8145845: [AOT] NullPointerException in compiler/whitebox/GetCodeHeapEntriesTest.java
authoriignatyev
Tue, 12 Feb 2019 11:23:43 -0800
changeset 53732 d667de4734ac
parent 53731 ee45b48c9e4a
child 53733 b5d45c2fe8a0
8145845: [AOT] NullPointerException in compiler/whitebox/GetCodeHeapEntriesTest.java Reviewed-by: kvn, thartmann
src/hotspot/share/prims/whitebox.cpp
test/hotspot/jtreg/compiler/whitebox/GetCodeHeapEntriesTest.java
--- a/src/hotspot/share/prims/whitebox.cpp	Tue Feb 12 19:22:19 2019 +0100
+++ b/src/hotspot/share/prims/whitebox.cpp	Tue Feb 12 11:23:43 2019 -0800
@@ -1544,9 +1544,6 @@
       blobs.append(stub);
     }
   }
-  if (blobs.length() == 0) {
-    return NULL;
-  }
   ThreadToNativeFromVM ttn(thread);
   jobjectArray result = NULL;
   jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
--- a/test/hotspot/jtreg/compiler/whitebox/GetCodeHeapEntriesTest.java	Tue Feb 12 19:22:19 2019 +0100
+++ b/test/hotspot/jtreg/compiler/whitebox/GetCodeHeapEntriesTest.java	Tue Feb 12 11:23:43 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -77,7 +77,7 @@
         CodeBlob blob = Arrays.stream(blobs)
                               .filter(GetCodeHeapEntriesTest::filter)
                               .findAny()
-                              .get();
+                              .orElse(null);
         Asserts.assertNotNull(blob);
         Asserts.assertEQ(blob.code_blob_type, type);
         Asserts.assertGTE(blob.size, SIZE);