pass TAG to printStack() and logex

So they'll show up when using logcat filtering
This commit is contained in:
Eric House 2016-12-09 07:34:51 -08:00
parent 25c2fd16ef
commit a1e4d4da0e
32 changed files with 122 additions and 120 deletions

View file

@ -1085,7 +1085,7 @@ public class BTService extends XWService {
try { try {
m_listener.join( 100 ); m_listener.join( 100 );
} catch ( InterruptedException ie ) { } catch ( InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
} }
m_listener = null; m_listener = null;
} }
@ -1096,7 +1096,7 @@ public class BTService extends XWService {
try { try {
m_sender.join( 100 ); m_sender.join( 100 );
} catch ( InterruptedException ie ) { } catch ( InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
} }
m_sender = null; m_sender = null;
} }
@ -1179,7 +1179,7 @@ public class BTService extends XWService {
private void logIOE( IOException ioe ) private void logIOE( IOException ioe )
{ {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
++s_errCount; ++s_errCount;
// if ( 0 == s_errCount % 10 ) { // if ( 0 == s_errCount % 10 ) {
postEvent( MultiEvent.BT_ERR_COUNT, s_errCount ); postEvent( MultiEvent.BT_ERR_COUNT, s_errCount );
@ -1222,7 +1222,7 @@ public class BTService extends XWService {
try { try {
socket.close(); socket.close();
} catch( IOException ioe ) { } catch( IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
} ); } );

View file

@ -79,11 +79,11 @@ public class BiDiSockWrap {
mIface.connectStateChanged( BiDiSockWrap.this, true ); mIface.connectStateChanged( BiDiSockWrap.this, true );
break; break;
} catch ( java.net.UnknownHostException uhe ) { } catch ( java.net.UnknownHostException uhe ) {
DbgUtils.logex( uhe ); DbgUtils.logex( TAG, uhe );
} catch ( IOException ioe ) { } catch ( IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} catch ( InterruptedException ie ) { } catch ( InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
} }
waitMillis = Math.min( waitMillis * 2, 1000 * 60 ); waitMillis = Math.min( waitMillis * 2, 1000 * 60 );
} }
@ -102,7 +102,7 @@ public class BiDiSockWrap {
try { try {
send( packet.getBytes( "UTF-8" ) ); send( packet.getBytes( "UTF-8" ) );
} catch ( java.io.UnsupportedEncodingException uee ) { } catch ( java.io.UnsupportedEncodingException uee ) {
DbgUtils.logex( uee ); DbgUtils.logex( TAG, uee );
} }
} }
@ -138,7 +138,7 @@ public class BiDiSockWrap {
try { try {
mSocket.close(); mSocket.close();
} catch ( IOException ioe ) { } catch ( IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
mIface.connectStateChanged( this, false ); mIface.connectStateChanged( this, false );
mQueue.add( new byte[0] ); mQueue.add( new byte[0] );
@ -170,7 +170,7 @@ public class BiDiSockWrap {
mIface.onWriteSuccess( BiDiSockWrap.this ); mIface.onWriteSuccess( BiDiSockWrap.this );
} }
} catch ( IOException ioe ) { } catch ( IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
closeSocket(); closeSocket();
} catch ( InterruptedException ie ) { } catch ( InterruptedException ie ) {
Assert.fail(); Assert.fail();
@ -195,7 +195,7 @@ public class BiDiSockWrap {
mIface.gotPacket( BiDiSockWrap.this, packet ); mIface.gotPacket( BiDiSockWrap.this, packet );
} }
} catch( IOException ioe ) { } catch( IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
closeSocket(); closeSocket();
} }
DbgUtils.logd( TAG, "read thread exiting" ); DbgUtils.logd( TAG, "read thread exiting" );

View file

@ -2287,12 +2287,12 @@ public class BoardDelegate extends DelegateBase
try { try {
m_forResultWait.acquire(); m_forResultWait.acquire();
} catch ( java.lang.InterruptedException ie ) { } catch ( java.lang.InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
if ( DlgID.NONE != m_blockingDlgID ) { if ( DlgID.NONE != m_blockingDlgID ) {
try { try {
dismissDialog( m_blockingDlgID ); dismissDialog( m_blockingDlgID );
} catch ( java.lang.IllegalArgumentException iae ) { } 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, RelayService.inviteRemote( m_activity, destDevID,
null, nli ); null, nli );
} catch (NumberFormatException nfi) { } catch (NumberFormatException nfi) {
DbgUtils.logex( nfi ); DbgUtils.logex( TAG, nfi );
} }
break; break;
case WIFIDIRECT: case WIFIDIRECT:
@ -2550,7 +2550,7 @@ public class BoardDelegate extends DelegateBase
m_handler.post( runnable ); m_handler.post( runnable );
} else { } else {
DbgUtils.logw( TAG, "post(): dropping b/c handler null" ); DbgUtils.logw( TAG, "post(): dropping b/c handler null" );
DbgUtils.printStack(); DbgUtils.printStack( TAG );
} }
return canPost; return canPost;
} }
@ -2795,7 +2795,7 @@ public class BoardDelegate extends DelegateBase
{ {
if ( null == m_jniThread ) { if ( null == m_jniThread ) {
DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() ); DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() );
DbgUtils.printStack(); DbgUtils.printStack( TAG );
} else { } else {
m_jniThread.handle( cmd, args ); m_jniThread.handle( cmd, args );
} }

