--- /dev/null
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.File;\r
+import java.util.jar.JarFile;\r
+/**\r
+ * really simple test to see if we can open an archive and test for the existence of\r
+ * an entry called vamssDocument.xml.\r
+ * \r
+ * 'Pathological' archives fail this test (due to things like funny characters or lots of '.' in the entry name.\r
+ * \r
+ * @author JimP\r
+ *\r
+ */\r
+public class ZipTest {\r
+\r
+ /**\r
+ * @param args single filename as an argument to open as a Jar file.\r
+ */\r
+ public static void main(String[] args) {\r
+ File av = new File(args[0]);\r
+ try {\r
+ JarFile jf = new JarFile(av, false, JarFile.OPEN_READ);\r
+ if (jf.getEntry("vamsasDocument.xml")!=null)\r
+ {\r
+ System.out.println("Valid archive "+av);\r
+ }\r
+ jf.close();\r
+ } catch (Exception f)\r
+ {\r
+ System.out.println("Couldn't access jar archive "+av);\r
+ f.printStackTrace(System.out);\r
+ }\r
+ }\r
+}\r