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

java: variable cannot be null

remove null check where null-analyis reveals the variable cannot be null

Change-Id: Ied0a24665514bbf68c2ed5f15af9e5c2232a8033
üst b58c053f
...@@ -621,7 +621,7 @@ public class AnyConverter ...@@ -621,7 +621,7 @@ public class AnyConverter
break; break;
case TypeClass.ENUM_value: case TypeClass.ENUM_value:
if (tc == TypeClass.ENUM_value && if (tc == TypeClass.ENUM_value &&
(null == destTClass || destType.equals( type ) /* optional destType */)) (destType.equals( type ) /* optional destType */))
{ {
return object; return object;
} }
......
...@@ -181,7 +181,7 @@ public class java_fat implements TestBase ...@@ -181,7 +181,7 @@ public class java_fat implements TestBase
aSubEntry.UserDefinedParams = m_aParams; aSubEntry.UserDefinedParams = m_aParams;
aSubEntry.Logger = ifclog; aSubEntry.Logger = ifclog;
if ((tEnv == null) || tEnv.isDisposed()) if (tEnv.isDisposed())
{ {
closeExistingOffice(); closeExistingOffice();
tEnv = getEnv(entry, m_aParams); tEnv = getEnv(entry, m_aParams);
......
...@@ -242,8 +242,6 @@ public class SQLExecution { ...@@ -242,8 +242,6 @@ public class SQLExecution {
} }
} }
} }
if (!update && sqlOutput == null)
return false;
return true; return true;
} }
......
...@@ -60,13 +60,13 @@ public class _XCellRangeReferrer extends MultiMethodTest { ...@@ -60,13 +60,13 @@ public class _XCellRangeReferrer extends MultiMethodTest {
("Relation 'DATAAREA' not found")); ("Relation 'DATAAREA' not found"));
XCellRange cr = oObj.getReferredCells(); XCellRange cr = oObj.getReferredCells();
log.println(cr.toString());
if (cr == null) { if (cr == null) {
log.println("getReferredCells returned NULL."); log.println("getReferredCells returned NULL.");
tRes.tested("getReferredCells()", false); tRes.tested("getReferredCells()", false);
return; return;
} }
log.println(cr.toString());
XCellRangeAddressable xCRA = UnoRuntime.queryInterface(XCellRangeAddressable.class, cr); XCellRangeAddressable xCRA = UnoRuntime.queryInterface(XCellRangeAddressable.class, cr);
......
...@@ -66,11 +66,11 @@ public class _XChangesBatch extends MultiMethodTest { ...@@ -66,11 +66,11 @@ public class _XChangesBatch extends MultiMethodTest {
if (changeElement == null || originalElement == null || elementName == null || (xProp == null && xNameReplace == null)) { if (changeElement == null || originalElement == null || elementName == null || (xProp == null && xNameReplace == null)) {
log.println( log.println(
changeElement == null?"Missing property 'XChangesBatch.ChangeElement'\n":"" + (changeElement == null?"Missing property 'XChangesBatch.ChangeElement'\n":"") +
originalElement == null?"Missing property 'XChangesBatch.OriginalElement'\n":"" + (originalElement == null?"Missing property 'XChangesBatch.OriginalElement'\n":"") +
elementName == null?"Missing property 'XChangesBatch.PropertyName'\n":"" + (elementName == null?"Missing property 'XChangesBatch.PropertyName'\n":"") +
xProp == null?"Missing property 'XChangesBatch.PropertySet'":"" + (xProp == null?"Missing property 'XChangesBatch.PropertySet'":"") +
xNameReplace == null?"Missing property 'XChangesBatch.NameReplace'":"" (xNameReplace == null?"Missing property 'XChangesBatch.NameReplace'":"")
); );
throw new StatusException("Some needed object relations are missing.", new Exception()); throw new StatusException("Some needed object relations are missing.", new Exception());
} }
......
...@@ -112,12 +112,12 @@ public class _XChangesNotifier extends MultiMethodTest { ...@@ -112,12 +112,12 @@ public class _XChangesNotifier extends MultiMethodTest {
if (changeElement == null || originalElement == null || elementName == null || (xProp == null && xNameReplace == null) || xBatch == null) { if (changeElement == null || originalElement == null || elementName == null || (xProp == null && xNameReplace == null) || xBatch == null) {
log.println( log.println(
changeElement == null?"Missing property 'XChangesNotifier.ChangeElement'\n":"" + (changeElement == null?"Missing property 'XChangesNotifier.ChangeElement'\n":"") +
originalElement == null?"Missing property 'XChangesNotifier.OriginalElement'\n":"" + (originalElement == null?"Missing property 'XChangesNotifier.OriginalElement'\n":"") +
elementName == null?"Missing property 'XChangesNotifier.PropertyName'\n":"" + (elementName == null?"Missing property 'XChangesNotifier.PropertyName'\n":"") +
xProp == null?"Missing property 'XChangesNotifier.PropertySet'":"" + (xProp == null?"Missing property 'XChangesNotifier.PropertySet'":"") +
xNameReplace == null?"Missing property 'XChangesNotifier.NameReplace'":"" + (xNameReplace == null?"Missing property 'XChangesNotifier.NameReplace'":"") +
xBatch == null?"Missing property 'XChangesNotifier.ChangesBatch'":"" (xBatch == null?"Missing property 'XChangesNotifier.ChangesBatch'":"")
); );
throw new StatusException("Some needed object relations are missing.", new Exception()); throw new StatusException("Some needed object relations are missing.", new Exception());
} }
......
...@@ -155,7 +155,6 @@ public class ScDataPilotTableObj extends TestCase { ...@@ -155,7 +155,6 @@ public class ScDataPilotTableObj extends TestCase {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); throw new StatusException( "Couldn't get a spreadsheet", e);
} }
log.println("Getting sheet - " + (oSheet == null ? "FAILED" : "OK"));
try { try {
log.println("Filing a table"); log.println("Filing a table");
for (int i = 1; i < 6; i++) { for (int i = 1; i < 6; i++) {
......
...@@ -166,9 +166,6 @@ public class ScDataPilotTablesObj extends TestCase { ...@@ -166,9 +166,6 @@ public class ScDataPilotTablesObj extends TestCase {
oObj = DPT; oObj = DPT;
log.println("Creating object - " +
((oObj == null) ? "FAILED" : "OK"));
TestEnvironment tEnv = new TestEnvironment( oObj ); TestEnvironment tEnv = new TestEnvironment( oObj );
// Other parameters required for interface tests // Other parameters required for interface tests
......
...@@ -131,9 +131,6 @@ public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase { ...@@ -131,9 +131,6 @@ public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase {
oObj = DPT; oObj = DPT;
log.println("Creating object - " +
((oObj == null) ? "FAILED" : "OK"));
XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj); XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
oObj = ea.createEnumeration(); oObj = ea.createEnumeration();
......
...@@ -948,11 +948,6 @@ public class ViewForwarder { ...@@ -948,11 +948,6 @@ public class ViewForwarder {
System.out.println("While waiting :" + e) ; System.out.println("While waiting :" + e) ;
} }
if (xComp == null) {
fail("loading document failed.");
return;
}
xSpreadsheetDoc = UnoRuntime.queryInterface( xSpreadsheetDoc = UnoRuntime.queryInterface(
XSpreadsheetDocument.class, xComp); XSpreadsheetDocument.class, xComp);
XModel aModel = XModel aModel =
......
...@@ -209,26 +209,21 @@ public class _XCommandProcessor { ...@@ -209,26 +209,21 @@ public class _XCommandProcessor {
* </ul> * </ul>
*/ */
public boolean _abort() { public boolean _abort() {
//executeMethod("createCommandIdentifier()");
// Command command = null;//(Command)tEnv.getObjRelation(
//"XCommandProcessor.AbortCommand");
Command command = new Command("getCommandInfo", -1, null); Command command = new Command("getCommandInfo", -1, null);
if (command == null) { String commandName = "globalTransfer";
String commandName = "globalTransfer";
String srcURL = util.utils.getFullTestURL("solibrary.jar") ; String srcURL = util.utils.getFullTestURL("solibrary.jar") ;
String tmpURL = util.utils.getOfficeTemp(xMSF) ; String tmpURL = util.utils.getOfficeTemp(xMSF) ;
log.println("Copying '" + srcURL + "' to '" + tmpURL) ; log.println("Copying '" + srcURL + "' to '" + tmpURL) ;
GlobalTransferCommandArgument arg = new GlobalTransferCommandArgument arg = new
GlobalTransferCommandArgument( GlobalTransferCommandArgument(
TransferCommandOperation.COPY, srcURL, TransferCommandOperation.COPY, srcURL,
tmpURL, "", NameClash.OVERWRITE); tmpURL, "", NameClash.OVERWRITE);
command = new Command(commandName, -1, arg); command = new Command(commandName, -1, arg);
}
Thread aborter = new Thread() { Thread aborter = new Thread() {
public void run() { public void run() {
......
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