You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Nexusrex18 (via GitHub)" <gi...@apache.org> on 2025/04/01 07:59:07 UTC

[PR] handle typed nil pointers in Encode method (apache/dubbo-go#2517) [dubbo-go-hessian2]

Nexusrex18 opened a new pull request, #376:
URL: https://github.com/apache/dubbo-go-hessian2/pull/376

   This PR fixes the issue where the Encode method in encode.go did not properly handle typed nil pointers (e.g., (*int32)(nil)). The changes ensure that such pointers are encoded as Hessian NULL ('N').
   
   Changes:
   - Modified encode.go to add a reflect-based check for typed nil pointers.
   - Added tests in encode_test.go to verify the behavior for typed nil pointers, untyped nil, and non-nil pointers.
   - Fixed TestUserDefinedException in decode_test.go by:
   - Updating getJavaReply to handle non-zero exit statuses from the Java program.
   - Correcting the Java class name to com.test.UserDefinedException and updating TestThrowable.java accordingly.
   
   Fixes apache/dubbo-go#2517 (Ref: apache/dubbo-go#2517) 
   
   This PR is a prerequisite for the corresponding changes in apache/dubbo-go.


-- 
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


Re: [PR] handle typed nil pointers in Encode method (apache/dubbo-go#2517) [dubbo-go-hessian2]

Posted by "MoChengqian (via GitHub)" <gi...@apache.org>.
MoChengqian commented on PR #376:
URL: https://github.com/apache/dubbo-go-hessian2/pull/376#issuecomment-4149418380

   @MoChengqian 


-- 
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


Re: [PR] handle typed nil pointers in Encode method (apache/dubbo-go#2517) [dubbo-go-hessian2]

Posted by "wongoo (via GitHub)" <gi...@apache.org>.
wongoo closed pull request #376: handle typed nil pointers in Encode method (apache/dubbo-go#2517)
URL: https://github.com/apache/dubbo-go-hessian2/pull/376


-- 
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


Re: [PR] handle typed nil pointers in Encode method (apache/dubbo-go#2517) [dubbo-go-hessian2]

Posted by "tiltwind (via GitHub)" <gi...@apache.org>.
tiltwind commented on code in PR #376:
URL: https://github.com/apache/dubbo-go-hessian2/pull/376#discussion_r2022541180


##########
decode_test.go:
##########
@@ -81,6 +81,10 @@ func getJavaReply(method, className string) []byte {
 	cmd := exec.Command("java", cmdArgs...)
 	out, err := cmd.Output()
 	if err != nil {
+		if exitErr, ok := err.(*exec.ExitError); ok {

Review Comment:
   why ignore the the exec.ExitError? 



-- 
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


Re: [PR] handle typed nil pointers in Encode method (apache/dubbo-go#2517) [dubbo-go-hessian2]

Posted by "tiltwind (via GitHub)" <gi...@apache.org>.
tiltwind commented on code in PR #376:
URL: https://github.com/apache/dubbo-go-hessian2/pull/376#discussion_r2022546344


##########
encode_test.go:
##########
@@ -92,6 +92,36 @@ func testSimpleEncode(t *testing.T, v interface{}) {
 	assert.Nil(t, err)
 }
 
+func TestEncodeTypedNilPointer(t *testing.T) {
+	encoder := NewEncoder()
+	var val *int32 = nil

Review Comment:
   we define *int32 as java.lang.Integer, https://github.com/apache/dubbo-go-hessian2/blob/e93635a23a54737612e316b1b5ff9a3db167faa9/java_lang_test.go#L60



-- 
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