[ https://issues.apache.org/jira/browse/OAK-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14342962#comment-14342962 ]
angela commented on OAK-2540: ----------------------------- [~mreutegg], the following statement is not quite true: {quote} The only implementation with attribute support is SimpleCredentials. {quote} first of all jackrabbit API defines {{TokenCredentials}} that also can have attributes and there might be other credentials depending on the (pluggable) authentication setup. i would rather omit the {{null}} check there. [~alexparvulescu], {{Session#impersonate}} with {{null}} credentials doesn't make sense to me. so, having a check there looks reasonable to me. > Session operations null check > ----------------------------- > > Key: OAK-2540 > URL: https://issues.apache.org/jira/browse/OAK-2540 > Project: Jackrabbit Oak > Issue Type: Bug > Components: jcr > Reporter: Alex Parvulescu > Assignee: Alex Parvulescu > Fix For: 1.1.8 > > Attachments: OAK-2540.patch > > > Calling a _Session.getNode(null)_ throws an ugly NPE. We should add a few > null checks and turn those illegal inputs into IAEs. > For those wondering Jackrabbit doesn't fare better here. > _Oak_ > {code} > java.lang.NullPointerException > at > org.apache.jackrabbit.oak.namepath.NamePathMapperImpl.needsFullMapping(NamePathMapperImpl.java:224) > at > org.apache.jackrabbit.oak.namepath.NamePathMapperImpl.getOakPath(NamePathMapperImpl.java:80) > at > org.apache.jackrabbit.oak.jcr.session.SessionContext.getOakPath(SessionContext.java:306) > at > org.apache.jackrabbit.oak.jcr.session.SessionContext.getOakPathOrThrow(SessionContext.java:325) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.getOakPathOrThrow(SessionImpl.java:149) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.access$1(SessionImpl.java:148) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl$1.perform(SessionImpl.java:188) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl$1.perform(SessionImpl.java:1) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:238) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:139) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.getNodeOrNull(SessionImpl.java:184) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.getNode(SessionImpl.java:315) > {code} > _Jackrabbit_ > {code} > java.lang.NullPointerException > at > org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:93) > at > org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:77) > at > org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver.getQPath(DefaultNamePathResolver.java:82) > at org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:648) > at > org.apache.jackrabbit.core.session.SessionContext.getQPath(SessionContext.java:338) > at > org.apache.jackrabbit.core.session.SessionItemOperation.perform(SessionItemOperation.java:185) > at > org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) > at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:361) > at org.apache.jackrabbit.core.SessionImpl.getNode(SessionImpl.java:1111) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)