Browse Source

Quote values in nowplaying substitutions

Fixes issue 3628

Change-Id: Iecf1a4fcc624eac4d8e2ecfc4b7f5e4499b5b972
Reviewed-on: http://gerrit.dmdirc.com/636
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
Automatic-Compile: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3
Chris Smith 14 years ago
parent
commit
4e5b896835
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java

+ 5
- 3
src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java View File

38
 import java.util.ArrayList;
38
 import java.util.ArrayList;
39
 import java.util.Collections;
39
 import java.util.Collections;
40
 import java.util.List;
40
 import java.util.List;
41
+import java.util.regex.Matcher;
41
 
42
 
42
 /**
43
 /**
43
  * Plugin that allows users to advertise what they're currently playing or
44
  * Plugin that allows users to advertise what they're currently playing or
183
     private void removePlugin(final PluginInfo target) {
184
     private void removePlugin(final PluginInfo target) {
184
         final Plugin targetPlugin = target.getPlugin();
185
         final Plugin targetPlugin = target.getPlugin();
185
         if (targetPlugin instanceof MediaSource) {
186
         if (targetPlugin instanceof MediaSource) {
186
-            sources.remove(targetPlugin);
187
+            sources.remove((MediaSource) targetPlugin);
187
         }
188
         }
188
         
189
         
189
         if (targetPlugin instanceof MediaSourceManager) {
190
         if (targetPlugin instanceof MediaSourceManager) {
268
      * Sanitises the specified String so that it may be used as the replacement
269
      * Sanitises the specified String so that it may be used as the replacement
269
      * in a call to String.replaceAll. Namely, at present, this method returns
270
      * in a call to String.replaceAll. Namely, at present, this method returns
270
      * an empty String if it is passed a null value; otherwise the input is
271
      * an empty String if it is passed a null value; otherwise the input is
271
-     * returned.
272
+     * quoted for use as a replacement in the
273
+     * {@link String#replaceAll(java.lang.String, java.lang.String)} method.
272
      *
274
      *
273
      * @param input The string to be sanitised
275
      * @param input The string to be sanitised
274
      * @return A sanitised version of the String
276
      * @return A sanitised version of the String
275
      * @since 0.6.3
277
      * @since 0.6.3
276
      */
278
      */
277
     protected static String sanitise(final String input) {
279
     protected static String sanitise(final String input) {
278
-        return input == null ? "" : input;
280
+        return input == null ? "" : Matcher.quoteReplacement(input);
279
     }
281
     }
280
     
282
     
281
     /**
283
     /**

Loading…
Cancel
Save