[hg] main-silver: #230331: Prevent from calling Variable.getValu...

  • From:
  • To:
  • Subject: [hg] main-silver: #230331: Prevent from calling Variable.getValu...
  • Date: Mon, 10 Jun 2013 14:35:41 -0700

changeset 8ae3ffa6dcff in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/8ae3ffa6dcff
description:
        #230331: Prevent from calling Variable.getValue() in property editor.

diffstat:

 
debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/ValuePropertyEditor.java
 |   4 +-
 
debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
 |  13 ++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diffs (63 lines):

diff --git 
a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/ValuePropertyEditor.java
 
b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/ValuePropertyEditor.java
--- 
a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/ValuePropertyEditor.java
+++ 
b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/ValuePropertyEditor.java
@@ -164,7 +164,7 @@
                 clazz = valueMirror.getClass();
             } else {
                 clazz = String.class;
-                valueMirror = var.getValue();
+                valueMirror = VariablesTableModel.getValueOf(var);
             }
         } else {
             throw new IllegalArgumentException(value.toString());
@@ -180,7 +180,7 @@
             if (propertyEditor == null) {
                 clazz = String.class;
                 propertyEditor = 
PropertyEditorManager.findEditor(String.class);
-                valueMirror = ((Variable) value).getValue();
+                valueMirror = VariablesTableModel.getValueOf((Variable) 
value);
             }
             mirrorClass = clazz;
             delegatePropertyEditor = propertyEditor;
diff --git 
a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
 
b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
--- 
a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
+++ 
b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTableModel.java
@@ -104,6 +104,7 @@
 public class VariablesTableModel implements TableModel, Constants {
     
     private static final Map<Variable, Object> mirrors = new 
WeakHashMap<Variable, Object>();
+    private static final Map<Variable, String> values = new 
WeakHashMap<Variable, String>();
     private final Map<Variable, Value> origValues = new 
WeakHashMap<Variable, Value>();
     private static final Set<Variable> checkReadOnlyMutables = new 
WeakSet<Variable>();
     
@@ -208,11 +209,17 @@
                 if (mirror == null) {
                     mirrors.remove(var);
                     origValues.remove(var);
+                    values.put(var, var.getValue());
                 } else {
                     mirrors.put(var, mirror);
+                    values.remove(var);
                     //origValues.put(var, ((JDIVariable) var).getJDIValue());
                 }
             }
+        } else {
+            synchronized (mirrors) {
+                values.put(var, var.getValue());
+            }
         }
         boolean isROCheck;
         synchronized (checkReadOnlyMutables) {
@@ -236,6 +243,12 @@
         }
     }
     
+    static String getValueOf(Variable var) {
+        synchronized (mirrors) {
+            return values.get(var);
+        }
+    }
+    
     public boolean isReadOnly (Object row, String columnID) throws 
     UnknownTypeException {
         if (row instanceof Variable) {

[hg] main-silver: #230331: Prevent from calling Variable.getValu...

mentlicher 06/10/2013

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close