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

fix #210 JavaDeserializer._constructor.newInstance([null, null]) NPE #1608

Closed
wants to merge 1 commit into from

Conversation

takeseem
Copy link
Contributor

@takeseem takeseem commented Apr 14, 2018

this is an old issue #210

public UncategorizedSQLException(String task, @Nullable String sql, SQLException ex) {
	super(task + "; uncategorized SQLException" + (sql != null ? " for SQL [" + sql + "]" : "") +
			"; SQL state [" + ex.getSQLState() + "]; error code [" + ex.getErrorCode() + "]; " +
			ex.getMessage(), ex);
	this.sql = sql;
}
  • the stacktrace like this:
com.alibaba.com.caucho.hessian.io.HessianProtocolException: 'org.springframework.jdbc.UncategorizedSQLException' could not be instantiated
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:313)
    ...
Caused by: java.lang.reflect.InvocationTargetException
	... 
Caused by: java.lang.NullPointerException
	at org.springframework.jdbc.UncategorizedSQLException.<init>(UncategorizedSQLException.java)
	...

@takeseem
Copy link
Contributor Author

takeseem commented Apr 15, 2018

@lovepoem @zonghaishang
#1232 HessianInput.readObject(Class, Class[]) nosupported
因为我对Hessian不熟,#1232 需要覆盖测试Hessian1的,看代码#1232 只支持Hessian2

@zonghaishang
Copy link
Member

@takeseem

  1. constructor(null...) , This is the validation rule of the instance object itself.
  2. HessianInput.readObject(Class, Class[]) not supported, there is no direct relationship between this exception and pr.

Please provide the full jar package that has this exception:

  1. dubbo
  2. org.springframework.jdbc.UncategorizedSQLException

thanks.

@takeseem
Copy link
Contributor Author

takeseem commented Apr 16, 2018

@zonghaishang 但是用 #1232 提交之前的代码,是工作很好的。既然AbstracthessianInput增加了方法,为什么heassian2能兼容和heassian1就不支持?这本身会导致所有的hessian1协议在#1232之后不再得到支持。

当然我也可以如你所说,去掉hessian1的junit以保证测试用例ok。

HessianInput.inistant()方法本意是构造一个对象而已。但是类创建者不知道会传入一个null。

“Please provide the full jar package that has this exception:
dubbo
org.springframework.jdbc.UncategorizedSQLException”
你需要的信息如下:

  • 我提交的代码就明确了依赖哪个dubbo
  • 1楼UncategorizedSQLException本身链接spring的源码

@zonghaishang
Copy link
Member

@takeseem

既然AbstracthessianInput增加了方法,为什么heassian2能兼容和heassian1就不支持?

  1. The new abstract method I added did not implement in Hessian1 by default, you should not reuse my hessian2 unit test to verify hessian1.
  2. Does it need to support hessian1, maybe I will support later today.
  3. dubbo调用报错HessianFieldException #210 is inconsistent with the given line number, perhaps due to the version used by the spring-jdbc framework

@takeseem
Copy link
Contributor Author

takeseem commented Apr 16, 2018

既然AbstracthessianInput增加了方法,为什么heassian2能兼容和heassian1就不支持?

  1. The new abstract method I added did not implement in Hessian1 by default, you should not reuse my hessian2 unit test to verify hessian1.
    虽然是开源项目,假设客户已经在生产中使用hessian1,这对客户来说升级版本将是灾难。
    所以我说不严谨
  2. Does it need to support hessian1, maybe I will support later today.
    点赞
  3. dubbo调用报错HessianFieldException #210 is inconsistent with the given line number, perhaps due to the version used by the spring-jdbc framework
    我会根据git的show revision information找到有用的信息,但dubbo调用报错HessianFieldException #210 案例最新代码依然能定位并重现问题。

@zonghaishang
Copy link
Member

@takeseem
Hessian1 protocol is not used in dubbo, but hessian1 protocol compatibility I have fixed, more detail see : #1616

@takeseem takeseem force-pushed the fix-210 branch 3 times, most recently from 9cf2384 to cf00db5 Compare April 18, 2018 08:01
Example: org.springframework.jdbc.UncategorizedSQLException
org.springframework.beans.MethodInvocationException

com.alibaba.com.caucho.hessian.io.HessianProtocolException:
'com.alibaba.com.caucho.hessian.io.beans.ConstructNPE' could not be
instantiated
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:313)

Caused by: java.lang.reflect.InvocationTargetException
	at com.alibaba.com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:309)
Caused by: java.lang.NullPointerException
	at com.alibaba.com.caucho.hessian.io.beans.ConstructNPE.<init>(ConstructNPE.java:15)
@ralf0131
Copy link
Contributor

Hi, please check the CI failure.

@diecui1202
Copy link

@takeseem After discussing with @zonghaishang For this question, you can implement custom Deserializer, and then register it to SerializerFactory, such as:

Deserializer des = new XXXDeserializer();

ExtSerializerFactory ext = new ExtSerializerFactory();
ext.addDeserializer(UncategorizedSQLException.class, des);

serializerFactory.addFactory(ext);

You can try it with this way.

@beiwei30
Copy link
Member

@takeseem, hessian-lite is moved out into github/dubbo, pls. feel free to resubmit PR there, if you don't agree with @diecui1202's suggestion.

@beiwei30 beiwei30 closed this Jun 11, 2018
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 this pull request may close these issues.

5 participants