View file

@ -414,7 +414,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
{ {
if ( null == m_jniThread ) { if ( null == m_jniThread ) {
DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() ); DbgUtils.logw( TAG, "not calling handle(%s)", cmd.toString() );
DbgUtils.printStack(); DbgUtils.printStack( TAG );
} else { } else {
m_jniThread.handle( cmd, args ); m_jniThread.handle( cmd, args );
} }

View file

@ -95,7 +95,7 @@ public class CommsTransport implements TransportProcs,
closeSocket(); closeSocket();
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} catch ( UnresolvedAddressException uae ) { } catch ( UnresolvedAddressException uae ) {
DbgUtils.logw( TAG, "bad address: name: %s; port: %s; exception: %s", DbgUtils.logw( TAG, "bad address: name: %s; port: %s; exception: %s",
m_useHost, m_relayAddr.ip_relay_port, m_useHost, m_relayAddr.ip_relay_port,
@ -133,7 +133,7 @@ public class CommsTransport implements TransportProcs,
m_relayAddr.ip_relay_port ); m_relayAddr.ip_relay_port );
m_socketChannel.connect( isa ); m_socketChannel.connect( isa );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
failed = true; failed = true;
break outer_loop; break outer_loop;
} }
@ -157,7 +157,7 @@ public class CommsTransport implements TransportProcs,
DbgUtils.logw( TAG, "exiting: %s", ioe.toString() ); DbgUtils.logw( TAG, "exiting: %s", ioe.toString() );
DbgUtils.logw( TAG, ioe.toString() ); DbgUtils.logw( TAG, ioe.toString() );
} catch ( java.nio.channels.NoConnectionPendingException ncp ) { } catch ( java.nio.channels.NoConnectionPendingException ncp ) {
DbgUtils.logex( ncp ); DbgUtils.logex( TAG, ncp );
closeSocket(); closeSocket();
break; break;
} }
@ -205,7 +205,7 @@ public class CommsTransport implements TransportProcs,
break outer_loop; break outer_loop;
} catch ( java.nio.channels. } catch ( java.nio.channels.
NoConnectionPendingException ncp ) { NoConnectionPendingException ncp ) {
DbgUtils.logex( ncp ); DbgUtils.logex( TAG, ncp );
break outer_loop; break outer_loop;
} }
} }
@ -342,7 +342,7 @@ public class CommsTransport implements TransportProcs,
try { try {
m_thread.join(100); // wait up to 1/10 second m_thread.join(100); // wait up to 1/10 second
} catch ( java.lang.InterruptedException ie ) { } catch ( java.lang.InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
} }
m_thread = null; m_thread = null;
} }

View file

@ -387,7 +387,7 @@ public class ConnStatusHandler {
// } catch ( java.lang.ClassNotFoundException cnfe ) { // } catch ( java.lang.ClassNotFoundException cnfe ) {
// DbgUtils.logf( "loadState: %s", cnfe.toString() ); // DbgUtils.logf( "loadState: %s", cnfe.toString() );
} catch ( Exception ex ) { } 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, XWPrefs.setPrefsString( context, R.string.key_connstat_data,
as64 ); as64 );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
s_needsSave = false; s_needsSave = false;
} }

View file

