这是我的方法。
@Override
public void onSuccess(PlotSetOutput result) {
String test = result.toString(); // this works
controller.getScolopaxGUI().getResultsPanel().setPlots(result);
controller.getScolopaxGUI().displayTab(1);
}
在我的setPlots方法中,我试图在GoogleMaps上显示结果。我设置了一个断点 在setPlots中,似乎代码在此之前失败了。 我也成功地获得了ResultPanel对象。因此,我对导致此NullPointerException的原因感到困惑。
06:47:38.791 [ERROR] [scolopax] Uncaught exception escaped
java.lang.NullPointerException: null
at edu.neu.scolopax.web.client.RetrieveSummariesAsynchCallback.onSuccess(RetrieveSummariesAsynchCallback.java:32)
at edu.neu.scolopax.web.client.RetrieveSummariesAsynchCallback.onSuccess(RetrieveSummariesAsynchCallback.java:1)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:232)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:258)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:412)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:680)
答案 0 :(得分:1)
下面
以下之一为null
controller
controller.getScolopaxGUI()
controller.getScolopaxGUI().getResultsPanel()
试试这个
if(controller != null && controller.getScolopaxGUI() != null &&
controller.getScolopaxGUI().getResultsPanel() != null)
controller.getScolopaxGUI().getResultsPanel().setPlots(result);