Program: 153604
Project: 153604
Buggy source:
public boolean handle(Throwable e,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  try {
    if (!(e instanceof PathNotFoundException)) {
      return false;
    }
    URLResolver urlResolver=urlResolverFactory.createURLResolver(request.getPathInfo(),request.getServerName(),request);
    JCRNodeWrapper pageNode;
    String parentPath=StringUtils.substringBeforeLast(urlResolver.getPath(),"String_Node_Str");
    String newName=StringUtils.substringAfterLast(urlResolver.getPath(),"String_Node_Str");
    newName=StringUtils.substringBefore(newName,"String_Node_Str");
    JCRSessionWrapper session=JCRSessionFactory.getInstance().getCurrentUserSession(urlResolver.getWorkspace(),urlResolver.getLocale());
    try {
      JCRNodeWrapper parent=session.getNode(parentPath);
      if (parent.isNodeType("String_Node_Str")) {
        pageNode=parent;
      }
 else {
        pageNode=JCRContentUtils.getParentOfType(parent,"String_Node_Str");
      }
      boolean isWiki=false;
      if (pageNode != null && pageNode.hasProperty("String_Node_Str")) {
        NodeIterator iterator=JCRContentUtils.getDescendantNodes((JCRNodeWrapper)pageNode.getProperty("String_Node_Str").getNode(),"String_Node_Str");
        if (iterator.hasNext()) {
          isWiki=true;
        }
      }
      if (pageNode == null || !isWiki) {
        return false;
      }
      try {
        JCRNodeWrapper node=pageNode.getNode(newName);
        String link=request.getContextPath() + request.getServletPath() + "String_Node_Str"+ StringUtils.substringBefore(request.getPathInfo().substring(1),"String_Node_Str")+ "String_Node_Str"+ urlResolver.getWorkspace()+ "String_Node_Str"+ urlResolver.getLocale()+ node.getPath();
        link+="String_Node_Str";
        response.sendRedirect(link);
      }
 catch (      PathNotFoundException e1) {
        if (null != pageNode) {
          String link=request.getContextPath() + request.getServletPath() + "String_Node_Str"+ StringUtils.substringBefore(request.getPathInfo().substring(1),"String_Node_Str")+ "String_Node_Str"+ urlResolver.getWorkspace()+ "String_Node_Str"+ urlResolver.getLocale()+ pageNode.getPath();
          String wikiTitle=request.getParameter("String_Node_Str") != null ? request.getParameter("String_Node_Str") : URLEncoder.encode(newName,"String_Node_Str");
          link+="String_Node_Str" + URLEncoder.encode(newName,"String_Node_Str") + "String_Node_Str"+ URLEncoder.encode(wikiTitle,"String_Node_Str");
          response.sendRedirect(link);
          return true;
        }
        logger.debug("String_Node_Str",e1);
      }
    }
 catch (    PathNotFoundException e1) {
      return false;
    }
  }
 catch (  Exception e1) {
    logger.error(e1.getMessage(),e1);
  }
  return false;
}

Fixed version (ground truth):
public boolean handle(Throwable e,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  try {
    if (!(e instanceof PathNotFoundException)) {
      return false;
    }
    URLResolver urlResolver=urlResolverFactory.createURLResolver(request.getPathInfo(),request.getServerName(),request);
    JCRNodeWrapper pageNode;
    String parentPath=StringUtils.substringBeforeLast(urlResolver.getPath(),"String_Node_Str");
    String newName=StringUtils.substringAfterLast(urlResolver.getPath(),"String_Node_Str");
    newName=StringUtils.substringBefore(newName,"String_Node_Str");
    JCRSessionWrapper session=JCRSessionFactory.getInstance().getCurrentUserSession(urlResolver.getWorkspace(),urlResolver.getLocale());
    try {
      JCRNodeWrapper parent=session.getNode(parentPath);
      if (parent.isNodeType("String_Node_Str")) {
        pageNode=parent;
      }
 else {
        pageNode=JCRContentUtils.getParentOfType(parent,"String_Node_Str");
      }
      boolean isWiki=false;
      if (pageNode != null && pageNode.hasProperty("String_Node_Str")) {
        String query="String_Node_Str" + pageNode.getPropertyAsString("String_Node_Str") + "String_Node_Str";
        QueryWrapper q=session.getWorkspace().getQueryManager().createQuery(query,Query.JCR_SQL2);
        QueryResultWrapper result=q.execute();
        if (result.getNodes().hasNext() && JCRContentUtils.getDescendantNodes((JCRNodeWrapper)result.getNodes().next(),"String_Node_Str").hasNext()) {
          isWiki=true;
        }
      }
      if (pageNode == null || !isWiki) {
        return false;
      }
      try {
        JCRNodeWrapper node=pageNode.getNode(newName);
        String link=request.getContextPath() + request.getServletPath() + "String_Node_Str"+ StringUtils.substringBefore(request.getPathInfo().substring(1),"String_Node_Str")+ "String_Node_Str"+ urlResolver.getWorkspace()+ "String_Node_Str"+ urlResolver.getLocale()+ node.getPath();
        link+="String_Node_Str";
        response.sendRedirect(link);
      }
 catch (      PathNotFoundException e1) {
        if (null != pageNode) {
          String link=request.getContextPath() + request.getServletPath() + "String_Node_Str"+ StringUtils.substringBefore(request.getPathInfo().substring(1),"String_Node_Str")+ "String_Node_Str"+ urlResolver.getWorkspace()+ "String_Node_Str"+ urlResolver.getLocale()+ pageNode.getPath();
          String wikiTitle=request.getParameter("String_Node_Str") != null ? request.getParameter("String_Node_Str") : URLEncoder.encode(newName,"String_Node_Str");
          link+="String_Node_Str" + URLEncoder.encode(newName,"String_Node_Str") + "String_Node_Str"+ URLEncoder.encode(wikiTitle,"String_Node_Str");
          response.sendRedirect(link);
          return true;
        }
        logger.debug("String_Node_Str",e1);
      }
    }
 catch (    PathNotFoundException e1) {
      return false;
    }
  }
 catch (  Exception e1) {
    logger.error(e1.getMessage(),e1);
  }
  return false;
}