JAL-1943 don't try to unmarshal non-xml files in V1 project
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 23 Oct 2015 09:30:56 +0000 (10:30 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 23 Oct 2015 09:30:56 +0000 (10:30 +0100)
src/jalview/gui/Jalview2XML_V1.java

index b551f5d..61e20fa 100755 (executable)
@@ -44,6 +44,8 @@ import jalview.util.jarInputStreamProvider;
 import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
 
 import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.UnknownHostException;
 import java.util.Hashtable;
 import java.util.Vector;
 import java.util.jar.JarEntry;
@@ -51,8 +53,6 @@ import java.util.jar.JarInputStream;
 
 import javax.swing.JOptionPane;
 
-import org.exolab.castor.xml.IDResolver;
-
 /**
  * DOCUMENT ME!
  * 
@@ -127,33 +127,29 @@ public class Jalview2XML_V1
           jarentry = jin.getNextJarEntry();
         }
 
-        class NoDescIDResolver implements IDResolver
-        {
-          public Object resolve(String idref)
-          {
-            System.out.println(idref + " used");
-            return null;
-          }
-        }
-
         if (jarentry != null)
         {
-          InputStreamReader in = new InputStreamReader(jin, "UTF-8");
-          JalviewModel object = new JalviewModel();
+          entryCount++;
+          if (jarentry.getName().endsWith(".xml"))
+          {
+            Reader in = new InputStreamReader(jin, "UTF-8");
+            JalviewModel object = new JalviewModel();
 
-          object = object.unmarshal(in);
+            object = object.unmarshal(in);
 
-          af = LoadFromObject(object, file);
-          entryCount++;
+            af = LoadFromObject(object, file);
+          }
         }
+        jin.close();
       } while (jarentry != null);
-    } catch (final java.net.UnknownHostException ex)
+    } catch (final UnknownHostException ex)
     {
       ex.printStackTrace();
       if (raiseGUI)
       {
         javax.swing.SwingUtilities.invokeLater(new Runnable()
         {
+          @Override
           public void run()
           {
 
@@ -176,6 +172,7 @@ public class Jalview2XML_V1
       {
         javax.swing.SwingUtilities.invokeLater(new Runnable()
         {
+          @Override
           public void run()
           {