summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-05 13:19:44 +0200
committerNoel Grandin <noel@peralex.com>2014-08-08 09:48:19 +0200
commitb6a83e99c8f4442c3c96198ac816dcb99419a67e (patch)
tree680dc3e55306b355983aa8c810f610015a95bf5d
parent8f020a45fa69c9458844b8b621df2e0b15ec3d16 (diff)
java: remove redundant null checks
Change-Id: Ia42e5ed715fbd3f5b84029a9844da55f307c6260
-rw-r--r--chart2/qa/TestCaseOldAPI.java1
-rw-r--r--extensions/qa/integration/extensions/ComponentFactory.java2
-rw-r--r--extensions/qa/integration/extensions/ObjectInspector.java15
-rw-r--r--forms/qa/integration/forms/FormControlTest.java1
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java11
-rw-r--r--odk/examples/DevelopersGuide/Database/OpenQuery.java2
-rw-r--r--qadevOOo/runner/helper/ComplexDescGetter.java7
-rw-r--r--qadevOOo/runner/util/ValueChanger.java2
-rw-r--r--qadevOOo/tests/java/ifc/i18n/_XTransliteration.java3
-rw-r--r--qadevOOo/tests/java/ifc/io/_XInputStream.java2
-rw-r--r--qadevOOo/tests/java/ifc/sheet/_XRecentFunctions.java1
-rw-r--r--qadevOOo/tests/java/ifc/sheet/_XSheetAnnotation.java2
-rw-r--r--qadevOOo/tests/java/ifc/task/_XStatusIndicatorFactory.java2
-rw-r--r--scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java5
-rw-r--r--sw/qa/complex/writer/LoadSaveTest.java4
15 files changed, 18 insertions, 42 deletions
diff --git a/chart2/qa/TestCaseOldAPI.java b/chart2/qa/TestCaseOldAPI.java
index be565ad38e16..cef8aa51b7f7 100644
--- a/chart2/qa/TestCaseOldAPI.java
+++ b/chart2/qa/TestCaseOldAPI.java
@@ -593,7 +593,6 @@ public class TestCaseOldAPI extends ComplexTestCase {
assure( "Changing FillColor of Data Series failed", nNewColor == nColor );
// Gradient
- assure( "No DataRowProperties for series 0", xProp != null );
// note: the FillGradient property is optional, however it was
// supported in the old chart's API
diff --git a/extensions/qa/integration/extensions/ComponentFactory.java b/extensions/qa/integration/extensions/ComponentFactory.java
index 5a449dfda3cc..170e19a43667 100644
--- a/extensions/qa/integration/extensions/ComponentFactory.java
+++ b/extensions/qa/integration/extensions/ComponentFactory.java
@@ -40,7 +40,7 @@ public class ComponentFactory implements XSingleComponentFactory
catch ( java.lang.ClassNotFoundException e ) { }
Constructor ctors[] = _handlerClass.getConstructors();
- for ( int i = 0; i < ctors.length && ctors != null; ++i)
+ for ( int i = 0; i < ctors.length; ++i)
{
Class ctorParams[] = ctors[i].getParameterTypes();
if ( ( ctorParams.length == 1 ) && ( ctorParams[0].equals( XComponentContext.class ) ) )
diff --git a/extensions/qa/integration/extensions/ObjectInspector.java b/extensions/qa/integration/extensions/ObjectInspector.java
index 4dac96782a46..9db57723ba9b 100644
--- a/extensions/qa/integration/extensions/ObjectInspector.java
+++ b/extensions/qa/integration/extensions/ObjectInspector.java
@@ -129,16 +129,13 @@ public class ObjectInspector extends complexlib.ComplexTestCase
private void closeExistentInspector()
{
Frame existentInspectorFrame = new Frame( m_desktop.findFrame( m_inspectorFrameName, 255 ) );
- if ( existentInspectorFrame != null )
+ try
{
- try
- {
- existentInspectorFrame.close( true );
- }
- catch( com.sun.star.util.CloseVetoException e )
- {
- failed( "could not close the existent inspector frame" );
- }
+ existentInspectorFrame.close( true );
+ }
+ catch( com.sun.star.util.CloseVetoException e )
+ {
+ failed( "could not close the existent inspector frame" );
}
}
diff --git a/forms/qa/integration/forms/FormControlTest.java b/forms/qa/integration/forms/FormControlTest.java
index 3126a1929087..0b826977a1bd 100644
--- a/forms/qa/integration/forms/FormControlTest.java
+++ b/forms/qa/integration/forms/FormControlTest.java
@@ -598,7 +598,6 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
private boolean ensureTables() throws com.sun.star.uno.Exception, java.lang.Exception
{
Connection connection = new Connection( m_dataSource.getConnection( "", "" ) );
- assure( "could not connect to the data source", connection != null );
// drop the table, if it already exists
if ( !implExecuteStatement( "DROP TABLE \"" + s_tableName + "\" IF EXISTS" )
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java b/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java
index d2c1bbfa7b48..f5408545b6b5 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java
@@ -80,13 +80,10 @@ class Proxy implements IQueryInterface, XEventListener
if (object instanceof IQueryInterface)
{
IQueryInterface iquery = (IQueryInterface) object;
- if (iquery != null)
- {
- if (iquery.getOid().equals(oid))
- return true;
- else
- return false;
- }
+ if (iquery.getOid().equals(oid))
+ return true;
+ else
+ return false;
}
String oidObj = UnoRuntime.generateOid(object);
diff --git a/odk/examples/DevelopersGuide/Database/OpenQuery.java b/odk/examples/DevelopersGuide/Database/OpenQuery.java
index a460b769f15e..92b0413c7723 100644
--- a/odk/examples/DevelopersGuide/Database/OpenQuery.java
+++ b/odk/examples/DevelopersGuide/Database/OpenQuery.java
@@ -120,7 +120,7 @@ public class OpenQuery {
System.out.println("----------\t------");
// output result rows
- while ( xRowSet != null && xRowSet.next() ) {
+ while ( xRowSet.next() ) {
String ident = xRow.getString(xLoc.findColumn("IDENTIFIER"));
String author = xRow.getString(xLoc.findColumn("AUTHOR"));
System.out.println(ident + "\t\t" + author);
diff --git a/qadevOOo/runner/helper/ComplexDescGetter.java b/qadevOOo/runner/helper/ComplexDescGetter.java
index e269e1816d1c..6e517d712d36 100644
--- a/qadevOOo/runner/helper/ComplexDescGetter.java
+++ b/qadevOOo/runner/helper/ComplexDescGetter.java
@@ -128,12 +128,7 @@ public class ComplexDescGetter extends DescGetter
}
String testObjectName = className;
- String[] testMethodNames = null;
-
- if (testMethodNames == null)
- {
- testMethodNames = testClass.getTestMethodNames();
- }
+ String[] testMethodNames = testClass.getTestMethodNames();
if (methodNames != null)
{
testMethodNames = methodNames;
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index 7b63dab6c161..7f01f8a21a57 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -748,7 +748,7 @@ public class ValueChanger {
if (Enum.class.equals(flds[i].getType().getSuperclass())) {
Enum value = (Enum) flds[i].get(null) ;
- if (newValue == null && !value.equals(oldValue)) {
+ if (!value.equals(oldValue)) {
newValue = value ;
break ;
}
diff --git a/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java b/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java
index fddad954c4d3..a300454cca81 100644
--- a/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java
+++ b/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java
@@ -212,8 +212,7 @@ public class _XTransliteration extends MultiMethodTest {
log.println(out[i]);
}
- boolean bOK = out != null &&
- out.length == 4 &&
+ boolean bOK = out.length == 4 &&
("A".equals(out[0]) && "I".equals(out[1]) &&
"a".equals(out[2]) && "i".equals(out[3])) ||
("a".equals(out[0]) && "i".equals(out[1]) &&
diff --git a/qadevOOo/tests/java/ifc/io/_XInputStream.java b/qadevOOo/tests/java/ifc/io/_XInputStream.java
index 738b252b96d1..f60a3c5f43a1 100644
--- a/qadevOOo/tests/java/ifc/io/_XInputStream.java
+++ b/qadevOOo/tests/java/ifc/io/_XInputStream.java
@@ -126,7 +126,6 @@ public class _XInputStream extends MultiMethodTest {
int read = oObj.readBytes(data, 1) ;
result = read == 1 &&
- data != null &&
data.length == 1 ;
} catch (com.sun.star.io.IOException e){
e.printStackTrace(log) ;
@@ -161,7 +160,6 @@ public class _XInputStream extends MultiMethodTest {
int read = oObj.readSomeBytes(data, 1) ;
result = read == 1 &&
- data != null &&
data.length == 1 ;
} catch (com.sun.star.io.IOException e){
e.printStackTrace(log) ;
diff --git a/qadevOOo/tests/java/ifc/sheet/_XRecentFunctions.java b/qadevOOo/tests/java/ifc/sheet/_XRecentFunctions.java
index d9dbf71323d0..3ca88e281f68 100644
--- a/qadevOOo/tests/java/ifc/sheet/_XRecentFunctions.java
+++ b/qadevOOo/tests/java/ifc/sheet/_XRecentFunctions.java
@@ -82,7 +82,6 @@ public class _XRecentFunctions extends MultiMethodTest {
iNumber = IDs.length;
bResult &= (iNumber <= iMaxNumber);
log.println("Now there are " + iNumber + " recent functions");
- bResult &= (IDs != null);
if (bResult) {
for (int i = 0; i < iNumber - 1; i++)
for (int j = i + 1; j < iNumber; j++) {
diff --git a/qadevOOo/tests/java/ifc/sheet/_XSheetAnnotation.java b/qadevOOo/tests/java/ifc/sheet/_XSheetAnnotation.java
index 5e72121ea47c..232b5bd84560 100644
--- a/qadevOOo/tests/java/ifc/sheet/_XSheetAnnotation.java
+++ b/qadevOOo/tests/java/ifc/sheet/_XSheetAnnotation.java
@@ -96,7 +96,7 @@ public class _XSheetAnnotation extends MultiMethodTest {
CellAddress oCAddr = oObj.getPosition();
- bResult = (oCAddr != null) && (sCAddr != null) &&
+ bResult = (oCAddr != null) &&
ValueComparer.equalValue(oCAddr, sCAddr) ;
tRes.tested("getPosition()", bResult);
diff --git a/qadevOOo/tests/java/ifc/task/_XStatusIndicatorFactory.java b/qadevOOo/tests/java/ifc/task/_XStatusIndicatorFactory.java
index f6cf0145615b..0ec515d1b8d2 100644
--- a/qadevOOo/tests/java/ifc/task/_XStatusIndicatorFactory.java
+++ b/qadevOOo/tests/java/ifc/task/_XStatusIndicatorFactory.java
@@ -60,8 +60,6 @@ public class _XStatusIndicatorFactory extends MultiMethodTest {
//Now SI1 is active
SI1.end();
- bResult &= SI1 != null;
-
tRes.tested("createStatusIndicator()", bResult);
}
}
diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
index 0497bd91bcf5..ff85de923605 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
@@ -363,10 +363,7 @@ public class ScriptEditorForBeanShell
if (fos != null) {
try {
fos.flush();
- if ( fos != null )
- {
- fos.close();
- }
+ fos.close();
}
catch (IOException ignore) {
}
diff --git a/sw/qa/complex/writer/LoadSaveTest.java b/sw/qa/complex/writer/LoadSaveTest.java
index 2bb1e90ae4f8..95565f283b62 100644
--- a/sw/qa/complex/writer/LoadSaveTest.java
+++ b/sw/qa/complex/writer/LoadSaveTest.java
@@ -148,9 +148,7 @@ public class LoadSaveTest
if (xDoc != null) {
util.DesktopTools.closeDoc(xDoc);
}
- if (xListener != null) {
- m_xGEB.removeDocumentEventListener(xListener);
- }
+ m_xGEB.removeDocumentEventListener(xListener);
}
}