将反射时的checked exception转换为unchecked exception.
779518
public static RuntimeException convertReflectionExceptionToUnchecked(Exception e) {
		if ((e instanceof IllegalAccessException) || (e instanceof NoSuchMethodException)) {
			return new IllegalArgumentException(e);
		} else if (e instanceof InvocationTargetException) {
			return new RuntimeException(((InvocationTargetException) e).getTargetException());
		} else if (e instanceof RuntimeException) {
			return (RuntimeException) e;
		}
		return new UncheckedException(e);
	}
1348188
protected <T> T processCheckRowCountError(Transaction t, Exception root, Throwable e, TxCallable<T> process) throws Exception {
        if (e == null) {
            throw root;
        }
        if (e instanceof OptimisticLockException) {
            if ("checkRowCount".equals(e.getStackTrace()[0].getMethodName())) {
                if (process != null)
                    return process.call(t);
            }
        }
        return processCheckRowCountError(t, root, e.getCause(), process);
    }
794975
def _catch_exceptions(self, exctype, value, tb):
        """"""

        # Now we log it.
        self.error('Uncaught exception', exc_info=(exctype, value, tb))

        # First, we print to stdout with some colouring.
        print_exception_formatted(exctype, value, tb)
919461
private static boolean mightInheritFromException(ClassDescriptor d) {
        while (d != null) {
            try {
                if ("java.lang.Exception".equals(d.getDottedClassName())) {
                    return true;
                }
                XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, d);
                d = classNameAndInfo.getSuperclassDescriptor();
            } catch (CheckedAnalysisException e) {
                return true; // don't know
            }
        }
        return false;
    }
511534
def exception(self):
        """"""
        buf = traceback.format_exception_only(self.exc_type, self.exc_value)
        rv = "".join(buf).strip()
        return to_unicode(rv, "utf-8", "replace")
501659
public <T> T runUnchecked(Retryable<T> operation) throws RuntimeException
	{
		try
		{
			return run(operation);
		}
		catch (RuntimeException e)
		{
			throw e;
		}
		catch (Exception e)
		{
			throw new RuntimeException("Retryable " + operation + " failed: " + e.getMessage(), e);
		}
	}
906274
public void check() throws ThriftConnectionPoolException {
		if (connectTimeout <= 0) {
			throw new ThriftConnectionPoolException("连接超时时间必须大于0");
		}

		// 判断是否是单接口模式 如果是则只检测单接口
		if (getThriftServiceType() == ThriftServiceType.SINGLE_INTERFACE) {
			if (clientClass == null) {
				throw new ThriftConnectionPoolException("thrift客户端实现类未设置");
			}
			// 检测ping方法
			try {
				clientClass.getMethod("ping");
			} catch (NoSuchMethodException e) {
				throw new ThriftConnectionPoolException("Thrift客户端实现类必须带有ping()方法用于检测连接");
			}
		} else if (getThriftServiceType() == ThriftServiceType.MULTIPLEXED_INTERFACE) {
			if (clientClasses.size() == 0) {
				throw new ThriftConnectionPoolException("多服务thrift客户端实现类未设置");
			}
			// 检测所有接口
			List<String> toRemoveClasses = new ArrayList<>();
			Iterator<Entry<String, Class<? extends TServiceClient>>> iterator = clientClasses.entrySet().iterator();
			while (iterator.hasNext()) {
				Entry<String, Class<? extends TServiceClient>> entry = iterator.next();
				Class<? extends TServiceClient> clazz = entry.getValue();
				try {
					clazz.getMethod("ping");
				} catch (NoSuchMethodException e) {
					toRemoveClasses.add(entry.getKey());
					logger.warn("接口：" + entry.getKey() + " 没有实现ping方法 无法创建对应的服务客户端");
				}
			}
			for (String toRemoveClass : toRemoveClasses) {
				clientClasses.remove(toRemoveClass);
			}
			Iterator<String> servicesNameIterator = clientClasses.keySet().iterator();
			while (servicesNameIterator.hasNext()) {
				logger.info("注册服务客户端：" + servicesNameIterator.next());
			}
		}

		if (maxConnectionPerServer <= 0) {
			throw new ThriftConnectionPoolException("每台服务器的最大连接数必须大于0");
		}

		if (minConnectionPerServer < 0) {
			throw new ThriftConnectionPoolException("每台服务器最小连接数不能小于0");
		}

		if (minConnectionPerServer > maxConnectionPerServer) {
			throw new ThriftConnectionPoolException("每台服务器的最小连接数不能超过最大连接数配置");
		}

		if (idleConnectionTestPeriodInSeconds <= 0) {
			throw new ThriftConnectionPoolException("检测时间周期必须大于0秒");
		}

		if (idleMaxAgeInSeconds <= 0) {
			throw new ThriftConnectionPoolException("未使用连接关闭时间必须大于0秒");
		}

		if (maxConnectionAgeInSeconds <= 0) {
			throw new ThriftConnectionPoolException("连接最大生存时间必须大于0秒");
		}

		if (acquireRetryAttempts < 0) {
			throw new ThriftConnectionPoolException("获取连接重试次数不能小于0");
		}

		if (acquireRetryDelayInMs < 0) {
			throw new ThriftConnectionPoolException("获取连接重试等待时间不能小于0毫秒");
		}

		if (connectionTimeoutInMs < 0) {
			throw new ThriftConnectionPoolException("获取连接等待时间不能小于0毫秒");
		}

		if (acquireIncrement <= 0) {
			throw new ThriftConnectionPoolException("每次创建原始连接的数量必须大于0个");
		}
	}
