Kaydet (Commit) b6a83e99 authored tarafından Noel Grandin's avatar Noel Grandin

java: remove redundant null checks

Change-Id: Ia42e5ed715fbd3f5b84029a9844da55f307c6260
üst 8f020a45
...@@ -593,7 +593,6 @@ public class TestCaseOldAPI extends ComplexTestCase { ...@@ -593,7 +593,6 @@ public class TestCaseOldAPI extends ComplexTestCase {
assure( "Changing FillColor of Data Series failed", nNewColor == nColor ); assure( "Changing FillColor of Data Series failed", nNewColor == nColor );
// Gradient // Gradient
assure( "No DataRowProperties for series 0", xProp != null );
// note: the FillGradient property is optional, however it was // note: the FillGradient property is optional, however it was
// supported in the old chart's API // supported in the old chart's API
......
...@@ -40,7 +40,7 @@ public class ComponentFactory implements XSingleComponentFactory ...@@ -40,7 +40,7 @@ public class ComponentFactory implements XSingleComponentFactory
catch ( java.lang.ClassNotFoundException e ) { } catch ( java.lang.ClassNotFoundException e ) { }
Constructor ctors[] = _handlerClass.getConstructors(); 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(); Class ctorParams[] = ctors[i].getParameterTypes();
if ( ( ctorParams.length == 1 ) && ( ctorParams[0].equals( XComponentContext.class ) ) ) if ( ( ctorParams.length == 1 ) && ( ctorParams[0].equals( XComponentContext.class ) ) )
......
...@@ -129,16 +129,13 @@ public class ObjectInspector extends complexlib.ComplexTestCase ...@@ -129,16 +129,13 @@ public class ObjectInspector extends complexlib.ComplexTestCase
private void closeExistentInspector() private void closeExistentInspector()
{ {
Frame existentInspectorFrame = new Frame( m_desktop.findFrame( m_inspectorFrameName, 255 ) ); Frame existentInspectorFrame = new Frame( m_desktop.findFrame( m_inspectorFrameName, 255 ) );
if ( existentInspectorFrame != null ) try
{ {
try existentInspectorFrame.close( true );
{ }
existentInspectorFrame.close( true ); catch( com.sun.star.util.CloseVetoException e )
} {
catch( com.sun.star.util.CloseVetoException e ) failed( "could not close the existent inspector frame" );
{
failed( "could not close the existent inspector frame" );
}
} }
} }
......
...@@ -598,7 +598,6 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE ...@@ -598,7 +598,6 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
private boolean ensureTables() throws com.sun.star.uno.Exception, java.lang.Exception private boolean ensureTables() throws com.sun.star.uno.Exception, java.lang.Exception
{ {
Connection connection = new Connection( m_dataSource.getConnection( "", "" ) ); Connection connection = new Connection( m_dataSource.getConnection( "", "" ) );
assure( "could not connect to the data source", connection != null );
// drop the table, if it already exists // drop the table, if it already exists
if ( !implExecuteStatement( "DROP TABLE \"" + s_tableName + "\" IF EXISTS" ) if ( !implExecuteStatement( "DROP TABLE \"" + s_tableName + "\" IF EXISTS" )
......
...@@ -80,13 +80,10 @@ class Proxy implements IQueryInterface, XEventListener ...@@ -80,13 +80,10 @@ class Proxy implements IQueryInterface, XEventListener
if (object instanceof IQueryInterface) if (object instanceof IQueryInterface)
{ {
IQueryInterface iquery = (IQueryInterface) object; IQueryInterface iquery = (IQueryInterface) object;
if (iquery != null) if (iquery.getOid().equals(oid))
{ return true;
if (iquery.getOid().equals(oid)) else
return true; return false;
else
return false;
}
} }
String oidObj = UnoRuntime.generateOid(object); String oidObj = UnoRuntime.generateOid(object);
......
...@@ -120,7 +120,7 @@ public class OpenQuery { ...@@ -120,7 +120,7 @@ public class OpenQuery {
System.out.println("----------\t------"); System.out.println("----------\t------");
// output result rows // output result rows
while ( xRowSet != null && xRowSet.next() ) { while ( xRowSet.next() ) {
String ident = xRow.getString(xLoc.findColumn("IDENTIFIER")); String ident = xRow.getString(xLoc.findColumn("IDENTIFIER"));
String author = xRow.getString(xLoc.findColumn("AUTHOR")); String author = xRow.getString(xLoc.findColumn("AUTHOR"));
System.out.println(ident + "\t\t" + author); System.out.println(ident + "\t\t" + author);
......
...@@ -128,12 +128,7 @@ public class ComplexDescGetter extends DescGetter ...@@ -128,12 +128,7 @@ public class ComplexDescGetter extends DescGetter
} }
String testObjectName = className; String testObjectName = className;
String[] testMethodNames = null; String[] testMethodNames = testClass.getTestMethodNames();
if (testMethodNames == null)
{
testMethodNames = testClass.getTestMethodNames();
}
if (methodNames != null) if (methodNames != null)
{ {
testMethodNames = methodNames; testMethodNames = methodNames;
......
...@@ -748,7 +748,7 @@ public class ValueChanger { ...@@ -748,7 +748,7 @@ public class ValueChanger {
if (Enum.class.equals(flds[i].getType().getSuperclass())) { if (Enum.class.equals(flds[i].getType().getSuperclass())) {
Enum value = (Enum) flds[i].get(null) ; Enum value = (Enum) flds[i].get(null) ;
if (newValue == null && !value.equals(oldValue)) { if (!value.equals(oldValue)) {
newValue = value ; newValue = value ;
break ; break ;
} }
......
...@@ -212,8 +212,7 @@ public class _XTransliteration extends MultiMethodTest { ...@@ -212,8 +212,7 @@ public class _XTransliteration extends MultiMethodTest {
log.println(out[i]); log.println(out[i]);
} }
boolean bOK = out != null && boolean bOK = out.length == 4 &&
out.length == 4 &&
("A".equals(out[0]) && "I".equals(out[1]) && ("A".equals(out[0]) && "I".equals(out[1]) &&
"a".equals(out[2]) && "i".equals(out[3])) || "a".equals(out[2]) && "i".equals(out[3])) ||
("a".equals(out[0]) && "i".equals(out[1]) && ("a".equals(out[0]) && "i".equals(out[1]) &&
......
...@@ -126,7 +126,6 @@ public class _XInputStream extends MultiMethodTest { ...@@ -126,7 +126,6 @@ public class _XInputStream extends MultiMethodTest {
int read = oObj.readBytes(data, 1) ; int read = oObj.readBytes(data, 1) ;
result = read == 1 && result = read == 1 &&
data != null &&
data.length == 1 ; data.length == 1 ;
} catch (com.sun.star.io.IOException e){ } catch (com.sun.star.io.IOException e){
e.printStackTrace(log) ; e.printStackTrace(log) ;
...@@ -161,7 +160,6 @@ public class _XInputStream extends MultiMethodTest { ...@@ -161,7 +160,6 @@ public class _XInputStream extends MultiMethodTest {
int read = oObj.readSomeBytes(data, 1) ; int read = oObj.readSomeBytes(data, 1) ;
result = read == 1 && result = read == 1 &&
data != null &&
data.length == 1 ; data.length == 1 ;
} catch (com.sun.star.io.IOException e){ } catch (com.sun.star.io.IOException e){
e.printStackTrace(log) ; e.printStackTrace(log) ;
......
...@@ -82,7 +82,6 @@ public class _XRecentFunctions extends MultiMethodTest { ...@@ -82,7 +82,6 @@ public class _XRecentFunctions extends MultiMethodTest {
iNumber = IDs.length; iNumber = IDs.length;
bResult &= (iNumber <= iMaxNumber); bResult &= (iNumber <= iMaxNumber);
log.println("Now there are " + iNumber + " recent functions"); log.println("Now there are " + iNumber + " recent functions");
bResult &= (IDs != null);
if (bResult) { if (bResult) {
for (int i = 0; i < iNumber - 1; i++) for (int i = 0; i < iNumber - 1; i++)
for (int j = i + 1; j < iNumber; j++) { for (int j = i + 1; j < iNumber; j++) {
......
...@@ -96,7 +96,7 @@ public class _XSheetAnnotation extends MultiMethodTest { ...@@ -96,7 +96,7 @@ public class _XSheetAnnotation extends MultiMethodTest {
CellAddress oCAddr = oObj.getPosition(); CellAddress oCAddr = oObj.getPosition();
bResult = (oCAddr != null) && (sCAddr != null) && bResult = (oCAddr != null) &&
ValueComparer.equalValue(oCAddr, sCAddr) ; ValueComparer.equalValue(oCAddr, sCAddr) ;
tRes.tested("getPosition()", bResult); tRes.tested("getPosition()", bResult);
......
...@@ -60,8 +60,6 @@ public class _XStatusIndicatorFactory extends MultiMethodTest { ...@@ -60,8 +60,6 @@ public class _XStatusIndicatorFactory extends MultiMethodTest {
//Now SI1 is active //Now SI1 is active
SI1.end(); SI1.end();
bResult &= SI1 != null;
tRes.tested("createStatusIndicator()", bResult); tRes.tested("createStatusIndicator()", bResult);
} }
} }
......
...@@ -363,10 +363,7 @@ public class ScriptEditorForBeanShell ...@@ -363,10 +363,7 @@ public class ScriptEditorForBeanShell
if (fos != null) { if (fos != null) {
try { try {
fos.flush(); fos.flush();
if ( fos != null ) fos.close();
{
fos.close();
}
} }
catch (IOException ignore) { catch (IOException ignore) {
} }
......
...@@ -148,9 +148,7 @@ public class LoadSaveTest ...@@ -148,9 +148,7 @@ public class LoadSaveTest
if (xDoc != null) { if (xDoc != null) {
util.DesktopTools.closeDoc(xDoc); util.DesktopTools.closeDoc(xDoc);
} }
if (xListener != null) { m_xGEB.removeDocumentEventListener(xListener);
m_xGEB.removeDocumentEventListener(xListener);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment