[ 
https://issues.apache.org/jira/browse/JCR-3085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13117138#comment-13117138
 ] 

Julian Reschke commented on JCR-3085:
-------------------------------------

Proposed change:

--- 
jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerBase.java
    (revision 1176889)
+++ 
jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerBase.java
    (working copy)
@@ -681,6 +681,13 @@
         } else {
             // 1. search a predecessor, suitable for generating the new name
             InternalValue[] values = 
node.getPropertyValues(NameConstants.JCR_PREDECESSORS);
+
+            if (values == null) {
+                String message = "mandatory jcr:predecessors property missing 
on " + node.getNodeId();
+                log.error(message);
+                throw new VersionException(message);
+            }
+            
             for (InternalValue value: values) {
                 InternalVersion pred = history.getVersion(value.getNodeId());
                 if (best == null
                
> better diagnostics when version storage is broken
> -------------------------------------------------
>
>                 Key: JCR-3085
>                 URL: https://issues.apache.org/jira/browse/JCR-3085
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>
> In InternalVersionManagerBase, the code doesn't do a null-check on the 
> predecessors property, assuming it'll always be present. When this is not the 
> case due to a repository problem, we'll see a NPE.
> Proposal: add code that generates a more meaningful error message; making it 
> easier to debug in production.

--
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

        

Reply via email to