aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-03-07 15:47:33 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-03-07 15:47:33 +0000
commitc751dda6d26a2b0bbb1eb4c0ea1b0bc7a0e7f42d (patch)
tree54a91b692e3718d9d4c5b4917a462cfd1d2530f1 /src/main/java
parentb3b273b8ef9927c99fe582ddd9553cc0dca9e46f (diff)
downloadpdf-as-3-c751dda6d26a2b0bbb1eb4c0ea1b0bc7a0e7f42d.tar.gz
pdf-as-3-c751dda6d26a2b0bbb1eb4c0ea1b0bc7a0e7f42d.tar.bz2
pdf-as-3-c751dda6d26a2b0bbb1eb4c0ea1b0bc7a0e7f42d.zip
add more defense if link struct cannot be found
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@775 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
index 859d2c0..8fe9e62 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
@@ -62,6 +62,8 @@ public class StructContentHelper implements StructContentWriter {
private int linkMcid = -1;
private String linkUrlString = null;
private boolean isTagged = false;
+ private Map linkPosMap = new HashMap();
+ private Map tmpMap = new HashMap();
private PdfStamper stamper;
private PdfStamperImp stamperImp;
@@ -234,7 +236,7 @@ public class StructContentHelper implements StructContentWriter {
* @throws PresentableException
*/
void buildVerifyLinkStructData(PdfTemplate sigBlockObj, ActualTablePos atp) throws PresentableException {
- if (!this.isTagged || !this.isLinkMarked()) return;
+ if (!this.isTagged || !this.isLinkMarked() || !isLinkFound()) return;
try {
PdfNumber parentTreeKey = getNewParentTreeKey();
@@ -242,7 +244,7 @@ public class StructContentHelper implements StructContentWriter {
PdfArray annots = obrainAnnotsFromPage();
PdfIndirectReference linkAnnotRef = createLinkAnnot(parentTreeKey, atp);
- annots.add(linkAnnotRef);
+ annots.add(linkAnnotRef);
PdfIndirectReference objr = createObjrStructElem(linkAnnotRef);
PdfIndirectReference mcr = createMcrStructElem(this.linkMcid, sigBlockObj.getIndirectReference());
@@ -280,6 +282,10 @@ public class StructContentHelper implements StructContentWriter {
}
}
+ private boolean isLinkFound() {
+ return this.linkUrlString != null && this.verifyLinkCellPos != null && this.linkPosMap.size() > 0 && this.linkMcid >= 0;
+ }
+
/**
* Build new StructParent entry for signature annotation.
* @return
@@ -412,13 +418,11 @@ public class StructContentHelper implements StructContentWriter {
public void storeCurrentPosAsLink() {
this.verifyLinkCellPos = new Rectangle(this.tempMarkedPos);
}
-
- private Map tmpMap = new HashMap();
+
public void putVal(String key, Object val) {
tmpMap.put(key, val);
}
- private Map linkPosMap;
public void storeVals() {
linkPosMap = new HashMap(tmpMap);
}