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

Eric Norman commented on SLING-1648:
------------------------------------

Actually this seems like it may be a bug in jackrabbit.  We could probably 
workaround the problem by using Node#getNode or Node#getProperty instead of 
Session#getItem since the former don't throw an exception while the latter does.

For example, the following code does basically the same as what the sling move 
operation does and it results in the same exception:

//add a couple nodes
Node parentNode = session.getRootNode();
parentNode.addNode("aTest1");
parentNode.addNode("aTest2");
session.save();

//remove the node at the destination path
session.getItem("/aTest1").remove();

//move the src to the destiniation
session.move("/aTest2", "/aTest1");

//this lookup works fine
Node node = parentNode.getNode("aTest1");

//this lookup for the same item throws PathNotFoundException!!
Item item = session.getItem("/aTest1");

                
> Node move with :replace fails
> -----------------------------
>
>                 Key: SLING-1648
>                 URL: https://issues.apache.org/jira/browse/SLING-1648
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Post 2.0.4
>            Reporter: daniel parry
>            Assignee: Eric Norman
>
> Following docs at 
> http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html
>  In trunk, Revision: 984520, steps to reproduce error:
> curl -uadmin:admin -Ftitle="test" -Ftext="test" http://localhost:8080/test1
> curl -uadmin:admin -Ftitle="test" -Ftext="test" http://localhost:8080/test2
> curl -uadmin:admin -F":operation=move" -F:dest="/test2" 
> http://localhost:8080/test1 (Not allowed to move without :replace as expected)
> curl -uadmin:admin -F":operation=move" -F":replace=true" -F:dest="/test2" 
> http://localhost:8080/test1 (This should work with :replace specified)
> However, error encountered:
> <html>
> <head>
>     <title>Error while processing /test1</title>
> </head>
>     <body>
>     <h1>Error while processing /test1</h1>
>     <table>
>         <tbody>
>             <tr>
>                 <td>Status</td>
>                 <td><div id="Status">500</div></td>
>             </tr>
>             <tr>
>                 <td>Message</td>
>                 <td><div id="Message">javax.jcr.PathNotFoundException: 
> /test2</div></td>
>             </tr>
>             <tr>
>                 <td>Location</td>
>                 <td><a href="/test1" id="Location">/test1</a></td>
>             </tr>
>             <tr>
>                 <td>Parent Location</td>
>                 <td><a href="/" id="ParentLocation">/</a></td>
>             </tr>
>             <tr>
>                 <td>Path</td>
>                 <td><div id="Path">/test1</div></td>
>             </tr>
>             <tr>
>                 <td>Referer</td>
>                 <td><a href="" id="Referer"></a></td>
>             </tr>
>             <tr>
>                 <td>ChangeLog</td>
>                 <td><div id="ChangeLog"><pre></pre></div></td>
>             </tr>
>         </tbody>
>     </table>
>     <p><a href="">Go Back</a></p>
>     <p><a href="/test1">Modified Resource</a></p>
>     <p><a href="/">Parent of Modified Resource</a></p>
>     </body>
> </html>

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