aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java15
-rw-r--r--src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java4
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java23
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java18
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/DelimitedPdfDataSource.java18
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java30
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java18
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java16
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/helper/DataSourceHelper.java49
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/output/ByteArrayDataSink.java3
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java2
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java19
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java13
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java22
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java63
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java30
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java15
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedSignator_1_0_0.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedfTextualSignator_1_0_0.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/TextualSignator_1_0_0.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_pdfasold.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java7
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java16
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java15
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/TextualSignature.java17
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/tools/FileHelper.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java7
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java5
31 files changed, 345 insertions, 100 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java b/src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java
index 265cb0c..fcf55b8 100644
--- a/src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java
+++ b/src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java
@@ -32,4 +32,19 @@ public interface DataSource
*/
public int getLength();
+ /**
+ * Returns the data of this DataSource as a byte array.
+ *
+ * <p>
+ * Calling this method indicates that you need a byte array for random <strong>read</strong> access.
+ * The DataSource implementation should of course cache this byte array to avoid too much memory usage.
+ * </p>
+ * <p>
+ * Performance analysis has shown that the libraries internally convert the streams to byte arrays and
+ * that file system access is very slow.
+ * </p>
+ *
+ * @return
+ */
+ public byte [] getAsByteArray();
}
diff --git a/src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java b/src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java
index d7d0cc4..595df52 100644
--- a/src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java
+++ b/src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java
@@ -12,4 +12,8 @@ public interface DataSink
public OutputStream createOutputStream(String mimeType);
public OutputStream createOutputStream(String mimeType, String characterEncoding);
+
+ public String getMimeType();
+
+ public String getCharacterEncoding();
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
index 0d27781..e4a5649 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
@@ -23,34 +23,43 @@ public class ByteArrayPdfDataSourceImpl implements PdfDataSource
{
protected byte[] pdf = null;
- protected int length = -1;
-
public ByteArrayPdfDataSourceImpl(byte[] pdf)
{
PerformanceCounters.byteArrays.increment();
this.pdf = pdf;
- this.length = pdf.length;
}
public ByteArrayPdfDataSourceImpl(byte[] pdf, int length)
{
PerformanceCounters.byteArrays.increment();
- this.pdf = pdf;
- this.length = length;
+ if (pdf.length == length)
+ {
+ this.pdf = pdf;
+ }
+ else
+ {
+ this.pdf = new byte [length];
+ System.arraycopy(pdf, 0, this.pdf, 0, length);
+ }
}
public InputStream createInputStream()
{
- ByteArrayInputStream bais = new ByteArrayInputStream(this.pdf, 0, this.length);
+ ByteArrayInputStream bais = new ByteArrayInputStream(this.pdf);
return bais;
}
public int getLength()
{
- return this.length;
+ return this.pdf.length;
}
+ public byte[] getAsByteArray()
+ {
+ return this.pdf;
+ }
+
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java
index f77d6be..4f00bb5 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java
@@ -43,5 +43,23 @@ public class CompoundPdfDataSourceImpl implements PdfDataSource
{
return this.originalDataSource.getLength() + this.appendix.length;
}
+
+ byte [] cache = null;
+ /**
+ * @see at.gv.egiz.pdfas.framework.input.DataSource#getAsByteArray()
+ */
+ public byte[] getAsByteArray()
+ {
+ if (cache != null)
+ {
+ return cache;
+ }
+
+ cache = new byte [getLength()];
+ System.arraycopy(originalDataSource.getAsByteArray(), 0, cache, 0, originalDataSource.getLength());
+ System.arraycopy(appendix, 0, cache, originalDataSource.getLength(), appendix.length);
+
+ return cache;
+ }
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/DelimitedPdfDataSource.java b/src/main/java/at/gv/egiz/pdfas/impl/input/DelimitedPdfDataSource.java
index 6c67be2..63874c7 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/DelimitedPdfDataSource.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/DelimitedPdfDataSource.java
@@ -41,4 +41,22 @@ public class DelimitedPdfDataSource implements PdfDataSource
return this.len;
}
+ byte [] cache = null;
+
+ /**
+ * @see at.gv.egiz.pdfas.framework.input.DataSource#getAsByteArray()
+ */
+ public byte[] getAsByteArray()
+ {
+ if (cache != null)
+ {
+ return cache;
+ }
+
+ cache = new byte [getLength()];
+ System.arraycopy(dataSource.getAsByteArray(), 0, cache, 0, getLength());
+
+ return cache;
+ }
+
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java
index 8453192..a3a0803 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java
@@ -3,6 +3,7 @@
*/
package at.gv.egiz.pdfas.impl.input;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -13,6 +14,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.framework.input.PdfDataSource;
+import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
/**
* @author wprinz
@@ -78,6 +80,15 @@ public class FileBasedPdfDataSourceImpl implements PdfDataSource, FileBased
*/
public InputStream createInputStream()
{
+ if (cache == null)
+ {
+ getAsByteArray();
+ }
+ return new ByteArrayInputStream(cache);
+ }
+
+ protected InputStream createFileInputStream()
+ {
try
{
FileInputStream fis = new FileInputStream(getFile());
@@ -92,7 +103,6 @@ public class FileBasedPdfDataSourceImpl implements PdfDataSource, FileBased
return null;
}
}
-
/**
* @see at.gv.egiz.pdfas.framework.input.PdfDataSource#getLength()
*/
@@ -100,4 +110,22 @@ public class FileBasedPdfDataSourceImpl implements PdfDataSource, FileBased
{
return this.length;
}
+
+ byte [] cache = null;
+
+ /**
+ * @see at.gv.egiz.pdfas.framework.input.DataSource#getAsByteArray()
+ */
+ public byte[] getAsByteArray()
+ {
+ if (cache != null)
+ {
+ return cache;
+ }
+
+ cache = DataSourceHelper.convertInputStreamToByteArray(createFileInputStream());
+
+ return cache;
+ }
+
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java
index 6f6c7b4..1988519 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java
@@ -13,6 +13,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.framework.input.TextDataSource;
+import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
/**
* @author wprinz
@@ -121,4 +122,21 @@ public class FileBasedTextDataSourceImpl implements TextDataSource, FileBased
return (int) getFile().length();
}
+ byte [] cache = null;
+
+ /**
+ * @see at.gv.egiz.pdfas.framework.input.DataSource#getAsByteArray()
+ */
+ public byte[] getAsByteArray()
+ {
+ if (cache != null)
+ {
+ return cache;
+ }
+
+ cache = DataSourceHelper.convertInputStreamToByteArray(createInputStream());
+
+ return cache;
+ }
+
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java
index b259a3e..c983a8a 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/TextDataSourceImpl.java
@@ -79,4 +79,20 @@ public class TextDataSourceImpl implements TextDataSource
}
}
+ /**
+ * @see at.gv.egiz.pdfas.framework.input.DataSource#getAsByteArray()
+ */
+ public byte[] getAsByteArray()
+ {
+ try
+ {
+ byte[] data = getText().getBytes("UTF-8");
+ return data;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/helper/DataSourceHelper.java b/src/main/java/at/gv/egiz/pdfas/impl/input/helper/DataSourceHelper.java
index 1e2ffdc..138b269 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/helper/DataSourceHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/helper/DataSourceHelper.java
@@ -3,6 +3,7 @@
*/
package at.gv.egiz.pdfas.impl.input.helper;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -42,24 +43,54 @@ public class DataSourceHelper
*/
public static byte[] convertDataSourceToByteArray(DataSource pdfDataSource)
{
+ return pdfDataSource.getAsByteArray();
+// try
+// {
+// PerformanceCounters.byteArrays.increment();
+//
+// byte[] data = new byte[pdfDataSource.getLength()];
+//
+// int bytes_written = 0;
+//
+// InputStream is = pdfDataSource.createInputStream();
+// int n = 0;
+// while ((n = is.read(data, bytes_written, data.length - bytes_written)) > 0)
+// {
+// bytes_written += n;
+// }
+// is.close();
+//
+// assert bytes_written == data.length;
+//
+// return data;
+// }
+// catch (IOException e)
+// {
+// log.error(e);
+// throw new RuntimeException(e);
+// }
+ }
+
+ public static byte [] convertInputStreamToByteArray(InputStream inputStream)
+ {
try
{
PerformanceCounters.byteArrays.increment();
- byte[] data = new byte[pdfDataSource.getLength()];
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
+
+ byte[] temp = new byte[4096];
- int bytes_written = 0;
-
- InputStream is = pdfDataSource.createInputStream();
int n = 0;
- while ((n = is.read(data, bytes_written, data.length - bytes_written)) > 0)
+ while ((n = inputStream.read(temp)) > 0)
{
- bytes_written += n;
+ baos.write(temp, 0, n);
}
- is.close();
-
- assert bytes_written == data.length;
+ inputStream.close();
+ baos.close();
+ byte [] data = baos.toByteArray();
+
return data;
}
catch (IOException e)
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/output/ByteArrayDataSink.java b/src/main/java/at/gv/egiz/pdfas/impl/output/ByteArrayDataSink.java
index f3d1283..3a3aeca 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/output/ByteArrayDataSink.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/output/ByteArrayDataSink.java
@@ -47,6 +47,9 @@ public class ByteArrayDataSink implements DataSink
*/
public OutputStream createOutputStream(String mimeType, String characterEncoding)
{
+ this.mimeType = mimeType;
+ this.characterEncoding = characterEncoding;
+
if (this.baos != null)
{
log.warn("An output stream is created twice. The old one will be rendered useless.");
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java
index b0494c8..1714afc 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java
@@ -91,7 +91,7 @@ public class TextualSignator_1_0_0 implements Signator
tsi.profile = profile;
tsi.pos = pos;
- String document_text = PdfAS.extractNormalizedTextTextual(pdfDataSource.createInputStream());
+ String document_text = PdfAS.extractNormalizedTextTextual(pdfDataSource);
// logger_.debug("signed_text = " + document_text);
DataSource ds = new TextDataSourceImpl(document_text);
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java
index 981b868..0c9e1f2 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java
@@ -18,7 +18,7 @@ import at.gv.egiz.pdfas.framework.input.TextDataSource;
import at.gv.egiz.pdfas.framework.verificator.Verificator;
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilter;
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters;
-import at.gv.egiz.pdfas.impl.input.DelimitedInputStream;
+import at.gv.egiz.pdfas.impl.input.DelimitedPdfDataSource;
import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
import at.gv.egiz.pdfas.impl.vfilter.helper.VerificationFilterBinaryHelper;
import at.gv.egiz.pdfas.impl.vfilter.helper.VerificationFilterHelper;
@@ -285,8 +285,9 @@ public class VerificationFilterImpl implements VerificationFilter
protected String extractText(PdfDataSource pdf, int endOfDocument) throws PresentableException
{
- DelimitedInputStream dis = new DelimitedInputStream(pdf.createInputStream(), endOfDocument);
- return PdfAS.extractNormalizedTextTextual(dis);
+ DelimitedPdfDataSource dds = new DelimitedPdfDataSource(pdf, endOfDocument);
+ //DelimitedInputStream dis = new DelimitedInputStream(pdf.createInputStream(), endOfDocument);
+ return PdfAS.extractNormalizedTextTextual(dds);
}
protected List extractNewSignaturesFromText(String text) throws VerificationFilterException
@@ -453,6 +454,18 @@ public class VerificationFilterImpl implements VerificationFilter
log.debug("Extracting signatures:");
List extractedSignatures = extractNewSignaturesFromText(extractedText);
log.debug("Extracting signatures finished.");
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("extracted signatures:");
+ for (int i = 0; i < extractedSignatures.size(); i++)
+ {
+ SignatureHolder sh = (SignatureHolder)extractedSignatures.get(i);
+ String dateStr = sh.getSignatureObject().getSignationDate();
+ EGIZDate ed = EGIZDate.parseFromString(dateStr);
+ log.debug("#" + i + ": dateStr = " + dateStr + ", egizDate = " + ed.toString());
+ }
+ }
return extractedSignatures;
}
diff --git a/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java b/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java
index 459a104..1ed0cab 100644
--- a/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java
+++ b/src/main/java/at/gv/egiz/pdfas/web/SignSessionInformation.java
@@ -9,14 +9,13 @@ import java.util.Properties;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
-import at.gv.egiz.pdfas.impl.input.FileBasedPdfDataSourceImpl;
-import at.gv.egiz.pdfas.impl.output.FileBasedDataSink;
-import at.gv.egiz.pdfas.web.helper.TempDirHelper;
-import at.gv.egiz.pdfas.framework.signator.SignatorInformation;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.pdfas.framework.input.PdfDataSource;
+import at.gv.egiz.pdfas.framework.output.DataSink;
+import at.gv.egiz.pdfas.framework.signator.SignatorInformation;
+import at.gv.egiz.pdfas.web.helper.TempDirHelper;
import at.knowcenter.wag.egov.egiz.pdf.TablePos;
import at.knowcenter.wag.egov.egiz.web.ExternAppInformation;
import at.knowcenter.wag.egov.egiz.web.LocalRequest;
@@ -55,7 +54,7 @@ public class SignSessionInformation implements HttpSessionBindingListener, Seria
/**
* The original, uploaded pdf.
*/
- public FileBasedPdfDataSourceImpl pdfDataSource = null;
+ public PdfDataSource pdfDataSource = null;
/**
* The type/profile of the signature.
@@ -94,7 +93,7 @@ public class SignSessionInformation implements HttpSessionBindingListener, Seria
/**
* The DataSink to write the output data to.
*/
- public FileBasedDataSink output = null;
+ public DataSink output = null;
/**
* The local request to be sent to the device.
diff --git a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
index af1d0ae..9826500 100644
--- a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
@@ -18,6 +18,8 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.framework.SignatorFactory;
import at.gv.egiz.pdfas.framework.signator.Signator;
+import at.gv.egiz.pdfas.impl.output.ByteArrayDataSink;
+import at.gv.egiz.pdfas.impl.output.FileBasedDataSink;
import at.gv.egiz.pdfas.web.SignSessionInformation;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
@@ -185,10 +187,21 @@ public class SignServletHelper
else
{
// TODO @tzefferer: what is this code?
- byte[] signed_pdf = new byte [(int)si.output.getFile().length()];
- FileInputStream fis = new FileInputStream(si.output.getFile());
- fis.read(signed_pdf);
- fis.close();
+ byte [] signed_pdf = null;
+ if (si.output instanceof FileBasedDataSink)
+ {
+ FileBasedDataSink fbds = (FileBasedDataSink)si.output;
+ signed_pdf = new byte [(int)fbds.getFile().length()];
+ FileInputStream fis = new FileInputStream(fbds.getFile());
+ fis.read(signed_pdf);
+ fis.close();
+ }
+ else
+ {
+ ByteArrayDataSink bads = (ByteArrayDataSink)si.output;
+ signed_pdf = bads.getByteArray();
+ }
+
PDFContainer entry = new PDFContainer(signed_pdf, si.exappinf.pdf_id);
ProvidePDFServlet.signedDocuments.add(entry);
@@ -205,7 +218,6 @@ public class SignServletHelper
+ "=" + pdf_id + "&" + FormFields.FIELD_FILE_LENGTH + "=" + signed_pdf.length;
response.sendRedirect(query);
-
}
}
diff --git a/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java b/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java
index 0745bcc..23c01fd 100644
--- a/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java
@@ -21,12 +21,16 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.framework.input.DataSource;
+import at.gv.egiz.pdfas.framework.input.PdfDataSource;
import at.gv.egiz.pdfas.framework.input.TextDataSource;
import at.gv.egiz.pdfas.framework.output.DataSink;
+import at.gv.egiz.pdfas.impl.input.ByteArrayPdfDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.FileBased;
import at.gv.egiz.pdfas.impl.input.FileBasedPdfDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.FileBasedTextDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.TextDataSourceImpl;
+import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
+import at.gv.egiz.pdfas.impl.output.ByteArrayDataSink;
import at.gv.egiz.pdfas.impl.output.FileBasedDataSink;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder;
@@ -119,11 +123,16 @@ public class TempDirHelper
return textLength >= 10000;
}
- public static FileBasedPdfDataSourceImpl placePdfIntoTempDir(InputStream pdfInput, String fileNameSuffix) throws IOException
+ public static PdfDataSource placePdfIntoTempDir(InputStream pdfInput, String fileNameSuffix) throws IOException
{
- File pdfFile = placeInputIntoTempDirFile(pdfInput, fileNameSuffix);
-
- FileBasedPdfDataSourceImpl pdfDataSource = new FileBasedPdfDataSourceImpl(pdfFile, (int) pdfFile.length());
+ log.debug("PERF: placing pdf into memory cache");
+
+ byte [] pdfData = DataSourceHelper.convertInputStreamToByteArray(pdfInput);
+ PdfDataSource pdfDataSource = new ByteArrayPdfDataSourceImpl(pdfData);
+
+// File pdfFile = placeInputIntoTempDirFile(pdfInput, fileNameSuffix);
+//
+// FileBasedPdfDataSourceImpl pdfDataSource = new FileBasedPdfDataSourceImpl(pdfFile, (int) pdfFile.length());
return pdfDataSource;
}
@@ -177,35 +186,49 @@ public class TempDirHelper
return tmpFile;
}
- public static FileBasedDataSink createTempDataSink(String fileNameSuffix) throws IOException
+ public static DataSink createTempDataSink(String fileNameSuffix) throws IOException
{
- String fileName = formatFileName(fileNameSuffix);
-
- File tmpFile = createTempFileInDir(fileName);
+ log.debug("PERF: placing pdf into memory cache");
- FileBasedDataSink fbds = new FileBasedDataSink(tmpFile);
+ DataSink ds = new ByteArrayDataSink();
+
+// String fileName = formatFileName(fileNameSuffix);
+//
+// File tmpFile = createTempFileInDir(fileName);
+//
+// FileBasedDataSink ds = new FileBasedDataSink(tmpFile);
- return fbds;
+ return ds;
}
- public static void writeDataSinkToHttpResponse(FileBasedDataSink fbds, HttpServletResponse response) throws IOException
+ public static void writeDataSinkToHttpResponse(DataSink ds, HttpServletResponse response) throws IOException
{
- response.setContentType(fbds.getMimeType());
- response.setCharacterEncoding(fbds.getCharacterEncoding());
+ response.setContentType(ds.getMimeType());
+ response.setCharacterEncoding(ds.getCharacterEncoding());
OutputStream os = response.getOutputStream();
- byte[] buffer = new byte[2048];
- FileInputStream fis = new FileInputStream(fbds.getFile());
- int n = -1;
- while ((n = fis.read(buffer)) > 0)
+ if (ds instanceof FileBasedDataSink)
{
- os.write(buffer, 0, n);
+ FileBasedDataSink fbds = (FileBasedDataSink)ds;
+ byte[] buffer = new byte[2048];
+ FileInputStream fis = new FileInputStream(fbds.getFile());
+ int n = -1;
+ while ((n = fis.read(buffer)) > 0)
+ {
+ os.write(buffer, 0, n);
+ }
+ fis.close();
}
- fis.close();
+ else
+ {
+ ByteArrayDataSink bads = (ByteArrayDataSink)ds;
+ os.write(bads.getByteArray());
+ }
+
os.close();
- }
+}
/**
* Deletes the underlying file of the FileBased DataSource.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
index e2505ea..6fc7b84 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -28,6 +28,7 @@ import java.util.Vector;
import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
+import at.gv.egiz.pdfas.impl.input.ByteArrayPdfDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.DelimitedInputStream;
import at.gv.egiz.pdfas.impl.input.TextDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
@@ -1026,19 +1027,30 @@ public abstract class PdfAS
// return extractNormalizedTextTextual(pdf, pdf.length);
// }
- public static String extractNormalizedTextTextual(InputStream pdfInputStream) throws PresentableException
+ public static String extractNormalizedTextTextual(PdfDataSource pdfDataSource) throws PresentableException
{
- String raw_document_text = TextualSignature.extractTextTextual(pdfInputStream);
+ String raw_document_text = TextualSignature.extractTextTextual(pdfDataSource);
String document_text = normalizeText(raw_document_text);
return document_text;
}
- public static String extractNormalizedTextTextual(InputStream pdfInputStream, int length) throws PresentableException
+ /**
+ @deprecated
+ */
+ public static String extractNormalizedTextTextual(byte [] pdf, int length) throws PresentableException
{
- DelimitedInputStream dis = new DelimitedInputStream(pdfInputStream, length);
- String raw_document_text = TextualSignature.extractTextTextual(dis);
+ ByteArrayPdfDataSourceImpl pdfDataSource = new ByteArrayPdfDataSourceImpl(pdf, length);
+ String raw_document_text = TextualSignature.extractTextTextual(pdfDataSource);
String document_text = normalizeText(raw_document_text);
return document_text;
}
+
+// public static String extractNormalizedTextTextual(InputStream pdfInputStream, int length) throws PresentableException
+// {
+// DelimitedInputStream dis = new DelimitedInputStream(pdfInputStream, length);
+// String raw_document_text = TextualSignature.extractTextTextual(dis);
+// String document_text = normalizeText(raw_document_text);
+// return document_text;
+// }
// /**
// * Extracts and normalizes the text from the pdf.
// *
@@ -1380,9 +1392,11 @@ public abstract class PdfAS
{
try
{
- InputStream is = pdfDataSource.createInputStream();
- PdfReader reader = new PdfReader(is);
- is.close();
+ //InputStream is = pdfDataSource.createInputStream();
+ // PERF: byte array instead of stream
+ byte [] pdf_data = pdfDataSource.getAsByteArray();
+ PdfReader reader = new PdfReader(pdf_data);
+ //is.close();
return reader;
}
catch (IOException e)
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
index a158729..b7fcb96 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
@@ -284,7 +284,7 @@ public class SettingsReader implements Serializable
if (logger_.isInfoEnabled())
{
File file = new File(settingsFile_);
- logger_.info("load Settings:" + file.getAbsolutePath());
+ logger_.debug("load Settings:" + file.getAbsolutePath());
// Properties sys_prop = System.getProperties();
// Enumeration prop_keys = sys_prop.propertyNames();
// while (prop_keys.hasMoreElements()) {
@@ -303,7 +303,7 @@ public class SettingsReader implements Serializable
// load properties from current package!
// properties_.load(getClass().getResourceAsStream(settingsFile_));
Enumeration prop_keys = properties_.propertyNames();
-
+
while (prop_keys.hasMoreElements())
{
String key = (String) prop_keys.nextElement();
@@ -456,8 +456,7 @@ public class SettingsReader implements Serializable
* the default value if the defaultKey is not found
* @return the value of the property key
*/
- public String getSetting(String primaryKey, String defaultKey,
- String defaultValue)
+ public String getSetting(String primaryKey, String defaultKey, String defaultValue)
{
String key = primaryKey;
String result = properties_.getProperty(key);
@@ -640,7 +639,7 @@ public class SettingsReader implements Serializable
public static void clearTemporaryDirectory()
{
File temp_dir = assembleTemporaryDirectoryFile();
- logger_.info("Clearing temporary directory: " + temp_dir);
+ logger_.debug("Clearing temporary directory: " + temp_dir);
if (!temp_dir.exists())
{
@@ -650,7 +649,7 @@ public class SettingsReader implements Serializable
File[] files = temp_dir.listFiles();
for (int i = 0; i < files.length; i++)
{
- logger_.info(" Clearing temporary file: " + files[i]);
+ logger_.debug(" Clearing temporary file: " + files[i]);
boolean delete_success = files[i].delete();
if (!delete_success)
{
@@ -662,7 +661,9 @@ public class SettingsReader implements Serializable
/**
* Initializes the paths of the SettingsReader for web application usage.
*
- * @param base_dir The base directory of this web application. E.g. TOMCAT_HOME/webapps/pdf-as
+ * @param base_dir
+ * The base directory of this web application. E.g.
+ * TOMCAT_HOME/webapps/pdf-as
*/
public static void initializeForWeb(String base_dir)
{
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
index b0c7c30..72565d9 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
@@ -448,7 +448,7 @@ public abstract class Main
{
carryOutVerify(input, connector, verify_which, messageOutput);
}
- messageOutput.close();
+ messageOutput.flush();
}
public static void carryOutSign(String input, String connector, String signature_mode, String signature_type, String pos_string, String user_name, String user_password, String output,
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java
index 2631028..6309ad4 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java
@@ -225,7 +225,7 @@ public class VerificationFilter
logger_.debug("Incemental block" + prev_end + " and there are " + text_holders.size() + " text holders");
logger_.debug("Checking for older textual Signatures");
logger_.debug("Extracting text to " + bpr.next_index);
- rest_text = PdfAS.extractNormalizedTextTextual(new ByteArrayInputStream(pdf), bpr.next_index);
+ rest_text = PdfAS.extractNormalizedTextTextual(pdf, bpr.next_index);
}
List old_holders = PdfAS.extractSignatureHoldersTextual(rest_text, true);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedSignator_1_0_0.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedSignator_1_0_0.java
index 4ef1e15..0728aae 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedSignator_1_0_0.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedSignator_1_0_0.java
@@ -87,7 +87,7 @@ public class DetachedSignator_1_0_0 implements Signator
iui.signature_type = signature_type;
iui.pos = pos;
- String document_text = PdfAS.extractNormalizedTextTextual(pdf.createInputStream());
+ String document_text = PdfAS.extractNormalizedTextTextual(pdf);
// logger_.debug("signed_text = " + document_text);
DataSource ds = new TextDataSourceImpl(document_text);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedfTextualSignator_1_0_0.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedfTextualSignator_1_0_0.java
index d7c79ea..923d232 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedfTextualSignator_1_0_0.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/DetachedfTextualSignator_1_0_0.java
@@ -95,7 +95,7 @@ public class DetachedfTextualSignator_1_0_0 implements Signator
iui.signature_type = signature_type;
iui.pos = pos;
- String document_text = PdfAS.extractNormalizedTextTextual(pdf.createInputStream());
+ String document_text = PdfAS.extractNormalizedTextTextual(pdf);
// logger_.debug("signed_text = " + document_text);
DataSource ds = new TextDataSourceImpl(document_text);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/TextualSignator_1_0_0.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/TextualSignator_1_0_0.java
index 33de15e..5ce21ce 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/TextualSignator_1_0_0.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/signators/TextualSignator_1_0_0.java
@@ -89,7 +89,7 @@ public class TextualSignator_1_0_0 implements Signator
iui.signature_type = signature_type;
iui.pos = pos;
- String document_text = PdfAS.extractNormalizedTextTextual(pdf.createInputStream());
+ String document_text = PdfAS.extractNormalizedTextTextual(pdf);
// logger_.debug("signed_text = " + document_text);
DataSource ds = new TextDataSourceImpl(document_text);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java
index 176c0f0..1cd5930 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_1_0_0.java
@@ -81,7 +81,7 @@ public class TextualVerificator_1_0_0 implements Verificator
public List parseBlock(byte[] pdf, FooterParseResult block,
int start_of_whole_block) throws PresentableException
{
- String block_text = PdfAS.extractNormalizedTextTextual(new ByteArrayInputStream(pdf), block.next_index);
+ String block_text = PdfAS.extractNormalizedTextTextual(pdf, block.next_index);
logger_.debug("Scanning block:");
//List signature_holders = PdfAS.extractSignatureHoldersTextual(block_text, false);
@@ -100,7 +100,7 @@ public class TextualVerificator_1_0_0 implements Verificator
{
text_holder_candidates = new ArrayList();
- String prev_text = PdfAS.extractNormalizedTextTextual(new ByteArrayInputStream(pdf), start_of_whole_block);
+ String prev_text = PdfAS.extractNormalizedTextTextual(pdf, start_of_whole_block);
logger_.debug("Scanning prev block:");
//List prev_signature_holders = PdfAS.extractSignatureHoldersTextual(prev_text, false);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_pdfasold.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_pdfasold.java
index ea84e7e..85bc96c 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_pdfasold.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/TextualVerificator_pdfasold.java
@@ -61,7 +61,7 @@ public class TextualVerificator_pdfasold implements Verificator
throw new PDFDocumentException(201, "The PDF-AS-old Verificator can only be applied on original documents.");
}
- String normalized_text = PdfAS.extractNormalizedTextTextual(new ByteArrayInputStream(pdf), block.next_index);
+ String normalized_text = PdfAS.extractNormalizedTextTextual(pdf, block.next_index);
logger_.debug("Scanning block:");
List signature_holders = PdfAS.extractSignatureHoldersTextual(normalized_text, true);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java
index d253393..677990b 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java
@@ -689,9 +689,10 @@ public abstract class BinarySignature
// System.out.println("wprinz: STAMPING PDF");
- InputStream is = original_document.createInputStream();
- PdfReader reader = new PdfReader(is);
- is.close();
+ //InputStream is = original_document.createInputStream();
+ byte [] pdf_data = original_document.getAsByteArray();
+ PdfReader reader = new PdfReader(pdf_data);
+ //is.close();
OutputStream baos = written_pdf.createOutputStream("application/pdf");
// ByteArrayOutputStream baos = new ByteArrayOutputStream();
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java
index 8b8475c..b801706 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java
@@ -134,9 +134,19 @@ public class EGIZDate {
if (li >= 19) {
date_value = new StringBuffer(date_value).deleteCharAt(li).toString();
}
- if (date_value.endsWith("Z")) {
- date_value = date_value.substring(0, date_value.length()-2) + "UTC";
- }
+ // FIXME: @iaik: wenn man bei UTC+"Z" die letzten -2 Zeichen durch "UTC" ersetzt verliert die Zeit ihre Sekunden-Einerstelle!!!!!!!
+ // alter code:
+// if (date_value.endsWith("Z")) {
+// date_value = date_value.substring(0, date_value.length()-2) + "UTC";
+// }
+ // neuer code:
+ if (date_value.endsWith("ZZ")) {
+ date_value = date_value.substring(0, date_value.length()-2) + "UTC";
+ }
+ if (date_value.endsWith("Z")) {
+ date_value = date_value.substring(0, date_value.length()-1) + "UTC";
+ }
+
} else {
date_value += "UTC";
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java
index e19c244..b40d129 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.util.List;
import at.gv.egiz.pdfas.framework.input.PdfDataSource;
+import at.gv.egiz.pdfas.impl.input.ByteArrayPdfDataSourceImpl;
import org.pdfbox.pdfparser.PDFParser;
import org.pdfbox.pdmodel.PDDocument;
@@ -47,7 +48,7 @@ public abstract class PDFUtilities
{
//ByteArrayInputStream original_bais = new ByteArrayInputStream(pdf);
//byte [] normalized_pdf = TextualSignature.normalizePDF(original_bais);
- byte [] normalized_pdf = TextualSignature.normalizePDF(pdfDataSource.createInputStream());
+ byte [] normalized_pdf = TextualSignature.normalizePDF(pdfDataSource);
// PERF: The whole PDF normalization process is costy
ByteArrayInputStream bais = new ByteArrayInputStream(normalized_pdf);
@@ -80,12 +81,20 @@ public abstract class PDFUtilities
return calculatePageLength(pdpage, footer_line);
}
+ /**
+ * @deprecated
+ * @param pdf
+ * @param footer_line
+ * @return
+ * @throws PDFDocumentException
+ */
public static float calculateLastPageLength(final byte[] pdf, float footer_line) throws PDFDocumentException
{
try
{
- ByteArrayInputStream original_bais = new ByteArrayInputStream(pdf);
- byte [] normalized_pdf = TextualSignature.normalizePDF(original_bais);
+ //ByteArrayInputStream original_bais = new ByteArrayInputStream(pdf);
+ PdfDataSource dataSource = new ByteArrayPdfDataSourceImpl(pdf);
+ byte [] normalized_pdf = TextualSignature.normalizePDF(dataSource);
ByteArrayInputStream bais = new ByteArrayInputStream(normalized_pdf);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TextualSignature.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TextualSignature.java
index 668bbcb..04b96fc 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TextualSignature.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TextualSignature.java
@@ -25,6 +25,7 @@ import java.io.InputStream;
import at.gv.egiz.pdfas.performance.PerformanceCounters;
import at.gv.egiz.pdfas.exceptions.pdf.TextExtractionException;
+import at.gv.egiz.pdfas.framework.input.PdfDataSource;
import org.apache.log4j.Logger;
import org.pdfbox.pdfparser.PDFParser;
@@ -64,7 +65,7 @@ public class TextualSignature
* @throws PresentableException
* Forwarded exception.
*/
- public static String extractTextTextual(InputStream pdf_stream) throws TextExtractionException
+ public static String extractTextTextual(PdfDataSource pdfDataSource) throws TextExtractionException
{
PerformanceCounters.textExtractions.increment();
@@ -83,8 +84,9 @@ public class TextualSignature
// byte[] bytes = normalizePDF(pdf_stream);
//iText
- PdfReader reader = new PdfReader(pdf_stream);
- pdf_stream.close();
+ byte [] pdf_data = pdfDataSource.getAsByteArray();
+ PdfReader reader = new PdfReader(pdf_data);
+ //pdf_stream.close();
// PERF: PDF normalization needs byte array - this is costy
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
@@ -202,11 +204,12 @@ public class TextualSignature
* @throws IOException
* @throws DocumentException
*/
- public static byte[] normalizePDF(InputStream input_pdf) throws IOException, DocumentException
+ public static byte[] normalizePDF(PdfDataSource pdfDataSource) throws IOException, DocumentException
{
- //iText
- PdfReader reader = new PdfReader(input_pdf);
- input_pdf.close();
+ //iText
+ byte [] pdf_data = pdfDataSource.getAsByteArray();
+ PdfReader reader = new PdfReader(pdf_data);
+ //input_pdf.close();
// PERF: PDF Normalization needs byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/tools/FileHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/tools/FileHelper.java
index 0c1a420..53ac7cf 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/tools/FileHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/tools/FileHelper.java
@@ -58,9 +58,9 @@ public class FileHelper {
}
reader.close();
} catch (FileNotFoundException e) {
- logger_.info("File not found:" + fileName);
+ logger_.debug("File not found:" + fileName);
} catch (IOException e) {
- logger_.info("File can not read:" + fileName);
+ logger_.debug("File can not read:" + fileName);
}
return file_string;
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java
index 2844c6d..ed4fc7a 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java
@@ -17,6 +17,9 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import at.gv.egiz.pdfas.exceptions.framework.SignatorException;
import at.gv.egiz.pdfas.framework.SignatorFactory;
import at.gv.egiz.pdfas.framework.signator.Signator;
@@ -25,10 +28,6 @@ import at.gv.egiz.pdfas.web.VerifySessionInformation;
import at.gv.egiz.pdfas.web.helper.SessionHelper;
import at.gv.egiz.pdfas.web.helper.SignServletHelper;
import at.gv.egiz.pdfas.web.helper.TempDirHelper;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException;
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java
index 60b3431..04971c6 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java
@@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletResponse;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.exceptions.ErrorCodeHelper;
import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException;
+import at.gv.egiz.pdfas.framework.input.PdfDataSource;
import at.gv.egiz.pdfas.impl.input.FileBasedPdfDataSourceImpl;
import at.gv.egiz.pdfas.web.SignSessionInformation;
import at.gv.egiz.pdfas.web.helper.SignServletHelper;
@@ -427,7 +428,7 @@ public class SignServlet extends HttpServlet
throw new PDFDocumentException(250, "The document is empty."); //$NON-NLS-1$
}
- FileBasedPdfDataSourceImpl pdfDataSource = null;
+ PdfDataSource pdfDataSource = null;
try
{
pdfDataSource = TempDirHelper.placePdfIntoTempDir(file_upload_fi.getInputStream(), doc_file_name);
@@ -571,7 +572,7 @@ public class SignServlet extends HttpServlet
protected String file_name = null;
- protected FileBasedPdfDataSourceImpl pdfDataSource = null;
+ protected PdfDataSource pdfDataSource = null;
// protected byte[] pdf = null;
}
} \ No newline at end of file