Program: 113549
Project: 113549
Buggy source:
public static String getSysAttrValue(MRCConfig config,StorageManager sMan,OSDStatusManager osdMan,String path,FileMetadata file,String keyString) throws DatabaseException, UserException, JSONException, UnknownUUIDException {
  if (keyString.startsWith(POLICY_ATTR_PREFIX.toString() + "String_Node_Str"))   return getPolicyValue(sMan,keyString);
  SysAttrs key=null;
  try {
    key=SysAttrs.valueOf(keyString);
  }
 catch (  IllegalArgumentException exc) {
    throw new UserException(ErrNo.EINVAL,"String_Node_Str" + keyString + "String_Node_Str");
  }
  if (key != null) {
switch (key) {
case locations:
      if (file.isDirectory()) {
        return "String_Node_Str";
      }
 else {
        XLocList xLocList=file.getXLocList();
        return xLocList == null ? "String_Node_Str" : Converter.xLocListToJSON(xLocList);
      }
case file_id:
    return sMan.getVolumeInfo().getId() + "String_Node_Str" + file.getId();
case object_type:
  String ref=sMan.getSoftlinkTarget(file.getId());
return ref != null ? "String_Node_Str" : file.isDirectory() ? "String_Node_Str" : "String_Node_Str";
case url:
{
InetSocketAddress addr=config.getDirectoryService();
return config.getURLScheme() + "String_Node_Str" + addr.getAddress().getCanonicalHostName()+ "String_Node_Str"+ addr.getPort()+ "String_Node_Str"+ path;
}
case owner:
return file.getOwnerId();
case group:
return file.getOwningGroupId();
case default_sp:
if (!file.isDirectory()) return "String_Node_Str";
StripingPolicy sp=sMan.getDefaultStripingPolicy(file.getId());
if (sp == null) return "String_Node_Str";
return Converter.stripingPolicyToJSONString(sp);
case ac_policy_id:
return file.getId() == 1 ? sMan.getVolumeInfo().getAcPolicyId() + "String_Node_Str" : "String_Node_Str";
case osel_policy:
return file.getId() == 1 ? Converter.shortArrayToString(sMan.getVolumeInfo().getOsdPolicy()) : "String_Node_Str";
case rsel_policy:
return file.getId() == 1 ? Converter.shortArrayToString(sMan.getVolumeInfo().getReplicaPolicy()) : "String_Node_Str";
case read_only:
if (file.isDirectory()) return "String_Node_Str";
return String.valueOf(file.isReadOnly());
case usable_osds:
{
if (file.getId() != 1) return "String_Node_Str";
ServiceSet srvs=osdMan.getUsableOSDs(sMan.getVolumeInfo().getId());
Map<String,String> osds=new HashMap<String,String>();
for (Service srv : srvs) {
ServiceUUID uuid=new ServiceUUID(srv.getUuid());
InetAddress ia=uuid.getMappings()[0].resolvedAddr.getAddress();
osds.put(uuid.toString(),ia.getCanonicalHostName());
}
return JSONParser.writeJSON(osds);
}
case free_space:
return file.getId() == 1 ? String.valueOf(osdMan.getFreeSpace(sMan.getVolumeInfo().getId())) : "String_Node_Str";
case used_space:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getVolumeSize()) : "String_Node_Str";
case num_files:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getNumFiles()) : "String_Node_Str";
case num_dirs:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getNumDirs()) : "String_Node_Str";
case repl_factor:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getAutoReplFactor()) : "String_Node_Str";
case repl_full:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getAutoReplFull()) : "String_Node_Str";
case snapshots:
{
if (file.getId() != 1) return "String_Node_Str";
StringBuilder sb=new StringBuilder();
String[] snaps=sMan.getAllSnapshots();
int i=0;
for (String snap : snaps) {
sb.append(snap);
if (i < snaps.length - 1) sb.append("String_Node_Str");
i++;
}
return sb.toString();
}
}
}
return "String_Node_Str";
}

