JAL-1499 first pass update of parsing and tests, more to come
[jalview.git] / src / jalview / io / IdentifyFile.java
index a5e7fbc..ef96123 100755 (executable)
@@ -132,6 +132,11 @@ public class IdentifyFile
         }
         data = data.toUpperCase();
 
+        if (data.startsWith("#MEGA"))
+        {
+          reply = "MEGA";
+          break;
+        }
         if (data.startsWith("##GFF-VERSION"))
         {
           reply = GFF3File;
@@ -260,6 +265,10 @@ public class IdentifyFile
           {
             break;
           }
+          if (data == null)
+          {
+            break;
+          }
         }
 
         if (data.indexOf("{\"") > -1)
@@ -306,19 +315,18 @@ public class IdentifyFile
           break;
         }
 
-
         /*
          * // TODO comment out SimpleBLAST identification for Jalview 2.4.1 else
          * if (!lineswereskipped && data.indexOf("BLAST")<4) { reply =
          * "SimpleBLAST"; break;
-         *
+         * 
          * } // end comments for Jalview 2.4.1
          */
         else if (!lineswereskipped && data.charAt(0) != '*'
                 && data.charAt(0) != ' '
                 && data.indexOf(":") < data.indexOf(",")) // &&
-          // data.indexOf(",")<data.indexOf(",",
-          // data.indexOf(",")))
+        // data.indexOf(",")<data.indexOf(",",
+        // data.indexOf(",")))
         {
           // file looks like a concise JNet file
           reply = "JnetFile";
@@ -344,7 +352,7 @@ public class IdentifyFile
     if (length == 0)
     {
       System.err
-      .println("File Identification failed! - Empty file was read.");
+              .println("File Identification failed! - Empty file was read.");
       return "EMPTY DATA FILE";
     }
     return reply;