jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Rauschenbach (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1131) JCR2SPI NodeEntryImpl throws NPE during reorderNodes
Date Fri, 14 Sep 2007 07:30:32 GMT

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

David Rauschenbach commented on JCR-1131:
-----------------------------------------

By the way, this same problem also occurs when the test is changed to perform a same-name
reorder.

		final String NAME = "nodeName", PROPERTY = "testSeq";
		
		// Create folder 1 on server in root
		Session serverSession = login(repository, creds);
		Node serverRootNode = serverSession.getRootNode();
		Node serverFolder1 = serverRootNode.addNode(NAME, "nt:unstructured");
		serverFolder1.setProperty(PROPERTY, "A");
		
		// Create folder 2 on server in root
		Node serverFolder2 = serverRootNode.addNode(NAME, "nt:unstructured");
		serverFolder2.setProperty(PROPERTY, "B");
		serverSession.save();
		
		// Validate order
		assertEquals(1, serverFolder1.getIndex());
		assertEquals(2, serverFolder2.getIndex());
		
		// Perform reorder via client
		Session clientSession = login(clientRepository, creds);
		Node clientRootNode = clientSession.getRootNode();
		clientRootNode.orderBefore(NAME + "[2]", NAME + "[1]");
		clientSession.save(); <== Throws NPE
		
		// Verify move on server
		serverSession.refresh(false);
		Node firstServerNode = serverRootNode.getNode(NAME + "[1]");
		assertEquals("B", firstServerNode.getProperty(PROPERTY).getString());


> JCR2SPI NodeEntryImpl throws NPE during reorderNodes
> ----------------------------------------------------
>
>                 Key: JCR-1131
>                 URL: https://issues.apache.org/jira/browse/JCR-1131
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: SPI
>    Affects Versions: 1.4
>            Reporter: David Rauschenbach
>
> Two folder nodes are created below root. From the root node, the 2nd folder is ordered
before the first node. The request is batched up correctly, but upon save, NodeEntryImpl throws
a NullPointerException in the first line of the completeTransientChanges method, because revertInfo.oldParent
is null.
> Test code:
> 		final String FOLDER1 = "folder1", FOLDER2 = "folder2";
> 		
> 		// Create folder 1 on server in root
> 		Session serverSession = login(repository, creds);
> 		Node serverRootNode = serverSession.getRootNode();
> 		Node serverFolder1 = serverRootNode.addNode(FOLDER1, "nt:folder");
> 		
> 		// Create folder 2 on server in root
> 		Node serverFolder2 = serverRootNode.addNode(FOLDER2, "nt:folder");
> 		serverSession.save();
> 		
> 		// Validate order (TODO)
> 		
> 		// Perform reorder via client
> 		Session clientSession = login(clientRepository, creds);
> 		Node clientRootNode = clientSession.getRootNode();
> 		clientRootNode.orderBefore(FOLDER2, FOLDER1);
> 		clientSession.save(); <== Throws NPE
> Call Stack:
>     [junit] java.lang.NullPointerException
>     [junit]     at org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl.completeTransientChanges(NodeEntryImpl.java:1354)
>     [junit]     at org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl.access$1100(NodeEntryImpl.java:60)
>     [junit]     at org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl$RevertInfo.statusChanged(NodeEntryImpl.java:1465)
>     [junit]     at org.apache.jackrabbit.jcr2spi.state.ItemState.setStatus(ItemState.java:257)
>     [junit]     at org.apache.jackrabbit.jcr2spi.state.NodeState.adjustNodeState(NodeState.java:554)
>     [junit]     at org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(NodeState.java:276)
>     [junit]     at org.apache.jackrabbit.jcr2spi.state.ChangeLog.persisted(ChangeLog.java:135)
>     [junit]     at org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.java:479)
>     [junit]     at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(SessionItemStateManager.java:149)
>     [junit]     at org.apache.jackrabbit.jcr2spi.ItemImpl.save(ItemImpl.java:239)
>     [junit]     at org.apache.jackrabbit.jcr2spi.SessionImpl.save(SessionImpl.java:317)
>     [junit]     at TestWsNodeReorder.testReorderNodes(TestWsNodeReorder.java:72)
> I'm using an SPI I implemented, in conjunction with the jcr2spi and spi2jcr bridges,
coupled with a back-end Jackrabbit in-memory filesystem. So there's always the possibility
that node or property SPI calls inject errors and cause this downstream problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message