diff options
author | netconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-08-17 06:10:56 +0000 |
---|---|---|
committer | netconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-08-17 06:10:56 +0000 |
commit | 3d982813b34f6f230baf4a467cdc37ec92a77595 (patch) | |
tree | 85319d39cee2ded1bb7a2b2dd9e8ea37e3778248 /src/main/java/at/knowcenter/wag/egov/egiz/tools | |
parent | 07f6c8f33b2d700276fe6ec6339ff836c8710131 (diff) | |
download | pdf-as-3-3d982813b34f6f230baf4a467cdc37ec92a77595.tar.gz pdf-as-3-3d982813b34f6f230baf4a467cdc37ec92a77595.tar.bz2 pdf-as-3-3d982813b34f6f230baf4a467cdc37ec92a77595.zip |
Performance
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@167 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/tools')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java | 12 | ||||
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java | 14 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java index 7908486..fe0cfcb 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java @@ -17,12 +17,17 @@ */
package at.knowcenter.wag.egov.egiz.tools;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Base64;
+import at.gv.egiz.pdfas.framework.input.DataSource;
+import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
+
/**
* This class provides encoding and decoding methods and other coding methods.
* All methods are static!
@@ -215,6 +220,13 @@ public class CodingHelper }
}
+ public static byte[] buildDigest(DataSource input) throws IOException
+ {
+ // PERF: digesting needs data source.
+ byte [] data = DataSourceHelper.convertDataSourceToByteArray(input);
+ return buildDigest(data);
+ }
+
/**
* This method escapes a given string with HTML entities.
*
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java b/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java index 7420b18..397f910 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java @@ -139,9 +139,7 @@ public class Normalizer implements Serializable { if (logger_.isEnabledFor(Level.FATAL)) {
logger_.fatal("Class not found:" + class_name);
}
- NormalizeException ne = new NormalizeException(400, "Can not load normalizer library");
- ne.setErrorCode(400);
- throw ne;
+ throw new NormalizeException("Can not load normalizer library");
}
try {
normalize_ = (Normalize) normalize_class.newInstance();
@@ -149,16 +147,12 @@ public class Normalizer implements Serializable { if (logger_.isEnabledFor(Level.FATAL)) {
logger_.fatal("Can not instantiate:" + class_name);
}
- NormalizeException ne = new NormalizeException(400, "Can not load normalizer library");
- ne.setErrorCode(400);
- throw ne;
+ throw new NormalizeException("Can not load normalizer library");
} catch (IllegalAccessException e) {
if (logger_.isEnabledFor(Level.FATAL)) {
logger_.fatal("Can not access:" + class_name);
}
- NormalizeException ne = new NormalizeException(400, "Can not load normalizer library");
- ne.setErrorCode(400);
- throw ne;
+ throw new NormalizeException("Can not load normalizer library");
}
}
@@ -271,7 +265,7 @@ public class Normalizer implements Serializable { } catch (SettingsException e) {
String log_message = "Can not load normalizer settings. Cause:\n" + e.getMessage();
logger_.error(log_message);
- throw new NormalizeException(400, log_message, e);
+ throw new NormalizeException(log_message, e);
}
}
}
|