Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Double type covert to float64 panic when null value set. #305

Open
ma642 opened this issue Jan 6, 2022 · 1 comment
Open

Java Double type covert to float64 panic when null value set. #305

ma642 opened this issue Jan 6, 2022 · 1 comment

Comments

@ma642
Copy link

ma642 commented Jan 6, 2022

What happened:
Java side:

class Score implements Serializable {
private Double score;
private String name;

public void setName(String name) {
    this.name = name;
}
public String getName() {
    return this.name;
}

public void setScore(Double score) {
    this.score = score;
}

public Double getScore() {
    return this.score;
}

}

.....
.....
Score s = new Score();
s.setScore(null);
s.setName("DoubleWithNull");

golang side:

type score struct {
Score float64
Name string
}

golang side get error when Double is null value as below

error:decDouble parse double wrong tag:78-0x4e\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).decDouble\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/double.go:151\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).decInstance\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/object.go:486\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).decObject\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/object.go:696\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/decode.go:285\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).decObject\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/object.go:655\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/decode.go:285\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).Decode\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/decode.go:214\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.unmarshalRequestBody\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/hessian.go:244\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.HessianSerializer.Unmarshal\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/hessian.go:56\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.(*ProtocolCodec).Decode\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/codec.go:186\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.(*DubboPackage).Unmarshal\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/package.go:93\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo.(*DubboCodec).decodeRequest\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/dubbo_codec.go:189\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo.(*DubboCodec).Decode\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/dubbo_codec.go:165\ndubbo.apache.org/dubbo-go/v3/remoting/getty.(*RpcServerPackageHandler).Read\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/remoting/getty/readwriter.go:104\ngithub.com/apache/dubbo-getty.(*session).handleTCPPackage\n\t/go/pkg/mod/github.com/apache/dubbo-getty@v1.4.5/session.go:627\ngithub.com/apache/dubbo-getty.(*session).handlePackage\n\t/go/pkg/mod/github.com/apache/dubbo-getty@v1.4.5/session.go:549\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581\ndecInstance->decDouble field name:totalScore\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).decInstance\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/object.go:488\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).decObject\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/object.go:696\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/decode.go:285\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).decObject\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/object.go:655\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/decode.go:285\ngithub.com/apache/dubbo-go-hessian2.(*Decoder).Decode\n\t/go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.10.1-0.20211206111530-75ff95074949/decode.go:214\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.unmarshalRequestBody\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/hessian.go:244\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.HessianSerializer.Unmarshal\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/hessian.go:56\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.(*ProtocolCodec).Decode\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/codec.go:186\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl.(*DubboPackage).Unmarshal\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/impl/package.go:93\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo.(*DubboCodec).decodeRequest\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/dubbo_codec.go:189\ndubbo.apache.org/dubbo-go/v3/protocol/dubbo.(*DubboCodec).Decode\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/protocol/dubbo/dubbo_codec.go:165\ndubbo.apache.org/dubbo-go/v3/remoting/getty.(*RpcServerPackageHandler).Read\n\t/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc4-1/remoting/getty/readwriter.go:104\ngithub.com/apache/dubbo-getty.(*session).handleTCPPackage\n\t/go/pkg/mod/github.com/apach

What you expected to happen:
zero value without error in golang code.
How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

@wongoo
Copy link
Contributor

wongoo commented Jan 6, 2022

@ma642 pls provide more details, like struct definition, instance values, etc.

ma642 pushed a commit to ma642/dubbo-go-hessian2 that referenced this issue Jan 6, 2022
AlexStocks added a commit that referenced this issue Jan 6, 2022
fix #305, Java Double type to float64 get error  when null value set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants