Fix problem with the JpredWS service. Now Jws2Client is able to test the service
[jabaws.git] / webservices / compbio / ws / client / IOHelper.java
index 88b695a..3e4b726 100644 (file)
@@ -1,3 +1,20 @@
+/* Copyright (c) 2011 Peter Troshin\r
+ *  \r
+ *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
+ * \r
+ *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
+ *  Apache License version 2 as published by the Apache Software Foundation\r
+ * \r
+ *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
+ *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
+ *  License for more details.\r
+ * \r
+ *  A copy of the license is in apache_license.txt. It is also available here:\r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
+ * \r
+ * Any republication or derived work distributed in source code form\r
+ * must include this copyright and license notice.\r
+ */\r
 package compbio.ws.client;\r
 \r
 import static compbio.ws.client.Constraints.pseparator;\r
@@ -29,8 +46,8 @@ public class IOHelper {
        static File getFile(String[] cmd, String key, boolean mustExist)\r
                        throws IOException {\r
                assert key != null && key.trim().length() != 0;\r
-               for (int i = 0; i < cmd.length; i++) {\r
-                       String filename = cmd[i];\r
+               for (String c : cmd) {\r
+                       String filename = c;\r
                        filename = filename.trim();\r
                        if (filename.toLowerCase().startsWith(key + pseparator)) {\r
                                filename = filename.substring((key + pseparator).length());\r
@@ -112,6 +129,9 @@ public class IOHelper {
         *            the AACon scores to output\r
         */\r
        static void writeOut(Writer writer, ScoreManager results) {\r
+               if (results == null) {\r
+                       return;\r
+               }\r
                try {\r
                        results.writeOut(writer);\r
                } catch (IOException e) {\r