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

  • SEARCH
  • Home
  • 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 7700575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:44:26+00:00 2026-05-31T22:44:26+00:00

My program crashes due to a null pointer exception. Snip of Stack Trace: java.lang.NullPointerException

  • 0

My program crashes due to a null pointer exception.

Snip of Stack Trace:

java.lang.NullPointerException
at com.my.GRTRecTimeSortComparator.compare(SourceFile:15)

That’s well and good. But my problem is that line 15 is the class declaration:

15 public class GRTRecTimeSortComparator   implements Comparator<GRTRecord> {
16    @Override
17    public int compare(GRTRecord rec1, GRTRecord rec2) {
18      
19      int returnVal=rec1.getRecordCalendar().compareTo(rec2.getRecordCalendar());
20        return returnVal;
21    }
22}

It’s calling out the Compare function, but I don’t see an issue with that either. Every record has a Unique Calendar assigned to it as well.

Any ideas? What have I done wrong here?

Edit: in response to queries:

No, there is nothing strange about the class itself, other than the fact I wrote it.

I AM using Proguard. Maybe the Obfuscation is replacing things incorrectly?

I’m writing up tests for the records right now. They SHOULDN’T be null, nor should the Calendars; I use them immediately before, and get good results.

Maybe I’m just passing the ArrayList incorrectly.

EDIT 2:

Logging lines inserted into the class never get run.
No matter what I add or do to the class, the null pointer always resolves to the class declaration line.

Removed Proguard Obfuscation, and still no dice.

I’m REALLY frustrated.

Edit 3:

For Future Users:

Proguard ruins your stack trace. That was the cause of the Above. Remove proguard if you run into issues.

The CAUSE was actually a corrupted record in the dataset.

  • 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-05-31T22:44:27+00:00Added an answer on May 31, 2026 at 10:44 pm

    I strongly suspect that the debug information is just out of sync. Put logging into your compare method. I would log (in order):

    • rec1
    • rec2
    • rec1.getRecordCalendar()
    • rec2.getRecordCalendar()

    If this isn’t the problem, is there anything “odd” about the class in any other way? For example:

    • Are you using Hibernate or something similar which may be creating proxies for you?
    • Is this an inner class?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes whenever I write a program in Linux and it crashes due to a
Due to seeing random memory crashes in my iOS program, I decided to use
I have a python program that uses a custom-built DLL. This DLL crashes due
I have a C++ program that crashed due to a bug. It would not
Sometimes my c++ program crashes in debug mode, and what I got is a
The following C++ program crashes on my Windows XP machine with a message Abnormal
I'm experiencing a strange issue where my Visual Studio 2005 C++ program crashes the
I am working on Linux with the GCC compiler. When my C++ program crashes
I'm trying to get this simple program to work on windows, but it crashes:
So I installed my app on my ipad and it crashes due to a

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.