mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
add logging
Keep some stuff added to debug problem with dict checksums on server.
This commit is contained in:
parent
cace99818d
commit
105e8e2623
3 changed files with 32 additions and 3 deletions
|
@ -326,7 +326,7 @@ public class DictLangCache {
|
|||
public static void inval( final Context context, String name,
|
||||
DictLoc loc, boolean added )
|
||||
{
|
||||
DBUtils.dictsRemoveInfo( context, name );
|
||||
DBUtils.dictsRemoveInfo( context, DictUtils.removeDictExtn( name ) );
|
||||
|
||||
if ( added ) {
|
||||
DictAndLoc dal = new DictAndLoc( name, loc );
|
||||
|
|
|
@ -275,8 +275,10 @@ public class NetUtils {
|
|||
}
|
||||
result = new String( bas.toByteArray() );
|
||||
} else {
|
||||
Log.w( TAG, "runConn: responseCode: %d for url: %s",
|
||||
responseCode, conn.getURL() );
|
||||
Log.w( TAG, "runConn: responseCode: %d/%s for url: %s",
|
||||
responseCode, conn.getResponseMessage(),
|
||||
conn.getURL() );
|
||||
logErrorStream( conn.getErrorStream() );
|
||||
}
|
||||
} catch ( java.net.ProtocolException pe ) {
|
||||
Log.ex( TAG, pe );
|
||||
|
@ -288,6 +290,24 @@ public class NetUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
private static void logErrorStream( InputStream is )
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
for ( ; ; ) {
|
||||
int length = is.read( buffer );
|
||||
if ( length == -1 ) {
|
||||
break;
|
||||
}
|
||||
baos.write( buffer, 0, length );
|
||||
}
|
||||
Log.e( TAG, baos.toString() );
|
||||
} catch (Exception ex) {
|
||||
Log.e( TAG, ex.getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
// This handles multiple params but only every gets passed one!
|
||||
private static String getPostDataString( Map<String, String> params )
|
||||
{
|
||||
|
|
|
@ -103,6 +103,15 @@ and_util_getMD5SumForDict( JNIUtilCtxt* jniutil, const XP_UCHAR* name,
|
|||
jstring result =
|
||||
(*env)->CallObjectMethod( env, jniutil->jjniutil, mid, jname, jbytes );
|
||||
deleteLocalRefs( env, jname, jbytes, DELETE_NO_REF );
|
||||
|
||||
#ifdef DEBUG
|
||||
if ( !!result ) {
|
||||
const char* chars = (*env)->GetStringUTFChars( env, result, NULL );
|
||||
XP_LOGF( "%s(%s, len=%d) => %s", __func__, name, len, chars );
|
||||
(*env)->ReleaseStringUTFChars( env, result, chars );
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue