[tree extension] new references do not require to be implemented for WAD
authorAsier Lostalé <asier.lostale@openbravo.com>
Wed, 05 Mar 2014 09:09:53 +0100
changeset 22628 ae962c8ea2fe
parent 22627 97f39970a49c
child 22629 8df8f64b0be8
[tree extension] new references do not require to be implemented for WAD

don't show warning messages in this case
src-wad/src/org/openbravo/wad/WadUtility.java
--- a/src-wad/src/org/openbravo/wad/WadUtility.java	Tue Mar 04 19:15:14 2014 +0100
+++ b/src-wad/src/org/openbravo/wad/WadUtility.java	Wed Mar 05 09:09:53 2014 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -807,20 +807,26 @@
       return new WADControl();
     }
 
-    try {
-      Class<?> c = Class.forName(classname);
-      control = (WADControl) c.newInstance();
-      control.setReference(parentRef);
-      control.setSubreference(subRef);
-    } catch (ClassNotFoundException ex) {
-      log4j.warn("Couldn't find class: " + classname);
+    if (classname == null || classname.isEmpty()) {
       control = new WADControl();
-    } catch (InstantiationException e) {
-      log4j.warn("Couldn't instanciate class: " + classname);
-      control = new WADControl();
-    } catch (IllegalAccessException e) {
-      log4j.warn("Illegal access class: " + classname);
-      control = new WADControl();
+      log4j.debug("Class no defined for reference " + parentRef + " - subreference:" + subRef);
+    } else {
+      try {
+        Class<?> c = Class.forName(classname);
+        control = (WADControl) c.newInstance();
+        control.setReference(parentRef);
+        control.setSubreference(subRef);
+      } catch (ClassNotFoundException ex) {
+        log4j.warn("Couldn't find class: " + classname + " - reference: " + parentRef
+            + " - subreference:" + subRef);
+        control = new WADControl();
+      } catch (InstantiationException e) {
+        log4j.warn("Couldn't instanciate class: " + classname);
+        control = new WADControl();
+      } catch (IllegalAccessException e) {
+        log4j.warn("Illegal access class: " + classname);
+        control = new WADControl();
+      }
     }
     return control;
   }