nus-yam/ex-repair huggingface dataset:
Program: 8956
Project: 8956
Buggy source:
@Nonnull @Override public PermissionProvider getPermissionProvider(final @Nonnull Root root,final @Nonnull String workspaceName,final @Nonnull Set<Principal> principals){
  List<AuthorizationConfiguration> configurations=getConfigurations();
switch (configurations.size()) {
case 0:
    throw new IllegalStateException();
case 1:
  return configurations.get(0).getPermissionProvider(root,workspaceName,principals);
default :
List<AggregatedPermissionProvider> aggrPermissionProviders=Lists.newArrayListWithCapacity(configurations.size());
for (AuthorizationConfiguration conf : configurations) {
PermissionProvider pProvider=conf.getPermissionProvider(root,workspaceName,principals);
if (pProvider instanceof AggregatedPermissionProvider) {
  aggrPermissionProviders.add((AggregatedPermissionProvider)pProvider);
}
}
if (aggrPermissionProviders.size() == 1) {
return aggrPermissionProviders.get(0);
}
 else {
return new CompositePermissionProvider(root,aggrPermissionProviders);
}
}
}

Fixed version (ground truth):
@Nonnull @Override public PermissionProvider getPermissionProvider(@Nonnull final Root root,@Nonnull final String workspaceName,@Nonnull final Set<Principal> principals){
  List<AuthorizationConfiguration> configurations=getConfigurations();
switch (configurations.size()) {
case 0:
    throw new IllegalStateException();
case 1:
  return configurations.get(0).getPermissionProvider(root,workspaceName,principals);
default :
List<AggregatedPermissionProvider> aggrPermissionProviders=Lists.newArrayListWithCapacity(configurations.size());
for (AuthorizationConfiguration conf : configurations) {
PermissionProvider pProvider=conf.getPermissionProvider(root,workspaceName,principals);
if (pProvider instanceof AggregatedPermissionProvider) {
  aggrPermissionProviders.add((AggregatedPermissionProvider)pProvider);
}
}
if (aggrPermissionProviders.size() == 1) {
return aggrPermissionProviders.get(0);
}
 else {
return new CompositePermissionProvider(root,aggrPermissionProviders);
}
}
}
Program: 8957
Project: 8957
Buggy source:
@Override public boolean hasPrivileges(final @Nullable Tree tree,@Nonnull String... privilegeNames){
  for (  final String privName : pbp.getAggregatedPrivilegeNames(privilegeNames)) {
    Iterable<AggregatedPermissionProvider> providers=Iterables.filter(pps,new Predicate<AggregatedPermissionProvider>(){
      @Override public boolean apply(      @Nullable AggregatedPermissionProvider pp){
        return pp != null && ((tree == null) ? pp.handlesRepositoryPermissions() : pp.handles(tree,pbp.getBits(privName)));
      }
    }
);
    for (    AggregatedPermissionProvider pp : providers) {
      if (!pp.hasPrivileges(tree,privName)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean hasPrivileges(@Nullable final Tree tree,@Nonnull String... privilegeNames){
  for (  final String privName : pbp.getAggregatedPrivilegeNames(privilegeNames)) {
    Iterable<AggregatedPermissionProvider> providers=Iterables.filter(pps,new Predicate<AggregatedPermissionProvider>(){
      @Override public boolean apply(      @Nullable AggregatedPermissionProvider pp){
        return pp != null && ((tree == null) ? pp.handlesRepositoryPermissions() : pp.handles(tree,pbp.getBits(privName)));
      }
    }
);
    for (    AggregatedPermissionProvider pp : providers) {
      if (!pp.hasPrivileges(tree,privName)) {
        return false;
      }
    }
  }
  return true;
}
Program: 8958
Project: 8958
Buggy source:
@Override public Set<String> getPrivileges(final @Nullable Tree tree){
  PrivilegeBits result=null;
  Iterable<AggregatedPermissionProvider> providers=Iterables.filter(pps,new Predicate<AggregatedPermissionProvider>(){
    @Override public boolean apply(    @Nullable AggregatedPermissionProvider pp){
      return pp != null && ((tree != null) || pp.handlesRepositoryPermissions());
    }
  }
);
  for (  AggregatedPermissionProvider pp : providers) {
    PrivilegeBits privs=pbp.getBits(pp.getPrivileges(tree));
    if (result == null) {
      result=PrivilegeBits.getInstance();
      result.add(privs);
    }
 else {
      result.retain(privs);
    }
  }
  return pbp.getPrivilegeNames(result);
}

Fixed version (ground truth):
@Override public Set<String> getPrivileges(@Nullable final Tree tree){
  PrivilegeBits result=null;
  Iterable<AggregatedPermissionProvider> providers=Iterables.filter(pps,new Predicate<AggregatedPermissionProvider>(){
    @Override public boolean apply(    @Nullable AggregatedPermissionProvider pp){
      return pp != null && ((tree != null) || pp.handlesRepositoryPermissions());
    }
  }
);
  for (  AggregatedPermissionProvider pp : providers) {
    PrivilegeBits privs=pbp.getBits(pp.getPrivileges(tree));
    if (result == null) {
      result=PrivilegeBits.getInstance();
      result.add(privs);
    }
 else {
      result.retain(privs);
    }
  }
  return pbp.getPrivilegeNames(result);
}
Program: 8959
Project: 8959
Buggy source:
private CompositeTreePermission(final @Nonnull ImmutableTree tree,@Nonnull CompositeTreePermission parentPermission){
  this.tree=tree;
  this.parentPermission=parentPermission;
  map=new LinkedHashMap<AggregatedPermissionProvider,TreePermission>(pps.size());
  for (  AggregatedPermissionProvider provider : pps) {
    TreePermission tp=provider.getTreePermission(tree,getParentPermission(provider));
    map.put(provider,tp);
  }
}

Fixed version (ground truth):
private CompositeTreePermission(@Nonnull final ImmutableTree tree,@Nonnull CompositeTreePermission parentPermission){
  this.tree=tree;
  this.parentPermission=parentPermission;
  map=new LinkedHashMap<AggregatedPermissionProvider,TreePermission>(pps.size());
  for (  AggregatedPermissionProvider provider : pps) {
    TreePermission tp=provider.getTreePermission(tree,getParentPermission(provider));
    map.put(provider,tp);
  }
}
Program: 8960
Project: 8960
Buggy source:
@Nonnull @Override public RestrictionPattern getPattern(@Nullable String oakPath,@Nonnull Set<Restriction> restrictions){
  if (oakPath == null || restrictions.isEmpty()) {
    return RestrictionPattern.EMPTY;
  }
 else {
    List<RestrictionPattern> patterns=new ArrayList<RestrictionPattern>(3);
    for (    Restriction r : restrictions) {
      String name=r.getDefinition().getName();
      if (REP_GLOB.equals(name)) {
        patterns.add(GlobPattern.create(oakPath,r.getProperty().getValue(Type.STRING)));
      }
 else       if (REP_NT_NAMES.equals(name)) {
        patterns.add(new NodeTypePattern(r.getProperty().getValue(Type.NAMES)));
      }
 else       if (REP_PREFIXES.equals(name)) {
        patterns.add(new PrefixPattern(r.getProperty().getValue(Type.STRINGS)));
      }
 else {
        log.debug("String_Node_Str" + name);
      }
    }
    return CompositePattern.create(patterns);
  }
}

Fixed version (ground truth):
@Nonnull @Override public RestrictionPattern getPattern(@Nullable String oakPath,@Nonnull Set<Restriction> restrictions){
  if (oakPath == null || restrictions.isEmpty()) {
    return RestrictionPattern.EMPTY;
  }
 else {
    List<RestrictionPattern> patterns=new ArrayList<RestrictionPattern>(NUMBER_OF_DEFINITIONS);
    for (    Restriction r : restrictions) {
      String name=r.getDefinition().getName();
      if (REP_GLOB.equals(name)) {
        patterns.add(GlobPattern.create(oakPath,r.getProperty().getValue(Type.STRING)));
      }
 else       if (REP_NT_NAMES.equals(name)) {
        patterns.add(new NodeTypePattern(r.getProperty().getValue(Type.NAMES)));
      }
 else       if (REP_PREFIXES.equals(name)) {
        patterns.add(new PrefixPattern(r.getProperty().getValue(Type.STRINGS)));
      }
 else {
        log.debug("String_Node_Str" + name);
      }
    }
    return CompositePattern.create(patterns);
  }
}
Program: 8961
Project: 8961
Buggy source:
@Override public void propertiesCompleted(@Nonnull Tree protectedParent) throws IllegalStateException, ConstraintViolationException, RepositoryException {
  Authorizable a=userManager.getAuthorizable(protectedParent);
  if (a == null) {
    return;
  }
  if (!protectedParent.hasProperty(REP_AUTHORIZABLE_ID)) {
    protectedParent.setProperty(REP_AUTHORIZABLE_ID,a.getID(),Type.STRING);
  }
  if (protectedParent.getStatus() == Tree.Status.NEW) {
    if (a.isGroup()) {
      userManager.onCreate((Group)a);
    }
 else {
      userManager.onCreate((User)a,currentPw);
    }
  }
  currentPw=null;
}

Fixed version (ground truth):
@Override public void propertiesCompleted(@Nonnull Tree protectedParent) throws RepositoryException {
  Authorizable a=userManager.getAuthorizable(protectedParent);
  if (a == null) {
    return;
  }
  if (!protectedParent.hasProperty(REP_AUTHORIZABLE_ID)) {
    protectedParent.setProperty(REP_AUTHORIZABLE_ID,a.getID(),Type.STRING);
  }
  if (protectedParent.getStatus() == Tree.Status.NEW) {
    if (a.isGroup()) {
      userManager.onCreate((Group)a);
    }
 else {
      userManager.onCreate((User)a,currentPw);
    }
  }
  currentPw=null;
}
Program: 8962
Project: 8962
Buggy source:
@Override public User createSystemUser(String userID,String intermediatePath) throws AuthorizableExistsException, RepositoryException {
  checkValidID(userID);
  Principal principal=new PrincipalImpl(userID);
  checkValidPrincipal(principal,false);
  Tree userTree=userProvider.createSystemUser(userID,intermediatePath);
  setPrincipal(userTree,principal);
  User user=new SystemUserImpl(userID,userTree,this);
  log.debug("String_Node_Str" + userID);
  return user;
}

Fixed version (ground truth):
@Override public User createSystemUser(String userID,String intermediatePath) throws RepositoryException {
  checkValidID(userID);
  Principal principal=new PrincipalImpl(userID);
  checkValidPrincipal(principal,false);
  Tree userTree=userProvider.createSystemUser(userID,intermediatePath);
  setPrincipal(userTree,principal);
  User user=new SystemUserImpl(userID,userTree,this);
  log.debug("String_Node_Str" + userID);
  return user;
}
Program: 8963
Project: 8963
Buggy source:
@Override public User createSystemUser(String userID,String intermediatePath) throws AuthorizableExistsException, RepositoryException {
  try {
    return wrap(dlg.createUser(userID,intermediatePath));
  }
  finally {
    autosave();
  }
}

Fixed version (ground truth):
@Override public User createSystemUser(String userID,String intermediatePath) throws RepositoryException {
  try {
    return wrap(dlg.createUser(userID,intermediatePath));
  }
  finally {
    autosave();
  }
}
Program: 8964
Project: 8964
Buggy source:
@Override public boolean removeMember(Authorizable authorizable) throws RepositoryException {
  try {
    if (isValid(authorizable)) {
      return getDelegate().removeMember(((AuthorizableImpl)authorizable).dlg);
    }
 else {
      return false;
    }
  }
  finally {
    mgr.autosave();
  }
}

Fixed version (ground truth):
@Override public boolean removeMember(Authorizable authorizable) throws RepositoryException {
  try {
    if (isValid(authorizable)) {
      return getDelegate().removeMember(((AuthorizableImpl)authorizable).getDlg());
    }
 else {
      return false;
    }
  }
  finally {
    getMgr().autosave();
  }
}
Program: 8965
Project: 8965
Buggy source:
@Override public boolean addMember(Authorizable authorizable) throws RepositoryException {
  try {
    if (isValid(authorizable)) {
      return getDelegate().addMember(((AuthorizableImpl)authorizable).dlg);
    }
 else {
      return false;
    }
  }
  finally {
    mgr.autosave();
  }
}

Fixed version (ground truth):
@Override public boolean addMember(Authorizable authorizable) throws RepositoryException {
  try {
    if (isValid(authorizable)) {
      return getDelegate().addMember(((AuthorizableImpl)authorizable).getDlg());
    }
 else {
      return false;
    }
  }
  finally {
    getMgr().autosave();
  }
}
Program: 8966
Project: 8966
Buggy source:
@Override public Iterator<Authorizable> getDeclaredMembers() throws RepositoryException {
  return AuthorizableWrapper.createIterator(getDelegate().getDeclaredMembers(),mgr);
}

Fixed version (ground truth):
@Override public Iterator<Authorizable> getDeclaredMembers() throws RepositoryException {
  return AuthorizableWrapper.createIterator(getDelegate().getDeclaredMembers(),getMgr());
}
Program: 8967
Project: 8967
Buggy source:
@Override public boolean isDeclaredMember(Authorizable authorizable) throws RepositoryException {
  if (isValid(authorizable)) {
    return getDelegate().isDeclaredMember(((AuthorizableImpl)authorizable).dlg);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean isDeclaredMember(Authorizable authorizable) throws RepositoryException {
  if (isValid(authorizable)) {
    return getDelegate().isDeclaredMember(((AuthorizableImpl)authorizable).getDlg());
  }
 else {
    return false;
  }
}
Program: 8968
Project: 8968
Buggy source:
private Group getDelegate(){
  return (Group)dlg;
}

Fixed version (ground truth):
Group getDelegate(){
  return (Group)getDlg();
}
Program: 8969
Project: 8969
Buggy source:
@Override public boolean isMember(Authorizable authorizable) throws RepositoryException {
  if (isValid(authorizable)) {
    return getDelegate().isMember(((AuthorizableImpl)authorizable).dlg);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean isMember(Authorizable authorizable) throws RepositoryException {
  if (isValid(authorizable)) {
    return getDelegate().isMember(((AuthorizableImpl)authorizable).getDlg());
  }
 else {
    return false;
  }
}
Program: 8970
Project: 8970
Buggy source:
@Override public Iterator<Authorizable> getMembers() throws RepositoryException {
  return AuthorizableWrapper.createIterator(getDelegate().getMembers(),mgr);
}

Fixed version (ground truth):
@Override public Iterator<Authorizable> getMembers() throws RepositoryException {
  return AuthorizableWrapper.createIterator(getDelegate().getMembers(),getMgr());
}
Program: 8971
Project: 8971
Buggy source:
@Override public boolean grantImpersonation(Principal principal) throws RepositoryException {
  try {
    return dlg.grantImpersonation(principal);
  }
  finally {
    mgr.autosave();
  }
}

Fixed version (ground truth):
@Override public boolean grantImpersonation(Principal principal) throws RepositoryException {
  try {
    return dlg.grantImpersonation(principal);
  }
  finally {
    getMgr().autosave();
  }
}
Program: 8972
Project: 8972
Buggy source:
private User getDelegate(){
  return (User)dlg;
}

Fixed version (ground truth):
private User getDelegate(){
  return (User)getDlg();
}
Program: 8973
Project: 8973
Buggy source:
@Override public void changePassword(String pw,String oldPw) throws RepositoryException {
  try {
    getDelegate().changePassword(pw,oldPw);
  }
  finally {
    mgr.autosave();
  }
}

Fixed version (ground truth):
@Override public void changePassword(String pw,String oldPw) throws RepositoryException {
  try {
    getDelegate().changePassword(pw,oldPw);
  }
  finally {
    getMgr().autosave();
  }
}
Program: 8974
Project: 8974
Buggy source:
@Override public void disable(String msg) throws RepositoryException {
  try {
    getDelegate().disable(msg);
  }
  finally {
    mgr.autosave();
  }
}

Fixed version (ground truth):
@Override public void disable(String msg) throws RepositoryException {
  try {
    getDelegate().disable(msg);
  }
  finally {
    getMgr().autosave();
  }
}
Program: 8975
Project: 8975
Buggy source:
@Override public boolean revokeImpersonation(Principal principal) throws RepositoryException {
  try {
    return dlg.revokeImpersonation(principal);
  }
  finally {
    mgr.autosave();
  }
}

Fixed version (ground truth):
@Override public boolean revokeImpersonation(Principal principal) throws RepositoryException {
  try {
    return dlg.revokeImpersonation(principal);
  }
  finally {
    getMgr().autosave();
  }
}
Program: 8977
Project: 8977
Buggy source:
/** 
 * Constructor for non-OSGi cases.
 * @param config the configuration
 */
public LdapIdentityProvider(LdapProviderConfig config){
  this.config=config;
  init();
}

Fixed version (ground truth):
/** 
 * Constructor for non-OSGi cases.
 * @param config the configuration
 */
public LdapIdentityProvider(@Nonnull LdapProviderConfig config){
  this.config=config;
  init();
}
Program: 8978
Project: 8978
Buggy source:
/** 
 * Initializes the ldap identity provider.
 */
private void init(){
  if (adminConnectionFactory != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  LdapConnectionConfig cc=createConnectionConfig();
  if (!config.getBindDN().isEmpty()) {
    cc.setName(config.getBindDN());
    cc.setCredentials(config.getBindPassword());
  }
  adminConnectionFactory=new PoolableLdapConnectionFactory(cc);
  if (config.getAdminPoolConfig().getMaxActive() != 0) {
    adminPool=new LdapConnectionPool(adminConnectionFactory);
    adminPool.setTestOnBorrow(true);
    adminPool.setMaxActive(config.getAdminPoolConfig().getMaxActive());
    adminPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
  }
  cc=createConnectionConfig();
  userConnectionFactory=new PoolableUnboundConnectionFactory(cc);
  if (config.getUserPoolConfig().getMaxActive() != 0) {
    userPool=new UnboundLdapConnectionPool(userConnectionFactory);
    userPool.setTestOnBorrow(true);
    userPool.setMaxActive(config.getUserPoolConfig().getMaxActive());
    userPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
  }
  log.info("String_Node_Str",config);
}

Fixed version (ground truth):
/** 
 * Initializes the ldap identity provider.
 */
private void init(){
  if (adminConnectionFactory != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  LdapConnectionConfig cc=createConnectionConfig();
  String bindDN=config.getBindDN();
  if (bindDN != null && !bindDN.isEmpty()) {
    cc.setName(bindDN);
    cc.setCredentials(config.getBindPassword());
  }
  adminConnectionFactory=new PoolableLdapConnectionFactory(cc);
  if (config.getAdminPoolConfig().getMaxActive() != 0) {
    adminPool=new LdapConnectionPool(adminConnectionFactory);
    adminPool.setTestOnBorrow(true);
    adminPool.setMaxActive(config.getAdminPoolConfig().getMaxActive());
    adminPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
  }
  cc=createConnectionConfig();
  userConnectionFactory=new PoolableUnboundConnectionFactory(cc);
  if (config.getUserPoolConfig().getMaxActive() != 0) {
    userPool=new UnboundLdapConnectionPool(userConnectionFactory);
    userPool.setTestOnBorrow(true);
    userPool.setMaxActive(config.getUserPoolConfig().getMaxActive());
    userPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
  }
  log.info("String_Node_Str",config);
}
Program: 8979
Project: 8979
Buggy source:
@Deactivate private void deactivate(){
  close();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Deactivate private void deactivate(){
  close();
}
Program: 8980
Project: 8980
Buggy source:
@Activate private void activate(Map<String,Object> properties){
  ConfigurationParameters cfg=ConfigurationParameters.of(properties);
  config=LdapProviderConfig.of(cfg);
  init();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Activate private void activate(Map<String,Object> properties){
  ConfigurationParameters cfg=ConfigurationParameters.of(properties);
  config=LdapProviderConfig.of(cfg);
  init();
}
Program: 8981
Project: 8981
Buggy source:
private boolean isImmutableProperty(@Nonnull String name,@Nonnull Tree parent){
  NodeState parentNs=getNodeState(parent);
  if (JcrConstants.JCR_UUID.equals(name) && isReferenceable.apply(parentNs)) {
    return true;
  }
 else   if ((JCR_CREATED.equals(name) || JCR_CREATEDBY.equals(name)) && isCreated.apply(parentNs)) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean isImmutableProperty(@Nonnull String name,@Nonnull Tree parent){
  NodeState parentNs=getNodeState(parent);
  if (JcrConstants.JCR_UUID.equals(name) && isReferenceable.apply(parentNs)) {
    return true;
  }
 else {
    return (JCR_CREATED.equals(name) || JCR_CREATEDBY.equals(name)) && isCreated.apply(parentNs);
  }
}
Program: 8982
Project: 8982
Buggy source:
@Override public boolean definesLocation(TreeLocation location){
  Tree tree=location.getTree();
  if (tree != null && location.exists()) {
    PropertyState p=location.getProperty();
    return (p == null) ? definesTree(tree) : definesProperty(tree,p);
  }
 else {
    String path=location.getPath();
    String name=Text.getName(path);
    if (USER_PROPERTY_NAMES.contains(name) || GROUP_PROPERTY_NAMES.contains(name) || path.contains(REP_MEMBERS)|| path.contains(REP_MEMBERS_LIST)|| path.contains(REP_PWD)) {
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
@Override public boolean definesLocation(TreeLocation location){
  Tree tree=location.getTree();
  if (tree != null && location.exists()) {
    PropertyState p=location.getProperty();
    return (p == null) ? definesTree(tree) : definesProperty(tree,p);
  }
 else {
    String path=location.getPath();
    String name=Text.getName(path);
    return USER_PROPERTY_NAMES.contains(name) || GROUP_PROPERTY_NAMES.contains(name) || path.contains(REP_MEMBERS)|| path.contains(REP_MEMBERS_LIST)|| path.contains(REP_PWD);
  }
}
Program: 8983
Project: 8983
Buggy source:
/** 
 * Recursively updates references on the destination tree as defined by  {@code Workspace.copy()}.
 * @param src  the source tree of the copy operation.
 * @param dest the unprocessed copy of the tree.
 */
private void updateReferences(Tree src,Tree dest) throws RepositoryException {
  for (  PropertyState prop : src.getProperties()) {
    if (isReferenceType(prop) && !VersionConstants.VERSION_PROPERTY_NAMES.contains(prop.getName()))     updateProperty(prop,dest);
  }
  for (  Tree child : src.getChildren()) {
    updateReferences(child,dest.getChild(child.getName()));
  }
}

Fixed version (ground truth):
/** 
 * Recursively updates references on the destination tree as defined by  {@code Workspace.copy()}.
 * @param src  the source tree of the copy operation.
 * @param dest the unprocessed copy of the tree.
 */
private void updateReferences(Tree src,Tree dest) throws RepositoryException {
  for (  PropertyState prop : src.getProperties()) {
    if (isReferenceType(prop) && !VersionConstants.VERSION_PROPERTY_NAMES.contains(prop.getName())) {
      updateProperty(prop,dest);
    }
  }
  for (  Tree child : src.getChildren()) {
    updateReferences(child,dest.getChild(child.getName()));
  }
}
Program: 8984
Project: 8984
Buggy source:
@Override public boolean commit() throws LoginException {
  if (tokenCredentials != null) {
    updateSubject(tokenCredentials,getAuthInfo(tokenInfo),principals);
    return true;
  }
  if (tokenProvider != null && sharedState.containsKey(SHARED_KEY_CREDENTIALS)) {
    Credentials shared=getSharedCredentials();
    if (shared != null && tokenProvider.doCreateToken(shared)) {
      getRoot().refresh();
      TokenInfo ti=tokenProvider.createToken(shared);
      if (ti != null) {
        TokenCredentials tc=new TokenCredentials(ti.getToken());
        Map<String,String> attributes=ti.getPrivateAttributes();
        for (        String name : attributes.keySet()) {
          tc.setAttribute(name,attributes.get(name));
        }
        attributes=ti.getPublicAttributes();
        for (        String name : attributes.keySet()) {
          tc.setAttribute(name,attributes.get(name));
        }
        sharedState.put(SHARED_KEY_ATTRIBUTES,attributes);
        updateSubject(tc,null,null);
      }
 else {
        log.debug("String_Node_Str" + userId);
        throw new LoginException("String_Node_Str" + userId);
      }
    }
  }
  clearState();
  return false;
}

Fixed version (ground truth):
@Override public boolean commit() throws LoginException {
  if (tokenCredentials != null) {
    updateSubject(tokenCredentials,getAuthInfo(tokenInfo),principals);
    return true;
  }
  if (tokenProvider != null && sharedState.containsKey(SHARED_KEY_CREDENTIALS)) {
    Credentials shared=getSharedCredentials();
    if (shared != null && tokenProvider.doCreateToken(shared)) {
      Root r=getRoot();
      if (r != null) {
        r.refresh();
      }
      TokenInfo ti=tokenProvider.createToken(shared);
      if (ti != null) {
        TokenCredentials tc=new TokenCredentials(ti.getToken());
        Map<String,String> attributes=ti.getPrivateAttributes();
        for (        String name : attributes.keySet()) {
          tc.setAttribute(name,attributes.get(name));
        }
        attributes=ti.getPublicAttributes();
        for (        String name : attributes.keySet()) {
          tc.setAttribute(name,attributes.get(name));
        }
        sharedState.put(SHARED_KEY_ATTRIBUTES,attributes);
        updateSubject(tc,null,null);
      }
 else {
        log.debug("String_Node_Str" + userId);
        throw new LoginException("String_Node_Str" + userId);
      }
    }
  }
  clearState();
  return false;
}
Program: 8985
Project: 8985
Buggy source:
@CheckForNull private JackrabbitAccessControlList getACL(String path) throws RepositoryException {
  JackrabbitAccessControlList acl=null;
  for (  AccessControlPolicy p : acMgr.getPolicies(path)) {
    if (p instanceof JackrabbitAccessControlList) {
      acl=(JackrabbitAccessControlList)p;
      break;
    }
  }
  return acl;
}

Fixed version (ground truth):
@CheckForNull private JackrabbitAccessControlList getACL(String path) throws RepositoryException {
  JackrabbitAccessControlList acList=null;
  for (  AccessControlPolicy p : acMgr.getPolicies(path)) {
    if (p instanceof JackrabbitAccessControlList) {
      acList=(JackrabbitAccessControlList)p;
      break;
    }
  }
  return acList;
}
Program: 8986
Project: 8986
Buggy source:
@CheckForNull public NodeUtil getParent(){
  return new NodeUtil(tree.getParent(),mapper);
}

Fixed version (ground truth):
@Nonnull public NodeUtil getParent(){
  return new NodeUtil(tree.getParent(),mapper);
}
Program: 8989
Project: 8989
Buggy source:
private void validateAuthorizable(@Nonnull Tree tree,@Nonnull AuthorizableType type) throws CommitFailedException {
  boolean isSystemUser=(type == AuthorizableType.USER) && UserUtil.isSystemUser(tree);
  String authRoot=UserUtil.getAuthorizableRootPath(provider.getConfig(),type);
  if (isSystemUser) {
    String sysRelPath=provider.getConfig().getConfigValue(PARAM_SYSTEM_RELATIVE_PATH,DEFAULT_SYSTEM_RELATIVE_PATH);
    authRoot=authRoot + '/' + sysRelPath;
  }
  if (authRoot != null) {
    assertHierarchy(tree,authRoot);
    if (TreeUtil.getString(tree,REP_PRINCIPAL_NAME) == null) {
      throw constraintViolation(26,"String_Node_Str");
    }
    if (isSystemUser) {
      if (TreeUtil.getString(tree,REP_PASSWORD) != null) {
        throw constraintViolation(32,"String_Node_Str");
      }
      if (tree.hasChild(REP_PWD)) {
        throw constraintViolation(33,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void validateAuthorizable(@Nonnull Tree tree,@Nullable AuthorizableType type) throws CommitFailedException {
  boolean isSystemUser=(type == AuthorizableType.USER) && UserUtil.isSystemUser(tree);
  String authRoot=UserUtil.getAuthorizableRootPath(provider.getConfig(),type);
  if (isSystemUser) {
    String sysRelPath=provider.getConfig().getConfigValue(PARAM_SYSTEM_RELATIVE_PATH,DEFAULT_SYSTEM_RELATIVE_PATH);
    authRoot=authRoot + '/' + sysRelPath;
  }
  if (authRoot != null) {
    assertHierarchy(tree,authRoot);
    if (TreeUtil.getString(tree,REP_PRINCIPAL_NAME) == null) {
      throw constraintViolation(26,"String_Node_Str");
    }
    if (isSystemUser) {
      if (TreeUtil.getString(tree,REP_PASSWORD) != null) {
        throw constraintViolation(32,"String_Node_Str");
      }
      if (tree.hasChild(REP_PWD)) {
        throw constraintViolation(33,"String_Node_Str");
      }
    }
  }
}
Program: 8990
Project: 8990
Buggy source:
@Nonnull private static Object readValueFromJson(@Nonnull JsopTokenizer json){
switch (json.read()) {
case JsopReader.NULL:
    return null;
case JsopReader.TRUE:
  return true;
case JsopReader.FALSE:
return false;
case JsopReader.NUMBER:
return Long.parseLong(json.getToken());
case JsopReader.STRING:
return json.getToken();
case '{':
TreeMap<Revision,Object> map=new TreeMap<Revision,Object>(StableRevisionComparator.REVERSE);
while (true) {
if (json.matches('}')) {
break;
}
String k=json.readString();
json.read(':');
map.put(Revision.fromString(k),readValueFromJson(json));
json.matches(',');
}
return map;
case '[':
List<Object> list=new ArrayList<Object>();
while (true) {
if (json.matches(']')) {
break;
}
list.add(readValueFromJson(json));
json.matches(',');
}
return list;
default :
throw new IllegalArgumentException(json.readRawValue());
}
}

Fixed version (ground truth):
@Nullable private static Object readValueFromJson(@Nonnull JsopTokenizer json){
switch (json.read()) {
case JsopReader.NULL:
    return null;
case JsopReader.TRUE:
  return true;
case JsopReader.FALSE:
return false;
case JsopReader.NUMBER:
return Long.parseLong(json.getToken());
case JsopReader.STRING:
return json.getToken();
case '{':
TreeMap<Revision,Object> map=new TreeMap<Revision,Object>(StableRevisionComparator.REVERSE);
while (true) {
if (json.matches('}')) {
break;
}
String k=json.readString();
if (k == null) {
throw new IllegalArgumentException("String_Node_Str");
}
json.read(':');
map.put(Revision.fromString(k),readValueFromJson(json));
json.matches(',');
}
return map;
case '[':
List<Object> list=new ArrayList<Object>();
while (true) {
if (json.matches(']')) {
break;
}
list.add(readValueFromJson(json));
json.matches(',');
}
return list;
default :
throw new IllegalArgumentException(json.readRawValue());
}
}
Program: 8994
Project: 8994
Buggy source:
private <T extends Document>void addToCache(Collection<T> collection,T doc){
  if (collection == Collection.NODES) {
    Lock lock=getAndLock(doc.getId());
    try {
      addToCache((NodeDocument)doc);
    }
  finally {
      lock.unlock();
    }
  }
}

Fixed version (ground truth):
private <T extends Document>void addToCache(Collection<T> collection,T doc){
  if (collection == Collection.NODES) {
    Lock lock=getAndLock(idOf(doc));
    try {
      addToCache((NodeDocument)doc);
    }
  finally {
      lock.unlock();
    }
  }
}
Program: 8995
Project: 8995
Buggy source:
@CheckForNull private <T extends Document>T readDocumentUncached(Collection<T> collection,String id,NodeDocument cachedDoc){
  Connection connection=null;
  String tableName=getTable(collection);
  try {
    long lastmodcount=-1;
    if (cachedDoc != null && cachedDoc.getModCount() != null) {
      lastmodcount=cachedDoc.getModCount().longValue();
    }
    connection=this.ch.getROConnection();
    RDBRow row=dbRead(connection,tableName,id,lastmodcount);
    connection.commit();
    if (row == null) {
      return null;
    }
 else {
      if (lastmodcount == row.getModcount()) {
        cachedDoc.markUpToDate(System.currentTimeMillis());
        return (T)cachedDoc;
      }
 else {
        return SR.fromRow(collection,row);
      }
    }
  }
 catch (  Exception ex) {
    throw new DocumentStoreException(ex);
  }
 finally {
    this.ch.closeConnection(connection);
  }
}

Fixed version (ground truth):
@CheckForNull private <T extends Document>T readDocumentUncached(Collection<T> collection,String id,NodeDocument cachedDoc){
  Connection connection=null;
  String tableName=getTable(collection);
  try {
    long lastmodcount=-1;
    if (cachedDoc != null) {
      lastmodcount=modcountOf(cachedDoc);
    }
    connection=this.ch.getROConnection();
    RDBRow row=dbRead(connection,tableName,id,lastmodcount);
    connection.commit();
    if (row == null) {
      return null;
    }
 else {
      if (lastmodcount == row.getModcount()) {
        cachedDoc.markUpToDate(System.currentTimeMillis());
        return (T)cachedDoc;
      }
 else {
        return SR.fromRow(collection,row);
      }
    }
  }
 catch (  Exception ex) {
    throw new DocumentStoreException(ex);
  }
 finally {
    this.ch.closeConnection(connection);
  }
}
Program: 8996
Project: 8996
Buggy source:
@Nonnull private void applyToCache(@Nonnull final NodeDocument oldDoc,@Nonnull final NodeDocument newDoc){
  NodeDocument cached=addToCache(newDoc);
  if (cached == newDoc) {
    return;
  }
 else   if (oldDoc == null) {
    return;
  }
 else {
    CacheValue key=new StringValue(newDoc.getId());
    if (Objects.equal(cached.getModCount(),oldDoc.getModCount())) {
      nodesCache.put(key,newDoc);
    }
 else {
      nodesCache.invalidate(key);
    }
  }
}

Fixed version (ground truth):
@Nonnull private void applyToCache(@Nonnull final NodeDocument oldDoc,@Nonnull final NodeDocument newDoc){
  NodeDocument cached=addToCache(newDoc);
  if (cached == newDoc) {
    return;
  }
 else   if (oldDoc == null) {
    return;
  }
 else {
    CacheValue key=new StringValue(idOf(newDoc));
    if (Objects.equal(cached.getModCount(),oldDoc.getModCount())) {
      nodesCache.put(key,newDoc);
    }
 else {
      nodesCache.invalidate(key);
    }
  }
}
Program: 8999
Project: 8999
Buggy source:
@Test @Ignore("String_Node_Str") public void testAddNodeCollidingWithInvisibleNode() throws Exception {
  setupPermission("String_Node_Str",testPrincipal,true,PrivilegeConstants.JCR_ALL);
  setupPermission("String_Node_Str",testPrincipal,false,PrivilegeConstants.JCR_READ);
  setupPermission("String_Node_Str",testPrincipal,true,PrivilegeConstants.JCR_ALL);
  Root testRoot=getTestRoot();
  Tree a=testRoot.getTree("String_Node_Str");
  assertFalse(a.getChild("String_Node_Str").exists());
  assertTrue(a.getChild("String_Node_Str").getChild("String_Node_Str").exists());
  new NodeUtil(a).addChild("String_Node_Str",JcrConstants.NT_UNSTRUCTURED);
  assertTrue(a.getChild("String_Node_Str").exists());
  assertFalse(a.getChild("String_Node_Str").getChild("String_Node_Str").exists());
  testRoot.commit();
  assertTrue(a.getChild("String_Node_Str").exists());
  assertFalse(a.getChild("String_Node_Str").getChild("String_Node_Str").exists());
}

Fixed version (ground truth):
public void testAddNodeCollidingWithInvisibleNode() throws Exception {
  setupPermission("String_Node_Str",testPrincipal,true,PrivilegeConstants.JCR_ALL);
  setupPermission("String_Node_Str",testPrincipal,false,PrivilegeConstants.JCR_READ);
  setupPermission("String_Node_Str",testPrincipal,true,PrivilegeConstants.JCR_ALL);
  Root testRoot=getTestRoot();
  Tree a=testRoot.getTree("String_Node_Str");
  assertFalse(a.getChild("String_Node_Str").exists());
  assertTrue(a.getChild("String_Node_Str").getChild("String_Node_Str").exists());
  new NodeUtil(a).addChild("String_Node_Str",JcrConstants.NT_UNSTRUCTURED);
  assertTrue(a.getChild("String_Node_Str").exists());
  assertFalse(a.getChild("String_Node_Str").getChild("String_Node_Str").exists());
  testRoot.commit();
  assertTrue(a.getChild("String_Node_Str").exists());
  assertFalse(a.getChild("String_Node_Str").getChild("String_Node_Str").exists());
}
Program: 9000
Project: 9000
Buggy source:
@Ignore("String_Node_Str") @Test public void testAllowChild3() throws Exception {
  Tree rootTree1=testRoot1.getTree("String_Node_Str");
  Tree rootTree2=testRoot2.getTree("String_Node_Str");
  assertTrue(rootTree1.hasChild("String_Node_Str"));
  assertTrue(rootTree2.hasChild("String_Node_Str"));
  assertFalse(rootTree1.hasChild("String_Node_Str"));
  assertFalse(rootTree2.hasChild("String_Node_Str"));
  setupPermission(testRoot1,"String_Node_Str",testPrincipal,false,PrivilegeConstants.JCR_READ);
  assertFalse(rootTree1.hasChild("String_Node_Str"));
  assertTrue(rootTree2.hasChild("String_Node_Str"));
  String uid=testPrincipal.getName();
  ContentSession session3=login(new SimpleCredentials(uid,uid.toCharArray()));
  Tree rootTree3=session3.getLatestRoot().getTree("String_Node_Str");
  assertFalse(rootTree3.hasChild("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testAllowChild3() throws Exception {
  Tree rootTree1=testRoot1.getTree("String_Node_Str");
  Tree rootTree2=testRoot2.getTree("String_Node_Str");
  assertTrue(rootTree1.hasChild("String_Node_Str"));
  assertTrue(rootTree2.hasChild("String_Node_Str"));
  assertFalse(rootTree1.hasChild("String_Node_Str"));
  assertFalse(rootTree2.hasChild("String_Node_Str"));
  setupPermission(testRoot1,"String_Node_Str",testPrincipal,false,PrivilegeConstants.JCR_READ);
  assertFalse(rootTree1.hasChild("String_Node_Str"));
  assertTrue(rootTree2.hasChild("String_Node_Str"));
  String uid=testPrincipal.getName();
  ContentSession session3=login(new SimpleCredentials(uid,uid.toCharArray()));
  Tree rootTree3=session3.getLatestRoot().getTree("String_Node_Str");
  assertFalse(rootTree3.hasChild("String_Node_Str"));
}
Program: 9001
Project: 9001
Buggy source:
private void convertOldestHotToCold(){
  Entry<K,V> last=stack.stackPrev;
  removeFromStack(last);
  addToQueue(queue,last);
  pruneStack();
}

Fixed version (ground truth):
private void convertOldestHotToCold(){
  Entry<K,V> last=stack.stackPrev;
  if (last == stack) {
    throw new IllegalStateException();
  }
  removeFromStack(last);
  addToQueue(queue,last);
  pruneStack();
}
Program: 9002
Project: 9002
Buggy source:
/** 
 * Evict cold entries (resident and non-resident) until the memory limit is reached. The new entry is added as a cold entry, except if it is the only entry.
 * @param newCold a new cold entry
 */
private void evict(Entry<K,V> newCold){
  while ((queueSize << 5) < mapSize) {
    convertOldestHotToCold();
  }
  if (stackSize > 0) {
    addToQueue(queue,newCold);
  }
  while (usedMemory > maxMemory && queueSize > 1) {
    Entry<K,V> e=queue.queuePrev;
    usedMemory-=e.memory;
    evictionCount++;
    removeFromQueue(e);
    e.value=null;
    e.memory=0;
    addToQueue(queue2,e);
    while (queue2Size + queue2Size > stackSize) {
      e=queue2.queuePrev;
      int hash=getHash(e.key);
      invalidate(e.key,hash);
    }
  }
}

Fixed version (ground truth):
/** 
 * Evict cold entries (resident and non-resident) until the memory limit is reached. The new entry is added as a cold entry, except if it is the only entry.
 * @param newCold a new cold entry
 */
private void evict(Entry<K,V> newCold){
  while (queueSize <= (mapSize >>> 5) && stackSize > 0) {
    convertOldestHotToCold();
  }
  if (stackSize > 0) {
    addToQueue(queue,newCold);
  }
  while (usedMemory > maxMemory && queueSize > 1) {
    Entry<K,V> e=queue.queuePrev;
    usedMemory-=e.memory;
    evictionCount++;
    removeFromQueue(e);
    e.value=null;
    e.memory=0;
    addToQueue(queue2,e);
    while (queue2Size + queue2Size > stackSize) {
      e=queue2.queuePrev;
      int hash=getHash(e.key);
      invalidate(e.key,hash);
    }
  }
}
Program: 9003
Project: 9003
Buggy source:
/** 
 * Ensure the last entry of the stack is cold.
 */
private void pruneStack(){
  while (true) {
    Entry<K,V> last=stack.stackPrev;
    if (last == stack || last.isHot()) {
      break;
    }
    removeFromStack(last);
  }
}

Fixed version (ground truth):
/** 
 * Ensure the last entry of the stack is cold.
 */
private void pruneStack(){
  while (true) {
    Entry<K,V> last=stack.stackPrev;
    if (last.isHot()) {
      break;
    }
    removeFromStack(last);
  }
}
Program: 9008
Project: 9008
Buggy source:
private synchronized void logCommonCall(long start,String key){
  int time=(int)(System.currentTimeMillis() - start);
  if (time <= 0) {
    return;
  }
  HashMap<String,Integer> map=commonCalls;
  Integer oldCount=map.get(key);
  if (oldCount == null) {
    map.put(key,time);
  }
 else {
    map.put(key,oldCount + time);
  }
  int maxElements=1000;
  int minCount=1;
  while (map.size() > maxElements) {
    for (Iterator<Map.Entry<String,Integer>> ei=map.entrySet().iterator(); ei.hasNext(); ) {
      Map.Entry<String,Integer> e=ei.next();
      if (e.getValue() <= minCount) {
        ei.remove();
      }
    }
    if (map.size() > maxElements) {
      minCount++;
    }
  }
}

Fixed version (ground truth):
private void logCommonCall(long start,String key){
  int time=(int)(System.currentTimeMillis() - start);
  if (time <= 0) {
    return;
  }
  Map<String,Integer> map=slowCalls;
  Integer oldCount=map.get(key);
  if (oldCount == null) {
    map.put(key,time);
  }
 else {
    map.put(key,oldCount + time);
  }
  int maxElements=1000;
  int minCount=1;
  while (map.size() > maxElements) {
    for (Iterator<Map.Entry<String,Integer>> ei=map.entrySet().iterator(); ei.hasNext(); ) {
      Map.Entry<String,Integer> e=ei.next();
      if (e.getValue() <= minCount) {
        ei.remove();
      }
    }
    if (map.size() > maxElements) {
      minCount++;
    }
  }
}
Program: 9009
Project: 9009
Buggy source:
@Override public synchronized String getNodes(String path,String revisionId,int depth,long offset,int maxChildNodes,String filter) throws MicroKernelException {
  if (depth != 0) {
    throw new MicroKernelException("String_Node_Str" + depth);
  }
  revisionId=revisionId != null ? revisionId : headRevision.toString();
  revisionId=stripBranchRevMarker(revisionId);
  Revision rev=Revision.fromString(revisionId);
  Node n=getNode(path,rev);
  if (n == null) {
    return null;
  }
  JsopStream json=new JsopStream();
  boolean includeId=filter != null && filter.contains("String_Node_Str");
  includeId|=filter != null && filter.contains("String_Node_Str");
  json.object();
  n.append(json,includeId);
  int max;
  if (maxChildNodes == -1) {
    max=MANY_CHILDREN_THRESHOLD;
    maxChildNodes=Integer.MAX_VALUE;
  }
 else {
    long m=maxChildNodes + 1L + offset;
    max=(int)Math.min(m,Integer.MAX_VALUE);
  }
  if (offset > 0) {
    max=Integer.MAX_VALUE;
  }
  Children c=getChildren(path,rev,max);
  for (long i=offset; i < c.children.size(); i++) {
    if (maxChildNodes-- <= 0) {
      break;
    }
    String name=PathUtils.getName(c.children.get((int)i));
    json.key(name).object().endObject();
  }
  if (c.hasMore) {
    json.key("String_Node_Str").value(Integer.MAX_VALUE);
  }
 else {
    json.key("String_Node_Str").value(c.children.size());
  }
  json.endObject();
  return json.toString();
}

Fixed version (ground truth):
@Override public synchronized String getNodes(String path,String revisionId,int depth,long offset,int maxChildNodes,String filter) throws MicroKernelException {
  if (depth != 0) {
    throw new MicroKernelException("String_Node_Str" + depth);
  }
  revisionId=revisionId != null ? revisionId : headRevision.toString();
  revisionId=stripBranchRevMarker(revisionId);
  Revision rev=Revision.fromString(revisionId);
  Node n=getNode(path,rev);
  if (n == null) {
    return null;
  }
  JsopStream json=new JsopStream();
  boolean includeId=filter != null && filter.contains("String_Node_Str");
  includeId|=filter != null && filter.contains("String_Node_Str");
  json.object();
  n.append(json,includeId);
  int max;
  if (maxChildNodes == -1) {
    max=MANY_CHILDREN_THRESHOLD;
    maxChildNodes=Integer.MAX_VALUE;
  }
 else {
    long m=maxChildNodes + 1L + offset;
    max=(int)Math.min(m,Integer.MAX_VALUE);
  }
  if (offset > 0) {
    max=Integer.MAX_VALUE;
  }
  Children c=getChildren(path,rev,max);
  for (long i=offset; i < c.children.size(); i++) {
    if (maxChildNodes-- <= 0) {
      break;
    }
    String name=PathUtils.getName(c.children.get((int)i));
    json.key(name).object().endObject();
  }
  if (c.hasMore) {
    json.key("String_Node_Str").value(Long.MAX_VALUE);
  }
 else {
    json.key("String_Node_Str").value(c.children.size());
  }
  json.endObject();
  return json.toString();
}
Program: 9010
Project: 9010
Buggy source:
@Override public synchronized String getNodes(String path,String revisionId,int depth,long offset,int maxChildNodes,String filter) throws MicroKernelException {
  if (depth != 0) {
    throw new MicroKernelException("String_Node_Str" + depth);
  }
  revisionId=revisionId != null ? revisionId : headRevision.toString();
  revisionId=stripBranchRevMarker(revisionId);
  Revision rev=Revision.fromString(revisionId);
  Node n=getNode(path,rev);
  if (n == null) {
    return null;
  }
  JsopStream json=new JsopStream();
  boolean includeId=filter != null && filter.contains("String_Node_Str");
  includeId|=filter != null && filter.contains("String_Node_Str");
  json.object();
  n.append(json,includeId);
  int max;
  if (maxChildNodes == -1) {
    max=MANY_CHILDREN_THRESHOLD;
    maxChildNodes=Integer.MAX_VALUE;
  }
 else {
    max=Math.max(maxChildNodes,maxChildNodes + 1);
  }
  Children c=getChildren(path,rev,max);
  for (long i=offset; i < c.children.size(); i++) {
    if (maxChildNodes-- <= 0) {
      break;
    }
    String name=PathUtils.getName(c.children.get((int)i));
    json.key(name).object().endObject();
  }
  if (c.hasMore) {
    json.key("String_Node_Str").value(Integer.MAX_VALUE);
  }
 else {
    json.key("String_Node_Str").value(c.children.size());
  }
  json.endObject();
  return json.toString();
}

Fixed version (ground truth):
@Override public synchronized String getNodes(String path,String revisionId,int depth,long offset,int maxChildNodes,String filter) throws MicroKernelException {
  if (depth != 0) {
    throw new MicroKernelException("String_Node_Str" + depth);
  }
  revisionId=revisionId != null ? revisionId : headRevision.toString();
  revisionId=stripBranchRevMarker(revisionId);
  Revision rev=Revision.fromString(revisionId);
  Node n=getNode(path,rev);
  if (n == null) {
    return null;
  }
  JsopStream json=new JsopStream();
  boolean includeId=filter != null && filter.contains("String_Node_Str");
  includeId|=filter != null && filter.contains("String_Node_Str");
  json.object();
  n.append(json,includeId);
  int max;
  if (maxChildNodes == -1) {
    max=MANY_CHILDREN_THRESHOLD;
    maxChildNodes=Integer.MAX_VALUE;
  }
 else {
    long m=maxChildNodes + 1L + offset;
    max=(int)Math.min(m,Integer.MAX_VALUE);
  }
  if (offset > 0) {
    max=Integer.MAX_VALUE;
  }
  Children c=getChildren(path,rev,max);
  for (long i=offset; i < c.children.size(); i++) {
    if (maxChildNodes-- <= 0) {
      break;
    }
    String name=PathUtils.getName(c.children.get((int)i));
    json.key(name).object().endObject();
  }
  if (c.hasMore) {
    json.key("String_Node_Str").value(Integer.MAX_VALUE);
  }
 else {
    json.key("String_Node_Str").value(c.children.size());
  }
  json.endObject();
  return json.toString();
}
Program: 9011
Project: 9011
Buggy source:
@Override public boolean init(Session session,Root root,NamePathMapper namePathMapper,boolean isWorkspaceImport,int uuidBehavior,ReferenceChangeTracker referenceTracker){
  if (initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    this.namePathMapper=namePathMapper;
    AccessControlConfiguration config=securityProvider.getAccessControlConfiguration();
    if (isWorkspaceImport) {
      acMgr=config.getAccessControlManager(root,namePathMapper);
    }
 else {
      acMgr=session.getAccessControlManager();
    }
    principalManager=securityProvider.getPrincipalConfiguration().getPrincipalManager(root,namePathMapper);
    ntMgr=ReadOnlyNodeTypeManager.getInstance(root,namePathMapper);
    initialized=true;
  }
 catch (  RepositoryException e) {
    log.warn("String_Node_Str",e);
  }
  return initialized;
}

Fixed version (ground truth):
@Override public boolean init(Session session,Root root,NamePathMapper namePathMapper,boolean isWorkspaceImport,int uuidBehavior,ReferenceChangeTracker referenceTracker){
  if (initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    AccessControlConfiguration config=securityProvider.getAccessControlConfiguration();
    if (isWorkspaceImport) {
      acMgr=config.getAccessControlManager(root,namePathMapper);
    }
 else {
      acMgr=session.getAccessControlManager();
    }
    principalManager=securityProvider.getPrincipalConfiguration().getPrincipalManager(root,namePathMapper);
    ntMgr=ReadOnlyNodeTypeManager.getInstance(root,namePathMapper);
    initialized=true;
  }
 catch (  RepositoryException e) {
    log.warn("String_Node_Str",e);
  }
  return initialized;
}
Program: 9012
Project: 9012
Buggy source:
public PrincipalProviderImpl(Root root,UserConfiguration userConfiguration,NamePathMapper namePathMapper){
  this.userManager=userConfiguration.getUserManager(root,namePathMapper);
}

Fixed version (ground truth):
public PrincipalProviderImpl(@Nonnull Root root,@Nonnull UserConfiguration userConfiguration,@Nonnull NamePathMapper namePathMapper){
  this.userManager=userConfiguration.getUserManager(root,namePathMapper);
}