Java 类com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException 实例源码

项目:gwt-syncproxy    文件:SyncClientSerializationStreamReader.java   
@Override
public void prepareToRead(String encoded) throws SerializationException {
    encoded = deconcat(encoded);
    parse(encoded);
    this.index = this.results.size();
    super.prepareToRead(encoded);

    if (getVersion() < SERIALIZATION_STREAM_MIN_VERSION
            || getVersion() > SERIALIZATION_STREAM_VERSION) {
        throw new IncompatibleRemoteServiceException(
                "Expecting version between "
                        + SERIALIZATION_STREAM_MIN_VERSION + " and "
                        + SERIALIZATION_STREAM_VERSION
                        + " from server, got " + getVersion() + ".");
    }

    buildStringTable();
}
项目:aggregate    文件:GWTAccessDeniedHandlerImpl.java   
/**
 * This is taken from GWT 2.4 sources.  The changed code was to, rather than 
 * call the actual XxxxServer method that would have handled the request, 
 * simply encode an AccessDeniedException as the failure response for the request.
 * 
 * Revisions to newer GWT versions should verify that this code is still
 * suitable for those newer GWT versions.
 */
@Override
public String processCall(String payload) throws SerializationException {
    try {
        RPCRequest rpcRequest = RPC.decodeRequest(payload);
        onAfterRequestDeserialized(rpcRequest);
        // ******* CHANGED GWT 2.4 CODE STARTS
        LogFactory.getLog(GWTAccessDeniedHandlerImpl.class).warn("GWT Method: " 
                    + rpcRequest.getMethod().getName() + " Exception: " + e.getMessage());
        return RPC
                .encodeResponseForFailure(
                        rpcRequest.getMethod(),
                        new org.opendatakit.common.security.client.exception.AccessDeniedException(
                                e));
        // ******** CHANGED GWT 2.4 CODE ENDS
    } catch (IncompatibleRemoteServiceException ex) {
        LogFactory.getLog(GWTAccessDeniedHandlerImpl.class).warn("An IncompatibleRemoteServiceException was thrown while processing this call.",
                ex);
        return RPC.encodeResponseForFailure(null, ex);
    }
}
项目:qafe-platform    文件:ExceptionUtil.java   
public static String getMessage(Throwable caught, String message) {
    String messageBody = "";
    try {
        throw caught;
    } catch (IncompatibleRemoteServiceException incompatibleException) {
        messageBody = "This application is out of date, please click the refresh button on your browser.";
    } catch (InvocationException  invocationException) {

        messageBody =  "The network connection to the server is temporarily unavailable.Please retry or refresh the browser. If the problem still exists please contact your support team.";                        
    } catch (GWTApplicationStoreException  gwtApplicationStoreException) {

        messageBody =  "Please refresh the browser. If the problem still exists please contact your support team.";                     
    } 
    catch (Throwable te) {
        messageBody = message;      
    } 
    return messageBody;
}
项目:PortlandStateJava    文件:GuiceRemoteServiceServlet.java   
@Override
public String processCall(String payload) throws SerializationException {
  try {
    RPCRequest req = RPC.decodeRequest(payload, null, this);

    RemoteService service = getServiceInstance(req.getMethod().getDeclaringClass());

    return RPC.invokeAndEncodeResponse(service, req.getMethod(),
      req.getParameters(), req.getSerializationPolicy());

  } catch (IncompatibleRemoteServiceException ex) {
    log("IncompatibleRemoteServiceException in the processCall(String) method.",
        ex);
    return RPC.encodeResponseForFailure(null, ex);
  }
}
项目:appinventor-extensions    文件:OdeAsyncCallback.java   
@Override
public void onFailure(Throwable caught) {
  if (caught instanceof IncompatibleRemoteServiceException) {
    ErrorReporter.reportError("App Inventor has just been upgraded, you will need to press the reload button in your browser window");
    return;
  }
  if (caught instanceof InvalidSessionException) {
    Ode.getInstance().invalidSessionDialog();
    return;
  }
  if (caught instanceof ChecksumedFileException) {
    Ode.getInstance().corruptionDialog();
    return;
  }
  if (caught instanceof BlocksTruncatedException) {
    OdeLog.log("Caught BlocksTruncatedException");
    ErrorReporter.reportError("Caught BlocksTruncatedException");
    return;
  }
  // SC_PRECONDITION_FAILED if our session has expired or login cookie
  // has become invalid
  if ((caught instanceof StatusCodeException) &&
    ((StatusCodeException)caught).getStatusCode() == Response.SC_PRECONDITION_FAILED) {
    Ode.getInstance().sessionDead();
    return;
  }
  String errorMessage =
      (failureMessage == null) ? caught.getMessage() : failureMessage;
  ErrorReporter.reportError(errorMessage);
  OdeLog.elog("Got exception: " + caught.getMessage());
  Throwable cause = caught.getCause();
  if (cause != null) {
    OdeLog.elog("Caused by: " + cause.getMessage());
  }
}
项目:fullmetalgalaxy    文件:FmpCallback.java   
@Override
public void onFailure(Throwable p_caught)
{
  // AppMain.instance().stopLoading();

  if( p_caught != null )
  {
    RpcUtil.logError( p_caught.getMessage(), p_caught );
  }

  if( p_caught instanceof RpcFmpException )
  {
    MAppMessagesStack.s_instance.showWarning( ((RpcFmpException)p_caught).getLocalizedMessage() );
  }
  else if( p_caught instanceof SerializationException
      || p_caught instanceof IncompatibleRemoteServiceException )
  {
    Window.alert( MAppBoard.s_messages.wrongGameVersion() );
    ClientUtil.reload();
  }
  else
  {
    // lets try it: don't display error to not confuse user...
    MAppMessagesStack.s_instance.showWarning( MAppBoard.s_messages.unknownError() );
  }

}
项目:mythpodcaster    文件:GWTController.java   
public String processCall(String payload) throws SerializationException {
  try {

    RPCRequest rpcRequest = RPC.decodeRequest(payload, this.remoteServiceClass);

    return RPC.invokeAndEncodeResponse(this.remoteService, rpcRequest.getMethod(),
        rpcRequest.getParameters());
  } catch (IncompatibleRemoteServiceException ex) {
    LOGGER.warn("An IncompatibleRemoteServiceException was thrown while processing this call.",
        ex);
    return RPC.encodeResponseForFailure(null, ex);
  }
}
项目:kaa    文件:Utils.java   
/**
 * Exception handler.
 */
