summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-04 13:49:16 +0200
committerNoel Grandin <noel@peralex.com>2014-08-04 14:50:58 +0200
commit66c34ff3e7cb940536b7257033c097491862d04f (patch)
tree2a4dd2b90cdd52f76b239af22c315bfce868beb6
parentjava: remove some unused fields in the ODK examples (diff)
downloadcore-66c34ff3e7cb940536b7257033c097491862d04f.tar.gz
core-66c34ff3e7cb940536b7257033c097491862d04f.zip
java: remove workarounds for missing functionality pre java 1.5
Since we now require java 1.5 Change-Id: I9e195f77c81bd9447f8e29c1862c68a57846c8a3
-rw-r--r--bean/com/sun/star/beans/LocalOfficeConnection.java22
-rw-r--r--bean/com/sun/star/comp/beans/LocalOfficeConnection.java22
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java19
-rw-r--r--qadevOOo/runner/convwatch/FilenameHelper.java8
-rw-r--r--qadevOOo/runner/convwatch/PRNCompare.java2
-rw-r--r--qadevOOo/runner/graphical/JPEGComparator.java2
-rw-r--r--qadevOOo/runner/graphical/JPEGCreator.java4
-rw-r--r--qadevOOo/runner/helper/ClParser.java2
-rw-r--r--qadevOOo/runner/helper/OfficeProvider.java2
-rw-r--r--qadevOOo/runner/util/UITools.java6
-rw-r--r--qadevOOo/runner/util/utils.java34
11 files changed, 19 insertions, 104 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( "%", "_" );
}
/**
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
index 4f76c5c304ce..e997fa48d55d 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
@@ -502,25 +502,6 @@ public class java_remote_bridge
if (Thread.currentThread() != _messageDispatcher
&& _messageDispatcher.isAlive())
{
- // This is a workaround for a Linux Sun JDK1.3 problem: The
- // message dispatcher stays in the socket read method, even if
- // the socket has been closed. Suspending and resuming the
- // message dispatcher lets it notice the closed socket. Only
- // use this workaround for Linux JRE 1.3.0 and 1.3.1 from Sun
- // and Blackdown. This workaround is dangerouse and may
- // hardlock the VM.
- if (System.getProperty("os.name", "").toLowerCase().equals(
- "linux")
- && System.getProperty("java.version", "").startsWith("1.3.")
- && (System.getProperty("java.vendor", "").toLowerCase().
- indexOf("sun") != -1
- || System.getProperty("java.vendor", "").toLowerCase().
- indexOf("blackdown") != -1))
- {
- _messageDispatcher.suspend();
- _messageDispatcher.resume();
- }
-
_messageDispatcher.join(1000);
if (_messageDispatcher.isAlive()) {
_messageDispatcher.interrupt();
diff --git a/qadevOOo/runner/convwatch/FilenameHelper.java b/qadevOOo/runner/convwatch/FilenameHelper.java
index 30fe19332536..c9d47afbf051 100644
--- a/qadevOOo/runner/convwatch/FilenameHelper.java
+++ b/qadevOOo/runner/convwatch/FilenameHelper.java
@@ -78,7 +78,7 @@ abstract class FilenameHelper_impl implements Filenamer
{
_sFilename = FileHelper.getSystemPathFromFileURL(_sFilename);
}
- _sFilename = utils.replaceAll13(_sFilename, "\\\\", "/");
+ _sFilename = _sFilename.replace("\\\\", "/");
String sPath = checkPath(FileHelper.getPath(_sFilename));
String sFilenameWithSuffix = checkFilename(FileHelper.getBasename(_sFilename));
@@ -95,7 +95,7 @@ abstract class FilenameHelper_impl implements Filenamer
public FilenameHelper_impl(String _sPath, String _sName, String _sSuffix)
{
initMember();
- _sPath = utils.replaceAll13(_sPath, "\\\\", "/");
+ _sPath = _sPath.replace("\\\\", "/");
String sPath = checkPath(_sPath);
String sFilename = checkFilename(_sName);
@@ -123,7 +123,7 @@ abstract class FilenameHelper_impl implements Filenamer
public String getAbsoluteSystemFilename()
{
String sSystemFilename = createAbsoluteFilename();
- sSystemFilename = utils.replaceAll13(sSystemFilename, "/", fs);
+ sSystemFilename = sSystemFilename.replace("/", fs);
return sSystemFilename;
}
@@ -168,7 +168,7 @@ abstract class FilenameHelper_impl implements Filenamer
public String getSystemPath()
{
String sSystemPath = m_sPath;
- sSystemPath = utils.replaceAll13(sSystemPath, "/", fs);
+ sSystemPath = sSystemPath.replace("/", fs);
return sSystemPath;
}
/**
diff --git a/qadevOOo/runner/convwatch/PRNCompare.java b/qadevOOo/runner/convwatch/PRNCompare.java
index 58f5de5893b9..ebf18a7a7298 100644
--- a/qadevOOo/runner/convwatch/PRNCompare.java
+++ b/qadevOOo/runner/convwatch/PRNCompare.java
@@ -257,7 +257,7 @@ public class PRNCompare
ArrayList<String> m_aFileList = new ArrayList<String>();
for (int i=1;i<9999;i++)
{
- String sNewJPEGFilename = utils.replaceAll13(sJPGFilename, sGS_PageOutput, StringHelper.createValueString(i, 4));
+ String sNewJPEGFilename = sJPGFilename.replace(sGS_PageOutput, StringHelper.createValueString(i, 4));
if (FileHelper.exists(sNewJPEGFilename))
{
m_aFileList.add(sNewJPEGFilename); // as long as the files exist, fill the array
diff --git a/qadevOOo/runner/graphical/JPEGComparator.java b/qadevOOo/runner/graphical/JPEGComparator.java
index d7a2bc3cd0d6..a3a886975298 100644
--- a/qadevOOo/runner/graphical/JPEGComparator.java
+++ b/qadevOOo/runner/graphical/JPEGComparator.java
@@ -344,7 +344,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
}
else
{
- String sResultFilenamePDF = util.utils.replaceAll13(sResultFilename, ".ps_", ".pdf_");
+ String sResultFilenamePDF = sResultFilename.replace(".ps_", ".pdf_");
File aResultPDFFile = new File(sResultFilenamePDF);
if (aResultPDFFile.exists())
{
diff --git a/qadevOOo/runner/graphical/JPEGCreator.java b/qadevOOo/runner/graphical/JPEGCreator.java
index cb3ee7f34cc7..6a53bca2d16b 100644
--- a/qadevOOo/runner/graphical/JPEGCreator.java
+++ b/qadevOOo/runner/graphical/JPEGCreator.java
@@ -131,7 +131,7 @@ public static void convertToNearSameFileWithWidth340(String _sJPEGFilename)
}
String sJPEGFilename = _sJPEGFilename.replaceAll("\\\\", "/");
String sNewJPEGFilename;
- sNewJPEGFilename = util.utils.replaceAll13(sJPEGFilename, ".jpg", "_w340.jpg");
+ sNewJPEGFilename = sJPEGFilename.replace(".jpg", "_w340.jpg");
convertToWidth340(sJPEGFilename, sNewJPEGFilename);
}
@@ -333,7 +333,7 @@ private static void convertToWidth340(String _sFrom, String _To)
{
return "";
}
- final String sFilename = util.utils.replaceAll13(_sJPEGSchema, m_sGS_PageOutput, StringHelper.createValueString(_nPage, 4));
+ final String sFilename = _sJPEGSchema.replace(m_sGS_PageOutput, StringHelper.createValueString(_nPage, 4));
return sFilename;
}
diff --git a/qadevOOo/runner/helper/ClParser.java b/qadevOOo/runner/helper/ClParser.java
index 4ac7e87445fa..0d3c7e665e52 100644
--- a/qadevOOo/runner/helper/ClParser.java
+++ b/qadevOOo/runner/helper/ClParser.java
@@ -76,7 +76,7 @@ public class ClParser
pValue = pValue + " " + args[i].trim();
}
- pValue = utils.replaceAll13(pValue, "'", "");
+ pValue = pValue.replace("'", "");
i++;
}
else
diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
index e04f1da491b3..3f45e02894ce 100644
--- a/qadevOOo/runner/helper/OfficeProvider.java
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -667,7 +667,7 @@ public class OfficeProvider implements AppProvider
sysDir = dir.substring("file://".length());
}
- sysDir = utils.replaceAll13(sysDir, "%20", " ");
+ sysDir = sysDir.replace("%20", " ");
// append '/' if not there (e.g. linux)
if (sysDir.charAt(sysDir.length() - 1) != '/')
diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java
index 49a29e415e84..84d7238046a1 100644
--- a/qadevOOo/runner/util/UITools.java
+++ b/qadevOOo/runner/util/UITools.java
@@ -500,9 +500,9 @@ public class UITools {
currencyVal = currencyVal.substring(0, currencyVal.length()-3) +
"#" + currencyVal.substring(currencyVal.length()-2);
- currencyVal = utils.replaceAll13(currencyVal, ",", "");
- currencyVal = utils.replaceAll13(currencyVal, "\\.", "");
- currencyVal = utils.replaceAll13(currencyVal, "#", ".");
+ currencyVal = currencyVal.replace(",", "");
+ currencyVal = currencyVal.replace("\\.", "");
+ currencyVal = currencyVal.replace("#", ".");
return currencyVal;
} catch (Exception e) {
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index 75b808d96632..bfc8afedb0e0 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -629,15 +629,6 @@ public class utils {
}
/**
- *
- * This method replaces a substring with another
- *
- */
- public static String replacePart(String all, String toReplace, String replacement) {
- return replaceAll13(all, toReplace, replacement);
- }
-
- /**
* Scan localhost for the next free port-number from a starting port
* on. If the starting port is smaller than 1024, port number starts with
* 10000 as default, because numbers < 1024 are never free on unix machines.
@@ -767,8 +758,8 @@ public class utils {
*/
public static String validateAppExecutionCommand(String appExecCommand, String os) {
String errorMessage = "OK";
- appExecCommand = replaceAll13(appExecCommand, "\"", "");
- appExecCommand = replaceAll13(appExecCommand, "'", "");
+ appExecCommand = appExecCommand.replace("\"", "");
+ appExecCommand = appExecCommand.replace("'", "");
StringTokenizer commandTokens = new StringTokenizer(appExecCommand, " \t");
String officeExecutable = "";
String officeExecCommand = "soffice";
@@ -862,27 +853,6 @@ public class utils {
}
/**
- * String.replaceAll() is available since Java 1.4 but the runner must be buldabale with Java 1.3
- * @param originalString
- * @param searchString
- * @param replaceString
- * @return modified string
- */
- public static String replaceAll13(String originalString, String searchString, String replaceString) {
-
- StringBuffer changeStringBuffer = new StringBuffer(originalString);
- int searchLength = searchString.length();
- int replaceLength = replaceString.length();
- int index = originalString.indexOf(searchString);
- while (index != -1) {
- changeStringBuffer = changeStringBuffer.replace(index, index + searchLength, replaceString);
- originalString = changeStringBuffer.toString();
- index = originalString.indexOf(searchString, index + replaceLength);
- }
- return originalString;
- }
-
- /**
* expand macrofied strings like <CODE>${$ORIGIN/bootstrap.ini:UserInstallation}</CODE> or
* <CODE>$_OS</CODE>
* @param xMSF the MultiServiceFactory