From 87018985bd993952fd848fd6b6a57d1a50aef484 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 11 Jan 2022 16:04:49 +0000 Subject: [PATCH] close filehandles straight after parse, without setting an error Conflicts: src/jalview/project/Jalview2XML.java (locale aware PDBID string compare) --- src/jalview/io/AlignFile.java | 15 ++++++++------- src/jalview/project/Jalview2XML.java | 8 +++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 497f0a5..338c4b2 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -20,13 +20,6 @@ */ package jalview.io; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.util.MessageManager; - import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; @@ -34,6 +27,13 @@ import java.util.Hashtable; import java.util.List; import java.util.Vector; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.util.MessageManager; + /** * DOCUMENT ME! * @@ -192,6 +192,7 @@ public abstract class AlignFile extends FileParse } parseCalled = true; parse(); + dataIn.close(); } /** diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 0e062ac..4f92736 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -53,6 +53,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; @@ -2071,9 +2072,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 @@ -2898,6 +2899,7 @@ public class Jalview2XML entryCount++; } } while (jarentry != null); + jin.close(); resolveFrefedSequences(); } catch (IOException ex) { -- 1.7.10.2