Improving exception handling on the XML Collector

Description

When something is wrong inside the XML Collection Handlers, the original exception is wrapped inside a XmlCollectorException (even on nested calls), hiding the original exception. Because of this, under some circumstances, is hard to track down a problem just by looking at the logs.

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Alejandro Galue May 6, 2015 at 4:53 PM

Fixed on revision aa276c48ca729e38c7dd7ce87766932674dff4d2 for foundation.

Alejandro Galue May 6, 2015 at 4:46 PM

Looking at the code, it is not required to catch and wrap the exception into a custom exception because the XmlCollector class is going to do this inside the collect method.

For this reason, the XmlCollectorException can be safely removed, and all the methods that are using it must be changed to throw exceptions. After doing it, if something is wrong, the root cause will be caught inside org.opennms.protocols.xml.collector.XmlCollector.collect(CollectionAgent, EventProxy, Map<String, Object>), and a CollectionException will be thrown with the root cause.

Fixed

Details

Assignee

Reporter

Components

Priority

PagerDuty

Created May 6, 2015 at 4:41 PM
Updated May 6, 2015 at 8:53 PM
Resolved May 6, 2015 at 4:53 PM