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

反序列化出错 #118

Closed
sniperking1234 opened this issue Aug 14, 2019 · 1 comment
Closed

反序列化出错 #118

sniperking1234 opened this issue Aug 14, 2019 · 1 comment

Comments

@sniperking1234
Copy link

当反序列化一个对象的时候,发生错误。但是同样的请求用java反序列化正常。
相关代码

type TriggerParam struct {
	JobId                 int
	ExecutorHandler       string
	ExecutorParams        string
	ExecutorBlockStrategy string
	ExecutorTimeout       int
	LogId                 int
	LogDateTim            int
	GlueType              string
	GlueSource            string
	GlueUpdatetime        int
	BroadcastIndex        int
	BroadcastTotal        int
}

func (TriggerParam) JavaClassName() string {
	return "com.xxl.job.core.biz.model.TriggerParam"
}

type XxlRpcRequest struct {
	RequestId        string
	CreateMillisTime int
	AccessToken      string
	ClassName        string
	MethodName       string
	ParameterTypes   []java_exception.Class
	Parameters       []interface{}
	Version          string
}

func (XxlRpcRequest) JavaClassName() string {
	return "com.xxl.rpc.remoting.net.params.XxlRpcRequest"
}

func TestSerializerFile(t *testing.T) {

	RegisterPOJO(XxlRpcRequest{})
	RegisterPOJO(TriggerParam{})
	f, _ := os.Open("test.dat")
	bt, _ := ioutil.ReadAll(f)
	_ = f.Close()
	for e := range bt {
		fmt.Printf("0x%x ", bt[e])
	}
	fmt.Println()
	fmt.Println(string(bt))
	d := NewDecoder(bt)
	res, err := d.Decode()
	if err != nil {
		t.Errorf("Decode() = %+v", err)
	}
	resJson, _ := json.Marshal(res)
	t.Logf("decode = %v, %v\n", string(resJson), err)
}

二进制文件:https://github.com/sniperking1234/dubbo-go-hessian2/blob/xxl-job/test.dat
解析的时候报错
image
用java反序列化的结果:
image

@wongoo
Copy link
Contributor

wongoo commented Feb 24, 2020

unsupported generics

@wongoo wongoo closed this as completed Feb 24, 2020
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

No branches or pull requests

2 participants