Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1715

javax.management.monitor.Monitor.getObservedObjects() throws

    XMLWordPrintable

Details

    Description

      SourceForge Submitter: ctday .
      When I try to access a StringMonitor MBean through
      jmx-console, I get a ClassCastException from
      javax.management.monitor.Monitor.getObservedObjects
      (). The code in the HEAD of CVS reads:

      public ObjectName[] getObservedObjects()
      {
      Set set = new HashSet(observedObjects.keySet());
      elementCount = set.size();
      ObjectName[] result = new ObjectName[set.size()];
      alreadyNotifieds = new int[set.size()];
      int count = 0;
      for (Iterator i = set.iterator(); i.hasNext()

      { ObservedObject object = (ObservedObject) i.next (); result[count] = object.getObjectName(); alreadyNotifieds[count++] = object.getAlreadyNotified(); }

      return result;
      }

      The Exception is raised from the (ObservedObject)
      i.next, which is an ObjectName, not an ObservedObject.

      The error appears to be in the initialization of set. The
      keySet of the observedObjects HashMap is being used,
      which is a set of ObjectNames, rather than the valueSet
      of observedObjects, which is a set of ObservedObjects.

      The code has been this way since at least 3.2.5.

      Attachments

        Activity

          People

            adrian.brock Adrian Brock (Inactive)
            sourceforge-user SourceForge legacy user (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: