Related with issue 28414: Change the error that appears in the log.
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Tue, 30 Dec 2014 10:50:25 +0100
changeset 25715 4e47ac5c68fa
parent 25714 8965d2c4301b
child 25716 e47640ded61f
Related with issue 28414: Change the error that appears in the log.

An error appears in the log when accessing a window which has a button with not a process nor a process definition assigned to it.

The problem was that the fact of a button with not process nor process definition assigned to it was not taken into account and that was why an url and a command
where not defined.

For fixing this a condition has been added to the function "getURL" and other one to the function "getCommand".
Now if a url or a command is null, a dummy value is given to them. Now, as they have a value, that value can be transformed into a string and the NPE error disappears.

This handles the case when the button is already wrongly configured. In the next step we will avoid making this configuration mistakes in new buttons.
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java	Wed Dec 24 16:42:09 2014 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java	Tue Dec 30 10:50:25 2014 +0100
@@ -903,6 +903,12 @@
     }
 
     public String getUrl() {
+      if (url == null) {
+        url = "/";
+        log.error("The button " + column.getName() + " of the table "
+            + column.getTable().getDBTableName()
+            + " has not process or a process definition assigned to it");
+      }
       return url;
     }
 
@@ -911,6 +917,12 @@
     }
 
     public String getCommand() {
+      if (command == null) {
+        command = "/";
+        log.error("The button " + column.getName() + " of the table "
+            + column.getTable().getDBTableName()
+            + " has not process or a process definition assigned to it");
+      }
       return command;
     }