]> source.dussan.org Git - vaadin-framework.git/commitdiff
Make component predicate matches exact (#12913)
authorPatrik Lindström <patrik@vaadin.com>
Wed, 6 Nov 2013 14:15:52 +0000 (16:15 +0200)
committerPatrik Lindström <patrik@vaadin.com>
Wed, 6 Nov 2013 14:16:42 +0000 (16:16 +0200)
Change-Id: Ia9a938977437a2188a6f5b207789058abce62965

client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java

index 5f5e0279ce13ccc73bc7ec81aa0bc6c104eb89d4..5123a57e5dd4ba1c5817b9ec045c0d76c825899d 100644 (file)
@@ -499,7 +499,16 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
                 String widgetClassName = split[0];
                 String indexString = split[1].substring(0,
                         split[1].length() - 1);
-                int widgetPosition = Integer.parseInt(indexString);
+
+                int widgetPosition;
+                try {
+                    widgetPosition = Integer.parseInt(indexString);
+                } catch (NumberFormatException e) {
+                    // We've probably been fed a new-style Vaadin locator with a
+                    // string-form predicate, that doesn't match anything in the
+                    // search space.
+                    return null;
+                }
 
                 // AbsolutePanel in GridLayout has been removed -> skip it
                 if (w instanceof VGridLayout
index 3390de86a4cd2f5018e928a15de36524cf712604..96374e898a7ce405551275ffe2cb3cb6ae611ef6 100644 (file)
@@ -241,6 +241,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
                     }
                 }
 
+                return null;
+
             } else {
                 int index = Integer.valueOf(predicateString);
                 return index < potentialMatches.size() ? potentialMatches