Program: 106417
Project: 106417
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static void processParameters(BaseCmd cmd,Map<String,String> params){
  List<Object> entitiesToAccess=new ArrayList<Object>();
  Map<String,Object> unpackedParams=cmd.unpackParams(params);
  if (cmd instanceof BaseListCmd) {
    Object pageSizeObj=unpackedParams.get(ApiConstants.PAGE_SIZE);
    Long pageSize=null;
    if (pageSizeObj != null) {
      pageSize=Long.valueOf((String)pageSizeObj);
    }
    if ((unpackedParams.get(ApiConstants.PAGE) == null) && (pageSize != null && pageSize != BaseListCmd.PAGESIZE_UNLIMITED)) {
      ServerApiException ex=new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
      ex.setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ex.getClass().getName()));
      throw ex;
    }
 else     if (pageSize == null && (unpackedParams.get(ApiConstants.PAGE) != null)) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
    }
  }
  Field[] fields=ReflectUtil.getAllFieldsForClass(cmd.getClass(),new Class<?>[]{BaseCmd.class});
  for (  Field field : fields) {
    PlugService plugServiceAnnotation=field.getAnnotation(PlugService.class);
    if (plugServiceAnnotation != null) {
      plugService(field,cmd);
    }
    Parameter parameterAnnotation=field.getAnnotation(Parameter.class);
    if ((parameterAnnotation == null) || !parameterAnnotation.expose()) {
      continue;
    }
    Validate validateAnnotation=field.getAnnotation(Validate.class);
    Object paramObj=unpackedParams.get(parameterAnnotation.name());
    if (paramObj == null) {
      if (parameterAnnotation.required()) {
        throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8) + "String_Node_Str"+ parameterAnnotation.name());
      }
      continue;
    }
    try {
      setFieldValue(field,cmd,paramObj,parameterAnnotation);
    }
 catch (    IllegalArgumentException argEx) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ paramObj+ "String_Node_Str"+ parameterAnnotation.name());
      }
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8) + "String_Node_Str"+ paramObj+ "String_Node_Str"+ parameterAnnotation.name());
    }
catch (    ParseException parseEx) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + paramObj + "String_Node_Str"+ cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8));
      }
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + paramObj + "String_Node_Str"+ cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8)+ "String_Node_Str");
    }
catch (    InvalidParameterValueException invEx) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8) + "String_Node_Str"+ invEx.getMessage());
    }
