Home / Class/ RequireNewOrMatchingContentFileHandler Class — spring-boot Architecture

RequireNewOrMatchingContentFileHandler Class — spring-boot Architecture

Architecture documentation for the RequireNewOrMatchingContentFileHandler class in SpringBootJoranConfigurator.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java lines 432–457

	private static final class RequireNewOrMatchingContentFileHandler implements ThrowingConsumer<FileHandler> {

		private final byte[] newContent;

		private RequireNewOrMatchingContentFileHandler(byte[] newContent) {
			this.newContent = newContent;
		}

		@Override
		public void acceptWithException(FileHandler file) throws Exception {
			if (file.exists()) {
				InputStreamSource content = file.getContent();
				Assert.state(content != null, "Unable to get file content");
				byte[] existingContent = content.getInputStream().readAllBytes();
				if (!Arrays.equals(this.newContent, existingContent)) {
					throw new IllegalStateException(
							"Logging configuration differs from the configuration that has already been written. "
									+ "Update your logging configuration so that it is the same for each context");
				}
			}
			else {
				file.create(new ByteArrayResource(this.newContent));
			}
		}

	}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free