Commit cafe1dc4 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish contribution

Fix additional use of \n

Closes gh-4707
parent e0ec6077
/* /*
* Copyright 2013-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -429,8 +429,9 @@ public class ShellProperties { ...@@ -429,8 +429,9 @@ public class ShellProperties {
config.put("crash.auth.simple.username", this.user.getName()); config.put("crash.auth.simple.username", this.user.getName());
config.put("crash.auth.simple.password", this.user.getPassword()); config.put("crash.auth.simple.password", this.user.getPassword());
if (this.user.isDefaultPassword()) { if (this.user.isDefaultPassword()) {
logger.info("\n\nUsing default password for shell access: " logger.info(String.format(
+ this.user.getPassword() + "\n\n"); "%n%nUsing default password for shell access: %s%n%n",
this.user.getPassword()));
} }
} }
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -109,9 +109,9 @@ public class AutoConfigurationReportLoggingInitializer ...@@ -109,9 +109,9 @@ public class AutoConfigurationReportLoggingInitializer
if (!this.report.getConditionAndOutcomesBySource().isEmpty()) { if (!this.report.getConditionAndOutcomesBySource().isEmpty()) {
if (isCrashReport && this.logger.isInfoEnabled() if (isCrashReport && this.logger.isInfoEnabled()
&& !this.logger.isDebugEnabled()) { && !this.logger.isDebugEnabled()) {
this.logger.info("\n\nError starting ApplicationContext. " this.logger.info(String.format("%n%nError starting ApplicationContext. "
+ "To display the auto-configuration report enable " + "To display the auto-configuration report enable "
+ "debug logging (start with --debug)\n\n"); + "debug logging (start with --debug)%n%n"));
} }
if (this.logger.isDebugEnabled()) { if (this.logger.isDebugEnabled()) {
this.logger.debug(getLogMessage(this.report)); this.logger.debug(getLogMessage(this.report));
...@@ -121,12 +121,12 @@ public class AutoConfigurationReportLoggingInitializer ...@@ -121,12 +121,12 @@ public class AutoConfigurationReportLoggingInitializer
private StringBuilder getLogMessage(ConditionEvaluationReport report) { private StringBuilder getLogMessage(ConditionEvaluationReport report) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append("\n\n\n"); message.append(String.format("%n%n%n"));
message.append("=========================\n"); message.append(String.format("=========================%n"));
message.append("AUTO-CONFIGURATION REPORT\n"); message.append(String.format("AUTO-CONFIGURATION REPORT%n"));
message.append("=========================\n\n\n"); message.append(String.format("=========================%n%n%n"));
message.append("Positive matches:\n"); message.append(String.format("Positive matches:%n"));
message.append("-----------------\n"); message.append(String.format("-----------------%n"));
Map<String, ConditionAndOutcomes> shortOutcomes = orderByName( Map<String, ConditionAndOutcomes> shortOutcomes = orderByName(
report.getConditionAndOutcomesBySource()); report.getConditionAndOutcomesBySource());
for (Map.Entry<String, ConditionAndOutcomes> entry : shortOutcomes.entrySet()) { for (Map.Entry<String, ConditionAndOutcomes> entry : shortOutcomes.entrySet()) {
...@@ -134,37 +134,37 @@ public class AutoConfigurationReportLoggingInitializer ...@@ -134,37 +134,37 @@ public class AutoConfigurationReportLoggingInitializer
addLogMessage(message, entry.getKey(), entry.getValue()); addLogMessage(message, entry.getKey(), entry.getValue());
} }
} }
message.append("\n\n"); message.append(String.format("%n%n"));
message.append("Negative matches:\n"); message.append(String.format("Negative matches:%n"));
message.append("-----------------\n"); message.append(String.format("-----------------%n"));
for (Map.Entry<String, ConditionAndOutcomes> entry : shortOutcomes.entrySet()) { for (Map.Entry<String, ConditionAndOutcomes> entry : shortOutcomes.entrySet()) {
if (!entry.getValue().isFullMatch()) { if (!entry.getValue().isFullMatch()) {
addLogMessage(message, entry.getKey(), entry.getValue()); addLogMessage(message, entry.getKey(), entry.getValue());
} }
} }
message.append("\n\n"); message.append(String.format("%n%n"));
message.append("Exclusions:\n"); message.append(String.format("Exclusions:%n"));
message.append("-----------\n"); message.append(String.format("-----------%n"));
if (report.getExclusions().isEmpty()) { if (report.getExclusions().isEmpty()) {
message.append("\n None\n"); message.append(String.format("%n None%n"));
} }
else { else {
for (String exclusion : report.getExclusions()) { for (String exclusion : report.getExclusions()) {
message.append("\n " + exclusion + "\n"); message.append(String.format("%n %s%n", exclusion));
} }
} }
message.append("\n\n"); message.append(String.format("%n%n"));
message.append("Unconditional classes:\n"); message.append(String.format("Unconditional classes:%n"));
message.append("----------------------\n"); message.append(String.format("----------------------%n"));
if (report.getUnconditionalClasses().isEmpty()) { if (report.getUnconditionalClasses().isEmpty()) {
message.append("\n None\n"); message.append(String.format("%n None%n"));
} }
else { else {
for (String unconditionalClass : report.getUnconditionalClasses()) { for (String unconditionalClass : report.getUnconditionalClasses()) {
message.append("\n " + unconditionalClass + "\n"); message.append(String.format("%n %s%n", unconditionalClass));
} }
} }
message.append("\n\n"); message.append(String.format("%n%n"));
return message; return message;
} }
...@@ -187,9 +187,10 @@ public class AutoConfigurationReportLoggingInitializer ...@@ -187,9 +187,10 @@ public class AutoConfigurationReportLoggingInitializer
private void addLogMessage(StringBuilder message, String source, private void addLogMessage(StringBuilder message, String source,
ConditionAndOutcomes conditionAndOutcomes) { ConditionAndOutcomes conditionAndOutcomes) {
message.append("\n " + source); message.append(String.format("%n %s", source));
message.append( message.append(
conditionAndOutcomes.isFullMatch() ? " matched\n" : " did not match\n"); conditionAndOutcomes.isFullMatch() ? " matched" : " did not match")
.append(String.format("%n"));
for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) { for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) {
message.append(" - "); message.append(" - ");
if (StringUtils.hasLength(conditionAndOutcome.getOutcome().getMessage())) { if (StringUtils.hasLength(conditionAndOutcome.getOutcome().getMessage())) {
...@@ -202,7 +203,7 @@ public class AutoConfigurationReportLoggingInitializer ...@@ -202,7 +203,7 @@ public class AutoConfigurationReportLoggingInitializer
message.append(" ("); message.append(" (");
message.append(ClassUtils message.append(ClassUtils
.getShortName(conditionAndOutcome.getCondition().getClass())); .getShortName(conditionAndOutcome.getCondition().getClass()));
message.append(")\n"); message.append(String.format(")%n"));
} }
} }
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -167,8 +167,8 @@ public class AuthenticationManagerConfiguration { ...@@ -167,8 +167,8 @@ public class AuthenticationManagerConfiguration {
} }
User user = this.securityProperties.getUser(); User user = this.securityProperties.getUser();
if (user.isDefaultPassword()) { if (user.isDefaultPassword()) {
logger.info("\n\nUsing default security password: " + user.getPassword() logger.info(String.format(
+ "\n"); "%n%nUsing default security password: %s%n", user.getPassword()));
} }
Set<String> roles = new LinkedHashSet<String>(user.getRole()); Set<String> roles = new LinkedHashSet<String>(user.getRole());
withUser(user.getName()).password(user.getPassword()) withUser(user.getName()).password(user.getPassword())
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -181,7 +181,7 @@ public class Shell { ...@@ -181,7 +181,7 @@ public class Shell {
if (this.commandRunner.handleSigInt()) { if (this.commandRunner.handleSigInt()) {
return; return;
} }
System.out.println("\nThanks for using Spring Boot"); System.out.println(String.format("%nThanks for using Spring Boot"));
System.exit(1); System.exit(1);
} }
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -159,8 +159,8 @@ public class DependencyManagementBomTransformation ...@@ -159,8 +159,8 @@ public class DependencyManagementBomTransformation
} }
private void handleMalformedDependency(Expression expression) { private void handleMalformedDependency(Expression expression) {
Message message = createSyntaxErrorMessage( Message message = createSyntaxErrorMessage(String.format(
"The string must be of the form \"group:module:version\"\n", expression); "The string must be of the form \"group:module:version\"%n"), expression);
getSourceUnit().getErrorCollector().addErrorAndContinue(message); getSourceUnit().getErrorCollector().addErrorAndContinue(message);
} }
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -231,7 +231,7 @@ public class PropertiesConfigurationFactory<T> ...@@ -231,7 +231,7 @@ public class PropertiesConfigurationFactory<T>
try { try {
if (this.logger.isTraceEnabled()) { if (this.logger.isTraceEnabled()) {
if (this.properties != null) { if (this.properties != null) {
this.logger.trace("Properties:\n" + this.properties); this.logger.trace(String.format("Properties:%n%s" + this.properties));
} }
else { else {
this.logger.trace("Property Sources: " + this.propertySources); this.logger.trace("Property Sources: " + this.propertySources);
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -138,7 +138,7 @@ public class YamlConfigurationFactory<T> ...@@ -138,7 +138,7 @@ public class YamlConfigurationFactory<T>
+ "either set it directly or set the resource to load it from"); + "either set it directly or set the resource to load it from");
try { try {
if (this.logger.isTraceEnabled()) { if (this.logger.isTraceEnabled()) {
this.logger.trace("Yaml document is\n" + this.yaml); this.logger.trace(String.format("Yaml document is %n%s" + this.yaml));
} }
Constructor constructor = new YamlJavaBeanPropertyConstructor(this.type, Constructor constructor = new YamlJavaBeanPropertyConstructor(this.type,
this.propertyAliases); this.propertyAliases);
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -105,7 +105,7 @@ public class ConfigurationWarningsApplicationContextInitializer ...@@ -105,7 +105,7 @@ public class ConfigurationWarningsApplicationContextInitializer
private void warn(String message) { private void warn(String message) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("\n\n** WARNING ** : " + message + "\n\n"); logger.warn(String.format("%n%n** WARNING ** : %s%n%n", message));
} }
} }
......
...@@ -145,13 +145,13 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { ...@@ -145,13 +145,13 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
StringBuilder errors = new StringBuilder(); StringBuilder errors = new StringBuilder();
for (Status status : statuses) { for (Status status : statuses) {
if (status.getLevel() == Status.ERROR) { if (status.getLevel() == Status.ERROR) {
errors.append(errors.length() > 0 ? "\n" : ""); errors.append(errors.length() > 0 ? String.format("%n") : "");
errors.append(status.toString()); errors.append(status.toString());
} }
} }
if (errors.length() > 0) { if (errors.length() > 0) {
throw new IllegalStateException( throw new IllegalStateException(String.format(
"Logback configuration error " + "detected: \n" + errors); "Logback configuration error detected: %n%s", errors));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment