Program: 172283
Project: 172283
Buggy source:
/** 
 * Find the file state for a pseudo folder path
 * @param avmPath AVMPath
 * @param avmCtx AVMContext
 * @return FileState
 */
private final FileState findPseudoState(AVMPath avmPath,AVMContext avmCtx){
  if (avmPath.isPseudoPath() == false)   return null;
  FileState fstate=null;
  StringBuilder str=null;
switch (avmPath.isLevel()) {
case Root:
    fstate=avmCtx.getStateTable().findFileState(FileName.DOS_SEPERATOR_STR);
  if (fstate == null) {
    fstate=avmCtx.getStateTable().findFileState(FileName.DOS_SEPERATOR_STR,true,true);
    fstate.setExpiryTime(FileState.NoTimeout);
    List<AVMStoreDescriptor> storeList=m_avmService.getStores();
    if (storeList != null && storeList.size() > 0) {
      boolean sandbox=false;
      for (      AVMStoreDescriptor storeDesc : storeList) {
        Map<QName,PropertyValue> props=m_avmService.getStoreProperties(storeDesc.getName());
        if (props.containsKey(AVMContext.PROP_WORKFLOWPREVIEW) || props.containsKey(AVMContext.PROP_AUTHORPREVIEW))         sandbox=true;
        if (logger.isDebugEnabled())         logger.debug("String_Node_Str" + storeDesc.getName() + "String_Node_Str"+ sandbox);
        if (sandbox == false || avmCtx.showSandboxes() == true)         fstate.addPseudoFile(new StorePseudoFile(storeDesc));
      }
    }
  }
break;
case StoreRoot:
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
fstate=avmCtx.getStateTable().findFileState(str.toString());
if (fstate == null) {
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
fstate.addPseudoFile(new VersionPseudoFile(AVMPath.VersionNameHead));
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.VersionsFolder));
}
break;
case Head:
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
str.append(FileName.DOS_SEPERATOR);
str.append(AVMPath.VersionNameHead);
fstate=avmCtx.getStateTable().findFileState(str.toString());
if (fstate == null) {
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
}
break;
case VersionRoot:
try {
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
str.append(FileName.DOS_SEPERATOR);
str.append(AVMPath.VersionsFolder);
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
if (fstate.hasPseudoFiles() == false) {
StringBuilder verStr=new StringBuilder(AVMPath.VersionFolderPrefix);
verStr.append("String_Node_Str");
fstate.addPseudoFile(new VersionPseudoFile(verStr.toString()));
List<VersionDescriptor> verList=m_avmService.getStoreVersions(avmPath.getStoreName());
if (verList.size() > 0) {
for (VersionDescriptor verDesc : verList) {
String verName=null;
verStr.setLength(AVMPath.VersionFolderPrefix.length());
verStr.append(verDesc.getVersionID());
verName=verStr.toString();
fstate.addPseudoFile(new VersionPseudoFile(verName,verDesc));
}
}
}
}
 catch (AVMNotFoundException ex) {
}
break;
case Version:
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
str.append(FileName.DOS_SEPERATOR);
str.append(AVMPath.VersionFolderPrefix);
str.append(avmPath.getVersion());
fstate=avmCtx.getStateTable().findFileState(str.toString());
if (fstate == null) {
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
}
break;
}
return fstate;
}

Fixed version (ground truth):
/** 
 * Find the file state for a pseudo folder path
 * @param avmPath AVMPath
 * @param avmCtx AVMContext
 * @return FileState
 */
private final FileState findPseudoState(AVMPath avmPath,AVMContext avmCtx){
  if (avmPath.isPseudoPath() == false)   return null;
  FileState fstate=null;
  StringBuilder str=null;
switch (avmPath.isLevel()) {
case Root:
    fstate=avmCtx.getStateTable().findFileState(FileName.DOS_SEPERATOR_STR);
  if (fstate == null) {
    fstate=avmCtx.getStateTable().findFileState(FileName.DOS_SEPERATOR_STR,true,true);
    fstate.setExpiryTime(FileState.NoTimeout);
    List<AVMStoreDescriptor> storeList=m_avmService.getStores();
    if (storeList != null && storeList.size() > 0) {
      boolean sandbox=false;
      for (      AVMStoreDescriptor storeDesc : storeList) {
        Map<QName,PropertyValue> props=m_avmService.getStoreProperties(storeDesc.getName());
        if (props.containsKey(AVMContext.PROP_WORKFLOWPREVIEW) || props.containsKey(AVMContext.PROP_AUTHORPREVIEW))         sandbox=true;
 else         sandbox=false;
        if (logger.isDebugEnabled())         logger.debug("String_Node_Str" + storeDesc.getName() + "String_Node_Str"+ sandbox);
        if (sandbox == false || avmCtx.showSandboxes() == true)         fstate.addPseudoFile(new StorePseudoFile(storeDesc));
      }
    }
  }
break;
case StoreRoot:
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
fstate=avmCtx.getStateTable().findFileState(str.toString());
if (fstate == null) {
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
fstate.addPseudoFile(new VersionPseudoFile(AVMPath.VersionNameHead));
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.VersionsFolder));
}
break;
case Head:
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
str.append(FileName.DOS_SEPERATOR);
str.append(AVMPath.VersionNameHead);
fstate=avmCtx.getStateTable().findFileState(str.toString());
if (fstate == null) {
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
}
break;
case VersionRoot:
try {
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
str.append(FileName.DOS_SEPERATOR);
str.append(AVMPath.VersionsFolder);
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
if (fstate.hasPseudoFiles() == false) {
StringBuilder verStr=new StringBuilder(AVMPath.VersionFolderPrefix);
verStr.append("String_Node_Str");
fstate.addPseudoFile(new VersionPseudoFile(verStr.toString()));
List<VersionDescriptor> verList=m_avmService.getStoreVersions(avmPath.getStoreName());
if (verList.size() > 0) {
for (VersionDescriptor verDesc : verList) {
String verName=null;
verStr.setLength(AVMPath.VersionFolderPrefix.length());
verStr.append(verDesc.getVersionID());
verName=verStr.toString();
fstate.addPseudoFile(new VersionPseudoFile(verName,verDesc));
}
}
}
}
 catch (AVMNotFoundException ex) {
}
break;
case Version:
str=new StringBuilder();
str.append(FileName.DOS_SEPERATOR);
str.append(avmPath.getStoreName());
str.append(FileName.DOS_SEPERATOR);
str.append(AVMPath.VersionFolderPrefix);
str.append(avmPath.getVersion());
fstate=avmCtx.getStateTable().findFileState(str.toString());
if (fstate == null) {
fstate=avmCtx.getStateTable().findFileState(str.toString(),true,true);
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.DataFolder));
fstate.addPseudoFile(new DummyFolderPseudoFile(AVMPath.MetaDataFolder));
}
break;
}
return fstate;
}