parent
b51e553f55
commit
44a00b58c8
|
@ -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}.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue