Skip to content

Commit 647172e

Browse files
authored
Merge pull request #80 from refractions-research/534_changelogerrors
fix bug with switching fields when one is null and the other is not
2 parents 4080241 + 806986b commit 647172e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

revolsys-core/src/main/java/com/revolsys/record/property/DirectionalFields.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,14 @@ public static void reverseRecord(final Record record) {
136136

137137
public static void setSwapFieldValues(final Record record, final MapEx newValues,
138138
final String fieldName1, final String fieldName2) {
139-
newValues.addFieldValue(fieldName1, record, fieldName2)
140-
.addFieldValue(fieldName2, record, fieldName1);
139+
140+
newValues.add(fieldName1, record.get(fieldName2)) //
141+
.add(fieldName2, record.get(fieldName1));
142+
143+
// this doesn't add null values to the map and
144+
// later we need the map keys so this doesn't work
145+
// newValues.addFieldValue(fieldName1, record, fieldName2)
146+
// .addFieldValue(fieldName2, record, fieldName1);
141147
}
142148

143149
private final Map<String, Map<Object, Object>> directionalFieldValues = new HashMap<>();

0 commit comments

Comments
 (0)