diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-04 13:49:16 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-04 14:50:58 +0200 |
commit | 66c34ff3e7cb940536b7257033c097491862d04f (patch) | |
tree | 2a4dd2b90cdd52f76b239af22c315bfce868beb6 /bean/com/sun | |
parent | d352735a7f2f74d3524adaa2f4d8cff61f60c5c6 (diff) |
java: remove workarounds for missing functionality pre java 1.5
Since we now require java 1.5
Change-Id: I9e195f77c81bd9447f8e29c1862c68a57846c8a3
Diffstat (limited to 'bean/com/sun')
-rw-r--r-- | bean/com/sun/star/beans/LocalOfficeConnection.java | 22 | ||||
-rw-r--r-- | bean/com/sun/star/comp/beans/LocalOfficeConnection.java | 22 |
2 files changed, 4 insertions, 40 deletions
diff --git a/bean/com/sun/star/beans/LocalOfficeConnection.java b/bean/com/sun/star/beans/LocalOfficeConnection.java index 8dbf00cbad55..7056bb9758f5 100644 --- a/bean/com/sun/star/beans/LocalOfficeConnection.java +++ b/bean/com/sun/star/beans/LocalOfficeConnection.java @@ -530,32 +530,14 @@ public class LocalOfficeConnection mPipe = pipe; } - /* replaces each substring aSearch in aString by aReplace. - - StringBuffer.replaceAll() is not available in Java 1.3.x. - */ - private static String replaceAll(String aString, String aSearch, String aReplace ) - { - StringBuffer aBuffer = new StringBuffer(aString); - - int nPos = aString.length(); - int nOfs = aSearch.length(); - - while ( ( nPos = aString.lastIndexOf( aSearch, nPos - 1 ) ) > -1 ) - aBuffer.replace( nPos, nPos+nOfs, aReplace ); - - return aBuffer.toString(); - } - - /** creates a unique pipe name. */ static String getPipeName() { // turn user name into a URL and file system safe name (% chars will not work) String aPipeName = System.getProperty("user.name") + OFFICE_ID_SUFFIX; - aPipeName = replaceAll( aPipeName, "_", "%B7" ); - return replaceAll( replaceAll( java.net.URLEncoder.encode(aPipeName), "\\+", "%20" ), "%", "_" ); + aPipeName = aPipeName.replace( "_", "%B7" ); + return java.net.URLEncoder.encode(aPipeName).replace( "\\+", "%20" ).replace( "%", "_" ); } /** diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java index 49fb32b52e20..6f87f0d06ea6 100644 --- a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java +++ b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java @@ -635,32 +635,14 @@ public class LocalOfficeConnection mPipe = pipe; } - /* replaces each substring aSearch in aString by aReplace. - - StringBuffer.replaceAll() is not available in Java 1.3.x. - */ - private static String replaceAll(String aString, String aSearch, String aReplace ) - { - StringBuffer aBuffer = new StringBuffer(aString); - - int nPos = aString.length(); - int nOfs = aSearch.length(); - - while ( ( nPos = aString.lastIndexOf( aSearch, nPos - 1 ) ) > -1 ) - aBuffer.replace( nPos, nPos+nOfs, aReplace ); - - return aBuffer.toString(); - } - - /** creates a unique pipe name. */ static String getPipeName() { // turn user name into a URL and file system safe name (% chars will not work) String aPipeName = System.getProperty("user.name") + OFFICE_ID_SUFFIX; - aPipeName = replaceAll( aPipeName, "_", "%B7" ); - return replaceAll( replaceAll( java.net.URLEncoder.encode(aPipeName), "+", "%20" ), "%", "_" ); + aPipeName = aPipeName.replace( "_", "%B7" ); + return java.net.URLEncoder.encode(aPipeName).replace( "+", "%20" ).replace( "%", "_" ); } /** |