aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java3
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java19
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java8
3 files changed, 22 insertions, 8 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java
index 5c3e548f..1929f95e 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java
@@ -24,6 +24,7 @@
package at.gv.egiz.pdfas.lib.impl;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
import javax.activation.DataSource;
@@ -84,6 +85,8 @@ protected Configuration configuration;
@Override
public void setDynamicSignatureBlockArguments(Map<String, String> map) throws PdfAsException {
+ if(map == null)
+ map = new HashMap<String, String>();
Map<String, String> tmpMap = Collections.unmodifiableMap(map);
String keyRegex = configuration.getValue(IConfigurationConstants.SIG_BLOCK_PARAMETER_KEY_REGEX);
String valueRegex = configuration.getValue(IConfigurationConstants.SIG_BLOCK_PARAMETER_VALUE_REGEX);
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
index a33517cb..3cf0853f 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
@@ -938,16 +938,25 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
if(placeholders!=null) {
for(int i = 0; i < placeholders.size(); ++i) {
//take smallest id
- if(!existingPlaceholders.contains(placeholders.get(i).getPlaceholderName())) {
+ if(!existingPlaceholders.contains(placeholders.get(i).getPlaceholderName())) {
SignaturePlaceholderData spd = placeholders.get(i);
if (spd.getId() != null) {
if(result == null) {
result = spd;
} else {
- String currentID = result.getId();
- String testID = spd.getId();
- if(testID.compareToIgnoreCase(currentID) < 0) {
- result = spd;
+ try{
+ int currentID = Integer.parseInt(result.getId());
+ int testID = Integer.parseInt(spd.getId());
+ if(testID < currentID) {
+ result = spd;
+ }
+ }catch(Exception e){
+ //fallback to string compare
+ String currentID = result.getId();
+ String testID = spd.getId();
+ if(testID.compareToIgnoreCase(currentID) < 0) {
+ result = spd;
+ }
}
}
}
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java
index 5f2dc95c..6e80fad8 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java
@@ -73,9 +73,11 @@ public class PlaceholderGeneratorServlet extends HttpServlet implements Placehol
String filename = "placeholder";
if(id != null && !id.isEmpty()) {
- id = id.replaceAll("[^a-zA-Z0-9]", "_");
- buildString = buildString + ";" + SignaturePlaceholderData.ID_KEY + "=" + id;
- filename = filename + "_" + id;
+ id = id.replaceAll("[^0-9]", "");
+ if(id != null && !id.isEmpty()) {
+ buildString = buildString + ";" + SignaturePlaceholderData.ID_KEY + "=" + id;
+ filename = filename + "_" + id;
+ }
}
if(profile != null && !profile.isEmpty()) {