diff --git a/org.adempiere.base.process/src/org/adempiere/process/ApplyMigrationScripts.java b/org.adempiere.base.process/src/org/adempiere/process/ApplyMigrationScripts.java index 0c2debd39f..c2d1c7db58 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/ApplyMigrationScripts.java +++ b/org.adempiere.base.process/src/org/adempiere/process/ApplyMigrationScripts.java @@ -156,7 +156,7 @@ public class ApplyMigrationScripts extends SvrProcess { log.saveError("Error", msglog.toString()); log.severe(e.getMessage()); } finally { - stmt.close(); + if (stmt != null)stmt.close(); if(execOk) conn.commit(); else diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultModelFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultModelFactory.java index cf53ee176c..83abb2d5ff 100644 --- a/org.adempiere.base/src/org/adempiere/base/DefaultModelFactory.java +++ b/org.adempiere.base/src/org/adempiere/base/DefaultModelFactory.java @@ -269,7 +269,7 @@ public class DefaultModelFactory implements IModelFactory { s_log.warning("No transaction Constructor for " + clazz + " (" + msg + ")"); } - PO po = (PO)constructor.newInstance(new Object[] {Env.getCtx(), new Integer(Record_ID), trxName}); + PO po = constructor!=null ? (PO)constructor.newInstance(new Object[] {Env.getCtx(), new Integer(Record_ID), trxName}) : null; return po; } catch (Exception e) diff --git a/org.adempiere.base/src/org/compiere/print/PrintData.java b/org.adempiere.base/src/org/compiere/print/PrintData.java index 937880f3da..b57ee3d98c 100644 --- a/org.adempiere.base/src/org/compiere/print/PrintData.java +++ b/org.adempiere.base/src/org/compiere/print/PrintData.java @@ -639,11 +639,14 @@ public class PrintData implements Serializable e.printStackTrace(); } // Root - Element root = document.createElement(PrintData.XML_TAG); - root.setAttribute(XML_ATTRIBUTE_NAME, getName()); - root.setAttribute(XML_ATTRIBUTE_COUNT, String.valueOf(getRowCount())); - document.appendChild(root); - processXML (this, document, root); + if (document != null) { + Element root = document.createElement(PrintData.XML_TAG); + root.setAttribute(XML_ATTRIBUTE_NAME, getName()); + root.setAttribute(XML_ATTRIBUTE_COUNT, String.valueOf(getRowCount())); + document.appendChild(root); + processXML (this, document, root); + } + return document; } // getDocument diff --git a/org.adempiere.base/src/org/compiere/util/Ini.java b/org.adempiere.base/src/org/compiere/util/Ini.java index 4b1facb955..b39307c61e 100644 --- a/org.adempiere.base/src/org/compiere/util/Ini.java +++ b/org.adempiere.base/src/org/compiere/util/Ini.java @@ -329,9 +329,11 @@ public final class Ini implements Serializable try { - InputStream is = fc.getInputStream(); - s_prop.load(is); - is.close(); + if (fc != null) { + InputStream is = fc.getInputStream(); + s_prop.load(is); + is.close(); + } } catch (Throwable t) { diff --git a/org.adempiere.base/src/org/compiere/util/Secure.java b/org.adempiere.base/src/org/compiere/util/Secure.java index 3b79e27273..d6fa0c4492 100644 --- a/org.adempiere.base/src/org/compiere/util/Secure.java +++ b/org.adempiere.base/src/org/compiere/util/Secure.java @@ -352,16 +352,19 @@ public class Secure implements SecureInterface nsae.printStackTrace(); } } - // Reset MessageDigest object - m_md.reset(); - // Convert String to array of bytes + // Convert String to array of bytes byte[] input = value.getBytes(); - // feed this array of bytes to the MessageDigest object - m_md.update(input); - // Get the resulting bytes after the encryption process - byte[] output = m_md.digest(); - m_md.reset(); - // + byte[] output = null; + // Reset MessageDigest object + if (m_md != null) { + m_md.reset(); + // feed this array of bytes to the MessageDigest object + m_md.update(input); + // Get the resulting bytes after the encryption process + output = m_md.digest(); + m_md.reset(); + // + } return convertToHexString(output); } // getDigest diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java b/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java index e0800d898c..9b1a1661e3 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/GridTab2PackExporter.java @@ -103,7 +103,7 @@ public class GridTab2PackExporter implements IGridTabExporter { } } try { - packOut.export(getPackoutDirectory(), file.getAbsolutePath(), packoutDocument, packoutItems, null); + packOut.export(getPackoutDirectory(), file!=null ? file.getAbsolutePath() : null , packoutDocument, packoutItems, null); } catch (Exception e) { throw new AdempiereException(e); } diff --git a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java index f8f54ae402..2f9339f2f7 100755 --- a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java +++ b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java @@ -1032,7 +1032,7 @@ public class DB_PostgreSQL implements AdempiereDatabase throw new DBException("Could not lock record for " + po.toString() + " caused by " + e.getLocalizedMessage()); } finally { try { - setStatementTimeout(stmt.getConnection(), currentTimeout); + if(stmt!=null)setStatementTimeout(stmt.getConnection(), currentTimeout); } catch (SQLException e) {} DB.close(rs, stmt); }