Kaydet (Commit) 0a6e0840 authored tarafından rbuj's avatar rbuj Kaydeden (comit) Noel Grandin

xmerge: Use J2SE 5.0 String.{replace|contains}

Replace "String.indexOf(String str)!=-1" with String.contains(String str)
Use J2SE 5.0 String String.replace(CharSequence target, CharSequence replacement).
Format code in needsMask function.

Change-Id: I787a61c4c090f95fb3862390cc1198f7209163a3
Reviewed-on: https://gerrit.libreoffice.org/10659Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 981e2dcd
...@@ -301,20 +301,19 @@ public class XMergeBridge { ...@@ -301,20 +301,19 @@ public class XMergeBridge {
} }
public String needsMask(String origString){ public String needsMask(String origString){
if (origString.indexOf("&")!=-1){ if (origString.contains("&")) {
origString=replace(origString,"&","&amp;"); origString = origString.replace("&","&amp;");
} }
if (origString.indexOf("\"")!=-1){ if (origString.contains("\"")) {
origString=replace(origString,"\"","&quot;"); origString = origString.replace("\"","&quot;");
} }
if (origString.indexOf("<")!=-1){ if (origString.contains("<")) {
origString=replace(origString,"<","&lt;"); origString = origString.replace("<","&lt;");
} }
if (origString.indexOf(">")!=-1){ if (origString.contains(">")) {
origString=replace(origString,">","&gt;"); origString = origString.replace(">","&gt;");
} }
return origString; return origString;
} }
...@@ -545,7 +544,7 @@ public class XMergeBridge { ...@@ -545,7 +544,7 @@ public class XMergeBridge {
private String getPath(URI uri){ private String getPath(URI uri){
String path = uri.getPath(); String path = uri.getPath();
String opSys=System.getProperty("os.name"); String opSys=System.getProperty("os.name");
if(opSys.indexOf("Windows")!=-1){ if(opSys.contains("Windows")){
path= path.replace('/','\\'); path= path.replace('/','\\');
path = path.substring(1); path = path.substring(1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment