IDEMPIERE-310 JasperReport: Compilation of JRXML is broken

IDEMPIERE-311 JasperReport: Loading pdf font from classpath is not working
This commit is contained in:
Heng Sin Low 2012-06-20 15:11:42 +08:00
parent 53232346e0
commit 7f0893c592
21 changed files with 384 additions and 207 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="groovy.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<accessrules> <accessrules>
<accessrule kind="accessible" pattern="com/sun/rowset/*"/> <accessrule kind="accessible" pattern="com/sun/rowset/*"/>
@ -9,7 +10,6 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="bsh-2.0b5.jar"/> <classpathentry exported="true" kind="lib" path="bsh-2.0b5.jar"/>
<classpathentry exported="true" kind="lib" path="bsh-engine.jar"/> <classpathentry exported="true" kind="lib" path="bsh-engine.jar"/>
<classpathentry exported="true" kind="lib" path="groovy-all-1.5.1.jar"/>
<classpathentry exported="true" kind="lib" path="groovy-engine.jar"/> <classpathentry exported="true" kind="lib" path="groovy-engine.jar"/>
<classpathentry exported="true" kind="lib" path="jython-engine.jar"/> <classpathentry exported="true" kind="lib" path="jython-engine.jar"/>
<classpathentry exported="true" kind="lib" path="jython.jar"/> <classpathentry exported="true" kind="lib" path="jython.jar"/>

View File

@ -6,7 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: base.jar, Bundle-ClassPath: base.jar,
bsh-2.0b5.jar, bsh-2.0b5.jar,
bsh-engine.jar, bsh-engine.jar,
groovy-all-1.5.1.jar,
groovy-engine.jar, groovy-engine.jar,
jython-engine.jar, jython-engine.jar,
jython.jar, jython.jar,
@ -15,8 +14,17 @@ Bundle-ClassPath: base.jar,
iText-2.1.7.jar, iText-2.1.7.jar,
jcommon-1.0.16.jar, jcommon-1.0.16.jar,
jfreechart-1.0.13.jar, jfreechart-1.0.13.jar,
jnlp.jar jnlp.jar,
groovy.jar
Export-Package: bsh, Export-Package: bsh,
bsh.classpath,
bsh.collection,
bsh.commands,
bsh.engine,
bsh.org.objectweb.asm,
bsh.reflect,
bsh.servlet,
bsh.util,
com.akunagroup.uk.postcode, com.akunagroup.uk.postcode,
com.lowagie.text, com.lowagie.text,
com.lowagie.text.exceptions, com.lowagie.text.exceptions,
@ -40,8 +48,46 @@ Export-Package: bsh,
com.lowagie.text.xml.simpleparser, com.lowagie.text.xml.simpleparser,
com.lowagie.text.xml.xmp, com.lowagie.text.xml.xmp,
com.lowagie.tools, com.lowagie.tools,
groovy.inspect,
groovy.inspect.swingui,
groovy.io,
groovy.lang, groovy.lang,
groovy.mock,
groovy.mock.interceptor,
groovy.model,
groovy.security,
groovy.servlet,
groovy.sql,
groovy.swing,
groovy.swing.binding,
groovy.swing.factory,
groovy.swing.impl,
groovy.text,
groovy.time,
groovy.ui, groovy.ui,
groovy.ui.text,
groovy.ui.view,
groovy.util,
groovy.util.slurpersupport,
groovy.xml,
groovy.xml.dom,
groovy.xml.streamingmarkupsupport,
groovyjarjarantlr,
groovyjarjarantlr.ASdebug,
groovyjarjarantlr.actions.cpp,
groovyjarjarantlr.actions.csharp,
groovyjarjarantlr.actions.java,
groovyjarjarantlr.actions.python,
groovyjarjarantlr.build,
groovyjarjarantlr.collections,
groovyjarjarantlr.collections.impl,
groovyjarjarantlr.debug,
groovyjarjarantlr.debug.misc,
groovyjarjarantlr.preprocessor,
groovyjarjarasm.asm,
groovyjarjarasm.asm.signature,
groovyjarjarasm.asm.tree,
groovyjarjarcommonscli,
it.sauronsoftware.cron4j, it.sauronsoftware.cron4j,
javax.jnlp, javax.jnlp,
net.sourceforge.barbecue, net.sourceforge.barbecue,
@ -67,6 +113,38 @@ Export-Package: bsh,
org.adempiere.print.export, org.adempiere.print.export,
org.adempiere.process, org.adempiere.process,
org.adempiere.util, org.adempiere.util,
org.codehaus.groovy,
org.codehaus.groovy.ant,
org.codehaus.groovy.antlr,
org.codehaus.groovy.antlr.java,
org.codehaus.groovy.antlr.parser,
org.codehaus.groovy.antlr.treewalker,
org.codehaus.groovy.ast,
org.codehaus.groovy.ast.expr,
org.codehaus.groovy.ast.stmt,
org.codehaus.groovy.binding,
org.codehaus.groovy.bsf,
org.codehaus.groovy.classgen,
org.codehaus.groovy.control,
org.codehaus.groovy.control.io,
org.codehaus.groovy.control.messages,
org.codehaus.groovy.groovydoc,
org.codehaus.groovy.reflection,
org.codehaus.groovy.runtime,
org.codehaus.groovy.runtime.metaclass,
org.codehaus.groovy.runtime.typehandling,
org.codehaus.groovy.runtime.wrappers,
org.codehaus.groovy.syntax,
org.codehaus.groovy.tools,
org.codehaus.groovy.tools.groovydoc,
org.codehaus.groovy.tools.javac,
org.codehaus.groovy.tools.shell,
org.codehaus.groovy.tools.shell.commands,
org.codehaus.groovy.tools.shell.util,
org.codehaus.groovy.tools.xml,
org.codehaus.groovy.vmplugin,
org.codehaus.groovy.vmplugin.v4,
org.codehaus.groovy.vmplugin.v5,
org.compiere, org.compiere,
org.compiere.FA, org.compiere.FA,
org.compiere.acct, org.compiere.acct,

