Skip to content

Commit

Permalink
fix read of null values, better exception explanation, new relic upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
anod committed Mar 1, 2015
1 parent 3443f5c commit 83dcdea
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 18 deletions.
1 change: 1 addition & 0 deletions newrelic.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.newrelic.application_token=AA47c4b684f2af988fdf3a13518738d7eaa8a4976f
4 changes: 2 additions & 2 deletions src/main/assets/crashlytics-build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#
#Do NOT modify, delete, or commit to source control!
#
#Sat Feb 28 09:25:53 IST 2015
#Sun Mar 01 15:38:42 IST 2015
version_name=0.0
package_name=com.anod.appwatcher
build_id=25d8fff2-7087-43b6-847c-b9301489dc73
build_id=aec386e9-58ba-43b8-90e1-7a8782dbf5b9
version_code=0
app_name=App Watcher
40 changes: 25 additions & 15 deletions src/main/java/com/anod/appwatcher/backup/AppListReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,45 @@ public AppInfo readAppInfo(JsonReader reader) throws IOException {
reader.beginObject();
while (reader.hasNext()) {
String name = reader.nextName();
final boolean isNull = reader.peek() == JsonToken.NULL;
boolean skipped = false;
if (name.equals("id")) {
appId = reader.nextString();
appId = (isNull) ? null : reader.nextString();
} else if (name.equals("packageName")) {
pname = reader.nextString();
pname = (isNull) ? null : reader.nextString();
} else if (name.equals("title") && reader.peek() != JsonToken.NULL) {
title = reader.nextString();
title = (isNull) ? "" : reader.nextString();
} else if (name.equals("creator")) {
creator = reader.nextString();
creator = (isNull) ? "" : reader.nextString();
} else if (name.equals("uploadDate")) {
uploadDate = reader.nextString();
uploadDate = (isNull) ? "" : reader.nextString();
} else if (name.equals("versionName")) {
versionName = reader.nextString();
versionName = (isNull) ? "" : reader.nextString();
} else if (name.equals("versionCode")) {
versionNumber = reader.nextInt();
versionNumber = (isNull) ? 0 : reader.nextInt();
} else if (name.equals("status")) {
status = reader.nextInt();
status = (isNull) ? 0 : reader.nextInt();
} else if (name.equals("detailsUrl")) {
detailsUrl = reader.nextString();
detailsUrl = (isNull) ? "" : reader.nextString();
} else if (name.equals("icon")) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
reader.beginArray();
while(reader.hasNext()) {
baos.write(reader.nextInt());
if (isNull) {
icon = null;
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
reader.beginArray();
while (reader.hasNext()) {
baos.write(reader.nextInt());
}
reader.endArray();
icon = BitmapUtils.unFlattenBitmap(baos.toByteArray());
}
reader.endArray();
icon = BitmapUtils.unFlattenBitmap(baos.toByteArray());
} else {
skipped = true;
reader.skipValue();
}
if (isNull && !skipped) {
reader.nextNull();
}
}
reader.endObject();
AppInfo info = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ public void startSync() {
DocType response = null;
try {
response = future.get();
} catch (InterruptedException | ExecutionException e) {
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause == null) {
AppLog.ex(e);
onErrorResponse(new VolleyError("Response exception: " + e.getMessage(), e));
} else {
AppLog.ex(cause);
onErrorResponse(new VolleyError("Response exception: " + cause.getMessage(), cause));
}
} catch (InterruptedException e) {
AppLog.ex(e);
onErrorResponse(new VolleyError("Response exception: "+e.getMessage(), e));
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/res/values/com_crashlytics_export_strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<!--
This file is automatically generated by Crashlytics to uniquely
identify individual builds of your Android application.
Do NOT modify, delete, or commit to source control!
-->
<string name="com.crashlytics.android.build_id" translatable="false">3f777f2b-48cb-4afa-a6c1-6338a3b0b4ca</string>
</resources>

0 comments on commit 83dcdea

Please sign in to comment.