Some resource graph work flows break when store-by-FS on, FS / FID contain + character

Description

Steps to reproduce:

  1. Enable store-by-foreign-source persisting in opennms.properties and restart OpenNMS:

  2. Create a requisition

  3. Add a node to the new requisition whose foreign-ID contains a + character (I used customer-provided value ''ojT0U+Gg4US9WFfr8QZ1Hw''

  4. Add an interface to the node that supports at least one pollable or collectable service; ICMP is sufficient.

  5. Synchronize the requisition

  6. Navigate to the new node's detail page

  7. Click the Resource Graphs link

  8. Select at least one item in the resource chooser and click Graph Selection

Expected results: Resource graphs drawn

Actual results: Exception stack trace in web UI

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Jesse White April 12, 2017 at 12:36 PM

I think the problem stems from the IDs being encoded directly in the OnmsResource class:
https://github.com/OpenNMS/opennms/blame/develop/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsResource.java#L220

We should only encode/decode these as necessary in the "web" layer, instead of directly in the model.

Christian Pape April 12, 2017 at 10:30 AM

Closed this PR since this doesn't seem to work for all cases. I'll start refactoring the resourceId handling and open a PR when I'm finished.

Christian Pape April 6, 2017 at 8:15 AM

Christian Pape April 6, 2017 at 7:43 AM

The problem is, that the method DefaultResourceDao.getResourceById(String resourceId) expect the resourceId’s parts inside the square brackets to be Url-encoded. This method decodes these parts and even in the case of an already decoded resourceId this works in the case the decoded string equals the given string itself. In the case of a plus character in the given string this decoding changes the string again (for instance "123%2B456" -> "123+456" -> "123 456"). I'll change the code in GraphResultsController to assure that the resoureIds will be encoded before passed to the subsequent calls.

Alejandro Galue May 25, 2016 at 1:58 PM

I made some changes recently to properly show the graphs when either JRobin or RRDtool are enabled with storeByForeignSource. I would appreciate if you can try to reproduce the problem on latest foundation-2016.

Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Affects versions

Priority

PagerDuty

Created March 11, 2015 at 1:08 PM
Updated May 3, 2017 at 8:28 PM
Resolved May 3, 2017 at 4:28 PM