public static void handleException(Throwable caught,
                                   HasErrorMessage hasErrorMessage,
                                   ErrorMessageCustomizer errorMessageCustomizer) {
  boolean handled = false;
  if (caught instanceof StatusCodeException) {
    StatusCodeException sce = (StatusCodeException) caught;
    if (sce.getStatusCode() == Response.SC_UNAUTHORIZED) {
      onUnauthorized();
      handled = true;
    } else if (sce.getStatusCode() == 0) {
      handleNetworkConnectionError();
      handled = true;
    }
  } else if (caught instanceof IncompatibleRemoteServiceException) {
    MessageDialog.showMessageDialog(AlertPanel.Type.ERROR, constants.incompatibleRemoteService(),
        messages.incompatibleRemoteService());
    handled = true;
  }
  if (!handled) {
    String message = parseErrorMessage(caught, errorMessageCustomizer);
    String[] lines = message.split("\r\n|\r|\n");
    if (lines.length > 1 || (lines.length == 1 && lines[0].length() >= MAX_ERROR_LINE_LENGTH)) {
      MessageDialog.showMessageDialog(AlertPanel.Type.ERROR, constants.errorTitle(), message);
    } else {
      hasErrorMessage.setErrorMessage(message);
    }
  }
}
项目:wannatrak    文件:ServerRequest.java   
protected void handleFailure(Throwable caught) {
    if (caught instanceof InvocationException || caught instanceof IncompatibleRemoteServiceException) {
        if (caught instanceof StatusCodeException) {
            handleStatusCodeException(caught);
        } else {
            handleUncheckedException(caught);
        }
    } else if (caught instanceof CheckedException) {
        handleCheckedException((CheckedException) caught);
    } else {
        handleUnknownException(caught);
    }
}
项目:gwt-syncproxy    文件:RemoteServiceServlet.java   
/**
 * Process a call originating from the given request. Uses the
 * {@link RPC#invokeAndEncodeResponse(Object, java.lang.reflect.Method, Object[])}
 * method to do the actual work.
 * <p>
 * Subclasses may optionally override this method to handle the payload in any
 * way they desire (by routing the request to a framework component, for
 * instance). The {@link HttpServletRequest} and {@link HttpServletResponse}
 * can be accessed via the {@link #getThreadLocalRequest()} and
 * {@link #getThreadLocalResponse()} methods.
 * </p>
 * This is public so that it can be unit tested easily without HTTP.
 * 
 * @param payload the UTF-8 request payload
 * @return a string which encodes either the method's return, a checked
 *         exception thrown by the method, or an
 *         {@link IncompatibleRemoteServiceException}
 * @throws SerializationException if we cannot serialize the response
 * @throws UnexpectedException if the invocation throws a checked exception
 *           that is not declared in the service method's signature
 * @throws RuntimeException if the service method throws an unchecked
 *           exception (the exception will be the one thrown by the service)
 */
