JAL-3858 report errors when trying to parse JSON to extract PAE and raise a warning...
[jalview.git] / src / jalview / ext / jmol / JmolParser.java
index f0e477c..25b52b4 100644 (file)
@@ -47,6 +47,7 @@ import jalview.datamodel.SequenceI;
 import jalview.datamodel.annotations.AlphaFoldAnnotationRowBuilder;
 import jalview.datamodel.annotations.AnnotationRowBuilder;
 import jalview.io.DataSourceType;
+import jalview.io.FileFormatException;
 import jalview.io.FileParse;
 import jalview.io.StructureFile;
 import jalview.schemes.ResidueProperties;
@@ -303,18 +304,29 @@ public class JmolParser extends StructureFile implements JmolStatusListener
       // add a PAEMatrix if set (either by above or otherwise)
       if (hasPAEMatrix())
       {
-        Alignment al = new Alignment(prot.toArray(new SequenceI[0]));
-        EBIAlfaFold.addAlphaFoldPAE(al, new File(this.getPAEMatrix()), 0,
-                null, false, false);
-
-        if (al.getAlignmentAnnotation() != null)
+        try
         {
-          for (AlignmentAnnotation alann : al.getAlignmentAnnotation())
+          Alignment al = new Alignment(prot.toArray(new SequenceI[0]));
+          EBIAlfaFold.addAlphaFoldPAE(al, new File(this.getPAEMatrix()), 0,
+                  null, false, false);
+
+          if (al.getAlignmentAnnotation() != null)
           {
-            annotations.add(alann);
+            for (AlignmentAnnotation alann : al.getAlignmentAnnotation())
+            {
+              annotations.add(alann);
+            }
           }
+        } catch (Throwable ff)
+        {
+          Console.error("Couldn't import PAE Matrix from " + getPAEMatrix(),
+                  ff);
+          warningMessage += "Couldn't import PAE Matrix"
+                  + getNewlineString() + ff.getLocalizedMessage()
+                  + getNewlineString();
         }
       }
+
     } catch (OutOfMemoryError er)
     {
       System.out.println(