Remove redundancy in Eclipse
[jalview.git] / src / jalview / ws / JPredClient.java
index 9fe7e27..fdf0cec 100755 (executable)
@@ -26,6 +26,7 @@ import ext.vamsas.*;
 import jalview.analysis.*;\r
 import jalview.datamodel.*;\r
 import jalview.gui.*;\r
+import jalview.io.FormatAdapter;\r
 \r
 public class JPredClient\r
     extends WSClient\r
@@ -136,7 +137,7 @@ public class JPredClient
                              " Service location failed\nfor URL :" + WsURL +\r
                              "\n" +\r
                              ex.getMessage());\r
-      wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);\r
+      wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
 \r
       return false;\r
     }\r
@@ -171,9 +172,8 @@ public class JPredClient
       this.sequence.setSeq(AlignSeq.extractGaps("-. ",\r
                                                 msf[0].getSequence()));\r
 \r
-      jalview.io.PileUpfile mwrite = new jalview.io.PileUpfile();\r
       this.msa = new vamsas.objects.simple.Msfalignment();\r
-      msa.setMsf(mwrite.print(msf));\r
+      msa.setMsf(jalview.io.PileUpfile.print(msf));\r
     }\r
 \r
     public void run()\r
@@ -304,26 +304,36 @@ public class JPredClient
       }\r
       catch (Exception e)\r
       {\r
-        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+        if (e.getMessage().indexOf("Exception")>-1) {\r
+          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+          wsInfo.setProgressText(\r
+              "Failed to submit the prediction. (Just close the window)\n"\r
+              +\r
+              "It is most likely that there is a problem with the server.\n");\r
+          System.err.println(\r
+              "JPredWS Client: Failed to submit the prediction. Quite possibly because of a server error - see below)\n" +\r
+              e.getMessage() + "\n");\r
+\r
+          jalview.bin.Cache.log.warn("Server Exception",e);\r
+        } else {\r
+          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+          // JBPNote - this could be a popup informing the user of the problem.\r
+          wsInfo.setProgressText("Failed to submit the prediction:\n"\r
+                                 +e.getMessage()+\r
+                                 wsInfo.getProgressText());\r
+\r
+          jalview.bin.Cache.log.debug("Failed Submission",e);\r
+\r
+        }\r
         allowedServerExceptions = -1;\r
         jobComplete = true;\r
 \r
-        wsInfo.setProgressText("Failed to submit the prediction. (Just close the window)\n"\r
-                                  + ((e.getMessage().indexOf("Exception")>-1) ? (\r
-                                  "It is most likely that there is a problem with the server.\n")\r
-                              : e.getMessage())\r
-                                  +wsInfo.getProgressText());\r
-        System.err.println(\r
-            "JPredWS Client: Failed to submit the prediction (Possibly a server error - see below)\n" +\r
-            e.getMessage() + "\n");\r
-\r
-        jalview.bin.Cache.log.debug("Failed Submission",e);\r
       }\r
     }\r
 \r
 \r
 \r
-    private void addFloatAnnotations(Alignment al, int[] gapmap,\r
+  /*  private void addFloatAnnotations(Alignment al, int[] gapmap,\r
                                      Vector values, String Symname,\r
                                      String Visname, float min,\r
                                      float max, int winLength)\r
@@ -339,7 +349,7 @@ public class JPredClient
 \r
       al.addAnnotation(new AlignmentAnnotation(Symname, Visname,\r
                                                annotations, min, max, winLength));\r
-    }\r
+    }*/\r
 \r
     void parseResult()\r
     {\r
@@ -390,7 +400,7 @@ public class JPredClient
 \r
           if (jalview.io.FormatAdapter.formats.contains(format))\r
           {\r
-            al = new Alignment(jalview.io.FormatAdapter.readFile(\r
+            al = new Alignment(new FormatAdapter().readFile(\r
                 result.getAligfile(), "Paste", format));\r
             for (int i=0, j=al.getHeight(); i<j; i++) {\r
               SequenceI sq = al.getSequenceAt(i);\r
@@ -507,7 +517,7 @@ public class JPredClient
           i++;\r
         }\r
 \r
-        Hashtable scores = prediction.getScores();\r
+        //Hashtable scores = prediction.getScores();\r
 \r
         /*  addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPH"),\r
                               "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);\r