@ -983,7 +983,7 @@ public class DBUtils {
long result = db.replaceOrThrow( DBHelper.TABLE_NAME_OBITS, long result = db.replaceOrThrow( DBHelper.TABLE_NAME_OBITS,
"", values ); "", values );
} catch ( Exception ex ) { } catch ( Exception ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
} }
db.close(); db.close();
} }
@ -1916,13 +1916,13 @@ public class DBUtils {
channelSrc.transferTo( 0, channelSrc.size(), channelDest ); channelSrc.transferTo( 0, channelSrc.size(), channelDest );
success = true; success = true;
} catch( java.io.IOException ioe ) { } catch( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} finally { } finally {
try { try {
channelSrc.close(); channelSrc.close();
channelDest.close(); channelDest.close();
} catch( java.io.IOException ioe ) { } catch( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
return success; return success;
@ -2280,7 +2280,7 @@ public class DBUtils {
try { try {
updateStmt.execute(); updateStmt.execute();
} catch ( Exception ex ) { } catch ( Exception ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
Assert.fail(); Assert.fail();
} }
} }
@ -2535,7 +2535,7 @@ public class DBUtils {
invalGroupsCache(); invalGroupsCache();
} }
} catch( java.io.FileNotFoundException fnfe ) { } catch( java.io.FileNotFoundException fnfe ) {
DbgUtils.logex( fnfe ); DbgUtils.logex( TAG, fnfe );
} }
} }

View file

@ -121,10 +121,10 @@ public class DbgUtils {
showf( context, LocUtils.getString( context, formatid ), args ); showf( context, LocUtils.getString( context, formatid ), args );
} // showf } // showf
public static void logex( Exception exception ) public static void logex( String tag, Exception exception )
{ {
logw( TAG, "Exception: %s", exception.toString() ); logw( TAG, "Exception: %s", exception.toString() );
printStack( exception.getStackTrace() ); printStack( tag, exception.getStackTrace() );
} }
public static void assertOnUIThread() public static void assertOnUIThread()
@ -132,20 +132,20 @@ public class DbgUtils {
Assert.assertTrue( Looper.getMainLooper().equals(Looper.myLooper()) ); 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 ) { if ( s_doLog && null != trace ) {
// 1: skip printStack etc. // 1: skip printStack etc.
for ( int ii = 1; ii < trace.length; ++ii ) { 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 ) { if ( s_doLog ) {
printStack( Thread.currentThread().getStackTrace() ); printStack( tag, Thread.currentThread().getStackTrace() );
} }
} }

View file

@ -195,7 +195,7 @@ public class DictUtils {
} catch ( java.io.FileNotFoundException fnf ) { } catch ( java.io.FileNotFoundException fnf ) {
// DbgUtils.logex( fnf ); // DbgUtils.logex( fnf );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
@ -264,7 +264,7 @@ public class DictUtils {
success = DBUtils.copyFileStream( fos, fis ); success = DBUtils.copyFileStream( fos, fis );
} catch ( java.io.FileNotFoundException fnfe ) { } catch ( java.io.FileNotFoundException fnfe ) {
DbgUtils.logex( fnfe ); DbgUtils.logex( TAG, fnfe );
} }
return success; return success;
} // copyDict } // copyDict
@ -365,7 +365,7 @@ public class DictUtils {
} catch ( java.io.FileNotFoundException fnf ) { } catch ( java.io.FileNotFoundException fnf ) {
// DbgUtils.logex( fnf ); // DbgUtils.logex( fnf );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
@ -478,9 +478,9 @@ public class DictUtils {
invalDictList(); invalDictList();
} }
} catch ( java.io.FileNotFoundException fnf ) { } catch ( java.io.FileNotFoundException fnf ) {
DbgUtils.logex( fnf ); DbgUtils.logex( TAG, fnf );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
tmpFile.delete(); tmpFile.delete();
} }
} }
@ -565,7 +565,7 @@ public class DictUtils {
AssetManager am = context.getAssets(); AssetManager am = context.getAssets();
return am.list(""); return am.list("");
} catch( java.io.IOException ioe ) { } catch( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
return new String[0]; return new String[0];
} }
} }

View file

@ -1243,7 +1243,7 @@ public class DictsDelegate extends ListDelegateBase
} }
} catch ( JSONException ex ) { } catch ( JSONException ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
theOne = null; theOne = null;
} }
} }
@ -1423,7 +1423,7 @@ public class DictsDelegate extends ListDelegateBase
success = true; success = true;
} catch ( JSONException ex ) { } catch ( JSONException ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
} }
} }

View file

