Skip to content

Commit d553f22

Browse files
committed
refactor(ContentSecurityPolicyHeaderWriter): remove micro StringBuilder optimization.
It probably doesn't makes code faster but it makes it less obvious.
1 parent 90aa07e commit d553f22

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/main/java/ru/mystamps/web/support/spring/security/ContentSecurityPolicyHeaderWriter.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,6 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
157157

158158
private static final char SEPARATOR = ';';
159159

160-
private static final int MIN_HEADER_LENGTH =
161-
DEFAULT_SRC.length()
162-
+ IMG_SRC.length()
163-
+ FONT_SRC.length()
164-
+ REPORT_URI.length()
165-
+ STYLE_SRC.length()
166-
+ SCRIPT_SRC.length()
167-
// number of separators between directives
168-
+ 5;
169-
170160
private final boolean useCdn;
171161
private final boolean useSingleHost;
172162
private final boolean hasH2Console;
@@ -184,7 +174,7 @@ protected String constructDirectives(String uri) {
184174
boolean onAddSeriesPage = uri.equals(SeriesUrl.ADD_SERIES_PAGE);
185175
boolean onH2ConsolePage = hasH2Console && uri.startsWith(H2_CONSOLE_PATTERN);
186176

187-
StringBuilder sb = new StringBuilder(MIN_HEADER_LENGTH);
177+
StringBuilder sb = new StringBuilder();
188178

189179
sb.append(DEFAULT_SRC).append(SEPARATOR)
190180
.append(IMG_SRC).append(useSingleHost ? IMG_SRC_SELF : IMG_SRC_ALT).append(SEPARATOR)

0 commit comments

Comments
 (0)