Wednesday, May 25, 2011

Re: MVP pattern uncaught exception

Problem identified. Thanks for the help.

The activity was injected to the View after its construction while the
activity was requested by the class inicializator.
I am forced to pass the activity in the constructor of the view.

Is that a good practice?

On 24 Maig, 22:58, Alisson Prestes <javalis...@gmail.com> wrote:
> You must find the "caused by" on the stack trace:
>
> Caused by: java.lang.NullPointerException: null
>
>  at com.rourevell.booking.client.ui.ControlPanelViewImpl.<init>(ControlPanelVie wImpl.java:80)
>
>  at com.rourevell.booking.client.service.impl.ClientFactoryImpl.getControlPanel View(ClientFactoryImpl.java:37)
>
>  at com.rourevell.booking.client.activity.ControlPanelActivity.start(ControlPan elActivity.java:21)
> ...
>
> It seems that you tried to acess a variable without checking if it's null
> and got this error. Did you initialize the variable?
>
> Alisson Presteswww.google.com/profiles/javalisson
>
> On Tue, May 24, 2011 at 5:36 AM, Jordi Planadecursach
> <planad...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Hello guys,
>
> > I have an exception in the following code using the MVP pattern. I'm
> > just iniciaiting myself to the GWT world and I would need some help.
>
> > Call:
>
> > public class LoginActivity extends AbstractActivity implements
> > LoginView.Presenter {
> >        private ClientFactory clientFactory;
> >        [...]
> >        public void goToControlPanel() {
> >                clientFactory.getPlaceController().goTo(new
> > ControlPanelPlace("controlPanelPlace"));
> >        }
>
> > Stack trace:
>
> > 10:26:01.019 [ERROR] [rourevell_booking] Uncaught exception escaped
> > com.google.gwt.event.shared.UmbrellaException: One or more exceptions
> > caught, see full set in UmbrellaException#getCauses
> >    at
> > com.google.gwt.event.shared.EventBus.castFireEvent(EventBus.java:70)
> >    at
> > com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
> > 57)
> >    at
> > com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
> > 136)
> >    at
>
> > com.rourevell.booking.client.activity.LoginActivity.goToControlPanel(LoginA ctivity.java:
> > 29)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:61)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:1)
> >    at
>
> > com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceiv ed(RequestCallbackAdapter.java:
> > 232)
> >    at
> > com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
> > 287)
> >    at com.google.gwt.http.client.RequestBuilder
> > $1.onReadyStateChange(RequestBuilder.java:395)
> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >    at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> >    at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:
> > 25)
> >    at java.lang.reflect.Method.invoke(Method.java:597)
> >    at
> > com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> >    at
> > com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> >    at
>
> > com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.jav a:
> > 167)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingFo rReturn(BrowserChannelServer.java:
> > 326)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChann elServer.java:
> > 207)
> >    at
> > com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
> > 132)
> >    at
> > com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
> > 561)
> >    at
> > com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
> > 269)
> >    at
>
> > com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.j ava:
> > 91)
> >    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
> >    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
> >    at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
> >    at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:
> > 25)
> >    at java.lang.reflect.Method.invoke(Method.java:597)
> >    at
> > com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> >    at
> > com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> >    at
>
> > com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.jav a:
> > 167)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChanne lServer.java:
> > 281)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChan nelServer.java:
> > 531)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java :
> > 352)
> >    at java.lang.Thread.run(Thread.java:619)
> > Caused by: com.google.gwt.event.shared.UmbrellaException: One or more
> > exceptions caught, see full set in UmbrellaException#getCauses
> >    at
>
> > com.google.gwt.activity.shared.ActivityManager.onPlaceChange(ActivityManage r.java:
> > 173)
> >    at
>
> > com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java :
> > 70)
> >    at
>
> > com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java :
> > 1)
> >    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
> >    at
>
> > com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.ja va:
> > 193)
> >    at
>
> > com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus .java:
> > 88)
> >    at
> > com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
> > 52)
> >    at
> > com.google.gwt.event.shared.EventBus.castFireEvent(EventBus.java:68)
> >    at
> > com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
> > 57)
> >    at
> > com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
> > 136)
> >    at
>
> > com.rourevell.booking.client.activity.LoginActivity.goToControlPanel(LoginA ctivity.java:
> > 29)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:61)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:1)
> >    at
>
> > com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceiv ed(RequestCallbackAdapter.java:
> > 232)
> >    at
> > com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
> > 287)
> >    at com.google.gwt.http.client.RequestBuilder
> > $1.onReadyStateChange(RequestBuilder.java:395)
> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >    at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> >    at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:
> > 25)
> >    at java.lang.reflect.Method.invoke(Method.java:597)
> >    at
> > com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> >    at
> > com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> >    at
>
> > com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.jav a:
> > 167)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingFo rReturn(BrowserChannelServer.java:
> > 326)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChann elServer.java:
> > 207)
> >    at
> > com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
> > 132)
> >    at
> > com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
> > 561)
> >    at
> > com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
> > 269)
> >    at
>
> > com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.j ava:
> > 91)
> >    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
> >    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
> >    at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
> >    at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:
> > 25)
> >    at java.lang.reflect.Method.invoke(Method.java:597)
> >    at
> > com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> >    at
> > com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> >    at
>
> > com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.jav a:
> > 167)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChanne lServer.java:
> > 281)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChan nelServer.java:
> > 531)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java :
> > 352)
> >    at java.lang.Thread.run(Thread.java:619)
> > Caused by: java.lang.NullPointerException: null
> >    at
>
> > com.rourevell.booking.client.ui.ControlPanelViewImpl.<init>(ControlPanelVie wImpl.java:
> > 80)
> >    at
>
> > com.rourevell.booking.client.service.impl.ClientFactoryImpl.getControlPanel View(ClientFactoryImpl.java:
> > 37)
> >    at
>
> > com.rourevell.booking.client.activity.ControlPanelActivity.start(ControlPan elActivity.java:
> > 21)
> >    at
>
> > com.google.gwt.activity.shared.ActivityManager.onPlaceChange(ActivityManage r.java:
> > 158)
> >    at
>
> > com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java :
> > 70)
> >    at
>
> > com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java :
> > 1)
> >    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
> >    at
>
> > com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.ja va:
> > 193)
> >    at
>
> > com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus .java:
> > 88)
> >    at
> > com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
> > 52)
> >    at
> > com.google.gwt.event.shared.EventBus.castFireEvent(EventBus.java:68)
> >    at
> > com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
> > 57)
> >    at
> > com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
> > 136)
> >    at
>
> > com.rourevell.booking.client.activity.LoginActivity.goToControlPanel(LoginA ctivity.java:
> > 29)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:61)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:1)
> >    at
>
> > com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceiv ed(RequestCallbackAdapter.java:
> > 232)
> >    at
> > com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
> > 287)
> >    at
>
> ...
>
> llegiu-ne més »

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment