Skip to content

Commit

Permalink
Update JasperLibrary to version 6.15
Browse files Browse the repository at this point in the history
Bug fixed preventing component running under Java 11
  • Loading branch information
jlolling committed Oct 13, 2020
1 parent d04e00d commit 3a9a2de
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 27 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.jlo.talendcomp</groupId>
<artifactId>jlo-talendcomp-jasperreportexec</artifactId>
<version>5.6</version>
<organization>
<name>Jan Lolling</name>
<url>http://jan-lolling.de</url>
Expand All @@ -24,7 +23,7 @@
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.12.2</version>
<version>6.15.0</version>
<exclusions>
<exclusion>
<artifactId>stax-api</artifactId>
Expand Down Expand Up @@ -119,12 +118,12 @@
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-functions</artifactId>
<version>6.12.2</version>
<version>6.15.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.12.2</version>
<version>6.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -241,4 +240,5 @@
</plugin>
</plugins>
</build>
<version>6.0</version>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.Writer;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Connection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
Expand Down Expand Up @@ -165,7 +163,17 @@ public class JasperReportExecuter {
private List<JRParameter> listJRParameters = null;
private boolean printJRParameters = false;
private boolean replaceJrxmlRef = true;
private static final Object lock = new Object();
private static ReportResourceClassLoader resourceClassLoader;

public JasperReportExecuter() {
synchronized(lock) {
if (resourceClassLoader == null) {
resourceClassLoader = new ReportResourceClassLoader(new URL[0], this.getClass().getClassLoader());
}
}
}

public String getOutputDir() {
return outputDir;
}
Expand Down Expand Up @@ -397,8 +405,8 @@ private void compileReport(String jrxmlFilePath, boolean isMainReport) throws Ex
try {
addPathToClasspath(baseDir);
} catch (Exception e) {
String message = "Failed to add dir " + baseDir.getAbsolutePath()
+ " to classpath." + e.getMessage();
String message = "Failed to add dir: " + baseDir.getAbsolutePath()
+ " to classpath. Message: " + e.getMessage();
throw new Exception(message, e);
}
final File currentJrxmlFile = new File(jrxmlFilePath);
Expand Down Expand Up @@ -1100,16 +1108,9 @@ public void setFixLanguage(boolean fixLanguage) {
this.fixLanguage = fixLanguage;
}

private static void addPathToClasspath(File dir) throws Exception {
private void addPathToClasspath(File dir) throws Exception {
URL url = dir.toURI().toURL();
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader
.getSystemClassLoader();
Class<?> urlClass = URLClassLoader.class;
Method method = urlClass.getDeclaredMethod(
"addURL",
new Class[] { URL.class }); // already existing URLs will be ignored
method.setAccessible(true);
method.invoke(urlClassLoader, new Object[] { url });
resourceClassLoader.addURL(url);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package de.jlo.talendcomp.jasperreportexec;

import java.net.URL;
import java.net.URLClassLoader;

public class ReportResourceClassLoader extends URLClassLoader {

public ReportResourceClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}

@Override
public void addURL(URL url) {
super.addURL(url);
}

}
Binary file not shown.
Binary file added talend_component/tJasperReportExec/ecj-3.21.0.jar
Binary file not shown.
Binary file removed talend_component/tJasperReportExec/ecj-4.4.2.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
20 changes: 10 additions & 10 deletions talend_component/tJasperReportExec/tJasperReportExec_java.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="5.6" STATUS="PROD" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20200518" STARTABLE="true">
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="6.0" STATUS="PROD" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20201013" STARTABLE="true">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -228,30 +228,30 @@
<PARAMETER NAME="DIE_ON_ERROR" FIELD="CHECK" NUM_ROW="130">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20200518" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 5.6 build at: 20200518</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20201013" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 6.0 build at: 20201013</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="jlo-talendcomp-jasperreportexec" MODULE="jlo-talendcomp-jasperreportexec-5.6.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-jasperreportexec-5.6/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jasperreports" MODULE="jasperreports-6.12.2.jar" MVN="mvn:org.talend.libraries/jasperreports-6.12.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jlo-talendcomp-jasperreportexec" MODULE="jlo-talendcomp-jasperreportexec-6.0.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-jasperreportexec-6.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jasperreports" MODULE="jasperreports-6.15.0.jar" MVN="mvn:org.talend.libraries/jasperreports-6.15.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-beanutils" MODULE="commons-beanutils-1.9.4.jar" MVN="mvn:org.talend.libraries/commons-beanutils-1.9.4/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-collections" MODULE="commons-collections-3.2.2.jar" MVN="mvn:org.talend.libraries/commons-collections-3.2.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-digester" MODULE="commons-digester-2.1.jar" MVN="mvn:org.talend.libraries/commons-digester-2.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-logging" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-collections4" MODULE="commons-collections4-4.2.jar" MVN="mvn:org.talend.libraries/commons-collections4-4.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="itext" MODULE="itext-2.1.7.js7.jar" MVN="mvn:org.talend.libraries/itext-2.1.7.js7/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="bcprov-jdk15on" MODULE="bcprov-jdk15on-1.62.jar" MVN="mvn:org.talend.libraries/bcprov-jdk15on-1.62/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="itext" MODULE="itext-2.1.7.js8.jar" MVN="mvn:org.talend.libraries/itext-2.1.7.js8/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="bcprov-jdk15on" MODULE="bcprov-jdk15on-1.64.jar" MVN="mvn:org.talend.libraries/bcprov-jdk15on-1.64/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jcommon" MODULE="jcommon-1.0.23.jar" MVN="mvn:org.talend.libraries/jcommon-1.0.23/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jfreechart" MODULE="jfreechart-1.0.19.jar" MVN="mvn:org.talend.libraries/jfreechart-1.0.19/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="ecj" MODULE="ecj-4.4.2.jar" MVN="mvn:org.talend.libraries/ecj-4.4.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="ecj" MODULE="ecj-3.21.0.jar" MVN="mvn:org.talend.libraries/ecj-3.21.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="castor-xml" MODULE="castor-xml-1.4.1.jar" MVN="mvn:org.talend.libraries/castor-xml-1.4.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="castor-core" MODULE="castor-core-1.4.1.jar" MVN="mvn:org.talend.libraries/castor-core-1.4.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-lang3" MODULE="commons-lang3-3.4.jar" MVN="mvn:org.talend.libraries/commons-lang3-3.4/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jackson-databind" MODULE="jackson-databind-2.10.0.jar" MVN="mvn:org.talend.libraries/jackson-databind-2.10.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jasperreports-functions" MODULE="jasperreports-functions-6.12.2.jar" MVN="mvn:org.talend.libraries/jasperreports-functions-6.12.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jasperreports-fonts" MODULE="jasperreports-fonts-6.12.2.jar" MVN="mvn:org.talend.libraries/jasperreports-fonts-6.12.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jasperreports-functions" MODULE="jasperreports-functions-6.15.0.jar" MVN="mvn:org.talend.libraries/jasperreports-functions-6.15.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jasperreports-fonts" MODULE="jasperreports-fonts-6.15.0.jar" MVN="mvn:org.talend.libraries/jasperreports-fonts-6.15.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-io" MODULE="commons-io-1.3.2.jar" MVN="mvn:org.talend.libraries/commons-io-1.3.2/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.20.jar" MVN="mvn:org.talend.libraries/commons-compress-1.20/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="joda-time" MODULE="joda-time-2.10.5.jar" MVN="mvn:org.talend.libraries/joda-time-2.10.5/6.0.0-SNAPSHOT" REQUIRED="true"/>
Expand Down

0 comments on commit 3a9a2de

Please sign in to comment.