View File

@ -3,7 +3,6 @@ bin.includes = META-INF/,\
plugin.xml,\ plugin.xml,\
bsh-2.0b5.jar,\ bsh-2.0b5.jar,\
bsh-engine.jar,\ bsh-engine.jar,\
groovy-all-1.5.1.jar,\
groovy-engine.jar,\ groovy-engine.jar,\
jython-engine.jar,\ jython-engine.jar,\
jython.jar,\ jython.jar,\
@ -13,7 +12,8 @@ bin.includes = META-INF/,\
jcommon-1.0.16.jar,\ jcommon-1.0.16.jar,\
jfreechart-1.0.13.jar,\ jfreechart-1.0.13.jar,\
jnlp.jar,\ jnlp.jar,\
OSGI-INF/ OSGI-INF/,\
groovy.jar
output.base.jar = build/ output.base.jar = build/
source.base.jar = src/ source.base.jar = src/
src.includes = schema/ src.includes = schema/

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.adempiere.report.jasper.font.demo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,8 @@
#Tue Jun 19 21:29:53 MYT 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -0,0 +1,4 @@
#Tue Jun 19 21:29:53 MYT 2012
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false

View File

@ -0,0 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JasperReport Font Demo
Bundle-SymbolicName: org.adempiere.report.jasper.font.demo
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Fragment-Host: org.adempiere.report.jasper.library;bundle-version="1.0.0"

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="lib/ecj-3.7.2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.7.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-digester-1.7.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-digester-1.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/iReport.jar"/> <classpathentry exported="true" kind="lib" path="lib/iReport.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jasperreports-3.7.3.jar"/> <classpathentry exported="true" kind="lib" path="lib/jasperreports-3.7.3.jar" sourcepath="lib/jasperreports-3.7.3-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.13.jar"/> <classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.13.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -7,7 +7,8 @@ Bundle-ClassPath: lib/commons-beanutils-1.7.jar,
lib/commons-digester-1.7.jar, lib/commons-digester-1.7.jar,
lib/iReport.jar, lib/iReport.jar,
lib/jasperreports-3.7.3.jar, lib/jasperreports-3.7.3.jar,
lib/jfreechart-1.0.13.jar lib/jfreechart-1.0.13.jar,
lib/ecj-3.7.2.jar
Export-Package: ., Export-Package: .,
be.savat.components, be.savat.components,
it.businesslogic.ireport, it.businesslogic.ireport,
@ -98,6 +99,7 @@ Export-Package: .,
net.sf.jasperreports.charts.base, net.sf.jasperreports.charts.base,
net.sf.jasperreports.charts.design, net.sf.jasperreports.charts.design,
net.sf.jasperreports.charts.fill, net.sf.jasperreports.charts.fill,
net.sf.jasperreports.charts.type,
net.sf.jasperreports.charts.util, net.sf.jasperreports.charts.util,
net.sf.jasperreports.charts.xml, net.sf.jasperreports.charts.xml,
net.sf.jasperreports.compilers, net.sf.jasperreports.compilers,
@ -105,11 +107,14 @@ Export-Package: .,
net.sf.jasperreports.components.barbecue, net.sf.jasperreports.components.barbecue,
net.sf.jasperreports.components.barcode4j, net.sf.jasperreports.components.barcode4j,
net.sf.jasperreports.components.list, net.sf.jasperreports.components.list,
net.sf.jasperreports.components.table,
net.sf.jasperreports.components.table.fill,
net.sf.jasperreports.crosstabs, net.sf.jasperreports.crosstabs,
net.sf.jasperreports.crosstabs.base, net.sf.jasperreports.crosstabs.base,
net.sf.jasperreports.crosstabs.design, net.sf.jasperreports.crosstabs.design,
net.sf.jasperreports.crosstabs.fill, net.sf.jasperreports.crosstabs.fill,
net.sf.jasperreports.crosstabs.fill.calculation, net.sf.jasperreports.crosstabs.fill.calculation,
net.sf.jasperreports.crosstabs.type,
net.sf.jasperreports.crosstabs.xml, net.sf.jasperreports.crosstabs.xml,
net.sf.jasperreports.engine, net.sf.jasperreports.engine,
net.sf.jasperreports.engine.base, net.sf.jasperreports.engine.base,
@ -133,6 +138,7 @@ Export-Package: .,
net.sf.jasperreports.engine.print, net.sf.jasperreports.engine.print,
net.sf.jasperreports.engine.query, net.sf.jasperreports.engine.query,
net.sf.jasperreports.engine.scriptlets, net.sf.jasperreports.engine.scriptlets,
net.sf.jasperreports.engine.type,
net.sf.jasperreports.engine.util, net.sf.jasperreports.engine.util,
net.sf.jasperreports.engine.util.xml, net.sf.jasperreports.engine.util.xml,
net.sf.jasperreports.engine.xml, net.sf.jasperreports.engine.xml,
@ -200,6 +206,46 @@ Export-Package: .,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.lowagie.text, Import-Package: com.lowagie.text,
com.lowagie.text.pdf, com.lowagie.text.pdf,
groovy.inspect,
groovy.inspect.swingui,
groovy.io,
groovy.lang,
groovy.mock,
groovy.mock.interceptor,
groovy.model,
groovy.security,
groovy.servlet,
groovy.sql,
groovy.swing,
groovy.swing.binding,
groovy.swing.factory,
groovy.swing.impl,
groovy.text,
groovy.time,
groovy.ui,
groovy.ui.text,
groovy.ui.view,
groovy.util,
groovy.util.slurpersupport,
groovy.xml,
groovy.xml.dom,
groovy.xml.streamingmarkupsupport,
groovyjarjarantlr,
groovyjarjarantlr.ASdebug,
groovyjarjarantlr.actions.cpp,
groovyjarjarantlr.actions.csharp,
groovyjarjarantlr.actions.java,
groovyjarjarantlr.actions.python,
groovyjarjarantlr.build,
groovyjarjarantlr.collections,
groovyjarjarantlr.collections.impl,
groovyjarjarantlr.debug,
groovyjarjarantlr.debug.misc,
groovyjarjarantlr.preprocessor,
groovyjarjarasm.asm,
groovyjarjarasm.asm.signature,
groovyjarjarasm.asm.tree,
groovyjarjarcommonscli,
org.apache.commons.codec;version="1.3.0", org.apache.commons.codec;version="1.3.0",
org.apache.commons.codec.binary;version="1.3.0", org.apache.commons.codec.binary;version="1.3.0",
org.apache.commons.collections, org.apache.commons.collections,
@ -208,4 +254,38 @@ Import-Package: com.lowagie.text,
org.apache.poi.hssf.usermodel;version="3.7.0", org.apache.poi.hssf.usermodel;version="3.7.0",
org.apache.poi.hssf.util;version="3.7.0", org.apache.poi.hssf.util;version="3.7.0",
org.apache.poi.ss.usermodel;version="3.7.0", org.apache.poi.ss.usermodel;version="3.7.0",
org.apache.poi.ss.util;version="3.7.0" org.apache.poi.ss.util;version="3.7.0",
org.codehaus.groovy,
org.codehaus.groovy.ant,
org.codehaus.groovy.antlr,
org.codehaus.groovy.antlr.java,
org.codehaus.groovy.antlr.parser,
org.codehaus.groovy.antlr.treewalker,
org.codehaus.groovy.ast,
org.codehaus.groovy.ast.expr,
org.codehaus.groovy.ast.stmt,
org.codehaus.groovy.binding,
org.codehaus.groovy.bsf,
org.codehaus.groovy.classgen,
org.codehaus.groovy.control,
org.codehaus.groovy.control.io,
org.codehaus.groovy.control.messages,
org.codehaus.groovy.groovydoc,
org.codehaus.groovy.reflection,
org.codehaus.groovy.runtime,
org.codehaus.groovy.runtime.metaclass,
org.codehaus.groovy.runtime.typehandling,
org.codehaus.groovy.runtime.wrappers,
org.codehaus.groovy.syntax,
org.codehaus.groovy.tools,
org.codehaus.groovy.tools.groovydoc,
org.codehaus.groovy.tools.javac,
org.codehaus.groovy.tools.shell,
org.codehaus.groovy.tools.shell.commands,
org.codehaus.groovy.tools.shell.util,
org.codehaus.groovy.tools.xml,
org.codehaus.groovy.vmplugin,
org.codehaus.groovy.vmplugin.v4,
org.codehaus.groovy.vmplugin.v5
Eclipse-BuddyPolicy: registered

