You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "wfk0924 (via GitHub)" <gi...@apache.org> on 2023/03/31 04:28:32 UTC

[GitHub] [dubbo-go-hessian2] wfk0924 opened a new issue, #356: 两个Map结构不同但值为nil时,decode will panic

wfk0924 opened a new issue, #356:
URL: https://github.com/apache/dubbo-go-hessian2/issues/356

   <!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
   
   -->
   
   
   **What happened**:
   两个Map结构不同但值为nil时,decode  will panic
   **What you expected to happen**:
   返回空Map
   **How to reproduce it (as minimally and precisely as possible)**:
   ```
   type UserInfo struct {
   	Name    string
   	Address map[string]string
   	Family  map[string]int
   }
   
   func (UserInfo) JavaClassName() string {
   	return "com.test.ReqInfo"
   }
   
   func TestIssueCase(t *testing.T) {
   	req := &UserInfo{
   		Name:    "test",
   		Address: nil,
   		Family:  nil,
   	}
   
   	hessian.RegisterPOJO(req)
   
   	encoder := hessian.NewEncoder()
   	err := encoder.Encode(req)
   	if err != nil {
   		t.Error(err)
   		return
   	}
   
   	enBuf := encoder.Buffer()
   
   	decoder := hessian.NewDecoder(enBuf)
   	deReq, err := decoder.Decode()
   	assert.Nil(t, err)
   
   	t.Log(deReq)
   
   	assert.True(t, reflect.DeepEqual(req, deReq))
   }
   
   ```
   ```
   === RUN   TestIssueCase
   --- FAIL: TestIssueCase (0.00s)
   panic: reflect.Set: value of type map[string]string is not assignable to type map[string]int [recovered]
   	panic: reflect.Set: value of type map[string]string is not assignable to type map[string]int
   ```
   **Anything else we need to know?**:
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] wongoo closed issue #356: 两个Map结构不同但值为nil时,decode will panic

Posted by "wongoo (via GitHub)" <gi...@apache.org>.
wongoo closed issue #356: 两个Map结构不同但值为nil时,decode  will panic
URL: https://github.com/apache/dubbo-go-hessian2/issues/356


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org