当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionUtils.getRootCauseMessage方法代码示例

本文整理汇总了Java中org.apache.commons.lang.exception.ExceptionUtils.getRootCauseMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionUtils.getRootCauseMessage方法的具体用法?Java ExceptionUtils.getRootCauseMessage怎么用?Java ExceptionUtils.getRootCauseMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.exception.ExceptionUtils的用法示例。


在下文中一共展示了ExceptionUtils.getRootCauseMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SistemaExternException

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public SistemaExternException(
		Long entornId,
		String entornCodi,
		String entornNom,
		Long expedientId, 
		String expedientTitol,
		String expedientNumero,
		Long expedientTipusId,
		String expedientTipusCodi,
		String expedientTipusNom,
		String sistemaExtern,
		Throwable cause) {
	super(	entornId,
			entornCodi,
			entornNom,
			expedientId,
			expedientTitol,
			expedientNumero,
			expedientTipusId,
			expedientTipusCodi,
			expedientTipusNom,
			"Error en la comunicació amb el sistema extern " + sistemaExtern + ": " + ExceptionUtils.getRootCauseMessage(cause),
			cause);
	this.sistemaExtern = sistemaExtern;
	this.publicMessage = "Error en la comunicació amb el sistema extern " + sistemaExtern + ": " + ExceptionUtils.getRootCauseMessage(cause);
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:27,代码来源:SistemaExternException.java

示例2: validate

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public static void validate(JSONObject formData) {
    JSONObject formDataJson = JSONObject.fromObject(formData);
    String userName;
    String password;
    String jdbcUrl;
    String driverName;
    String name;
    try {
        userName = formDataJson.getString("userName");
        password = formDataJson.getString("password");
        jdbcUrl = formDataJson.getString("jdbcUrl");
        driverName = formDataJson.getString("driverName");
        name = formDataJson.getString("name");
    } catch (Exception e) {
        throw new IncompleteFormDataException("The form data json is incomplete and lacks " +
                "required parameters. " + ExceptionUtils.getRootCauseMessage(e));
    }

    Map<String, String> parameters = new HashMap<>();
    parameters.put("userName", userName);
    parameters.put("password", password);
    parameters.put("jdbcUrl", jdbcUrl);
    parameters.put("driverName", driverName);
    parameters.put("name", name);
    checkForNullsAndEmptyParameters(parameters);
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:27,代码来源:ControllerUtils.java

示例3: doFilter

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
/**
 * Logs the stack trace to the log files with original exception that has
 * not been handled and also forwards the request to the errorPage.
 *
 * @param request  The request object
 * @param response The response object
 * @param chain    The filterChain object
 * @throws IOException      The java.io.IOException
 * @throws ServletException The javax.servlet.ServletException
 */
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
        ServletException {
    try {
        logger.info(String.format("The current request thread is %s.", Thread.currentThread()));
        chain.doFilter(request, response);
    } catch (Throwable exception) {
        logger.error("There was an exception ", exception);
        String rootCauseMessage = ExceptionUtils.getRootCauseMessage(exception);
        request.setAttribute("errorMessage", rootCauseMessage);
        if (exception instanceof RuntimeException) {
            logger.error("A Runtime Exception has occurred. The cause is " + rootCauseMessage, exception);
            throw new RuntimeException();
        }
        if (exception instanceof Exception) {
            logger.error("An Exception has occurred. The cause is " + rootCauseMessage, exception);
        } else {
            logger.error("An Error has occurred. The cause is " + rootCauseMessage, exception);
        }
        throw new RuntimeException();
    }
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:33,代码来源:ErrorInterceptorFilter.java

示例4: executeComponent

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public String executeComponent(String formData) {
    JSONObject formDataJson = JSONObject.fromObject(formData);
    String type;
    String id;
    String directory;

    try {
        type = formDataJson.getString("type");
        id = formDataJson.getString("id");
        directory = formDataJson.getString("dir");
    } catch (Exception ex) {
        throw new IncompleteFormDataException(ExceptionUtils.getRootCauseMessage(ex));
    }

    Map<String, String> parameters = new HashMap<>();
    parameters.put("id", id);
    parameters.put("type", type);
    parameters.put("dir", directory);
    ControllerUtils.checkForNullsAndEmptyParameters(parameters);

    File efwdFile = ApplicationUtilities.getEfwdFile(directory);
    JSONObject fileAsJson = getJsonOfEfwd(efwdFile);

    JSONObject efwdConnection = getEfwdConnection(fileAsJson, id, type);
    return efwdConnection.toString();
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:27,代码来源:EfwdReader.java

示例5: executeComponent

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public String executeComponent(String formData) {
    JSONObject formDataJson = JSONObject.fromObject(formData);
    String type;
    try {
        type = formDataJson.getString("type");
    } catch (Exception ex) {
        throw new IncompleteFormDataException(ExceptionUtils.getRootCauseMessage(ex));
    }

    Map<String, String> parameters = new HashMap<>();
    parameters.put("type", type);

    ControllerUtils.checkForNullsAndEmptyParameters(parameters);
    if (formDataJson.has("directory")) {
        String directory = formDataJson.getString("directory");
        formDataJson.accumulate("dir", directory);
    }
    if (formDataJson.has("id")) {
        DataSourceSecurityUtility.isDataSourceAuthenticated(formDataJson);
    }

    EfwdDataSourceHandler handler = DsTypeHandlerFactory.handler(type);

    return handler.testDS(formDataJson).toString();
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:26,代码来源:EfwdConnectionTester.java

示例6: getTableMeta

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
private TableMeta getTableMeta(String dbName, String tbName, boolean useCache) {
    try {
        return tableMetaCache.getTableMeta(dbName, tbName, useCache);
    } catch (Exception e) {
        String message = ExceptionUtils.getRootCauseMessage(e);
        if (filterTableError) {
            if (StringUtils.contains(message, "errorNumber=1146") && StringUtils.contains(message, "doesn't exist")) {
                return null;
            }
        }

        throw new CanalParseException(e);
    }
}
 
开发者ID:BriData,项目名称:DBus,代码行数:15,代码来源:LogEventConvert 原始文件.java

示例7: handleFailure

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public static void handleFailure(HttpServletResponse response, boolean isAjax,
                                 Exception exception) throws IOException {
    if (isAjax) {
        String rootCauseMessage = ExceptionUtils.getRootCauseMessage(exception);
        JSONObject theResponse = statusZeroJson(rootCauseMessage);
        logger.error("There was a problem in serving the request. The cause is " + rootCauseMessage, exception);
        handleAjaxRuntimeException(response, theResponse.toString());
    } else {
        //Now ErrorInterceptorFilter and Tomcat deal with the request
        throw new RuntimeException("Unable to process the request. Something went terribly " + "wrong.", exception);
    }
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:13,代码来源:ControllerUtils.java

示例8: executeComponent

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public String executeComponent(String formData) {
    JSONObject formDataJson = JSONObject.fromObject(formData);
    Map<String, String> parameters = new HashMap<>();

    String dataSourceProvider = formDataJson.getString("dataSourceProvider");
    String id = formDataJson.getString("id");
    String type = formDataJson.getString("type");

    parameters.put("id", id);
    parameters.put("type", type);
    parameters.put("dataSourceProvider", dataSourceProvider);
    ControllerUtils.checkForNullsAndEmptyParameters(parameters);

    if (!"jndi".equalsIgnoreCase(dataSourceProvider)) {
        ControllerUtils.validate(formDataJson);
    }

    try {
        String message = marshal(dataSourceProvider, id, formDataJson, "edit");
        if (logger.isDebugEnabled()) {
            logger.debug("The update status of the global xml is " + message);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new EfwServiceException("The data source could not be updated with the new details. Cause " +
                ExceptionUtils.getRootCauseMessage(ex));
    }

    if (logger.isDebugEnabled()) {
        logger.debug("The data source is updated with the new details successfully.");
    }

    JSONObject model;
    model = new JSONObject();
    model.accumulate("message", "The data source is updated with the new details successfully.");
    return model.toString();
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:39,代码来源:GlobalXmlUpdateHandler.java

示例9: testDS

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public JSONObject testDS(JSONObject json) {
    JSONObject model;
    model = new JSONObject();

    JSONObject formDataJson = JSONObject.fromObject(json);
    String url;
    String userName;
    String password;
    String driverName;
    try {
        url = formDataJson.getString("jdbcUrl");
        userName = formDataJson.getString("userName");
        password = formDataJson.getString("password");
        driverName = formDataJson.getString("driverName");
    } catch (Exception ex) {
        throw new IncompleteFormDataException(ExceptionUtils.getRootCauseMessage(ex));
    }

    Map<String, String> parameters = new HashMap<>();
    parameters.put("jdbcUrl", url);
    parameters.put("userName", userName);
    parameters.put("password", password);
    parameters.put("driverName", driverName);

    ControllerUtils.checkForNullsAndEmptyParameters(parameters);

    EfwdConnection efwdConnection = getEfwdConnection(url, userName, password, driverName);

    Connection connection = efwdConnection.getConnection();
    if (connection != null) {
        model.accumulate("message", "The connection test is successful");
        DbUtils.closeQuietly(connection);
    }

    return model;
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:38,代码来源:SqlJdbcHandler.java

示例10: testDS

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public JSONObject testDS(JSONObject json) {
    JSONObject response;
    response = new JSONObject();

    JSONObject formDataJson = JSONObject.fromObject(json);
    String model;
    String driverName;
    try {
        model = formDataJson.getString("model");
        driverName = formDataJson.getString("driverName");
    } catch (Exception ex) {
        throw new IncompleteFormDataException(ExceptionUtils.getRootCauseMessage(ex));
    }

    Map<String, String> parameters = new HashMap<>();
    parameters.put("model", model);
    parameters.put("driverName", driverName);

    ControllerUtils.checkForNullsAndEmptyParameters(parameters);

    CalciteConnectionProvider connectionProvider = ApplicationContextAccessor.getBean(CalciteConnectionProvider
            .class);

    Connection connection = connectionProvider.getConnection(model);
    if (connection != null) {
        response.accumulate("message", "The connection test is successful");
        DbUtils.closeQuietly(connection);
    } else {
        throw new EfwdServiceException("Couldn't get connection.");
    }

    return response;
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:35,代码来源:SqlCalciteHandler.java

示例11: toResponse

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
/**
* Converts RMap Transform API Exceptions to HTTP responses.
*
* @param exception the exception
* @return the HTTP response for the exception
*/
  @Override
  public Response toResponse(RMapApiException exception)
  {
  	//to build up the error message
  	StringBuilder errMsg = new StringBuilder();
  	
  	Status errType = null;
  	String exMsg = null;
  	String rmapApiMsg = null;
  	
  	ErrorCode errorCode = exception.getErrorCode();
  	if (errorCode != null){
   	errType = errorCode.getStatus();
   	rmapApiMsg = errorCode.getMessage();
   	exMsg = exception.getMessage();
  	}
  	
  	//set default error status as 500
  	if (errType == null)	{
  		errType = Status.INTERNAL_SERVER_ERROR;
  	}
  	
  	//append message associated with RMap API error code
  	if (rmapApiMsg != null && rmapApiMsg.length()>0)	{
  		errMsg.append(rmapApiMsg);
  	}
	
  	String rootCause = ExceptionUtils.getRootCauseMessage(exception);
  	
  	//append system message (typically relevant where non-RMapApiException thrown)
  	//only if rootCause isn't same message!
  	if (exMsg != null && exMsg.length()>0 && !rootCause.contains(exMsg))	{
  		if (errMsg.length()>0){
  			errMsg.append("; ");
  		}
  		errMsg.append(exMsg);
  	}

  	//Append root cause message
  	if (rootCause != null && rootCause.length()>0)	{
  		if (errMsg.length()>0){
  			errMsg.append("; ");
  		}
  		errMsg.append(rootCause);
  	}    	
  	
  	Response response = null;
  	if (errType==Status.CONFLICT){
  		//extract redirect URL
  		try {
		String discoUrl = exMsg;
		discoUrl = discoUrl.substring(discoUrl.lastIndexOf("<") + 1, discoUrl.lastIndexOf(">"));
		discoUrl = pathUtils.makeDiscoUrl(discoUrl);
   		response = Response.status(errType)
    						.link(new URI(discoUrl), "latest-version") 
    						.type("text/plain")
    						.entity(errMsg.toString()).build(); 
	} catch (Exception e) {
		// continue... we are already handling an error!
	}   		
  	}

  	if (response==null){
  		//no redirect URL
  		response = Response.status(errType).type("text/plain").entity(errMsg.toString()).build(); 
  	}
	
  	LOG.error(errMsg.toString(), exception);
  	return response;
  }
 
开发者ID:rmap-project,项目名称:rmap,代码行数:77,代码来源:RMapApiExceptionHandler.java

示例12: getPublicMessage

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public String getPublicMessage() {
	return "Error de tramitació. " + ExceptionUtils.getRootCauseMessage(this.getCause());
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:4,代码来源:TramitacioException.java

示例13: getPublicMessage

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public String getPublicMessage() {
	return "Error de tramitació en l'execució del Handler. " + ExceptionUtils.getRootCauseMessage(this.getCause());
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:4,代码来源:TramitacioHandlerException.java

示例14: IndexacioException

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
public IndexacioException(
		String message,
		Throwable cause) {
	super(message + ". " + ExceptionUtils.getRootCauseMessage(cause), cause);
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:6,代码来源:IndexacioException.java

示例15: executeComponent

import org.apache.commons.lang.exception.ExceptionUtils; //导入方法依赖的package包/类
@Override
public String executeComponent(String formData) {
    JSONObject formDataJson = JSONObject.fromObject(formData);

    String name;
    String type;
    String directory;
    String driverName;
    String url;
    String userName;
    String password;

    try {
        directory = formDataJson.getString("directory");
        type = formDataJson.getString("type");

        userName = formDataJson.getString("userName");
        password = formDataJson.getString("password");
        url = formDataJson.getString("jdbcUrl");
        driverName = formDataJson.getString("driverName");
        name = formDataJson.getString("name");
    } catch (Exception ex) {
        throw new IncompleteFormDataException(ExceptionUtils.getRootCauseMessage(ex));
    }

    Map<String, String> parameters = new HashMap<>();
    parameters.put("name", name);
    parameters.put("type", type);
    parameters.put("directory", directory);
    parameters.put("driverName", driverName);
    parameters.put("jdbcUrl", url);
    parameters.put("userName", userName);
    parameters.put("password", password);

    ControllerUtils.checkForNullsAndEmptyParameters(parameters);

    EfwdWriterUtility utility = new EfwdWriterUtility(name, type, directory, driverName, url, userName, password);

    JSONObject model;
    model = new JSONObject();
    try {
        utility.write();
        model.accumulate("message", "The data source has been saved successfully.");
    } catch (DuplicateDatasourceConnectionException e) {
        throw new RuntimeException("The given data source already exists in the directory " + directory, e);
    }
    return model.toString();
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:49,代码来源:EfwdWriter.java


注:本文中的org.apache.commons.lang.exception.ExceptionUtils.getRootCauseMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。