Note that there are some explanatory texts on larger screens.

plurals
  1. POClass Declaration causes Null Pointer Exception
    primarykey
    data
    text
    <p>My program crashes due to a null pointer exception.</p> <p>Snip of Stack Trace:</p> <pre><code>java.lang.NullPointerException at com.my.GRTRecTimeSortComparator.compare(SourceFile:15) </code></pre> <p>That's well and good. But my problem is that line 15 is the class declaration:</p> <pre><code>15 public class GRTRecTimeSortComparator implements Comparator&lt;GRTRecord&gt; { 16 @Override 17 public int compare(GRTRecord rec1, GRTRecord rec2) { 18 19 int returnVal=rec1.getRecordCalendar().compareTo(rec2.getRecordCalendar()); 20 return returnVal; 21 } 22} </code></pre> <p>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.</p> <p>Any ideas? What have I done wrong here?</p> <p>Edit: in response to queries:</p> <p>No, there is nothing strange about the class itself, other than the fact I wrote it.</p> <p>I AM using Proguard. Maybe the Obfuscation is replacing things incorrectly?</p> <p>I'm writing up tests for the records right now. They SHOULDN'T be <code>null</code>, nor should the <code>Calendars</code>; I use them immediately before, and get good results.</p> <p>Maybe I'm just passing the <code>ArrayList</code> incorrectly.</p> <p>EDIT 2:</p> <p>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.</p> <p>Removed Proguard Obfuscation, and still no dice.</p> <p>I'm REALLY frustrated.</p> <p>Edit 3:</p> <p>For Future Users:</p> <p>Proguard ruins your stack trace. That was the cause of the Above. Remove proguard if you run into issues.</p> <p>The CAUSE was actually a corrupted record in the dataset.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload