Seemingly incorrect short-circuiting logic
Greetings, org.apache.jackrabbit.webdav.security.report.AclPrincipalReport.java does the following This logic seems wrong to me *if (href == null respMap.containsKey(href)) {* i'd expect it should be || correct? @Override public void init(DavResource resource, ReportInfo info) throws DavException { super.init(resource, info); // build the DAV:responses objects. DavProperty? acl = resource.getProperty(SecurityConstants.ACL); if (!(acl instanceof AclProperty)) { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, DAV:acl property expected.); } DavResourceLocator loc = resource.getLocator(); MapString, MultiStatusResponse respMap = new HashMapString, MultiStatusResponse(); ListAclProperty.Ace list = (ListAclProperty.Ace) ((AclProperty)acl).getValue(); for (AclProperty.Ace ace : list) { String href = ace.getPrincipal().getHref(); *if (href == null respMap.containsKey(href)) {* // ignore non-href principals and principals that have been listed before continue; } // href-principal that has not been found before DavResourceLocator princLocator = loc.getFactory().createResourceLocator(loc.getPrefix(), href); DavResource principalResource = resource.getFactory().createResource(princLocator, resource.getSession()); respMap.put(href, new MultiStatusResponse(principalResource, info.getPropertyNameSet())); } this.responses = respMap.values().toArray(new MultiStatusResponse[respMap.size()]); }
Re: Seemingly incorrect short-circuiting logic
Wrong mailing list? This is Jakarta, not Jackrabbit ... On 17 October 2011 00:44, Dave Brosius dbros...@apache.org wrote: Greetings, org.apache.jackrabbit.webdav.security.report.AclPrincipalReport.java does the following This logic seems wrong to me *if (href == null respMap.containsKey(href)) {* i'd expect it should be || correct? @Override public void init(DavResource resource, ReportInfo info) throws DavException { super.init(resource, info); // build the DAV:responses objects. DavProperty? acl = resource.getProperty(SecurityConstants.ACL); if (!(acl instanceof AclProperty)) { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, DAV:acl property expected.); } DavResourceLocator loc = resource.getLocator(); MapString, MultiStatusResponse respMap = new HashMapString, MultiStatusResponse(); ListAclProperty.Ace list = (ListAclProperty.Ace) ((AclProperty)acl).getValue(); for (AclProperty.Ace ace : list) { String href = ace.getPrincipal().getHref(); *if (href == null respMap.containsKey(href)) {* // ignore non-href principals and principals that have been listed before continue; } // href-principal that has not been found before DavResourceLocator princLocator = loc.getFactory().createResourceLocator(loc.getPrefix(), href); DavResource principalResource = resource.getFactory().createResource(princLocator, resource.getSession()); respMap.put(href, new MultiStatusResponse(principalResource, info.getPropertyNameSet())); } this.responses = respMap.values().toArray(new MultiStatusResponse[respMap.size()]); } - To unsubscribe, e-mail: dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: dev-h...@jakarta.apache.org
Re: Seemingly incorrect short-circuiting logic
Oops, my apologies :) On 10/16/2011 08:06 PM, sebb wrote: Wrong mailing list? This is Jakarta, not Jackrabbit ... On 17 October 2011 00:44, Dave Brosiusdbros...@apache.org wrote: Greetings, org.apache.jackrabbit.webdav.security.report.AclPrincipalReport.java does the following This logic seems wrong to me *if (href == null respMap.containsKey(href)) {* i'd expect it should be || correct? @Override public void init(DavResource resource, ReportInfo info) throws DavException { super.init(resource, info); // build the DAV:responses objects. DavProperty? acl = resource.getProperty(SecurityConstants.ACL); if (!(acl instanceof AclProperty)) { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, DAV:acl property expected.); } DavResourceLocator loc = resource.getLocator(); MapString, MultiStatusResponse respMap = new HashMapString, MultiStatusResponse(); ListAclProperty.Ace list = (ListAclProperty.Ace) ((AclProperty)acl).getValue(); for (AclProperty.Ace ace : list) { String href = ace.getPrincipal().getHref(); *if (href == null respMap.containsKey(href)) {* // ignore non-href principals and principals that have been listed before continue; } // href-principal that has not been found before DavResourceLocator princLocator = loc.getFactory().createResourceLocator(loc.getPrefix(), href); DavResource principalResource = resource.getFactory().createResource(princLocator, resource.getSession()); respMap.put(href, new MultiStatusResponse(principalResource, info.getPropertyNameSet())); } this.responses = respMap.values().toArray(new MultiStatusResponse[respMap.size()]); } - To unsubscribe, e-mail: dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: dev-h...@jakarta.apache.org - To unsubscribe, e-mail: dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: dev-h...@jakarta.apache.org