Fixed version (ground truth):
public static String getSysAttrValue(MRCConfig config,StorageManager sMan,OSDStatusManager osdMan,String path,FileMetadata file,String keyString) throws DatabaseException, UserException, JSONException, UnknownUUIDException {
  if (keyString.startsWith(POLICY_ATTR_PREFIX.toString() + "String_Node_Str"))   return getPolicyValue(sMan,keyString);
  SysAttrs key=null;
  try {
    key=SysAttrs.valueOf(keyString);
  }
 catch (  IllegalArgumentException exc) {
    throw new UserException(ErrNo.EINVAL,"String_Node_Str" + keyString + "String_Node_Str");
  }
  if (key != null) {
switch (key) {
case locations:
      if (file.isDirectory()) {
        return "String_Node_Str";
      }
 else {
        XLocList xLocList=file.getXLocList();
        return xLocList == null ? "String_Node_Str" : Converter.xLocListToJSON(xLocList);
      }
case file_id:
    return sMan.getVolumeInfo().getId() + "String_Node_Str" + file.getId();
case object_type:
  String ref=sMan.getSoftlinkTarget(file.getId());
return ref != null ? "String_Node_Str" : file.isDirectory() ? "String_Node_Str" : "String_Node_Str";
case url:
{
InetSocketAddress addr=config.getDirectoryService();
final String hostname=(config.getHostName().length() > 0) ? config.getHostName() : addr.getAddress().getCanonicalHostName();
return config.getURLScheme() + "String_Node_Str" + hostname+ "String_Node_Str"+ addr.getPort()+ "String_Node_Str"+ path;
}
case owner:
return file.getOwnerId();
case group:
return file.getOwningGroupId();
case default_sp:
if (!file.isDirectory()) return "String_Node_Str";
StripingPolicy sp=sMan.getDefaultStripingPolicy(file.getId());
if (sp == null) return "String_Node_Str";
return Converter.stripingPolicyToJSONString(sp);
case ac_policy_id:
return file.getId() == 1 ? sMan.getVolumeInfo().getAcPolicyId() + "String_Node_Str" : "String_Node_Str";
case osel_policy:
return file.getId() == 1 ? Converter.shortArrayToString(sMan.getVolumeInfo().getOsdPolicy()) : "String_Node_Str";
case rsel_policy:
return file.getId() == 1 ? Converter.shortArrayToString(sMan.getVolumeInfo().getReplicaPolicy()) : "String_Node_Str";
case read_only:
if (file.isDirectory()) return "String_Node_Str";
return String.valueOf(file.isReadOnly());
case usable_osds:
{
if (file.getId() != 1) return "String_Node_Str";
ServiceSet srvs=osdMan.getUsableOSDs(sMan.getVolumeInfo().getId());
Map<String,String> osds=new HashMap<String,String>();
for (Service srv : srvs) {
ServiceUUID uuid=new ServiceUUID(srv.getUuid());
InetAddress ia=uuid.getMappings()[0].resolvedAddr.getAddress();
osds.put(uuid.toString(),ia.getCanonicalHostName());
}
return JSONParser.writeJSON(osds);
}
case free_space:
return file.getId() == 1 ? String.valueOf(osdMan.getFreeSpace(sMan.getVolumeInfo().getId())) : "String_Node_Str";
case used_space:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getVolumeSize()) : "String_Node_Str";
case num_files:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getNumFiles()) : "String_Node_Str";
case num_dirs:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getNumDirs()) : "String_Node_Str";
case repl_factor:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getAutoReplFactor()) : "String_Node_Str";
case repl_full:
return file.getId() == 1 ? String.valueOf(sMan.getVolumeInfo().getAutoReplFull()) : "String_Node_Str";
case snapshots:
{
if (file.getId() != 1) return "String_Node_Str";
StringBuilder sb=new StringBuilder();
String[] snaps=sMan.getAllSnapshots();
int i=0;
for (String snap : snaps) {
sb.append(snap);
if (i < snaps.length - 1) sb.append("String_Node_Str");
i++;
}
return sb.toString();
}
}
}
return "String_Node_Str";
}