[Tree Extension Project] Prevents NPE when filtering on multi parent trees
authorAugusto Mauch <augusto.mauch@openbravo.com>
Fri, 24 Jan 2014 15:01:45 +0100
changeset 22499 8c9e7678477b
parent 22498 64127e08c47f
child 22500 330aafc6d8e5
[Tree Extension Project] Prevents NPE when filtering on multi parent trees
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/LinkToParentTreeDatasourceService.java
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/LinkToParentTreeDatasourceService.java	Wed Jan 22 17:59:21 2014 +0100
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/LinkToParentTreeDatasourceService.java	Fri Jan 24 15:01:45 2014 +0100
@@ -782,7 +782,11 @@
       }
       try {
         json.put("nodeId", nodeIdStr);
-        json.put("parentId", parentNodeIdStr);
+        if (parentNodeIdStr == null) {
+                    json.put("parentId", ROOT_NODE);
+                  } else {
+                    json.put("parentId", parentNodeIdStr); 
+                  }
       } catch (JSONException e) {
         logger.error("Error on tree datasource", e);
       }