You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Mat Lowery <ml...@pentaho.com> on 2011/07/18 15:48:26 UTC
NullPointerException during getBaseVersion
We are using Jackrabbit 1.6.0. A user generated this stack trace recently:
java.lang.NullPointerException
at org.apache.jackrabbit.core.version.AbstractVersionManager.createInternalVersionItem(AbstractVersionManager.java:626)
at org.apache.jackrabbit.core.version.VersionManagerImpl.getItem(VersionManagerImpl.java:260)
at org.apache.jackrabbit.core.version.XAVersionManager.getItem(XAVersionManager.java:356)
at org.apache.jackrabbit.core.version.AbstractVersionManager.getVersion(AbstractVersionManager.java:86)
at org.apache.jackrabbit.core.NodeImpl.getBaseVersion(NodeImpl.java:3652)
Here's the code for createInternalVersionItem:
612 protected InternalVersionItem createInternalVersionItem(NodeId id)
613 throws RepositoryException {
614 try {
615 if (stateMgr.hasItemState(id)) {
616 NodeState state = (NodeState) stateMgr.getItemState(id);
617 NodeStateEx pNode = new NodeStateEx(stateMgr, ntReg, state, null);
618 NodeId parentId = pNode.getParentId();
619 InternalVersionItem parent = getItem(parentId);
620 Name ntName = state.getNodeTypeName();
621 if (ntName.equals(NameConstants.NT_FROZENNODE)) {
622 return new InternalFrozenNodeImpl(this, pNode, parent);
623 } else if (ntName.equals(NameConstants.NT_VERSIONEDCHILD)) {
624 return new InternalFrozenVHImpl(this, pNode, parent);
625 } else if (ntName.equals(NameConstants.NT_VERSION)) {
626 return ((InternalVersionHistory) parent).getVersion(id);
627 } else if (ntName.equals(NameConstants.NT_VERSIONHISTORY)) {
628 return new InternalVersionHistoryImpl(this, pNode);
629 } else {
630 return null;
631 }
632 } else {
633 return null;
634 }
635 } catch (ItemStateException e) {
636 throw new RepositoryException(e);
637 }
638 }
Stepping through the code with a debugger shows that getItem(parentId)
returns null on line 619 because getItem calls createInternalVersionItem
which calls stateMgr.hasItemState(parentId) which returns false. Anyone
have any idea how we got into this situation?
I found a couple of issues in JIRA but they are not the same stack trace:
https://issues.apache.org/jira/browse/JCR-2382
https://issues.apache.org/jira/browse/JCR-1440
Thanks.