Program: 83171
Project: 83171
Buggy source:
/** 
 * An example of how you could integrate GWTs RPC functionality without using the   {@link com.google.gwt.user.server.rpc.RemoteServiceServlet}. Note that it also shows how mapping between and RPC interface and some other POJO could be performed.
 */
public void doPost(HttpServletRequest httpRequest,HttpServletResponse httpResponse) throws ServletException, IOException {
  String payload=readPayloadAsUtf8(httpRequest);
  try {
    RPCRequest rpcRequest=RPC.decodeRequest(payload);
    Object targetInstance=getInstanceToHandleRequest(httpRequest,rpcRequest);
    Method targetMethod=maybeMapRequestedMethod(targetInstance,rpcRequest.getMethod());
    Object[] targetParameters=maybeMapParameters(rpcRequest.getParameters());
    try {
      Object result=targetMethod.invoke(targetInstance,targetParameters);
      result=maybeMapResult(rpcRequest.getMethod(),result);
      String encodedResult=RPC.encodeResponseForSuccess(rpcRequest.getMethod(),result);
      sendResponseForSuccess(httpResponse,encodedResult);
    }
 catch (    IllegalArgumentException e) {
      SecurityException securityException=new SecurityException("String_Node_Str" + targetMethod);
      securityException.initCause(e);
      throw securityException;
    }
catch (    IllegalAccessException e) {
      SecurityException securityException=new SecurityException("String_Node_Str" + targetMethod + (targetInstance != null ? "String_Node_Str" + targetInstance : "String_Node_Str"));
      securityException.initCause(e);
      throw securityException;
    }
catch (    InvocationTargetException e) {
      Throwable cause=e.getCause();
      Throwable mappedThrowable=maybeMapThrowable(cause,rpcRequest.getMethod());
      String failurePayload=RPC.encodeResponseForFailure(rpcRequest.getMethod(),mappedThrowable);
      sendResponseForFailure(httpResponse,failurePayload);
    }
  }
 catch (  Throwable e) {
    sendResponseForGenericFailure(httpResponse);
  }
}

Fixed version (ground truth):
/** 
 * An example of how you could integrate GWTs RPC functionality without using the   {@link com.google.gwt.user.server.rpc.RemoteServiceServlet}. Note that it also shows how mapping between and RPC interface and some other POJO could be performed.
 */
public void doPost(HttpServletRequest httpRequest,HttpServletResponse httpResponse) throws ServletException, IOException {
  String payload=readPayloadAsUtf8(httpRequest);
  try {
    try {
      RPCRequest rpcRequest=RPC.decodeRequest(payload);
      Object targetInstance=getInstanceToHandleRequest(httpRequest,rpcRequest);
      Method targetMethod=maybeMapRequestedMethod(targetInstance,rpcRequest.getMethod());
      Object[] targetParameters=maybeMapParameters(rpcRequest.getParameters());
      try {
        Object result=targetMethod.invoke(targetInstance,targetParameters);
        result=maybeMapResult(rpcRequest.getMethod(),result);
        String encodedResult=RPC.encodeResponseForSuccess(rpcRequest.getMethod(),result);
        sendResponseForSuccess(httpResponse,encodedResult);
      }
 catch (      IllegalArgumentException e) {
        SecurityException securityException=new SecurityException("String_Node_Str" + targetMethod);
        securityException.initCause(e);
        throw securityException;
      }
catch (      IllegalAccessException e) {
        SecurityException securityException=new SecurityException("String_Node_Str" + targetMethod + (targetInstance != null ? "String_Node_Str" + targetInstance : "String_Node_Str"));
        securityException.initCause(e);
        throw securityException;
      }
catch (      InvocationTargetException e) {
        Throwable cause=e.getCause();
        Throwable mappedThrowable=maybeMapThrowable(cause,rpcRequest.getMethod());
        String failurePayload=RPC.encodeResponseForFailure(rpcRequest.getMethod(),mappedThrowable);
        sendResponseForFailure(httpResponse,failurePayload);
      }
    }
 catch (    IncompatibleRemoteServiceException e) {
      sendResponseForFailure(httpResponse,RPC.encodeResponseForFailure(null,e));
    }
  }
 catch (  Throwable e) {
    sendResponseForGenericFailure(httpResponse);
  }
}