Skip to content

Commit c96ca72

Browse files
committed
GH-533 support for custom Level class added
1 parent b101fa8 commit c96ca72

File tree

1 file changed

+15
-1
lines changed
  • visualvm/libs.profiler/profiler.heapwalker/src/org/graalvm/visualvm/lib/profiler/heapwalk/details/jdk

1 file changed

+15
-1
lines changed

visualvm/libs.profiler/profiler.heapwalker/src/org/graalvm/visualvm/lib/profiler/heapwalk/details/jdk/UtilDetailsProvider.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,21 @@ public Object[] getParameters() {
314314
@Override
315315
public Level getLevel() {
316316
String level = DetailsUtils.getInstanceFieldString(record, "level"); // NOI18N
317-
return Level.parse(level);
317+
try {
318+
return Level.parse(level);
319+
} catch (RuntimeException ex) {
320+
// custom level, construct level directly
321+
Instance levelObj = (Instance)record.getValueOfField("level"); // NOI18N
322+
Integer value = (Integer)levelObj.getValueOfField("value"); // NOI18N
323+
if (level == null) level = "NULL"; // NOI18N
324+
return new CustomLevel(level, value); // NOI18N
325+
}
326+
}
327+
}
328+
329+
private static class CustomLevel extends Level {
330+
private CustomLevel(String name, int value) {
331+
super(name, value);
318332
}
319333
}
320334
}

0 commit comments

Comments
 (0)