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

KeystoneAuth does not have a default constructor #838

Closed
whaon opened this issue Sep 30, 2016 · 7 comments
Closed

KeystoneAuth does not have a default constructor #838

whaon opened this issue Sep 30, 2016 · 7 comments

Comments

@whaon
Copy link
Contributor

whaon commented Sep 30, 2016

this may cause problems when using jackson to handle it

@auhlig
Copy link
Member

auhlig commented Sep 30, 2016

Can you share more details?

@whaon
Copy link
Contributor Author

whaon commented Oct 8, 2016

public KeystoneAuth(String tokenId, AuthScope scope) {
        this.identity = AuthIdentity.createTokenType(tokenId);
        this.scope = scope;
        this.type = Type.TOKEN;
    }

    public KeystoneAuth(String userId, String password) {
        this(userId, password, null, null);
    }

    public KeystoneAuth(String user, String password, Identifier domain, AuthScope scope) {
        this.identity = AuthIdentity.createCredentialType(user, password, domain);
        this.scope = scope;
        this.type = Type.CREDENTIALS;
    }

    protected KeystoneAuth(Type type) {
        this.type = type;
    }

as we see above,there is no constructor with no parameters in the KeystoneAuth class.
this may cause some problems when using jackson to handle it

@auhlig
Copy link
Member

auhlig commented Oct 8, 2016

So far I'm not aware this caused problems and tests are passing. Did you experience any errors caused by this?

@whaon
Copy link
Contributor Author

whaon commented Oct 9, 2016

Oh,sorry, I have forgot to say that it's OK to serialize it but faild when deserialize it if the Classs does not have a default empty params constructor,the exception occurs like the below:

com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class com.xxx.A]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)

@auhlig
Copy link
Member

auhlig commented Oct 10, 2016

Ah. Okay. Thanks for explaining. Would you like to submit a PR for that?

@whaon
Copy link
Contributor Author

whaon commented Oct 12, 2016

see pr:848

auhlig added a commit that referenced this issue Oct 12, 2016
KeystoneAuth does not have a default constructor #838
@auhlig
Copy link
Member

auhlig commented Oct 12, 2016

Just merged the PR. Cam we close this issue @whaon ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants