jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1836031 - in /jackrabbit/branches/2.16: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
Date Mon, 16 Jul 2018 12:49:11 GMT
Author: reschke
Date: Mon Jul 16 12:49:11 2018
New Revision: 1836031

URL: http://svn.apache.org/viewvc?rev=1836031&view=rev
Log:
JCR-4324: NPE on Version.getLinearPredecessor() implementation (ported to 2.16)

Modified:
    jackrabbit/branches/2.16/   (props changed)
    jackrabbit/branches/2.16/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java
    jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java

Propchange: jackrabbit/branches/2.16/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 16 12:49:11 2018
@@ -1,3 +1,3 @@
 /jackrabbit/branches/JCR-2272:1173165-1176545
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
-/jackrabbit/trunk:1816227,1817094,1817097-1817098,1817100,1817113,1817201,1817213,1817341,1817373,1817377,1818586,1819269,1819271,1819839,1819849,1820119,1820133,1820294,1820573,1820675,1821247,1821475,1821597,1821705,1821880,1822643,1822863,1822947,1822950,1824756,1824763-1824764,1824771,1824876,1826154,1826178,1826230,1826647,1826940,1826964,1828213,1830107,1830201,1830540,1830753,1830814,1830878,1830951,1831182,1831854,1831860,1832058,1833374,1833835,1833891,1834008,1834315,1834401,1834418
+/jackrabbit/trunk:1816227,1817094,1817097-1817098,1817100,1817113,1817201,1817213,1817341,1817373,1817377,1818586,1819269,1819271,1819839,1819849,1820119,1820133,1820294,1820573,1820675,1821247,1821475,1821597,1821705,1821880,1822643,1822863,1822947,1822950,1824756,1824763-1824764,1824771,1824876,1826154,1826178,1826230,1826647,1826940,1826964,1828213,1830107,1830201,1830540,1830753,1830814,1830878,1830951,1831182,1831854,1831860,1832058,1833374,1833835,1833891,1834008,1834315,1834401,1834418,1834424

Modified: jackrabbit/branches/2.16/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.16/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java?rev=1836031&r1=1836030&r2=1836031&view=diff
==============================================================================
--- jackrabbit/branches/2.16/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java
(original)
+++ jackrabbit/branches/2.16/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java
Mon Jul 16 12:49:11 2018
@@ -127,7 +127,7 @@ public class VersionImpl extends NodeImp
      */
     public javax.jcr.version.Version getLinearPredecessor() throws RepositoryException {
         InternalVersion pred = getInternalVersion().getLinearPredecessor();
-        return (Version) sessionContext.getSessionImpl().getNodeById(pred.getId());
+        return pred == null ? null : (Version) sessionContext.getSessionImpl().getNodeById(pred.getId());
     }
 
     /**

Modified: jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java?rev=1836031&r1=1836030&r2=1836031&view=diff
==============================================================================
--- jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
(original)
+++ jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
Mon Jul 16 12:49:11 2018
@@ -41,31 +41,34 @@ public class GetPredecessorsTest extends
 
         assertTrue("Version should have at minimum one predecessor version.", version.getPredecessors().length
> 0);
     }
-    
+
     /**
-     * Checks ontaining the linear predecessor.
+     * Checks obtaining the linear predecessor.
      * @since JCR 2.0
      */
     public void testGetLinearPredecessorSuccessor() throws RepositoryException {
 
         String path = versionableNode.getPath();
-        
+
         VersionManager vm = versionableNode.getSession().getWorkspace().getVersionManager();
-        
+
         // get the previous version
         Version pred = vm.getBaseVersion(path);
 
+        // shouldn't have a predecessor
+        assertNull(pred.getLinearPredecessor());
+
         // shouldn't have a successor yet
         assertNull(pred.getLinearSuccessor());
-        
+
         // check root version
         Version root = vm.getVersionHistory(path).getRootVersion();
         assertNull(root.getLinearSuccessor());
-        
+
         // create a new version
         vm.checkout(path);
         Version version = vm.checkin(path);
-        
+
         // refresh the predecessor
         pred = (Version)versionableNode.getSession().getNode(pred.getPath());
 



Mime
View raw message