Skip to content

Commit 3b37989

Browse files
committed
Apply De Morgan's law for greater clarity of purpose
1 parent 1f35bb6 commit 3b37989

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-core/src/main/java/org/springframework/core/SortedProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void store(OutputStream out, String comments) throws IOException {
9393
super.store(baos, (this.omitComments ? null : comments));
9494
String contents = new String(baos.toByteArray(), StandardCharsets.ISO_8859_1);
9595
for (String line : contents.split(EOL)) {
96-
if (!this.omitComments || !line.startsWith("#")) {
96+
if (!(this.omitComments && line.startsWith("#"))) {
9797
out.write((line + EOL).getBytes(StandardCharsets.ISO_8859_1));
9898
}
9999
}
@@ -105,7 +105,7 @@ public void store(Writer writer, String comments) throws IOException {
105105
super.store(stringWriter, (this.omitComments ? null : comments));
106106
String contents = stringWriter.toString();
107107
for (String line : contents.split(EOL)) {
108-
if (!this.omitComments || !line.startsWith("#")) {
108+
if (!(this.omitComments && line.startsWith("#"))) {
109109
writer.write(line + EOL);
110110
}
111111
}

0 commit comments

Comments
 (0)