Program: 15837
Project: 15837
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:
                HtmlShadowElement current=shadow;
              label_: {
                List<ShadowElement> list=cast(current.getChildren());
                if (!list.isEmpty()) {
                  for (                  ShadowElement sh : list) {
                    if (sh instanceof HtmlShadowElement) {
                      HtmlShadowElement shadow0=(HtmlShadowElement)sh;
switch (HtmlShadowElement.inRange(shadow0,baseChild)) {
case IN_RANGE:
case FIRST:
case LAST:
                        current=shadow0;
                      break label_;
                  }
                }
              }
            }
          }
        return current.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;
}
}

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:
                HtmlShadowElement current=shadow;
              label_: {
                List<ShadowElement> list=cast(current.getChildren());
                if (!list.isEmpty()) {
                  for (                  ShadowElement sh : list) {
                    if (sh instanceof HtmlShadowElement) {
                      HtmlShadowElement shadow0=(HtmlShadowElement)sh;
switch (HtmlShadowElement.inRange(shadow0,baseChild)) {
case IN_RANGE:
case FIRST:
case LAST:
                        current=shadow0;
                      break label_;
                  }
                }
              }
            }
          }
        return current.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;
}
return ((AbstractComponent)shadowHost).getShadowVariable0(shadowHost,name,recurse);
}
}
}
return null;
}
  finally {
_variableSeeking=false;
}
}