Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0009328Openbravo ERPA. Platformpublic2009-06-04 09:422009-06-09 00:00
networkb 
iperdomo 
immediatemajoralways
closedfixed 
5
2.50MP1 
2.50MP2 
Core
No
0009328: String out of index: -1 error appears, when a jasper report contains a \n in one field
If a jasper contains an static field, for example the address, with a \n, the execution fails.

For example, a field like:

C/Mayor 5,

Pamplona

The problem is in AppsOpenbravo/src-core/src/org/openbravo/uiTransalation/TranslationHandler.java, in the method, createInputStream.
In the loop, a \n is considered as the final of the line, and </text> target is not found.


Create a jasper report.
Include an static field like:

Street,

City

(Note: it is really important to include a \n)

Compile it.
And execute it in the application

EROOR LOG:

org.openbravo.erpCommon.utility.reporting.ReportingException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at org.openbravo.erpCommon.utility.reporting.ReportManager.processReport(ReportManager.java:144)
    at org.openbravo.erpCommon.utility.reporting.ReportManager.saveTempReport(ReportManager.java:168)
    at org.openbravo.erpCommon.utility.reporting.printing.PrintController.post(PrintController.java:240)
    at org.openbravo.erpCommon.utility.reporting.printing.PrintInvoices.doPost(PrintInvoices.java:57)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at org.openbravo.base.HttpBaseServlet.serviceInitialized(HttpBaseServlet.java:225)
    at org.openbravo.base.secureApp.HttpSecureAppServlet.service(HttpSecureAppServlet.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.openbravo.utils.SessionExpirationFilter.doFilter(SessionExpirationFilter.java:66)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.openbravo.utils.CharsetFilter.doFilter(CharsetFilter.java:35)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.openbravo.dal.core.DalRequestFilter$1.doAction(DalRequestFilter.java:79)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46)
    at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:85)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1938)
    at org.openbravo.uiTranslation.TranslationHandler.createInputStream(TranslationHandler.java:176)
    at org.openbravo.uiTranslation.TranslationHandler.prepareFile(TranslationHandler.java:118)
    at org.openbravo.erpCommon.utility.Utility.getTranslatedJasperReport(Utility.java:2133)
    at org.openbravo.erpCommon.utility.reporting.ReportManager.processReport(ReportManager.java:126)
    ... 30 more
No tags attached.
related to defect 0006706 closed shuehner "/n" character is removed from jrxml file when executed through Openbravo 
png PrintingInvoice.png (167,736) 2009-06-04 11:34
https://issues.openbravo.com/file_download.php?file_id=1384&type=bug
png

pdf RptC_Invoice-240.jrxml.pdf (2,232) 2009-06-04 11:34
https://issues.openbravo.com/file_download.php?file_id=1385&type=bug
diff change-made-RptCInvoice.diff (1,175) 2009-06-04 11:34
https://issues.openbravo.com/file_download.php?file_id=1386&type=bug
Issue History
2009-06-04 09:42networkbNew Issue
2009-06-04 09:42networkbAssigned To => rafaroda
2009-06-04 11:20rafarodaRelationship addedrelated to 0006706
2009-06-04 11:34rafarodaNote Added: 0016943
2009-06-04 11:34rafarodaAssigned Torafaroda => iperdomo
2009-06-04 11:34rafarodaStatusnew => scheduled
2009-06-04 11:34rafarodaProposed Solution updated
2009-06-04 11:34rafarodaFile Added: PrintingInvoice.png
2009-06-04 11:34rafarodaFile Added: RptC_Invoice-240.jrxml.pdf
2009-06-04 11:34rafarodaFile Added: change-made-RptCInvoice.diff
2009-06-05 09:21hgbotCheckin
2009-06-05 09:21hgbotNote Added: 0016994
2009-06-05 09:21hgbotStatusscheduled => resolved
2009-06-05 09:21hgbotResolutionopen => fixed
2009-06-05 09:21hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/5251395c3c1399c35c90ad6d5b6f28e712e89611 [^]
2009-06-08 13:40psarobeStatusresolved => closed
2009-06-08 13:40psarobeFixed in Version => 2.50MP2
2009-06-09 00:00anonymoussf_bug_id0 => 2803195

Notes
(0016943)
rafaroda   
2009-06-04 11:34   
This issue has been able to reproduce in pi (see attached PrintInvoice.png) but not in 2.40 (see attached RptC_Invoice-240.jrxml.pdf). The change made to both erpReports/RptC_Invoice.jrxml files has been the one attached in change-made-RptCInvoice.diff.
(0016994)
hgbot   
2009-06-05 09:21   
Repository: erp/devel/pi
Changeset: 5251395c3c1399c35c90ad6d5b6f28e712e89611
Author: Iván Perdomo <ivan.perdomo <at> openbravo.com>
Date: Fri Jun 05 09:20:10 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5251395c3c1399c35c90ad6d5b6f28e712e89611 [^]

Fixes issue 9328: Prevent indexOutOfBounds when parsing a <text> tag

---
M src-core/src/org/openbravo/uiTranslation/TranslationHandler.java
---