aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-01-14 14:39:47 +0000
committerferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-01-14 14:39:47 +0000
commitaa880a2ae7b078bc776a3f04f47eda2782f80787 (patch)
tree8174d86bd58837f089d91d1b91fb398619c92d69 /src/main/java/at
parent036a581e919c8c9ee36435a86a5a414dd2599115 (diff)
downloadpdf-as-3-aa880a2ae7b078bc776a3f04f47eda2782f80787.tar.gz
pdf-as-3-aa880a2ae7b078bc776a3f04f47eda2782f80787.tar.bz2
pdf-as-3-aa880a2ae7b078bc776a3f04f47eda2782f80787.zip
fixing ognl + linebreak
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@550 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java20
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java3
2 files changed, 19 insertions, 4 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
index 4b9a566..36d3764 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
@@ -43,8 +43,10 @@ import at.gv.egiz.pdfas.utils.OgnlUtil;
import at.knowcenter.wag.egov.egiz.PdfAS;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
+import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException;
import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
+import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
import at.knowcenter.wag.egov.egiz.framework.SignatorFactory;
import at.knowcenter.wag.egov.egiz.pdf.BinarySignature;
import at.knowcenter.wag.egov.egiz.pdf.IncrementalUpdateInformation;
@@ -58,6 +60,7 @@ import at.knowcenter.wag.egov.egiz.sig.SignatureFieldDefinition;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
import at.knowcenter.wag.egov.egiz.sig.signatureobject.SignatureObjectHelper;
+import at.knowcenter.wag.egov.egiz.tools.Normalizer;
import at.knowcenter.wag.exactparser.ByteArrayUtils;
import com.lowagie.text.pdf.PdfPTable;
@@ -94,6 +97,8 @@ public class BinarySignator_1_0_0 implements Signator
*/
public static final PdfASID MY_ID = new PdfASID(SignatorFactory.VENDOR, SignatorFactory.TYPE_BINARY, SignatorFactory.VERSION_1_0_0);
+ private Normalizer normalizer;
+
/**
* @see at.knowcenter.wag.egov.egiz.framework.Signator#getMyId()
*/
@@ -107,7 +112,15 @@ public class BinarySignator_1_0_0 implements Signator
*/
public BinarySignator_1_0_0()
{
- // Default constructor.
+ try
+ {
+ this.normalizer = new Normalizer();
+ }
+ catch (NormalizeException e)
+ {
+ String msg = "Normalizer can not be initialized";
+ throw new RuntimeException(msg, new SignatureException(400, msg, e));
+ }
}
/**
@@ -320,8 +333,9 @@ public class BinarySignator_1_0_0 implements Signator
// dferbas
if (ognl.containsExpression(ri.sfd.value)) {
// evaluate expression
- String res = ognl.compileMessage(ri.sfd.value);
- ri.value = res;
+ String res = ognl.compileMessage(ri.sfd.value);
+
+ ri.value = this.normalizer.normalize(res);
} else {
ri.value = iui.signed_signature_object.retrieveStringValue(ri.sfd.field_name);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java
index b407b61..fdb37a9 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java
@@ -120,7 +120,8 @@ public class SplitStrings
System.arraycopy(data, 0, this.pdf, this.strings[this.cur_string].string_start + this.cur_pos, data.length);
this.cur_pos += data.length;
- if (data[data.length-1] == '\n') {
+ if (data[data.length-1] == '\n') {
+ this.cur_pos -= 1; // remove \n from output
newline();
}
}