[SNMP4J] SmiManager.parse throwing checked exception

Eugene Lockett Eugene.Lockett at servicenow.com
Sat Jan 18 00:19:55 CET 2014


Hello there,
I downloaded and started using the latest SNMP4J-SMI (v 1.1.1), and found some unexpected behavior with SmiManager.parse().  When called with an invalid OID, a java.text.ParseException is thrown, which is expected according the docs.  The issue is this: ParseException is a checked exception, but at compile time i'm not allowed to handle it - it's as if SmiManager.parse() never had the "throws ParseException" clause.  And this true of other methods of SmiManager as well…

The following piece of code causes all sorts of compile time errors when built w/ 1.0.1 (as expected… buncha unhanded checked exceptions), but compiles successfully against v1.1.1:


public void test()  {

    SmiManager smiManager = new SmiManager(SNMP4J_SMI_LICENSE_KEY, new File("repo"));

    smiManager.listModules();

    smiManager.getLoadedModuleNames();

    smiManager.compile(new File("blah"));

    smiManager.parse("wacky.oid");

}



I noticed in a previous list message there was some build issues with enums… perhaps this is related?


Thanks,

Gene



More information about the SNMP4J mailing list