Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-20826

EJB components use inappropriate data structure to store method-specific objects.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 37.0.0.Final
    • EE, EJB
    • None
    • ---
    • ---

      While debugging bizarre issues with persistent auto-timers, I discovered that the EJB component uses java.lang.reflect.Method as a key in an IdentityHashMap. Like every AccessibleObject, a Method is inherently mutable. For this reason, Method overrides Object.hashCode() and methods such as Class.getMethods(...), getDeclaredMethods(...), etc. will always return a new Method instance. In general, unless one can guarantee that all calls to IdentityHashMap.get(...) will use the same Method instance used to create the map entry, a Method should not be used as a key in an IdentityHashMap, especially if the contents of this map can be accessed publicly.

              pferraro@redhat.com Paul Ferraro
              pferraro@redhat.com Paul Ferraro
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: