X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FJPredClient.java;h=8f94e97a6d6946f4a1e9c08d9aade46da18f7d66;hb=83b24eab35785ea8473763ea5ed175a1fa63a4d1;hp=65f03253c61d59314c0f655640090c586714303f;hpb=503023b56eda1ae799c73b4189921bb2d60cc5d7;p=jalview.git diff --git a/src/jalview/ws/JPredClient.java b/src/jalview/ws/JPredClient.java index 65f0325..8f94e97 100755 --- a/src/jalview/ws/JPredClient.java +++ b/src/jalview/ws/JPredClient.java @@ -26,6 +26,7 @@ import ext.vamsas.*; import jalview.analysis.*; import jalview.datamodel.*; import jalview.gui.*; +import jalview.io.FormatAdapter; public class JPredClient extends WSClient @@ -190,7 +191,7 @@ public class JPredClient "Timed out when communicating with server\nTry again later.\n")); } if (result.getState()==0) - jalview.bin.Jalview.log.debug("Finished "+jobId); + jalview.bin.Cache.log.debug("Finished "+jobId); if (result.isRunning()) { wsInfo.setStatus(WebserviceInfo.STATE_RUNNING); @@ -248,16 +249,29 @@ public class JPredClient { } } + catch (OutOfMemoryError er) + { + jobComplete = true; + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Out of memory handling result!!" + + + "\nSee help files for increasing Java Virtual Machine memory." + , "Out of memory", + JOptionPane.WARNING_MESSAGE); + System.out.println("JPredClient: "+er); + System.gc(); + } } - - if (! (result.isJobFailed() || result.isServerError())) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); - } - else - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); - } + if (result!=null) + if (! (result.isJobFailed() || result.isServerError())) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); + } + else + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + } } void StartJob() @@ -291,19 +305,30 @@ public class JPredClient } catch (Exception e) { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); - allowedServerExceptions = 0; - jobComplete = false; - - wsInfo.appendProgressText("Failed to submit the prediction.\n" - + - "It is most likely that there is a problem with the server.\n" - + "Just close the window\n"); - System.err.println( - "JPredWS Client: Failed to submit the prediction (Probably a server error - see below)\n" + - e.toString() + "\n"); - - jalview.bin.Jalview.log.debug("Failed Submission",e); + if (e.getMessage().indexOf("Exception")>-1) { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo.setProgressText( + "Failed to submit the prediction. (Just close the window)\n" + + + "It is most likely that there is a problem with the server.\n"); + System.err.println( + "JPredWS Client: Failed to submit the prediction. Quite possibly because of a server error - see below)\n" + + e.getMessage() + "\n"); + + jalview.bin.Cache.log.warn("Server Exception",e); + } else { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + // JBPNote - this could be a popup informing the user of the problem. + wsInfo.setProgressText("Failed to submit the prediction:\n" + +e.getMessage()+ + wsInfo.getProgressText()); + + jalview.bin.Cache.log.debug("Failed Submission",e); + + } + allowedServerExceptions = -1; + jobComplete = true; + } } @@ -356,27 +381,27 @@ public class JPredClient try { - jalview.bin.Jalview.log.debug("Parsing output from JNet job."); + jalview.bin.Cache.log.debug("Parsing output from JNet job."); // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", "File"); jalview.io.JPredFile prediction = new jalview.io.JPredFile(result. getPredfile(), "Paste"); SequenceI[] preds = prediction.getSeqsAsArray(); - jalview.bin.Jalview.log.debug("Got prediction profile."); + jalview.bin.Cache.log.debug("Got prediction profile."); Alignment al; int FirstSeq; // the position of the query sequence in Alignment al boolean noMsa = true; // set if no MSA has been returned by JPred if ( (this.msa != null) && (result.getAligfile() != null)) { - jalview.bin.Jalview.log.debug("Getting associated alignment."); + jalview.bin.Cache.log.debug("Getting associated alignment."); // we ignore the returned alignment if we only predicted on a single sequence String format = jalview.io.IdentifyFile.Identify(result.getAligfile(), "Paste"); if (jalview.io.FormatAdapter.formats.contains(format)) { - al = new Alignment(jalview.io.FormatAdapter.readFile( + al = new Alignment(new FormatAdapter().readFile( result.getAligfile(), "Paste", format)); for (int i=0, j=al.getHeight(); i