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(jans): add null check to avoid NullPointerException #3074

Closed
pujavs opened this issue Nov 24, 2022 · 0 comments · Fixed by #3077
Closed

fix(jans): add null check to avoid NullPointerException #3074

pujavs opened this issue Nov 24, 2022 · 0 comments · Fixed by #3077
Assignees
Labels
kind-bug Issue or PR is a bug in existing functionality

Comments

@pujavs
Copy link
Contributor

pujavs commented Nov 24, 2022

Describe the bug
Getting NullPointerException is two cases
1) CustomObjectAttribute:
URL: GET https://jenkins-build.jans.io/jans-config-api/mgt/configuser?limit=3
Logs:
config-api-CustomObjectAttribute-6028.log

Log snippet:
Caused by: java.lang.NullPointerException at io.jans.orm.model.base.CustomObjectAttribute.getDisplayValue(CustomObjectAttribute.java:92) at jdk.internal.reflect.GeneratedMethodAccessor1136.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:689) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:774)

Screenshot:
image

2) LocalizedString

URL: POST http://localhost:8080/jans-config-api/api/v1/openid/clients
JSON:
{ "dn": null, "expirationDate": null, "deletable": true, "clientSecret": "password", "frontChannelLogoutUri": null, "frontChannelLogoutSessionRequired": true, "registrationAccessToken": null, "clientIdIssuedAt": null, "clientSecretExpiresAt": null, "redirectUris": ["https://myserver.com"], "claimRedirectUris": [], "responseTypes": [], "grantTypes": [], "applicationType": "native", "contacts": [], "idTokenTokenBindingCnf": null, "clientName": "clientName-test1", "logoUri": null, "clientUri": null, "policyUri": null, "tosUri": null, "clientNameLocalized": { "values": null, "value": null, "languageTags": [] }, "logoUriLocalized": { "values": null, "value": "https://myserver.com/logoUriLocalized", "languageTags": [] }, "clientUriLocalized": { "values": null, "value": "https://myserver.com/clientUriLocalized", "languageTags": [] }, "policyUriLocalized": { "values": null, "value": "https://myserver.com/policyUriLocalized", "languageTags": [] }, "tosUriLocalized": { "values": null, "value": "https://myserver.com/tosUriLocalized", "languageTags": [] }, "jwksUri": null, "jwks": null, "sectorIdentifierUri": null, "subjectType": "public", "idTokenSignedResponseAlg": null, "idTokenEncryptedResponseAlg": null, "idTokenEncryptedResponseEnc": null, "userInfoSignedResponseAlg": null, "userInfoEncryptedResponseAlg": null, "userInfoEncryptedResponseEnc": null, "requestObjectSigningAlg": null, "requestObjectEncryptionAlg": null, "requestObjectEncryptionEnc": null, "tokenEndpointAuthMethod": null, "tokenEndpointAuthSigningAlg": null, "defaultMaxAge": null, "defaultAcrValues": [], "initiateLoginUri": null, "postLogoutRedirectUris": [], "requestUris": [], "scopes": [], "claims": [], "trustedClient": true, "lastAccessTime": null, "lastLogonTime": null, "persistClientAuthorizations": true, "includeClaimsInIdToken": true, "refreshTokenLifetime": null, "accessTokenLifetime": null, "customAttributes": [{ "name": "displayName", "multiValued": false, "values": ["Jans Role Based Client"], "value": "Jans Role Based Client", "displayValue": "Jans Role Based Client" }], "customObjectClasses": [], "rptAsJwt": true, "accessTokenAsJwt": true, "accessTokenSigningAlg": null, "disabled": true, "authorizedOrigins": [], "softwareId": null, "softwareVersion": null, "softwareStatement": null, "attributes": { "tlsClientAuthSubjectDn": null, "runIntrospectionScriptBeforeJwtCreation": false, "keepClientAuthorizationAfterExpiration": true, "allowSpontaneousScopes": true, "spontaneousScopes": [], "spontaneousScopeScriptDns": [], "updateTokenScriptDns": [], "backchannelLogoutUri": [], "backchannelLogoutSessionRequired": true, "additionalAudience": [], "postAuthnScripts": [], "consentGatheringScripts": [], "introspectionScripts": [], "rptClaimsScripts": [], "ropcScripts": [], "parLifetime": null, "requirePar": false, "jansAuthSignedRespAlg": null, "jansAuthEncRespAlg": null, "jansAuthEncRespEnc": null, "jansSubAttr": null, "redirectUrisRegex": null, "jansAuthorizedAcr": [], "jansDefaultPromptLogin": true, "idTokenLifetime": null }, "backchannelTokenDeliveryMode": "poll", "backchannelClientNotificationEndpoint": null, "backchannelAuthenticationRequestSigningAlg": "PS384", "backchannelUserCodeParameter": true, "description": null, "organization": null, "groups": [], "ttl": null, "displayName": null, "tokenBindingSupported": false, "authenticationMethod": "client_secret_jwt", "baseDn": null, "inum": null }

Logs:
config-api-LocalizedString-2022_11_24.jetty.log

Log snippet:
Caused by: java.lang.NullPointerException at io.jans.orm.model.base.LocalizedString.getLanguageTags(LocalizedString.java:77) at io.jans.orm.ldap.impl.LdapEntryManager.getAttributeDataListFromLocalizedString(LdapEntryManager.java:641) at io.jans.orm.ldap.impl.LdapEntryManager.addAttributeDataFromLocalizedString(LdapEntryManager.java:995) at io.jans.orm.impl.BaseEntryManager.getAttributesListForPersist(BaseEntryManager.java:1574) at io.jans.orm.impl.BaseEntryManager.persist(BaseEntryManager.java:107) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566)

Screenshot:
image

@pujavs pujavs self-assigned this Nov 24, 2022
@mo-auto mo-auto added the kind-bug Issue or PR is a bug in existing functionality label Nov 24, 2022
@pujavs pujavs changed the title fix(jans): added null check to avoid NullPointerException fix(jans): add null check to avoid NullPointerException Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind-bug Issue or PR is a bug in existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants