From bc98852ff1a926cf7b11a92db96ff8fe308ceae0 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Fri, 24 Apr 2015 16:05:24 +0100 Subject: [PATCH] JAL-1710, JAL-1711 Bug fix for exception thrown when a request containing a colon (:) is sent to the PDB Rest API and Implementation to allow selection of a specific PDB chain --- src/jalview/gui/PDBSearchPanel.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/PDBSearchPanel.java b/src/jalview/gui/PDBSearchPanel.java index 2d46714..5a8407a 100644 --- a/src/jalview/gui/PDBSearchPanel.java +++ b/src/jalview/gui/PDBSearchPanel.java @@ -74,11 +74,17 @@ public class PDBSearchPanel extends GPDBSearchPanel wantedFields = PDBDocFieldPreferences .getSearchSummaryFields(); + String searchTerm = txt_search.getText(); + if (searchTerm.contains(":")) + { + searchTerm = searchTerm.split(":")[0]; + } + PDBRestRequest request = new PDBRestRequest(); request.setAllowEmptySeq(allowEmptySequence); request.setResponseSize(100); request.setFieldToSearchBy(searchTarget + ":"); - request.setSearchTerm(txt_search.getText()); + request.setSearchTerm(searchTerm); request.setWantedFields(wantedFields); PDBRestClient pdbRestCleint = new PDBRestClient(); @@ -131,7 +137,17 @@ public class PDBSearchPanel extends GPDBSearchPanel { String pdbIdStr = tbl_summary.getValueAt(summaryRow, pdbIdCol) .toString(); - selectedIds.append(";").append(pdbIdStr); + + String searchTerm = txt_search.getText(); + if (searchTerm.contains(":")) + { + selectedIds.append(";").append(pdbIdStr).append(":") + .append(searchTerm.split(":")[1].toUpperCase()); + } + else + { + selectedIds.append(";").append(pdbIdStr); + } } String ids = selectedIds.deleteCharAt(0).toString(); -- 1.7.10.2