From 330763451812f4422e4027a8ee7dc81ab52b269d Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Wed, 1 Jul 2015 15:23:11 +0100 Subject: [PATCH] house keeping --- src/jalview/io/BioJsHTMLOutput.java | 12 +++++++----- src/jalview/jbgui/PDBDocFieldPreferences.java | 6 +++--- src/jalview/json/binding/v1/BioJSRepositoryPojo.java | 3 +++ src/jalview/ws/dbsources/PDBRestClient.java | 14 +++++++------- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/jalview/io/BioJsHTMLOutput.java b/src/jalview/io/BioJsHTMLOutput.java index 089f50b..73be79f 100644 --- a/src/jalview/io/BioJsHTMLOutput.java +++ b/src/jalview/io/BioJsHTMLOutput.java @@ -96,7 +96,6 @@ public class BioJsHTMLOutput { "HTML files" }, "HTML files"); jvFileChooser.setFileView(new JalviewFileView()); - // TODO uncomment when supported by MassageManager jvFileChooser.setDialogTitle(MessageManager .getString("label.save_as_biojs_html")); jvFileChooser.setDialogTitle("save as BioJs HTML"); @@ -201,10 +200,13 @@ public class BioJsHTMLOutput try { String gitRepoPkgJson = getURLContentAsString(BJS_TEMPLATE_GIT_REPO); - BioJSRepositoryPojo release = new BioJSRepositoryPojo( - gitRepoPkgJson); - syncUpdates(BJS_TEMPLATES_LOCAL_DIRECTORY, release); - refreshBioJSVersionsInfo(BJS_TEMPLATES_LOCAL_DIRECTORY); + if (gitRepoPkgJson != null) + { + BioJSRepositoryPojo release = new BioJSRepositoryPojo( + gitRepoPkgJson); + syncUpdates(BJS_TEMPLATES_LOCAL_DIRECTORY, release); + refreshBioJSVersionsInfo(BJS_TEMPLATES_LOCAL_DIRECTORY); + } } catch (URISyntaxException e) { e.printStackTrace(); diff --git a/src/jalview/jbgui/PDBDocFieldPreferences.java b/src/jalview/jbgui/PDBDocFieldPreferences.java index 96e27e6..4ec649a 100644 --- a/src/jalview/jbgui/PDBDocFieldPreferences.java +++ b/src/jalview/jbgui/PDBDocFieldPreferences.java @@ -51,15 +51,15 @@ public class PDBDocFieldPreferences extends JScrollPane { case SEARCH_SUMMARY: columnNames = new String[] - { "PDB Feild", "Show in search summary" }; + { "PDB Field", "Show in search summary" }; break; case STRUCTURE_CHOOSER: columnNames = new String[] - { "PDB Feild", "Show in structure summary" }; + { "PDB Field", "Show in structure summary" }; break; case PREFERENCES: columnNames = new String[] - { "PDB Feild", "Show in search summary", "Show in structure summary" }; + { "PDB Field", "Show in search summary", "Show in structure summary" }; break; default: break; diff --git a/src/jalview/json/binding/v1/BioJSRepositoryPojo.java b/src/jalview/json/binding/v1/BioJSRepositoryPojo.java index 4028a9d..1e6ef7e 100644 --- a/src/jalview/json/binding/v1/BioJSRepositoryPojo.java +++ b/src/jalview/json/binding/v1/BioJSRepositoryPojo.java @@ -3,6 +3,7 @@ package jalview.json.binding.v1; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.Objects; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -36,6 +37,8 @@ public class BioJSRepositoryPojo @SuppressWarnings("unchecked") private void parse(String jsonString) throws ParseException { + Objects.requireNonNull(jsonString, + "Supplied jsonString must not be null"); JSONParser jsonParser = new JSONParser(); JSONObject JsonObj = (JSONObject) jsonParser.parse(jsonString); this.description = (String) JsonObj.get("description"); diff --git a/src/jalview/ws/dbsources/PDBRestClient.java b/src/jalview/ws/dbsources/PDBRestClient.java index 67ab3f2..09c10ef 100644 --- a/src/jalview/ws/dbsources/PDBRestClient.java +++ b/src/jalview/ws/dbsources/PDBRestClient.java @@ -269,27 +269,27 @@ public class PDBRestClient * table. The PDB Id serves as a unique identifier for a given row in the * summary table * - * @param wantedFeilds + * @param wantedFields * the available table columns in no particular order * @return the pdb id field column index */ public static int getPDBIdColumIndex( - Collection wantedFeilds, boolean hasRefSeq) + Collection wantedFields, boolean hasRefSeq) { // If a reference sequence is attached then start counting from 1 else // start from zero - int pdbFeildIndexCounter = hasRefSeq ? 1 : 0; + int pdbFieldIndexCounter = hasRefSeq ? 1 : 0; - for (PDBDocField feild : wantedFeilds) + for (PDBDocField field : wantedFields) { - if (feild.equals(PDBDocField.PDB_ID)) + if (field.equals(PDBDocField.PDB_ID)) { break; // Once PDB Id index is determined exit iteration } - ++pdbFeildIndexCounter; + ++pdbFieldIndexCounter; } - return pdbFeildIndexCounter; + return pdbFieldIndexCounter; } /** -- 1.7.10.2