Program: 79970
Project: 79970
Buggy source:
public static ActionDefinition reverse(String action,Map<String,Object> args){
  Map<String,Object> argsbackup=new HashMap<String,Object>(args);
  for (  Route route : routes) {
    if (route.actionPattern != null) {
      Matcher matcher=route.actionPattern.matcher(action);
      if (matcher.matches()) {
        for (        String group : route.actionArgs) {
          String v=matcher.group(group);
          if (v == null) {
            continue;
          }
          args.put(group,v.toLowerCase());
        }
        List<String> inPathArgs=new ArrayList<String>(16);
        boolean allRequiredArgsAreHere=true;
        for (        Route.Arg arg : route.args) {
          inPathArgs.add(arg.name);
          Object value=args.get(arg.name);
          if (value == null) {
            String host=route.host.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
            if (host.equals(arg.name) || host.matches(arg.name)) {
              args.put(arg.name,"String_Node_Str");
              value="String_Node_Str";
            }
 else {
              allRequiredArgsAreHere=false;
              break;
            }
          }
 else {
            if (value instanceof List<?>) {
              @SuppressWarnings("String_Node_Str") List<Object> l=(List<Object>)value;
              value=l.get(0);
            }
            if (!value.toString().startsWith("String_Node_Str") && !arg.constraint.matches(value.toString())) {
              allRequiredArgsAreHere=false;
              break;
            }
          }
        }
        for (        String staticKey : route.staticArgs.keySet()) {
          if (staticKey.equals("String_Node_Str")) {
            if (!HTTPRequestAdapter.current.get().format.equals(route.staticArgs.get("String_Node_Str"))) {
              allRequiredArgsAreHere=false;
              break;
            }
            continue;
          }
          if (!args.containsKey(staticKey) || (args.get(staticKey) == null) || !args.get(staticKey).toString().equals(route.staticArgs.get(staticKey))) {
            allRequiredArgsAreHere=false;
            break;
          }
        }
        if (allRequiredArgsAreHere) {
          StringBuilder queryString=new StringBuilder();
          String path=route.path;
          if (HTTPRequestAdapter.current.get() != null) {
            if (!HTTPRequestAdapter.current.get().servletPath.isEmpty()) {
              String servletPath=HTTPRequestAdapter.current.get().servletPath;
              path=(StringUtils.startsWith(servletPath,"String_Node_Str") ? servletPath : "String_Node_Str" + servletPath) + path;
            }
            if (!HTTPRequestAdapter.current.get().contextPath.isEmpty()) {
              String contextPath=HTTPRequestAdapter.current.get().contextPath;
              path=(StringUtils.startsWith(contextPath,"String_Node_Str") ? contextPath : "String_Node_Str" + contextPath) + path;
            }
          }
          String host=route.host;
          if (path.endsWith("String_Node_Str")) {
            path=path.substring(0,path.length() - 2);
          }
          for (          Map.Entry<String,Object> entry : args.entrySet()) {
            String key=entry.getKey();
            Object value=entry.getValue();
            if (inPathArgs.contains(key) && value != null) {
              if (List.class.isAssignableFrom(value.getClass())) {
                @SuppressWarnings("String_Node_Str") List<Object> vals=(List<Object>)value;
                try {
                  path=path.replaceAll("String_Node_Str" + key + "String_Node_Str",URLEncoder.encode(vals.get(0).toString().replace("String_Node_Str","String_Node_Str"),"String_Node_Str"));
                }
 catch (                UnsupportedEncodingException e) {
                  throw new RouteFileParsingException("String_Node_Str",e);
                }
              }
 else {
                try {
                  path=path.replaceAll("String_Node_Str" + key + "String_Node_Str",URLEncoder.encode(value.toString().replace("String_Node_Str","String_Node_Str"),"String_Node_Str"));
                  host=host.replaceAll("String_Node_Str" + key + "String_Node_Str",URLEncoder.encode(value.toString().replace("String_Node_Str","String_Node_Str"),"String_Node_Str"));
                }
 catch (                UnsupportedEncodingException e) {
                  throw new RouteFileParsingException("String_Node_Str",e);
                }
              }
            }
 else             if (route.staticArgs.containsKey(key)) {
            }
 else             if (value != null) {
              if (List.class.isAssignableFrom(value.getClass())) {
                @SuppressWarnings("String_Node_Str") List<Object> vals=(List<Object>)value;
                for (                Object object : vals) {
                  try {
                    queryString.append(URLEncoder.encode(key,"String_Node_Str"));
                    queryString.append("String_Node_Str");
                    if (object.toString().startsWith("String_Node_Str")) {
                      queryString.append(object.toString());
                    }
 else {
                      queryString.append(URLEncoder.encode(object.toString() + "String_Node_Str","String_Node_Str"));
                    }
                    queryString.append("String_Node_Str");
                  }
 catch (                  UnsupportedEncodingException ex) {
                  }
                }
              }
 else {
                try {
                  queryString.append(URLEncoder.encode(key,"String_Node_Str"));
                  queryString.append("String_Node_Str");
                  if (value.toString().startsWith("String_Node_Str")) {
                    queryString.append(value.toString());
                  }
 else {
                    queryString.append(URLEncoder.encode(value.toString() + "String_Node_Str","String_Node_Str"));
                  }
                  queryString.append("String_Node_Str");
                }
 catch (                UnsupportedEncodingException ex) {
                }
              }
            }
          }
          String qs=queryString.toString();
          if (qs.endsWith("String_Node_Str")) {
            qs=qs.substring(0,qs.length() - 1);
          }
          ActionDefinition actionDefinition=new ActionDefinition();
          actionDefinition.url=qs.length() == 0 ? path : path + "String_Node_Str" + qs;
          actionDefinition.method=route.method == null || route.method.equals("String_Node_Str") ? "String_Node_Str" : route.method.toUpperCase();
          actionDefinition.star="String_Node_Str".equals(route.method);
          actionDefinition.action=action;
          actionDefinition.args=argsbackup;
          actionDefinition.host=host;
          return actionDefinition;
        }
      }
    }
  }
  throw new NoHandlerFoundException(action,args);
}

