Berolfingen / windowlicker

Automatically exported from code.google.com/p/windowlicker
GNU General Public License v3.0
0 stars 0 forks source link

IndexOutOfBoundsException thrown by NthComponentFinder when no matching components found #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Instantiate a driver using the NthComponentFinder as a selector
2. Ensure that no components satisfy the specified matchers
3. Observe failure with stack trace below:

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.RangeCheck(ArrayList.java:546)
    at java.util.ArrayList.get(ArrayList.java:321)
    at com.objogate.wl.swing.probe.NthComponentFinder.components(NthComponentFinder.java:21)
    at com.objogate.wl.swing.probe.RecursiveComponentFinder.probe(RecursiveComponentFinder.java:41)
    at com.objogate.wl.swing.probe.SingleComponentFinder.probe(SingleComponentFinder.java:31)
    at com.objogate.wl.swing.probe.ComponentManipulatorProbe.probe(ComponentManipulatorProbe.java:19)
    at com.objogate.wl.swing.internal.ProbeRunner.run(ProbeRunner.java:17)

Could be fixed with a check of parentOrOwnerFinder.components() for size before 
converting to a list for return in NthComponentFinder.components()

Original issue reported on code.google.com by t.denley on 16 Jun 2010 at 10:26

GoogleCodeExporter commented 8 years ago
Slight oversimplification in the steps to reproduce. Turns out that this 
failure occurs when searching for a component within the component matched by 
the NthComponentFinder, when the NthComponentFinder finds no matches.

Original comment by t.denley on 22 Jun 2010 at 9:38

GoogleCodeExporter commented 8 years ago
Test and fix checked in

Original comment by t.denley on 22 Jun 2010 at 11:16