* minor development configuration and build changes.

* reduce the usage of non official sun api.
This commit is contained in:
Heng Sin Low 2010-07-15 03:10:10 +08:00
parent a8c7b3863b
commit f379b187f8
5 changed files with 26 additions and 33 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry excluding="org/compiere/report/ReportExporter.java" kind="src" path="src"/> <classpathentry excluding="org/compiere/report/ReportExporter.java" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <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="output" path="build"/> <classpathentry kind="output" path="build"/>
</classpath> </classpath>

View File

@ -1,5 +1,6 @@
#Wed Mar 24 23:21:11 CET 2010 #Wed Jul 14 15:38:16 MYT 2010
eclipse.preferences.version=1 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.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

View File

@ -7,9 +7,9 @@ Bundle-ClassPath: JasperReports.jar
Export-Package: org.compiere.interfaces, Export-Package: org.compiere.interfaces,
org.compiere.report, org.compiere.report,
org.compiere.utils org.compiere.utils
Require-Bundle: org.adempiere.base;bundle-version="0.0.0", Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
org.adempiere.JasperReportsTools;bundle-version="1.0.0", org.adempiere.JasperReportsTools;bundle-version="1.0.0",
org.adempiere.client;bundle-version="0.0.0", org.adempiere.client;bundle-version="1.0.0",
com.springsource.javax.ejb;bundle-version="3.0.0", com.springsource.javax.ejb;bundle-version="3.0.0",
org.adempiere.tools;bundle-version="0.0.0" org.adempiere.tools;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View File

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

View File

@ -6,10 +6,7 @@ import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import sun.security.provider.Sun;
/** /**
* @author rlemeill * @author rlemeill
@ -19,14 +16,14 @@ import sun.security.provider.Sun;
public class DigestOfFile public class DigestOfFile
{ {
/** /**
* @param mode ie MD5 * @param algorithm ie MD5
* @throws Exception * @throws Exception
*/ */
public DigestOfFile(String mode) throws Exception public DigestOfFile(String algorithm) throws Exception
{ {
digestAgent = MessageDigest.getInstance(mode, "SUN"); digestAgent = MessageDigest.getInstance(algorithm);
} }
/** /**
* @param file to hash * @param file to hash
* @return hash * @return hash
@ -44,14 +41,14 @@ public class DigestOfFile
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
{ {
digestAgent.reset(); digestAgent.reset();
byte[] digest = digestAgent.digest(input); byte[] digest = digestAgent.digest(input);
return digest; return digest;
} }
/** /**
* @author rlemeill * @author rlemeill
* @param file * @param file
@ -65,7 +62,7 @@ public class DigestOfFile
String digestAsBase64 = new String(encoder.encode(digest),"ASCII"); String digestAsBase64 = new String(encoder.encode(digest),"ASCII");
return digestAsBase64; return digestAsBase64;
} }
/** /**
* @param input * @param input
* @return hash (base64 encoded) * @return hash (base64 encoded)
@ -78,15 +75,15 @@ public class DigestOfFile
String digestAsBase64 = new String(encoder.encode(digest),"ASCII"); String digestAsBase64 = new String(encoder.encode(digest),"ASCII");
return digestAsBase64; 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 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 MessageDigest digestAgent;
//private Base64 base64Encoder = new Base64(); //private Base64 base64Encoder = new Base64();
private byte[] buffer = new byte[4096]; private byte[] buffer = new byte[4096];
/** /**
* @author rlemeill * @author rlemeill
* @param args file * @param args file
@ -95,10 +92,8 @@ public class DigestOfFile
{ {
try try
{ {
java.security.Security.addProvider(new Sun());
DigestOfFile md5DigestAgent = new DigestOfFile("MD5"); DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
for (int argIndex = 0; argIndex < args.length; argIndex++) for (int argIndex = 0; argIndex < args.length; argIndex++)
{ {
{ {
@ -112,8 +107,8 @@ public class DigestOfFile
e.printStackTrace(System.out); e.printStackTrace(System.out);
} }
} }
/** /**
* @param file1 first file to compare * @param file1 first file to compare
* @param file2 second file to compare * @param file2 second file to compare
@ -124,7 +119,6 @@ public class DigestOfFile
//compute Hash of exisiting and downloaded //compute Hash of exisiting and downloaded
String hashFile1; String hashFile1;
String hashFile2; String hashFile2;
java.security.Security.addProvider(new Sun());
try{ try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5"); DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hashFile1 = md5DigestAgent.digestAsBase64(file1); hashFile1 = md5DigestAgent.digestAsBase64(file1);
@ -134,8 +128,8 @@ public class DigestOfFile
{ {
return false; //if there is an error during comparison return files are difs return false; //if there is an error during comparison return files are difs
} }
} }
/** /**
* @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
@ -143,7 +137,6 @@ public class DigestOfFile
public static String GetLocalMD5Hash(File file) public static String GetLocalMD5Hash(File file)
{ {
String hash; String hash;
java.security.Security.addProvider(new Sun());
try{ try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5"); DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hash = md5DigestAgent.digestAsBase64(file); hash = md5DigestAgent.digestAsBase64(file);
@ -153,7 +146,7 @@ public class DigestOfFile
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
} }
} }
/** /**
* Get md5 hash from byte[] * Get md5 hash from byte[]
* @param input * @param input
@ -162,7 +155,6 @@ public class DigestOfFile
public static String getMD5Hash(byte[] input) public static String getMD5Hash(byte[] input)
{ {
String hash; String hash;
java.security.Security.addProvider(new Sun());
try{ try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5"); DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hash = md5DigestAgent.digestAsBase64(input); hash = md5DigestAgent.digestAsBase64(input);