variable not passed in generated JS code in finally block

11 views
Skip to first unread message

vishal...@gmail.com

unread,
Sep 2, 2011, 2:52:05 PM9/2/11
to Google Web Toolkit
I'm using GWT 2.4.0-rc1 and have hit a possible JS bug (not 100% sure
as I don't have a simple reproducer) and thought it's worth
sharing.

I wrote some Antlr based validation of user input in GWT client and
everything worked fine in debug mode but the compiled JS code never
called the logic that should be executed when there's no error (err =
false in code below)

So the issue is that if I've code like below

boolean err = false
try {
// do something that might fail due to exception
} catch (Throwable e) {
err = true;
// do something to process the error
} finally {
someLogicThatDependyOnErrValue(abc,def,err)
}

Then the generated js code assumes that err will always be false in
finally and pass false as param, i.e it creates

someLogicThatDependyOnErrValue(abc,def,false)

Note that instead or 'err', false is passed

My fix is to improve my needlessly complicated code (must have been
late night)

try {
// do something that might fail due to exception

// We should reach this point only if there's no error
someLogicThatDependyOnErrValue(abc,def,true)
} catch (Throwable e) {
// do something to process the error
}

vishal...@gmail.com

unread,
Sep 2, 2011, 3:01:29 PM9/2/11
to Google Web Toolkit
Small typo correction. my fix was
someLogicThatDependyOnErrValue(abc,def,FALSE) and not
someLogicThatDependyOnErrValue(abc,def,TRUE)

On Sep 2, 11:52 am, "vishalvish...@gmail.com"

Thomas Broyer

unread,
Sep 2, 2011, 3:11:37 PM9/2/11
to google-we...@googlegroups.com

vishal...@gmail.com

unread,
Sep 2, 2011, 3:30:00 PM9/2/11
to Google Web Toolkit
Thanks tom. It looks like the same issue. I've starred the issue. Hope
it's fixed soon.

--Vishal

On Sep 2, 12:11 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> Looks a bit
> likehttp://code.google.com/p/google-web-toolkit/issues/detail?id=6375
Reply all
Reply to author
Forward
0 new messages