nus-yam/ex-repair huggingface dataset:
Program: 8900
Project: 8900
Buggy source:
@Override public Editor childNodeAdded(String name,NodeState after) throws CommitFailedException {
  TypeEditor editor=childNodeChanged(name,MISSING_NODE,after);
  if (editor.checkThisNode) {
    for (    String property : editor.effective.getMandatoryProperties()) {
      if (!after.hasProperty(property)) {
        editor.constraintViolation(21,"String_Node_Str" + property + "String_Node_Str");
      }
    }
    for (    String child : editor.effective.getMandatoryChildNodes()) {
      if (!after.hasChildNode(child)) {
        editor.constraintViolation(25,"String_Node_Str" + child + "String_Node_Str");
      }
    }
  }
  return editor;
}

Fixed version (ground truth):
@Override public Editor childNodeAdded(String name,NodeState after) throws CommitFailedException {
  TypeEditor editor=childNodeChanged(name,MISSING_NODE,after);
  if (editor != null && editor.checkThisNode) {
    for (    String property : editor.getEffective().getMandatoryProperties()) {
      if (!after.hasProperty(property)) {
        editor.constraintViolation(21,"String_Node_Str" + property + "String_Node_Str");
      }
    }
    for (    String child : editor.getEffective().getMandatoryChildNodes()) {
      if (!after.hasChildNode(child)) {
        editor.constraintViolation(25,"String_Node_Str" + child + "String_Node_Str");
      }
    }
  }
  return editor;
}
Program: 8901
Project: 8901
Buggy source:
@Override public TypeEditor childNodeChanged(String name,NodeState before,NodeState after) throws CommitFailedException {
  String primary=after.getName(JCR_PRIMARYTYPE);
  Iterable<String> mixins=after.getNames(JCR_MIXINTYPES);
  NodeBuilder childBuilder=builder.getChildNode(name);
  if (primary == null && effective != null) {
    primary=effective.getDefaultType(name);
    if (primary != null) {
      builder.setProperty(JCR_PRIMARYTYPE,primary,NAME);
    }
 else {
      constraintViolation(4,"String_Node_Str" + "String_Node_Str" + name);
    }
  }
  TypeEditor editor=new TypeEditor(this,name,primary,mixins,childBuilder);
  if (checkThisNode && !effective.isValidChildNode(name,editor.effective)) {
    constraintViolation(1,"String_Node_Str" + name + "String_Node_Str"+ editor.effective);
  }
  return editor;
}

Fixed version (ground truth):
@Override public TypeEditor childNodeChanged(String name,NodeState before,NodeState after) throws CommitFailedException {
  String primary=after.getName(JCR_PRIMARYTYPE);
  Iterable<String> mixins=after.getNames(JCR_MIXINTYPES);
  NodeBuilder childBuilder=builder.getChildNode(name);
  if (primary == null && effective != null) {
    primary=effective.getDefaultType(name);
    if (primary != null) {
      builder.setProperty(JCR_PRIMARYTYPE,primary,NAME);
    }
 else {
      constraintViolation(4,"String_Node_Str" + "String_Node_Str" + name);
    }
  }
  TypeEditor editor=new TypeEditor(this,name,primary,mixins,childBuilder);
  if (checkThisNode && !getEffective().isValidChildNode(name,editor.getEffective())) {
    constraintViolation(1,"String_Node_Str" + name + "String_Node_Str"+ editor.getEffective());
  }
  return editor;
}
Program: 8902
Project: 8902
Buggy source:
public String getString(){
  if (timestamps.isEmpty()) {
    return "String_Node_Str";
  }
  StringBuilder b=new StringBuilder();
  for (  TimeStamp t : timestamps) {
    if (b.length() > 0) {
      b.append("String_Node_Str");
    }
 else {
      b.append("String_Node_Str");
    }
    int u=0;
    double time=t.time;
    while (time > 1000 && u < units.length - 1) {
      time=time / 1000;
      u++;
    }
    b.append(String.format("String_Node_Str",t.msg,time,units[u]));
  }
  return b.append(')').toString();
}

Fixed version (ground truth):
public String getString(){
  if (timestamps.isEmpty()) {
    return "String_Node_Str";
  }
  StringBuilder b=new StringBuilder();
  for (  TimeStamp t : timestamps) {
    if (b.length() > 0) {
      b.append("String_Node_Str");
    }
 else {
      b.append('(');
    }
    int u=0;
    double time=t.time;
    while (time > 1000 && u < units.length - 1) {
      time=time / 1000;
      u++;
    }
    b.append(String.format("String_Node_Str",t.msg,time,units[u]));
  }
  return b.append(')').toString();
}
Program: 8903
Project: 8903
Buggy source:
public SyncContext setForceGroupSync(boolean forceGroupSync){
  this.forceGroupSync=forceGroupSync;
  return this;
}

