Skip to content

Commit c938a56

Browse files
committed
GH-197 Make sure the user is notified on heap dump loading failure
1 parent 1ecd317 commit c938a56

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

visualvm/heapdump/src/org/graalvm/visualvm/heapdump/impl/Bundle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,8 @@ LBL_Loading_Heap_Dump=Loading heap dump...
4949

5050
LBL_Loading_Heap_Dump_failed=Loading Heap Dump failed.
5151

52+
LBL_Loading_Heap_Dump_failed2=Loading failed: {0}
53+
5254
MSG_Opening_Heap_Dump=Opening Heap Dump...
5355

5456
MSG_Opening_Heap_Dump_failed=Opening heap dump failed.

visualvm/heapdump/src/org/graalvm/visualvm/heapdump/impl/HeapDumpView.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,8 +33,8 @@
3333
import org.graalvm.visualvm.heapviewer.HeapViewer;
3434
import java.awt.BorderLayout;
3535
import java.io.File;
36-
import java.io.FileNotFoundException;
3736
import java.io.IOException;
37+
import java.util.logging.Level;
3838
import java.util.logging.Logger;
3939
import javax.swing.JLabel;
4040
import javax.swing.JPanel;
@@ -135,10 +135,14 @@ public void run() {
135135
contentsPanel.revalidate();
136136
contentsPanel.repaint();
137137
} });
138-
} catch (FileNotFoundException ex) {
139-
LOGGER.throwing(HeapDumpView.class.getName(), "loadHeap", ex); // NOI18N
140-
} catch (IOException ex) {
138+
} catch (final IOException ex) {
139+
SwingUtilities.invokeLater(new Runnable() { public void run() {
140+
progressLabel.setText(NbBundle.getMessage(HeapDumpView.class, "LBL_Loading_Heap_Dump_failed2", ex.getMessage()));
141+
contentsPanel.revalidate();
142+
contentsPanel.repaint();
143+
} });
141144
LOGGER.throwing(HeapDumpView.class.getName(), "loadHeap", ex); // NOI18N
145+
LOGGER.log(Level.INFO, "Failed to load heap dump", ex); // NOI18N
142146
}
143147
}
144148
});

0 commit comments

Comments
 (0)