Commit 7b24941d authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #12591 from dreis2211:avoid-string-copy-banner

* pr/12591:
  Polish "Avoid string copies in SpringBootBanner"
  Avoid string copies in SpringBootBanner
parents 9fccb0ae ed7618b0
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 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.
...@@ -50,14 +50,14 @@ class SpringBootBanner implements Banner { ...@@ -50,14 +50,14 @@ class SpringBootBanner implements Banner {
} }
String version = SpringBootVersion.getVersion(); String version = SpringBootVersion.getVersion();
version = (version == null ? "" : " (v" + version + ")"); version = (version == null ? "" : " (v" + version + ")");
String padding = ""; StringBuilder padding = new StringBuilder();
while (padding.length() < STRAP_LINE_SIZE while (padding.length() < STRAP_LINE_SIZE
- (version.length() + SPRING_BOOT.length())) { - (version.length() + SPRING_BOOT.length())) {
padding += " "; padding.append(" ");
} }
printStream.println(AnsiOutput.toString(AnsiColor.GREEN, SPRING_BOOT, printStream.println(AnsiOutput.toString(AnsiColor.GREEN, SPRING_BOOT,
AnsiColor.DEFAULT, padding, AnsiStyle.FAINT, version)); AnsiColor.DEFAULT, padding.toString(), AnsiStyle.FAINT, version));
printStream.println(); printStream.println();
} }
......
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