Fixed version (ground truth):
@Nonnull public SyncContext setForceGroupSync(boolean forceGroupSync){
  this.forceGroupSync=forceGroupSync;
  return this;
}
Program: 8904
Project: 8904
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Iterator<SyncedIdentity> listIdentities(@Nonnull UserManager userManager) throws RepositoryException {
  final Iterator<Authorizable> iter=userManager.findAuthorizables("String_Node_Str",null);
  return new AbstractLazyIterator<SyncedIdentity>(){
    @Override protected SyncedIdentity getNext(){
      while (iter.hasNext()) {
        try {
          SyncedIdentity id=createSyncedIdentity(iter.next());
          if (id != null) {
            return id;
          }
        }
 catch (        RepositoryException e) {
          log.error("String_Node_Str",e);
          break;
        }
      }
      return null;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Nonnull @Override public Iterator<SyncedIdentity> listIdentities(@Nonnull UserManager userManager) throws RepositoryException {
  final Iterator<Authorizable> iter=userManager.findAuthorizables("String_Node_Str",null);
  return new AbstractLazyIterator<SyncedIdentity>(){
    @Override protected SyncedIdentity getNext(){
      while (iter.hasNext()) {
        try {
          SyncedIdentity id=createSyncedIdentity(iter.next());
          if (id != null) {
            return id;
          }
        }
 catch (        RepositoryException e) {
          log.error("String_Node_Str",e);
          break;
        }
      }
      return null;
    }
  }
;
}
Program: 8905
Project: 8905
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public SyncContext setKeepMissing(boolean keepMissing){
  this.keepMissing=keepMissing;
  return this;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Nonnull @Override public SyncContext setKeepMissing(boolean keepMissing){
  this.keepMissing=keepMissing;
  return this;
}
Program: 8906
Project: 8906
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public SyncContext setForceUserSync(boolean forceUserSync){
  this.forceUserSync=forceUserSync;
  return this;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Nonnull @Override public SyncContext setForceUserSync(boolean forceUserSync){
  this.forceUserSync=forceUserSync;
  return this;
}
Program: 8907
Project: 8907
Buggy source:
@Activate private void activate(Map<String,Object> properties){
  ConfigurationParameters cfg=ConfigurationParameters.of(properties);
  config=DefaultSyncConfig.of(cfg);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Activate private void activate(Map<String,Object> properties){
  ConfigurationParameters cfg=ConfigurationParameters.of(properties);
  config=DefaultSyncConfig.of(cfg);
}
Program: 8908
Project: 8908
Buggy source:
/** 
 * @return An immutable set containing only the {@link SimpleCredentials} class.
 */
@Override protected Set<Class> getSupportedCredentials(){
  Class scClass=SimpleCredentials.class;
  return Collections.singleton(scClass);
}

Fixed version (ground truth):
/** 
 * @return An immutable set containing only the {@link SimpleCredentials} class.
 */
@Nonnull @Override protected Set<Class> getSupportedCredentials(){
  Class scClass=SimpleCredentials.class;
  return Collections.singleton(scClass);
}
Program: 8909
Project: 8909
Buggy source:
public SyncedIdentityImpl getIdentity(){
  return id;
}

Fixed version (ground truth):
@CheckForNull public SyncedIdentityImpl getIdentity(){
  return id;
}
Program: 8910
Project: 8910
Buggy source:
public Status getStatus(){
  return status;
}

Fixed version (ground truth):
@Nonnull public Status getStatus(){
  return status;
}
Program: 8911
Project: 8911
Buggy source:
@Override public Map<String,?> getProperties(){
  return props;
}

Fixed version (ground truth):
@Nonnull @Override public Map<String,?> getProperties(){
  return props;
}
Program: 8912
Project: 8912
Buggy source:
@Override public String getId(){
  return userId;
}

Fixed version (ground truth):
@Nonnull @Override public String getId(){
  return userId;
}
Program: 8913
Project: 8913
Buggy source:
@Override public String getPrincipalName(){
  return userId;
}

Fixed version (ground truth):
@Nonnull @Override public String getPrincipalName(){
  return userId;
}
Program: 8914
Project: 8914
Buggy source:
@Override public Iterable<ExternalIdentityRef> getDeclaredGroups(){
  return groups;
}

Fixed version (ground truth):
@Nonnull @Override public Iterable<ExternalIdentityRef> getDeclaredGroups(){
  return groups;
}
Program: 8915
Project: 8915
Buggy source:
@Override public Iterator<ExternalUser> listUsers() throws ExternalIdentityException {
  return externalUsers.values().iterator();
}

Fixed version (ground truth):
@Nonnull @Override public Iterator<ExternalUser> listUsers() throws ExternalIdentityException {
  return externalUsers.values().iterator();
}
Program: 8916
Project: 8916
Buggy source:
@Override public Iterator<ExternalGroup> listGroups() throws ExternalIdentityException {
  return externalGroups.values().iterator();
}

Fixed version (ground truth):
@Nonnull @Override public Iterator<ExternalGroup> listGroups() throws ExternalIdentityException {
  return externalGroups.values().iterator();
}
Program: 8917
Project: 8917
Buggy source:
@Override public Iterator<ExternalUser> listUsers() throws ExternalIdentityException {
  DebugTimer timer=new DebugTimer();
  LdapConnection connection=connect();
  timer.mark("String_Node_Str");
  try {
    final List<Entry> entries=getEntries(connection,config.getUserConfig());
    timer.mark("String_Node_Str");
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",timer.getString());
    }
    return new AbstractLazyIterator<ExternalUser>(){
      private final Iterator<Entry> iter=entries.iterator();
      @Override protected ExternalUser getNext(){
        while (iter.hasNext()) {
          try {
            return createUser(iter.next(),null);
          }
 catch (          LdapInvalidAttributeValueException e) {
            log.warn("String_Node_Str",e);
          }
        }
        return null;
      }
    }
;
  }
 catch (  LdapException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
catch (  CursorException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
 finally {
    disconnect(connection);
  }
}

Fixed version (ground truth):
@Nonnull @Override public Iterator<ExternalUser> listUsers() throws ExternalIdentityException {
  DebugTimer timer=new DebugTimer();
  LdapConnection connection=connect();
  timer.mark("String_Node_Str");
  try {
    final List<Entry> entries=getEntries(connection,config.getUserConfig());
    timer.mark("String_Node_Str");
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",timer.getString());
    }
    return new AbstractLazyIterator<ExternalUser>(){
      private final Iterator<Entry> iter=entries.iterator();
      @Override protected ExternalUser getNext(){
        while (iter.hasNext()) {
          try {
            return createUser(iter.next(),null);
          }
 catch (          LdapInvalidAttributeValueException e) {
            log.warn("String_Node_Str",e);
          }
        }
        return null;
      }
    }
;
  }
 catch (  LdapException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
catch (  CursorException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
 finally {
    disconnect(connection);
  }
}
Program: 8918
Project: 8918
Buggy source:
@Override public Iterator<ExternalGroup> listGroups() throws ExternalIdentityException {
  DebugTimer timer=new DebugTimer();
  LdapConnection connection=connect();
  timer.mark("String_Node_Str");
  try {
    final List<Entry> entries=getEntries(connection,config.getGroupConfig());
    timer.mark("String_Node_Str");
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",timer.getString());
    }
    return new AbstractLazyIterator<ExternalGroup>(){
      private final Iterator<Entry> iter=entries.iterator();
      @Override protected ExternalGroup getNext(){
        while (iter.hasNext()) {
          try {
            return createGroup(iter.next(),null);
          }
 catch (          LdapInvalidAttributeValueException e) {
            log.warn("String_Node_Str",e);
          }
        }
        return null;
      }
    }
;
  }
 catch (  LdapException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
catch (  CursorException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
 finally {
    disconnect(connection);
  }
}

Fixed version (ground truth):
@Nonnull @Override public Iterator<ExternalGroup> listGroups() throws ExternalIdentityException {
  DebugTimer timer=new DebugTimer();
  LdapConnection connection=connect();
  timer.mark("String_Node_Str");
  try {
    final List<Entry> entries=getEntries(connection,config.getGroupConfig());
    timer.mark("String_Node_Str");
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",timer.getString());
    }
    return new AbstractLazyIterator<ExternalGroup>(){
      private final Iterator<Entry> iter=entries.iterator();
      @Override protected ExternalGroup getNext(){
        while (iter.hasNext()) {
          try {
            return createGroup(iter.next(),null);
          }
 catch (          LdapInvalidAttributeValueException e) {
            log.warn("String_Node_Str",e);
          }
        }
        return null;
      }
    }
;
  }
 catch (  LdapException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
catch (  CursorException e) {
    log.error("String_Node_Str" + timer.getString(),e);
    throw new ExternalIdentityException("String_Node_Str",e);
  }
 finally {
    disconnect(connection);
  }
}
Program: 8919
Project: 8919
Buggy source:
@Override public RestrictionProvider getRestrictionProvider(){
  return RestrictionProvider.EMPTY;
}

Fixed version (ground truth):
@Nonnull @Override public RestrictionProvider getRestrictionProvider(){
  return RestrictionProvider.EMPTY;
}
Program: 8920
Project: 8920
Buggy source:
@Override public String getName(){
  return AuthorizationConfiguration.NAME;
}

Fixed version (ground truth):
@Nonnull @Override public String getName(){
  return AuthorizationConfiguration.NAME;
}
Program: 8921
Project: 8921
Buggy source:
@Nonnull @Override public RepositoryInitializer getRepositoryInitializer(){
  return new RepositoryInitializer(){
    @Override public void initialize(    NodeBuilder builder){
      NodeState base=builder.getNodeState();
      NodeStore store=new MemoryNodeStore(base);
      Root root=RootFactory.createSystemRoot(store,new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(),new TypeEditorProvider())),null,null,null,null);
      if (CugUtil.registerCugNodeTypes(root)) {
        NodeState target=store.getRoot();
        target.compareAgainstBaseState(base,new ApplyDiff(builder));
      }
    }
  }
;
}

Fixed version (ground truth):
@Nonnull @Override public RepositoryInitializer getRepositoryInitializer(){
  return new RepositoryInitializer(){
    @Override public void initialize(    @Nonnull NodeBuilder builder){
      NodeState base=builder.getNodeState();
      NodeStore store=new MemoryNodeStore(base);
      Root root=RootFactory.createSystemRoot(store,new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(),new TypeEditorProvider())),null,null,null,null);
      if (CugUtil.registerCugNodeTypes(root)) {
        NodeState target=store.getRoot();
        target.compareAgainstBaseState(base,new ApplyDiff(builder));
      }
    }
  }
;
}
Program: 8922
Project: 8922
Buggy source:
@Override public List<ProtectedItemImporter> getProtectedItemImporters(){
  return Collections.<ProtectedItemImporter>singletonList(new CugImporter());
}

Fixed version (ground truth):
@Nonnull @Override public List<ProtectedItemImporter> getProtectedItemImporters(){
  return Collections.<ProtectedItemImporter>singletonList(new CugImporter());
}
Program: 8923
Project: 8923
Buggy source:
@Override public AccessControlManager getAccessControlManager(Root root,NamePathMapper namePathMapper){
  return new CugAccessControlManager(root,namePathMapper,getSecurityProvider());
}

Fixed version (ground truth):
@Nonnull @Override public AccessControlManager getAccessControlManager(@Nonnull Root root,@Nonnull NamePathMapper namePathMapper){
  return new CugAccessControlManager(root,namePathMapper,getSecurityProvider());
}
Program: 8924
Project: 8924
Buggy source:
@Override public PermissionProvider getPermissionProvider(Root root,String workspaceName,Set<Principal> principals){
  ConfigurationParameters params=getParameters();
  boolean enabled=params.getConfigValue(CugConstants.PARAM_CUG_ENABLED,false);
  Set<String> supportedPaths=params.getConfigValue(CugConstants.PARAM_CUG_SUPPORTED_PATHS,Collections.<String>emptySet());
  if (!enabled || supportedPaths.isEmpty() || getExclude().isExcluded(principals)) {
    return EmptyPermissionProvider.getInstance();
  }
 else {
    return new CugPermissionProvider(root,principals,supportedPaths,getContext());
  }
}

Fixed version (ground truth):
@Nonnull @Override public PermissionProvider getPermissionProvider(@Nonnull Root root,@Nonnull String workspaceName,@Nonnull Set<Principal> principals){
  ConfigurationParameters params=getParameters();
  boolean enabled=params.getConfigValue(CugConstants.PARAM_CUG_ENABLED,false);
  Set<String> supportedPaths=params.getConfigValue(CugConstants.PARAM_CUG_SUPPORTED_PATHS,Collections.<String>emptySet());
  if (!enabled || supportedPaths.isEmpty() || getExclude().isExcluded(principals)) {
    return EmptyPermissionProvider.getInstance();
  }
 else {
    return new CugPermissionProvider(root,principals,supportedPaths,getContext());
  }
}
Program: 8925
Project: 8925
Buggy source:
@Override public void initialize(NodeBuilder builder){
  NodeState base=builder.getNodeState();
  NodeStore store=new MemoryNodeStore(base);
  Root root=RootFactory.createSystemRoot(store,new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(),new TypeEditorProvider())),null,null,null,null);
  if (CugUtil.registerCugNodeTypes(root)) {
    NodeState target=store.getRoot();
    target.compareAgainstBaseState(base,new ApplyDiff(builder));
  }
}

Fixed version (ground truth):
@Override public void initialize(@Nonnull NodeBuilder builder){
  NodeState base=builder.getNodeState();
  NodeStore store=new MemoryNodeStore(base);
  Root root=RootFactory.createSystemRoot(store,new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(),new TypeEditorProvider())),null,null,null,null);
  if (CugUtil.registerCugNodeTypes(root)) {
    NodeState target=store.getRoot();
    target.compareAgainstBaseState(base,new ApplyDiff(builder));
  }
}
Program: 8926
Project: 8926
Buggy source:
@Override public Context getContext(){
  return CugContext.INSTANCE;
}

Fixed version (ground truth):
@Nonnull @Override public Context getContext(){
  return CugContext.INSTANCE;
}
Program: 8927
Project: 8927
Buggy source:
@Nonnull @Override public List<? extends ValidatorProvider> getValidators(String workspaceName,Set<Principal> principals,MoveTracker moveTracker){
  return ImmutableList.of(new CugValidatorProvider());
}

Fixed version (ground truth):
@Nonnull @Override public List<? extends ValidatorProvider> getValidators(@Nonnull String workspaceName,@Nonnull Set<Principal> principals,@Nonnull MoveTracker moveTracker){
  return ImmutableList.of(new CugValidatorProvider());
}
Program: 8928
Project: 8928
Buggy source:
@Override public boolean init(@Nonnull Session session,@Nonnull Root root,@Nonnull NamePathMapper namePathMapper,boolean isWorkspaceImport,int uuidBehavior,@Nonnull ReferenceChangeTracker referenceTracker,SecurityProvider securityProvider){
  if (initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    config=securityProvider.getConfiguration(AuthorizationConfiguration.class).getParameters();
    importBehavior=CugUtil.getImportBehavior(config);
    if (isWorkspaceImport) {
      PrincipalConfiguration pConfig=securityProvider.getConfiguration(PrincipalConfiguration.class);
      principalManager=pConfig.getPrincipalManager(root,namePathMapper);
    }
 else {
      principalManager=((JackrabbitSession)session).getPrincipalManager();
    }
    initialized=true;
  }
 catch (  RepositoryException e) {
    log.warn("String_Node_Str",e);
  }
  return initialized;
}

Fixed version (ground truth):
@Override public boolean init(@Nonnull Session session,@Nonnull Root root,@Nonnull NamePathMapper namePathMapper,boolean isWorkspaceImport,int uuidBehavior,@Nonnull ReferenceChangeTracker referenceTracker,@Nonnull SecurityProvider securityProvider){
  if (initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    config=securityProvider.getConfiguration(AuthorizationConfiguration.class).getParameters();
    importBehavior=CugUtil.getImportBehavior(config);
    if (isWorkspaceImport) {
      PrincipalConfiguration pConfig=securityProvider.getConfiguration(PrincipalConfiguration.class);
      principalManager=pConfig.getPrincipalManager(root,namePathMapper);
    }
 else {
      principalManager=((JackrabbitSession)session).getPrincipalManager();
    }
    initialized=true;
  }
 catch (  RepositoryException e) {
    log.warn("String_Node_Str",e);
  }
  return initialized;
}
Program: 8929
Project: 8929
Buggy source:
@Override public boolean hasPrivileges(Tree tree,String... privilegeNames){
  for (  String privilegeName : privilegeNames) {
    if (!READ_PRIVILEGE_NAMES.contains(privilegeName)) {
      return false;
    }
  }
  return canRead(tree);
}

Fixed version (ground truth):
@Override public boolean hasPrivileges(@Nullable Tree tree,@Nonnull String... privilegeNames){
  if (tree == null) {
    return false;
  }
  for (  String privilegeName : privilegeNames) {
    if (!READ_PRIVILEGE_NAMES.contains(privilegeName)) {
      return false;
    }
  }
  return canRead(tree);
}
Program: 8930
Project: 8930
Buggy source:
@Override public TreePermission getChildPermission(String childName,NodeState childState){
  return getTreePermission(tree.getChild(childName),this);
}

Fixed version (ground truth):
@Nonnull @Override public TreePermission getChildPermission(@Nonnull String childName,@Nonnull NodeState childState){
  return getTreePermission(tree.getChild(childName),this);
}
Program: 8931
Project: 8931
Buggy source:
@Override public TreePermission getTreePermission(Tree tree,TreePermission parentPermission){
  Tree immutableTree=getImmutableTree(tree);
  if (parentPermission == TreePermission.EMPTY && !immutableTree.isRoot() || isAcContent(immutableTree,true)) {
    return TreePermission.EMPTY;
  }
  TreePermission tp;
  if (parentPermission instanceof CugTreePermission) {
    tp=new CugTreePermission(immutableTree,((CugTreePermission)parentPermission).allow);
    if (hasCug(immutableTree)) {
      tp=createCugPermission(immutableTree,tp);
    }
  }
 else {
    String path=immutableTree.getPath();
    if (supportedPaths.includes(path)) {
      tp=createCugPermission(immutableTree,null);
    }
 else     if (supportedPaths.mayContainCug(path)) {
      tp=new EmptyCugPermission(immutableTree);
    }
 else {
      tp=TreePermission.EMPTY;
    }
  }
  return tp;
}

Fixed version (ground truth):
@Nonnull @Override public TreePermission getTreePermission(@Nonnull Tree tree,@Nonnull TreePermission parentPermission){
  Tree immutableTree=getImmutableTree(tree);
  if (parentPermission == TreePermission.EMPTY && !immutableTree.isRoot() || isAcContent(immutableTree,true)) {
    return TreePermission.EMPTY;
  }
  TreePermission tp;
  if (parentPermission instanceof CugTreePermission) {
    tp=new CugTreePermission(immutableTree,((CugTreePermission)parentPermission).allow);
    if (hasCug(immutableTree)) {
      tp=createCugPermission(immutableTree,tp);
    }
  }
 else {
    String path=immutableTree.getPath();
    if (supportedPaths.includes(path)) {
      tp=createCugPermission(immutableTree,null);
    }
 else     if (supportedPaths.mayContainCug(path)) {
      tp=new EmptyCugPermission(immutableTree);
    }
 else {
      tp=TreePermission.EMPTY;
    }
  }
  return tp;
}
Program: 8932
Project: 8932
Buggy source:
@Override public Set<String> getPrivileges(Tree tree){
  if (canRead(tree)) {
    return READ_PRIVILEGE_NAMES;
  }
 else {
    return Collections.emptySet();
  }
}

Fixed version (ground truth):
@Nonnull @Override public Set<String> getPrivileges(@Nullable Tree tree){
  if (tree != null && canRead(tree)) {
    return READ_PRIVILEGE_NAMES;
  }
 else {
    return Collections.emptySet();
  }
}
Program: 8933
Project: 8933
Buggy source:
@Override public RepositoryPermission getRepositoryPermission(){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Nonnull @Override public RepositoryPermission getRepositoryPermission(){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 8934
Project: 8934
Buggy source:
@Override public String getReference(String blobId){
  checkNotNull(blobId,"String_Node_Str");
  try {
    Mac mac=Mac.getInstance(ALGORITHM);
    mac.init(new SecretKeySpec(getReferenceKey(),ALGORITHM));
    byte[] hash=mac.doFinal(blobId.getBytes("String_Node_Str"));
    return blobId + ':' + BaseEncoding.base32Hex().encode(hash);
  }
 catch (  NoSuchAlgorithmException e) {
    throw new IllegalStateException(e);
  }
catch (  InvalidKeyException e) {
    throw new IllegalStateException(e);
  }
catch (  UnsupportedEncodingException e) {
    throw new IllegalStateException(e);
  }
}

Fixed version (ground truth):
@Override public String getReference(@Nonnull String blobId){
  checkNotNull(blobId,"String_Node_Str");
  try {
    Mac mac=Mac.getInstance(ALGORITHM);
    mac.init(new SecretKeySpec(getReferenceKey(),ALGORITHM));
    byte[] hash=mac.doFinal(blobId.getBytes("String_Node_Str"));
    return blobId + ':' + BaseEncoding.base32Hex().encode(hash);
  }
 catch (  NoSuchAlgorithmException e) {
    throw new IllegalStateException(e);
  }
catch (  InvalidKeyException e) {
    throw new IllegalStateException(e);
  }
catch (  UnsupportedEncodingException e) {
    throw new IllegalStateException(e);
  }
}
Program: 8935
Project: 8935
Buggy source:
@Override public String getBlobId(String reference){
  checkNotNull(reference,"String_Node_Str");
  int colon=reference.indexOf(':');
  if (colon != -1) {
    String blobId=reference.substring(0,colon);
    if (reference.equals(getReference(blobId))) {
      return blobId;
    }
    log.debug("String_Node_Str",reference);
  }
  return null;
}

Fixed version (ground truth):
@Override public String getBlobId(@Nonnull String reference){
  checkNotNull(reference,"String_Node_Str");
  int colon=reference.indexOf(':');
  if (colon != -1) {
    String blobId=reference.substring(0,colon);
    if (reference.equals(getReference(blobId))) {
      return blobId;
    }
    log.debug("String_Node_Str",reference);
  }
  return null;
}
Program: 8936
Project: 8936
Buggy source:
@Override public Thread newThread(Runnable r){
  Thread thread=new Thread(r,createName());
  thread.setDaemon(true);
  thread.setPriority(Thread.MIN_PRIORITY);
  return thread;
}

Fixed version (ground truth):
@Override public Thread newThread(@Nonnull Runnable r){
  Thread thread=new Thread(r,createName());
  thread.setDaemon(true);
  thread.setPriority(Thread.MIN_PRIORITY);
  return thread;
}
Program: 8937
Project: 8937
Buggy source:
/** 
 * Default   {@code ExecutorService} used for scheduling concurrent tasks.This default spawns as many threads as required with a priority of {@code Thread.MIN_PRIORITY}. Idle threads are pruned after one minute.
 * @return  fresh ExecutorService
 */
public static ExecutorService defaultExecutorService(){
  ThreadPoolExecutor executor=new ThreadPoolExecutor(0,Integer.MAX_VALUE,60L,TimeUnit.SECONDS,new SynchronousQueue<Runnable>(),new ThreadFactory(){
    private final AtomicInteger counter=new AtomicInteger();
    @Override public Thread newThread(    Runnable r){
      Thread thread=new Thread(r,createName());
      thread.setDaemon(true);
      thread.setPriority(Thread.MIN_PRIORITY);
      return thread;
    }
    private String createName(){
      return "String_Node_Str" + counter.getAndIncrement();
    }
  }
);
  executor.setKeepAliveTime(1,TimeUnit.MINUTES);
  executor.allowCoreThreadTimeOut(true);
  return executor;
}

Fixed version (ground truth):
/** 
 * Default   {@code ExecutorService} used for scheduling concurrent tasks.This default spawns as many threads as required with a priority of {@code Thread.MIN_PRIORITY}. Idle threads are pruned after one minute.
 * @return  fresh ExecutorService
 */
public static ExecutorService defaultExecutorService(){
  ThreadPoolExecutor executor=new ThreadPoolExecutor(0,Integer.MAX_VALUE,60L,TimeUnit.SECONDS,new SynchronousQueue<Runnable>(),new ThreadFactory(){
    private final AtomicInteger counter=new AtomicInteger();
    @Override public Thread newThread(    @Nonnull Runnable r){
      Thread thread=new Thread(r,createName());
      thread.setDaemon(true);
      thread.setPriority(Thread.MIN_PRIORITY);
      return thread;
    }
    private String createName(){
      return "String_Node_Str" + counter.getAndIncrement();
    }
  }
);
  executor.setKeepAliveTime(1,TimeUnit.MINUTES);
  executor.allowCoreThreadTimeOut(true);
  return executor;
}
Program: 8938
Project: 8938
Buggy source:
/** 
 * Default   {@code ScheduledExecutorService} used for scheduling background tasks.This default spawns up to 32 background thread on an as need basis. Idle threads are pruned after one minute.
 * @return  fresh ScheduledExecutorService
 */
public static ScheduledExecutorService defaultScheduledExecutor(){
  ScheduledThreadPoolExecutor executor=new ScheduledThreadPoolExecutor(32,new ThreadFactory(){
    private final AtomicInteger counter=new AtomicInteger();
    @Override public Thread newThread(    Runnable r){
      Thread thread=new Thread(r,createName());
      thread.setDaemon(true);
      return thread;
    }
    private String createName(){
      return "String_Node_Str" + counter.getAndIncrement();
    }
  }
);
  executor.setKeepAliveTime(1,TimeUnit.MINUTES);
  executor.allowCoreThreadTimeOut(true);
  return executor;
}

Fixed version (ground truth):
/** 
 * Default   {@code ScheduledExecutorService} used for scheduling background tasks.This default spawns up to 32 background thread on an as need basis. Idle threads are pruned after one minute.
 * @return  fresh ScheduledExecutorService
 */
public static ScheduledExecutorService defaultScheduledExecutor(){
  ScheduledThreadPoolExecutor executor=new ScheduledThreadPoolExecutor(32,new ThreadFactory(){
    private final AtomicInteger counter=new AtomicInteger();
    @Override public Thread newThread(    @Nonnull Runnable r){
      Thread thread=new Thread(r,createName());
      thread.setDaemon(true);
      return thread;
    }
    private String createName(){
      return "String_Node_Str" + counter.getAndIncrement();
    }
  }
);
  executor.setKeepAliveTime(1,TimeUnit.MINUTES);
  executor.allowCoreThreadTimeOut(true);
  return executor;
}
Program: 8939
Project: 8939
Buggy source:
@Override public int compareTo(Type<?> that){
  return ComparisonChain.start().compare(tag,that.tag).compareFalseFirst(array,that.array).result();
}

Fixed version (ground truth):
@Override public int compareTo(@Nonnull Type<?> that){
  return ComparisonChain.start().compare(tag,that.tag).compareFalseFirst(array,that.array).result();
}
Program: 8940
Project: 8940
Buggy source:
static protected void setAuthInfo(@Nonnull AuthInfo authInfo,@Nonnull Subject subject){
  Set<AuthInfo> ais=subject.getPublicCredentials(AuthInfo.class);
  if (!ais.isEmpty()) {
    subject.getPublicCredentials().removeAll(ais);
  }
  subject.getPublicCredentials().add(authInfo);
}

Fixed version (ground truth):
protected static void setAuthInfo(@Nonnull AuthInfo authInfo,@Nonnull Subject subject){
  Set<AuthInfo> ais=subject.getPublicCredentials(AuthInfo.class);
  if (!ais.isEmpty()) {
    subject.getPublicCredentials().removeAll(ais);
  }
  subject.getPublicCredentials().add(authInfo);
}
Program: 8941
Project: 8941
Buggy source:
/** 
 * Returns the next policy.
 * @return next policy.
 * @throws java.util.NoSuchElementException if there is no next policy.
 */
@Override public Principal nextPrincipal() throws NoSuchElementException {
  return (Principal)next();
}

Fixed version (ground truth):
/** 
 * Returns the next policy.
 * @return next policy.
 */
@Override public Principal nextPrincipal(){
  return (Principal)next();
}
Program: 8942
Project: 8942
Buggy source:
@Nonnull @Override public Restriction createRestriction(@Nullable String oakPath,@Nonnull String oakName,@Nonnull Value... values) throws AccessControlException, RepositoryException {
  return getProvider().createRestriction(oakPath,oakName,values);
}

Fixed version (ground truth):
@Nonnull @Override public Restriction createRestriction(@Nullable String oakPath,@Nonnull String oakName,@Nonnull Value... values) throws RepositoryException {
  return getProvider().createRestriction(oakPath,oakName,values);
}
Program: 8943
Project: 8943
Buggy source:
@Override public void validateRestrictions(@Nullable String oakPath,@Nonnull Tree aceTree) throws AccessControlException, RepositoryException {
  getProvider().validateRestrictions(oakPath,aceTree);
}

Fixed version (ground truth):
@Override public void validateRestrictions(@Nullable String oakPath,@Nonnull Tree aceTree) throws RepositoryException {
  getProvider().validateRestrictions(oakPath,aceTree);
}
Program: 8944
Project: 8944
Buggy source:
@Activate protected void activate(ComponentContext componentContext){
  Object value=componentContext.getProperties().get(QUERY_TIME_AGGREGATION);
  boolean queryTimeAggregation=PropertiesUtil.toBoolean(value,QUERY_TIME_AGGREGATION_DEFAULT);
  if (solrServerProvider != null && oakSolrConfigurationProvider != null) {
    QueryIndexProvider solrQueryIndexProvider=new SolrQueryIndexProvider(solrServerProvider,oakSolrConfigurationProvider,nodeAggregator);
    log.debug("String_Node_Str",queryTimeAggregation ? "String_Node_Str" : "String_Node_Str");
    if (queryTimeAggregation) {
      solrQueryIndexProvider=AggregateIndexProvider.wrap(solrQueryIndexProvider);
    }
    regs.add(componentContext.getBundleContext().registerService(QueryIndexProvider.class.getName(),solrQueryIndexProvider,null));
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Activate protected void activate(ComponentContext componentContext){
  Object value=componentContext.getProperties().get(QUERY_TIME_AGGREGATION);
  boolean queryTimeAggregation=PropertiesUtil.toBoolean(value,QUERY_TIME_AGGREGATION_DEFAULT);
  if (solrServerProvider != null && oakSolrConfigurationProvider != null) {
    QueryIndexProvider solrQueryIndexProvider=new SolrQueryIndexProvider(solrServerProvider,oakSolrConfigurationProvider,nodeAggregator);
    log.debug("String_Node_Str",queryTimeAggregation ? "String_Node_Str" : "String_Node_Str");
    if (queryTimeAggregation) {
      solrQueryIndexProvider=AggregateIndexProvider.wrap(solrQueryIndexProvider);
    }
    regs.add(componentContext.getBundleContext().registerService(QueryIndexProvider.class.getName(),solrQueryIndexProvider,null));
  }
}
Program: 8945
Project: 8945
Buggy source:
@Deactivate protected void deactivate(){
  for (  ServiceRegistration registration : regs) {
    registration.unregister();
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Deactivate protected void deactivate(){
  for (  ServiceRegistration registration : regs) {
    registration.unregister();
  }
}
Program: 8946
Project: 8946
Buggy source:
/** 
 * Deletes all the metadata records with the specified prefix.
 * @param prefix the prefix of the record
 */
public void deleteAllMetadataRecords(String prefix);

Fixed version (ground truth):
/** 
 * Deletes all the metadata records with the specified prefix.
 * @param prefix the prefix of the record
 */
void deleteAllMetadataRecords(String prefix);
Program: 8947
Project: 8947
Buggy source:
/** 
 * Adds a metadata record with the specified name
 * @param input the record input stream
 * @param name the name
 * @throws org.apache.jackrabbit.core.data.DataStoreException
 */
public void addMetadataRecord(final InputStream input,final String name) throws DataStoreException ;

Fixed version (ground truth):
/** 
 * Adds a metadata record with the specified name
 * @param input the record input stream
 * @param name the name
 * @throws org.apache.jackrabbit.core.data.DataStoreException
 */
void addMetadataRecord(final InputStream input,final String name) throws DataStoreException ;
Program: 8948
Project: 8948
Buggy source:
/** 
 * Gets all the metadata with a specified prefix.
 * @param prefix the prefix of the records to retrieve
 * @return list of all the metadata DataRecords
 */
public List<DataRecord> getAllMetadataRecords(String prefix);

Fixed version (ground truth):
/** 
 * Gets all the metadata with a specified prefix.
 * @param prefix the prefix of the records to retrieve
 * @return list of all the metadata DataRecords
 */
List<DataRecord> getAllMetadataRecords(String prefix);
Program: 8949
Project: 8949
Buggy source:
/** 
 * Gets the metadata of the specified name.
 * @param name the name of the record
 * @return the metadata DataRecord
 */
public DataRecord getMetadataRecord(String name);

Fixed version (ground truth):
/** 
 * Gets the metadata of the specified name.
 * @param name the name of the record
 * @return the metadata DataRecord
 */
DataRecord getMetadataRecord(String name);
Program: 8950
Project: 8950
Buggy source:
/** 
 * Deletes the metadata record with the specified name
 * @param name the name of the record
 * @return boolean to indicate success of deletion
 */
public boolean deleteMetadataRecord(String name);

Fixed version (ground truth):
/** 
 * Deletes the metadata record with the specified name
 * @param name the name of the record
 * @return boolean to indicate success of deletion
 */
boolean deleteMetadataRecord(String name);
Program: 8951
Project: 8951
Buggy source:
@Deactivate protected void deactivate() throws Exception {
  authorizableActionProvider.stop();
  authorizableNodeName.stop();
  restrictionProvider.stop();
  userAuthenticationFactory.stop();
}

Fixed version (ground truth):
@Deactivate protected void deactivate(){
  authorizableActionProvider.stop();
  authorizableNodeName.stop();
  restrictionProvider.stop();
  userAuthenticationFactory.stop();
}
Program: 8952
Project: 8952
Buggy source:
@Activate protected void activate(BundleContext context) throws Exception {
  whiteboard=new OsgiWhiteboard(context);
  authorizableActionProvider.start(whiteboard);
  authorizableNodeName.start(whiteboard);
  restrictionProvider.start(whiteboard);
  userAuthenticationFactory.start(whiteboard);
  initializeConfigurations();
}

Fixed version (ground truth):
@Activate protected void activate(BundleContext context){
  whiteboard=new OsgiWhiteboard(context);
  authorizableActionProvider.start(whiteboard);
  authorizableNodeName.start(whiteboard);
  restrictionProvider.start(whiteboard);
  userAuthenticationFactory.start(whiteboard);
  initializeConfigurations();
}
Program: 8953
Project: 8953
Buggy source:
/** 
 * Create a   {@code LoginContextProvider} using standard{@link javax.security.auth.login.Configuration#getConfiguration() JAAS}functionality. In case no login configuration for the specified app name can be retrieve this implementation uses the default as defined by  {@link ConfigurationUtil#getDefaultConfiguration(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)}. <p> The   {@link LoginContextProvider} implementation is intended to be used with<ul> <li>Regular login using JAAS  {@link javax.security.auth.spi.LoginModule} or</li><li>Pre-authenticated subjects in which case any authentication related validation is omitted</li> </ul> <h4>Configuration Options</h4> <ul> <li> {@link #PARAM_APP_NAME}: The appName passed to  {@code Configuration#getAppConfigurationEntry(String)}. The default value is   {@link #DEFAULT_APP_NAME}.</li> </ul>
 * @param contentRepository The content repository.
 * @return An new instance of {@link LoginContextProvider}.
 */
@Nonnull @Override public LoginContextProvider getLoginContextProvider(ContentRepository contentRepository){
  String appName=getParameters().getConfigValue(PARAM_APP_NAME,DEFAULT_APP_NAME);
  SecurityProvider provider=getSecurityProvider();
  Whiteboard whiteboard=null;
  if (provider instanceof WhiteboardAware) {
    whiteboard=((WhiteboardAware)provider).getWhiteboard();
  }
 else {
    log.warn("String_Node_Str");
  }
  return new LoginContextProviderImpl(appName,getParameters(),contentRepository,getSecurityProvider(),whiteboard);
}

Fixed version (ground truth):
/** 
 * Create a   {@code LoginContextProvider} using standard{@link javax.security.auth.login.Configuration#getConfiguration() JAAS}functionality. In case no login configuration for the specified app name can be retrieve this implementation uses the default as defined by  {@link org.apache.jackrabbit.oak.spi.security.authentication.ConfigurationUtil#getDefaultConfiguration(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)}. <p> The   {@link LoginContextProvider} implementation is intended to be used with<ul> <li>Regular login using JAAS  {@link javax.security.auth.spi.LoginModule} or</li><li>Pre-authenticated subjects in which case any authentication related validation is omitted</li> </ul> <h4>Configuration Options</h4> <ul> <li> {@link #PARAM_APP_NAME}: The appName passed to  {@code Configuration#getAppConfigurationEntry(String)}. The default value is   {@link #DEFAULT_APP_NAME}.</li> </ul>
 * @param contentRepository The content repository.
 * @return An new instance of {@link LoginContextProvider}.
 */
@Nonnull @Override public LoginContextProvider getLoginContextProvider(ContentRepository contentRepository){
  String appName=getParameters().getConfigValue(PARAM_APP_NAME,DEFAULT_APP_NAME);
  SecurityProvider provider=getSecurityProvider();
  Whiteboard whiteboard=null;
  if (provider instanceof WhiteboardAware) {
    whiteboard=((WhiteboardAware)provider).getWhiteboard();
  }
 else {
    log.warn("String_Node_Str");
  }
  return new LoginContextProviderImpl(appName,getParameters(),contentRepository,getSecurityProvider(),whiteboard);
}
Program: 8954
Project: 8954
Buggy source:
@Nonnull private Configuration getConfiguration(){
  if (configuration == null) {
    Configuration loginConfig=null;
    String configSpiName=params.getConfigValue(PARAM_CONFIG_SPI_NAME,"String_Node_Str");
    if (!"String_Node_Str".equals(configSpiName)) {
      try {
        loginConfig=Configuration.getInstance("String_Node_Str",null,configSpiName);
        if (loginConfig.getAppConfigurationEntry(appName) == null) {
          log.warn("String_Node_Str" + "String_Node_Str",appName,configSpiName);
        }
      }
 catch (      NoSuchAlgorithmException e) {
        log.warn("String_Node_Str",configSpiName,e);
      }
catch (      NoSuchProviderException e) {
        log.warn("String_Node_Str",configSpiName,e);
      }
    }
    if (loginConfig == null) {
      try {
        loginConfig=Configuration.getConfiguration();
        if (loginConfig.getAppConfigurationEntry(appName) == null) {
          loginConfig=null;
        }
      }
 catch (      SecurityException e) {
        log.info("String_Node_Str" + e);
      }
    }
    if (loginConfig == null) {
      log.debug("String_Node_Str",appName);
      loginConfig=ConfigurationUtil.getDefaultConfiguration(params);
    }
    configuration=loginConfig;
  }
  return configuration;
}

Fixed version (ground truth):
@Nonnull private Configuration getConfiguration(){
  if (configuration == null) {
    Configuration loginConfig=null;
    String configSpiName=params.getConfigValue(PARAM_CONFIG_SPI_NAME,null,String.class);
    if (configSpiName != null) {
      try {
        loginConfig=Configuration.getInstance("String_Node_Str",null,configSpiName);
        if (loginConfig.getAppConfigurationEntry(appName) == null) {
          log.warn("String_Node_Str" + "String_Node_Str",appName,configSpiName);
        }
      }
 catch (      NoSuchAlgorithmException e) {
        log.warn("String_Node_Str",configSpiName,e);
      }
catch (      NoSuchProviderException e) {
        log.warn("String_Node_Str",configSpiName,e);
      }
    }
    if (loginConfig == null) {
      try {
        loginConfig=Configuration.getConfiguration();
        if (loginConfig.getAppConfigurationEntry(appName) == null) {
          loginConfig=null;
        }
      }
 catch (      SecurityException e) {
        log.info("String_Node_Str" + e);
      }
    }
    if (loginConfig == null) {
      log.debug("String_Node_Str",appName);
      loginConfig=ConfigurationUtil.getDefaultConfiguration(params);
    }
    configuration=loginConfig;
  }
  return configuration;
}
Program: 8955
Project: 8955
Buggy source:
@Nonnull @Override public AccessControlManager getAccessControlManager(final @Nonnull Root root,final @Nonnull NamePathMapper namePathMapper){
  List<AuthorizationConfiguration> configurations=getConfigurations();
switch (configurations.size()) {
case 0:
    throw new IllegalStateException();
case 1:
  return configurations.get(0).getAccessControlManager(root,namePathMapper);
default :
List<AccessControlManager> mgrs=Lists.transform(configurations,new Function<AuthorizationConfiguration,AccessControlManager>(){
  @Override public AccessControlManager apply(  AuthorizationConfiguration authorizationConfiguration){
    return authorizationConfiguration.getAccessControlManager(root,namePathMapper);
  }
}
);
return new CompositeAccessControlManager(root,namePathMapper,getSecurityProvider(),mgrs);
}
}

Fixed version (ground truth):
@Nonnull @Override public AccessControlManager getAccessControlManager(@Nonnull final Root root,@Nonnull final NamePathMapper namePathMapper){
  List<AuthorizationConfiguration> configurations=getConfigurations();
switch (configurations.size()) {
case 0:
    throw new IllegalStateException();
case 1:
  return configurations.get(0).getAccessControlManager(root,namePathMapper);
default :
List<AccessControlManager> mgrs=Lists.transform(configurations,new Function<AuthorizationConfiguration,AccessControlManager>(){
  @Override public AccessControlManager apply(  AuthorizationConfiguration authorizationConfiguration){
    return authorizationConfiguration.getAccessControlManager(root,namePathMapper);
  }
}
);
return new CompositeAccessControlManager(root,namePathMapper,getSecurityProvider(),mgrs);
}
}