@ -138,11 +138,11 @@ public class DwnldDelegate extends ListDelegateBase {
} }
is.close(); is.close();
} catch ( java.net.URISyntaxException use ) { } catch ( java.net.URISyntaxException use ) {
DbgUtils.logex( use ); DbgUtils.logex( TAG, use );
} catch ( java.net.MalformedURLException mue ) { } catch ( java.net.MalformedURLException mue ) {
DbgUtils.logex( mue ); DbgUtils.logex( TAG, mue );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
return null; return null;
} }
@ -218,9 +218,9 @@ public class DwnldDelegate extends ListDelegateBase {
fos.close(); fos.close();
success = !cancelled; success = !cancelled;
} catch ( java.io.FileNotFoundException fnf ) { } catch ( java.io.FileNotFoundException fnf ) {
DbgUtils.logex( fnf ); DbgUtils.logex( TAG, fnf );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
if ( !success ) { if ( !success ) {

View file

@ -96,7 +96,7 @@ public class GCMIntentService extends GCMBaseIntentService {
RelayService.processGameMsgs( context, connname, strs64 ); RelayService.processGameMsgs( context, connname, strs64 );
} }
} catch (org.json.JSONException jse ) { } 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." ); DbgUtils.logw( TAG, "Device can't do GCM." );
} catch ( Exception whatever ) { } catch ( Exception whatever ) {
// funky devices could do anything // funky devices could do anything
DbgUtils.logex( whatever ); DbgUtils.logex( TAG, whatever );
} }
} }
} }

View file

@ -58,7 +58,7 @@ public class GameLock {
if ( DEBUG_LOCKS ) { if ( DEBUG_LOCKS ) {
DbgUtils.logi( TAG, "GameLock(rowid:%d,isForWrite:%b)=>" DbgUtils.logi( TAG, "GameLock(rowid:%d,isForWrite:%b)=>"
+ "this: %H", rowid, isForWrite, this ); + "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 ); DbgUtils.logi( TAG, "lock() %H failed; sleeping", this );
if ( 0 == sleptTime || sleptTime + SLEEP_TIME >= ASSERT_TIME ) { if ( 0 == sleptTime || sleptTime + SLEEP_TIME >= ASSERT_TIME ) {
DbgUtils.logi( TAG, "lock %H seeking stack:", curOwner ); 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.logi( TAG, "lock %H seeking stack:", this );
DbgUtils.printStack(); DbgUtils.printStack( TAG );
} }
} }
try { try {
Thread.sleep( SLEEP_TIME ); // milliseconds Thread.sleep( SLEEP_TIME ); // milliseconds
sleptTime += SLEEP_TIME; sleptTime += SLEEP_TIME;
} catch( InterruptedException ie ) { } catch( InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
break; break;
} }

View file

@ -225,7 +225,7 @@ public class GameUtils {
try { try {
lock = new GameLock( rowid, false ).lock( maxMillis ); lock = new GameLock( rowid, false ).lock( maxMillis );
} catch ( GameLock.GameLockedException gle ) { } catch ( GameLock.GameLockedException gle ) {
DbgUtils.logex( gle ); DbgUtils.logex( TAG, gle );
} }
} }
@ -1254,7 +1254,7 @@ public class GameUtils {
fos.close(); fos.close();
result = file; result = file;
} catch ( Exception ex ) { } catch ( Exception ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
} }
} }
return result; return result;

View file

@ -2423,7 +2423,7 @@ public class GamesListDelegate extends ListDelegateBase
launchGame( rowid ); launchGame( rowid );
} }
} catch ( GameLock.GameLockedException gle ) { } catch ( GameLock.GameLockedException gle ) {
DbgUtils.logex( gle ); DbgUtils.logex( TAG, gle );
finish(); finish();
} }
} }

View file

@ -289,7 +289,7 @@ public class LookupAlert extends LinearLayout
try { try {
context.startActivity( intent ); context.startActivity( intent );
} catch ( android.content.ActivityNotFoundException anfe ) { } catch ( android.content.ActivityNotFoundException anfe ) {
DbgUtils.logex( anfe ); DbgUtils.logex( TAG, anfe );
} }
} }
} // lookupWord } // lookupWord

View file

