|
14 | 14 | */ |
15 | 15 | package co.bugjar.android.monitor; |
16 | 16 |
|
17 | | -import java.io.BufferedReader; |
18 | 17 | import java.io.File; |
19 | 18 | import java.io.FileInputStream; |
20 | 19 | import java.io.IOException; |
21 | 20 | import java.io.InputStream; |
22 | | -import java.io.InputStreamReader; |
23 | 21 |
|
24 | 22 | import org.apache.http.HttpResponse; |
25 | 23 | import org.apache.http.client.methods.HttpPost; |
26 | 24 | import org.apache.http.entity.InputStreamEntity; |
27 | 25 | import org.apache.http.entity.StringEntity; |
28 | 26 | import org.apache.http.impl.client.DefaultHttpClient; |
29 | | -import org.apache.http.util.EntityUtils; |
30 | 27 |
|
31 | 28 | import android.content.Context; |
32 | 29 | import android.content.pm.PackageInfo; |
@@ -182,10 +179,14 @@ private void readResponse(HttpResponse response) |
182 | 179 |
|
183 | 180 | byte[] buffer = new byte[4096]; |
184 | 181 | 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 | + } |
189 | 190 | } |
190 | 191 | } catch (Exception e) { |
191 | 192 | Log.e(TAG, e.getClass().getSimpleName() |
|
0 commit comments