From be3bd5941c778a3612308fab1c1466030f3fd473 Mon Sep 17 00:00:00 2001 From: Siva Velusamy Date: Thu, 9 Aug 2012 15:19:11 -0700 Subject: hv: Add more logging for when things go wrong. Change-Id: Idbb0a32507c19aadb11544342d73e1be7d1d4272 --- .../src/com/android/hierarchyviewerlib/device/DeviceBridge.java | 1 + .../src/com/android/hierarchyviewerlib/device/ViewNode.java | 3 +++ 2 files changed, 4 insertions(+) (limited to 'hierarchyviewer2/libs') diff --git a/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/DeviceBridge.java b/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/DeviceBridge.java index 07bb807..10308a3 100644 --- a/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/DeviceBridge.java +++ b/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/DeviceBridge.java @@ -468,6 +468,7 @@ public class DeviceBridge { } catch (Exception e) { Log.e(TAG, "Unable to load window data for window " + window.getTitle() + " on device " + window.getDevice()); + Log.e(TAG, e.getMessage()); } finally { if (connection != null) { connection.close(); diff --git a/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/ViewNode.java b/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/ViewNode.java index 76eaa10..4ab4fc6 100644 --- a/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/ViewNode.java +++ b/hierarchyviewer2/libs/hierarchyviewerlib/src/com/android/hierarchyviewerlib/device/ViewNode.java @@ -125,6 +125,9 @@ public class ViewNode { this.parent.children.add(this); } int delimIndex = data.indexOf('@'); + if (delimIndex < 0) { + throw new IllegalArgumentException("Invalid format for ViewNode, missing @: " + data); + } name = data.substring(0, delimIndex); data = data.substring(delimIndex + 1); delimIndex = data.indexOf(' '); -- cgit v1.1