You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Julian Reschke (Created) (JIRA)" <ji...@apache.org> on 2011/10/13 13:21:11 UTC
[jira] [Created] (JCR-3111) InternalVersionManagerBase; missing
null check after getNode()
InternalVersionManagerBase; missing null check after getNode()
--------------------------------------------------------------
Key: JCR-3111
URL: https://issues.apache.org/jira/browse/JCR-3111
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: jackrabbit-core, versioning
Reporter: Julian Reschke
There are at least two instances where we check for a node with hasNode(), and then call getNode() without checking for null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (JCR-3111) InternalVersionManagerBase; missing
null check after getNode()
Posted by "Julian Reschke (Assigned) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-3111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Reschke reassigned JCR-3111:
-----------------------------------
Assignee: Julian Reschke
> InternalVersionManagerBase; missing null check after getNode()
> --------------------------------------------------------------
>
> Key: JCR-3111
> URL: https://issues.apache.org/jira/browse/JCR-3111
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, versioning
> Reporter: Julian Reschke
> Assignee: Julian Reschke
> Attachments: JCR-3111.patch
>
>
> There are at least two instances where we check for a node with hasNode(), and then call getNode() without checking for null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (JCR-3111) InternalVersionManagerBase; missing
null check after getNode()
Posted by "Julian Reschke (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-3111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Reschke resolved JCR-3111.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.3.2
2.2.10
trunk: r1183409
2.2: 1183425
> InternalVersionManagerBase; missing null check after getNode()
> --------------------------------------------------------------
>
> Key: JCR-3111
> URL: https://issues.apache.org/jira/browse/JCR-3111
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, versioning
> Reporter: Julian Reschke
> Assignee: Julian Reschke
> Fix For: 2.2.10, 2.3.2
>
> Attachments: JCR-3111.patch, JCR-3111.patch
>
>
> There are at least two instances where we check for a node with hasNode(), and then call getNode() without checking for null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JCR-3111) InternalVersionManagerBase; missing
null check after getNode()
Posted by "Julian Reschke (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-3111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13126490#comment-13126490 ]
Julian Reschke commented on JCR-3111:
-------------------------------------
For instance, in getVersionHistoryOfNode:
public InternalVersionHistory getVersionHistoryOfNode(NodeId id)
throws RepositoryException {
VersioningLock.ReadLock lock = acquireReadLock();
try {
String uuid = id.toString();
Name name = getName(uuid);
NodeStateEx parent = getParentNode(getHistoryRoot(), uuid, null);
if (parent != null && parent.hasNode(name)) {
NodeStateEx history = parent.getNode(name, 1);
return getVersionHistory(history.getNodeId());
} else {
throw new ItemNotFoundException("Version history of node " + id + " not found.");
}
} finally {
lock.release();
}
}
> InternalVersionManagerBase; missing null check after getNode()
> --------------------------------------------------------------
>
> Key: JCR-3111
> URL: https://issues.apache.org/jira/browse/JCR-3111
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, versioning
> Reporter: Julian Reschke
>
> There are at least two instances where we check for a node with hasNode(), and then call getNode() without checking for null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (JCR-3111) InternalVersionManagerBase; missing
null check after getNode()
Posted by "Julian Reschke (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-3111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Reschke updated JCR-3111:
--------------------------------
Attachment: JCR-3111.patch
new proposed patch, just adding explicit exceptions supplying more information
> InternalVersionManagerBase; missing null check after getNode()
> --------------------------------------------------------------
>
> Key: JCR-3111
> URL: https://issues.apache.org/jira/browse/JCR-3111
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, versioning
> Reporter: Julian Reschke
> Assignee: Julian Reschke
> Attachments: JCR-3111.patch, JCR-3111.patch
>
>
> There are at least two instances where we check for a node with hasNode(), and then call getNode() without checking for null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (JCR-3111) InternalVersionManagerBase; missing
null check after getNode()
Posted by "Julian Reschke (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-3111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13127415#comment-13127415 ]
Julian Reschke commented on JCR-3111:
-------------------------------------
Actually, NodeStateEx.getNode(name, ...) *only* returns null if the child node entry is not found:
ChildNodeEntry entry = nodeState.getChildNodeEntry(name, index);
if (entry == null) {
return null;
}
...otherwise it throws. So if the NPE happens in getVersionHistoryOfNode (and it has...), this indicates that some strange is happening which can't even be explained by inconsistent storage.
So a better approach seems to be to simply add null checks, and add better diagnostics for now. Maybe this will help understanding what's going on next time it happens.
> InternalVersionManagerBase; missing null check after getNode()
> --------------------------------------------------------------
>
> Key: JCR-3111
> URL: https://issues.apache.org/jira/browse/JCR-3111
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, versioning
> Reporter: Julian Reschke
> Assignee: Julian Reschke
> Attachments: JCR-3111.patch
>
>
> There are at least two instances where we check for a node with hasNode(), and then call getNode() without checking for null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (JCR-3111) InternalVersionManagerBase; missing
null check after getNode()
Posted by "Julian Reschke (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-3111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Reschke updated JCR-3111:
--------------------------------
Attachment: JCR-3111.patch
Proposed patch.
> InternalVersionManagerBase; missing null check after getNode()
> --------------------------------------------------------------
>
> Key: JCR-3111
> URL: https://issues.apache.org/jira/browse/JCR-3111
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, versioning
> Reporter: Julian Reschke
> Assignee: Julian Reschke
> Attachments: JCR-3111.patch
>
>
> There are at least two instances where we check for a node with hasNode(), and then call getNode() without checking for null.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira