From 93f8b0fa68417c4a876be79aac8aee359ad1a25d Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 26 Mar 2020 10:42:17 +0000 Subject: Fix heapsummary type parsing --- .../me/lucko/spark/common/heapdump/HeapDumpSummary.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'spark-common/src/main/java/me/lucko/spark') diff --git a/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java b/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java index 002ff72..56958d1 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java +++ b/spark-common/src/main/java/me/lucko/spark/common/heapdump/HeapDumpSummary.java @@ -69,6 +69,20 @@ public final class HeapDumpSummary { return proxy.gcClassHistogram(new String[0]); } + /** + * Converts type descriptors to their class name. + * + * @param type the type + * @return the class name + */ + private static String typeToClassName(String type) { + try { + return Type.getType(type).getClassName(); + } catch (IllegalArgumentException e) { + return type; + } + } + /** * Creates a new heap dump based on the current VM. * @@ -95,7 +109,7 @@ public final class HeapDumpSummary { Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Long.parseLong(matcher.group(3)), - Type.getType(matcher.group(4)).getClassName() + typeToClassName(matcher.group(4)) ); } catch (Exception e) { new IllegalArgumentException("Exception parsing line: " + line, e).printStackTrace(); -- cgit