Skip to content

Commit 0a4c726

Browse files
committed
Properly encode filter string in feature editor
Currently if one uses a filter in a feature import that happens to use special characters like '&' that require encoding as an entity saving the feature will break the XML as it will write out the literal value but not the encoded entity. One then has to manually fix up the results. This now uses the PDEXMLHelper.getWritableAttributeString to properly encode this as and attribute value before writing.
1 parent a1f7257 commit 0a4c726

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/feature/FeatureImport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.eclipse.pde.internal.core.ifeature.IFeature;
3434
import org.eclipse.pde.internal.core.ifeature.IFeatureImport;
3535
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
36+
import org.eclipse.pde.internal.core.util.PDEXMLHelper;
3637
import org.eclipse.pde.internal.core.util.VersionUtil;
3738
import org.w3c.dom.Node;
3839

@@ -188,8 +189,9 @@ public void write(String indent, PrintWriter writer) {
188189
if (fPatch) {
189190
writer.print(" patch=\"true\""); //$NON-NLS-1$
190191
}
191-
if (fFilter != null) {
192-
writer.print(" filter=\"" + fFilter + "\""); //$NON-NLS-1$ //$NON-NLS-2$
192+
String writableString = PDEXMLHelper.getWritableAttributeString(fFilter);
193+
if (!writableString.isBlank()) {
194+
writer.print(" filter=\"" + writableString + "\""); //$NON-NLS-1$ //$NON-NLS-2$
193195
}
194196
writer.println("/>"); //$NON-NLS-1$
195197
}

0 commit comments

Comments
 (0)