Skip to main content

Re: [PATCH] Handle names of Eden/Survivor spaces in G1 after 7045232

  • From: Andreas Kohn < >
  • To:
  • Subject: Re: [PATCH] Handle names of Eden/Survivor spaces in G1 after 7045232
  • Date: Thu, 12 Jan 2012 09:39:03 +0100

On Wed, 2012-01-11 at 12:52 +0100, Andreas Kohn wrote:
> Hi,
> 
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7045232 changed the
> names of some G1 spaces in JDK 8, which leads to a NPE in MemoryPoolView
> because the space does not have a position.
> 
> Please find attached a patch ...

Oops, that was not a patch :/

Here is the right thing.

--
Andreas

-- 
Never attribute to malice that which can be adequately explained by
stupidity.                                        -- Hanlon's Razor
diff --git a/src/com/kodewerk/visualvm/memorypools/MemoryPoolView.java 
b/src/com/kodewerk/visualvm/memorypools/MemoryPoolView.java
--- a/src/com/kodewerk/visualvm/memorypools/MemoryPoolView.java
+++ b/src/com/kodewerk/visualvm/memorypools/MemoryPoolView.java
@@ -81,8 +81,12 @@ class MemoryPoolView extends DataSourceView {
             panel = new MemoryPoolPanel(model.getName());
             model.registerView(panel);
             Point position = calculatePosition(model.getName());
-            dvc.addDetailsView(new DataViewComponent.DetailsView(
-                model.getName(), "memory pool metrics", position.y, panel, 
null), position.x);
+            if (position == null) {
+                LOGGER.warning("Cannot find position for model " + 
model.getName());
+            } else {
+                dvc.addDetailsView(new DataViewComponent.DetailsView(
+                    model.getName(), "memory pool metrics", position.y, 
panel, null), position.x);
+            }
         }
 
         return dvc;
@@ -139,10 +143,12 @@ class MemoryPoolView extends DataSourceView {
         positions.put( "PS Eden Space", new 
Point(DataViewComponent.TOP_LEFT,10));
         positions.put( "Eden Space", new 
Point(DataViewComponent.TOP_LEFT,10));
         positions.put( "G1 Eden", new Point(DataViewComponent.TOP_LEFT,10));
+        positions.put( "G1 Eden Space", new 
Point(DataViewComponent.TOP_LEFT,10)); // post-7045232
         positions.put( "Par Survivor Space", new 
Point(DataViewComponent.TOP_LEFT,20));
         positions.put( "PS Survivor Space", new 
Point(DataViewComponent.TOP_LEFT,20));
         positions.put( "Survivor Space", new 
Point(DataViewComponent.TOP_LEFT,20));
         positions.put( "G1 Survivor", new 
Point(DataViewComponent.TOP_LEFT,20));
+        positions.put( "G1 Survivor Space", new 
Point(DataViewComponent.TOP_LEFT,20)); // post-7045232
         positions.put( "CMS Old Gen", new 
Point(DataViewComponent.TOP_RIGHT,10));
         positions.put( "PS Old Gen", new 
Point(DataViewComponent.TOP_RIGHT,10));
         positions.put( "Tenured Gen", new 
Point(DataViewComponent.TOP_RIGHT,10));
-- 
1.7.2.3

Attachment: signature.asc
Description: This is a digitally signed message part



[PATCH] Handle names of Eden/Survivor spaces in G1 after 7045232

Andreas Kohn 01/11/2012

Re: [PATCH] Handle names of Eden/Survivor spaces in G1 after 7045232

Andreas Kohn 01/12/2012
 
 
Close
loading
Please Confirm
Close