Fixed version (ground truth):
public static ActionDefinition reverse(String action,Map<String,Object> args){
  Map<String,Object> argsbackup=new HashMap<String,Object>(args);
  for (  Route route : routes) {
    if (route.actionPattern != null) {
      Matcher matcher=route.actionPattern.matcher(action);
      if (matcher.matches()) {
        for (        String group : route.actionArgs) {
          String v=matcher.group(group);
          if (v == null) {
            continue;
          }
          args.put(group,v.toLowerCase());
        }
        List<String> inPathArgs=new ArrayList<String>(16);
        boolean allRequiredArgsAreHere=true;
        for (        Route.Arg arg : route.args) {
          inPathArgs.add(arg.name);
          Object value=args.get(arg.name);
          if (value == null) {
            String host=route.host.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
            if (host.equals(arg.name) || host.matches(arg.name)) {
              args.put(arg.name,"String_Node_Str");
              value="String_Node_Str";
            }
 else {
              allRequiredArgsAreHere=false;
              break;
            }
          }
 else {
            if (value instanceof List<?>) {
              @SuppressWarnings("String_Node_Str") List<Object> l=(List<Object>)value;
              value=l.get(0);
            }
            if (!value.toString().startsWith("String_Node_Str") && !arg.constraint.matches(value.toString())) {
              allRequiredArgsAreHere=false;
              break;
            }
          }
        }
        for (        String staticKey : route.staticArgs.keySet()) {
          if (staticKey.equals("String_Node_Str")) {
            if (!HTTPRequestAdapter.current.get().format.equals(route.staticArgs.get("String_Node_Str"))) {
              allRequiredArgsAreHere=false;
              break;
            }
            continue;
          }
          if (!args.containsKey(staticKey) || (args.get(staticKey) == null) || !args.get(staticKey).toString().equals(route.staticArgs.get(staticKey))) {
            allRequiredArgsAreHere=false;
            break;
          }
        }
        if (allRequiredArgsAreHere) {
          StringBuilder queryString=new StringBuilder();
          String path=route.path;
          if (HTTPRequestAdapter.current.get() != null) {
            if (!HTTPRequestAdapter.current.get().servletPath.isEmpty() && !HTTPRequestAdapter.current.get().servletPath.equals("String_Node_Str")) {
              String servletPath=HTTPRequestAdapter.current.get().servletPath;
              path=(StringUtils.startsWith(servletPath,"String_Node_Str") ? servletPath : "String_Node_Str" + servletPath) + path;
            }
            if (!HTTPRequestAdapter.current.get().contextPath.isEmpty() && !HTTPRequestAdapter.current.get().contextPath.equals("String_Node_Str")) {
              String contextPath=HTTPRequestAdapter.current.get().contextPath;
              path=(StringUtils.startsWith(contextPath,"String_Node_Str") ? contextPath : "String_Node_Str" + contextPath) + path;
            }
          }
          String host=route.host;
          if (path.endsWith("String_Node_Str")) {
            path=path.substring(0,path.length() - 2);
          }
          for (          Map.Entry<String,Object> entry : args.entrySet()) {
            String key=entry.getKey();
            Object value=entry.getValue();
            if (inPathArgs.contains(key) && value != null) {
              if (List.class.isAssignableFrom(value.getClass())) {
                @SuppressWarnings("String_Node_Str") List<Object> vals=(List<Object>)value;
                try {
                  path=path.replaceAll("String_Node_Str" + key + "String_Node_Str",URLEncoder.encode(vals.get(0).toString().replace("String_Node_Str","String_Node_Str"),"String_Node_Str"));
                }
 catch (                UnsupportedEncodingException e) {
                  throw new RouteFileParsingException("String_Node_Str",e);
                }
              }
 else {
                try {
                  path=path.replaceAll("String_Node_Str" + key + "String_Node_Str",URLEncoder.encode(value.toString().replace("String_Node_Str","String_Node_Str"),"String_Node_Str"));
                  host=host.replaceAll("String_Node_Str" + key + "String_Node_Str",URLEncoder.encode(value.toString().replace("String_Node_Str","String_Node_Str"),"String_Node_Str"));
                }
 catch (                UnsupportedEncodingException e) {
                  throw new RouteFileParsingException("String_Node_Str",e);
                }
              }
            }
 else             if (route.staticArgs.containsKey(key)) {
            }
 else             if (value != null) {
              if (List.class.isAssignableFrom(value.getClass())) {
                @SuppressWarnings("String_Node_Str") List<Object> vals=(List<Object>)value;
                for (                Object object : vals) {
                  try {
                    queryString.append(URLEncoder.encode(key,"String_Node_Str"));
                    queryString.append("String_Node_Str");
                    if (object.toString().startsWith("String_Node_Str")) {
                      queryString.append(object.toString());
                    }
 else {
                      queryString.append(URLEncoder.encode(object.toString() + "String_Node_Str","String_Node_Str"));
                    }
                    queryString.append("String_Node_Str");
                  }
 catch (                  UnsupportedEncodingException ex) {
                  }
                }
              }
 else {
                try {
                  queryString.append(URLEncoder.encode(key,"String_Node_Str"));
                  queryString.append("String_Node_Str");
                  if (value.toString().startsWith("String_Node_Str")) {
                    queryString.append(value.toString());
                  }
 else {
                    queryString.append(URLEncoder.encode(value.toString() + "String_Node_Str","String_Node_Str"));
                  }
                  queryString.append("String_Node_Str");
                }
 catch (                UnsupportedEncodingException ex) {
                }
              }
            }
          }
          String qs=queryString.toString();
          if (qs.endsWith("String_Node_Str")) {
            qs=qs.substring(0,qs.length() - 1);
          }
          ActionDefinition actionDefinition=new ActionDefinition();
          actionDefinition.url=qs.length() == 0 ? path : path + "String_Node_Str" + qs;
          actionDefinition.method=route.method == null || route.method.equals("String_Node_Str") ? "String_Node_Str" : route.method.toUpperCase();
          actionDefinition.star="String_Node_Str".equals(route.method);
          actionDefinition.action=action;
          actionDefinition.args=argsbackup;
          actionDefinition.host=host;
          return actionDefinition;
        }
      }
    }
  }
  throw new NoHandlerFoundException(action,args);
}