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 /qadevOOo | |
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 'qadevOOo')
-rw-r--r-- | qadevOOo/runner/convwatch/FilenameHelper.java | 8 | ||||
-rw-r--r-- | qadevOOo/runner/convwatch/PRNCompare.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/graphical/JPEGComparator.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/graphical/JPEGCreator.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/helper/ClParser.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/helper/OfficeProvider.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/util/UITools.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/util/utils.java | 34 |
8 files changed, 15 insertions, 45 deletions
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 |