From c1c1eaac282c848b02704e819400396fcc685ef5 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 18 May 2017 15:28:54 +0100 Subject: [PATCH] JAL-2543 html-encode quote characters in feature description --- src/jalview/gui/AlignmentPanel.java | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 885d79d..0c052d9 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1556,35 +1556,37 @@ public class AlignmentPanel extends GAlignmentPanel implements for (f = 0; f < fSize; f++) { - if ((features[f].getBegin() <= seq.findPosition(res)) - && (features[f].getEnd() >= seq.findPosition(res))) + SequenceFeature sf = features[f]; + if ((sf.getBegin() <= seq.findPosition(res)) + && (sf.getEnd() >= seq.findPosition(res))) { - if (features[f].isContactFeature()) + if (sf.isContactFeature()) { - if (features[f].getBegin() == seq.findPosition(res) - || features[f].getEnd() == seq + if (sf.getBegin() == seq.findPosition(res) + || sf.getEnd() == seq .findPosition(res)) { - text.append("
").append(features[f].getType()) - .append(" ").append(features[f].getBegin()) - .append(":").append(features[f].getEnd()); + text.append("
").append(sf.getType()) + .append(" ").append(sf.getBegin()) + .append(":").append(sf.getEnd()); } } else { text.append("
"); - text.append(features[f].getType()); - if (features[f].getDescription() != null - && !features[f].getType().equals( - features[f].getDescription())) + text.append(sf.getType()); + String description = sf.getDescription(); + if (description != null + && !sf.getType().equals(description)) { - text.append(" ").append(features[f].getDescription()); + description = description.replace("\"", """); + text.append(" ").append(description); } - if (features[f].getValue("status") != null) + String status = sf.getStatus(); + if (status != null && !"".equals(status)) { - text.append(" (").append(features[f].getValue("status")) - .append(")"); + text.append(" (").append(status).append(")"); } } } -- 1.7.10.2