From c4d24dc2cda88599d7dec7b266a28ed635aaa8f3 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 30 Oct 2013 15:03:00 +0000 Subject: [PATCH] 2012-10-29 Miguel de Dios * src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java: fixed when the data return to call for get events is bad format, before it was fails all app, now it tries to get correct event for each line. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8982 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- extras/pandroid_event_viewer/ChangeLog | 7 +++ .../PandroidEventviewerActivity.java | 47 ++++++++++++++----- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/extras/pandroid_event_viewer/ChangeLog b/extras/pandroid_event_viewer/ChangeLog index efa151e3ed..3e7465b785 100644 --- a/extras/pandroid_event_viewer/ChangeLog +++ b/extras/pandroid_event_viewer/ChangeLog @@ -1,3 +1,10 @@ +2012-10-29 Miguel de Dios + + * src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java: + fixed when the data return to call for get events is bad format, + before it was fails all app, now it tries to get correct event for + each line. + 2012-10-23 Junichi Satoh * res/values-ja/strings.xml: Traslated string "empty". diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java index 7d16548b39..cd98e55100 100644 --- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java +++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java @@ -99,7 +99,8 @@ public class PandroidEventviewerActivity extends TabActivity implements && (url.length() == 0)) { startActivity(new Intent(this, Options.class)); this.showOptionsFirstTime = true; - } else { + } + else { this.loadInProgress = true; this.showOptionsFirstTime = false; @@ -272,7 +273,12 @@ public class PandroidEventviewerActivity extends TabActivity implements String[] items = lines[i].split(";"); EventListItem event = new EventListItem(); + boolean extract = true; try { + if (items.length < 14) { + extract = false; + continue; + } //Get id event if (items[0].length() == 0) { event.id_event = 0; @@ -368,14 +374,28 @@ public class PandroidEventviewerActivity extends TabActivity implements */ - //Get agent name - event.agent_name = items[22]; - event.group_name = items[23]; - event.group_icon = items[24]; - event.description_event = items[25]; - event.description_image = items[26]; - event.criticity_name = items[28]; - event.criticity_image = items[27]; + event.agent_name = ""; + event.group_name = ""; + event.group_icon = ""; + event.description_event = ""; + event.description_image = ""; + event.criticity_name = ""; + event.criticity_image = ""; + + if (items.length >= 23) + event.agent_name = items[22]; + if (items.length >= 24) + event.group_name = items[23]; + if (items.length >= 25) + event.group_icon = items[24]; + if (items.length >= 26) + event.description_event = items[25]; + if (items.length >= 27) + event.description_image = items[26]; + if (items.length >= 28) + event.criticity_name = items[28]; + if (items.length >= 27) + event.criticity_image = items[27]; event.opened = false; } @@ -384,7 +404,8 @@ public class PandroidEventviewerActivity extends TabActivity implements R.string.unknown_event_str); launchProblemParsingNotification(); } - this.eventList.add(event); + if (extract) + this.eventList.add(event); } } @@ -583,7 +604,8 @@ public class PandroidEventviewerActivity extends TabActivity implements Log.i(TAG + " GetEventsAsyncTask", "doInBackground"); try { getEvents(); - } catch (IOException e) { + } + catch (IOException e) { connectionProblem = true; } return null; @@ -602,7 +624,8 @@ public class PandroidEventviewerActivity extends TabActivity implements getNewListEvents = false; i.putExtra("load_more", 0); - } else { + } + else { i.putExtra("load_more", 1); }