catch (    CloudRuntimeException cloudEx) {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8));
    }
    try {
      ACL checkAccess=field.getAnnotation(ACL.class);
      CommandType fieldType=parameterAnnotation.type();
      if (checkAccess != null) {
        if (parameterAnnotation.entityType() != null) {
          Class<?>[] entityList=parameterAnnotation.entityType()[0].getAnnotation(EntityReference.class).value();
          for (          Class entity : entityList) {
switch (fieldType) {
case LIST:
              CommandType listType=parameterAnnotation.collectionType();
switch (listType) {
case LONG:
case UUID:
              List<Long> listParam=new ArrayList<Long>();
            listParam=(List)field.get(cmd);
          for (          Long entityId : listParam) {
            Object entityObj=s_instance._entityMgr.findById(entity,(Long)field.get(cmd));
            entitiesToAccess.add(entityObj);
          }
        break;
default :
      break;
  }
break;
case LONG:
case UUID:
Object entityObj=s_instance._entityMgr.findById(entity,(Long)field.get(cmd));
entitiesToAccess.add(entityObj);
break;
default :
break;
}
if (ControlledEntity.class.isAssignableFrom(entity)) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("String_Node_Str" + entity.getName());
}
}
if (InfrastructureEntity.class.isAssignableFrom(entity)) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("String_Node_Str" + entity.getName());
}
}
}
}
}
}
 catch (IllegalArgumentException e) {
s_logger.error("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
throw new CloudRuntimeException("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
}
catch (IllegalAccessException e) {
s_logger.error("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
throw new CloudRuntimeException("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
}
}
s_instance.doAccessChecks(cmd,entitiesToAccess);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static void processParameters(BaseCmd cmd,Map<String,String> params){
  List<Object> entitiesToAccess=new ArrayList<Object>();
  Map<String,Object> unpackedParams=cmd.unpackParams(params);
  if (cmd instanceof BaseListCmd) {
    Object pageSizeObj=unpackedParams.get(ApiConstants.PAGE_SIZE);
    Long pageSize=null;
    if (pageSizeObj != null) {
      pageSize=Long.valueOf((String)pageSizeObj);
    }
    if ((unpackedParams.get(ApiConstants.PAGE) == null) && (pageSize != null && pageSize != BaseListCmd.PAGESIZE_UNLIMITED)) {
      ServerApiException ex=new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
      ex.setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ex.getClass().getName()));
      throw ex;
    }
 else     if (pageSize == null && (unpackedParams.get(ApiConstants.PAGE) != null)) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
    }
  }
  Field[] fields=ReflectUtil.getAllFieldsForClass(cmd.getClass(),new Class<?>[]{BaseCmd.class});
  for (  Field field : fields) {
    PlugService plugServiceAnnotation=field.getAnnotation(PlugService.class);
    if (plugServiceAnnotation != null) {
      plugService(field,cmd);
    }
    Parameter parameterAnnotation=field.getAnnotation(Parameter.class);
    if ((parameterAnnotation == null) || !parameterAnnotation.expose()) {
      continue;
    }
    Validate validateAnnotation=field.getAnnotation(Validate.class);
    Object paramObj=unpackedParams.get(parameterAnnotation.name());
    if (paramObj == null) {
      if (parameterAnnotation.required()) {
        throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8) + "String_Node_Str"+ parameterAnnotation.name());
      }
      continue;
    }
    try {
      setFieldValue(field,cmd,paramObj,parameterAnnotation);
    }
 catch (    IllegalArgumentException argEx) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ paramObj+ "String_Node_Str"+ parameterAnnotation.name());
      }
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8) + "String_Node_Str"+ paramObj+ "String_Node_Str"+ parameterAnnotation.name());
    }
catch (    ParseException parseEx) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + paramObj + "String_Node_Str"+ cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8));
      }
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + paramObj + "String_Node_Str"+ cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8)+ "String_Node_Str");
    }
catch (    InvalidParameterValueException invEx) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8) + "String_Node_Str"+ invEx.getMessage());
    }
catch (    CloudRuntimeException cloudEx) {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str" + cmd.getCommandName().substring(0,cmd.getCommandName().length() - 8));
    }
    try {
      ACL checkAccess=field.getAnnotation(ACL.class);
      CommandType fieldType=parameterAnnotation.type();
      if (checkAccess != null) {
        if (parameterAnnotation.entityType() != null) {
          Class<?>[] entityList=parameterAnnotation.entityType()[0].getAnnotation(EntityReference.class).value();
          for (          Class entity : entityList) {
switch (fieldType) {
case LIST:
              CommandType listType=parameterAnnotation.collectionType();
switch (listType) {
case LONG:
case UUID:
              List<Long> listParam=(List<Long>)field.get(cmd);
            for (            Long entityId : listParam) {
              Object entityObj=s_instance._entityMgr.findById(entity,entityId);
              entitiesToAccess.add(entityObj);
            }
          break;
default :
        break;
    }
  break;
case LONG:
case UUID:
Object entityObj=s_instance._entityMgr.findById(entity,(Long)field.get(cmd));
entitiesToAccess.add(entityObj);
break;
default :
break;
}
if (ControlledEntity.class.isAssignableFrom(entity)) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("String_Node_Str" + entity.getName());
}
}
if (InfrastructureEntity.class.isAssignableFrom(entity)) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("String_Node_Str" + entity.getName());
}
}
}
}
}
}
 catch (IllegalArgumentException e) {
s_logger.error("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
throw new CloudRuntimeException("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
}
catch (IllegalAccessException e) {
s_logger.error("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
throw new CloudRuntimeException("String_Node_Str" + cmd.getCommandName() + "String_Node_Str"+ field.getName()+ "String_Node_Str");
}
}
s_instance.doAccessChecks(cmd,entitiesToAccess);
}