aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-06 16:56:26 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-06 16:56:26 +0000
commit12e08e6bc47592045f54e3b46274f0231e88d369 (patch)
tree0e4573a5a89f79da3c14b7f5d7807c92864df9e5 /src/main/java/at
parentf4f361e0e8af41e3d12ee3e36a1ba11e60a12077 (diff)
downloadpdf-as-3-12e08e6bc47592045f54e3b46274f0231e88d369.tar.gz
pdf-as-3-12e08e6bc47592045f54e3b46274f0231e88d369.tar.bz2
pdf-as-3-12e08e6bc47592045f54e3b46274f0231e88d369.zip
Removed dependency for VerifyServlet
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@677 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
index 919201f..e60708a 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
@@ -62,7 +62,6 @@ import at.knowcenter.wag.egov.egiz.sig.ConnectorFactory;
import at.knowcenter.wag.egov.egiz.sig.ConnectorInformation;
import at.knowcenter.wag.egov.egiz.sig.SignatureResponse;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
-import at.knowcenter.wag.egov.egiz.web.servlets.VerifyServlet;
/**
* The main program entry point of the commandline tool.
@@ -543,7 +542,7 @@ public abstract class Main
File file = new File(input);
if (logger_.isDebugEnabled())
fileSize = file.length();
- String extension = VerifyServlet.extractExtension(input);
+ String extension = extractExtension(input);
if (extension != null && extension.equals("txt"))
{
try
@@ -586,6 +585,34 @@ public abstract class Main
}
+ /**
+ * Extracts the extension from a file name string.
+ *
+ * <p>
+ * The extension of a file name is whatever text follows the last '.'.
+ * </p>
+ *
+ * @param file_name
+ * The file name.
+ * @return Returns the extension. If the file name ends with the '.', then an
+ * empty string is returned. If the file name doesn't contain any '.'
+ * or file_name is null, null is returned.
+ */
+ public static String extractExtension(String file_name)
+ {
+ if (file_name == null)
+ {
+ return null;
+ }
+
+ int dot_index = file_name.lastIndexOf('.');
+ if (dot_index < 0)
+ {
+ return null;
+ }
+ return file_name.substring(dot_index + 1);
+ }
+
public static void processSign(PdfDataSource pdfDataSource, String connector, String signature_mode, String signature_type, String pos_string, DataSink dataSink) throws PresentableException
{
pdfDataSource = PdfAS.applyStrictMode(pdfDataSource);