Java Code Examples for org.springframework.core.NestedExceptionUtils#buildMessage()

The following examples show how to use org.springframework.core.NestedExceptionUtils#buildMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeEnvironmentRepository.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@Override
public Environment findOne(String config, String profile, String label,
		boolean includeOrigin) {
	SpringApplicationBuilder builder = new SpringApplicationBuilder(
			PropertyPlaceholderAutoConfiguration.class);
	ConfigurableEnvironment environment = getEnvironment(profile);
	builder.environment(environment);
	builder.web(WebApplicationType.NONE).bannerMode(Mode.OFF);
	if (!logger.isDebugEnabled()) {
		// Make the mini-application startup less verbose
		builder.logStartupInfo(false);
	}
	String[] args = getArgs(config, profile, label);
	// Explicitly set the listeners (to exclude logging listener which would change
	// log levels in the caller)
	builder.application()
			.setListeners(Arrays.asList(new ConfigFileApplicationListener()));

	try (ConfigurableApplicationContext context = builder.run(args)) {
		environment.getPropertySources().remove("profiles");
		return clean(new PassthruEnvironmentRepository(environment).findOne(config,
				profile, label, includeOrigin));
	}
	catch (Exception e) {
		String msg = String.format(
				"Could not construct context for config=%s profile=%s label=%s includeOrigin=%b",
				config, profile, label, includeOrigin);
		String completeMessage = NestedExceptionUtils.buildMessage(msg,
				NestedExceptionUtils.getMostSpecificCause(e));
		throw new FailedToConstructEnvironmentException(completeMessage, e);
	}
}
 
Example 2
Source File: ResponseStatusException.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public String getMessage() {
	String msg = this.status + (this.reason != null ? " \"" + this.reason + "\"" : "");
	return NestedExceptionUtils.buildMessage(msg, getCause());
}
 
Example 3
Source File: NestedServletException.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Return the detail message, including the message from the nested exception
 * if there is one.
 */
@Override
@Nullable
public String getMessage() {
	return NestedExceptionUtils.buildMessage(super.getMessage(), getCause());
}
 
Example 4
Source File: ResponseStatusException.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public String getMessage() {
	String msg = this.status + (this.reason != null ? " \"" + this.reason + "\"" : "");
	return NestedExceptionUtils.buildMessage(msg, getCause());
}
 
Example 5
Source File: NestedServletException.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Return the detail message, including the message from the nested exception
 * if there is one.
 */
@Override
@Nullable
public String getMessage() {
	return NestedExceptionUtils.buildMessage(super.getMessage(), getCause());
}
 
Example 6
Source File: NestedServletException.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Return the detail message, including the message from the nested exception
 * if there is one.
 */
@Override
public String getMessage() {
	return NestedExceptionUtils.buildMessage(super.getMessage(), getCause());
}
 
Example 7
Source File: NestedServletException.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Return the detail message, including the message from the nested exception
 * if there is one.
 */
@Override
public String getMessage() {
	return NestedExceptionUtils.buildMessage(super.getMessage(), getCause());
}