From users-return-3129-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Tue Jan 9 10:35:55 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id F2F59180718 for ; Tue, 9 Jan 2018 10:35:54 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E2E06160C2D; Tue, 9 Jan 2018 09:35:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0BE38160C13 for ; Tue, 9 Jan 2018 10:35:53 +0100 (CET) Received: (qmail 93584 invoked by uid 500); 9 Jan 2018 09:35:53 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 93574 invoked by uid 99); 9 Jan 2018 09:35:53 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jan 2018 09:35:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8CABCC41DD for ; Tue, 9 Jan 2018 09:35:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id aZ9Hs_Zsm1kr for ; Tue, 9 Jan 2018 09:35:50 +0000 (UTC) Received: from mail-qk0-f181.google.com (mail-qk0-f181.google.com [209.85.220.181]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 561545F39E for ; Tue, 9 Jan 2018 09:35:50 +0000 (UTC) Received: by mail-qk0-f181.google.com with SMTP id q1so686928qkb.9 for ; Tue, 09 Jan 2018 01:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=W1yjbo+mJq8A7dzNuetpy6Z1jv8RXPu5/cF9/yfBWIY=; b=vJYlfO7otWmOfo6xJ6z/xGQXfW5bmtD6k+BIRKy7dfcjJH203F8E7rDiwgRUZD3Ryg zvBLHAG1RX/H6QAJQzDDX0IA+mLPEqBoYZbpRBsD4dt84aAnwUuf2bSufv0MW4wuhLAb 7HdKlhQoZuSt8iSmTrAWPLjs7lAH4P6KhjdopxHJEGJSYuAlQOjaQFAqQWqRrNBgRxHO wToolBkcYb4LRgVJPNM259L45cJIf9I+gUC2OZYqCG52NBArcdLtgClb3gGQ/UpOwjlK FuiOh/ShKQzxDcbxBTETV+pb9/BQTg0UkRCKBD7Rt4qFpvSCB8iKXhJYnmxnUSIY9Kkb vUfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=W1yjbo+mJq8A7dzNuetpy6Z1jv8RXPu5/cF9/yfBWIY=; b=SEbFT01mODBu9AfejjKu3Xya5u+VwOXcBs/D7JZaW/SdYjKfajDwoq98jWKBWfAEZi Voes8cjjIkNC76MIsaleT3w3EvaYoPGj2WCvlpOIIbpjGHBjZ8oNbtheAL92KfbtK/Kh a9cKTTLUVAJz8PA4BJMAGZAXB9hFkgCxURPEU3g8y6I8rSENePFhurcFufYVlioCkJzO j4HaRCEtpi/10BPHgSFos+q2JAHjbO5m+oAOuRcwYIFgwge7OEIFunzTNvX9v2VQID7F 8TjsXKbMJBrWTdgG1FtN8/b0cFJdHC0AfWnJZPk+zwwf7Vcu5wfPihSMRQ8Jh3CZu2US qQaA== X-Gm-Message-State: AKwxyteaUpJBKtt5kD4iGfuB8PA+TmR9Ze/et48itDsklb6mnNKP6U8p ySIOhp/oJvnh/W68DreQm4TMXpssK7gqbeIeIamE5Q== X-Google-Smtp-Source: ACJfBosknosyrmnhrq6snFnLHaacFRmRORURbGcdqTvr/FrU170RtZzyxy3fPX19mb+xT1ontii3IJp9927xvAsmxPs= X-Received: by 10.55.124.70 with SMTP id x67mr2890405qkc.114.1515490549792; Tue, 09 Jan 2018 01:35:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.197.130 with HTTP; Tue, 9 Jan 2018 01:35:49 -0800 (PST) Received: by 10.12.197.130 with HTTP; Tue, 9 Jan 2018 01:35:49 -0800 (PST) In-Reply-To: References: From: Felix Dorner Date: Tue, 9 Jan 2018 10:35:49 +0100 Message-ID: Subject: Re: Catch clause difference To: users@groovy.apache.org Content-Type: multipart/alternative; boundary="94eb2c05bf62e18651056254a30e" --94eb2c05bf62e18651056254a30e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Or the same exception class but different classloader? Either of these two. On Jan 9, 2018 10:01, "Dinko Srko=C4=8D" wrote: > Is your `NoSuchElementException` in the catch clause by any chance > `java.util.NoSuchElementException`? > > cheers, > Dinko > > On 8 January 2018 at 16:18, Mohan Radhakrishnan > wrote: > > In the second case it is this. > > > > org.openqa.selenium.NoSuchElementException > > > > In the first case this seems to escape out. > > > > So I changed my first clause to this. > > > > }catch( NoSuchElementException nse ){ > > print "Catch clause " + nse > > }catch( Exception e ){ > > print "Catch clause " + e > > } > > > > It prints org.openqa.selenium.NoSuchElementException if I catch > 'Exception'. > > > > Does this have anything to do with the 'closure' shown in this trace ? > > > > at > > com.automation.pages.PageObjectLayer$_waitUntil_closure2.doCall( > PageObjectLayer.groovy:39) > > at org.openqa.selenium.support.ui.FluentWait.until( > FluentWait.java:208) > > at > > com.automation.pages.PageObjectLayer.waitUntil( > PageObjectLayer.groovy:39) > > at > > com.automation.page.test.WidgetTest.waitUntilNoSuchWidgetException > WithMessage(WidgetTest.groovy:54) > > > > Thanks. > > > > On 8 January 2018 at 19:28, Paul King wrote: > >> > >> What does printing out `nse` in both cases show? > >> > >> On Mon, Jan 8, 2018 at 11:02 PM, Mohan Radhakrishnan > >> wrote: > >>> > >>> Hello, > >>> > >>> These catch clauses are somehow different from each other. Why ? > >>> > >>> In the first case 'NoSuchElementException' is somehow escaping the > >>> 'catch' block. My test fails. > >>> > >>> But the second clause succeeds as expected. > >>> > >>> Clause 1 : > >>> > >>> catch( NoSuchElementException nse ){ > >>> > >>> throw new NoSuchWidgetException( " Element " + by.toString() + " > not > >>> found" + > >>> " after polling for [" + > >>> pollingInterval.longValue() + > >>> "] with timeout set to [" + > >>> timeOut.longValue() ); > >>> } > >>> > >>> > >>> Clause 2 : > >>> > >>> try{ > >>> WaitForWidget wait =3D > >>> new WaitForWidget(wd). > >>> > >>> pollingEvery(pollingInterval.longValue(),unit). > >>> withTimeout(timeOut.longValue(),unit). > >>> withMessage(supplierClosure) > >>> > >>> wait.until( { wd.findElement( by )} as Function ) > >>> }catch( nse ){ > >>> throw new NoSuchWidgetException( " Element " + by.toString() + " > not > >>> found" + > >>> " after polling for [" + > >>> pollingInterval.longValue() + > >>> "] with timeout set to [" + > >>> timeOut.longValue() ); > >>> } > >>> > >>> Thanks, > >>> Mohan > >> > >> > > > --94eb2c05bf62e18651056254a30e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Or the same exception class but=C2=A0 different classload= er? Either of these two.=C2=A0

