JAL-3577 cleaned up old DMG files. Added NON-RELEASE DMG files. Changed how Jalview...
[jalview.git] / src / jalview / io / SequenceAnnotationReport.java
index 9d82d66..0125277 100644 (file)
@@ -66,7 +66,7 @@ public class SequenceAnnotationReport
    * Comparator to order DBRefEntry by Source + accession id (case-insensitive),
    * with 'Primary' sources placed before others, and 'chromosome' first of all
    */
-  private static Comparator<DBRefEntry> comparator = new Comparator<>()
+  private static Comparator<DBRefEntry> comparator = new Comparator<DBRefEntry>()
   {
 
     @Override
@@ -204,7 +204,7 @@ public class SequenceAnnotationReport
     {
       if (feature.getBegin() == rpos || feature.getEnd() == rpos)
       {
-        if (sb.length() > 6)
+        if (sb0.length() > 6)
         {
           sb.append("<br/>");
         }
@@ -240,9 +240,11 @@ public class SequenceAnnotationReport
 
         /*
          * truncate overlong descriptions unless they contain an href
-         * (as truncation could leave corrupted html)
+         * before the truncation point (as truncation could leave corrupted html)
          */
-        boolean hasLink = description.indexOf("a href") > -1;
+        int linkindex = description.toLowerCase().indexOf("<a ");
+        boolean hasLink = linkindex > -1
+                && linkindex < MAX_DESCRIPTION_LENGTH;
         if (description.length() > MAX_DESCRIPTION_LENGTH && !hasLink)
         {
           description = description.substring(0, MAX_DESCRIPTION_LENGTH)
@@ -369,7 +371,8 @@ public class SequenceAnnotationReport
                       + (urllink.get(0).toLowerCase()
                               .equals(urllink.get(1).toLowerCase()) ? urllink
                               .get(0) : (urllink.get(0) + ":" + urllink
-                              .get(1))) + "</a></br>");
+                                              .get(1)))
+                      + "</a><br/>");
             }
           } catch (Exception x)
           {