提交 44a00b58 编写于 作者: S Sam Brannen

Polish contribution

See gh-22383
上级 b51e553f
......@@ -28,6 +28,7 @@ import java.util.Set;
* Marshaller to write {@link CandidateComponentsMetadata} as properties.
*
* @author Stephane Nicoll
* @author Vedran Pavic
* @since 5.0
*/
abstract class PropertiesMarshaller {
......@@ -35,7 +36,7 @@ abstract class PropertiesMarshaller {
public static void write(CandidateComponentsMetadata metadata, OutputStream out) throws IOException {
Properties props = new SortedProperties(true);
metadata.getItems().forEach(m -> props.put(m.getType(), String.join(",", m.getStereotypes())));
props.store(out, "");
props.store(out, null);
}
public static CandidateComponentsMetadata read(InputStream in) throws IOException {
......
......@@ -93,7 +93,7 @@ class SortedProperties extends Properties {
super.store(baos, (this.omitComments ? null : comments));
String contents = new String(baos.toByteArray(), StandardCharsets.ISO_8859_1);
for (String line : contents.split(EOL)) {
if (!this.omitComments || !line.startsWith("#")) {
if (!(this.omitComments && line.startsWith("#"))) {
out.write((line + EOL).getBytes(StandardCharsets.ISO_8859_1));
}
}
......@@ -105,7 +105,7 @@ class SortedProperties extends Properties {
super.store(stringWriter, (this.omitComments ? null : comments));
String contents = stringWriter.toString();
for (String line : contents.split(EOL)) {
if (!this.omitComments || !line.startsWith("#")) {
if (!(this.omitComments && line.startsWith("#"))) {
writer.write(line + EOL);
}
}
......
......@@ -27,7 +27,6 @@ import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link PropertiesMarshaller}.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册