details:   https://code.openbravo.com/erp/devel/pi/rev/fcb60f9bbde5
changeset: 33411:fcb60f9bbde5
user:      Armaignac <collazoandy4 <at> gmail.com>
date:      Wed Feb 07 11:59:36 2018 -0500
summary:   Fixes issue 37763: Trial Balance Report sometimes returns null 
pointer exception
when include zero figures is checked.

When zero figures is checked the matches accounts are skipped from vector list
causing null entries when the vector values are copied with different sizes

Now the dataZeroFigures size is equal to the vector size to avoid null entries

diffstat:

 src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java |  10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r 17c6f2da9596 -r fcb60f9bbde5 
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java    Thu Feb 
08 09:25:40 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java    Wed Feb 
07 11:59:36 2018 -0500
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2018 Openbravo SLU 
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -1008,19 +1008,13 @@
         dataAccounts.add(data[i].id);
       }
       int j = 0;
-      int extra = 0;
       for (int i = 0; i < dataAccountCombinations.length; i++) {
         String accountId = dataAccountCombinations[i].id;
         if (dataAccounts.contains(accountId)) {
           int lastAccountMatch = dataAccounts.lastIndexOf(accountId);
-          int extraCount = 0;
           for (int k = j; k <= lastAccountMatch; k++) {
             vec.addElement(data[k]);
             j++;
-            if (extraCount > 0) {
-              extra++;
-            }
-            extraCount++;
           }
         } else {
           ReportTrialBalanceData[] dataProcess = ReportTrialBalanceData.set();
@@ -1034,7 +1028,7 @@
           vec.addElement(dataProcess[0]);
         }
       }
-      dataZeroFigures = new 
ReportTrialBalanceData[dataAccountCombinations.length + extra];
+      dataZeroFigures = new ReportTrialBalanceData[vec.size()];
       vec.copyInto(dataZeroFigures);
     }
     return dataZeroFigures;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to