On Jan 30, 2014, at 3:55 PM, Alejandro Galue <aga...@opennms.org> wrote:

> So, my question is: what's the meaning of last_ds ? and, What kind of 
> variable is that in order to find the proper representation in Java ? 
> java.lang.Double ? java.lang.Long ?

I made a test to answer my own question.

Yes, the last_ds should be considered as Double.
Yes, UNKN can be interpreted as a synonym of NaN.

Here is the fix for the issue for those who want to try it out:

diff --git 
a/opennms-rrd/opennms-rrd-model/src/main/java/org/opennms/netmgt/rrd/model/DoubleAdapter.java
 b/opennms-rrd/opennms-rrd-model/
index 1c120ae..6fa070e 100644
--- 
a/opennms-rrd/opennms-rrd-model/src/main/java/org/opennms/netmgt/rrd/model/DoubleAdapter.java
+++ 
b/opennms-rrd/opennms-rrd-model/src/main/java/org/opennms/netmgt/rrd/model/DoubleAdapter.java
@@ -72,7 +72,7 @@ public class DoubleAdapter extends XmlAdapter<String, Double> 
{
         if (v.equalsIgnoreCase("inf")) {
             return Double.POSITIVE_INFINITY;
         }
-        if (v.equalsIgnoreCase("nan")) {
+        if (v.equalsIgnoreCase("nan") || v.equalsIgnoreCase("unkn")) {
             return Double.NaN;
         }
         return new Double(v);

I've created the following JUnit test with the JRB attached to the Jira issue 
and I was able to reproduce the issue and verify that the above solution works:

public class NMS6369 {

    @Test
    public void testJrobinParse() throws Exception {
        RRDv1 rrd = RrdConvertUtils.dumpJrb(new 
File("src/test/resources/mib2-interfaces.jrb"));
        Assert.assertNotNull(rrd);
        File target = new File("target/mib2-interfaces.jrb");
        RrdConvertUtils.restoreJrb(rrd, target);
        Assert.assertTrue(target.exists());
    }

}

Of course, I need to test it with RRDtool ;)

Alejandro.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to