Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions src/mdo/java/WrapperProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,10 @@ private <T> T writeOperation(WriteOp<T> runner) {
}

private void writeOperationVoid(WriteOpVoid runner) {
OrderedProperties props = new OrderedProperties(getter.get());
runner.perform(props);
if (!props.equals(getter.get())) {
setter.accept(props);
}
writeOperation(properties -> {
runner.perform(properties);
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return null;
return null;

format seems broken as offset.

Comment on lines +195 to +196
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
runner.perform(properties);
return null;
runner.perform(properties);
return null;

format seems broken as offset.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use auto formatting, so either it fails or we need to accept the output. If the CI test pass, we cannot change the formatting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, thanks.

});
}

@Override
Expand Down Expand Up @@ -302,20 +301,17 @@ public synchronized void load(InputStream inStream) throws IOException {

@Override
public void save(OutputStream out, String comments) {
OrderedProperties props = new OrderedProperties(getter.get());
props.save(out, comments);
new OrderedProperties(getter.get()).save(out, comments);
}

@Override
public void store(Writer writer, String comments) throws IOException {
OrderedProperties props = new OrderedProperties(getter.get());
props.store(writer, comments);
new OrderedProperties(getter.get()).store(writer, comments);
}

@Override
public void store(OutputStream out, String comments) throws IOException {
OrderedProperties props = new OrderedProperties(getter.get());
props.store(out, comments);
new OrderedProperties(getter.get()).store(out, comments);
}

@Override
Expand All @@ -325,29 +321,23 @@ public synchronized void loadFromXML(InputStream in) throws IOException, Invalid

@Override
public void storeToXML(OutputStream os, String comment) throws IOException {
OrderedProperties props = new OrderedProperties(getter.get());
props.storeToXML(os, comment);
new OrderedProperties(getter.get()).storeToXML(os, comment);
}

@Override
public void storeToXML(OutputStream os, String comment, String encoding) throws IOException {
OrderedProperties props = new OrderedProperties(getter.get());
props.storeToXML(os, comment, encoding);
new OrderedProperties(getter.get()).storeToXML(os, comment, encoding);
}


private Object writeReplace() throws java.io.ObjectStreamException {
OrderedProperties props = new OrderedProperties(getter.get());
return props;
return new OrderedProperties(getter.get());
}

private class OrderedProperties extends Properties {
private final List<Object> keyOrder = new CopyOnWriteArrayList<>();

public OrderedProperties() {
}

public OrderedProperties(Map<?, ?> map) {
OrderedProperties(Map<?, ?> map) {
putAll(map);
}

Expand Down