-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In Dubbo instrumentation, I found a compatibility problem of DubboHeadersGetter#keys in Dubbo 2.7.6, 2.7.7.
In related versions, the getAttachments is as follows:
@Deprecated
@Override
public Map<String, String> getAttachments() {
return new AttachmentsAdapter.ObjectToStringMap(attachments);
}
public static class ObjectToStringMap extends HashMap<String, String> {
private Map<String, Object> attachments;
public ObjectToStringMap(Map<String, Object> attachments) {
this.attachments = attachments;
}
@Override
public String get(Object key) {
Object obj = attachments.get(key);
return convert(obj);
}
@Override
public String put(String key, String value) {
Object obj = attachments.put(key, value);
return convert(obj);
}
@Override
public String remove(Object key) {
Object obj = attachments.remove(key);
return convert(obj);
}
private String convert(Object obj) {
if (obj instanceof String) {
return (String) obj;
}
return null; // or JSON.toString(obj);
}
}The ObjectToStringMap can't get all keySet by keySet method, so it can't get correct result of DubboHeadersGetter#keys in related version.
Steps to reproduce
We can compare the codes between Dubbo 2.7.6, 2.7.7 and others, we can get above conclusion by codes.
Expected behavior
DubboHeadersGetter#keys can't get correct result in Dubbo 2.7.6, 2.7.7
Actual behavior
DubboHeadersGetter#keys can get correct result in Dubbo 2.7.6, 2.7.7
Javaagent or library instrumentation version
2.11.0
Environment
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working