Program: 15935
Project: 15935
Buggy source:
protected Object getShadowVariable0(Component baseChild,String name,boolean recurse){
  try {
    _variableSeeking=true;
    Object val=getAttribute(name);
    if (val != null || hasAttribute(name))     return val;
    if (!(this instanceof ShadowElement)) {
      ComponentCtrl ctrl=this;
      List<HtmlShadowElement> shadowRoots=ctrl.getShadowRoots();
      if (!shadowRoots.isEmpty()) {
        Map<Component,Integer> indexCacheMap=getIndexCacheMap();
        try {
          if (indexCacheMap != null) {
            destroyIndexCacheMap();
          }
          initIndexCacheMap();
          for (          HtmlShadowElement shadow : shadowRoots) {
            if (shadow.getShadowHost() != baseChild) {
switch (HtmlShadowElement.inRange(shadow,baseChild)) {
case IN_RANGE:
case FIRST:
case LAST:
                return shadow.resolveVariable(baseChild,name,recurse);
            }
          }
 else {
            val=shadow.resolveVariable(baseChild,name,recurse);
            if (val != null)             return val;
          }
        }
      }
  finally {
        ShadowElementsCtrl.setDistributedIndexInfo(indexCacheMap);
      }
    }
  }
  if (recurse) {
    if (_parent != null)     return _parent.getShadowVariable0(this,name,recurse);
    if (this instanceof ShadowElement) {
      AbstractComponent shadowHost=(AbstractComponent)((ShadowElement)this).getShadowHost();
      if (shadowHost != null) {
        if (shadowHost._variableSeeking) {
          if (shadowHost.getParent() != null) {
            return ((AbstractComponent)shadowHost.getParent()).getShadowVariable0(shadowHost,name,recurse);
          }
          return null;
        }
        if (shadowHost.getParent() != null)         return ((AbstractComponent)shadowHost.getParent()).getShadowVariable0(shadowHost,name,recurse);
      }
    }
  }
  return null;
}
  finally {
  _variableSeeking=false;
}
}

Fixed version (ground truth):
protected Object getShadowVariable0(Component baseChild,String name,boolean recurse){
  try {
    _variableSeeking=true;
    Object val=getAttribute(name);
    if (val != null || hasAttribute(name))     return val;
    if (!(this instanceof ShadowElement)) {
      ComponentCtrl ctrl=this;
      List<HtmlShadowElement> shadowRoots=ctrl.getShadowRoots();
      if (!shadowRoots.isEmpty()) {
        Map<Component,Integer> indexCacheMap=getIndexCacheMap();
        try {
          if (indexCacheMap != null) {
            destroyIndexCacheMap();
          }
          initIndexCacheMap();
          for (          HtmlShadowElement shadow : shadowRoots) {
            if (shadow.getShadowHost() != baseChild) {
switch (HtmlShadowElement.inRange(shadow,baseChild)) {
case IN_RANGE:
case FIRST:
case LAST:
                return shadow.resolveVariable(baseChild,name,recurse);
            }
          }
 else {
            val=shadow.resolveVariable(baseChild,name,recurse);
            if (val != null)             return val;
          }
        }
      }
  finally {
        ShadowElementsCtrl.setDistributedIndexInfo(indexCacheMap);
      }
    }
  }
  if (recurse) {
    if (_parent != null)     return _parent.getShadowVariable0(this,name,recurse);
    if (this instanceof ShadowElement) {
      final Object value=((ShadowElementCtrl)this).resolveVariable(null,name,recurse);
      if (value != null)       return value;
      AbstractComponent shadowHost=(AbstractComponent)((ShadowElement)this).getShadowHost();
      if (shadowHost != null) {
        if (shadowHost._variableSeeking) {
          if (shadowHost.getParent() != null) {
            return ((AbstractComponent)shadowHost.getParent()).getShadowVariable0(shadowHost,name,recurse);
          }
          return null;
        }
        if (shadowHost.getParent() != null)         return ((AbstractComponent)shadowHost.getParent()).getShadowVariable0(shadowHost,name,recurse);
      }
    }
  }
  return null;
}
  finally {
  _variableSeeking=false;
}
}