On Jan 9, 2018 10:01, "Dinko Srko=C4=8D" <<= a href=3D"mailto:dinko.srkoc@gmail.com">dinko.srkoc@gmail.com> wrote= :
Is your `NoSuchEle= mentException` in the catch clause by any chance
`java.util.NoSuchElementException`?

cheers,
Dinko

On 8 January 2018 at 16:18, Mohan Radhakrishnan
<radhakrishnan.mohan@gm= ail.com> wrote:
> In the second case it is this.
>
> org.openqa.selenium.NoSuchElementException
>
> In the first case this seems to escape out.
>
> So I changed my first clause to this.
>
> }catch( NoSuchElementException nse ){
>=C2=A0 =C2=A0 =C2=A0print "Catch clause " + nse
> }catch( Exception e ){
>=C2=A0 =C2=A0 =C2=A0print "Catch clause " + e
> }
>
> It prints org.openqa.selenium.NoSuchElementException if I catch &= #39;Exception'.
>
> Does this have anything to do with the 'closure' shown in this= trace ?
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0at
> com.automation.pages.PageObjectLayer$_waitUntil_closure2.doC= all(PageObjectLayer.groovy:39)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0at org.openqa.selenium.support.ui.Fluen= tWait.until(FluentWait.java:208)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0at
> com.automation.pages.PageObjectLayer.waitUntil(PageObjectLay= er.groovy:39)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0at
> com.automation.page.test.WidgetTest.waitUntilNoSuchWidgetExc= eptionWithMessage(WidgetTest.groovy:54)
>
> Thanks.
>
> On 8 January 2018 at 19:28, Paul King <paulk@asert.com.au> wrote:
>>
>> What does printing out `nse` in both cases show?
>>
>> On Mon, Jan 8, 2018 at 11:02 PM, Mohan Radhakrishnan
>> <radhakrishnan= .mohan@gmail.com> wrote:
>>>
>>> Hello,
>>>
>>> These catch clauses are somehow different from each other. Why= =C2=A0 ?
>>>
>>> In the first case 'NoSuchElementException' is somehow = escaping the
>>> 'catch' block. My test fails.
>>>
>>> But the second clause succeeds as expected.
>>>
>>> Clause 1 :
>>>
>>> catch( NoSuchElementException nse ){
>>>
>>>=C2=A0 =C2=A0 =C2=A0throw new NoSuchWidgetException( " Ele= ment " + by.toString() + " not
>>> found" +
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "= ; after polling for [" +
>>> pollingInterval.longValue() +
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "= ;] with timeout set to [" +
>>> timeOut.longValue() );
>>> }
>>>
>>>
>>> Clause 2 :
>>>
>>> try{
>>>=C2=A0 =C2=A0 =C2=A0WaitForWidget<Widget> wait =3D
>>>=C2=A0 =C2=A0 =C2=A0new WaitForWidget<WebDriver>(wd).
>>>
>>> pollingEvery(pollingInterval.longValue(),unit).
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0withTimeout(timeOut.longValue(),unit).
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0withMessage(supplierClosure)
>>>
>>>=C2=A0 =C2=A0 =C2=A0wait.until( {=C2=A0 wd.findElement( by )} a= s Function )
>>> }catch(=C2=A0 nse ){
>>>=C2=A0 =C2=A0 =C2=A0throw new NoSuchWidgetException( " Ele= ment " + by.toString() + " not
>>> found" +
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "= ; after polling for [" +
>>> pollingInterval.longValue() +
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "= ;] with timeout set to [" +
>>> timeOut.longValue() );
>>> }
>>>
>>> Thanks,
>>> Mohan
>>
>>
>
--94eb2c05bf62e18651056254a30e--