@ -178,7 +178,7 @@ public class NagTurnReceiver extends BroadcastReceiver {
al.add(value); al.add(value);
} }
} catch ( Exception ex ) { } catch ( Exception ex ) {
DbgUtils.logex(ex); DbgUtils.logex( TAG, ex );
} }
} }
if ( 0 < al.size() ) { if ( 0 < al.size() ) {

View file

@ -350,7 +350,7 @@ public class NetLaunchInfo {
result = obj.toString(); result = obj.toString();
} catch ( org.json.JSONException jse ) { } catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
// DbgUtils.logf( "makeLaunchJSON() => %s", result ); // DbgUtils.logf( "makeLaunchJSON() => %s", result );
return result; return result;
@ -441,7 +441,7 @@ public class NetLaunchInfo {
} }
} catch ( JSONException jse ) { } catch ( JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
removeUnsupported( supported ); removeUnsupported( supported );

View file

@ -72,9 +72,9 @@ public class NetUtils {
socket.setSoTimeout( timeoutMillis ); socket.setSoTimeout( timeoutMillis );
} catch ( java.net.UnknownHostException uhe ) { } catch ( java.net.UnknownHostException uhe ) {
DbgUtils.logex( uhe ); DbgUtils.logex( TAG, uhe );
} catch( java.io.IOException ioe ) { } catch( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
return socket; return socket;
} }
@ -129,7 +129,7 @@ public class NetUtils {
DBUtils.clearObits( m_context, m_obits ); DBUtils.clearObits( m_context, m_obits );
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
} }
@ -199,7 +199,7 @@ public class NetUtils {
} }
} catch( Exception npe ) { } catch( Exception npe ) {
DbgUtils.logex( npe ); DbgUtils.logex( TAG, npe );
} }
return msgs; return msgs;
} // queryRelay } // queryRelay
@ -225,10 +225,10 @@ public class NetUtils {
result = (HttpURLConnection)new URL(url).openConnection(); result = (HttpURLConnection)new URL(url).openConnection();
} catch ( java.net.MalformedURLException mue ) { } catch ( java.net.MalformedURLException mue ) {
Assert.assertNull( result ); Assert.assertNull( result );
DbgUtils.logex( mue ); DbgUtils.logex( TAG, mue );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
Assert.assertNull( result ); Assert.assertNull( result );
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
return result; return result;
} }
@ -276,9 +276,9 @@ public class NetUtils {
DbgUtils.logw( TAG, "runConn: responseCode: %d", responseCode ); DbgUtils.logw( TAG, "runConn: responseCode: %d", responseCode );
} }
} catch ( java.net.ProtocolException pe ) { } catch ( java.net.ProtocolException pe ) {
DbgUtils.logex( pe ); DbgUtils.logex( TAG, pe );
} catch( java.io.IOException ioe ) { } catch( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
@ -299,7 +299,7 @@ public class NetUtils {
} }
result = TextUtils.join( "&", pairs ); result = TextUtils.join( "&", pairs );
} catch ( java.io.UnsupportedEncodingException uee ) { } catch ( java.io.UnsupportedEncodingException uee ) {
DbgUtils.logex( uee ); DbgUtils.logex( TAG, uee );
} }
return result; return result;

View file

@ -110,7 +110,7 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
} }
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
DbgUtils.logi( TAG, "doInBackground() returning" ); DbgUtils.logi( TAG, "doInBackground() returning" );
return names.toArray( new String[names.size()] ); return names.toArray( new String[names.size()] );

View file

@ -534,7 +534,7 @@ public class RelayInviteDelegate extends InviteDelegate {
} }
} catch ( org.json.JSONException je ) { } catch ( org.json.JSONException je ) {
DbgUtils.logex( je ); DbgUtils.logex( TAG, je );
} }
stopProgress(); stopProgress();

View file

