NPE check was added in method  onShow( final TabPanel.ShowEvent e )

It was detected that in some use cases (for example when a new TabPanel was added to the original TabPanel) the method onShow( final TabPanel.ShowEvent e ) throws an NPE.
The fix basically adds the same tra/catch that already existed for the fist handler.



+1... just because there was some duff code elsewhere doesn't mean we
should repeat it!

It's just masking the symptoms not finding (and fixing the cause)

Sent on the move
On 26 Jun 2014 17:58, "Petr Široký" <notifications@github.com> wrote:

> In
> uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/client/common/MultiPageEditorView.java:
>
> > @@ -65,9 +65,13 @@ public void onShow( final TabPanel.ShownEvent e ) {
> >              addShowHandler( new TabPanel.ShowEvent.Handler() {
> >                  @Override
> >                  public void onShow( final TabPanel.ShowEvent e ) {
> > -                    final Page.PageView widget = ( (Page.PageView) ( (LayoutPanel) e.getTarget().getTabPane().getWidget( 0 ) ).getWidget( 0 ) );
> > -                    scheduleResize( widget );
> > -                    widget.onFocus();
> > +                    try {
> > +                        final Page.PageView widget = ( (Page.PageView) ( (LayoutPanel) e.getTarget().getTabPane().getWidget( 0 ) ).getWidget( 0 ) );
> > +                        scheduleResize( widget );
> > +                        widget.onFocus();
> > +                    } catch ( final Exception ex ) {
> > +
> > +                    }
> >                  }
>
> This seems like a really bad practice, swallowing the exception. I don't
> really know what's going on in this particular case, but if there are
> objective reasons to swallow the exception, please add a comment that
> explains them, so people reading the code won't be tempted to "fix" it.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/uberfire/uberfire/pull/63/files#r14252277>.
>