public String processCall(String payload) throws SerializationException {
  // First, check for possible XSRF situation
  checkPermutationStrongName();

  try {
    RPCRequest rpcRequest = RPC.decodeRequest(payload, delegate.getClass(), this);
    onAfterRequestDeserialized(rpcRequest);
    return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(),
        rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
        rpcRequest.getFlags());
  } catch (IncompatibleRemoteServiceException ex) {
    log(
        "An IncompatibleRemoteServiceException was thrown while processing this call.",
        ex);
    return RPC.encodeResponseForFailure(null, ex);
  } catch (RpcTokenException tokenException) {
    log("An RpcTokenException was thrown while processing this call.",
        tokenException);
    return RPC.encodeResponseForFailure(null, tokenException);
  }
}
项目:firefly    文件:PopupUtil.java   
public static void showSevereError(final Throwable caught) {

        String eMsg= caught == null || caught.getMessage() == null ? "unknown" : caught.getMessage();
        GWT.log(eMsg, caught);

        String msgExtra= "<span class=\"faded-text\">" +
                "<br><br>If you still continue to receive this message, contact IRSA for <a href='http://irsa.ipac.caltech.edu/applications/Helpdesk' target='_blank'>help</a>.  " +
                "<span>";
        String title = "Error";
        String msg = "An unexpected error has occurred." +
                "<br>Caused by: " + eMsg;
        String details = null;

        if (caught instanceof IncompatibleRemoteServiceException) {
            title = "Application is out of date";
            msg = "This application is out of date.  In most cases, refreshing the page will resolve the problem.";
        } else if ( caught instanceof StatusCodeException) {
            StatusCodeException scx = (StatusCodeException) caught;
            title = "Server is not available";
            details = eMsg;
            if (scx.getStatusCode() == 503) {
                msg = "The site is down for scheduled maintenance.";
                msgExtra = "";
            } else if (scx.getStatusCode() == 0) {
                title = "Server/Network is not available";
                msg = "If you are not connected to the internet, check your internet connection and try again";
            } else {
                msg = "The server encountered an unexpected condition which prevented it from fulfilling the request.<br>" +
                      "Refreshing the page may resolve the problem.";
            }
        } else if (caught instanceof RPCException) {
            RPCException ex = (RPCException)caught;
            details = ex.toHtmlString();
            if (ex.getEndUserMsg()!=null) {
                msg= ex.getEndUserMsg();
            }
        }

        showMsgWithDetails(title, msg + msgExtra, PopupType.STANDARD, details, ERROR_MSG_STYLE);

    }
项目:gwt-sl    文件:OverriddenGWTRPCServiceExporter.java   
@Override
protected String handleIncompatibleRemoteServiceException(
        IncompatibleRemoteServiceException e) throws SerializationException {
    return null;
}
项目:gwt-sl    文件:GWTRPCServiceExporter.java   
/**
 * Invoked by {@link #processCall(String)} when RPC throws an
 * {@link IncompatibleRemoteServiceException}. This implementation
 * propagates the exception back to the client via RPC.
 * 
 * @param cause
 *            Exception thrown
 * @return RPC encoded failure response
 * @throws SerializationException If problems during serialization of cause to RPC
 */
protected String handleIncompatibleRemoteServiceException(IncompatibleRemoteServiceException cause)
        throws SerializationException {
    logger.warn(cause.getMessage());
    return RPC.encodeResponseForFailure(null, cause);
}