94389
public static <T, R, E extends Exception> R uncheck(FunctionWithExceptions<T, R, E> function, T t) {
        try {
            return function.apply(t);
        } catch (Exception exception) {
            throwAsUnchecked(exception);
            return null;
        }
    }
1230827
public void setChecked(boolean checked) {
        setChecked(checked ? CheckableDrawable.CheckedState.CHECKED : CheckableDrawable.CheckedState.UNCHECKED);
    }
1106517
public static <T> Comparator<T> comparator(CheckedComparator<T> comparator) {
        return comparator(comparator, THROWABLE_TO_RUNTIME_EXCEPTION);
    }
114293
def process_uncaught_exception(self, e):
        """"""
        # Add information about the actual exception to the log message
        # This includes the file, line and piece of code causing the exception.
        # exc_info=True adds the full stack trace to the log message.
        exc_file_fullpath, exc_file, exc_lineno, exc_func, exc_line = (
            workflows.logging.get_exception_source()
        )
        added_information = {
            "workflows_exc_lineno": exc_lineno,
            "workflows_exc_funcName": exc_func,
            "workflows_exc_line": exc_line,
            "workflows_exc_pathname": exc_file_fullpath,
            "workflows_exc_filename": exc_file,
        }
        for field in filter(lambda x: x.startswith("workflows_log_"), dir(e)):
            added_information[field[14:]] = getattr(e, field, None)
        self.log.critical(
            "Unhandled service exception: %s", e, exc_info=True, extra=added_information
        )
230270
public void waitForChecked(final long time) throws WidgetException {
        super.waitForCommand(new ITimerCallback() {

            @Override
            public boolean execute() {
                WebElement elem = null;
                try {
                    elem = getWebElement();
                } catch (WidgetException e) {

                }

                boolean isSelected = false;
                try {
                    isSelected = isSelected(elem);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
                return (elem != null && isSelected);
            }

            @Override
            public String toString() {
                return "Waiting for element with the locator: " + getByLocator() + "to be checked";
            }
        }, time);
    }
1352654
public void uncaughtException(Thread thread, Throwable throwable) {
        if (exceptionPurger != null) {
            throwable = exceptionPurger.purge(throwable);
        }
        for (ExceptionHandlerDelegate delegate : delegateList) {
            if (delegate.hasAppropriateHandler(throwable)) {
                delegate.uncaughtException(thread, throwable);
                return;
            }
        }
        // A silent exception handler should be configured if it needs to be silent
        logger.error("No exception handler found for throwable", throwable);
    }
139755
public static boolean isCheckedExceptionType(Type t, VisitorState state) {
    Symtab symtab = state.getSymtab();
    return isSubtype(t, symtab.exceptionType, state)
        && !isSubtype(t, symtab.runtimeExceptionType, state);
  }
1151962
public static void throwIfUnchecked(Throwable t) {
    Preconditions.checkNotNull(t);
    if (t instanceof RuntimeException) {
      throw (RuntimeException) t;
    }
    if (t instanceof Error) {
      throw (Error) t;
    }
  }
658626
def catches(exc, handler=re_raise):
    '''
    
    '''
    if not __CHECKING__:
        return lambda f: f

    def wrap(f):
        def call(*args, **kwd):
            try:
                ID = exc_checker.set_attention(exc)
                res = f(*args, **kwd)
                exc_checker.remove_attention(exc, ID)
                return res
            # handle checked exception
            except exc, e:
                exc_checker.remove_attention(exc, ID)
                traceback = sys.exc_info()[2]
                return handler(exc, str(e), traceback.tb_next.tb_next)
            # re-raise unchecked exception but remove checked exeption info first
            except Exception, e:
                exc_checker.remove_attention(exc, ID)
                traceback = sys.exc_info()[2]
                raise e.__class__, e.args, traceback.tb_next.tb_next
        call.__name__ = f.__name__
        return call
    return wrap
781172
public static <R> IntFunction<R> intFunction(CheckedIntFunction<R> function) {
        return intFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION);
    }