From 4eb7477046479b074e6ea78890a270a0bce9c27e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 29 Oct 2012 22:29:35 -0500 Subject: [PATCH] IDEMPIERE-454 Easy import / Fix NPE - improve success message log --- .../src/org/adempiere/impexp/GridTabCSVImporter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index cc01a3a1a6..ef6370e51e 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -15,7 +15,6 @@ package org.adempiere.impexp; import java.io.File; -import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -37,6 +36,7 @@ import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.model.MColumn; import org.compiere.model.MTable; +import org.compiere.model.PO; import org.compiere.tools.FileUtil; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -202,7 +202,7 @@ public class GridTabCSVImporter implements IGridTabImporter } if (!isLineError) { MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); - if (isForeign) { + if (isForeign && value != null) { String foreignTable = column.getReferenceTableName(); String idS = null; int id = -1; @@ -315,7 +315,9 @@ public class GridTabCSVImporter implements IGridTabImporter } if (! error) { if (gridTab.dataSave(false)) { - logMsg = Msg.getMsg(Env.getCtx(), "SuccessfullySaved", new Object[] {gridTab.getTableModel().getKeyID(gridTab.getCurrentRow())}); + PO po = gridTab.getTableModel().getPO(gridTab.getCurrentRow()); + logMsg = Msg.getMsg(Env.getCtx(), "SuccessfullySaved", + new Object[] {po != null ? po.toString() : gridTab.getTableModel().getKeyID(gridTab.getCurrentRow())}); } else { error = true; ValueNamePair ppE = CLogger.retrieveWarning();