Skip to content

Commit

Permalink
fix remove the field writer which only differ in first character that…
Browse files Browse the repository at this point in the history
… one is upper case the other is lower case, for issue 3220
  • Loading branch information
yanxutao89 committed Dec 25, 2024
1 parent 2947043 commit e370739
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,14 @@ boolean record = BeanUtils.isRecord(objectClass);
if (origin != null && origin.compareTo(fieldWriter) > 0) {
fieldWriterMap.put(fieldName, fieldWriter);
}

// the sameFieldName means only differ in first character that one is upper case the other is lower case
if (origin == null) {
String sameFieldName = Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
if (fieldWriterMap.containsKey(sameFieldName)) {
fieldWriterMap.remove(sameFieldName);
}
}
});

fieldWriters = new ArrayList<>(fieldWriterMap.values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ boolean record = BeanUtils.isRecord(objectClass);
if (origin != null && origin.compareTo(fieldWriter) > 0) {
fieldWriterMap.put(fieldName, fieldWriter);
}

// the sameFieldName means only differ in first character that one is upper case the other is lower case
if (origin == null) {
String sameFieldName = Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
if (fieldWriterMap.containsKey(sameFieldName)) {
fieldWriterMap.remove(sameFieldName);
}
}
});
}
} else {
Expand Down

0 comments on commit e370739

Please sign in to comment.