From a1e4d4da0e53c91c0928cd2994f8a8433783ca2b Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 9 Dec 2016 07:34:51 -0800 Subject: [PATCH] pass TAG to printStack() and logex So they'll show up when using logcat filtering --- .../org/eehouse/android/xw4/BTService.java | 8 ++--- .../org/eehouse/android/xw4/BiDiSockWrap.java | 14 ++++---- .../eehouse/android/xw4/BoardDelegate.java | 10 +++--- .../org/eehouse/android/xw4/BoardView.java | 2 +- .../eehouse/android/xw4/CommsTransport.java | 10 +++--- .../android/xw4/ConnStatusHandler.java | 4 +-- .../src/org/eehouse/android/xw4/DBUtils.java | 10 +++--- .../src/org/eehouse/android/xw4/DbgUtils.java | 12 +++---- .../org/eehouse/android/xw4/DictUtils.java | 12 +++---- .../eehouse/android/xw4/DictsDelegate.java | 4 +-- .../eehouse/android/xw4/DwnldDelegate.java | 10 +++--- .../eehouse/android/xw4/GCMIntentService.java | 4 +-- .../src/org/eehouse/android/xw4/GameLock.java | 8 ++--- .../org/eehouse/android/xw4/GameUtils.java | 4 +-- .../android/xw4/GamesListDelegate.java | 2 +- .../org/eehouse/android/xw4/LookupAlert.java | 2 +- .../eehouse/android/xw4/NagTurnReceiver.java | 2 +- .../eehouse/android/xw4/NetLaunchInfo.java | 4 +-- .../src/org/eehouse/android/xw4/NetUtils.java | 18 +++++------ .../eehouse/android/xw4/RefreshNamesTask.java | 2 +- .../android/xw4/RelayInviteDelegate.java | 2 +- .../org/eehouse/android/xw4/RelayService.java | 32 +++++++++---------- .../org/eehouse/android/xw4/SMSReceiver.java | 2 +- .../org/eehouse/android/xw4/SMSService.java | 14 ++++---- .../android/xw4/UpdateCheckReceiver.java | 16 +++++----- .../src/org/eehouse/android/xw4/Utils.java | 5 +-- .../org/eehouse/android/xw4/WiDirService.java | 8 ++--- .../eehouse/android/xw4/jni/CurGameInfo.java | 7 ++-- .../eehouse/android/xw4/jni/GameSummary.java | 4 +-- .../eehouse/android/xw4/jni/JNIThread.java | 4 +-- .../eehouse/android/xw4/jni/JNIUtilsImpl.java | 2 +- .../org/eehouse/android/xw4/loc/LocUtils.java | 4 +-- 32 files changed, 122 insertions(+), 120 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java index 5c8180e84..9329efcf2 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java @@ -1085,7 +1085,7 @@ public class BTService extends XWService { try { m_listener.join( 100 ); } catch ( InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } m_listener = null; } @@ -1096,7 +1096,7 @@ public class BTService extends XWService { try { m_sender.join( 100 ); } catch ( InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } m_sender = null; } @@ -1179,7 +1179,7 @@ public class BTService extends XWService { private void logIOE( IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); ++s_errCount; // if ( 0 == s_errCount % 10 ) { postEvent( MultiEvent.BT_ERR_COUNT, s_errCount ); @@ -1222,7 +1222,7 @@ public class BTService extends XWService { try { socket.close(); } catch( IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } } ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BiDiSockWrap.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BiDiSockWrap.java index 48ac9a62f..99c703fc6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BiDiSockWrap.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BiDiSockWrap.java @@ -79,11 +79,11 @@ public class BiDiSockWrap { mIface.connectStateChanged( BiDiSockWrap.this, true ); break; } catch ( java.net.UnknownHostException uhe ) { - DbgUtils.logex( uhe ); + DbgUtils.logex( TAG, uhe ); } catch ( IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } catch ( InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } waitMillis = Math.min( waitMillis * 2, 1000 * 60 ); } @@ -102,7 +102,7 @@ public class BiDiSockWrap { try { send( packet.getBytes( "UTF-8" ) ); } catch ( java.io.UnsupportedEncodingException uee ) { - DbgUtils.logex( uee ); + DbgUtils.logex( TAG, uee ); } } @@ -138,7 +138,7 @@ public class BiDiSockWrap { try { mSocket.close(); } catch ( IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } mIface.connectStateChanged( this, false ); mQueue.add( new byte[0] ); @@ -170,7 +170,7 @@ public class BiDiSockWrap { mIface.onWriteSuccess( BiDiSockWrap.this ); } } catch ( IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); closeSocket(); } catch ( InterruptedException ie ) { Assert.fail(); @@ -195,7 +195,7 @@ public class BiDiSockWrap { mIface.gotPacket( BiDiSockWrap.this, packet ); } } catch( IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); closeSocket(); } DbgUtils.logd( TAG, "read thread exiting" ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java index cb9a72469..b78cc2254 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -2287,12 +2287,12 @@ public class BoardDelegate extends DelegateBase try { m_forResultWait.acquire(); } catch ( java.lang.InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); if ( DlgID.NONE != m_blockingDlgID ) { try { dismissDialog( m_blockingDlgID ); } catch ( java.lang.IllegalArgumentException iae ) { - DbgUtils.logex( iae ); + DbgUtils.logex( TAG, iae ); } } } @@ -2465,7 +2465,7 @@ public class BoardDelegate extends DelegateBase RelayService.inviteRemote( m_activity, destDevID, null, nli ); } catch (NumberFormatException nfi) { - DbgUtils.logex( nfi ); + DbgUtils.logex( TAG, nfi ); } break; case WIFIDIRECT: @@ -2550,7 +2550,7 @@ public class BoardDelegate extends DelegateBase m_handler.post( runnable ); } else { DbgUtils.logw( TAG, "post(): dropping b/c handler null" ); - DbgUtils.printStack(); + DbgUtils.printStack( TAG ); } return canPost; } @@ -2795,7 +2795,7 @@ public class BoardDelegate extends DelegateBase { if ( null == m_jniThread ) { DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() ); - DbgUtils.printStack(); + DbgUtils.printStack( TAG ); } else { m_jniThread.handle( cmd, args ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java index 9be717d89..44fa3d139 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java @@ -414,7 +414,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw { { if ( null == m_jniThread ) { DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() ); - DbgUtils.printStack(); + DbgUtils.printStack( TAG ); } else { m_jniThread.handle( cmd, args ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java index 7548e58bc..18b20d8f0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java @@ -95,7 +95,7 @@ public class CommsTransport implements TransportProcs, closeSocket(); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } catch ( UnresolvedAddressException uae ) { DbgUtils.logw( TAG, "bad address: name: %s; port: %s; exception: %s", m_useHost, m_relayAddr.ip_relay_port, @@ -133,7 +133,7 @@ public class CommsTransport implements TransportProcs, m_relayAddr.ip_relay_port ); m_socketChannel.connect( isa ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); failed = true; break outer_loop; } @@ -157,7 +157,7 @@ public class CommsTransport implements TransportProcs, DbgUtils.logw( TAG, "exiting: %s", ioe.toString() ); DbgUtils.logw( TAG, ioe.toString() ); } catch ( java.nio.channels.NoConnectionPendingException ncp ) { - DbgUtils.logex( ncp ); + DbgUtils.logex( TAG, ncp ); closeSocket(); break; } @@ -205,7 +205,7 @@ public class CommsTransport implements TransportProcs, break outer_loop; } catch ( java.nio.channels. NoConnectionPendingException ncp ) { - DbgUtils.logex( ncp ); + DbgUtils.logex( TAG, ncp ); break outer_loop; } } @@ -342,7 +342,7 @@ public class CommsTransport implements TransportProcs, try { m_thread.join(100); // wait up to 1/10 second } catch ( java.lang.InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } m_thread = null; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java index db1b65195..e682c285a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java @@ -387,7 +387,7 @@ public class ConnStatusHandler { // } catch ( java.lang.ClassNotFoundException cnfe ) { // DbgUtils.logf( "loadState: %s", cnfe.toString() ); } catch ( Exception ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } } } @@ -506,7 +506,7 @@ public class ConnStatusHandler { XWPrefs.setPrefsString( context, R.string.key_connstat_data, as64 ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } s_needsSave = false; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java index 78ca7e46e..b861da5dd 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java @@ -983,7 +983,7 @@ public class DBUtils { long result = db.replaceOrThrow( DBHelper.TABLE_NAME_OBITS, "", values ); } catch ( Exception ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } db.close(); } @@ -1916,13 +1916,13 @@ public class DBUtils { channelSrc.transferTo( 0, channelSrc.size(), channelDest ); success = true; } catch( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } finally { try { channelSrc.close(); channelDest.close(); } catch( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } return success; @@ -2280,7 +2280,7 @@ public class DBUtils { try { updateStmt.execute(); } catch ( Exception ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); Assert.fail(); } } @@ -2535,7 +2535,7 @@ public class DBUtils { invalGroupsCache(); } } catch( java.io.FileNotFoundException fnfe ) { - DbgUtils.logex( fnfe ); + DbgUtils.logex( TAG, fnfe ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java index b3f5ba1a6..d55f59c5c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java @@ -121,10 +121,10 @@ public class DbgUtils { showf( context, LocUtils.getString( context, formatid ), args ); } // showf - public static void logex( Exception exception ) + public static void logex( String tag, Exception exception ) { logw( TAG, "Exception: %s", exception.toString() ); - printStack( exception.getStackTrace() ); + printStack( tag, exception.getStackTrace() ); } public static void assertOnUIThread() @@ -132,20 +132,20 @@ public class DbgUtils { Assert.assertTrue( Looper.getMainLooper().equals(Looper.myLooper()) ); } - public static void printStack( StackTraceElement[] trace ) + public static void printStack( String tag, StackTraceElement[] trace ) { if ( s_doLog && null != trace ) { // 1: skip printStack etc. for ( int ii = 1; ii < trace.length; ++ii ) { - DbgUtils.logd( TAG, "ste %d: %s", ii, trace[ii].toString() ); + DbgUtils.logd( tag, "ste %d: %s", ii, trace[ii].toString() ); } } } - public static void printStack() + public static void printStack( String tag ) { if ( s_doLog ) { - printStack( Thread.currentThread().getStackTrace() ); + printStack( tag, Thread.currentThread().getStackTrace() ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java index 10756e12d..f2ca0b039 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java @@ -195,7 +195,7 @@ public class DictUtils { } catch ( java.io.FileNotFoundException fnf ) { // DbgUtils.logex( fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -264,7 +264,7 @@ public class DictUtils { success = DBUtils.copyFileStream( fos, fis ); } catch ( java.io.FileNotFoundException fnfe ) { - DbgUtils.logex( fnfe ); + DbgUtils.logex( TAG, fnfe ); } return success; } // copyDict @@ -365,7 +365,7 @@ public class DictUtils { } catch ( java.io.FileNotFoundException fnf ) { // DbgUtils.logex( fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -478,9 +478,9 @@ public class DictUtils { invalDictList(); } } catch ( java.io.FileNotFoundException fnf ) { - DbgUtils.logex( fnf ); + DbgUtils.logex( TAG, fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); tmpFile.delete(); } } @@ -565,7 +565,7 @@ public class DictUtils { AssetManager am = context.getAssets(); return am.list(""); } catch( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); return new String[0]; } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java index cf2bfb9e0..041a90644 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java @@ -1243,7 +1243,7 @@ public class DictsDelegate extends ListDelegateBase } } catch ( JSONException ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); theOne = null; } } @@ -1423,7 +1423,7 @@ public class DictsDelegate extends ListDelegateBase success = true; } catch ( JSONException ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java index a6d3ba880..09eb82895 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java @@ -138,11 +138,11 @@ public class DwnldDelegate extends ListDelegateBase { } is.close(); } catch ( java.net.URISyntaxException use ) { - DbgUtils.logex( use ); + DbgUtils.logex( TAG, use ); } catch ( java.net.MalformedURLException mue ) { - DbgUtils.logex( mue ); + DbgUtils.logex( TAG, mue ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } return null; } @@ -218,9 +218,9 @@ public class DwnldDelegate extends ListDelegateBase { fos.close(); success = !cancelled; } catch ( java.io.FileNotFoundException fnf ) { - DbgUtils.logex( fnf ); + DbgUtils.logex( TAG, fnf ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } if ( !success ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java index 96fe777b7..a6858987f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java @@ -96,7 +96,7 @@ public class GCMIntentService extends GCMBaseIntentService { RelayService.processGameMsgs( context, connname, strs64 ); } } catch (org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } @@ -133,7 +133,7 @@ public class GCMIntentService extends GCMBaseIntentService { DbgUtils.logw( TAG, "Device can't do GCM." ); } catch ( Exception whatever ) { // funky devices could do anything - DbgUtils.logex( whatever ); + DbgUtils.logex( TAG, whatever ); } } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java index 9cba04fa9..719945a49 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java @@ -58,7 +58,7 @@ public class GameLock { if ( DEBUG_LOCKS ) { DbgUtils.logi( TAG, "GameLock(rowid:%d,isForWrite:%b)=>" + "this: %H", rowid, isForWrite, this ); - DbgUtils.printStack(); + DbgUtils.printStack( TAG ); } } @@ -139,16 +139,16 @@ public class GameLock { DbgUtils.logi( TAG, "lock() %H failed; sleeping", this ); if ( 0 == sleptTime || sleptTime + SLEEP_TIME >= ASSERT_TIME ) { DbgUtils.logi( TAG, "lock %H seeking stack:", curOwner ); - DbgUtils.printStack( curOwner.m_lockTrace ); + DbgUtils.printStack( TAG, curOwner.m_lockTrace ); DbgUtils.logi( TAG, "lock %H seeking stack:", this ); - DbgUtils.printStack(); + DbgUtils.printStack( TAG ); } } try { Thread.sleep( SLEEP_TIME ); // milliseconds sleptTime += SLEEP_TIME; } catch( InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); break; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index 103fa5465..6ed9e25d7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -225,7 +225,7 @@ public class GameUtils { try { lock = new GameLock( rowid, false ).lock( maxMillis ); } catch ( GameLock.GameLockedException gle ) { - DbgUtils.logex( gle ); + DbgUtils.logex( TAG, gle ); } } @@ -1254,7 +1254,7 @@ public class GameUtils { fos.close(); result = file; } catch ( Exception ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } } return result; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java index ffaa4ede1..7eac6d0e7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java @@ -2423,7 +2423,7 @@ public class GamesListDelegate extends ListDelegateBase launchGame( rowid ); } } catch ( GameLock.GameLockedException gle ) { - DbgUtils.logex( gle ); + DbgUtils.logex( TAG, gle ); finish(); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java index 3812b8b29..db890aaa6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java @@ -289,7 +289,7 @@ public class LookupAlert extends LinearLayout try { context.startActivity( intent ); } catch ( android.content.ActivityNotFoundException anfe ) { - DbgUtils.logex( anfe ); + DbgUtils.logex( TAG, anfe ); } } } // lookupWord diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java index 616dbd3ff..feb331b19 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java @@ -178,7 +178,7 @@ public class NagTurnReceiver extends BroadcastReceiver { al.add(value); } } catch ( Exception ex ) { - DbgUtils.logex(ex); + DbgUtils.logex( TAG, ex ); } } if ( 0 < al.size() ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java index af2fa898e..8d0423640 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java @@ -350,7 +350,7 @@ public class NetLaunchInfo { result = obj.toString(); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } // DbgUtils.logf( "makeLaunchJSON() => %s", result ); return result; @@ -441,7 +441,7 @@ public class NetLaunchInfo { } } catch ( JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } removeUnsupported( supported ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java index 855ee6ec7..99ed3ef8d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java @@ -72,9 +72,9 @@ public class NetUtils { socket.setSoTimeout( timeoutMillis ); } catch ( java.net.UnknownHostException uhe ) { - DbgUtils.logex( uhe ); + DbgUtils.logex( TAG, uhe ); } catch( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } return socket; } @@ -129,7 +129,7 @@ public class NetUtils { DBUtils.clearObits( m_context, m_obits ); } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } } @@ -199,7 +199,7 @@ public class NetUtils { } } catch( Exception npe ) { - DbgUtils.logex( npe ); + DbgUtils.logex( TAG, npe ); } return msgs; } // queryRelay @@ -225,10 +225,10 @@ public class NetUtils { result = (HttpURLConnection)new URL(url).openConnection(); } catch ( java.net.MalformedURLException mue ) { Assert.assertNull( result ); - DbgUtils.logex( mue ); + DbgUtils.logex( TAG, mue ); } catch ( java.io.IOException ioe ) { Assert.assertNull( result ); - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } return result; } @@ -276,9 +276,9 @@ public class NetUtils { DbgUtils.logw( TAG, "runConn: responseCode: %d", responseCode ); } } catch ( java.net.ProtocolException pe ) { - DbgUtils.logex( pe ); + DbgUtils.logex( TAG, pe ); } catch( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -299,7 +299,7 @@ public class NetUtils { } result = TextUtils.join( "&", pairs ); } catch ( java.io.UnsupportedEncodingException uee ) { - DbgUtils.logex( uee ); + DbgUtils.logex( TAG, uee ); } return result; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java index 6bfbfebc2..b8cb4d9ef 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java @@ -110,7 +110,7 @@ public class RefreshNamesTask extends AsyncTask { } } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } DbgUtils.logi( TAG, "doInBackground() returning" ); return names.toArray( new String[names.size()] ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java index d166d71eb..fc8986df0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java @@ -534,7 +534,7 @@ public class RelayInviteDelegate extends InviteDelegate { } } catch ( org.json.JSONException je ) { - DbgUtils.logex( je ); + DbgUtils.logex( TAG, je ); } stopProgress(); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java index aa7cadb4d..e63c5e54c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java @@ -535,7 +535,7 @@ public class RelayService extends XWService try { Thread.sleep( 20 ); } catch( java.lang.InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } } } @@ -592,10 +592,10 @@ public class RelayService extends XWService DbgUtils.logd( TAG, "connectSocket(%s:%d): m_UDPSocket" + " now %H", host, port, m_UDPSocket ); } catch( java.net.SocketException se ) { - DbgUtils.logex( se ); + DbgUtils.logex( TAG, se ); Assert.fail(); } catch( java.net.UnknownHostException uhe ) { - DbgUtils.logex( uhe ); + DbgUtils.logex( TAG, uhe ); } } else { Assert.assertTrue( m_UDPSocket.isConnected() ); @@ -637,7 +637,7 @@ public class RelayService extends XWService resetExitTimer(); ConnStatusHandler.showSuccessOut(); } catch ( java.net.SocketException se ) { - DbgUtils.logex( se ); + DbgUtils.logex( TAG, se ); DbgUtils.logi( TAG, "Restarting threads to force" + " new socket" ); m_handler.post( new Runnable() { @@ -646,7 +646,7 @@ public class RelayService extends XWService } } ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } catch ( NullPointerException npe ) { DbgUtils.logw( TAG, "network problem; dropping packet" ); } @@ -671,7 +671,7 @@ public class RelayService extends XWService m_UDPWriteThread.join(); DbgUtils.logd( TAG, "SUCCESSFULLY joined m_UDPWriteThread" ); } catch( java.lang.InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } m_UDPWriteThread = null; m_queue.clear(); @@ -681,7 +681,7 @@ public class RelayService extends XWService try { m_UDPReadThread.join(); } catch( java.lang.InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } m_UDPReadThread = null; m_UDPSocket = null; @@ -783,7 +783,7 @@ public class RelayService extends XWService } } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } if ( resetBackoff ) { @@ -860,7 +860,7 @@ public class RelayService extends XWService postPacket( bas, XWRelayReg.XWPDEV_REG ); s_regStartTime = now; } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } } @@ -884,7 +884,7 @@ public class RelayService extends XWService postPacket( bas, reg ); } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -908,7 +908,7 @@ public class RelayService extends XWService out.write( msg, 0, msg.length ); postPacket( bas, XWRelayReg.XWPDEV_MSG ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -924,7 +924,7 @@ public class RelayService extends XWService out.write( msg, 0, msg.length ); postPacket( bas, XWRelayReg.XWPDEV_MSGNOCONN ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -958,7 +958,7 @@ public class RelayService extends XWService out.write( nliData, 0, nliData.length ); postPacket( bas, XWRelayReg.XWPDEV_INVITE ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -971,7 +971,7 @@ public class RelayService extends XWService un2vli( header.m_packetID, out ); postPacket( bas, XWRelayReg.XWPDEV_ACK ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } } @@ -1145,7 +1145,7 @@ public class RelayService extends XWService socket.close(); } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } return null; } // doInBackground @@ -1467,7 +1467,7 @@ public class RelayService extends XWService out.writeByte( m_cmd.ordinal() ); m_header = bas.toByteArray(); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSReceiver.java index 6e97f8462..ed88b2ecc 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSReceiver.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSReceiver.java @@ -48,7 +48,7 @@ public class SMSReceiver extends BroadcastReceiver { byte[] body = sms.getUserData(); SMSService.handleFrom( context, body, phone ); } catch ( NullPointerException npe ) { - DbgUtils.logex( npe ); + DbgUtils.logex( TAG, npe ); } } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java index 953e8bf7d..5bd634fbb 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java @@ -385,7 +385,7 @@ public class SMSService extends XWService { send( SMS_CMD.INVITE, bas.toByteArray(), phone ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -399,7 +399,7 @@ public class SMSService extends XWService { send( SMS_CMD.ACK, bas.toByteArray(), phone ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -414,7 +414,7 @@ public class SMSService extends XWService { send( SMS_CMD.DEATH, bas.toByteArray(), phone ); s_sentDied.add( gameID ); } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } } @@ -432,7 +432,7 @@ public class SMSService extends XWService { nSent = bytes.length; } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } return nSent; } @@ -533,7 +533,7 @@ public class SMSService extends XWService { break; } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } } @@ -614,7 +614,7 @@ public class SMSService extends XWService { success = true; } } catch ( java.io.IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } catch ( ArrayIndexOutOfBoundsException oob ) { // enum this older code doesn't know about; drop it DbgUtils.logw( TAG, "disAssemble: dropping message with too-new enum" ); @@ -679,7 +679,7 @@ public class SMSService extends XWService { } catch ( NullPointerException npe ) { Assert.fail(); // shouldn't be trying to do this!!! } catch ( Exception ee ) { - DbgUtils.logex( ee ); + DbgUtils.logex( TAG, ee ); } } } else { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java index af51dfdfa..fc5c1aa9e 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java @@ -119,7 +119,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { try { versionCode = pm.getPackageInfo( packageName, 0 ).versionCode; } catch ( PackageManager.NameNotFoundException nnfe ) { - DbgUtils.logex( nnfe ); + DbgUtils.logex( TAG, nnfe ); versionCode = 0; } @@ -143,7 +143,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { params.put( k_APP, appParams ); params.put( k_DEVID, XWPrefs.getDevID( context ) ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } @@ -158,7 +158,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { params.put( k_DICTS, dictParams ); params.put( k_DEVID, XWPrefs.getDevID( context ) ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } @@ -168,7 +168,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { try { params.put( k_XLATEINFO, xlationUpdate ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } @@ -182,7 +182,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { new UpdateQueryTask( context, params, fromUI, pm, packageName, dals ).execute(); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } } @@ -225,7 +225,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver { params.put( k_MD5SUM, sum ); params.put( k_INDEX, index ); } catch( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } return params; } @@ -365,11 +365,11 @@ public class UpdateCheckReceiver extends BroadcastReceiver { } } } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); DbgUtils.logw( TAG, "sent: \"%s\"", params.toString() ); DbgUtils.logw( TAG, "received: \"%s\"", jstr ); } catch ( PackageManager.NameNotFoundException nnfe ) { - DbgUtils.logex( nnfe ); + DbgUtils.logex( TAG, nnfe ); } if ( !gotOne && m_fromUI ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java index d5c883f8c..6a5fddf17 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java @@ -59,6 +59,7 @@ import java.util.List; import java.util.Random; public class Utils { + private static final String TAG = Utils.class.getSimpleName(); public static final int TURN_COLOR = 0x7F00FF00; private static final String DB_PATH = "XW_GAMES"; @@ -140,7 +141,7 @@ public class Utils { try { Toast.makeText( context, msg, Toast.LENGTH_SHORT).show(); } catch ( java.lang.RuntimeException re ) { - DbgUtils.logex( re ); + DbgUtils.logex( TAG, re ); } } @@ -431,7 +432,7 @@ public class Utils { .versionCode; s_appVersion = new Integer( version ); } catch ( Exception e ) { - DbgUtils.logex( e ); + DbgUtils.logex( TAG, e ); } } return null == s_appVersion? 0 : s_appVersion; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java index 795825f3e..03c2ea232 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/WiDirService.java @@ -317,7 +317,7 @@ public class WiDirService extends XWService { try { activity.unregisterReceiver( sReceiver ); } catch ( IllegalArgumentException iae ) { - DbgUtils.logex( iae ); + DbgUtils.logex( TAG, iae ); } DbgUtils.logd( TAG, "activityPaused() done" ); @@ -844,7 +844,7 @@ public class WiDirService extends XWService { } packet.put( KEY_MAP, array ); } catch ( JSONException ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } } } @@ -861,7 +861,7 @@ public class WiDirService extends XWService { sUserMap.put( mac, name ); } } catch ( JSONException ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } } updateListeners(); @@ -972,7 +972,7 @@ public class WiDirService extends XWService { try { sServerSock.close(); } catch ( IOException ioe ) { - DbgUtils.logex( ioe ); + DbgUtils.logex( TAG, ioe ); } sServerSock = null; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java index d3258dd76..7a5d577b8 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java @@ -36,7 +36,8 @@ import java.util.HashSet; import java.util.Random; public class CurGameInfo { - + private static final String TAG = CurGameInfo.class.getSimpleName(); + public static final int MAX_NUM_PLAYERS = 4; private static final String BOARD_SIZE = "BOARD_SIZE"; @@ -164,7 +165,7 @@ public class CurGameInfo { ; jsonData = obj.toString(); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } return jsonData; @@ -182,7 +183,7 @@ public class CurGameInfo { int tmp = obj.optInt( PHONIES, phoniesAction.ordinal() ); phoniesAction = XWPhoniesChoice.values()[tmp]; } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java index a4600fb01..430a67a3f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java @@ -426,7 +426,7 @@ public class GameSummary { } m_extras = asObj.toString(); } catch( org.json.JSONException ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } DbgUtils.logi( TAG, "putStringExtra(%s,%s) => %s", key, value, m_extras ); } @@ -442,7 +442,7 @@ public class GameSummary { result = null; } } catch( org.json.JSONException ex ) { - DbgUtils.logex( ex ); + DbgUtils.logex( TAG, ex ); } } DbgUtils.logi( TAG, "getStringExtra(%s) => %s", key, result ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java index 2c95a9f3b..c3fef0374 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java @@ -250,7 +250,7 @@ public class JNIThread extends Thread { join(); // Assert.assertFalse( isAlive() ); } catch ( java.lang.InterruptedException ie ) { - DbgUtils.logex( ie ); + DbgUtils.logex( TAG, ie ); } m_lock.unlock(); } @@ -715,7 +715,7 @@ public class JNIThread extends Thread { if ( m_stopped && ! JNICmd.CMD_NONE.equals(cmd) ) { DbgUtils.logw( TAG, "adding %s to stopped thread!!!", cmd.toString() ); - DbgUtils.printStack(); + DbgUtils.printStack( TAG ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java index 1deef4353..66eaaad96 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java @@ -148,7 +148,7 @@ public class JNIUtilsImpl implements JNIUtils { } digest = md.digest(); } catch ( java.security.NoSuchAlgorithmException nsae ) { - DbgUtils.logex( nsae ); + DbgUtils.logex( TAG, nsae ); } return Utils.digestToString( digest ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java index ffe75396b..b0c329c0a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java @@ -414,7 +414,7 @@ public class LocUtils { .put( k_LOCALE, locale ) .put( k_XLATEVERS, version ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } return result; @@ -464,7 +464,7 @@ public class LocUtils { s_xlationsBlessed = null; loadXlations( context ); } catch ( org.json.JSONException jse ) { - DbgUtils.logex( jse ); + DbgUtils.logex( TAG, jse ); } } return nAdded;