IDEMPIERE-5965 Translation Import crashed with a wrong XML (#2152)

This commit is contained in:
Carlos Ruiz 2023-12-21 13:39:20 +01:00 committed by GitHub
parent ccbcfb1eb7
commit 03ceb5f88f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -40,6 +40,7 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.Adempiere;
import org.compiere.model.MLanguage;
import org.compiere.model.MPInstance;
@ -174,8 +175,7 @@ public class Translation implements IApplication
}
catch (Exception e)
{
log.log(Level.SEVERE, "importTrl", e);
return e.toString();
throw new AdempiereException(e);
}
} // importTrl

View File

@ -19,6 +19,7 @@ package org.compiere.install;
import java.sql.Timestamp;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Language;
@ -185,7 +186,8 @@ public class TranslationHandler extends DefaultHandler
m_sql.insert(0, m_updateSQL);
// Execute
int no = DB.executeUpdate(m_sql.toString(), m_trxName);
try {
int no = DB.executeUpdateEx(m_sql.toString(), m_trxName);
if (no == 1)
{
if (log.isLoggable(Level.FINE)) log.fine(m_sql.toString());
@ -195,6 +197,9 @@ public class TranslationHandler extends DefaultHandler
log.warning ("Not Found - " + m_sql.toString());
else
log.severe ("Update Rows=" + no + " (Should be 1) - " + m_sql.toString());
} catch (Exception e) {
throw new AdempiereException("Error: " + e.getLocalizedMessage() + " ... executing " + m_sql, e);
}
}
else if (qName.equals(Translation.XML_VALUE_TAG))
{