aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib
diff options
context:
space:
mode:
authorAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-06-01 11:18:24 +0200
committerAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-06-01 11:18:24 +0200
commitfef273a399d7ce891262d217cc04e4aea032c919 (patch)
treee2a2221b4b4724de35b83909aa17cc544ea32dca /pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib
parent1c6646e49761792b63028aea06a2e3a318361955 (diff)
downloadpdf-as-4-fef273a399d7ce891262d217cc04e4aea032c919.tar.gz
pdf-as-4-fef273a399d7ce891262d217cc04e4aea032c919.tar.bz2
pdf-as-4-fef273a399d7ce891262d217cc04e4aea032c919.zip
try to parse placeholder id as int and sort as int with fallback to string
Diffstat (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib')
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java18
1 files changed, 13 insertions, 5 deletions
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 a6a7ced3..fd0472ac 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
@@ -922,11 +922,19 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
if(result == null) {
result = spd;
} else {
- String currentID = result.getId();
- String testID = spd.getId();
- //TODO why compare as string?
- 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;
+ }
}
}
}