[hg] main-silver: #224679: NPE at o.n.m.db.explorer.node.Procedu...

  • From: Jaroslav Havlin < >
  • To:
  • Subject: [hg] main-silver: #224679: NPE at o.n.m.db.explorer.node.Procedu...
  • Date: Mon, 28 Jan 2013 14:36:41 -0800

changeset 19ba96bcc9e8 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/19ba96bcc9e8
description:
        #224679: NPE at 
o.n.m.db.explorer.node.ProcedureNode$Oracle.updateProcedureProperties

diffstat:

 db/src/org/netbeans/modules/db/explorer/node/ProcedureNode.java |  79 
++++-----
 1 files changed, 34 insertions(+), 45 deletions(-)

diffs (101 lines):

diff --git a/db/src/org/netbeans/modules/db/explorer/node/ProcedureNode.java 
b/db/src/org/netbeans/modules/db/explorer/node/ProcedureNode.java
--- a/db/src/org/netbeans/modules/db/explorer/node/ProcedureNode.java
+++ b/db/src/org/netbeans/modules/db/explorer/node/ProcedureNode.java
@@ -306,31 +306,7 @@
         @Override
         protected void initialize() {
             super.initialize();
-            updateProcedureProperties();
-        }
-        
-        private void updateProcedureProperties() {
-            PropertySupport.Name ps = new PropertySupport.Name(this);
-            addProperty(ps);
-            Type type = provider.getType(getName());
-            if (type == null) {
-                Logger.getLogger(ProcedureNode.class.getName()).log(
-                        Level.WARNING, "Unknown type of object " + 
getName(), new Exception()); //NOI18N
-                return;
-            }
-            switch (type) {
-                case Function:
-                    addProperty(TYPE, TYPEDESC, String.class, false, 
NbBundle.getMessage (ProcedureNode.class, "StoredFunction")); // NOI18N
-                    break;
-                case Procedure:
-                    addProperty(TYPE, TYPEDESC, String.class, false, 
NbBundle.getMessage (ProcedureNode.class, "StoredProcedure")); // NOI18N
-                    break;
-                case Trigger:
-                    addProperty(TYPE, TYPEDESC, String.class, false, 
NbBundle.getMessage (ProcedureNode.class, "StoredTrigger")); // NOI18N
-                    break;
-                default:
-                    assert false : "Unknown type " + 
provider.getType(getName());
-            }
+            updateProcedureProperties(this, provider);
         }
 
         @Override
@@ -554,26 +530,7 @@
         @Override
         protected void initialize() {
             super.initialize();
-            updateProcedureProperties();
-        }
-        
-        private void updateProcedureProperties() {
-            PropertySupport.Name ps = new PropertySupport.Name(this);
-            addProperty(ps);
-            
-            switch (provider.getType(getName())) {
-                case Function:
-                    addProperty(TYPE, TYPEDESC, String.class, false, 
NbBundle.getMessage (ProcedureNode.class, "StoredFunction")); // NOI18N
-                    break;
-                case Procedure:
-                    addProperty(TYPE, TYPEDESC, String.class, false, 
NbBundle.getMessage (ProcedureNode.class, "StoredProcedure")); // NOI18N
-                    break;
-                case Trigger:
-                    addProperty(TYPE, TYPEDESC, String.class, false, 
NbBundle.getMessage (ProcedureNode.class, "StoredTrigger")); // NOI18N
-                    break;
-                default:
-                    assert false : "Unknown type " + 
provider.getType(getName());
-            }
+            updateProcedureProperties(this, provider);
         }
 
         @Override
@@ -719,4 +676,36 @@
         }
         return name;
     }
+
+    private static void updateProcedureProperties(ProcedureNode node,
+            ProcedureNodeProvider provider) {
+        PropertySupport.Name ps = new PropertySupport.Name(node);
+        node.addProperty(ps);
+        Type type = provider.getType(node.getName());
+        if (type == null) {
+            Logger.getLogger(ProcedureNode.class.getName()).log(
+                    Level.WARNING, "Unknown type of object " //NOI18N
+                    + node.getName(), new Exception());
+            return;
 }
+        switch (type) {
+            case Function:
+                setTypeProperty(node, "StoredFunction");                
//NOI18N
+                break;
+            case Procedure:
+                setTypeProperty(node, "StoredProcedure");               
//NOI18N
+                break;
+            case Trigger:
+                setTypeProperty(node, "StoredTrigger");                 
//NOI18N
+                break;
+            default:
+                assert false : "Unknown type " //NOI18N
+                        + provider.getType(node.getName());
+        }
+    }
+
+    private static void setTypeProperty(ProcedureNode node, String 
bundleKey) {
+        node.addProperty(TYPE, TYPEDESC, String.class, false,
+                NbBundle.getMessage(ProcedureNode.class, bundleKey));
+    }
+}

[hg] main-silver: #224679: NPE at o.n.m.db.explorer.node.Procedu...

Jaroslav Havlin 01/28/2013

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 113 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close