View File

@ -3,4 +3,5 @@ bin.includes = META-INF/,\
lib/commons-digester-1.7.jar,\ lib/commons-digester-1.7.jar,\
lib/iReport.jar,\ lib/iReport.jar,\
lib/jasperreports-3.7.3.jar,\ lib/jasperreports-3.7.3.jar,\
lib/jfreechart-1.0.13.jar lib/jfreechart-1.0.13.jar,\
lib/ecj-3.7.2.jar

View File

@ -2,7 +2,7 @@
<!-- Created using an evaluation version of JasperAssistant (http://www.jasperassistant.com) --> <!-- Created using an evaluation version of JasperAssistant (http://www.jasperassistant.com) -->
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="standalone" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30"> <jasperReport language="groovy" name="standalone" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">
<title> <title>
<band height="782"> <band height="782">
<staticText> <staticText>

View File

@ -51,14 +51,15 @@ import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JRParameter; import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRPrintServiceExporter; import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter; import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter;
import net.sf.jasperreports.engine.fill.JRSwapFileVirtualizer; import net.sf.jasperreports.engine.fill.JRSwapFileVirtualizer;
import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.util.JRProperties;
import net.sf.jasperreports.engine.util.JRSwapFile; import net.sf.jasperreports.engine.util.JRSwapFile;
import org.adempiere.base.Service; import org.adempiere.base.Service;
@ -315,6 +316,22 @@ public class ReportStarter implements ProcessCall, ClientProcess
* @return true if success * @return true if success
*/ */
public boolean startProcess(Properties ctx, ProcessInfo pi, Trx trx) public boolean startProcess(Properties ctx, ProcessInfo pi, Trx trx)
{
ClassLoader cl1 = Thread.currentThread().getContextClassLoader();
ClassLoader cl2 = getClass().getClassLoader();
try {
if (!cl1.equals(cl2)) {
Thread.currentThread().setContextClassLoader(cl2);
}
return startProcess0(ctx, pi, trx);
} finally {
if (!cl1.equals(cl2)) {
Thread.currentThread().setContextClassLoader(cl1);
}
}
}
private boolean startProcess0(Properties ctx, ProcessInfo pi, Trx trx)
{ {
processInfo = pi; processInfo = pi;
String Name=pi.getTitle(); String Name=pi.getTitle();
@ -378,7 +395,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
File reportDir = data.getReportDir(); File reportDir = data.getReportDir();
// Add reportDir to class path // Add reportDir to class path
ClassLoader scl = ClassLoader.getSystemClassLoader(); ClassLoader scl = getClass().getClassLoader();
try { try {
java.net.URLClassLoader ucl = new java.net.URLClassLoader(new java.net.URL[]{reportDir.toURI().toURL()}, scl); java.net.URLClassLoader ucl = new java.net.URLClassLoader(new java.net.URL[]{reportDir.toURI().toURL()}, scl);
net.sf.jasperreports.engine.util.JRResourcesUtil.setThreadClassLoader(ucl); net.sf.jasperreports.engine.util.JRResourcesUtil.setThreadClassLoader(ucl);
@ -504,7 +521,8 @@ public class ReportStarter implements ProcessCall, ClientProcess
JRSwapFile swapFile = new JRSwapFile(swapPath, 1024, 1024); JRSwapFile swapFile = new JRSwapFile(swapPath, 1024, 1024);
JRSwapFileVirtualizer virtualizer = new JRSwapFileVirtualizer(2, swapFile, true); JRSwapFileVirtualizer virtualizer = new JRSwapFileVirtualizer(2, swapFile, true);
params.put(JRParameter.REPORT_VIRTUALIZER, virtualizer); params.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);
JRProperties.setProperty("net.sf.jasperreports.awt.ignore.missing.font", true);
JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, conn); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, conn);
if (reportData.isDirectPrint()) if (reportData.isDirectPrint())
{ {
@ -550,8 +568,12 @@ public class ReportStarter implements ProcessCall, ClientProcess
// Used For the PH // Used For the PH
try try
{ {
File PDF = File.createTempFile("mail", ".pdf"); File PDF = File.createTempFile(makePrefix(jasperPrint.getName()), ".pdf");
JasperExportManager.exportReportToPdfFile(jasperPrint, PDF.getAbsolutePath()); JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, PDF.getAbsolutePath());
exporter.setParameter(JRExporterParameter.CLASS_LOADER, this.getClass().getClassLoader());
exporter.exportReport();
processInfo.setPDFReport(PDF); processInfo.setPDFReport(PDF);
} }
catch (IOException e) catch (IOException e)
@ -587,6 +609,18 @@ public class ReportStarter implements ProcessCall, ClientProcess
return jasperPrint; return jasperPrint;
} }
private String makePrefix(String name) {
StringBuffer prefix = new StringBuffer();
char[] nameArray = name.toCharArray();
for (char ch : nameArray) {
if (Character.isLetterOrDigit(ch)) {
prefix.append(ch);
} else {
prefix.append("_");
}
}
return prefix.toString();
}
/** /**
* Get .property resource file from process attachment * Get .property resource file from process attachment
@ -986,73 +1020,6 @@ public class ReportStarter implements ProcessCall, ClientProcess
} }
} }
/**
* @author rlemeill
* Correct the class path if loaded from java web start
*/
private void JWScorrectClassPath()
{
URL jasperreportsAbsoluteURL = Thread.currentThread().getContextClassLoader().getResource("net/sf/jasperreports/engine");
String jasperreportsAbsolutePath = "";
if(jasperreportsAbsoluteURL.toString().startsWith("jar:http:") || jasperreportsAbsoluteURL.toString().startsWith("jar:https:"))
{
// Jasper classes are deployed to a webserver (Java Webstart)
jasperreportsAbsolutePath = jasperreportsAbsoluteURL.toString().split("!")[0].split("jar:")[1];
// Download the required jasper libraries if they are not already existing
File reqLib = new File(System.getProperty("java.io.tmpdir"), "CompiereJasperReqs.jar");
if(!reqLib.exists() && !(reqLib.length() > 0))
{
try{
URL reqLibURL = new URL(jasperreportsAbsolutePath);
InputStream in = reqLibURL.openStream();
FileOutputStream fout = new FileOutputStream(reqLib);
byte buf[] = new byte[1024];
int s = 0;
while((s = in.read(buf, 0, 1024)) > 0)
fout.write(buf, 0, s);
in.close();
fout.flush();
fout.close();
} catch (FileNotFoundException e) {
log.warning("Required library not found "+ e.getMessage());
reqLib.delete();
reqLib = null;
} catch (IOException e) {
log.severe("I/O error downloading required library from server "+ e.getMessage());
reqLib.delete();
reqLib = null;
}
}
jasperreportsAbsolutePath = reqLib.getAbsolutePath();
}
else
{
// Jasper classes are locally available (Local client)
jasperreportsAbsolutePath = jasperreportsAbsoluteURL.toString().split("!")[0].split("file:")[1];
}
if(jasperreportsAbsolutePath != null && !jasperreportsAbsolutePath.trim().equals(""))
{
// Check whether the current CLASSPATH already contains our
// jasper libraries and dependencies or not.
if(System.getProperty("java.class.path").indexOf(jasperreportsAbsolutePath) < 0)
{
System.setProperty("java.class.path",
System.getProperty("java.class.path") +
System.getProperty("path.separator") +
jasperreportsAbsolutePath);
log.info("Classpath has been corrected to " + System.getProperty("java.class.path"));
}
}
}
/** /**
* @author rlemeill * @author rlemeill
* @param reportFile * @param reportFile
@ -1061,7 +1028,6 @@ public class ReportStarter implements ProcessCall, ClientProcess
*/ */
private JasperReport compileReport( File reportFile, File jasperFile) private JasperReport compileReport( File reportFile, File jasperFile)
{ {
JWScorrectClassPath();
JasperReport compiledJasperReport = null; JasperReport compiledJasperReport = null;
try { try {
JasperCompileManager.compileReportToFile ( reportFile.getAbsolutePath(), jasperFile.getAbsolutePath() ); JasperCompileManager.compileReportToFile ( reportFile.getAbsolutePath(), jasperFile.getAbsolutePath() );
@ -1070,7 +1036,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
} catch (JRException e) { } catch (JRException e) {
log.log(Level.SEVERE, "Error", e); log.log(Level.SEVERE, "Error", e);
} }
return compiledJasperReport; return compiledJasperReport;
} }
/** /**

View File

@ -1,36 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="lib/asm.jar"/> <classpathentry exported="true" kind="lib" path="lib/asm.jar"/>
<classpathentry exported="true" kind="lib" path="lib/bsh.jar"/> <classpathentry exported="true" kind="lib" path="lib/cglib.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cglib.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-el.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-el.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-fileupload.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-fileupload.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-io.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-io.jar"/> <classpathentry exported="true" kind="lib" path="lib/Filters.jar"/>
<classpathentry exported="true" kind="lib" path="lib/Filters.jar"/> <classpathentry exported="true" kind="lib" path="lib/gmapsz.jar"/>
<classpathentry exported="true" kind="lib" path="lib/gmapsz.jar"/> <classpathentry exported="true" kind="lib" path="lib/jruby.jar"/>
<classpathentry exported="true" kind="lib" path="lib/groovy.jar"/> <classpathentry exported="true" kind="lib" path="lib/js.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jruby.jar"/> <classpathentry exported="true" kind="lib" path="lib/json_simple.jar"/>
<classpathentry exported="true" kind="lib" path="lib/js.jar"/> <classpathentry exported="true" kind="lib" path="lib/junit.jar"/>
<classpathentry exported="true" kind="lib" path="lib/json_simple.jar"/> <classpathentry exported="true" kind="lib" path="lib/jxl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/junit.jar"/> <classpathentry exported="true" kind="lib" path="lib/jython.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jxl.jar"/> <classpathentry exported="true" kind="lib" path="lib/mvel.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jython.jar"/> <classpathentry exported="true" kind="lib" path="lib/ognl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/mvel.jar"/> <classpathentry exported="true" kind="lib" path="lib/timelinez.jar"/>
<classpathentry exported="true" kind="lib" path="lib/ognl.jar"/> <classpathentry exported="true" kind="lib" path="lib/timeplotz.jar"/>
<classpathentry exported="true" kind="lib" path="lib/timelinez.jar"/> <classpathentry exported="true" kind="lib" path="lib/xercesImpl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/timeplotz.jar"/> <classpathentry exported="true" kind="lib" path="lib/zcommon.jar" sourcepath="lib/src/zcommon-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xercesImpl.jar"/> <classpathentry exported="true" kind="lib" path="lib/zhtml.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zcommon.jar" sourcepath="lib/src/zcommon-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/zk.jar" sourcepath="lib/src/zk-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zhtml.jar"/> <classpathentry exported="true" kind="lib" path="lib/zkplus.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zk.jar" sourcepath="lib/src/zk-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/zul.jar" sourcepath="lib/src/zul-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkplus.jar"/> <classpathentry exported="true" kind="lib" path="lib/zweb.jar" sourcepath="lib/zweb-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zul.jar" sourcepath="lib/src/zul-sources.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="lib" path="lib/zweb.jar" sourcepath="lib/zweb-sources.jar"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry exported="true" kind="lib" path="lib/ckez.jar"/>
<classpathentry kind="src" path="src"/> <classpathentry exported="true" kind="lib" path="lib/zel.jar"/>
<classpathentry exported="true" kind="lib" path="lib/ckez.jar"/> <classpathentry exported="true" kind="lib" path="lib/zkbind.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zel.jar"/> <classpathentry kind="output" path="bin"/>
<classpathentry exported="true" kind="lib" path="lib/zkbind.jar"/> </classpath>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -4,7 +4,56 @@ Bundle-Name: Library
Bundle-SymbolicName: org.zkoss.zk.library Bundle-SymbolicName: org.zkoss.zk.library
Bundle-Version: 6.0.0.qualifier Bundle-Version: 6.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: javax.servlet;version="3.0.0", Import-Package: bsh,
bsh.classpath,
bsh.collection,
bsh.commands,
bsh.engine,
bsh.org.objectweb.asm,
bsh.reflect,
bsh.servlet,
bsh.util,
groovy.inspect,
groovy.inspect.swingui,
groovy.io,
groovy.lang,
groovy.mock,
groovy.mock.interceptor,
groovy.model,
groovy.security,
groovy.servlet,
groovy.sql,
groovy.swing,
groovy.swing.binding,
groovy.swing.factory,
groovy.swing.impl,
groovy.text,
groovy.time,
groovy.ui,
groovy.ui.text,
groovy.ui.view,
groovy.util,
groovy.util.slurpersupport,
groovy.xml,
groovy.xml.dom,
groovy.xml.streamingmarkupsupport,
groovyjarjarantlr,
groovyjarjarantlr.ASdebug,
groovyjarjarantlr.actions.cpp,
groovyjarjarantlr.actions.csharp,
groovyjarjarantlr.actions.java,
groovyjarjarantlr.actions.python,
groovyjarjarantlr.build,
groovyjarjarantlr.collections,
groovyjarjarantlr.collections.impl,
groovyjarjarantlr.debug,
groovyjarjarantlr.debug.misc,
groovyjarjarantlr.preprocessor,
groovyjarjarasm.asm,
groovyjarjarasm.asm.signature,
groovyjarjarasm.asm.tree,
groovyjarjarcommonscli,
javax.servlet;version="3.0.0",
javax.servlet.annotation;version="3.0.0", javax.servlet.annotation;version="3.0.0",
javax.servlet.descriptor;version="3.0.0", javax.servlet.descriptor;version="3.0.0",
javax.servlet.http;version="3.0.0", javax.servlet.http;version="3.0.0",
@ -17,17 +66,47 @@ Import-Package: javax.servlet;version="3.0.0",
javax.servlet.jsp.resources;version="2.2.0", javax.servlet.jsp.resources;version="2.2.0",
javax.servlet.jsp.tagext;version="2.2.0", javax.servlet.jsp.tagext;version="2.2.0",
javax.servlet.resources;version="3.0.0", javax.servlet.resources;version="3.0.0",
org.codehaus.groovy,
org.codehaus.groovy.ant,
org.codehaus.groovy.antlr,
org.codehaus.groovy.antlr.java,
org.codehaus.groovy.antlr.parser,
org.codehaus.groovy.antlr.treewalker,
org.codehaus.groovy.ast,
org.codehaus.groovy.ast.expr,
org.codehaus.groovy.ast.stmt,
org.codehaus.groovy.binding,
org.codehaus.groovy.bsf,
org.codehaus.groovy.classgen,
org.codehaus.groovy.control,
org.codehaus.groovy.control.io,
org.codehaus.groovy.control.messages,
org.codehaus.groovy.groovydoc,
org.codehaus.groovy.reflection,
org.codehaus.groovy.runtime,
org.codehaus.groovy.runtime.metaclass,
org.codehaus.groovy.runtime.typehandling,
org.codehaus.groovy.runtime.wrappers,
org.codehaus.groovy.syntax,
org.codehaus.groovy.tools,
org.codehaus.groovy.tools.groovydoc,
org.codehaus.groovy.tools.javac,
org.codehaus.groovy.tools.shell,
org.codehaus.groovy.tools.shell.commands,
org.codehaus.groovy.tools.shell.util,
org.codehaus.groovy.tools.xml,
org.codehaus.groovy.vmplugin,
org.codehaus.groovy.vmplugin.v4,
org.codehaus.groovy.vmplugin.v5,
org.osgi.framework;version="1.3.0" org.osgi.framework;version="1.3.0"
Bundle-ClassPath: ., Bundle-ClassPath: .,
lib/asm.jar, lib/asm.jar,
lib/bsh.jar,
lib/cglib.jar, lib/cglib.jar,
lib/commons-el.jar, lib/commons-el.jar,
lib/commons-fileupload.jar, lib/commons-fileupload.jar,
lib/commons-io.jar, lib/commons-io.jar,
lib/Filters.jar, lib/Filters.jar,
lib/gmapsz.jar, lib/gmapsz.jar,
lib/groovy.jar,
lib/jruby.jar, lib/jruby.jar,
lib/js.jar, lib/js.jar,
lib/json_simple.jar, lib/json_simple.jar,
@ -70,15 +149,6 @@ Export-Package: Lib,
Lib.xml.sax, Lib.xml.sax,
Lib.xml.sax.drivers2, Lib.xml.sax.drivers2,
bigdecimal, bigdecimal,
bsh,
bsh.classpath,
bsh.collection,
bsh.commands,
bsh.org.objectweb.asm,
bsh.reflect,
bsh.servlet,
bsh.util,
bsh.util.lib,
builtin, builtin,
builtin.core_ext, builtin.core_ext,
builtin.java, builtin.java,
@ -118,47 +188,6 @@ Export-Package: Lib,
date, date,
doc, doc,
drb, drb,
groovy.inspect,
groovy.inspect.swingui,
groovy.io,
groovy.lang,
groovy.mock,
groovy.mock.interceptor,
groovy.model,
groovy.security,
groovy.servlet,
groovy.sql,
groovy.swing,
groovy.swing.binding,
groovy.swing.factory,
groovy.swing.impl,
groovy.text,
groovy.time,
groovy.ui,
groovy.ui.icons,
groovy.ui.text,
groovy.ui.view,
groovy.util,
groovy.util.slurpersupport,
groovy.xml,
groovy.xml.dom,
groovy.xml.streamingmarkupsupport,
groovyjarjarantlr,
groovyjarjarantlr.ASdebug,
groovyjarjarantlr.actions.cpp,
groovyjarjarantlr.actions.csharp,
groovyjarjarantlr.actions.java,
groovyjarjarantlr.actions.python,
groovyjarjarantlr.build,
groovyjarjarantlr.collections,
groovyjarjarantlr.collections.impl,
groovyjarjarantlr.debug,
groovyjarjarantlr.debug.misc,
groovyjarjarantlr.preprocessor,
groovyjarjarasm.asm,
groovyjarjarasm.asm.signature,
groovyjarjarasm.asm.tree,
groovyjarjarcommonscli,
io, io,
irb, irb,
irb.cmd, irb.cmd,
@ -254,38 +283,6 @@ Export-Package: Lib,
org.apache.xerces.xs, org.apache.xerces.xs,
org.apache.xerces.xs.datatypes, org.apache.xerces.xs.datatypes,
org.apache.xml.serialize, org.apache.xml.serialize,
org.codehaus.groovy,
org.codehaus.groovy.ant,
org.codehaus.groovy.antlr,
org.codehaus.groovy.antlr.java,
org.codehaus.groovy.antlr.parser,
org.codehaus.groovy.antlr.treewalker,
org.codehaus.groovy.ast,
org.codehaus.groovy.ast.expr,
org.codehaus.groovy.ast.stmt,
org.codehaus.groovy.binding,
org.codehaus.groovy.bsf,
org.codehaus.groovy.classgen,
org.codehaus.groovy.control,
org.codehaus.groovy.control.io,
org.codehaus.groovy.control.messages,
org.codehaus.groovy.groovydoc,
org.codehaus.groovy.reflection,
org.codehaus.groovy.runtime,
org.codehaus.groovy.runtime.metaclass,
org.codehaus.groovy.runtime.typehandling,
org.codehaus.groovy.runtime.wrappers,
org.codehaus.groovy.syntax,
org.codehaus.groovy.tools,
org.codehaus.groovy.tools.groovydoc,
org.codehaus.groovy.tools.javac,
org.codehaus.groovy.tools.shell,
org.codehaus.groovy.tools.shell.commands,
org.codehaus.groovy.tools.shell.util,
org.codehaus.groovy.tools.xml,
org.codehaus.groovy.vmplugin,
org.codehaus.groovy.vmplugin.v4,
org.codehaus.groovy.vmplugin.v5,
org.dynalang.mop, org.dynalang.mop,
org.dynalang.mop.beans, org.dynalang.mop.beans,
org.dynalang.mop.collections, org.dynalang.mop.collections,

View File

@ -3,14 +3,12 @@ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
lib/asm.jar,\ lib/asm.jar,\
lib/bsh.jar,\
lib/cglib.jar,\ lib/cglib.jar,\
lib/commons-el.jar,\ lib/commons-el.jar,\
lib/commons-fileupload.jar,\ lib/commons-fileupload.jar,\
lib/commons-io.jar,\ lib/commons-io.jar,\
lib/Filters.jar,\ lib/Filters.jar,\
lib/gmapsz.jar,\ lib/gmapsz.jar,\
lib/groovy.jar,\
lib/jruby.jar,\ lib/jruby.jar,\
lib/js.jar,\ lib/js.jar,\
lib/json_simple.jar,\ lib/json_simple.jar,\