details: https://code.openbravo.com/erp/devel/pi/rev/8bea9d2b658a changeset: 28016:8bea9d2b658a user: Mark <markmm82 <at> gmail.com> date: Fri Nov 20 14:20:55 2015 +0000 summary: Fix31506 Nullpointer Exception thrown because a substring action over a null Description
When payment have an empty value the substring operation fail. A validation was inserted to prevent that, and default "" string value is assigned to the description field. diffstat: modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/TransactionsDao.java | 12 +++++---- 1 files changed, 7 insertions(+), 5 deletions(-) diffs (22 lines): diff -r 4cac71a29165 -r 8bea9d2b658a modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/TransactionsDao.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/TransactionsDao.java Mon Nov 23 11:45:12 2015 +0100 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/TransactionsDao.java Fri Nov 20 14:20:55 2015 +0000 @@ -109,11 +109,13 @@ newTransaction.setStDimension(payment.getStDimension()); newTransaction.setNdDimension(payment.getNdDimension()); newTransaction.setCurrency(payment.getAccount().getCurrency()); - newTransaction.setDescription(payment - .getDescription() - .replace("\n", ". ") - .substring(0, - payment.getDescription().length() > 254 ? 254 : payment.getDescription().length())); + String desc = ""; + if(payment.getDescription()!=null && !payment.getDescription().isEmpty()){ + desc = payment.getDescription() + .replace("\n", ". ") + .substring(0, payment.getDescription().length() > 254 ? 254 : payment.getDescription().length()); + } + newTransaction.setDescription(desc); newTransaction.setClient(payment.getClient()); newTransaction.setLineNo(getTransactionMaxLineNo(payment.getAccount()) + 10); ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits