From: Jim Procter Date: Tue, 12 Nov 2024 15:36:44 +0000 (+0000) Subject: JAL-4077 JAL-3921 even more generous incremental backoff and warnings to log and... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f2b9dd1eb23246ad6c5447c2f49241d0306be68d;p=jalview.git JAL-4077 JAL-3921 even more generous incremental backoff and warnings to log and GUI if the saved structure session file was zero length --- diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index bd757e8..b8446cd 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -1371,17 +1371,21 @@ public abstract class StructureViewerBase extends GStructureViewer { try { - Thread.sleep(5); + Thread.sleep(5+2*(51-wait)); } catch (InterruptedException e) { } long nextl = session.length(); + Console.trace("Finished waiting around for session save... ("+nextl+" length - was "+l+" and waits "+wait+")"); if (nextl != l) { wait = 50; l = nextl; } } while (--wait > 0); + if (l==0) { + Console.error("Structure viewer session save resulted in zero length file. This is a bug, please report it."); + } return session; } diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index e2a5508..afcd450 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -1236,6 +1236,10 @@ public class Jalview2XML File viewerState = viewFrame.saveSession(); if (viewerState != null) { + if (viewerState.length()==0) + { + addErrorMessage("Dataloss warning: structure viewer session file was zero length."); + } copyFileToJar(jout, viewerState.getPath(), getViewerJarEntryName(viewId), viewerType); } @@ -1891,6 +1895,15 @@ public class Jalview2XML return object; } + private void addErrorMessage(String string) + { + if (errorMessage==null) + { + errorMessage=""; + } + errorMessage+=string+"\n"; + } + /** * Writes PCA viewer attributes and computed values to an XML model object and * adds it to the JalviewModel. Any exceptions are reported by logging.