From f51266471cb6c3e824435ae6e416012a62266d52 Mon Sep 17 00:00:00 2001
From: Anthony Newnam <anthony.newnam@garmin.com>
Date: Mon, 22 Mar 2010 17:29:06 -0500
Subject: Don't allow invalid Uris to be added as observers.

If a null segment is added, it will cause problems traversing the list
at a later point.

Change-Id: I5aa97b969cac7231e214168af7d3263b1c16f0a0
---
 core/java/android/content/ContentService.java | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'core/java/android/content/ContentService.java')

diff --git a/core/java/android/content/ContentService.java b/core/java/android/content/ContentService.java
index 974a667..89e504e 100644
--- a/core/java/android/content/ContentService.java
+++ b/core/java/android/content/ContentService.java
@@ -496,6 +496,9 @@ public final class ContentService extends IContentService.Stub {
 
             // Look to see if the proper child already exists
             String segment = getUriSegment(uri, index);
+            if (segment == null) {
+                throw new IllegalArgumentException("Invalid Uri (" + uri + ") used for observer");
+            }
             int N = mChildren.size();
             for (int i = 0; i < N; i++) {
                 ObserverNode node = mChildren.get(i);
-- 
cgit v1.1