Bug 821058 - Protect Set passed in MeasurementFacet.getValues()
Protect Set passed in MeasurementFacet.getValues()
Product: RHQ Project
Classification: Other
Component: Plugin Container (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: ---
Assigned To: John Mazzitelli
Mike Foley
Depends On:
  Show dependency treegraph
Reported: 2012-05-11 13:38 EDT by Elias Ross
Modified: 2013-09-01 15:20 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-01 15:20:22 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to measurement subsystem in PC (2.13 KB, patch)
2012-06-22 10:11 EDT, John Mazzitelli
no flags Details | Diff

  None (edit)
Description Elias Ross 2012-05-11 13:38:13 EDT
Description of problem:

I have a plugin that uses the subclass and parent class to obtain measurement values. I wrote the code in the following way:

    public void getValues(MeasurementReport mr, Set<MeasurementScheduleRequest> msrs) {
        Map<String, Double> map = new HashMap<String, Double>();
        try {
        } catch (Exception e) {
            log.warn("failed to digest additional content", e);
        for (Iterator<MeasurementScheduleRequest> i = msrs.iterator(); i.hasNext(); ) {
            MeasurementScheduleRequest msr = i.next();
            Double d = digest.get(msr.getName());
            if (d != null) {
                mr.addData(new MeasurementDataNumeric(msr, d));
                i.remove(); // XXX
        super.getValues(mr, msrs);

What this does, unfortunately, is unschedule the measurement request.

The "Set" passed into the method should either be read-only or a copy.

It would probably be better to be read-only, though.

Version-Release number of selected component (if applicable):

RHQ 4.2

How reproducible:


Additional info:
Comment 1 Heiko W. Rupp 2012-06-21 05:33:23 EDT
Mazz, could you look into this? I think it makes a lot of sense
Comment 2 John Mazzitelli 2012-06-22 10:11:30 EDT
Created attachment 593763 [details]
patch to measurement subsystem in PC

attaching a patch for the PC's measurement classes that will now pass in a read-only set.

this isn't the finished patch. I will be looking at writing unit tests for this prior to committing to master. But the patch should be all the code that goes into the PC. any additional changes will be to test classes.
Comment 3 John Mazzitelli 2012-06-25 15:41:12 EDT
git commit to master 2af89d1

added a new unit test in our arquillian test suite.

there is nothing for QE to test - this is a code change.
Comment 4 Heiko W. Rupp 2013-09-01 15:20:22 EDT
Bulk closing of BZs that have no target version set, but which are ON_QA for more than a year and thus are in production for a long time.

Note You need to log in before you can comment on or make changes to this bug.