Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0043591
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] A. Platformminoralways2020-03-20 13:542020-04-02 08:46
ReporterguillermogilView Statuspublic 
Assigned Toalostale 
PriorityhighResolutionfixedFixed in Version3.0PR20Q1.1
StatusclosedFix in branchFixed in SCM revision602682efc345
ProjectionnoneETAnoneTarget Version3.0PR20Q1.1
OSAnyDatabaseAnyJava version>=9
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0043591: jrxml translate build step fails if using jasperreport.dtd

DescriptionWhen a jrxml file makes use of jasperreport.dtd, translate build step fails executing with JDK 9+:

Compilation fails in case of an external dtd is used on a JRXML file:
     [java] 1770 [main] ERROR org.openbravo.translate.Translate - file: /XX/XX/XX/XX.jrxml
     [java] java.net.MalformedURLException: null
     [java] at java.net.URL.<init>(URL.java:679) ~[?:?]
     [java] at java.net.URL.<init>(URL.java:541) ~[?:?]
     [java] at java.net.URL.<init>(URL.java:488) ~[?:?]
     [java] at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) ~[xercesImpl.jar:?]
     [java] at org.openbravo.translate.Translate.parseFile(Translate.java:251) [openbravo-trl.jar:?]
     [java] at org.openbravo.translate.Translate$1.visitFile(Translate.java:219) [openbravo-trl.jar:?]
     [java] at org.openbravo.translate.Translate$1.visitFile(Translate.java:208) [openbravo-trl.jar:?]
     [java] at java.nio.file.Files.walkFileTree(Files.java:2724) [?:?]
     [java] at java.nio.file.Files.walkFileTree(Files.java:2796) [?:?]
     [java] at org.openbravo.translate.Translate.execute(Translate.java:208) [openbravo-trl.jar:?]
     [java] at org.openbravo.translate.Translate.main(Translate.java:166) [openbravo-trl.jar:?]
     [java] Caused by: java.lang.NullPointerException
     [java] at java.net.URL.<init>(URL.java:585) ~[?:?]
     [java] ... 19 more
Steps To Reproduce1. Add to C_Order.jrxml the following:
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> [^]
2. Set core module in development
3. run ant smartbuild (sing JDK 11)
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0043532 closedalostale jrxml translate build step fails if using jasperreport.dtd 

-  Notes
(0118865)
hgbot (developer)
2020-03-30 10:27

Repository: erp/backports/3.0PR20Q1.1
Changeset: 602682efc345362ded2a3bcd737fd2fa37121bff
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Mar 26 12:25:43 2020 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR20Q1.1/rev/602682efc345362ded2a3bcd737fd2fa37121bff [^]

fixed BUG-43591: jrxml translate build step fails if using jasperreport.dtd

Translate makes use of a custom EntityResolver to handle jasperreport.dtd
resolving it locally instead of getting it from Internet. This local
resolution is implemented making use of Class.getResourceAsStream
method. The class the method was invoked from was java.lang.System.

Starting from JDK 9, getResourceAsStream invoked in classes within named
Modules looks for the resources only in those modules rather than in the
whole classpath [1]:

  > If this class is in a named Module then this method will attempt to find
  > the resource in the module. This is done by delegating to the module's class
  > loader findResource(String,String) method, invoking it with the module name
  > and the absolute name of the resource. Resources in named modules are subject
  > to the rules for encapsulation specified in the Module getResourceAsStream
  > method and so this method returns null when the resource is a non-".class"
  > resource in a package that is not open to the caller's module.
  >
  > Otherwise, if this class is not in a named module then the rules for searching
  > resources associated with a given class are implemented by the defining class
  > loader of the class. This method delegates to this object's class loader. If
  > this object was loaded by the bootstrap class loader, the method delegates to
  > ClassLoader.getSystemResourceAsStream(java.lang.String).

As java.lang.System is in a named Module, dtd's resource was tried to be found within
it and not found.

Fixed by invoking getResourceAsStream on LocalEntityResolver.class which
is not in a named module.

[1] https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html#getResourceAsStream(java.lang.String) [^]

---
M src-trl/src/org/openbravo/translate/LocalEntityResolver.java
---
(0118909)
caristu (developer)
2020-04-02 08:46

Reviewed

- Issue History
Date Modified Username Field Change
2020-03-26 13:18 alostale Type defect => backport
2020-03-26 13:18 alostale Target Version => 3.0PR20Q1.1
2020-03-30 10:27 hgbot Checkin
2020-03-30 10:27 hgbot Note Added: 0118865
2020-03-30 10:27 hgbot Status scheduled => resolved
2020-03-30 10:27 hgbot Resolution open => fixed
2020-03-30 10:27 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR20Q1.1/rev/602682efc345362ded2a3bcd737fd2fa37121bff [^]
2020-04-02 08:46 caristu Note Added: 0118909
2020-04-02 08:46 caristu Status resolved => closed
2020-04-02 08:46 caristu Fixed in Version => 3.0PR20Q1.1


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker