collectd/collectd — pull request #645 by manuelluis (2014-06-19 13:22:33+00:00)
Title: Plugin java: fix notification time conversion to cdtime_t.

Fix conversion of time in notifications to ``cdtime_t``.

To reproduce the problem:

Read notitications:

import org.collectd.api.Collectd;
import org.collectd.api.Notification;
import org.collectd.api.CollectdNotificationInterface;

public class TestNotify implements CollectdNotificationInterface
{
public TestNotify ()
{
Collectd.registerNotification("TestNotify", this);
}

public int notification (Notification n)
{
System.out.println(n.toString());
return 0;
}
}

Generate notifications:

import org.collectd.api.Collectd;
import org.collectd.api.Notification;
import java.util.Date;
import org.collectd.api.CollectdReadInterface;

public class TestDispatchNotification implements CollectdReadInterface
{
public TestDispatchNotification ()
{
Collectd.registerRead("TestNotify", this);
}

public int read()
{
Notification n = new Notification();

n.setTime(new Date().getTime());
n.setSeverity(Notification.WARNING);
n.setHost("localhost");
n.setPlugin("java");
n.setPluginInstance("TestDispatchNotification");
n.setType("counter");
n.setMessage("TestDispatchNotification");

Collectd.dispatchNotification(n);

return 0;
}
}

The cmd ``PUTNOTIF`` has the same problem, fixed in https://github.com/collectd/collectd/pull/644