TypeMismatchException中获取到参数错误类型

@param e
8826
private ModelAndView getParamErrors(TypeMismatchException e) {

        Throwable t = e.getCause();

        if (t instanceof ConversionFailedException) {

            ConversionFailedException x = (ConversionFailedException) t;
            TypeDescriptor type = x.getTargetType();
            Annotation[] annotations = type != null ? type.getAnnotations() : new Annotation[0];
            Map<String, String> errors = new HashMap<String, String>();
            for (Annotation a : annotations) {
                if (a instanceof RequestParam) {
                    errors.put(((RequestParam) a).value(), "parameter type error!");
                }
            }
            if (errors.size() > 0) {
                return paramError(errors, ErrorCode.TYPE_MIS_MATCH);
            }
        }

        JsonObjectBase jsonObject = JsonObjectUtils.buildGlobalError("parameter type error!", ErrorCode.TYPE_MIS_MATCH);
        return JsonObjectUtils.JsonObjectError2ModelView((JsonObjectError) jsonObject);
    }
950779
public void error(Throwable e) {
		out.println(new Date()+" ERROR:" +e.getMessage());
		e.printStackTrace(out);
	}
1066504
public void exception(CharSequence message, Throwable e) {
    log(Level.SEVERE, message, e);
  }
39646
private static void checkPartForTextType(HashMap<String, Collection<String>> bodies, Part part) throws IOException, MessagingException {
        Object content = part.getContent();
        if (content instanceof CharSequence) {
            String ct = part.getContentType();
            Collection<String> value = bodies.get(ct);
            if (value != null) {
                value.add(content.toString());
            } else {
                value = new LinkedList<>();
                value.add(content.toString());
                bodies.put(ct, value);
            }
        } else if (content instanceof Multipart) {
            Multipart mp = (Multipart) content;
            for(int i = 0; i < mp.getCount(); i++) {
                checkPartForTextType(bodies, mp.getBodyPart(i));
            }
        }
    }
