Skip to content

Commit fbc96f9

Browse files
committed
debug output
1 parent c6c23d3 commit fbc96f9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/co/bugjar/android/monitor/BugjarMonitor.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,16 @@
1414
*/
1515
package co.bugjar.android.monitor;
1616

17-
import java.io.BufferedReader;
1817
import java.io.File;
1918
import java.io.FileInputStream;
2019
import java.io.IOException;
2120
import java.io.InputStream;
22-
import java.io.InputStreamReader;
2321

2422
import org.apache.http.HttpResponse;
2523
import org.apache.http.client.methods.HttpPost;
2624
import org.apache.http.entity.InputStreamEntity;
2725
import org.apache.http.entity.StringEntity;
2826
import org.apache.http.impl.client.DefaultHttpClient;
29-
import org.apache.http.util.EntityUtils;
3027

3128
import android.content.Context;
3229
import android.content.pm.PackageInfo;
@@ -182,10 +179,14 @@ private void readResponse(HttpResponse response)
182179

183180
byte[] buffer = new byte[4096];
184181
int length = in.read(buffer);
185-
int currentVersion = Integer.parseInt(new String(buffer, 0, length, "UTF-8"));
186-
187-
if (currentVersion > VERSION) {
188-
Log.w(TAG, "a newer version of the Bugjar jar is available--download it at http://www.getbugjar.com");
182+
if (length > 0) {
183+
Log.w(TAG, "length is " + length);
184+
int currentVersion = Integer.parseInt(new String(buffer, 0,
185+
length, "UTF-8"));
186+
187+
if (currentVersion > VERSION) {
188+
Log.w(TAG, "a newer version of the Bugjar jar is available--download it at http://www.getbugjar.com");
189+
}
189190
}
190191
} catch (Exception e) {
191192
Log.e(TAG, e.getClass().getSimpleName()

0 commit comments

Comments
 (0)