@ -535,7 +535,7 @@ public class RelayService extends XWService
try { try {
Thread.sleep( 20 ); Thread.sleep( 20 );
} catch( java.lang.InterruptedException ie ) { } 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" DbgUtils.logd( TAG, "connectSocket(%s:%d): m_UDPSocket"
+ " now %H", host, port, m_UDPSocket ); + " now %H", host, port, m_UDPSocket );
} catch( java.net.SocketException se ) { } catch( java.net.SocketException se ) {
DbgUtils.logex( se ); DbgUtils.logex( TAG, se );
Assert.fail(); Assert.fail();
} catch( java.net.UnknownHostException uhe ) { } catch( java.net.UnknownHostException uhe ) {
DbgUtils.logex( uhe ); DbgUtils.logex( TAG, uhe );
} }
} else { } else {
Assert.assertTrue( m_UDPSocket.isConnected() ); Assert.assertTrue( m_UDPSocket.isConnected() );
@ -637,7 +637,7 @@ public class RelayService extends XWService
resetExitTimer(); resetExitTimer();
ConnStatusHandler.showSuccessOut(); ConnStatusHandler.showSuccessOut();
} catch ( java.net.SocketException se ) { } catch ( java.net.SocketException se ) {
DbgUtils.logex( se ); DbgUtils.logex( TAG, se );
DbgUtils.logi( TAG, "Restarting threads to force" DbgUtils.logi( TAG, "Restarting threads to force"
+ " new socket" ); + " new socket" );
m_handler.post( new Runnable() { m_handler.post( new Runnable() {
@ -646,7 +646,7 @@ public class RelayService extends XWService
} }
} ); } );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} catch ( NullPointerException npe ) { } catch ( NullPointerException npe ) {
DbgUtils.logw( TAG, "network problem; dropping packet" ); DbgUtils.logw( TAG, "network problem; dropping packet" );
} }
@ -671,7 +671,7 @@ public class RelayService extends XWService
m_UDPWriteThread.join(); m_UDPWriteThread.join();
DbgUtils.logd( TAG, "SUCCESSFULLY joined m_UDPWriteThread" ); DbgUtils.logd( TAG, "SUCCESSFULLY joined m_UDPWriteThread" );
} catch( java.lang.InterruptedException ie ) { } catch( java.lang.InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
} }
m_UDPWriteThread = null; m_UDPWriteThread = null;
m_queue.clear(); m_queue.clear();
@ -681,7 +681,7 @@ public class RelayService extends XWService
try { try {
m_UDPReadThread.join(); m_UDPReadThread.join();
} catch( java.lang.InterruptedException ie ) { } catch( java.lang.InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
} }
m_UDPReadThread = null; m_UDPReadThread = null;
m_UDPSocket = null; m_UDPSocket = null;
@ -783,7 +783,7 @@ public class RelayService extends XWService
} }
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
if ( resetBackoff ) { if ( resetBackoff ) {
@ -860,7 +860,7 @@ public class RelayService extends XWService
postPacket( bas, XWRelayReg.XWPDEV_REG ); postPacket( bas, XWRelayReg.XWPDEV_REG );
s_regStartTime = now; s_regStartTime = now;
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
} }
@ -884,7 +884,7 @@ public class RelayService extends XWService
postPacket( bas, reg ); postPacket( bas, reg );
} }
} catch ( java.io.IOException ioe ) { } 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 ); out.write( msg, 0, msg.length );
postPacket( bas, XWRelayReg.XWPDEV_MSG ); postPacket( bas, XWRelayReg.XWPDEV_MSG );
} catch ( java.io.IOException ioe ) { } 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 ); out.write( msg, 0, msg.length );
postPacket( bas, XWRelayReg.XWPDEV_MSGNOCONN ); postPacket( bas, XWRelayReg.XWPDEV_MSGNOCONN );
} catch ( java.io.IOException ioe ) { } 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 ); out.write( nliData, 0, nliData.length );
postPacket( bas, XWRelayReg.XWPDEV_INVITE ); postPacket( bas, XWRelayReg.XWPDEV_INVITE );
} catch ( java.io.IOException ioe ) { } 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 ); un2vli( header.m_packetID, out );
postPacket( bas, XWRelayReg.XWPDEV_ACK ); postPacket( bas, XWRelayReg.XWPDEV_ACK );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
} }
@ -1145,7 +1145,7 @@ public class RelayService extends XWService
socket.close(); socket.close();
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
return null; return null;
} // doInBackground } // doInBackground
@ -1467,7 +1467,7 @@ public class RelayService extends XWService
out.writeByte( m_cmd.ordinal() ); out.writeByte( m_cmd.ordinal() );
m_header = bas.toByteArray(); m_header = bas.toByteArray();
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }

View file

@ -48,7 +48,7 @@ public class SMSReceiver extends BroadcastReceiver {
byte[] body = sms.getUserData(); byte[] body = sms.getUserData();
SMSService.handleFrom( context, body, phone ); SMSService.handleFrom( context, body, phone );
} catch ( NullPointerException npe ) { } catch ( NullPointerException npe ) {
DbgUtils.logex( npe ); DbgUtils.logex( TAG, npe );
} }
} }
} }

View file

