Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F65D9C56 for ; Mon, 31 Oct 2011 14:07:54 +0000 (UTC) Received: (qmail 50812 invoked by uid 500); 31 Oct 2011 14:07:53 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 50773 invoked by uid 500); 31 Oct 2011 14:07:53 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 50766 invoked by uid 99); 31 Oct 2011 14:07:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Oct 2011 14:07:53 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Oct 2011 14:07:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id B208F32A5B6 for ; Mon, 31 Oct 2011 14:07:32 +0000 (UTC) Date: Mon, 31 Oct 2011 14:07:32 +0000 (UTC) From: "Julian Reschke (Commented) (JIRA)" To: dev@jackrabbit.apache.org Message-ID: <1913744980.40881.1320070052730.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1474051628.24883.1319724992373.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (JCR-3131) NPE in ItemManager when calling Session.save() with nothing to save MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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