aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter
diff options
context:
space:
mode:
authorwprinz <wprinz@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-16 12:24:14 +0000
committerwprinz <wprinz@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-16 12:24:14 +0000
commitb1fc4f688639f938535558ec2dd245c115c6be16 (patch)
tree85e135dc0c2350d6109a6253898ed76fe4da7158 /src/main/java/at/knowcenter
parent7bb909f4091af4117679159d288703d2e8e4e0c7 (diff)
downloadpdf-as-3-b1fc4f688639f938535558ec2dd245c115c6be16.tar.gz
pdf-as-3-b1fc4f688639f938535558ec2dd245c115c6be16.tar.bz2
pdf-as-3-b1fc4f688639f938535558ec2dd245c115c6be16.zip
line_break_tolerance über config.properties konfigurierbarREL-3.0.6@290
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@289 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java30
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java2
2 files changed, 24 insertions, 8 deletions
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 02b1cd1..bb34040 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
@@ -17,13 +17,8 @@
*/
package at.knowcenter.wag.egov.egiz.pdf;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
@@ -50,7 +45,6 @@ import at.knowcenter.wag.egov.egiz.exceptions.PlaceholderException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
-import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException;
import at.knowcenter.wag.egov.egiz.sig.SignatureFieldDefinition;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypeDefinition;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
@@ -667,6 +661,26 @@ public abstract class BinarySignature
// }
// }
+ protected static int getLineBreakTolerance(IncrementalUpdateInformation iui) throws PDFDocumentException
+ {
+ SettingsReader settings;
+ try
+ {
+ settings = SettingsReader.getInstance();
+ }
+ catch (SettingsException e)
+ {
+ throw new PDFDocumentException(e.getErrorCode(), e);
+ }
+ String phLineBreakTolerance = SignatureTypeDefinition.readPhLenStringFromSettings(settings, iui.signProfile, "line_break_tolerance");
+ int lineBreakTolerance = LINE_BREAK_TOLERANCE;
+ if (phLineBreakTolerance != null)
+ {
+ lineBreakTolerance = Integer.parseInt(phLineBreakTolerance);
+ }
+ return lineBreakTolerance;
+ }
+
protected static int getCertificatePlaceholderLength(IncrementalUpdateInformation iui) throws SettingNotFoundException
{
SettingsReader settings;
@@ -1356,6 +1370,8 @@ public abstract class BinarySignature
*/
public static void replacePlaceholders(IncrementalUpdateInformation iui) throws PDFDocumentException
{
+ final int lineBreakTolerance = getLineBreakTolerance(iui);
+
final byte[] signed_pdf = iui.signed_pdf;
// int num_replaces = calcNumReps(iui.replaces);
@@ -1413,7 +1429,7 @@ public abstract class BinarySignature
encoding_entry_index++;
}
- Placeholder.replacePlaceholderWithTolerance(signed_pdf, ri.replaces, replace_bytes, LINE_BREAK_TOLERANCE);
+ Placeholder.replacePlaceholderWithTolerance(signed_pdf, ri.replaces, replace_bytes, lineBreakTolerance);
}
catch (PlaceholderException e)
{
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java
index 000b3c2..6523db9 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java
@@ -352,7 +352,7 @@ public abstract class Placeholder
*/
protected static boolean canBreakAfter(byte character)
{
- return (character == ' ' || character == ',' || character == ';');
+ return (character == ' ' || character == ',' || character == ';' || character == '-');
}
/**