Fix some of [2604454] - 2Pack errors

- NPE
- Raise exceptions on some failure conditions
Pending to implement old functionality in trunk (assign name, key1name and key2name)
This commit is contained in:
Carlos Ruiz 2009-02-16 05:29:09 +00:00
parent 64dfa6acf8
commit e17794b434
2 changed files with 5 additions and 3 deletions

View File

@ -258,10 +258,10 @@ public abstract class AbstractElementHandler implements ElementHandler {
int idDetail = DB.getSQLValue(getTrxName(ctx),sqlD.toString())+1;
if (referenceID == 10 || referenceID == 14 || referenceID == 34 || referenceID == 17)
if (from.get_Value(i)!= null)
if (from != null && from.get_Value(i)!= null)
colValue = from.get_Value(i).toString().replaceAll("'","''");
else if (referenceID == 20|| referenceID == 28)
if (from.get_Value(i)!= null)
if (from != null && from.get_Value(i)!= null)
colValue = from.get_Value(i).toString().replaceAll("'","''");
else
;//Ignore
@ -281,7 +281,7 @@ public abstract class AbstractElementHandler implements ElementHandler {
.append( ", " + tableID )
.append( ", " + (columnID == -1 ? "null" : columnID) )
.append( ", " + (referenceID == -1 ? "null" : referenceID) )
.append( ", '" + (colValue != null ? colValue : from.get_Value(i)) )
.append( ", '" + (colValue != null ? colValue : (from != null ? from.get_Value(i) : "null")) )
.append( "')");
int no = DB.executeUpdate (sqlB.toString(), getTrxName(ctx));

View File

@ -162,6 +162,8 @@ public class DataElementHandler extends AbstractElementHandler {
int id = get_ID(ctx, d_tablename, nameAttribute);
genericPO = table.getPO(id, getTrxName(ctx));
if (id > 0){
if (genericPO == null || genericPO.get_ID() != id)
throw new SAXException("id not found");
AD_Backup_ID = copyRecord(ctx,d_tablename,genericPO);
objectStatus = "Update";
}