@ -385,7 +385,7 @@ public class SMSService extends XWService {
send( SMS_CMD.INVITE, bas.toByteArray(), phone ); send( SMS_CMD.INVITE, bas.toByteArray(), phone );
} catch ( java.io.IOException ioe ) { } 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 ); send( SMS_CMD.ACK, bas.toByteArray(), phone );
} catch ( java.io.IOException ioe ) { } 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 ); send( SMS_CMD.DEATH, bas.toByteArray(), phone );
s_sentDied.add( gameID ); s_sentDied.add( gameID );
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
} }
@ -432,7 +432,7 @@ public class SMSService extends XWService {
nSent = bytes.length; nSent = bytes.length;
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
return nSent; return nSent;
} }
@ -533,7 +533,7 @@ public class SMSService extends XWService {
break; break;
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
} }
@ -614,7 +614,7 @@ public class SMSService extends XWService {
success = true; success = true;
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} catch ( ArrayIndexOutOfBoundsException oob ) { } catch ( ArrayIndexOutOfBoundsException oob ) {
// enum this older code doesn't know about; drop it // enum this older code doesn't know about; drop it
DbgUtils.logw( TAG, "disAssemble: dropping message with too-new enum" ); DbgUtils.logw( TAG, "disAssemble: dropping message with too-new enum" );
@ -679,7 +679,7 @@ public class SMSService extends XWService {
} catch ( NullPointerException npe ) { } catch ( NullPointerException npe ) {
Assert.fail(); // shouldn't be trying to do this!!! Assert.fail(); // shouldn't be trying to do this!!!
} catch ( Exception ee ) { } catch ( Exception ee ) {
DbgUtils.logex( ee ); DbgUtils.logex( TAG, ee );
} }
} }
} else { } else {

View file

@ -119,7 +119,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
try { try {
versionCode = pm.getPackageInfo( packageName, 0 ).versionCode; versionCode = pm.getPackageInfo( packageName, 0 ).versionCode;
} catch ( PackageManager.NameNotFoundException nnfe ) { } catch ( PackageManager.NameNotFoundException nnfe ) {
DbgUtils.logex( nnfe ); DbgUtils.logex( TAG, nnfe );
versionCode = 0; versionCode = 0;
} }
@ -143,7 +143,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
params.put( k_APP, appParams ); params.put( k_APP, appParams );
params.put( k_DEVID, XWPrefs.getDevID( context ) ); params.put( k_DEVID, XWPrefs.getDevID( context ) );
} catch ( org.json.JSONException jse ) { } 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_DICTS, dictParams );
params.put( k_DEVID, XWPrefs.getDevID( context ) ); params.put( k_DEVID, XWPrefs.getDevID( context ) );
} catch ( org.json.JSONException jse ) { } catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
} }
@ -168,7 +168,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
try { try {
params.put( k_XLATEINFO, xlationUpdate ); params.put( k_XLATEINFO, xlationUpdate );
} catch ( org.json.JSONException jse ) { } 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, new UpdateQueryTask( context, params, fromUI, pm,
packageName, dals ).execute(); packageName, dals ).execute();
} catch ( org.json.JSONException jse ) { } 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_MD5SUM, sum );
params.put( k_INDEX, index ); params.put( k_INDEX, index );
} catch( org.json.JSONException jse ) { } catch( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
return params; return params;
} }
@ -365,11 +365,11 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
} }
} }
} catch ( org.json.JSONException jse ) { } catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
DbgUtils.logw( TAG, "sent: \"%s\"", params.toString() ); DbgUtils.logw( TAG, "sent: \"%s\"", params.toString() );
DbgUtils.logw( TAG, "received: \"%s\"", jstr ); DbgUtils.logw( TAG, "received: \"%s\"", jstr );
} catch ( PackageManager.NameNotFoundException nnfe ) { } catch ( PackageManager.NameNotFoundException nnfe ) {
DbgUtils.logex( nnfe ); DbgUtils.logex( TAG, nnfe );
} }
if ( !gotOne && m_fromUI ) { if ( !gotOne && m_fromUI ) {

View file

@ -59,6 +59,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
public class Utils { public class Utils {
private static final String TAG = Utils.class.getSimpleName();
public static final int TURN_COLOR = 0x7F00FF00; public static final int TURN_COLOR = 0x7F00FF00;
private static final String DB_PATH = "XW_GAMES"; private static final String DB_PATH = "XW_GAMES";
@ -140,7 +141,7 @@ public class Utils {
try { try {
Toast.makeText( context, msg, Toast.LENGTH_SHORT).show(); Toast.makeText( context, msg, Toast.LENGTH_SHORT).show();
} catch ( java.lang.RuntimeException re ) { } catch ( java.lang.RuntimeException re ) {
DbgUtils.logex( re ); DbgUtils.logex( TAG, re );
} }
} }
@ -431,7 +432,7 @@ public class Utils {
.versionCode; .versionCode;
s_appVersion = new Integer( version ); s_appVersion = new Integer( version );
} catch ( Exception e ) { } catch ( Exception e ) {
DbgUtils.logex( e ); DbgUtils.logex( TAG, e );
} }
} }
return null == s_appVersion? 0 : s_appVersion; return null == s_appVersion? 0 : s_appVersion;

View file

@ -317,7 +317,7 @@ public class WiDirService extends XWService {
try { try {
activity.unregisterReceiver( sReceiver ); activity.unregisterReceiver( sReceiver );
} catch ( IllegalArgumentException iae ) { } catch ( IllegalArgumentException iae ) {
DbgUtils.logex( iae ); DbgUtils.logex( TAG, iae );
} }
DbgUtils.logd( TAG, "activityPaused() done" ); DbgUtils.logd( TAG, "activityPaused() done" );
@ -844,7 +844,7 @@ public class WiDirService extends XWService {
} }
packet.put( KEY_MAP, array ); packet.put( KEY_MAP, array );
} catch ( JSONException ex ) { } catch ( JSONException ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
} }
} }
} }
@ -861,7 +861,7 @@ public class WiDirService extends XWService {
sUserMap.put( mac, name ); sUserMap.put( mac, name );
} }
} catch ( JSONException ex ) { } catch ( JSONException ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
} }
} }
updateListeners(); updateListeners();
@ -972,7 +972,7 @@ public class WiDirService extends XWService {
try { try {
sServerSock.close(); sServerSock.close();
} catch ( IOException ioe ) { } catch ( IOException ioe ) {
DbgUtils.logex( ioe ); DbgUtils.logex( TAG, ioe );
} }
sServerSock = null; sServerSock = null;
} }

