Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7942929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:07:24+00:00 2026-06-04T00:07:24+00:00

I have null pointer exception in my GWT project when I call this method:

  • 0

I have null pointer exception in my GWT project when I call this method:

public void getPerson(ArrayList<Date> set, TextItem box, ListBox listBox) {
    if (listBox.getSelectedIndex() == 0) {
        Person person = new Person(box.getValueAsString(), set);
        Leaders.add(person);
    } else if (listBox.getSelectedIndex() == 1) {
        Person person = new Person(box.getValueAsString(), set);
        Reviewers.add(person);
    } else if (listBox.getSelectedIndex() == 2) {
        Person person = new Person(box.getValueAsString(), set);
        Leaders.add(person);
        Reviewers.add(person);
    }
}

It is part of class with the following definition:

public class FunctionalityManager {

private Date startDate;
private Date endDate;
private HashSet<Person> Leaders;
private HashSet<Person> Reviewers;
private ArrayList<SoftwareWork> SoftwareWorks;
private ArrayList<DiplomaWork> HardwareWorks;
private ArrayList<DiplomaWork> NetWorks;

public FunctionalityManager() {
    super();
    startDate = new Date();
    endDate = new Date();
    HashSet<Person> Leaders = new HashSet<Person>();
    HashSet<Person> Reviewers = new HashSet<Person>();
    ArrayList<SoftwareWork> SoftwareWorks = new ArrayList<SoftwareWork>();
    ArrayList<DiplomaWork> HardwareWorks = new ArrayList<DiplomaWork>();
    ArrayList<DiplomaWork> NetWorks = new ArrayList<DiplomaWork>();
}

…and some getters and setters. In the main class where is my onModuleLoad() method here is how i create a FunctionalityManager :

public class Salvation implements EntryPoint {

private FunctionalityManager FM = new FunctionalityManager();

and here is where I call getPerson method:

Button oneMoreButton = new Button("One More");
    oneMoreButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            FM.getPerson(dates, textBox, listBox);
            RootPanel.get("mainDiv").clear();
            addPerson();
        }
    });

    Button next = new Button("Next");
    next.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            FM.getPerson(dates, textBox, listBox);
            RootPanel.get("mainDiv").clear();
            addDiploma();

        }
    });

Here is and the exception if it will help:

16:53:11.406 [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.GeneratedMethodAccessor38.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.FunctionalityManager.getPerson(FunctionalityManager.java:101)
    at org.elsys.salvation.client.Salvation$5.onClick(Salvation.java:149)
    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.GeneratedMethodAccessor38.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)

How can it be fixed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:07:25+00:00Added an answer on June 4, 2026 at 12:07 am

    You’re not creating the global variables properly. Change the following lines…

    public FunctionalityManager() {
        super();
        startDate = new Date();
        endDate = new Date();
        Leaders = new HashSet<Person>(); // Changed
        Reviewers = new HashSet<Person>(); // Changed
        SoftwareWorks = new ArrayList<SoftwareWork>(); // Changed
        HardwareWorks = new ArrayList<DiplomaWork>(); // Changed
        NetWorks = new ArrayList<DiplomaWork>(); // Changed
    }
    

    You were creating local variables called Leaders, Reviewers, etc instead of initialising the global variables.

    Basically you were calling this..

    HashSet<Person> Leaders = new HashSet<Person>();
    

    Instead of just calling this…

    Leaders = new HashSet<Person>();
    

    So the global variables weren’t actually being set – you were just creating new local variables with the same name, which no longer exist after the end of the FunctionalityManager() constructor method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code is causing a null pointer exception. I have no idea why: private
I have this piece of code which is throwing a Null Pointer exception at
my app crashes with a null pointer exception on the code below. i have
I have the following code: public void someMethod() { Set<Foo> fooSet = bar.getFoos(); for(Foo
I have a class file which when i compile shows me Null pointer exception
So I have a null pointer exception when run. I am supposed to create
I'm dealing with a null pointer exception for which I have a stack trace.
Possible Duplicate: Why do I get a null pointer exception from TabWidget? I have
I have a strange problem regarding null pointer exception. I'm posting the problematic code
I am getting Null Pointer Exception for ImageView imag = (ImageView) findViewById(R.id.image). I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.