1
0

[HUDI-3528] Fix String convert issue and overwrite putAll method in TypedProperties.java (#4920)

This commit is contained in:
stayrascal
2022-02-28 23:45:47 +08:00
committed by GitHub
parent 4a59876c8b
commit 8f1e4f5b3e
2 changed files with 43 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ import java.util.Enumeration;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
@@ -63,11 +64,22 @@ public class TypedProperties extends Properties implements Serializable {
public Set<String> stringPropertyNames() {
Set<String> set = new LinkedHashSet<>();
for (Object key : this.keys) {
set.add((String) key);
if (key instanceof String) {
set.add((String) key);
}
}
return set;
}
public synchronized void putAll(Properties t) {
for (Map.Entry<?, ?> e : t.entrySet()) {
if (!containsKey(String.valueOf(e.getKey()))) {
keys.add(e.getKey());
}
super.put(e.getKey(), e.getValue());
}
}
@Override
public synchronized Object put(Object key, Object value) {
keys.remove(key);