[ 1906709 ] NPE exception if no name and key2name defined on drow

This commit is contained in:
Carlos Ruiz 2008-03-04 03:01:57 +00:00
parent 8e18feb9cc
commit 350ba7a5be
1 changed files with 5 additions and 3 deletions

View File

@ -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));