From 350ba7a5be9e076e2d02a2419f555a9f5402a31a Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 4 Mar 2008 03:01:57 +0000 Subject: [PATCH] [ 1906709 ] NPE exception if no name and key2name defined on drow --- .../org/adempiere/pipo/handler/DataElementHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/base/src/org/adempiere/pipo/handler/DataElementHandler.java b/base/src/org/adempiere/pipo/handler/DataElementHandler.java index 029bdd460e..d628691f40 100644 --- a/base/src/org/adempiere/pipo/handler/DataElementHandler.java +++ b/base/src/org/adempiere/pipo/handler/DataElementHandler.java @@ -113,16 +113,18 @@ public class DataElementHandler extends AbstractElementHandler { else { String sql = "select * from "+d_tablename; String whereand = " where"; - String CURRENT_KEY = "key1name"; - if (!atts.getValue(CURRENT_KEY).equals("")) { + String CURRENT_KEY = "key1name"; + if (atts.getValue(CURRENT_KEY) != null && !atts.getValue(CURRENT_KEY).equals("")) { sql = sql+whereand+" "+atts.getValue(CURRENT_KEY)+"="+atts.getValue("lookup"+CURRENT_KEY); whereand = " and"; } CURRENT_KEY = "key2name"; - if (!atts.getValue(CURRENT_KEY).equals("")) { + if (atts.getValue(CURRENT_KEY) != null && !atts.getValue(CURRENT_KEY).equals("")) { sql = sql+whereand+" "+atts.getValue(CURRENT_KEY)+"="+atts.getValue("lookup"+CURRENT_KEY); whereand = " and"; } + if (whereand.equals(" where")) + log.warning("no name or keyXname attribute defined."); // Load GenericPO from rs, in fact ID could not exist e.g. Attribute Value try { PreparedStatement pstmt = DB.prepareStatement(sql, getTrxName(ctx));