ソースを参照

Change non-regex uses of replaceAll to replace

Change-Id: I55762a3c25de36b1e3c435fccab4a4cc653c78ed
Reviewed-on: http://gerrit.dmdirc.com/703
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: Gregory Holmes <greg@dmdirc.com>
tags/0.6.3b1
Chris Smith 14年前
コミット
bcb50254d7
3個のファイルの変更12行の追加14行の削除
  1. 2
    2
      src/com/dmdirc/Main.java
  2. 1
    1
      src/com/dmdirc/ui/themes/ThemeIdentity.java
  3. 9
    11
      src/com/dmdirc/util/URLHandler.java

+ 2
- 2
src/com/dmdirc/Main.java ファイルの表示

@@ -219,7 +219,7 @@ public final class Main {
219 219
         }
220 220
 
221 221
         // Let command-line users know what is happening.
222
-        System.out.println(message.replaceAll("<br>", "\n"));
222
+        System.out.println(message.replace("<br>", "\n"));
223 223
 
224 224
         final File configFile = new File(getConfigDir() + "dmdirc.config");
225 225
         final File newConfigFile = new File(getConfigDir() + "dmdirc.config." + date);
@@ -237,7 +237,7 @@ public final class Main {
237 237
             if (!GraphicsEnvironment.isHeadless()) {
238 238
                 new WarningDialog("Invalid Config File", newMessage).displayBlocking();
239 239
             }
240
-            System.out.println(newMessage.replaceAll("<br>", "\n"));
240
+            System.out.println(newMessage.replace("<br>", "\n"));
241 241
             System.exit(1);
242 242
         }
243 243
     }

+ 1
- 1
src/com/dmdirc/ui/themes/ThemeIdentity.java ファイルの表示

@@ -82,7 +82,7 @@ public class ThemeIdentity extends Identity {
82 82
         if (result == null) {
83 83
             return result;
84 84
         } else {
85
-            return result.replaceAll("\\$theme", theme.getFileName(false));
85
+            return result.replace("$theme", theme.getFileName(false));
86 86
         }
87 87
     }
88 88
 

+ 9
- 11
src/com/dmdirc/util/URLHandler.java ファイルの表示

@@ -37,8 +37,6 @@ import java.net.URL;
37 37
 import java.util.ArrayList;
38 38
 import java.util.Date;
39 39
 import java.util.List;
40
-import java.util.regex.Matcher;
41
-import java.util.regex.Pattern;
42 40
 
43 41
 /** Handles URLs. */
44 42
 public class URLHandler {
@@ -208,15 +206,15 @@ public class URLHandler {
208 206
             }
209 207
         }
210 208
 
211
-        newCommand = newCommand.replaceAll("\\$url", Matcher.quoteReplacement(url.toString()));
212
-        newCommand = newCommand.replaceAll("\\$fragment", Matcher.quoteReplacement(fragment));
213
-        newCommand = newCommand.replaceAll("\\$host", Matcher.quoteReplacement(host));
214
-        newCommand = newCommand.replaceAll("\\$path", Matcher.quoteReplacement(path));
215
-        newCommand = newCommand.replaceAll("\\$port", Matcher.quoteReplacement(port));
216
-        newCommand = newCommand.replaceAll("\\$query", Matcher.quoteReplacement(query));
217
-        newCommand = newCommand.replaceAll("\\$protocol", Matcher.quoteReplacement(protocol));
218
-        newCommand = newCommand.replaceAll("\\$username", Matcher.quoteReplacement(username));
219
-        newCommand = newCommand.replaceAll("\\$password", Matcher.quoteReplacement(password));
209
+        newCommand = newCommand.replace("$url", url.toString());
210
+        newCommand = newCommand.replace("$fragment", fragment);
211
+        newCommand = newCommand.replace("$host", host);
212
+        newCommand = newCommand.replace("$path", path);
213
+        newCommand = newCommand.replace("$port", port);
214
+        newCommand = newCommand.replace("$query", query);
215
+        newCommand = newCommand.replace("$protocol", protocol);
216
+        newCommand = newCommand.replace("$username", username);
217
+        newCommand = newCommand.replace("$password", password);
220 218
 
221 219
         return newCommand;
222 220
     }

読み込み中…
キャンセル
保存