JAL-722 updated from 2.11.2 develop branch - needs further work before release
[jalview.git] / src / jalview / project / Jalview2XML.java
index 64b3a9c..985aece 100644 (file)
@@ -54,6 +54,7 @@ import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -913,13 +914,12 @@ public class Jalview2XML
     }
     if (jal.getProperties() != null)
     {
-      Enumeration en = jal.getProperties().keys();
-      while (en.hasMoreElements())
+      for (Entry<Object, Object> prop : jal.getProperties().entrySet())
       {
-        String key = en.nextElement().toString();
+        String key = prop.getKey().toString();
         SequenceSetProperties ssp = new SequenceSetProperties();
         ssp.setKey(key);
-        ssp.setValue(jal.getProperties().get(key).toString());
+        ssp.setValue(prop.getValue().toString());
         // vamsasSet.addSequenceSetProperties(ssp);
         vamsasSet.getSequenceSetProperties().add(ssp);
       }
@@ -2075,9 +2075,9 @@ public class Jalview2XML
     {
       final PDBEntry pdbentry = bindingModel.getPdbEntry(peid);
       final String pdbId = pdbentry.getId();
-      if (!pdbId.equals(entry.getId())
-              && !(entry.getId().length() > 4 && entry.getId().toLowerCase()
-                      .startsWith(pdbId.toLowerCase())))
+      if (!pdbId.equals(entry.getId()) && !(entry.getId().length() > 4
+              && entry.getId().toLowerCase(Locale.ROOT)
+                      .startsWith(pdbId.toLowerCase(Locale.ROOT))))
       {
         /*
          * not interested in a binding to a different PDB entry here
@@ -2529,6 +2529,7 @@ public class Jalview2XML
         dbref.setSource(ref.getSource());
         dbref.setVersion(ref.getVersion());
         dbref.setAccessionId(ref.getAccessionId());
+        dbref.setCanonical(ref.isCanonical());
         if (ref instanceof GeneLocus)
         {
           dbref.setLocus(true);
@@ -2644,7 +2645,7 @@ public class Jalview2XML
         for (int i = 0; i < colours.length; i++)
         {
           Colour col = new Colour();
-          col.setName(ResidueProperties.aa[i].toLowerCase());
+          col.setName(ResidueProperties.aa[i].toLowerCase(Locale.ROOT));
           col.setRGB(jalview.util.Format.getHexString(colours[i]));
           // jbucs.addColour(col);
           jbucs.getColour().add(col);
@@ -2919,6 +2920,7 @@ public class Jalview2XML
           entryCount++;
         }
       } while (jarentry != null);
+      jin.close();
       resolveFrefedSequences();
     } catch (IOException ex)
     {
@@ -5622,6 +5624,7 @@ public class Jalview2XML
       {
         entry.setMap(addMapping(dr.getMapping()));
       }
+      entry.setCanonical(dr.isCanonical());
       datasetSequence.addDBRef(entry);
     }
   }