952585
public final void mSEMI() throws RecognitionException {
        try {
            int _type = SEMI;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:128:5: ( ';' )
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:128:16: ';'
            {
            match(';'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        	// do for sure before leaving
        }
    }
531365
public void error(CharSequence message, Throwable e) {
    log(Level.SEVERE, message, e);
  }
713547
@Transactional(readOnly = true)
    public void validateToken(E token) throws Exception {

        if (token == null) {
            throw new Exception("The provided token is null.");
        }

        DateTime expirationDate = (DateTime) token.getExpirationDate();

        String tokenValue = token.getToken();

        // check if the token expire date is valid
        if (expirationDate.isBeforeNow()) {
            throw new Exception("The token '" + tokenValue + "' expired on '"
                + expirationDate + "'");
        }

    }
733594
@Requires("e != null")
  @Ensures("result != null")
  private Boolean isContractedType(TypeElement e) {
    Boolean result = Boolean.FALSE;

    /* The current element has contracts on its annotations. */
    result = hasContracts(e.getAnnotationMirrors());

    /* Checks superclass. */
    if (!result) {
      Element superclass =
          utils.typeUtils.asElement(e.getSuperclass());
      if (superclass != null) {
        /* Scans up in the syntax tree looking for contract annotations. */
        result = superclass.accept(this, null);
      }
    }

    /* Checks interfaces. */
    if (!result) {
      Collection<? extends TypeMirror> interfaces = e.getInterfaces();
      for (TypeMirror i : interfaces) {
        Element iface = utils.typeUtils.asElement(i);
        result = iface.accept(this, null);
        if (result) {
          break;
        }
      }
    }

    /* Scan the enclosed elements of this. */
    if (!result) {
      List<? extends Element> enclosed = e.getEnclosedElements();
      for (Element element : enclosed) {
        result = element.accept(this, null);
        if (result) {
          break;
        }
      }
    }

    return result;
  }
1252435
protected SofaRpcException convertToRpcException(InvocationTargetException e) {
        SofaRpcException exception;
        Throwable ie = e.getCause(); // 包装的原因
        if (ie != null) {
            Throwable realException = ie.getCause(); // 真正的原因
            if (realException != null) {
                if (realException instanceof SocketTimeoutException) {
                    exception = new SofaRpcException(RpcErrorType.CLIENT_TIMEOUT, "Client read timeout!", realException);
                } else if (realException instanceof ConnectException) {
                    open = false;
                    exception = new SofaRpcException(RpcErrorType.CLIENT_NETWORK,
                        "Connect to remote " + transportConfig.getProviderInfo()
                            + " error!", realException);
                } else {
                    exception = new SofaRpcException(RpcErrorType.CLIENT_UNDECLARED_ERROR,
                        "Send message to remote catch error: " + realException.getMessage(), realException);
                }
            } else {
                exception = new SofaRpcException(RpcErrorType.CLIENT_UNDECLARED_ERROR,
                    "Send message to remote catch error: " + ie.getMessage(), ie);
            }
        } else {
            exception = new SofaRpcException(RpcErrorType.CLIENT_UNDECLARED_ERROR,
                "Send message to remote catch error: " + e.getMessage(), e);
        }
        return exception;
    }
1042450
public final void mEXPONENT() throws RecognitionException {
		try {
			// hql.g:871:2: ( ( 'e' ) ( '+' | '-' )? ( '0' .. '9' )+ )
			// hql.g:871:4: ( 'e' ) ( '+' | '-' )? ( '0' .. '9' )+
			{
			// hql.g:871:4: ( 'e' )
			// hql.g:871:5: 'e'
			{
			match('e'); if (state.failed) return;
			}

			// hql.g:871:10: ( '+' | '-' )?
			int alt21=2;
			int LA21_0 = input.LA(1);
			if ( (LA21_0=='+'||LA21_0=='-') ) {
				alt21=1;
			}
			switch (alt21) {
				case 1 :
					// hql.g:
					{
					if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
						input.consume();
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

			}

			// hql.g:871:21: ( '0' .. '9' )+
			int cnt22=0;
			loop22:
			while (true) {
				int alt22=2;
				int LA22_0 = input.LA(1);
				if ( ((LA22_0 >= '0' && LA22_0 <= '9')) ) {
					alt22=1;
				}

				switch (alt22) {
				case 1 :
					// hql.g:
					{
					if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
						input.consume();
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

				default :
					if ( cnt22 >= 1 ) break loop22;
					if (state.backtracking>0) {state.failed=true; return;}
					EarlyExitException eee = new EarlyExitException(22, input);
					throw eee;
				}
				cnt22++;
			}

			}

		}
		finally {
			// do for sure before leaving
		}
	}
1110417
public static Throwable findExceptionCause( Throwable e )
  {
    Throwable error = e;
    Throwable cause = e;
    while( (error.getCause() != null) && (error.getCause() != error) )
    {
      cause = error.getCause();
      error = cause;
    }
    return cause;
  }
1277009
private void checkType(BtrpOperand e) {
        if (!(e instanceof BtrpNumber)) {
            throw new UnsupportedOperationException(e + " must be a '" + prettyType() + "' instead of a '" + e.prettyType() + "'");
        }
    }
573950
private boolean isCheckedException(TypeMirror t) {
        return !(env.types.isAssignable(t, env.java_lang_Error)
                || env.types.isAssignable(t, env.java_lang_RuntimeException));
    }
519346
public static String stringifyException(final Throwable e) {
		if (e == null) {
			return STRINGIFIED_NULL_EXCEPTION;
		}

		try {
			StringWriter stm = new StringWriter();
			PrintWriter wrt = new PrintWriter(stm);
			e.printStackTrace(wrt);
			wrt.close();
			return stm.toString();
		}
		catch (Throwable t) {
			return e.getClass().getName() + " (error while printing stack trace)";
		}
	}
1263784
public static void exception(TraceComponent tc, Exception e) {
    if(isTracing()) SibTr.exception(tc, e);

  }
1359340
public final void mDecimalLiteral() throws RecognitionException {
		try {
			int _type = DecimalLiteral;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:16: ( ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )? )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )?
			{
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) )
			int alt5=2;
			int LA5_0 = input.LA(1);
			if ( (LA5_0=='0') ) {
				alt5=1;
			}
			else if ( ((LA5_0 >= '1' && LA5_0 <= '9')) ) {
				alt5=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 5, 0, input);
				throw nvae;
			}

			switch (alt5) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:19: '0'
					{
					match('0'); 
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:25: NonZeroDigit ( ( Digits )? | Underscores Digits )
					{
					mNonZeroDigit(); 

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:38: ( ( Digits )? | Underscores Digits )
					int alt4=2;
					int LA4_0 = input.LA(1);
					if ( (LA4_0=='_') ) {
						alt4=2;
					}

					else {
						alt4=1;
					}

					switch (alt4) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )?
							{
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )?
							int alt3=2;
							int LA3_0 = input.LA(1);
							if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) {
								alt3=1;
							}
							switch (alt3) {
								case 1 :
									// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: Digits
									{
									mDigits(); 

									}
									break;

							}

							}
							break;
						case 2 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:49: Underscores Digits
							{
							mUnderscores(); 

							mDigits(); 

							}
							break;

					}

					}
					break;

			}

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:70: ( IntegerTypeSuffix )?
			int alt6=2;
			int LA6_0 = input.LA(1);
			if ( (LA6_0=='L'||LA6_0=='l') ) {
				alt6=1;
			}
			switch (alt6) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
					{
					if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
						input.consume();
					}
					else {
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

			}

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
611193
private TypeElement checkAndGetClass(Element e) throws ProcessingException {

    if (e.getKind() != ElementKind.CLASS) {
      throw new ProcessingException(e,
          "%s is annotated with @%s but only classes can be annotated with this annotation",
          e.toString(), ObjectMappable.class.getSimpleName());
    }

    return (TypeElement) e;
  }