diff --git a/pom.xml b/pom.xml index 71bc618..7ec84ec 100755 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,6 @@ 4.0.0 de.jlo.talendcomp jlo-talendcomp-jasperreportexec - 5.6 Jan Lolling http://jan-lolling.de @@ -24,7 +23,7 @@ net.sf.jasperreports jasperreports - 6.12.2 + 6.15.0 stax-api @@ -119,12 +118,12 @@ net.sf.jasperreports jasperreports-functions - 6.12.2 + 6.15.0 net.sf.jasperreports jasperreports-fonts - 6.12.2 + 6.15.0 org.apache.commons @@ -241,4 +240,5 @@ + 6.0 \ No newline at end of file diff --git a/src/main/java/de/jlo/talendcomp/jasperreportexec/JasperReportExecuter.java b/src/main/java/de/jlo/talendcomp/jasperreportexec/JasperReportExecuter.java index df76a37..1097999 100755 --- a/src/main/java/de/jlo/talendcomp/jasperreportexec/JasperReportExecuter.java +++ b/src/main/java/de/jlo/talendcomp/jasperreportexec/JasperReportExecuter.java @@ -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; @@ -165,7 +163,17 @@ public class JasperReportExecuter { private List 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; } @@ -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); @@ -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); } /** diff --git a/src/main/java/de/jlo/talendcomp/jasperreportexec/ReportResourceClassLoader.java b/src/main/java/de/jlo/talendcomp/jasperreportexec/ReportResourceClassLoader.java new file mode 100644 index 0000000..1bffba0 --- /dev/null +++ b/src/main/java/de/jlo/talendcomp/jasperreportexec/ReportResourceClassLoader.java @@ -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); + } + +} diff --git a/talend_component/tJasperReportExec/bcprov-jdk15on-1.62.jar b/talend_component/tJasperReportExec/bcprov-jdk15on-1.64.jar similarity index 55% rename from talend_component/tJasperReportExec/bcprov-jdk15on-1.62.jar rename to talend_component/tJasperReportExec/bcprov-jdk15on-1.64.jar index c52b16e..0cb3c8b 100644 Binary files a/talend_component/tJasperReportExec/bcprov-jdk15on-1.62.jar and b/talend_component/tJasperReportExec/bcprov-jdk15on-1.64.jar differ diff --git a/talend_component/tJasperReportExec/ecj-3.21.0.jar b/talend_component/tJasperReportExec/ecj-3.21.0.jar new file mode 100644 index 0000000..04217bc Binary files /dev/null and b/talend_component/tJasperReportExec/ecj-3.21.0.jar differ diff --git a/talend_component/tJasperReportExec/ecj-4.4.2.jar b/talend_component/tJasperReportExec/ecj-4.4.2.jar deleted file mode 100644 index d9411b3..0000000 Binary files a/talend_component/tJasperReportExec/ecj-4.4.2.jar and /dev/null differ diff --git a/talend_component/tJasperReportExec/itext-2.1.7.js7.jar b/talend_component/tJasperReportExec/itext-2.1.7.js8.jar similarity index 93% rename from talend_component/tJasperReportExec/itext-2.1.7.js7.jar rename to talend_component/tJasperReportExec/itext-2.1.7.js8.jar index 7df9279..a03fce0 100644 Binary files a/talend_component/tJasperReportExec/itext-2.1.7.js7.jar and b/talend_component/tJasperReportExec/itext-2.1.7.js8.jar differ diff --git a/talend_component/tJasperReportExec/jasperreports-6.12.2.jar b/talend_component/tJasperReportExec/jasperreports-6.15.0.jar similarity index 77% rename from talend_component/tJasperReportExec/jasperreports-6.12.2.jar rename to talend_component/tJasperReportExec/jasperreports-6.15.0.jar index 6742dc6..a89ea55 100644 Binary files a/talend_component/tJasperReportExec/jasperreports-6.12.2.jar and b/talend_component/tJasperReportExec/jasperreports-6.15.0.jar differ diff --git a/talend_component/tJasperReportExec/jasperreports-fonts-6.12.2.jar b/talend_component/tJasperReportExec/jasperreports-fonts-6.15.0.jar similarity index 99% rename from talend_component/tJasperReportExec/jasperreports-fonts-6.12.2.jar rename to talend_component/tJasperReportExec/jasperreports-fonts-6.15.0.jar index 57bc579..e9524fb 100644 Binary files a/talend_component/tJasperReportExec/jasperreports-fonts-6.12.2.jar and b/talend_component/tJasperReportExec/jasperreports-fonts-6.15.0.jar differ diff --git a/talend_component/tJasperReportExec/jasperreports-functions-6.12.2.jar b/talend_component/tJasperReportExec/jasperreports-functions-6.15.0.jar similarity index 63% rename from talend_component/tJasperReportExec/jasperreports-functions-6.12.2.jar rename to talend_component/tJasperReportExec/jasperreports-functions-6.15.0.jar index e41d302..2147492 100644 Binary files a/talend_component/tJasperReportExec/jasperreports-functions-6.12.2.jar and b/talend_component/tJasperReportExec/jasperreports-functions-6.15.0.jar differ diff --git a/talend_component/tJasperReportExec/jlo-talendcomp-jasperreportexec-5.6.jar b/talend_component/tJasperReportExec/jlo-talendcomp-jasperreportexec-5.6.jar deleted file mode 100644 index d24edf5..0000000 Binary files a/talend_component/tJasperReportExec/jlo-talendcomp-jasperreportexec-5.6.jar and /dev/null differ diff --git a/talend_component/tJasperReportExec/jlo-talendcomp-jasperreportexec-6.0.jar b/talend_component/tJasperReportExec/jlo-talendcomp-jasperreportexec-6.0.jar new file mode 100644 index 0000000..47e0456 Binary files /dev/null and b/talend_component/tJasperReportExec/jlo-talendcomp-jasperreportexec-6.0.jar differ diff --git a/talend_component/tJasperReportExec/tJasperReportExec_java.xml b/talend_component/tJasperReportExec/tJasperReportExec_java.xml index 1dfb31d..0915999 100755 --- a/talend_component/tJasperReportExec/tJasperReportExec_java.xml +++ b/talend_component/tJasperReportExec/tJasperReportExec_java.xml @@ -1,7 +1,7 @@ -
+
@@ -228,30 +228,30 @@ true - - Release: 5.6 build at: 20200518 + + Release: 6.0 build at: 20201013 - - + + - - + + - + - - + +