From bab92f1e137903283c0b0fb986d01b6f91cdd82e Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 9 May 2016 15:18:12 +0100 Subject: [PATCH] JAL-2098 identify feature file with "<" in feature type name --- src/jalview/io/IdentifyFile.java | 30 +++++++----------------------- test/jalview/io/IdentifyFileTest.java | 25 ++++++++++++++++++------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 71f4237..889359f 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -230,7 +230,6 @@ public class IdentifyFile } catch (IOException ex) { } - ; if (dta != null && dta.indexOf("*") > -1) { starterm = true; @@ -250,34 +249,19 @@ public class IdentifyFile // read as a FASTA (probably) break; } - if ((data.indexOf("<") > -1)) // possible Markup Language data i.e HTML, + int lessThan = data.indexOf("<"); + if ((lessThan > -1)) // possible Markup Language data i.e HTML, // RNAML, XML { - // FIXME this is nuts - it consumes the rest of the file if no match - boolean identified = false; - do - { - if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>")) - { - reply = HtmlFile.FILE_DESC; - identified = true; - break; - } - - if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>")) - { - reply = "RNAML"; - identified = true; - break; - } - } while ((data = source.nextLine()) != null); - - if (identified) + String upper = data.toUpperCase(); + if (upper.substring(lessThan).startsWith("