Program: 33158
Project: 33158
Buggy source:
private QueryOption parseOption(final String optionName,final String optionValue) throws UriParserException, UriValidationException {
  if (optionName.startsWith(DOLLAR)) {
    final SystemQueryOptionKind kind=SystemQueryOptionKind.get(optionName);
    if (kind == null) {
      throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.UNKNOWN_SYSTEM_QUERY_OPTION,optionName);
    }
    SystemQueryOption systemOption=null;
switch (kind) {
case SEARCH:
      systemOption=new SearchParser().parse(optionValue);
    break;
case FILTER:
  systemOption=new FilterOptionImpl();
break;
case COUNT:
if (optionValue.equals("String_Node_Str") || optionValue.equals("String_Node_Str")) {
systemOption=new CountOptionImpl().setValue(Boolean.parseBoolean(optionValue));
}
 else {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,optionName,optionValue);
}
break;
case ORDERBY:
systemOption=new OrderByOptionImpl();
break;
case SKIP:
systemOption=new SkipOptionImpl().setValue(ParserHelper.parseNonNegativeInteger(optionName,optionValue,true));
break;
case SKIPTOKEN:
if (optionValue.isEmpty()) {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,optionName,optionValue);
}
systemOption=new SkipTokenOptionImpl().setValue(optionValue);
break;
case TOP:
systemOption=new TopOptionImpl().setValue(ParserHelper.parseNonNegativeInteger(optionName,optionValue,true));
break;
case EXPAND:
systemOption=new ExpandOptionImpl();
break;
case SELECT:
systemOption=new SelectOptionImpl();
break;
case FORMAT:
if (optionValue.equalsIgnoreCase(JSON) || optionValue.equalsIgnoreCase(XML) || optionValue.equalsIgnoreCase(ATOM)|| isFormatSyntaxValid(optionValue)) {
systemOption=new FormatOptionImpl().setFormat(optionValue);
}
 else {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT,optionValue);
}
break;
case ID:
if (optionValue.isEmpty()) {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,optionName,optionValue);
}
systemOption=new IdOptionImpl().setValue(optionValue);
break;
case LEVELS:
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.SYSTEM_QUERY_OPTION_LEVELS_NOT_ALLOWED_HERE);
}
((SystemQueryOptionImpl)systemOption).setText(optionValue);
return systemOption;
}
 else if (optionName.startsWith(AT)) {
return new AliasQueryOptionImpl().setName(optionName).setText(NULL.equals(optionValue) ? null : optionValue);
}
 else {
return null;
}
}

Fixed version (ground truth):
private QueryOption parseOption(final String optionName,final String optionValue) throws UriParserException, UriValidationException {
  if (optionName.startsWith(DOLLAR)) {
    final SystemQueryOptionKind kind=SystemQueryOptionKind.get(optionName);
    if (kind == null) {
      throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.UNKNOWN_SYSTEM_QUERY_OPTION,optionName);
    }
    final SystemQueryOptionImpl systemOption;
switch (kind) {
case SEARCH:
      SearchOption searchOption=new SearchParser().parse(optionValue);
    SearchOptionImpl tmp=new SearchOptionImpl();
  tmp.setSearchExpression(searchOption.getSearchExpression());
systemOption=tmp;
break;
case FILTER:
systemOption=new FilterOptionImpl();
break;
case COUNT:
if (optionValue.equals("String_Node_Str") || optionValue.equals("String_Node_Str")) {
systemOption=new CountOptionImpl().setValue(Boolean.parseBoolean(optionValue));
}
 else {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,optionName,optionValue);
}
break;
case ORDERBY:
systemOption=new OrderByOptionImpl();
break;
case SKIP:
systemOption=new SkipOptionImpl().setValue(ParserHelper.parseNonNegativeInteger(optionName,optionValue,true));
break;
case SKIPTOKEN:
if (optionValue.isEmpty()) {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,optionName,optionValue);
}
systemOption=new SkipTokenOptionImpl().setValue(optionValue);
break;
case TOP:
systemOption=new TopOptionImpl().setValue(ParserHelper.parseNonNegativeInteger(optionName,optionValue,true));
break;
case EXPAND:
systemOption=new ExpandOptionImpl();
break;
case SELECT:
systemOption=new SelectOptionImpl();
break;
case FORMAT:
if (optionValue.equalsIgnoreCase(JSON) || optionValue.equalsIgnoreCase(XML) || optionValue.equalsIgnoreCase(ATOM)|| isFormatSyntaxValid(optionValue)) {
systemOption=new FormatOptionImpl().setFormat(optionValue);
}
 else {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT,optionValue);
}
break;
case ID:
if (optionValue.isEmpty()) {
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,optionName,optionValue);
}
systemOption=new IdOptionImpl().setValue(optionValue);
break;
case LEVELS:
throw new UriParserSyntaxException("String_Node_Str",UriParserSyntaxException.MessageKeys.SYSTEM_QUERY_OPTION_LEVELS_NOT_ALLOWED_HERE);
default :
throw new UriParserSyntaxException("String_Node_Str" + kind + "String_Node_Str",UriParserSyntaxException.MessageKeys.UNKNOWN_SYSTEM_QUERY_OPTION,optionName);
}
systemOption.setText(optionValue);
return systemOption;
}
 else if (optionName.startsWith(AT)) {
return new AliasQueryOptionImpl().setName(optionName).setText(NULL.equals(optionValue) ? null : optionValue);
}
 else {
return null;
}
}