From: Patrik Lindström Date: Wed, 6 Nov 2013 14:15:52 +0000 (+0200) Subject: Make component predicate matches exact (#12913) X-Git-Tag: 7.2.0.beta1~169^2~5^2~5^2^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d70d6a2cac7271b2f49805611d77cd3f7eb431f1;p=vaadin-framework.git Make component predicate matches exact (#12913) Change-Id: Ia9a938977437a2188a6f5b207789058abce62965 --- diff --git a/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java b/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java index 5f5e0279ce..5123a57e5d 100644 --- a/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java +++ b/client/src/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java @@ -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 diff --git a/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java b/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java index 3390de86a4..96374e898a 100644 --- a/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java +++ b/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java @@ -241,6 +241,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { } } + return null; + } else { int index = Integer.valueOf(predicateString); return index < potentialMatches.size() ? potentialMatches