diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java index 4212ff183..470fe9d7e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java @@ -797,7 +797,7 @@ public class DBUtils { public static long[] getRowIDsFor( Context context, String relayID ) { - long[] result = null; + long[] result = {}; String[] columns = { ROW_ID }; String selection = DBHelper.RELAYID + "='" + relayID + "'"; initDB( context ); @@ -814,7 +814,7 @@ public class DBUtils { public static long[] getRowIDsFor( Context context, int gameID ) { - long[] result = null; + long[] result = {}; String[] columns = { ROW_ID }; String selection = String.format( DBHelper.GAMEID + "=%d", gameID ); initDB( context ); @@ -836,7 +836,7 @@ public class DBUtils { public static boolean haveGame( Context context, int gameID ) { long[] rows = getRowIDsFor( context, gameID ); - return rows != null && 0 < rows.length; + return 0 < rows.length; } public static boolean haveGame( Context context, long rowid ) @@ -1607,7 +1607,7 @@ public class DBUtils { public static long[] getGroupGames( Context context, long groupID ) { - long[] result = null; + long[] result = {}; initDB( context ); String[] columns = { ROW_ID, DBHelper.HASMSGS }; String selection = String.format( "%s=%d", DBHelper.GROUPID, groupID ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 0a83a0517..bb372fa18 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -2271,10 +2271,8 @@ public class GamesListDelegate extends ListDelegateBase if ( null != relayIDs ) { for ( String relayID : relayIDs ) { long[] rowids = DBUtils.getRowIDsFor( m_activity, relayID ); - if ( null != rowids ) { - for ( long rowid : rowids ) { - reloadGame( rowid ); - } + for ( long rowid : rowids ) { + reloadGame( rowid ); } } } @@ -2289,13 +2287,11 @@ public class GamesListDelegate extends ListDelegateBase outer: for ( String relayID : relayIDs ) { long[] rowids = DBUtils.getRowIDsFor( m_activity, relayID ); - if ( null != rowids ) { - for ( long rowid : rowids ) { - if ( GameUtils.gameDictsHere( m_activity, rowid ) ) { - launchGame( rowid ); - launched = true; - break outer; - } + for ( long rowid : rowids ) { + if ( GameUtils.gameDictsHere( m_activity, rowid ) ) { + launchGame( rowid ); + launched = true; + break outer; } } } @@ -2390,7 +2386,7 @@ public class GamesListDelegate extends ListDelegateBase { boolean handled = false; long[] rowids = DBUtils.getRowIDsFor( m_activity, gameID ); - if ( null != rowids && 0 < rowids.length ) { + if ( 0 < rowids.length ) { launchGame( rowids[0] ); handled = true; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java index 38fda0d17..f6fac4e66 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java @@ -550,7 +550,7 @@ public class MQTTUtils extends Thread implements IMqttActionListener, MqttCallba Log.d( TAG, "handleMessage(gameID=%d): got message", gameID ); MQTTServiceHelper helper = new MQTTServiceHelper( context, from ); long[] rowids = DBUtils.getRowIDsFor( context, gameID ); - Log.d( TAG, "got %d rows for gameID %d", rowids == null ? 0 : rowids.length, gameID ); + Log.d( TAG, "got %d rows for gameID %d", rowids.length, gameID ); if ( 0 == rowids.length ) { notifyNotHere( context, from.mqtt_devID, gameID ); } else { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NFCUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NFCUtils.java index 20fe2d14c..798be658a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NFCUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/NFCUtils.java @@ -377,7 +377,7 @@ public class NFCUtils { switch ( typ[0] ) { case MESSAGE: long[] rowids = DBUtils.getRowIDsFor( context, gameID[0] ); - if ( null == rowids || 0 == rowids.length ) { + if ( 0 == rowids.length ) { addReplyFor( new byte[]{REPLY_NOGAME}, gameID[0] ); } else { for ( long rowid : rowids ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java index 68bc0ed6a..eb6b15f49 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayService.java @@ -755,11 +755,9 @@ public class RelayService extends XWJIService String relayID = relayIDs[ii]; BackMoveResult bmr = bmrs[ii]; long[] rowids = DBUtils.getRowIDsFor( this, relayID ); - if ( null != rowids ) { - for ( long rowid : rowids ) { - GameUtils.postMoveNotification( this, rowid, bmr, - locals.get(ii) ); - } + for ( long rowid : rowids ) { + GameUtils.postMoveNotification( this, rowid, bmr, + locals.get(ii) ); } } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java index b5671be2f..53eda8cbd 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/WiDirService.java @@ -779,7 +779,7 @@ public class WiDirService extends XWService { private void makeGame( NetLaunchInfo nli, String senderMac ) { long[] rowids = DBUtils.getRowIDsFor( this, nli.gameID() ); - if ( null == rowids || 0 == rowids.length ) { + if ( 0 == rowids.length ) { CommsAddrRec addr = nli.makeAddrRec( this ); long rowid = GameUtils.makeNewMultiGame( this, nli, m_sink, diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java index 2fd47463f..18e7c6c1a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java @@ -63,7 +63,7 @@ abstract class XWServiceHelper { { ReceiveResult result; long[] rowids = DBUtils.getRowIDsFor( mContext, gameID ); - if ( null == rowids || 0 == rowids.length ) { + if ( 0 == rowids.length ) { result = ReceiveResult.GAME_GONE; } else { result = ReceiveResult.UNCONSUMED; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java index 5a476c2d6..ada9a0c88 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java @@ -288,7 +288,7 @@ public class DUtilCtxt { String pauserName, String expl ) { long[] rowids = DBUtils.getRowIDsFor( m_context, gameID ); - Log.d( TAG, "got %d games with gameid", null == rowids ? 0 : rowids.length ); + Log.d( TAG, "got %d games with gameid", rowids.length ); final boolean isPause = UNPAUSED != pauseType;