IDEMPIERE-4267 Remove org.adempiere.report.jasper.webapp (#33)

* IDEMPIERE-4267 Remove org.adempiere.report.jasper.webapp

Remove org.adempiere.report.jasper.webapp project.
Use reportfilename.md5 to get remote md5 hash.
Use hex instead of base64 for md5 hash.
Copy standalone.jrxml to org.adempiere.report.jasper/test folder.

* IDEMPIERE-4267 Remove org.adempiere.report.jasper.webapp

Remove org.adempiere.report.jasper.fragment.test project
Added space checking for the default hash created by the md5sum command
line tool.
This commit is contained in:
hengsin 2020-05-06 19:08:58 +08:00 committed by GitHub
parent c6df56d2ba
commit 9d937aa328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 131 additions and 1210 deletions

View File

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

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.adempiere.report.jasper.fragment.test</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

@ -1,7 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false

View File

@ -1,9 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-SymbolicName: org.adempiere.report.jasper.fragment.test
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.adempiere.report.jasper.webapp;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Jetty-WarPatchFragmentFolderPath: /

View File

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

View File

@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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">
<jasperReport language="java" name="standalone" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">
<title>
<band height="782">
<staticText>
<reportElement x="0" y="50" width="150" height="40"/>
<textElement/>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="50" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="50" width="150" height="40"/><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="100" width="150" height="40"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="100" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="100" width="150" height="40"/><textElement><font size="14"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="150" width="150" height="40"/>
<textElement>
<font fontName="Times New Roman" size="12" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="150" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="150" width="150" height="40"/><textElement><font fontName="Times New Roman" size="12" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="200" width="150" height="40"/>
<textElement>
<font fontName="Times New Roman" size="12" isBold="true" isItalic="true" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="200" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="200" width="150" height="40"/><textElement><font fontName="Times New Roman" size="12" isBold="true" isItalic="true" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="250" width="150" height="40"/>
<textElement>
<font fontName="Comic Sans Test" size="12" isBold="false" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="250" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="250" width="150" height="40"/><textElement><font fontName="Comic Sans MS" size="12" isBold="false" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="300" width="150" height="40"/>
<textElement>
<font fontName="Comic Sans MS" size="12" isBold="true" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="300" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="300" width="150" height="40"/><textElement><font fontName="Comic Sans MS" size="12" isBold="true" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="350" width="150" height="40"/>
<textElement>
<font fontName="Monospaced" size="12" isItalic="true" isUnderline="true" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="350" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="350" width="150" height="40"/><textElement><font fontName="Monospaced" size="12" isItalic="true" isUnderline="true" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="400" width="150" height="40"/>
<textElement>
<font fontName="Monospaced" size="12" isBold="true" isStrikeThrough="true" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="400" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="400" width="150" height="40"/><textElement><font fontName="Monospaced" size="12" isBold="true" isStrikeThrough="true" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="450" width="150" height="40" forecolor="#ff0000"/>
<textElement>
<font size="14"/>
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="450" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="450" width="150" height="40" forecolor="red"/><textElement><font size="14"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="500" width="150" height="40" forecolor="#ff00" backcolor="#ffff00"/>
<textElement>
<font fontName="Times New Roman" size="12" isBold="true" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="500" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="500" width="150" height="40" forecolor="green" backcolor="#FFFF00" mode="Opaque"/><textElement><font fontName="Times New Roman" size="12" isBold="true" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="550" width="150" height="90" forecolor="#ff" backcolor="#ffdd99"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="550" width="390" height="90"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="550" width="150" height="90" forecolor="blue" backcolor="#FFDD99" mode="Opaque"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="Times New Roman" size="12" isBold="true" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="0" y="650" width="150" height="90" forecolor="#ff0000" backcolor="#99ddff"/>
<textElement textAlignment="Right" verticalAlignment="Bottom">
<font fontName="Times New Roman" size="12" isBold="true" />
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="650" width="390" height="90"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="650" width="150" height="90" forecolor="red" backcolor="#99DDFF" mode="Opaque"/><textElement textAlignment="Right" verticalAlignment="Bottom"><font fontName="Times New Roman" size="12" isBold="true" /></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
</band>
</title>
</jasperReport>

View File

@ -1,11 +0,0 @@
<?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-11">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.adempiere.report.jasper.webapp</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>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,10 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,17 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: iDempiere JasperReport Web App
Bundle-SymbolicName: org.adempiere.report.jasper.webapp;singleton:=true
Bundle-Version: 7.1.0.qualifier
Require-Bundle: org.adempiere.base;bundle-version="0.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=11))"
Web-ContextPath: JasperReportFiles
Import-Package: javax.servlet;version="2.5.0",
javax.servlet.http;version="2.5.0",
javax.servlet.jsp;version="2.1.0",
org.apache.commons.codec,
org.apache.commons.codec.binary
Bundle-ClassPath: .
Automatic-Module-Name: org.adempiere.report.jasper.webapp
Bundle-Vendor: iDempiere Community

View File

@ -1,15 +0,0 @@
@CALL ..\utils_dev\myDevEnv.bat
@IF NOT %COMPIERE_ENV%==Y GOTO NOBUILD
@echo Cleanup ...
@%JAVA_HOME%\bin\java -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main clean
@echo Building ...
@%JAVA_HOME%\bin\java -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main main
@REM @pause
@REM @exit
:NOBUILD
@Echo Check myDevEnv.bat (copy from myDevEnvTemplate.bat)
@REM @Pause

View File

@ -1,18 +0,0 @@
# Module compiling script
# Ported from Windows script Marek Mosiewicz<marek.mosiewicz@jotel.com.pl>
SAVED_DIR=`pwd` #save current dir
cd `dirname $0`/../utils_dev #change dir to place where script resides - doesn not work with sym links
UTILS_DEV=`pwd` #this is compiere source
cd $SAVED_DIR #back to the saved directory
. $UTILS_DEV/myDevEnv.sh #call environment
echo done
if [ ! $COMPIERE_ENV==Y ] ; then
echo "Can't set developemeent environemnt - check myDevEnv.sh"
exit 1
fi
echo running Ant
$JAVA_HOME/bin/java -Dant.home="." $ANT_PROPERTIES org.apache.tools.ant.Main

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">
<jboss-web>
<!-- Resource Environment References -->
<!--
For additional resouce-env-ref tags add a merge file called jbossweb-resource-env-ref.xml
-->
<!-- Resource references -->
<!--
For additional resouce-ref tags add a merge file called jbossweb-resource-ref.xml
-->
<!-- EJB References -->
<!--
For additional ejb-ref tags add a merge file called jbossweb-ejb-ref.xml
-->
<ejb-ref>
<ejb-ref-name>ejb/compiere/MD5</ejb-ref-name>
<jndi-name>ejb/compiere/MD5</jndi-name>
</ejb-ref>
<!-- EJB Local References -->
</jboss-web>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<filter>
<filter-name>MD5Filter</filter-name>
<filter-class>
org.compiere.web.MD5Filter
</filter-class>
</filter>
<filter-mapping>
<filter-name>MD5Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>GetMD5File</servlet-name>
<servlet-class>
org.compiere.web.GetMD5FileServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GetMD5File</servlet-name>
<url-pattern>/GetMD5File</url-pattern>
</servlet-mapping>
<!--
To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
Organize mime-mappings.xml following this DTD slice:
<!ELEMENT mime-mapping (extension, mime-type)>
-->
<!--
To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
Organize error-pages.xml following this DTD slice:
<!ELEMENT error-page ((error-code | exception-type), location)>
-->
<!--
To add taglibs by xml, create a file called taglibs.xml and place it
in your merge dir.
-->
<!--
To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
Organize web-security.xml following this DTD slice:
<!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
<!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
<!ELEMENT web-resource-name (#PCDATA)>
<!ELEMENT url-pattern (#PCDATA)>
<!ELEMENT http-method (#PCDATA)>
<!ELEMENT user-data-constraint (description?, transport-guarantee)>
<!ELEMENT transport-guarantee (#PCDATA)>
<!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
<!ELEMENT auth-method (#PCDATA)>
<!ELEMENT realm-name (#PCDATA)>
<!ELEMENT form-login-config (form-login-page, form-error-page)>
<!ELEMENT form-login-page (#PCDATA)>
<!ELEMENT form-error-page (#PCDATA)>
-->
</web-app>

View File

@ -1,11 +0,0 @@
bin.includes = META-INF/,\
standalone.jrxml,\
WEB-INF/,\
.
bin.excludes = src/**,\
.settings/**,\
.classpath,\
.project,\
build.properties
output.. = target/classes/
source.. = src/

View File

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Packaging Generator" default="_packaging_generation_">
<property name="deploy.name" value="web" />
<target name="_packaging_generation_" depends="EJB.jar,EJB-client.jar,Web.war,WebApp.ear"/>
<target name="EJB.jar" description="${deploy.name}AppEJB.jar">
<jar destfile="${deploy.name}AppEJB.jar">
<zipfileset dir="src/META-INF" prefix="META-INF">
<include name="ejb-jar.xml"/>
</zipfileset>
<zipfileset dir="src/META-INF" prefix="META-INF">
<include name="jboss.xml"/>
</zipfileset>
<zipfileset dir="../JasperReports">
<include name="CompiereJasper.jar"/>
</zipfileset>
<zipfileset dir="build" includes="org/compiere/ejb/*.class,org/compiere/interfaces/*.class"/>
</jar>
</target>
<target name="EJB-client.jar" description="${deploy.name}EJB-client.jar">
<jar destfile="${deploy.name}EJB-client.jar">
<zipfileset dir="build" includes="org/compiere/interfaces/*.class"/>
</jar>
</target>
<target name="Web.war" description="${deploy.name}App.war">
<jar destfile="${deploy.name}App.war">
<zipfileset dir="src/WEB-INF" prefix="WEB-INF">
<include name="web.xml"/>
</zipfileset>
<zipfileset dir="src/WEB-INF" prefix="WEB-INF">
<include name="jboss-web.xml"/>
</zipfileset>
<zipfileset dir="." prefix="WEB-INF/lib">
<include name="${deploy.name}EJB-client.jar"/>
</zipfileset>
<zipfileset dir="build" prefix="WEB-INF/classes" includes="org/compiere/web/*.class"/>
<zipfileset dir="webroot" includes="*.jrxml, *.xml, *.html"/>
</jar>
</target>
<target name="WebApp.ear" description="${deploy.name}App.ear">
<jar destfile="${deploy.name}App.ear">
<zipfileset dir="src/META-INF" prefix="META-INF">
<include name="application.xml"/>
</zipfileset>
<zipfileset dir=".">
<include name="${deploy.name}AppEJB.jar"/>
</zipfileset>
<zipfileset dir=".">
<include name="${deploy.name}App.war"/>
</zipfileset>
</jar>
</target>
</project>

View File

@ -1,12 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.idempiere</groupId>
<artifactId>org.idempiere.parent</artifactId>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../org.idempiere.parent/pom.xml</relativePath>
</parent>
<artifactId>org.adempiere.report.jasper.webapp</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -1,124 +0,0 @@
package org.compiere.utils;
import java.security.*;
import java.io.*;
import org.apache.commons.codec.binary.Base64;
/**
* @author rlemeill
*
*/
public class DigestOfFile
{
/**
* @param algorithm ie MD5
* @throws Exception
*/
public DigestOfFile(String algorithm) throws Exception
{
digestAgent = MessageDigest.getInstance(algorithm);
}
/**
* @param file to hash
* @return hash
* @throws Exception
*/
synchronized public byte[] digestAsByteArray(File file) throws Exception
{
digestAgent.reset();
InputStream is = new BufferedInputStream(new FileInputStream(file));
for (int bytesRead = 0; (bytesRead = is.read(buffer)) >= 0;)
{
digestAgent.update(buffer, 0, bytesRead);
}
is.close();
byte[] digest = digestAgent.digest();
return digest;
}
/**
* @author rlemeill
* @param file
* @return hash (base64 encoded)
* @throws Exception
*/
synchronized public String digestAsBase64(File file) throws Exception
{
byte[] digest = digestAsByteArray(file);
Base64 base64 = new Base64();
String digestAsBase64 = new String(base64.encode(digest));
return digestAsBase64;
}
//private static final char[] HEX_CHARS = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
private MessageDigest digestAgent;
private byte[] buffer = new byte[4096];
/**
* @author rlemeill
* @param args file
*/
public static void main(String[] args)
{
try
{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
for (int argIndex = 0; argIndex < args.length; argIndex++)
{
{
String base64Digest = md5DigestAgent.digestAsBase64(new File(args[argIndex]));
System.out.println("Base64 MD5 of " + args[argIndex] + " = [" + base64Digest + "]");
}
}
}
catch (Exception e)
{
e.printStackTrace(System.out);
}
}
/**
* @param file1 first file to compare
* @param file2 second file to compare
* @return true if files are identic false otherwise
*/
public static boolean md5localHashCompare(File file1,File file2)
{
//compute Hash of exisiting and downloaded
String hashFile1;
String hashFile2;
try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hashFile1 = md5DigestAgent.digestAsBase64(file1);
hashFile2 = md5DigestAgent.digestAsBase64(file2);
return hashFile1.equals(hashFile2) ; }
catch (Exception e)
{
return false; //if there is an error during comparison return files are difs
}
}
/**
* @param file
* @return md5 hash null if file is not found or other error
*/
public static String GetLocalMD5Hash(File file)
{
String hash;
try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hash = md5DigestAgent.digestAsBase64(file);
return hash; }
catch (Exception e)
{
return null; //if there is an error during comparison return files are difs
}
}
}

View File

@ -1,78 +0,0 @@
/*
* Créé le 22 mars 2005
*
* TODO Pour changer le modčle de ce fichier généré, allez ŕ :
* Fenętre - Préférences - Java - Style de code - Modčles de code
*/
package org.compiere.utils;
import java.net.URL;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.utils.DigestOfFile;
public class MD5Impl {
/**
*
*/
private static final CLogger log = CLogger.getCLogger(MD5Impl.class);
public MD5Impl() {
super();
}
/**
* Business method
* @param FileName
* @return hash base64 encoded
*/
public String getFileMD5(String FileName) {
String hash = null;
String absoluteFilename = null;
String filepartOnly = null;
try
{
//Thread.currentThread().getContextClassLoader().getResource("");
if ( FileName.startsWith("http://") )
{
//extract absolute path
String[] filePathParts = FileName.split("/");
filepartOnly = filePathParts[filePathParts.length-1];
URL currentFile = Thread.currentThread().getContextClassLoader().getResource(filepartOnly);
System.out.println(filepartOnly);
absoluteFilename = currentFile.getFile();
if (log.isLoggable(Level.INFO)) log.info("decoded absolute path name for "+filepartOnly +" is "+absoluteFilename);
}
else
{
absoluteFilename = FileName;
}
if (absoluteFilename != null)
{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hash = md5DigestAgent.digestAsBase64(new java.io.File(absoluteFilename));
}
}
catch(Exception e)
{
log.severe(e.getMessage());
return null;
}
return hash;
}
/**
* Business method
* @param Filename
* @return AbsolutePath on server
*/
public String getFileAsolutePath(String Filename)
{
java.net.URL currentFile = Thread.currentThread().getContextClassLoader().getResource(Filename);
return currentFile.toString();
}
}

View File

@ -1,68 +0,0 @@
/*
* Créé le 22 mars 2005
*
* TODO Pour changer le modčle de ce fichier généré, allez ŕ :
* Fenętre - Préférences - Java - Style de code - Modčles de code
*/
package org.compiere.web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.compiere.util.Util;
import org.compiere.utils.MD5Impl;
/**
* Servlet Class
*
* @author Michael Judd BF [2728388] - fix potential CSS vulnerability
*/
public class GetMD5FileServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = -2625917637549702574L;
/**
*
*/
private MD5Impl md5;
public GetMD5FileServlet() {
super();
}
public void init(ServletConfig config) throws ServletException {
super.init(config);
md5 = new MD5Impl();
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,
IOException {
// TODO Auto-generated method stub
String file = Util.maskHTML(req.getParameter("File"));
String output = req.getParameter("output");
if ("text".equalsIgnoreCase(output))
{
resp.setContentType("text/plain");
PrintWriter out = resp.getWriter();
out.print(md5.getFileMD5(file));
}
else
{
PrintWriter out = resp.getWriter();
out.println("<HTML><HEAD><TITLE>MD5 Hash</TITLE></HEAD><BODY>");
out.println("File is: "+ file + "<BR>MD5 : "+ md5.getFileMD5(file)+"<BR>");
//out.println(md5.getFileAsolutePath(file));
out.println("</BODY></HTML>");
}
}
}

View File

@ -1,111 +0,0 @@
package org.compiere.web;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Implementation of <code>javax.servlet.Filter</code> used to compress
* the ServletResponse if it is bigger than a threshold.
*
* @author Amy Roh
* @author Dmitri Valdin
* @version $Revision: 1.2 $, $Date: 2004/03/18 16:40:33 $
*/
public class MD5Filter implements Filter{
/**
* The filter configuration object we are associated with. If this value
* is null, this filter instance is not currently configured.
*/
private FilterConfig config = null;
/**
/**
* Place this filter into service.
*
* @param filterConfig The filter configuration object
*/
public void init(FilterConfig filterConfig) {
config = filterConfig;
}
/**
* Take this filter out of service.
*/
public void destroy() {
this.config = null;
}
/**
* The <code>doFilter</code> method of the Filter is called by the container
* each time a request/response pair is passed through the chain due
* to a client request for a resource at the end of the chain.
* The FilterChain passed into this method allows the Filter to pass on the
* request and response to the next entity in the chain.<p>
* This method first examines the request to check whether the client support
* compression. <br>
* It simply just pass the request and response if there is no support for
* compression.<br>
* If the compression support is available, it creates a
* CompressionServletResponseWrapper object which compresses the content and
* modifies the header if the content length is big enough.
* It then invokes the next entity in the chain using the FilterChain object
* (<code>chain.doFilter()</code>), <br>
**/
public void doFilter ( ServletRequest request, ServletResponse response,
FilterChain chain ) throws IOException, ServletException {
if (request instanceof HttpServletRequest) {
// is md5 request
String s = ((HttpServletRequest)request).getParameter("md5");
if (!"true".equals(s)) {
chain.doFilter(request, response);
return;
}
}
if (response instanceof HttpServletResponse) {
MD5ResponseWrapper wrappedResponse =
new MD5ResponseWrapper((HttpServletResponse)response);
try {
chain.doFilter(request, wrappedResponse);
} finally {
wrappedResponse.finishResponse();
}
return;
}
}
/**
* Set filter config
* This function is equivalent to init. Required by Weblogic 6.1
*
* @param filterConfig The filter configuration object
*/
public void setFilterConfig(FilterConfig filterConfig) {
init(filterConfig);
}
/**
* Return filter config
* Required by Weblogic 6.1
*/
public FilterConfig getFilterConfig() {
return config;
}
}

View File

@ -1,63 +0,0 @@
/**
*
*/
package org.compiere.web;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;
import org.apache.commons.codec.binary.Base64;
/**
* @author hengsin
*
*/
public class MD5OutputStream extends ServletOutputStream {
private MessageDigest digestAgent;
/**
*
*/
public MD5OutputStream() {
try {
digestAgent = MessageDigest.getInstance("MD5", "SUN");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchProviderException e) {
e.printStackTrace();
}
}
/**
* @see java.io.OutputStream#write(int)
*/
@Override
public void write(int b) throws IOException {
digestAgent.update((byte) b);
}
/**
* @return md5 hash
*/
public String getMD5Hash() {
byte[] digest = digestAgent.digest();
Base64 base64 = new Base64();
String digestAsBase64 = new String(base64.encode(digest));
return digestAsBase64;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setWriteListener(WriteListener arg0) {
}
}

View File

@ -1,75 +0,0 @@
/**
*
*/
package org.compiere.web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
/**
* @author hengsin
*
*/
public class MD5ResponseWrapper extends HttpServletResponseWrapper {
private ServletOutputStream stream = null;
private PrintWriter writer = null;
private HttpServletResponse origResponse;
/**
* @param response
*/
public MD5ResponseWrapper(HttpServletResponse response) {
super(response);
origResponse = response;
}
public void finishResponse() {
if (stream != null) {
String digest = ((MD5OutputStream)stream).getMD5Hash();
origResponse.setContentType("text/plain");
origResponse.setContentLength(digest.getBytes().length);
try {
origResponse.getOutputStream().write(digest.getBytes());
origResponse.getOutputStream().flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public ServletOutputStream getOutputStream() throws IOException {
if (writer != null)
throw new IllegalStateException("getWriter() has already been called for this response");
if (stream == null)
stream = createOutputStream();
return (stream);
}
@Override
public PrintWriter getWriter() throws IOException {
if (writer != null)
return (writer);
if (stream != null)
throw new IllegalStateException("getOutputStream() has already been called for this response");
stream = createOutputStream();
writer = new PrintWriter(stream);
return writer;
}
private ServletOutputStream createOutputStream() {
stream = new MD5OutputStream();
return stream;
}
}

View File

@ -1,15 +0,0 @@
@CALL ..\utils_dev\myDevEnv.bat
@IF NOT %COMPIERE_ENV%==Y GOTO NOBUILD
@echo Cleanup ...
@%JAVA_HOME%\bin\java -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main clean
@echo Building ...
@%JAVA_HOME%\bin\java -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main dist
@pause
@exit
:NOBUILD
@Echo Check myDevEnv.bat (copy from myDevEnvTemplate.bat)
@Pause

View File

@ -1,18 +0,0 @@
# Module compiling script
# Ported from Windows script Marek Mosiewicz<marek.mosiewicz@jotel.com.pl>
SAVED_DIR=`pwd` #save current dir
cd `dirname $0`/../utils_dev #change dir to place where script resides - doesn not work with sym links
UTILS_DEV=`pwd` #this is compiere source
cd $SAVED_DIR #back to the saved directory
. $UTILS_DEV/myDevEnv.sh #call environment
echo done
if [ ! $COMPIERE_ENV==Y ] ; then
echo "Can't set developemeent environemnt - check myDevEnv.sh"
exit 1
fi
echo running Ant
$JAVA_HOME/bin/java -Dant.home="." $ANT_PROPERTIES org.apache.tools.ant.Main

View File

@ -1,22 +0,0 @@
CVS=cvs
RM=rm
CVSROOT=:pserver:anonymous@cvs.sourceforge.net:/cvsroot/compiere
#JAVAHOME=c:\jdk1.5.0_01
JAVAHOME=c:\j2sdk1.4.2_06
JAVAC=$(JAVAHOME)\bin\javac
JAVA=$(JAVAHOME)\bin\java
#usage at de top directory (containing base, client...)
#make -f JasperReports/scripts/Makefile all
version:
$(JAVAC) JasperReports\scripts\Version.java -classpath lib\Compiere.jar
patch: version
$(RM) -f JasperReports/patch-$(shell $(JAVA) JasperReports.scripts.Version ).diff
-$(CVS) -d $(CVSROOT) diff -N -u base client data db dbPort extend install interfaces jboss launch looks print serverApps serverRoot utils utils_dev tools webStore>> JasperReports/patch-$(shell $(JAVA) JasperReports.scripts.Version ).diff
pack: version
$(RM) -f compierejasper-$(shell $(JAVA) JasperReports.scripts.Version ).tar.bz2
tar -cvjf compierejasper-$(shell $(JAVA) JasperReports.scripts.Version ).tar.bz2 --exclude=JasperReports/lib --exclude=JasperReports/build --exclude=JasperReports/needed JasperReports tools/lib/barbecue-1.1.jar tools/lib/iReport.jar tools/lib/commons-beanutils-1.7.jar tools/lib/itext-1.2.jar tools/lib/commons-collections-3.1.jar tools/lib/commons-digester-1.6.jar tools/lib/commons-logging-1.4.jar tools/lib/jasperreports-0.6.5.jar tools/lib/jfreechart-0.9.21.jar tools/lib/xercesImpl.jar tools/lib/xml-apis.jar
all: patch pack

View File

@ -1,14 +0,0 @@
package JasperReports.scripts;
import org.compiere.*;
class Version
{
public static void main(String args[])
{
String version[];
version = org.compiere.Compiere.MAIN_VERSION.split(" ");
System.out.println(version[1]);
}
}

View File

@ -28,6 +28,9 @@ import java.math.BigDecimal;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -71,6 +74,7 @@ import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Ini; import org.compiere.util.Ini;
import org.compiere.util.Language; import org.compiere.util.Language;
import org.compiere.util.Msg;
import org.compiere.util.Trx; import org.compiere.util.Trx;
import org.compiere.util.Util; import org.compiere.util.Util;
import org.compiere.utils.DigestOfFile; import org.compiere.utils.DigestOfFile;
@ -197,8 +201,6 @@ public class ReportStarter implements ProcessCall, ClientProcess
fout.close(); fout.close();
return downloadedFile; return downloadedFile;
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
if(reportLocation.indexOf("Subreport") == -1 && !reportLocation.endsWith(".properties")) // Only show the warning if it is not a subreport or properties
log.warning("404 not found: Report cannot be found on server "+ e.getMessage());
return null; return null;
} catch (IOException e) { } catch (IOException e) {
throw new AdempiereException("I/O error when trying to download (sub)report from server "+ e.getLocalizedMessage()); throw new AdempiereException("I/O error when trying to download (sub)report from server "+ e.getLocalizedMessage());
@ -254,78 +256,91 @@ public class ReportStarter implements ProcessCall, ClientProcess
String downloadedLocalFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator")+"TMP" + cleanFile; String downloadedLocalFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator")+"TMP" + cleanFile;
reportFile = new File(localFile); reportFile = new File(localFile);
if (reportFile.exists()) if (reportFile.exists())
{ {
String localMD5hash = DigestOfFile.GetLocalMD5Hash(reportFile);
String remoteMD5Hash = getRemoteMD5(reportLocation); String remoteMD5Hash = getRemoteMD5(reportLocation);
if (!Util.isEmpty(remoteMD5Hash, true))
{
String localMD5hash = DigestOfFile.getMD5Hash(reportFile);
if (log.isLoggable(Level.INFO)) log.info("MD5 for local file is "+localMD5hash ); if (log.isLoggable(Level.INFO)) log.info("MD5 for local file is "+localMD5hash );
if ( remoteMD5Hash != null) if (localMD5hash.equals(remoteMD5Hash.trim()))
{ {
if (localMD5hash.equals(remoteMD5Hash)) if (log.isLoggable(Level.INFO)) log.info("MD5 match: local report file is up-to-date");
{ return reportFile;
if (log.isLoggable(Level.INFO)) log.info(" no need to download: local report is up-to-date");
} }
else else
{ {
if (log.isLoggable(Level.INFO)) log.info(" report on server is different that local one, download and replace"); if (log.isLoggable(Level.INFO)) log.info("MD5 is different, download and replace");
downloadedFile = getRemoteFile(reportLocation, downloadedLocalFile); downloadedFile = getRemoteFile(reportLocation, downloadedLocalFile);
reportFile.delete(); if (downloadedFile != null)
downloadedFile.renameTo(reportFile); {
Path to = reportFile.toPath();
Path from = downloadedFile.toPath();
Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING);
return to.toFile();
}
else
{
return null;
}
} }
} }
else else
{ {
log.warning("Remote hashing is not available did you deployed webApp.ear?");
downloadedFile = getRemoteFile(reportLocation, downloadedLocalFile); downloadedFile = getRemoteFile(reportLocation, downloadedLocalFile);
if (downloadedFile == null)
return null;
// compare hash of existing and downloaded // compare hash of existing and downloaded
if ( DigestOfFile.md5localHashCompare(reportFile,downloadedFile) ) if ( DigestOfFile.md5HashCompare(reportFile,downloadedFile) )
{ {
//nothing file are identical //nothing file are identical
if (log.isLoggable(Level.INFO)) log.info(" no need to replace your existing report"); if (log.isLoggable(Level.INFO)) log.info("MD5 match: local report file is up-to-date");
return reportFile;
} }
else else
{ {
if (log.isLoggable(Level.INFO)) log.info(" report on server is different that local one, replacing"); if (log.isLoggable(Level.INFO)) log.info("MD5 is different, replace with downloaded file");
reportFile.delete(); Path to = reportFile.toPath();
downloadedFile.renameTo(reportFile); Path from = downloadedFile.toPath();
Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING);
return to.toFile();
} }
} }
} }
else else
{ {
reportFile = getRemoteFile(reportLocation,localFile); reportFile = getRemoteFile(reportLocation,localFile);
return reportFile;
} }
} }
catch (Exception e) { catch (Exception e) {
throw new AdempiereException("Unknown exception: "+ e.getLocalizedMessage()); throw new AdempiereException("Unknown exception: "+ e.getLocalizedMessage());
} }
return reportFile;
} }
private String getRemoteMD5(String reportLocation) { private String getRemoteMD5(String reportLocation) {
try{ try {
String md5url = reportLocation; String md5url = reportLocation + ".md5";
if (md5url.indexOf("?") > 0)
md5url = md5url + "&md5=true";
else
md5url = md5url + "?md5=true";
URL reportURL = new URL(md5url); URL reportURL = new URL(md5url);
InputStream in = reportURL.openStream(); try (InputStream in = reportURL.openStream()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buf[] = new byte[1024]; byte buf[] = new byte[1024];
int s = 0; int s = 0;
while((s = in.read(buf, 0, 1024)) > 0) while((s = in.read(buf, 0, 1024)) > 0)
baos.write(buf, 0, s); baos.write(buf, 0, s);
in.close();
String hash = new String(baos.toByteArray()); String hash = new String(baos.toByteArray());
int posSpace = hash.indexOf(" ");
if (posSpace > 0)
hash = hash.substring(0, posSpace);
return hash; return hash;
}
} catch (IOException e) { } catch (IOException e) {
throw new AdempiereException("I/O error when trying to download (sub)report from server "+ e.getLocalizedMessage()); if (log.isLoggable(Level.INFO))
log.log(Level.INFO, "MD5 not available for " + reportLocation, e);
return null;
} }
} }
@ -388,7 +403,8 @@ public class ReportStarter implements ProcessCall, ClientProcess
} }
ReportData reportData = getReportData(pi, trxName); ReportData reportData = getReportData(pi, trxName);
if (reportData == null) { if (reportData == null) {
reportResult(AD_PInstance_ID, "Can not find report data", trxName); reportResult(AD_PInstance_ID, "Failed to retrieve report data", trxName);
pi.setSummary("Failed to retrieve report data", true);
return false; return false;
} }
@ -401,6 +417,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
if (Util.isEmpty(reportPath, true)) if (Util.isEmpty(reportPath, true))
{ {
reportResult(AD_PInstance_ID, "Can not find report", trxName); reportResult(AD_PInstance_ID, "Can not find report", trxName);
pi.setSummary("Can not find report", true);
return false; return false;
} }
if (reportPath.startsWith("@#LocalHttpAddr@")) { if (reportPath.startsWith("@#LocalHttpAddr@")) {
@ -430,6 +447,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
String tmp = "Can not find report file at path - " + reportPath; String tmp = "Can not find report file at path - " + reportPath;
log.severe(tmp); log.severe(tmp);
reportResult(AD_PInstance_ID, tmp, trxName); reportResult(AD_PInstance_ID, tmp, trxName);
pi.setSummary(tmp, true);
} }
if (reportFile != null) if (reportFile != null)
@ -860,6 +878,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
processInfo.setRowCount(nrows); processInfo.setRowCount(nrows);
} }
reportResult( AD_PInstance_ID, null, trxName); reportResult( AD_PInstance_ID, null, trxName);
pi.setSummary(Msg.getMsg(Env.getCtx(), "Success"), false);
return true; return true;
} }
@ -1182,7 +1201,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
String downloadedLocalFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator")+"TMP" + entry.getName(); String downloadedLocalFile = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator")+"TMP" + entry.getName();
File reportFile = new File(localFile); File reportFile = new File(localFile);
if (reportFile.exists()) { if (reportFile.exists()) {
String localMD5hash = DigestOfFile.GetLocalMD5Hash(reportFile); String localMD5hash = DigestOfFile.getMD5Hash(reportFile);
String entryMD5hash = DigestOfFile.getMD5Hash(entry.getData()); String entryMD5hash = DigestOfFile.getMD5Hash(entry.getData());
if (localMD5hash.equals(entryMD5hash)) if (localMD5hash.equals(entryMD5hash))
{ {

View File

@ -4,9 +4,11 @@ import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.security.DigestInputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
/** /**
* @author rlemeill * @author rlemeill
@ -32,15 +34,14 @@ public class DigestOfFile
synchronized public byte[] digestAsByteArray(File file) throws Exception synchronized public byte[] digestAsByteArray(File file) throws Exception
{ {
digestAgent.reset(); digestAgent.reset();
InputStream is = new BufferedInputStream(new FileInputStream(file)); try (InputStream is = new BufferedInputStream(new FileInputStream(file));
for (int bytesRead = 0; (bytesRead = is.read(buffer)) >= 0;) DigestInputStream dis = new DigestInputStream(is, digestAgent))
{ {
digestAgent.update(buffer, 0, bytesRead); while(dis.read() != -1){}
}
is.close();
byte[] digest = digestAgent.digest(); byte[] digest = digestAgent.digest();
return digest; return digest;
} }
}
public synchronized byte[] digestAsByteArray(byte[] input) throws Exception public synchronized byte[] digestAsByteArray(byte[] input) throws Exception
{ {
@ -76,13 +77,31 @@ public class DigestOfFile
return digestAsBase64; return digestAsBase64;
} }
/**
*
* @param file
* @return hex encoded md5 string
* @throws Exception
*/
public synchronized String digestAsHex(File file) throws Exception
{
byte[] digest = digestAsByteArray(file);
return Hex.encodeHexString(digest);
}
/**
//private static final char[] HEX_CHARS = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; *
* @param input
* @return hex encoded md5 string
* @throws Exception
*/
public synchronized String digestAsHex(byte[] input) throws Exception
{
byte[] digest = digestAsByteArray(input);
return Hex.encodeHexString(digest);
}
private MessageDigest digestAgent; private MessageDigest digestAgent;
//private Base64 base64Encoder = new Base64();
private byte[] buffer = new byte[4096];
/** /**
* @author rlemeill * @author rlemeill
@ -114,15 +133,15 @@ public class DigestOfFile
* @param file2 second file to compare * @param file2 second file to compare
* @return true if files are identic false otherwise * @return true if files are identic false otherwise
*/ */
public static boolean md5localHashCompare(File file1,File file2) public static boolean md5HashCompare(File file1,File file2)
{ {
//compute Hash of exisiting and downloaded //compute Hash of exisiting and downloaded
String hashFile1; String hashFile1;
String hashFile2; String hashFile2;
try{ try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5"); DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hashFile1 = md5DigestAgent.digestAsBase64(file1); hashFile1 = md5DigestAgent.digestAsHex(file1);
hashFile2 = md5DigestAgent.digestAsBase64(file2); hashFile2 = md5DigestAgent.digestAsHex(file2);
return hashFile1.equals(hashFile2) ; } return hashFile1.equals(hashFile2) ; }
catch (Exception e) catch (Exception e)
{ {
@ -134,13 +153,15 @@ public class DigestOfFile
* @param file * @param file
* @return md5 hash null if file is not found or other error * @return md5 hash null if file is not found or other error
*/ */
public static String GetLocalMD5Hash(File file) public static String getMD5Hash(File file)
{ {
String hash; String hash;
try{ try
{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5"); DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hash = md5DigestAgent.digestAsBase64(file); hash = md5DigestAgent.digestAsHex(file);
return hash; } return hash;
}
catch (Exception e) catch (Exception e)
{ {
return null; //if there is an error during comparison return files are difs return null; //if there is an error during comparison return files are difs
@ -155,10 +176,12 @@ public class DigestOfFile
public static String getMD5Hash(byte[] input) public static String getMD5Hash(byte[] input)
{ {
String hash; String hash;
try{ try
{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5"); DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hash = md5DigestAgent.digestAsBase64(input); hash = md5DigestAgent.digestAsHex(input);
return hash; } return hash;
}
catch (Exception e) catch (Exception e)
{ {
return null; //if there is an error during comparison return files are difs return null; //if there is an error during comparison return files are difs

View File

@ -28,124 +28,100 @@
<text><![CDATA[<staticText><reportElement x="0" y="100" width="150" height="40"/><textElement><font size="14"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="100" width="150" height="40"/><textElement><font size="14"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="0" y="150" width="150" height="40"/> <reportElement x="0" y="150" width="150" height="60"/>
<textElement> <textElement>
<font fontName="serif" size="12" pdfFontName="Times-Roman"/> <font fontName="serif" size="12" pdfFontName="Times-Roman"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="150" width="390" height="40"/> <reportElement x="160" y="150" width="390" height="60"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="150" width="150" height="40"/><textElement><font fontName="serif" size="12" pdfFontName="Times-Roman"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="150" width="150" height="60"/><textElement><font fontName="serif" size="12" pdfFontName="Times-Roman"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="0" y="200" width="150" height="40"/> <reportElement x="0" y="220" width="150" height="60"/>
<textElement> <textElement>
<font fontName="serif" size="12" isBold="true" isItalic="true" pdfFontName="Times-BoldItalic"/> <font fontName="serif" size="12" isBold="true" isItalic="true" pdfFontName="Times-BoldItalic"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="200" width="390" height="40"/> <reportElement x="160" y="220" width="390" height="60"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="200" width="150" height="40"/><textElement><font fontName="serif" size="12" isBold="true" isItalic="true" pdfFontName="Times-BoldItalic"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="220" width="150" height="60"/><textElement><font fontName="serif" size="12" isBold="true" isItalic="true" pdfFontName="Times-BoldItalic"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="0" y="250" width="150" height="40"/> <reportElement x="0" y="290" width="150" height="60"/>
<textElement>
<font fontName="Comic Sans MS" size="12" isBold="false" pdfFontName="COMIC.TTF"/>
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="250" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="250" width="150" height="40"/><textElement><font fontName="Comic Sans MS" size="12" isBold="false" pdfFontName="COMIC.TTF"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="300" width="150" height="40"/>
<textElement>
<font fontName="Comic Sans MS" size="12" isBold="true" pdfFontName="COMICBD.TTF"/>
</textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText>
<staticText>
<reportElement x="160" y="300" width="390" height="40"/>
<textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="300" width="150" height="40"/><textElement><font fontName="Comic Sans MS" size="12" isBold="true" pdfFontName="COMICBD.TTF"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText>
<staticText>
<reportElement x="0" y="350" width="150" height="40"/>
<textElement> <textElement>
<font fontName="monospaced" size="12" isItalic="true" isUnderline="true" pdfFontName="Courier-Oblique"/> <font fontName="monospaced" size="12" isItalic="true" isUnderline="true" pdfFontName="Courier-Oblique"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="350" width="390" height="40"/> <reportElement x="160" y="290" width="390" height="60"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="350" width="150" height="40"/><textElement><font fontName="monospaced" size="12" isItalic="true" isUnderline="true" pdfFontName="Courier-Oblique"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="290" width="150" height="60"/><textElement><font fontName="monospaced" size="12" isItalic="true" isUnderline="true" pdfFontName="Courier-Oblique"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="0" y="400" width="150" height="40"/> <reportElement x="0" y="360" width="150" height="60"/>
<textElement> <textElement>
<font fontName="monospaced" size="12" isBold="true" isStrikeThrough="true" pdfFontName="Courier-Bold"/> <font fontName="monospaced" size="12" isBold="true" isStrikeThrough="true" pdfFontName="Courier-Bold"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="400" width="390" height="40"/> <reportElement x="160" y="360" width="390" height="60"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="400" width="150" height="40"/><textElement><font fontName="monospaced" size="12" isBold="true" isStrikeThrough="true" pdfFontName="Courier-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="360" width="150" height="60"/><textElement><font fontName="monospaced" size="12" isBold="true" isStrikeThrough="true" pdfFontName="Courier-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="0" y="450" width="150" height="40" forecolor="#ff0000"/> <reportElement x="0" y="430" width="150" height="60" forecolor="#ff0000"/>
<textElement> <textElement>
<font size="14"/> <font size="14"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="450" width="390" height="40"/> <reportElement x="160" y="430" width="390" height="60"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="450" width="150" height="40" forecolor="red"/><textElement><font size="14"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="430" width="150" height="60" forecolor="red"/><textElement><font size="14"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement mode="Opaque" x="0" y="500" width="150" height="40" forecolor="#ff00" backcolor="#ffff00"/> <reportElement mode="Opaque" x="0" y="500" width="150" height="60" forecolor="#ff00" backcolor="#ffff00"/>
<textElement> <textElement>
<font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/> <font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="500" width="390" height="40"/> <reportElement x="160" y="500" width="390" height="60"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="500" width="150" height="40" forecolor="green" backcolor="#FFFF00" mode="Opaque"/><textElement><font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="500" width="150" height="60" forecolor="green" backcolor="#FFFF00" mode="Opaque"/><textElement><font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement mode="Opaque" x="0" y="550" width="150" height="90" forecolor="#ff" backcolor="#ffdd99"/> <reportElement mode="Opaque" x="0" y="570" width="150" height="90" forecolor="#ff" backcolor="#ffdd99"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/> <font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="550" width="390" height="90"/> <reportElement x="160" y="570" width="390" height="90"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="550" width="150" height="90" forecolor="blue" backcolor="#FFDD99" mode="Opaque"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="570" width="150" height="90" forecolor="blue" backcolor="#FFDD99" mode="Opaque"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement mode="Opaque" x="0" y="650" width="150" height="90" forecolor="#ff0000" backcolor="#99ddff"/> <reportElement mode="Opaque" x="0" y="670" width="150" height="90" forecolor="#ff0000" backcolor="#99ddff"/>
<textElement textAlignment="Right" verticalAlignment="Bottom"> <textElement textAlignment="Right" verticalAlignment="Bottom">
<font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/> <font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/>
</textElement> </textElement>
<text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text> <text><![CDATA[The quick brown fox jumps over the lazy dog.]]></text>
</staticText> </staticText>
<staticText> <staticText>
<reportElement x="160" y="650" width="390" height="90"/> <reportElement x="160" y="670" width="390" height="90"/>
<textElement/> <textElement/>
<text><![CDATA[<staticText><reportElement x="0" y="650" width="150" height="90" forecolor="red" backcolor="#99DDFF" mode="Opaque"/><textElement textAlignment="Right" verticalAlignment="Bottom"><font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text> <text><![CDATA[<staticText><reportElement x="0" y="670" width="150" height="90" forecolor="red" backcolor="#99DDFF" mode="Opaque"/><textElement textAlignment="Right" verticalAlignment="Bottom"><font fontName="serif" size="12" isBold="true" pdfFontName="Times-Bold"/></textElement><text>The quick brown fox jumps over the lazy dog.</text></staticText>]]></text>
</staticText> </staticText>
</band> </band>
</title> </title>

View File

@ -82,13 +82,6 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="org.adempiere.report.jasper.webapp"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="org.adempiere.server" id="org.adempiere.server"
download-size="0" download-size="0"

View File

@ -353,7 +353,6 @@
<setEntry value="org.adempiere.replication.server@default:default"/> <setEntry value="org.adempiere.replication.server@default:default"/>
<setEntry value="org.adempiere.replication@default:default"/> <setEntry value="org.adempiere.replication@default:default"/>
<setEntry value="org.adempiere.report.jasper.library@default:false"/> <setEntry value="org.adempiere.report.jasper.library@default:false"/>
<setEntry value="org.adempiere.report.jasper.webapp@default:default"/>
<setEntry value="org.adempiere.report.jasper@default:default"/> <setEntry value="org.adempiere.report.jasper@default:default"/>
<setEntry value="org.adempiere.server@default:true"/> <setEntry value="org.adempiere.server@default:true"/>
<setEntry value="org.adempiere.ui.zk@default:true"/> <setEntry value="org.adempiere.ui.zk@default:true"/>

View File

@ -353,7 +353,6 @@
<setEntry value="org.adempiere.replication.server@default:default"/> <setEntry value="org.adempiere.replication.server@default:default"/>
<setEntry value="org.adempiere.replication@default:default"/> <setEntry value="org.adempiere.replication@default:default"/>
<setEntry value="org.adempiere.report.jasper.library@default:false"/> <setEntry value="org.adempiere.report.jasper.library@default:false"/>
<setEntry value="org.adempiere.report.jasper.webapp@default:default"/>
<setEntry value="org.adempiere.report.jasper@default:default"/> <setEntry value="org.adempiere.report.jasper@default:default"/>
<setEntry value="org.adempiere.server@default:true"/> <setEntry value="org.adempiere.server@default:true"/>
<setEntry value="org.adempiere.ui.zk@default:true"/> <setEntry value="org.adempiere.ui.zk@default:true"/>

View File

@ -25,7 +25,6 @@
<module>org.adempiere.replication.server</module> <module>org.adempiere.replication.server</module>
<module>org.adempiere.report.jasper.library</module> <module>org.adempiere.report.jasper.library</module>
<module>org.adempiere.report.jasper</module> <module>org.adempiere.report.jasper</module>
<module>org.adempiere.report.jasper.webapp</module>
<module>org.adempiere.server</module> <module>org.adempiere.server</module>
<module>org.adempiere.ui</module> <module>org.adempiere.ui</module>
<module>org.adempiere.ui.zk</module> <module>org.adempiere.ui.zk</module>