You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "seedeed (GitHub)" <gi...@apache.org> on 2020/03/05 15:06:42 UTC
[GitHub] [dubbo] seedeed commented on issue #5768: fix a potential
NPE in CallbackServiceCodec.java
I'm not sure whether the url is always not null. But I found that there already exists a null check for the url before setting the variable named group in this method. So I thought one more null check for this url is still needed before calling its getParameters method anyway.
```java
/**
* export or unexport callback service on client side
*
* @param channel
* @param url
* @param clazz
* @param inst
* @param export
* @throws IOException
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private static String exportOrUnexportCallbackService(Channel channel, URL url, Class clazz, Object inst, Boolean export) throws IOException {
int instid = System.identityHashCode(inst);
Map<String, String> params = new HashMap<>(3);
// no need to new client again
params.put(IS_SERVER_KEY, Boolean.FALSE.toString());
// mark it's a callback, for troubleshooting
params.put(IS_CALLBACK_SERVICE, Boolean.TRUE.toString());
String group = (url == null ? null : url.getParameter(GROUP_KEY));
if (group != null && group.length() > 0) {
params.put(GROUP_KEY, group);
}
// add method, for verifying against method, automatic fallback (see dubbo protocol)
params.put(METHODS_KEY, StringUtils.join(Wrapper.getWrapper(clazz).getDeclaredMethodNames(), ","));
Map<String, String> tmpMap = new HashMap<>(url.getParameters());
```
[ Full content available at: https://github.com/apache/dubbo/pull/5768 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org