Skip to content

Commit 44a00b5

Browse files
committed
Polish contribution
See gh-22383
1 parent b51e553 commit 44a00b5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

spring-context-indexer/src/main/java/org/springframework/context/index/processor/PropertiesMarshaller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
* Marshaller to write {@link CandidateComponentsMetadata} as properties.
2929
*
3030
* @author Stephane Nicoll
31+
* @author Vedran Pavic
3132
* @since 5.0
3233
*/
3334
abstract class PropertiesMarshaller {
3435

3536
public static void write(CandidateComponentsMetadata metadata, OutputStream out) throws IOException {
3637
Properties props = new SortedProperties(true);
3738
metadata.getItems().forEach(m -> props.put(m.getType(), String.join(",", m.getStereotypes())));
38-
props.store(out, "");
39+
props.store(out, null);
3940
}
4041

4142
public static CandidateComponentsMetadata read(InputStream in) throws IOException {

spring-context-indexer/src/main/java/org/springframework/context/index/processor/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
}

spring-context-indexer/src/test/java/org/springframework/context/index/processor/PropertiesMarshallerTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import static org.assertj.core.api.Assertions.assertThat;
2929

30-
3130
/**
3231
* Tests for {@link PropertiesMarshaller}.
3332
*

0 commit comments

Comments
 (0)