You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Bertrand Delacretaz (Created) (JIRA)" <ji...@apache.org> on 2011/10/27 16:16:32 UTC

[jira] [Created] (JCR-3131) NPE in ItemManager when calling Session.save() with nothing to save

NPE in ItemManager when calling Session.save() with nothing to save
-------------------------------------------------------------------

                 Key: JCR-3131
                 URL: https://issues.apache.org/jira/browse/JCR-3131
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: 2.3.2
            Reporter: Bertrand Delacretaz
            Priority: Minor


I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:

    private ItemData retrieveItem(ItemId id) {
        synchronized (itemCache) {
            ItemData data = itemCache.get(id);
            if (data == null && id.denotesNode()) {
...

because the id is null after taking the second branch of this if in SessionSaveOperation.perform:

        if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
            id = context.getRootNodeId();
        } else {
            id = context.getItemStateManager().getIdOfRootTransientNodeState();
        }

context.toString() says:

session-author-3623:
ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
Items in cache:

SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
[transient]
{}[attic]
{}

which I assume means there's nothing to save.

The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Julian Reschke (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13140172#comment-13140172 ] 

Julian Reschke commented on JCR-3131:
-------------------------------------

This seems to reproduce it:

    // https://issues.apache.org/jira/browse/JCR-3131
    public void testEmptySaveNoRootAccess() throws RepositoryException, NotExecutableException {
    	
    	// no change in the session
    	Session s = getTestSession();
    	s.save();

    	Privilege[] read = privilegesFromName(Privilege.JCR_READ);

    	try {
            withdrawPrivileges("/", read, getRestrictions(superuser, path));
        	s.save();
    	}
    	finally {
            givePrivileges("/", read, getRestrictions(superuser, path));
    	}
    }

(to be added in o.a.c.s.a.a.WriteTest)
                
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Assignee: Julian Reschke
>            Priority: Minor
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Julian Reschke (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated JCR-3131:
--------------------------------

    Assignee: Julian Reschke
    
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Assignee: Julian Reschke
>            Priority: Minor
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Julian Reschke (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated JCR-3131:
--------------------------------

    Attachment: JCR-3131.patch
    
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Assignee: Julian Reschke
>            Priority: Minor
>         Attachments: JCR-3131.patch
>
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Jukka Zitting (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-3131:
-------------------------------

    Fix Version/s:     (was: 2.4)
                   2.3.3
    
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Assignee: Stefan Guggisberg
>            Priority: Minor
>             Fix For: 2.3.3
>
>         Attachments: JCR-3131.patch
>
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Stefan Guggisberg (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg resolved JCR-3131.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4

fixed in svn revision 1196062 by committing the patch with some changes (i've chosen a somewhat simpler approach).
                
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Assignee: Stefan Guggisberg
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: JCR-3131.patch
>
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Jukka Zitting (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13141086#comment-13141086 ] 

Jukka Zitting commented on JCR-3131:
------------------------------------

+1 the patch looks good
                
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Assignee: Julian Reschke
>            Priority: Minor
>         Attachments: JCR-3131.patch
>
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Julian Reschke (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13140163#comment-13140163 ] 

Julian Reschke commented on JCR-3131:
-------------------------------------

(confirmed by hacking SessionSaveOperation sp the second branch is always taken)
                
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Priority: Minor
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

--
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-3131) NPE in ItemManager when calling Session.save() with nothing to save

Posted by "Stefan Guggisberg (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg reassigned JCR-3131:
--------------------------------------

    Assignee: Stefan Guggisberg  (was: Julian Reschke)
    
> NPE in ItemManager when calling Session.save() with nothing to save
> -------------------------------------------------------------------
>
>                 Key: JCR-3131
>                 URL: https://issues.apache.org/jira/browse/JCR-3131
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Bertrand Delacretaz
>            Assignee: Stefan Guggisberg
>            Priority: Minor
>         Attachments: JCR-3131.patch
>
>
> I'm getting an NPE on the id.denoteNodes() call below, in ItemManager:
>     private ItemData retrieveItem(ItemId id) {
>         synchronized (itemCache) {
>             ItemData data = itemCache.get(id);
>             if (data == null && id.denotesNode()) {
> ...
> because the id is null after taking the second branch of this if in SessionSaveOperation.perform:
>         if (context.getSessionImpl().hasPermission("/", Session.ACTION_READ)) {
>             id = context.getRootNodeId();
>         } else {
>             id = context.getItemStateManager().getIdOfRootTransientNodeState();
>         }
> context.toString() says:
> session-author-3623:
> ItemManager (org.apache.jackrabbit.core.ItemManager@1e911ccc)
> Items in cache:
> SessionItemStateManager (org.apache.jackrabbit.core.state.SessionItemStateManager@15472b43)
> [transient]
> {}[attic]
> {}
> which I assume means there's nothing to save.
> The correct behavior is probably to do nothing in perform to avoid the NPE.

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