diff options
author | Robert Antoni Buj i Gelonch <robert.buj@gmail.com> | 2014-10-09 21:51:37 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-10-10 07:09:21 +0000 |
commit | 110ae4e498a55bd50ca0afe558126e9e029f68cd (patch) | |
tree | a7784faed1c2273fd80add17d12d68bc800dda46 | |
parent | 999fb810673f7c1b490cdac1f29c2e931e8e7f2e (diff) |
runner: The if statement is redundant
Change-Id: Ida40034bdfe6a44a936db1243ad6c71616caada3
Reviewed-on: https://gerrit.libreoffice.org/11895
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | qadevOOo/runner/convwatch/EnhancedComplexTestCase.java | 8 | ||||
-rw-r--r-- | qadevOOo/runner/convwatch/FileHelper.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/convwatch/FilenameHelper.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/convwatch/GraphicalTestArguments.java | 46 | ||||
-rw-r--r-- | qadevOOo/runner/convwatch/IniFile.java | 10 | ||||
-rw-r--r-- | qadevOOo/runner/convwatch/MSOfficePrint.java | 16 | ||||
-rw-r--r-- | qadevOOo/runner/graphical/IniFile.java | 31 | ||||
-rw-r--r-- | qadevOOo/runner/graphical/MSOfficePostscriptCreator.java | 22 | ||||
-rw-r--r-- | qadevOOo/runner/graphical/ParameterHelper.java | 15 | ||||
-rw-r--r-- | qadevOOo/runner/helper/OSHelper.java | 45 | ||||
-rw-r--r-- | qadevOOo/runner/org/openoffice/Runner.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/org/openoffice/RunnerService.java | 4 |
12 files changed, 48 insertions, 167 deletions
diff --git a/qadevOOo/runner/convwatch/EnhancedComplexTestCase.java b/qadevOOo/runner/convwatch/EnhancedComplexTestCase.java index 47e23fcca052..52587c62bfe7 100644 --- a/qadevOOo/runner/convwatch/EnhancedComplexTestCase.java +++ b/qadevOOo/runner/convwatch/EnhancedComplexTestCase.java @@ -79,12 +79,8 @@ public abstract class EnhancedComplexTestCase extends ComplexTestCase { sNEEDCHECK = "false"; } - if (sNEEDCHECK.equalsIgnoreCase("yes") || - sNEEDCHECK.equalsIgnoreCase("true")) - { - return true; - } - return false; + return sNEEDCHECK.equalsIgnoreCase("yes") || + sNEEDCHECK.equalsIgnoreCase("true"); } diff --git a/qadevOOo/runner/convwatch/FileHelper.java b/qadevOOo/runner/convwatch/FileHelper.java index e9f97effd9b9..ba4e4c3f46a1 100644 --- a/qadevOOo/runner/convwatch/FileHelper.java +++ b/qadevOOo/runner/convwatch/FileHelper.java @@ -44,11 +44,7 @@ public class FileHelper if (_sFile == null) return false; File aFile = new File(_sFile); - if (aFile.exists()) - { - return true; - } - return false; + return aFile.exists(); } public static boolean isDir(String _sDir) diff --git a/qadevOOo/runner/convwatch/FilenameHelper.java b/qadevOOo/runner/convwatch/FilenameHelper.java index 19b9eea0bf7a..56a3b5dda65a 100644 --- a/qadevOOo/runner/convwatch/FilenameHelper.java +++ b/qadevOOo/runner/convwatch/FilenameHelper.java @@ -246,11 +246,7 @@ abstract class FilenameHelper_impl implements Filenamer { String sPath = createAbsoluteFilename(); String sPathOther = _aOtherFN.createAbsoluteFilename(); - if (sPath.equals(sPathOther)) - { - return true; - } - return false; + return sPath.equals(sPathOther); } } diff --git a/qadevOOo/runner/convwatch/GraphicalTestArguments.java b/qadevOOo/runner/convwatch/GraphicalTestArguments.java index 49fb1e07dc9b..5fc4bedbdfde 100644 --- a/qadevOOo/runner/convwatch/GraphicalTestArguments.java +++ b/qadevOOo/runner/convwatch/GraphicalTestArguments.java @@ -196,15 +196,9 @@ public class GraphicalTestArguments { sREUSE_OFFICE = "false"; } - if (sREUSE_OFFICE.equalsIgnoreCase("yes") || - sREUSE_OFFICE.equalsIgnoreCase("true")) - { - m_bResuseOffice = true; - } - else - { - m_bResuseOffice = false; - } + m_bResuseOffice = + sREUSE_OFFICE.equalsIgnoreCase("yes") || + sREUSE_OFFICE.equalsIgnoreCase("true"); String sHTMLOutputPrefix = (String)param.get( PropertyName.DOC_COMPARATOR_HTML_OUTPUT_PREFIX); @@ -276,15 +270,9 @@ public class GraphicalTestArguments String sCreateDefault = (String)param.get(PropertyName.CREATE_DEFAULT); if (sCreateDefault != null) { - if (sCreateDefault.equalsIgnoreCase("yes") || - sCreateDefault.equalsIgnoreCase("true")) - { - m_bCreateDefaultReference = true; - } - else - { - m_bCreateDefaultReference = false; - } + m_bCreateDefaultReference = + sCreateDefault.equalsIgnoreCase("yes") || + sCreateDefault.equalsIgnoreCase("true"); } } @@ -293,17 +281,12 @@ public class GraphicalTestArguments { // @todo // check if the name is in the leave out list and then return 'false' - if (_sName.toLowerCase().endsWith(".jpg") || + return !(_sName.toLowerCase().endsWith(".jpg") || _sName.toLowerCase().endsWith(".png") || _sName.toLowerCase().endsWith(".gif") || _sName.toLowerCase().endsWith(".bmp") || _sName.toLowerCase().endsWith(".prn") || - _sName.toLowerCase().endsWith(".ps")) - { - return false; - } - - return true; + _sName.toLowerCase().endsWith(".ps")); } private static void showInternalFilterName(String _sFilterName, XMultiServiceFactory _xMSF) @@ -417,12 +400,7 @@ public class GraphicalTestArguments */ public boolean printAllPages() { - if ( (getMaxPages() > 0) || - (getOnlyPages().length() != 0)) - { - return false; - } - return true; + return !((getMaxPages() > 0) || (getOnlyPages().length() != 0)); } /** @@ -590,11 +568,7 @@ public class GraphicalTestArguments public boolean restartOffice() { - if (!m_bResuseOffice) - { - return true; - } - return false; + return !m_bResuseOffice; } private String m_sHTMLOutputPrefix = ""; diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java index 29897272a2bc..8e1747bf1308 100644 --- a/qadevOOo/runner/convwatch/IniFile.java +++ b/qadevOOo/runner/convwatch/IniFile.java @@ -104,13 +104,9 @@ class IniFile private boolean isRemark(String _sLine) { - if ( ((_sLine.length() < 2) ) || - ( _sLine.startsWith("#")) || - ( _sLine.startsWith(";")) ) - { - return true; - } - return false; + return _sLine.length() < 2 || + _sLine.startsWith("#") || + _sLine.startsWith(";"); } private String getItem(int i) diff --git a/qadevOOo/runner/convwatch/MSOfficePrint.java b/qadevOOo/runner/convwatch/MSOfficePrint.java index 62d8c54e391f..4436d8397cbf 100644 --- a/qadevOOo/runner/convwatch/MSOfficePrint.java +++ b/qadevOOo/runner/convwatch/MSOfficePrint.java @@ -47,13 +47,9 @@ public class MSOfficePrint private static boolean isWordDocument(String _sSuffix) { - if (_sSuffix.toLowerCase().endsWith(".doc") || + return _sSuffix.toLowerCase().endsWith(".doc") || _sSuffix.toLowerCase().endsWith(".rtf") || - _sSuffix.toLowerCase().endsWith(".dot")) - { - return true; - } - return false; + _sSuffix.toLowerCase().endsWith(".dot"); } private static boolean isExcelDocument(String _sSuffix) @@ -75,12 +71,8 @@ public class MSOfficePrint private static boolean isPowerPointDocument(String _sSuffix) { - if (_sSuffix.toLowerCase().endsWith(".pps") || - _sSuffix.toLowerCase().endsWith(".ppt")) - { - return true; - } - return false; + return _sSuffix.toLowerCase().endsWith(".pps") || + _sSuffix.toLowerCase().endsWith(".ppt"); } /** diff --git a/qadevOOo/runner/graphical/IniFile.java b/qadevOOo/runner/graphical/IniFile.java index 16bf0ad79743..f6b371f342e2 100644 --- a/qadevOOo/runner/graphical/IniFile.java +++ b/qadevOOo/runner/graphical/IniFile.java @@ -120,24 +120,15 @@ public class IniFile implements Enumeration<String> */ public boolean hasValue(String _sSectionName, String _sKey) { - int n = findKey(_sSectionName, _sKey); - if (n > 0) - { - return true; - } - return false; + return findKey(_sSectionName, _sKey) > 0; } private boolean isRemark(String _sLine) { - if (((_sLine.length() < 2)) || - (_sLine.startsWith("#")) || - (_sLine.startsWith(";"))) - { - return true; - } - return false; + return _sLine.length() < 2 || + _sLine.startsWith("#") || + _sLine.startsWith(";"); } private String getItem(int i) @@ -199,12 +190,7 @@ public class IniFile implements Enumeration<String> */ public boolean hasSection(String _sSection) { - int i = findSection(_sSection); - if (i == -1) - { - return false; - } - return true; + return findSection(_sSection) != -1; } // return the line number, where the key is found. @@ -494,12 +480,7 @@ public class IniFile implements Enumeration<String> */ public boolean hasMoreElements() { - if (m_aEnumerationPos >= 0 && - m_aEnumerationPos < m_aList.size()) - { - return true; - } - return false; + return m_aEnumerationPos >= 0 && m_aEnumerationPos < m_aList.size(); } /** diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java index 19955a5c04e4..5a940ca79b3e 100644 --- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java @@ -113,13 +113,9 @@ public class MSOfficePostscriptCreator implements IOffice private boolean isWordDocument(String _sSuffix) { - if (_sSuffix.toLowerCase().endsWith(".doc") || + return _sSuffix.toLowerCase().endsWith(".doc") || _sSuffix.toLowerCase().endsWith(".rtf") || - _sSuffix.toLowerCase().endsWith(".dot")) - { - return true; - } - return false; + _sSuffix.toLowerCase().endsWith(".dot"); } private boolean isExcelDocument(String _sSuffix) @@ -127,21 +123,13 @@ public class MSOfficePostscriptCreator implements IOffice // xlt templates // xlw // xla addin - if (_sSuffix.toLowerCase().endsWith(".xls")) - { - return true; - } - return false; + return _sSuffix.toLowerCase().endsWith(".xls"); } private boolean isPowerPointDocument(String _sSuffix) { - if (_sSuffix.toLowerCase().endsWith(".pps") || - _sSuffix.toLowerCase().endsWith(".ppt")) - { - return true; - } - return false; + return _sSuffix.toLowerCase().endsWith(".pps") || + _sSuffix.toLowerCase().endsWith(".ppt"); } /** diff --git a/qadevOOo/runner/graphical/ParameterHelper.java b/qadevOOo/runner/graphical/ParameterHelper.java index 6658564ae9e7..4e028583ac4d 100644 --- a/qadevOOo/runner/graphical/ParameterHelper.java +++ b/qadevOOo/runner/graphical/ParameterHelper.java @@ -314,12 +314,7 @@ public class ParameterHelper */ public boolean printAllPages() { - if ( (getMaxPages() > 0) || - (getOnlyPages().length() != 0)) - { - return false; - } - return true; + return !((getMaxPages() > 0) || (getOnlyPages().length() != 0)); } public boolean getOverwrite() @@ -348,13 +343,7 @@ public class ParameterHelper public boolean createSmallPictures() { - // boolean bCreateSmallPictures = true; - boolean bNoSmallPictures = m_aCurrentParams.getBool( PropertyName.NO_SMALL_PICTURES); - if (bNoSmallPictures) - { - return false; - } - return true; + return !m_aCurrentParams.getBool(PropertyName.NO_SMALL_PICTURES); } } diff --git a/qadevOOo/runner/helper/OSHelper.java b/qadevOOo/runner/helper/OSHelper.java index 41a10004f766..212a01b1655c 100644 --- a/qadevOOo/runner/helper/OSHelper.java +++ b/qadevOOo/runner/helper/OSHelper.java @@ -25,52 +25,31 @@ public class OSHelper { public static boolean isWindows() { - String sOSName = System.getProperty("os.name"); - if (sOSName.toLowerCase().startsWith("windows")) - { - return true; - } - return false; + return System.getProperty("os.name").toLowerCase().startsWith("windows"); } public static boolean isSolarisIntel() { - if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") || - System.getProperty("os.name").toLowerCase().startsWith("sunos") ) && - System.getProperty("os.arch").equals("x86")) - { - return true; - } - return false; + String sOSName = System.getProperty("os.name"); + return ( sOSName.toLowerCase().startsWith("solaris") || + sOSName.toLowerCase().startsWith("sunos") ) && + System.getProperty("os.arch").equals("x86"); } public static boolean isSolarisSparc() { - if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") || - System.getProperty("os.name").toLowerCase().startsWith("sunos") ) && - System.getProperty("os.arch").equals("sparc")) - { - return true; - } - return false; + String sOSName = System.getProperty("os.name"); + return ( sOSName.toLowerCase().startsWith("solaris") || + sOSName.toLowerCase().startsWith("sunos") ) && + System.getProperty("os.arch").equals("sparc"); } public static boolean isLinuxIntel() { - if (System.getProperty("os.name").toLowerCase().startsWith("linux") && - System.getProperty("os.arch").equals("i386")) - { - return true; - } - return false; + return System.getProperty("os.name").toLowerCase().startsWith("linux") && + System.getProperty("os.arch").equals("i386"); } public static boolean isUnix() { - if (isLinuxIntel() || - isSolarisIntel() || - isSolarisSparc()) - { - return true; - } - return false; + return isLinuxIntel() || isSolarisIntel() || isSolarisSparc(); } } diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java index 33071aa4e7b4..d833a4fb56e1 100644 --- a/qadevOOo/runner/org/openoffice/Runner.java +++ b/qadevOOo/runner/org/openoffice/Runner.java @@ -60,11 +60,7 @@ public class Runner { return false; } - if (_sVariable.startsWith("/cygdrive")) - { - return true; - } - return false; + return _sVariable.startsWith("/cygdrive"); } private static boolean checkPathVariable(String _sPath, String delim) diff --git a/qadevOOo/runner/org/openoffice/RunnerService.java b/qadevOOo/runner/org/openoffice/RunnerService.java index fcd425617fcf..82f240c738a0 100644 --- a/qadevOOo/runner/org/openoffice/RunnerService.java +++ b/qadevOOo/runner/org/openoffice/RunnerService.java @@ -173,9 +173,7 @@ public class RunnerService implements XJob, XServiceInfo, * @see com.sun.star.lang.XServiceInfo */ public boolean supportsService(String serviceName) { - if(serviceName.equals(__serviceName)) - return true; - return false; + return serviceName.equals(__serviceName); } /** |