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 {
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
......
......@@ -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 ) ) )
......
......@@ -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" );
}
}
......
......@@ -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" )
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 ;
}
......
......@@ -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]) &&
......
......@@ -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) ;
......
......@@ -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++) {
......
......@@ -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);
......
......@@ -60,8 +60,6 @@ public class _XStatusIndicatorFactory extends MultiMethodTest {
//Now SI1 is active
SI1.end();
bResult &= SI1 != null;
tRes.tested("createStatusIndicator()", bResult);
}
}
......
......@@ -363,10 +363,7 @@ public class ScriptEditorForBeanShell
if (fos != null) {
try {
fos.flush();
if ( fos != null )
{
fos.close();
}
fos.close();
}
catch (IOException ignore) {
}
......
......@@ -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);
}
}
......
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