Program: 106590
Project: 106590
Buggy source:
public static void setupParameters(BaseCmd cmd,Map<String,String> params){
  Map<String,Object> unpackedParams=cmd.unpackParams(params);
  if (cmd instanceof BaseListCmd) {
    if ((unpackedParams.get(ApiConstants.PAGE) == null) && (unpackedParams.get(ApiConstants.PAGE_SIZE) != null)) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
    }
 else     if ((unpackedParams.get(ApiConstants.PAGE_SIZE) == null) && (unpackedParams.get(ApiConstants.PAGE) != null)) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
    }
  }
  Field[] fields=cmd.getClass().getDeclaredFields();
  Class<?> superClass=cmd.getClass().getSuperclass();
  while (BaseCmd.class.isAssignableFrom(superClass)) {
    Field[] superClassFields=superClass.getDeclaredFields();
    if (superClassFields != null) {
      Field[] tmpFields=new Field[fields.length + superClassFields.length];
      System.arraycopy(fields,0,tmpFields,0,fields.length);
      System.arraycopy(superClassFields,0,tmpFields,fields.length,superClassFields.length);
      fields=tmpFields;
    }
    superClass=superClass.getSuperclass();
  }
  for (  Field field : fields) {
    Parameter parameterAnnotation=field.getAnnotation(Parameter.class);
    if ((parameterAnnotation == null) || !parameterAnnotation.expose()) {
      continue;
    }
    IdentityMapper identityMapper=field.getAnnotation(IdentityMapper.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,identityMapper);
    }
 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));
    }
  }
}

Fixed version (ground truth):
public static void setupParameters(BaseCmd cmd,Map<String,String> params){
  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)) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
    }
 else     if (pageSize == null && (unpackedParams.get(ApiConstants.PAGE) != null)) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str");
    }
  }
  Field[] fields=cmd.getClass().getDeclaredFields();
  Class<?> superClass=cmd.getClass().getSuperclass();
  while (BaseCmd.class.isAssignableFrom(superClass)) {
    Field[] superClassFields=superClass.getDeclaredFields();
    if (superClassFields != null) {
      Field[] tmpFields=new Field[fields.length + superClassFields.length];
      System.arraycopy(fields,0,tmpFields,0,fields.length);
      System.arraycopy(superClassFields,0,tmpFields,fields.length,superClassFields.length);
      fields=tmpFields;
    }
    superClass=superClass.getSuperclass();
  }
  for (  Field field : fields) {
    Parameter parameterAnnotation=field.getAnnotation(Parameter.class);
    if ((parameterAnnotation == null) || !parameterAnnotation.expose()) {
      continue;
    }
    IdentityMapper identityMapper=field.getAnnotation(IdentityMapper.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,identityMapper);
    }
 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));
    }
  }
}