Merge branch 'develop' into task/JAL-2196pdbeProperties
[jalview.git] / src / jalview / util / DBRefUtils.java
index f414a9c..e6aa472 100755 (executable)
@@ -29,7 +29,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -302,7 +301,8 @@ public class DBRefUtils
     @Override
     public boolean matches(DBRefEntry refa, DBRefEntry refb)
     {
-      if (refa.getSource() != null && refb.getSource() != null
+      if (refa.getSource() != null
+              && refb.getSource() != null
               && DBRefUtils.getCanonicalName(refb.getSource()).equals(
                       DBRefUtils.getCanonicalName(refa.getSource())))
       {
@@ -334,7 +334,8 @@ public class DBRefUtils
     @Override
     public boolean matches(DBRefEntry refa, DBRefEntry refb)
     {
-      if (refa.getSource() != null && refb.getSource() != null
+      if (refa.getSource() != null
+              && refb.getSource() != null
               && DBRefUtils.getCanonicalName(refb.getSource()).equals(
                       DBRefUtils.getCanonicalName(refa.getSource())))
       {
@@ -371,7 +372,8 @@ public class DBRefUtils
     @Override
     public boolean matches(DBRefEntry refa, DBRefEntry refb)
     {
-      if (refa.getSource() != null && refb.getSource() != null
+      if (refa.getSource() != null
+              && refb.getSource() != null
               && DBRefUtils.getCanonicalName(refb.getSource()).equals(
                       DBRefUtils.getCanonicalName(refa.getSource())))
       {
@@ -411,7 +413,8 @@ public class DBRefUtils
     @Override
     public boolean matches(DBRefEntry refa, DBRefEntry refb)
     {
-      if (refa.getSource() != null && refb.getSource() != null
+      if (refa.getSource() != null
+              && refb.getSource() != null
               && DBRefUtils.getCanonicalName(refb.getSource()).equals(
                       DBRefUtils.getCanonicalName(refa.getSource())))
       {
@@ -504,9 +507,7 @@ public class DBRefUtils
           PDBEntry pdbr = new PDBEntry();
           pdbr.setId(pdbid);
           pdbr.setType(PDBEntry.Type.PDB);
-          pdbr.setProperty(new Hashtable());
           pdbr.setChainCode(chaincode);
-          // pdbr.getProperty().put("CHAIN", chaincode);
           seq.addPDBId(pdbr);
         }
         else
@@ -614,21 +615,21 @@ public class DBRefUtils
    * sequences if they have an appropriate primary ref
    * <table>
    * <tr>
-   * <td>Seq Type</td>
-   * <td>Primary DB</td>
-   * <td>Direct which will be promoted</td>
+   * <th>Seq Type</th>
+   * <th>Primary DB</th>
+   * <th>Direct which will be promoted</th>
    * </tr>
-   * <tr>
+   * <tr align=center>
    * <td>peptides</td>
    * <td>Ensembl</td>
    * <td>Uniprot</td>
    * </tr>
-   * <tr>
+   * <tr align=center>
    * <td>peptides</td>
    * <td>Ensembl</td>
    * <td>Uniprot</td>
    * </tr>
-   * <tr>
+   * <tr align=center>
    * <td>dna</td>
    * <td>Ensembl</td>
    * <td>ENA</td>
@@ -646,8 +647,16 @@ public class DBRefUtils
       return;
     }
     List<DBRefEntry> selfs = new ArrayList<DBRefEntry>();
-    selfs.addAll(Arrays.asList(selectDbRefs(!sequence.isProtein(),
-            sequence.getDBRefs())));
+    {
+      DBRefEntry[] selfArray = selectDbRefs(!sequence.isProtein(),
+              sequence.getDBRefs());
+      if (selfArray == null || selfArray.length == 0)
+      {
+        // nothing to do
+        return;
+      }
+      selfs.addAll(Arrays.asList(selfArray));
+    }
 
     // filter non-primary refs
     for (DBRefEntry p : pr)