+/*\r
+ * This file is part of the Vamsas Client version 0.2. \r
+ * Copyright 2010 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.test.simpleclient;\r
\r
import java.io.File;\r
import java.util.jar.JarFile;\r
+\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
+ * really simple test to see if we can open an archive and test for the\r
+ * existence of 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
+ * 'Pathological' archives fail this test (due to things like funny characters\r
+ * or lots of '.' in the entry name.\r
* \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class ZipTest {\r
\r
/**\r
- * @param args single filename as an argument to open as a Jar file.\r
+ * @param args\r
+ * 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
- boolean jfailed=false;\r
+ boolean jfailed = false;\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
+ if (jf.getEntry("vamsasDocument.xml") != null) {\r
+ System.out.println("Valid archive " + av);\r
}\r
jf.close();\r
return;\r
- } catch (Exception f)\r
- {\r
- System.out.println("Couldn't access jar archive "+av);\r
+ } catch (Exception f) {\r
+ System.out.println("Couldn't access jar archive " + av);\r
f.printStackTrace(System.out);\r
}\r
try {\r
System.out.println("Trying the Apache Zip Package:");\r
org.apache.tools.zip.ZipFile jf = new org.apache.tools.zip.ZipFile(av);\r
- if (jf.getEntry("vamsasDocument.xml")!=null)\r
- {\r
- System.out.println("Valid archive "+av);\r
+ if (jf.getEntry("vamsasDocument.xml") != null) {\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
+ } catch (Exception f) {\r
+ System.out.println("Couldn't access jar archive " + av);\r
f.printStackTrace(System.out);\r
}\r
}\r