From: gmungoc Date: Wed, 8 Mar 2017 11:15:27 +0000 (+0000) Subject: JAL-2295 avoid quotes breaking attribute value parsing X-Git-Tag: Release_2_10_2~3^2~168 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b55fd078dae331c368cd90165459a6b0efe6305d;p=jalview.git JAL-2295 avoid quotes breaking attribute value parsing --- diff --git a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java index c4aa2e7..bb9df8a 100644 --- a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java +++ b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java @@ -473,10 +473,13 @@ public class ChimeraCommands /* * for each distinct value recorded for this feature type, * add a command to set the attribute on the mapped residues + * Put values in single quotes, encoding any embedded single quotes */ StringBuilder sb = new StringBuilder(128); - sb.append("setattr r ").append(attributeName).append(" \"") - .append(value.toString()).append("\" "); + String featureValue = value.toString(); + featureValue.replaceAll("'", "'"); + sb.append("setattr r ").append(attributeName).append(" '") + .append(featureValue).append("' "); sb.append(values.get(value).getAtomSpec()); commands.add(sb.toString()); }