[#9676] - Jasper reports library uses URLs as Map/Set keys - leads to DNS requests and occassional/sporadic delays

Category:
Bug report
Priority:
Normal
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Random
Assigned to:
1

The Jasper Reports library uses URLs as Map/Set keys:
http://www.grepcode.com/file/repo1.maven.org/maven2/net.sf.jasperreports...

There are potential problems with this, as every time a URLs hashCode()/equals() methods are used a DNS request may be performed:
http://www.eishay.com/2008/04/javas-url-little-secret.html
https://bugs.openjdk.java.net/browse/JDK-6810437
The recommendation of JDK developers is to use URIs in Map/Set collections instead.

This (performing host name lookups) depends on the underlying URL stream handler implementation. The problem does not apply equally to all environments where the Jasper reports library may be deployed. For instance JAR URLs in a static class-path have no such problem. On the the other hand HTTP URLs returned by a URLClassLoader may cause DNS lookups. We have seen specific problems in a JBoss OSGi environment:
http://grepcode.com/file/repository.jboss.org/nexus/content/repositories...
If the DNS service for some reason does not answer fast enough this leads to applications delays. In addition if DNS does not perform very reliably this leads to the impression that the application itself has sporadic delays in Jasper Reports generation etc.

I believe the best place to fix this is the Jasper Reports library - use URIs in Map/Set collections instead.

v5.5.1
JasperReports
appropriator's picture
Joined: Jul 17 2012 - 6:53am
Last seen: 2 weeks 2 days ago
Feedback