Search:

Type: Posts; User: andreas90

Search: Search took 0.08 seconds.

  1. Replies
    14
    Views
    1,789

    [SOLVED] Re: Getting a null pointer exception.

    Why you need to check both conditions?

    if (this.sender.length() > 0 & this.receiver.length() >0)

    If the first is false then the whole if will be false, thus there is no need to check the second...
  2. Replies
    14
    Views
    1,789

    [SOLVED] Re: Getting a null pointer exception.

    If I were you, I would first check for null and then length() > 0, to avoid a NPE.
    And also I would use the logical && instead of the bitwise & operator. They seem to work the same but they are...
  3. Replies
    14
    Views
    1,789

    [SOLVED] Re: Getting a null pointer exception.

    If the updated isValid() method is the one from post#3, I think it will still throw a NPE, unless you gave the reciever a non null value. I told you that in your case a null sender is the same with a...
  4. Replies
    14
    Views
    1,789

    [SOLVED] Re: Getting a null pointer exception.

    Hello Ouzi!
    When you get an NPE you should print the variables in the line that the exception tells you to find which of them is null, and then you can find out why it is null.
    Here the problem is...
Results 1 to 4 of 4