View file

@ -36,7 +36,8 @@ import java.util.HashSet;
import java.util.Random; import java.util.Random;
public class CurGameInfo { public class CurGameInfo {
private static final String TAG = CurGameInfo.class.getSimpleName();
public static final int MAX_NUM_PLAYERS = 4; public static final int MAX_NUM_PLAYERS = 4;
private static final String BOARD_SIZE = "BOARD_SIZE"; private static final String BOARD_SIZE = "BOARD_SIZE";
@ -164,7 +165,7 @@ public class CurGameInfo {
; ;
jsonData = obj.toString(); jsonData = obj.toString();
} catch ( org.json.JSONException jse ) { } catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
return jsonData; return jsonData;
@ -182,7 +183,7 @@ public class CurGameInfo {
int tmp = obj.optInt( PHONIES, phoniesAction.ordinal() ); int tmp = obj.optInt( PHONIES, phoniesAction.ordinal() );
phoniesAction = XWPhoniesChoice.values()[tmp]; phoniesAction = XWPhoniesChoice.values()[tmp];
} catch ( org.json.JSONException jse ) { } catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
} }
} }

View file

@ -426,7 +426,7 @@ public class GameSummary {
} }
m_extras = asObj.toString(); m_extras = asObj.toString();
} catch( org.json.JSONException ex ) { } catch( org.json.JSONException ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
} }
DbgUtils.logi( TAG, "putStringExtra(%s,%s) => %s", key, value, m_extras ); DbgUtils.logi( TAG, "putStringExtra(%s,%s) => %s", key, value, m_extras );
} }
@ -442,7 +442,7 @@ public class GameSummary {
result = null; result = null;
} }
} catch( org.json.JSONException ex ) { } catch( org.json.JSONException ex ) {
DbgUtils.logex( ex ); DbgUtils.logex( TAG, ex );
} }
} }
DbgUtils.logi( TAG, "getStringExtra(%s) => %s", key, result ); DbgUtils.logi( TAG, "getStringExtra(%s) => %s", key, result );

View file

@ -250,7 +250,7 @@ public class JNIThread extends Thread {
join(); join();
// Assert.assertFalse( isAlive() ); // Assert.assertFalse( isAlive() );
} catch ( java.lang.InterruptedException ie ) { } catch ( java.lang.InterruptedException ie ) {
DbgUtils.logex( ie ); DbgUtils.logex( TAG, ie );
} }
m_lock.unlock(); m_lock.unlock();
} }
@ -715,7 +715,7 @@ public class JNIThread extends Thread {
if ( m_stopped && ! JNICmd.CMD_NONE.equals(cmd) ) { if ( m_stopped && ! JNICmd.CMD_NONE.equals(cmd) ) {
DbgUtils.logw( TAG, "adding %s to stopped thread!!!", DbgUtils.logw( TAG, "adding %s to stopped thread!!!",
cmd.toString() ); cmd.toString() );
DbgUtils.printStack(); DbgUtils.printStack( TAG );
} }
} }

View file

@ -148,7 +148,7 @@ public class JNIUtilsImpl implements JNIUtils {
} }
digest = md.digest(); digest = md.digest();
} catch ( java.security.NoSuchAlgorithmException nsae ) { } catch ( java.security.NoSuchAlgorithmException nsae ) {
DbgUtils.logex( nsae ); DbgUtils.logex( TAG, nsae );
} }
return Utils.digestToString( digest ); return Utils.digestToString( digest );
} }

View file

@ -414,7 +414,7 @@ public class LocUtils {
.put( k_LOCALE, locale ) .put( k_LOCALE, locale )
.put( k_XLATEVERS, version ); .put( k_XLATEVERS, version );
} catch ( org.json.JSONException jse ) { } catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
} }
return result; return result;
@ -464,7 +464,7 @@ public class LocUtils {
s_xlationsBlessed = null; s_xlationsBlessed = null;
loadXlations( context ); loadXlations( context );
} catch ( org.json.JSONException jse ) { } catch ( org.json.JSONException jse ) {
DbgUtils.logex( jse ); DbgUtils.logex( TAG, jse );
} }
} }
return nAdded; return nAdded;