From f0a2059a38d5d843852d45abd825d092007352ef Mon Sep 17 00:00:00 2001 From: Paxy Date: Sun, 9 Aug 2020 13:23:41 +0200 Subject: [PATCH] Update SmartCardSigner.java --- src/main/java/rs/paxy/SmartCardSigner.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/rs/paxy/SmartCardSigner.java b/src/main/java/rs/paxy/SmartCardSigner.java index fdff7a7..8d167c1 100644 --- a/src/main/java/rs/paxy/SmartCardSigner.java +++ b/src/main/java/rs/paxy/SmartCardSigner.java @@ -117,8 +117,12 @@ public static void main(String[] args) throws Exception { if (args.length < 1) return; File input = new File(args[0]); - String path = input.getParent(); + if (!input.exists()) throw new Exception( + "Invalid path to input file: "+args[0]); + String path = input.getAbsoluteFile().getParent(); String name = input.getName(); + if (!name.contains(".pdf")) throw new Exception( + "PaxyPDFSigner supports only PDF input files."); String signedFile = path + "/" + name.replace(".pdf", "-signed.pdf"); new SmartCardSigner(input.getAbsolutePath(), signedFile, null);