guys I am working with GWT and when I click a button which creates a class I receive an UmbrellaException. Here is the problematic code:
private void addPerson(){
final HashSet<Date> dates = new HashSet();
HorizontalPanel horizontalPanel = new HorizontalPanel();
HorizontalPanel buttonsPanel = new HorizontalPanel();
final TextItem textBox = new TextItem();
textBox.setTitle("Name");
DynamicForm form = new DynamicForm();
final ListBox listBox = new ListBox();
listBox.addItem("DiplomaManager");
listBox.addItem("Reviewer");
//listBox.setVisibleItemCount(2);
DatePicker datePicker = new DatePicker();
datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
public void onValueChange(ValueChangeEvent<Date> event) {
dates.add(event.getValue());
SC.say(event.getValue().toString() + " Added to unavailable dates ");
}
});
Button oneMoreButton = new Button("One More");
oneMoreButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
//SC.say(listBox.getValue(0));
getPerson(dates,textBox,listBox);
RootPanel.get("mainDiv").clear();
addPerson();
}
});
Button back = new Button("Back");
back.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
RootPanel.get("mainDiv").clear();
onModuleLoad();
}
});
Button next = new Button("Next");
next.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
RootPanel.get("mainDiv").clear();
addDiploma();
}
});
form.setFields(textBox);
horizontalPanel.add(form);
horizontalPanel.add(datePicker);
horizontalPanel.add(listBox);
buttonsPanel.add(oneMoreButton);
buttonsPanel.add(back);
buttonsPanel.add(next);
RootPanel.get("mainDiv").add(horizontalPanel);
RootPanel.get("mainDiv").add(buttonsPanel);
}
The exception appears when I click the oneMoreButton
.
Here is the getPerson source:
private void getPerson(HashSet<Date> set, TextItem box, ListBox list){
if(list.getSelectedIndex()==0){
DiplomaLeader leader = new DiplomaLeader(box.getValueAsString(), set);
DiplomaLeaders.add(leader);
}else if(list.getSelectedIndex()==1){
Reviewer reviewer = new Reviewer(box.getValueAsString(), set);
Reviewers.add(reviewer);
}else {
SC.say("Error accured :) Maybe nothing was entered");
}
}
The diplomaLeader and the Reviewer class are the same but with different names for easier treatment. This is their code:
package org.elsys.salvation.client;
import java.util.Date;
import java.util.HashSet;
public class Reviewer {
private String name;
private HashSet<Date> unavailableDates;
public Reviewer(String name, HashSet<Date> unavailableDates) {
super();
this.name = name;
this.unavailableDates = unavailableDates;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public HashSet<Date> getUnavailableDates() {
return unavailableDates;
}
public void setUnavailableDates(HashSet<Date> unavailableDates) {
this.unavailableDates.addAll(unavailableDates) ;
}
}
Everything is autogenerated. I am not verry good with collections so maybe the problem is comming from the constructor.
The Error log:
16:10:12.218 [ERROR] [Salvation] 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.HandlerManager.fireEvent(HandlerManager.java:129)
at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
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.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: null
at org.elsys.salvation.client.Salvation.getPerson(Salvation.java:190)
at org.elsys.salvation.client.Salvation.access$2(Salvation.java:184)
at org.elsys.salvation.client.Salvation$5.onClick(Salvation.java:145)
at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:96)
at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
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.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)