NullPointerException in TimeSeries.getTimePeriod

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jeffmoore
Posts: 1
Joined: Fri Jan 06, 2012 4:10 pm
antibot: No, of course not.

NullPointerException in TimeSeries.getTimePeriod

Post by jeffmoore » Fri Jan 06, 2012 5:43 pm

Hello all. I had a quick question that I can't seem to find the answer to by searching on Google or the forums. I've built an app that monitors memory usage on multiple servers and plots it to various line charts. My co-worker had it stop updating the other day and sent me the log file to figure out what was going on. I can't re-create the error, but it seems to be a null pointer exception happening within the TimeSeries class in the getTimePeriod method. This happened in version 1.0.13 but I have since updated to version 1.0.14. The details are below, thanks for any help in advance.

Here is the error from my log.

Code: Select all

2012-01-03 15:05:27,352 [MonitorThread] ERROR m.army.hrc.ServerMonitor.Monitor.Monitor - [33] Uncaught Exception in thread: MonitorThread
java.lang.NullPointerException: null
	at org.jfree.data.time.TimeSeries.getTimePeriod(TimeSeries.java:361) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at org.jfree.data.time.TimeSeries.removeAgedItems(TimeSeries.java:730) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at org.jfree.data.time.TimeSeries.addOrUpdate(TimeSeries.java:709) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at org.jfree.data.time.TimeSeries.addOrUpdate(TimeSeries.java:662) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at mil.army.hrc.ASBS.ServerMonitor.Monitor.gui.MemoryUsageChart.AddMemoryUsageDataPoint(MemoryUsageChart.java:87) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at mil.army.hrc.ASBS.ServerMonitor.Monitor.gui.SummaryPanel.update(SummaryPanel.java:153) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at mil.army.hrc.ASBS.ServerMonitor.Monitor.gui.MonitorFrame.update(MonitorFrame.java:169) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at mil.army.hrc.ASBS.ServerMonitor.Monitor.gui.MonitorFrame.run(MonitorFrame.java:195) ~[ASBS%20Server%20Monitor%201.0.0.jar:na]
	at java.lang.Thread.run(Thread.java:662) ~[na:1.6.0_29]
And this the method where control transfers from my code to jfreechart code.

Code: Select all

public void AddMemoryUsageDataPoint(final double memoryUsed)
  {
    LOG.trace("Adding a data point to the memory usage series...");
    memoryUsage.addOrUpdate(new Second(Calendar.getInstance().getTime()), memoryUsed);
  }

Locked