Narender007 / oauth-signpost

Automatically exported from code.google.com/p/oauth-signpost
0 stars 0 forks source link

OAuthConsumer is not fully serializable #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The front page mentions that:

"[OAuthConsumer and OAuthProvider] are also serializable, so you can 
persist and restore them later."

I found that to not be the case. When I restore an OAuthConsumer to sign a 
request, it will fail with this traceback:

java.lang.NullPointerException
        at oauth.signpost.signature.OAuthMessageSigner.base64Encode
(OAuthMessageSigner.java:66)
        at oauth.signpost.signature.HmacSha1MessageSigner.sign
(HmacSha1MessageSigner.java:55)
        at oauth.signpost.AbstractOAuthConsumer.sign
(AbstractOAuthConsumer.java:97)
        at oauth.signpost.AbstractOAuthConsumer.sign
(AbstractOAuthConsumer.java:107)

This is because OAuthMessageSigner.base64 is transient and thus wasn't 
serialized.

Original issue reported on code.google.com by sok...@gmail.com on 14 Apr 2010 at 4:32

GoogleCodeExporter commented 8 years ago
Hmm, there is a line in readObject() to reinitialize base64, not sure how the 
traceback happened.

Original comment by sok...@gmail.com on 14 Apr 2010 at 4:36

GoogleCodeExporter commented 8 years ago
As mentioned in the first comment in 
https://issues.apache.org/jira/browse/CODEC-96 , 
calling "new Base64()" is cheap. Maybe we can change to do so in 
OAuthMessageSigner?

Original comment by sok...@gmail.com on 14 Apr 2010 at 4:59

Attachments: