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

org.jboss.ejb.EjbUtil.resolveAbsoluteLink does not work correctly under some circumstances

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • No Release
    • JBossAS-4.0.2 Final
    • EJB2
    • None

    Description

      In server\src\main\org\jboss\ejb\EjbUtil.java in
      method "private static String resolveAbsoluteLink(DeploymentInfo di, String link, boolean isLocal)"
      I find the following [fixed - marked with DG] code below.
      The problem is that if this is called AND di.metaData is an instanceof ApplicationMetaData AND
      appMD.getBeanByEjbName(link) is null AND logging is turned on AND appMD.getEnterpriseBeans().hasNext() is true
      AND getJndiName() returns NOT null, THEN the resolved link will be the last appMD.getEnterpriseBeans() iteration,
      INSTEAD of the result of looking through each subcontext.

      That is, if logging is turned on, under some circumstances,
      ejbName is changed as an unintended side-effect.

      private static String resolveAbsoluteLink(DeploymentInfo di, String link, boolean isLocal)
      {
      if (log.isTraceEnabled())

      { log.trace("Resolving absolute link, di: " + di); }

      String ejbName = null;

      // Search current DeploymentInfo
      if (di.metaData instanceof ApplicationMetaData)
      {
      ApplicationMetaData appMD = (ApplicationMetaData) di.metaData;
      BeanMetaData beanMD = appMD.getBeanByEjbName(link);
      if (beanMD != null)
      {
      ejbName = getJndiName(beanMD, isLocal);
      if (log.isTraceEnabled())

      { log.trace("Found Bean: " + beanMD + ", resolves to: " + ejbName); }

      return ejbName;
      }
      else if (log.isTraceEnabled())
      {
      log.trace("No match for ejb-link: " + link);
      Iterator iter = appMD.getEnterpriseBeans();
      while (iter.hasNext())

      { beanMD = (BeanMetaData) iter.next(); // don't TRASH ejbName // DG ADD // ejbName = getJndiName(beanMD, isLocal); // DG del String ejbNameTemp = getJndiName(beanMD, isLocal); // DG ADD // log.trace("... Has ejbName: " + ejbName); // DG del log.trace("... Has ejbName: " + ejbNameTemp); // DG ADD }

      }
      }

      // Search each subcontext
      Iterator it = di.subDeployments.iterator();
      while (it.hasNext() && ejbName == null)

      { DeploymentInfo child = (DeploymentInfo) it.next(); ejbName = resolveAbsoluteLink(child, link, isLocal); }

      return ejbName;
      }

      Attachments

        Issue Links

          Activity

            People

              dandread1@redhat.com Dimitrios Andreadis
              dgscreamer_jira David George (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: