nus-yam/ex-repair huggingface dataset:
Program: 8739
Project: 8739
Buggy source:
/** 
 * <p> consolidate the   {@link #PREFIX_PROP_COUNTER} properties and sum them into the{@link #PROP_COUNTER}</p> <p> The passed in   {@code NodeBuilder} must have{@link org.apache.jackrabbit.JcrConstants#JCR_MIXINTYPES JCR_MIXINTYPES} with{@link org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants#MIX_ATOMIC_COUNTER MIX_ATOMIC_COUNTER}. If not it will be silently ignored. </p>
 * @param builder the builder to work on. Cannot be null.
 */
public static void consolidateCount(@Nonnull final NodeBuilder builder){
  long count=0;
  for (  PropertyState p : builder.getProperties()) {
    if (p.getName().startsWith(PREFIX_PROP_COUNTER)) {
      count+=p.getValue(LONG);
    }
  }
  builder.setProperty(PROP_COUNTER,count);
}

Fixed version (ground truth):
/** 
 * <p> consolidate the   {@link #PREFIX_PROP_COUNTER} properties and sum them into the{@link #PROP_COUNTER}</p> <p> The passed in   {@code NodeBuilder} must have{@link org.apache.jackrabbit.JcrConstants#JCR_MIXINTYPES JCR_MIXINTYPES} with{@link NodeTypeConstants#MIX_ATOMIC_COUNTER MIX_ATOMIC_COUNTER}. If not it will be silently ignored. </p>
 * @param builder the builder to work on. Cannot be null.
 */
public static void consolidateCount(@Nonnull final NodeBuilder builder){
  long count=0;
  for (  PropertyState p : builder.getProperties()) {
    if (p.getName().startsWith(PREFIX_PROP_COUNTER)) {
      count+=p.getValue(LONG);
    }
  }
  builder.setProperty(PROP_COUNTER,count);
}
Program: 8740
Project: 8740
Buggy source:
/** 
 * <p> Plain Java oriented constructor. Refer to  {@link AtomicCounterEditor#AtomicCounterEditor(NodeBuilder,String,ScheduledExecutorService,NodeStore)}for constructions details of the actual editor. </p> <p> Based on the use case this may need an already set of the constructor parameters during the repository construction. Please ensure they're registered before this provider is registered. </p>
 * @param clusterInfo cluster node information
 * @param executor the executor for running asynchronously.
 * @param store reference to the NodeStore.
 * @param whiteboard the underlying board for picking up the registered {@link CommitHook}
 */
public AtomicCounterEditorProvider(@Nullable Supplier<Clusterable> clusterInfo,@Nullable Supplier<ScheduledExecutorService> executor,@Nullable Supplier<NodeStore> store,@Nullable Supplier<Whiteboard> whiteboard){
  this.clusterSupplier=clusterInfo;
  this.schedulerSupplier=executor;
  this.storeSupplier=store;
  this.wbSupplier=whiteboard;
}

Fixed version (ground truth):
/** 
 * <p> Plain Java oriented constructor. Refer to  {@link AtomicCounterEditor#AtomicCounterEditor(NodeBuilder,String,ScheduledExecutorService,NodeStore,Whiteboard)}for constructions details of the actual editor. </p> <p> Based on the use case this may need an already set of the constructor parameters during the repository construction. Please ensure they're registered before this provider is registered. </p>
 * @param clusterInfo cluster node information
 * @param executor the executor for running asynchronously.
 * @param store reference to the NodeStore.
 * @param whiteboard the underlying board for picking up the registered {@link CommitHook}
 */
public AtomicCounterEditorProvider(@Nullable Supplier<Clusterable> clusterInfo,@Nullable Supplier<ScheduledExecutorService> executor,@Nullable Supplier<NodeStore> store,@Nullable Supplier<Whiteboard> whiteboard){
  this.clusterSupplier=clusterInfo;
  this.schedulerSupplier=executor;
  this.storeSupplier=store;
  this.wbSupplier=whiteboard;
}
Program: 8741
Project: 8741
Buggy source:
/** 
 * Collect references.
 * @param collector the collector to collect all references
 * @return the references
 * @throws Exception the exception
 */
void collectReferences(ReferenceCollector collector);

Fixed version (ground truth):
/** 
 * Collect references.
 * @param collector the collector to collect all references
 */
void collectReferences(ReferenceCollector collector);
Program: 8743
Project: 8743
Buggy source:
/** 
 * Adds the root record.
 * @param stream the stream
 * @param name the name of the root record
 * @return the data record
 * @throws DataStoreException the data store exception
 */
void addMetadataRecord(InputStream stream,String name) throws DataStoreException ;

Fixed version (ground truth):
/** 
 * Adds the root record.
 * @param stream the stream
 * @param name the name of the root record
 * @throws DataStoreException the data store exception
 */
void addMetadataRecord(InputStream stream,String name) throws DataStoreException ;
Program: 8744
Project: 8744
Buggy source:
/** 
 * Check if _lastRev recovery needed for this cluster node state is Active && currentTime past the leaseEnd time
 */
public boolean isRecoveryNeeded(@Nonnull ClusterNodeInfoDocument nodeInfo){
  return nodeInfo.isActive() && clock.getTime() > nodeInfo.getLeaseEndTime();
}

Fixed version (ground truth):
/** 
 * Check if _lastRev recovery needed for this cluster node state is Active and currentTime past the leaseEnd time
 */
public boolean isRecoveryNeeded(@Nonnull ClusterNodeInfoDocument nodeInfo){
  return nodeInfo.isActive() && clock.getTime() > nodeInfo.getLeaseEndTime();
}
Program: 8746
Project: 8746
Buggy source:
/** 
 * @param useRevisionMaps whether to use  {@link RevisionMap}s instead of regular  {@link Map}s.
 */
public RDBJSONSupport(boolean useRevisionMaps){
  this.useRevisionMaps=useRevisionMaps;
}

Fixed version (ground truth):
/** 
 * @param useRevisionMaps whether to use revision maps instead of regular {@link Map}s.
 */
public RDBJSONSupport(boolean useRevisionMaps){
  this.useRevisionMaps=useRevisionMaps;
}
Program: 8747
Project: 8747
Buggy source:
/** 
 * Returns the parent id for given id if possible <p>It would return null in following cases <ul> <li>If id is from long path</li> <li>If id is for root path</li> <li>If id is for an invalid path</li> </ul> </p>
 * @param id id for which parent id needs to be determined
 * @return parent id. null if parent id cannot be determined
 */
@CheckForNull public static String getParentId(String id){
  if (Utils.isIdFromLongPath(id)) {
    return null;
  }
  String path=Utils.getPathFromId(id);
  if (!PathUtils.isValid(path)) {
    return null;
  }
  if (PathUtils.denotesRoot(path)) {
    return null;
  }
  String parentPath=PathUtils.getParentPath(path);
  return Utils.getIdFromPath(parentPath);
}

Fixed version (ground truth):
/** 
 * Returns the parent id for given id if possible <p>It would return null in following cases <ul> <li>If id is from long path</li> <li>If id is for root path</li> <li>If id is for an invalid path</li> </ul>
 * @param id id for which parent id needs to be determined
 * @return parent id. null if parent id cannot be determined
 */
@CheckForNull public static String getParentId(String id){
  if (Utils.isIdFromLongPath(id)) {
    return null;
  }
  String path=Utils.getPathFromId(id);
  if (!PathUtils.isValid(path)) {
    return null;
  }
  if (PathUtils.denotesRoot(path)) {
    return null;
  }
  String parentPath=PathUtils.getParentPath(path);
  return Utils.getIdFromPath(parentPath);
}
Program: 8748
Project: 8748
Buggy source:
/** 
 * Calculates the applicable definition for the property with the specified characteristics under a parent with this effective type.
 * @param propertyName The internal oak name of the property for which thedefinition should be retrieved.
 * @param isMultiple {@code true} if the target property is multi-valued.
 * @param type The target type of the property.
 * @param exactTypeMatch {@code true} if the required type of the definitionmust exactly match the type of the target property.
 * @return the applicable definition for the target property.
 * @throws ConstraintViolationException If no matching definition can be found.
 * @throws RepositoryException If another error occurs.
 */
public PropertyDefinition getPropertyDefinition(String propertyName,boolean isMultiple,int type,boolean exactTypeMatch) throws ConstraintViolationException {
  for (  PropertyDefinition def : getNamedPropertyDefinitions(propertyName)) {
    int defType=def.getRequiredType();
    if (isMultiple == def.isMultiple() && (!exactTypeMatch || (type == defType || UNDEFINED == type || UNDEFINED == defType))) {
      return def;
    }
  }
  for (  PropertyDefinition def : getResidualPropertyDefinitions()) {
    int defType=def.getRequiredType();
    if (isMultiple == def.isMultiple() && (!exactTypeMatch || (type == defType || UNDEFINED == type || UNDEFINED == defType))) {
      return def;
    }
  }
  throw new ConstraintViolationException("String_Node_Str" + propertyName);
}

Fixed version (ground truth):
/** 
 * Calculates the applicable definition for the property with the specified characteristics under a parent with this effective type.
 * @param propertyName The internal oak name of the property for which thedefinition should be retrieved.
 * @param isMultiple {@code true} if the target property is multi-valued.
 * @param type The target type of the property.
 * @param exactTypeMatch {@code true} if the required type of the definitionmust exactly match the type of the target property.
 * @return the applicable definition for the target property.
 * @throws ConstraintViolationException If no matching definition can be found.
 */
public PropertyDefinition getPropertyDefinition(String propertyName,boolean isMultiple,int type,boolean exactTypeMatch) throws ConstraintViolationException {
  for (  PropertyDefinition def : getNamedPropertyDefinitions(propertyName)) {
    int defType=def.getRequiredType();
    if (isMultiple == def.isMultiple() && (!exactTypeMatch || (type == defType || UNDEFINED == type || UNDEFINED == defType))) {
      return def;
    }
  }
  for (  PropertyDefinition def : getResidualPropertyDefinitions()) {
    int defType=def.getRequiredType();
    if (isMultiple == def.isMultiple() && (!exactTypeMatch || (type == defType || UNDEFINED == type || UNDEFINED == defType))) {
      return def;
    }
  }
  throw new ConstraintViolationException("String_Node_Str" + propertyName);
}
Program: 8751
Project: 8751
Buggy source:
@Test public void testUpdateAndDelete() throws Exception {
  byte[] data=new byte[256];
  Random r=new Random(0);
  r.nextBytes(data);
  byte[] digest=getDigest(data);
  RDBBlobStoreFriend.storeBlock(blobStore,digest,0,data);
  String id=StringUtils.convertBytesToHex(digest);
  long until=System.currentTimeMillis() + 1000;
  while (System.currentTimeMillis() < until) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
  RDBBlobStoreFriend.storeBlock(blobStore,digest,0,data);
  Assert.assertFalse(blobStore.deleteChunks(ImmutableList.of(id),System.currentTimeMillis() - 100));
  Assert.assertNotNull(RDBBlobStoreFriend.readBlockFromBackend(blobStore,digest));
}

Fixed version (ground truth):
@Test public void testUpdateAndDelete() throws Exception {
  byte[] data=new byte[256];
  Random r=new Random(0);
  r.nextBytes(data);
  byte[] digest=getDigest(data);
  RDBBlobStoreFriend.storeBlock(blobStore,digest,0,data);
  String id=StringUtils.convertBytesToHex(digest);
  long until=System.currentTimeMillis() + 1000;
  while (System.currentTimeMillis() < until) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
  long beforeUpdateTs=System.currentTimeMillis() - 100;
  RDBBlobStoreFriend.storeBlock(blobStore,digest,0,data);
  Assert.assertFalse("String_Node_Str",blobStore.deleteChunks(ImmutableList.of(id),beforeUpdateTs));
  Assert.assertNotNull(RDBBlobStoreFriend.readBlockFromBackend(blobStore,digest));
}
Program: 8752
Project: 8752
Buggy source:
static Delegatee createInstance(final @Nonnull Repository repository,@Nonnull SyncHandler handler,@Nonnull ExternalIdentityProvider idp){
  Session systemSession;
  try {
    systemSession=Subject.doAs(SystemSubject.INSTANCE,new PrivilegedExceptionAction<Session>(){
      @Override public Session run() throws RepositoryException {
        if (repository instanceof JackrabbitRepository) {
          return ((JackrabbitRepository)repository).login(null,null,null);
        }
 else {
          return repository.login(null,null);
        }
      }
    }
);
  }
 catch (  PrivilegedActionException e) {
    throw new SyncRuntimeException(ERROR_CREATE_DELEGATEE,e);
  }
  if (!(systemSession instanceof JackrabbitSession)) {
    systemSession.logout();
    throw new SyncRuntimeException("String_Node_Str");
  }
  try {
    return new Delegatee(handler,idp,(JackrabbitSession)systemSession);
  }
 catch (  RepositoryException e) {
    systemSession.logout();
    throw new SyncRuntimeException(ERROR_CREATE_DELEGATEE,e);
  }
catch (  SyncException e) {
    systemSession.logout();
    throw new SyncRuntimeException(ERROR_CREATE_DELEGATEE,e);
  }
}

Fixed version (ground truth):
static Delegatee createInstance(@Nonnull final Repository repository,@Nonnull SyncHandler handler,@Nonnull ExternalIdentityProvider idp){
  Session systemSession;
  try {
    systemSession=Subject.doAs(SystemSubject.INSTANCE,new PrivilegedExceptionAction<Session>(){
      @Override public Session run() throws RepositoryException {
        if (repository instanceof JackrabbitRepository) {
          return ((JackrabbitRepository)repository).login(null,null,null);
        }
 else {
          return repository.login(null,null);
        }
      }
    }
);
  }
 catch (  PrivilegedActionException e) {
    throw new SyncRuntimeException(ERROR_CREATE_DELEGATEE,e);
  }
  if (!(systemSession instanceof JackrabbitSession)) {
    systemSession.logout();
    throw new SyncRuntimeException("String_Node_Str");
  }
  try {
    return new Delegatee(handler,idp,(JackrabbitSession)systemSession);
  }
 catch (  RepositoryException e) {
    systemSession.logout();
    throw new SyncRuntimeException(ERROR_CREATE_DELEGATEE,e);
  }
catch (  SyncException e) {
    systemSession.logout();
    throw new SyncRuntimeException(ERROR_CREATE_DELEGATEE,e);
  }
}
Program: 8754
Project: 8754
Buggy source:
/** 
 * Get the nth ancestor of a path. The 1st ancestor is the parent path, 2nd ancestor the grandparent path, and so on... <p> If nth <= 0, the path argument is returned as is.
 * @param path the path
 * @param nth  indicates the ancestor level for which the path should becalculated.
 * @return the ancestor path
 */
@Nonnull public static String getAncestorPath(String path,int nth){
}

Fixed version (ground truth):
/** 
 * Get the nth ancestor of a path. The 1st ancestor is the parent path, 2nd ancestor the grandparent path, and so on... <p> If   {@code nth <= 0}, the path argument is returned as is.
 * @param path the path
 * @param nth  indicates the ancestor level for which the path should becalculated.
 * @return the ancestor path
 */
@Nonnull public static String getAncestorPath(String path,int nth){
}
Program: 8755
Project: 8755
Buggy source:
/** 
 * Set the on complete handler. The handler will run exactly once after the task terminated. If the task has already terminated at the time of this method call the handler will execute immediately. <p/> Note: there is no guarantee to which handler will run when the method is called multiple times with different arguments.
 * @param onComplete listener to invoke upon completion
 */
public void onComplete(Runnable onComplete){
  this.onComplete=onComplete;
  if (isDone()) {
    run(onComplete);
  }
}

Fixed version (ground truth):
/** 
 * Set the on complete handler. The handler will run exactly once after the task terminated. If the task has already terminated at the time of this method call the handler will execute immediately. <p> Note: there is no guarantee to which handler will run when the method is called multiple times with different arguments. </p>
 * @param onComplete listener to invoke upon completion
 */
public void onComplete(Runnable onComplete){
  this.onComplete=onComplete;
  if (isDone()) {
    run(onComplete);
  }
}
Program: 8756
Project: 8756
Buggy source:
/** 
 * <p> Enable the asynchronous (background) indexing behavior for the provided task name. </p> <p> Please note that when enabling the background indexer, you need to take care of calling <code>#shutdown<code> on the <code>executor<code> provided for this Oak instance. </p>
 */
public Oak withAsyncIndexing(@Nonnull String name,long delayInSeconds){
  if (this.asyncTasks == null) {
    asyncTasks=new HashMap<String,Long>();
  }
  checkState(delayInSeconds > 0,"String_Node_Str");
  asyncTasks.put(checkNotNull(name),delayInSeconds);
  return this;
}

Fixed version (ground truth):
/** 
 * <p> Enable the asynchronous (background) indexing behavior for the provided task name. </p> <p> Please note that when enabling the background indexer, you need to take care of calling <code>#shutdown</code> on the <code>executor</code> provided for this Oak instance. </p>
 */
public Oak withAsyncIndexing(@Nonnull String name,long delayInSeconds){
  if (this.asyncTasks == null) {
    asyncTasks=new HashMap<String,Long>();
  }
  checkState(delayInSeconds > 0,"String_Node_Str");
  asyncTasks.put(checkNotNull(name),delayInSeconds);
  return this;
}
Program: 8757
Project: 8757
Buggy source:
/** 
 * @return the original statement as it was used to construct the object. If not provided the{@link #toString()} will be used instead.
 */
String getStatement();

Fixed version (ground truth):
/** 
 * @return the original statement as it was used to construct the object. If not provided thetoString() will be used instead.
 */
String getStatement();
Program: 8758
Project: 8758
Buggy source:
/** 
 * Whether this condition will, from now on, always evaluate to false. This is the case for example for full-text constraints if there is no full-text index (unless FullTextComparisonWithoutIndex is enabled). This will also allow is to add conditions that stop further processing for other reasons, similar to "WHERE ROWNUM < 10" in Oracle.
 * @return true if further processing should be stopped
 */
public boolean evaluateStop(){
  return false;
}

Fixed version (ground truth):
/** 
 * Whether this condition will, from now on, always evaluate to false. This is the case for example for full-text constraints if there is no full-text index (unless FullTextComparisonWithoutIndex is enabled). This will also allow is to add conditions that stop further processing for other reasons, similar to   {@code "WHERE ROWNUM < 10"} in Oracle.
 * @return true if further processing should be stopped
 */
public boolean evaluateStop(){
  return false;
}
Program: 8759
Project: 8759
Buggy source:
/** 
 * <b>!Test purpose only! <b> this creates a filter for the given query
 * @param preparing whether this this the prepare phase
 * @return a new filter
 */
public abstract Filter createFilter(boolean preparing);

Fixed version (ground truth):
/** 
 * <b>!Test purpose only! </b> this creates a filter for the given query
 * @param preparing whether this this the prepare phase
 * @return a new filter
 */
public abstract Filter createFilter(boolean preparing);
Program: 8761
Project: 8761
Buggy source:
/** 
 * Returns a cursor wrapper, which returns the ancestor rows at the given <code>level</code> of the wrapped cursor <code>c</code>. With <code>level</code> e.g. set to <code>1</code>, the returned cursor iterates over the parent rows of the passed cursor <code>c</code>. The returned cursor guarantees distinct rows.
 * @param c the cursor to wrap.
 * @param level the ancestor level. Must be >= 1.
 * @return cursor over the ancestors of <code>c</code> at <code>level</code>.
 */
public static Cursor newAncestorCursor(Cursor c,int level,QueryEngineSettings settings){
  checkNotNull(c);
  checkArgument(level >= 1);
  return new AncestorCursor(c,level,settings);
}

Fixed version (ground truth):
/** 
 * Returns a cursor wrapper, which returns the ancestor rows at the given <code>level</code> of the wrapped cursor <code>c</code>. With <code>level</code> e.g. set to <code>1</code>, the returned cursor iterates over the parent rows of the passed cursor <code>c</code>. The returned cursor guarantees distinct rows.
 * @param c the cursor to wrap.
 * @param level the ancestor level. Must be {@code >= 1}.
 * @return cursor over the ancestors of <code>c</code> at <code>level</code>.
 */
public static Cursor newAncestorCursor(Cursor c,int level,QueryEngineSettings settings){
  checkNotNull(c);
  checkArgument(level >= 1);
  return new AncestorCursor(c,level,settings);
}
Program: 8762
Project: 8762
Buggy source:
/** 
 * Optional method that allows a given user management implementation to provide a specific and optimized implementation of the   {@link PrincipalProvider}interface for the principals represented by the user/groups known to this implementation. If this method returns   {@code null} the security setup will by defaultuse a basic  {@code PrincipalProvider} implementation based on publicuser management API or a combination of other  {@link PrincipalProvider}s as configured with the repository setup.
 * @param root The root used to read the principal information from.
 * @param namePathMapper The {@code NamePathMapper} to convert oak paths to JCR paths.
 * @return An implementation of {@code PrincipalProvider} or {@code null} ifprincipal discovery is provided by other means of if the default principal provider implementation should be used that acts on public user management API.
 * @see {@link org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration}
 */
@Nullable PrincipalProvider getUserPrincipalProvider(@Nonnull Root root,@Nonnull NamePathMapper namePathMapper);

Fixed version (ground truth):
/** 
 * Optional method that allows a given user management implementation to provide a specific and optimized implementation of the   {@link PrincipalProvider}interface for the principals represented by the user/groups known to this implementation. If this method returns   {@code null} the security setup will by defaultuse a basic  {@code PrincipalProvider} implementation based on publicuser management API or a combination of other  {@link PrincipalProvider}s as configured with the repository setup.
 * @param root The root used to read the principal information from.
 * @param namePathMapper The {@code NamePathMapper} to convert oak paths to JCR paths.
 * @return An implementation of {@code PrincipalProvider} or {@code null} ifprincipal discovery is provided by other means of if the default principal provider implementation should be used that acts on public user management API.
 * @see org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration
 */
@Nullable PrincipalProvider getUserPrincipalProvider(@Nonnull Root root,@Nonnull NamePathMapper namePathMapper);
Program: 8763
Project: 8763
Buggy source:
/** 
 * Returns the name value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = builder.getProperty(name); if (property != null && property.getType() == Type.NAME) { return property.getValue(Type.NAME); } else { return null; } </pre>
 * @param name property name
 * @return name value of the named property, or {@code null}
 */
@CheckForNull String getName(@Nonnull String name);

Fixed version (ground truth):
/** 
 * Returns the name value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = builder.getProperty(name);}if (property != null && property.getType() == Type.NAME)  return property.getValue(Type.NAME); } else { return null; } } </pre>
 * @param name property name
 * @return name value of the named property, or {@code null}
 */
@CheckForNull String getName(@Nonnull String name);
Program: 8764
Project: 8764
Buggy source:
/** 
 * Returns the name values of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = builder.getProperty(name); if (property != null && property.getType() == Type.NAMES) { return property.getValue(Type.NAMES); } else { return Collections.emptyList(); } </pre>
 * @param name property name
 * @return name values of the named property, or an empty collection
 */
@Nonnull Iterable<String> getNames(@Nonnull String name);

Fixed version (ground truth):
/** 
 * Returns the name values of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = builder.getProperty(name);}if (property != null && property.getType() == Type.NAMES)  return property.getValue(Type.NAMES); } else { return Collections.emptyList(); } } </pre>
 * @param name property name
 * @return name values of the named property, or an empty collection
 */
@Nonnull Iterable<String> getNames(@Nonnull String name);
Program: 8765
Project: 8765
Buggy source:
/** 
 * Returns the boolean value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = builder.getProperty(name); return property != null && property.getType() == Type.BOOLEAN && property.getValue(Type.BOOLEAN); </pre>
 * @param name property name
 * @return boolean value of the named property, or {@code false}
 */
boolean getBoolean(@Nonnull String name);

Fixed version (ground truth):
/** 
 * Returns the boolean value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = builder.getProperty(name); return property != null && property.getType() == Type.BOOLEAN && property.getValue(Type.BOOLEAN);}</pre>
 * @param name property name
 * @return boolean value of the named property, or {@code false}
 */
boolean getBoolean(@Nonnull String name);
Program: 8766
Project: 8766
Buggy source:
/** 
 * Returns the name value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = builder.getProperty(name); if (property != null && property.getType() == Type.STRING) { return property.getValue(Type.STRING); } else { return null; } </pre>
 * @param name property name
 * @return string value of the named property, or {@code null}
 */
@CheckForNull String getString(String name);

Fixed version (ground truth):
/** 
 * Returns the name value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = builder.getProperty(name);}if (property != null && property.getType() == Type.STRING)  return property.getValue(Type.STRING); } else { return null; } } </pre>
 * @param name property name
 * @return string value of the named property, or {@code null}
 */
@CheckForNull String getString(String name);
Program: 8767
Project: 8767
Buggy source:
/** 
 * Returns the name value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = state.getProperty(name); if (property != null && property.getType() == Type.NAME) { return property.getValue(Type.NAME); } else { return null; } </pre>
 * @param name property name
 * @return name value of the named property, or {@code null}
 */
@CheckForNull String getName(@Nonnull String name);

Fixed version (ground truth):
/** 
 * Returns the name value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = state.getProperty(name);}if (property != null && property.getType() == Type.NAME)  return property.getValue(Type.NAME); } else { return null; } } </pre>
 * @param name property name
 * @return name value of the named property, or {@code null}
 */
@CheckForNull String getName(@Nonnull String name);
Program: 8768
Project: 8768
Buggy source:
/** 
 * Returns the string value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = state.getProperty(name); if (property != null && property.getType() == Type.STRING) { return property.getValue(Type.STRING); } else { return null; } </pre>
 * @param name property name
 * @return string value of the named property, or {@code null}
 */
@CheckForNull String getString(String name);

Fixed version (ground truth):
/** 
 * Returns the string value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = state.getProperty(name);}if (property != null && property.getType() == Type.STRING)  return property.getValue(Type.STRING); } else { return null; } } </pre>
 * @param name property name
 * @return string value of the named property, or {@code null}
 */
@CheckForNull String getString(String name);
Program: 8769
Project: 8769
Buggy source:
/** 
 * Returns the name values of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = state.getProperty(name); if (property != null && property.getType() == Type.NAMES) { return property.getValue(Type.NAMES); } else { return Collections.emptyList(); } </pre>
 * @param name property name
 * @return name values of the named property, or an empty collection
 */
@Nonnull Iterable<String> getNames(@Nonnull String name);

Fixed version (ground truth):
/** 
 * Returns the name values of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = state.getProperty(name);}if (property != null && property.getType() == Type.NAMES)  return property.getValue(Type.NAMES); } else { return Collections.emptyList(); } } </pre>
 * @param name property name
 * @return name values of the named property, or an empty collection
 */
@Nonnull Iterable<String> getNames(@Nonnull String name);
Program: 8770
Project: 8770
Buggy source:
/** 
 * Returns the string values of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = state.getProperty(name); if (property != null && property.getType() == Type.STRINGS) { return property.getValue(Type.STRINGS); } else { return Collections.emptyList(); } </pre>
 * @param name property name
 * @return string values of the named property, or an empty collection
 */
@Nonnull Iterable<String> getStrings(@Nonnull String name);

Fixed version (ground truth):
/** 
 * Returns the string values of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = state.getProperty(name);}if (property != null && property.getType() == Type.STRINGS)  return property.getValue(Type.STRINGS); } else { return Collections.emptyList(); } } </pre>
 * @param name property name
 * @return string values of the named property, or an empty collection
 */
@Nonnull Iterable<String> getStrings(@Nonnull String name);
Program: 8771
Project: 8771
Buggy source:
/** 
 * Returns the long value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = state.getProperty(name); if (property != null && property.getType() == Type.LONG) { return property.getValue(Type.LONG); } else { return 0; } </pre>
 * @param name property name
 * @return long value of the named property, or zero
 */
long getLong(String name);

Fixed version (ground truth):
/** 
 * Returns the long value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = state.getProperty(name);}if (property != null && property.getType() == Type.LONG)  return property.getValue(Type.LONG); } else { return 0; } } </pre>
 * @param name property name
 * @return long value of the named property, or zero
 */
long getLong(String name);
Program: 8772
Project: 8772
Buggy source:
/** 
 * Returns the boolean value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre> PropertyState property = state.getProperty(name); return property != null && property.getType() == Type.BOOLEAN && property.getValue(Type.BOOLEAN); </pre>
 * @param name property name
 * @return boolean value of the named property, or {@code false}
 */
boolean getBoolean(@Nonnull String name);

Fixed version (ground truth):
/** 
 * Returns the boolean value of the named property. The implementation is equivalent to the following code, but may be optimized. <pre>  {@code PropertyState property = state.getProperty(name); return property != null && property.getType() == Type.BOOLEAN && property.getValue(Type.BOOLEAN);}</pre>
 * @param name property name
 * @return boolean value of the named property, or {@code false}
 */
boolean getBoolean(@Nonnull String name);
Program: 8773
Project: 8773
Buggy source:
/** 
 * Store the given id mapping for later lookup using  {@code }{@link #get(String)}</code>.
 * @param oldUUID old node id
 * @param newUUID new node id
 */
public void put(String oldUUID,String newUUID){
  uuidMap.put(oldUUID,newUUID);
}

Fixed version (ground truth):
/** 
 * Store the given id mapping for later lookup using  {@link #get(String)}.
 * @param oldUUID old node id
 * @param newUUID new node id
 */
public void put(String oldUUID,String newUUID){
  uuidMap.put(oldUUID,newUUID);
}
Program: 8774
Project: 8774
Buggy source:
/** 
 * Store the given reference property for later retrieval using  {@code }{@link #getProcessedReferences()}</code>.
 * @param refProp reference property
 */
public void processedReference(Object refProp){
  references.add(refProp);
}

Fixed version (ground truth):
/** 
 * Store the given reference property for later retrieval using  {@link #getProcessedReferences()}.
 * @param refProp reference property
 */
public void processedReference(Object refProp){
  references.add(refProp);
}
Program: 8776
Project: 8776
Buggy source:
public static CompiledPermissions getInstance(){
  return INSTANCE;
}

Fixed version (ground truth):
static CompiledPermissions getInstance(){
  return INSTANCE;
}
Program: 8777
Project: 8777
Buggy source:
public boolean isReadableTree(@Nonnull Tree tree,boolean exactMatch){
  String targetPath=tree.getPath();
  for (  String path : readPaths) {
    if (targetPath.equals(path)) {
      return true;
    }
  }
  if (!exactMatch) {
    for (    String path : altReadPaths) {
      if (targetPath.startsWith(path)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isReadableTree(@Nonnull Tree tree,boolean exactMatch){
  String targetPath=tree.getPath();
  for (  String path : readPaths) {
    if (targetPath.equals(path)) {
      return true;
    }
  }
  if (!exactMatch) {
    for (    String path : altReadPaths) {
      if (targetPath.startsWith(path)) {
        return true;
      }
    }
  }
  return false;
}
Program: 8778
Project: 8778
Buggy source:
@Override public boolean canRead(@Nonnull PropertyState property){
  boolean isAcTree=isAcTree();
  if (!isAcTree && readableTree) {
    return true;
  }
  if (readStatus != null && readStatus.allowsProperties()) {
    return true;
  }
  long permission=(isAcTree) ? Permissions.READ_ACCESS_CONTROL : Permissions.READ_PROPERTY;
  Iterator<PermissionEntry> it=getIterator(property,permission);
  while (it.hasNext()) {
    PermissionEntry entry=it.next();
    if (entry.privilegeBits.includes(READ_BITS.get(permission))) {
      return (entry.isAllow);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canRead(@Nonnull PropertyState property){
  boolean isAcTree=isAcTree();
  if (!isAcTree && isReadableTree) {
    return true;
  }
  if (readStatus != null && readStatus.allowsProperties()) {
    return true;
  }
  long permission=(isAcTree) ? Permissions.READ_ACCESS_CONTROL : Permissions.READ_PROPERTY;
  Iterator<PermissionEntry> it=getIterator(property,permission);
  while (it.hasNext()) {
    PermissionEntry entry=it.next();
    if (entry.privilegeBits.includes(READ_BITS.get(permission))) {
      return (entry.isAllow);
    }
  }
  return false;
}
Program: 8779
Project: 8779
Buggy source:
public boolean isReadablePath(@Nullable String treePath,boolean exactMatch){
  if (treePath != null) {
    for (    String path : readPaths) {
      if (treePath.equals(path)) {
        return true;
      }
    }
    if (!exactMatch) {
      for (      String path : altReadPaths) {
        if (treePath.startsWith(path)) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isReadablePath(@Nullable String treePath,boolean exactMatch){
  if (treePath != null) {
    for (    String path : readPaths) {
      if (treePath.equals(path)) {
        return true;
      }
    }
    if (!exactMatch) {
      for (      String path : altReadPaths) {
        if (treePath.startsWith(path)) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 8780
Project: 8780
Buggy source:
private TreePermissionImpl(Tree tree,TreeType type,TreePermission parentPermission){
  this.tree=tree;
  this.type=type;
  if (parentPermission instanceof TreePermissionImpl) {
    parent=(TreePermissionImpl)parentPermission;
  }
 else {
    parent=null;
  }
  readableTree=readPolicy.isReadableTree(tree,parent);
}

Fixed version (ground truth):
private TreePermissionImpl(Tree tree,TreeType type,TreePermission parentPermission){
  this.tree=tree;
  this.type=type;
  if (parentPermission instanceof TreePermissionImpl) {
    parent=(TreePermissionImpl)parentPermission;
  }
 else {
    parent=null;
  }
  isReadableTree=readPolicy.isReadableTree(tree,parent);
}
Program: 8781
Project: 8781
Buggy source:
/** 
 * Retruns true if all privileges identified by the given   {@code privilegeNames}are granted at the given   {@code tree}.
 * @param tree The target tree.
 * @param privilegeNames The privilege names to be tested.
 * @return {@code true} if the tree has privileges
 */
boolean hasPrivileges(@Nullable Tree tree,@Nonnull String... privilegeNames);

Fixed version (ground truth):
/** 
 * Returns   {@code true} if all privileges identified by the given {@code privilegeNames}are granted at the given   {@code tree}.
 * @param tree The target tree.
 * @param privilegeNames The privilege names to be tested.
 * @return {@code true} if the tree has privileges
 */
boolean hasPrivileges(@Nullable Tree tree,@Nonnull String... privilegeNames);
Program: 8782
Project: 8782
Buggy source:
@CheckForNull public String getPath(){
  return path;
}

Fixed version (ground truth):
@CheckForNull String getPath(){
  return path;
}
Program: 8783
Project: 8783
Buggy source:
@Override public Validator childNodeDeleted(String name,NodeState before) throws CommitFailedException {
  if (moveCtx.processDelete((ImmutableTree)getParentBefore().getChild(name),this)) {
    return null;
  }
 else {
    return super.childNodeDeleted(name,before);
  }
}

Fixed version (ground truth):
@Override public Validator childNodeDeleted(String name,NodeState before) throws CommitFailedException {
  if (moveCtx.processDelete(getParentBefore(),name,this)) {
    return null;
  }
 else {
    return super.childNodeDeleted(name,before);
  }
}
Program: 8784
Project: 8784
Buggy source:
private boolean processDelete(ImmutableTree child,MoveAwarePermissionValidator validator) throws CommitFailedException {
  String destPath=moveTracker.getDestPath(child.getPath());
  if (destPath != null) {
    ImmutableTree dest=(ImmutableTree)rootAfter.getTree(destPath);
    if (dest.exists()) {
      validator.checkPermissions(child,true,Permissions.REMOVE_NODE);
      checkPermissions(dest,Permissions.ADD_NODE | Permissions.NODE_TYPE_MANAGEMENT);
      return diff(child,dest,validator);
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean processDelete(@CheckForNull Tree parent,@Nonnull String name,@Nonnull MoveAwarePermissionValidator validator) throws CommitFailedException {
  if (parent == null) {
    return false;
  }
  ImmutableTree child=(ImmutableTree)parent.getChild(name);
  String destPath=moveTracker.getDestPath(child.getPath());
  if (destPath != null) {
    ImmutableTree dest=(ImmutableTree)rootAfter.getTree(destPath);
    if (dest.exists()) {
      validator.checkPermissions(child,true,Permissions.REMOVE_NODE);
      checkPermissions(dest,Permissions.ADD_NODE | Permissions.NODE_TYPE_MANAGEMENT);
      return diff(child,dest,validator);
    }
  }
  return false;
}
Program: 8785
Project: 8785
Buggy source:
private boolean diff(ImmutableTree source,ImmutableTree dest,MoveAwarePermissionValidator validator) throws CommitFailedException {
  Validator nextValidator=validator.visibleValidator(source,dest);
  CommitFailedException e=EditorDiff.process(nextValidator,source.getNodeState(),dest.getNodeState());
  if (e != null) {
    throw e;
  }
  return true;
}

Fixed version (ground truth):
private boolean diff(@Nonnull ImmutableTree source,@Nonnull ImmutableTree dest,@Nonnull MoveAwarePermissionValidator validator) throws CommitFailedException {
  Validator nextValidator=validator.visibleValidator(source,dest);
  CommitFailedException e=EditorDiff.process(nextValidator,source.getNodeState(),dest.getNodeState());
  if (e != null) {
    throw e;
  }
  return true;
}
Program: 8786
Project: 8786
Buggy source:
private boolean containsMove(Tree parentBefore,Tree parentAfter){
  return moveTracker.containsMove(PermissionUtil.getPath(parentBefore,parentAfter));
}

Fixed version (ground truth):
private boolean containsMove(@Nullable Tree parentBefore,@Nullable Tree parentAfter){
  return moveTracker.containsMove(PermissionUtil.getPath(parentBefore,parentAfter));
}
Program: 8787
Project: 8787
Buggy source:
private boolean processAdd(ImmutableTree child,MoveAwarePermissionValidator validator) throws CommitFailedException {
  String sourcePath=moveTracker.getSourcePath(child.getPath());
  if (sourcePath != null) {
    ImmutableTree source=(ImmutableTree)rootBefore.getTree(sourcePath);
    if (source.exists()) {
      validator.checkPermissions(child,false,Permissions.ADD_NODE | Permissions.NODE_TYPE_MANAGEMENT);
      checkPermissions(source,Permissions.REMOVE_NODE);
      return diff(source,child,validator);
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean processAdd(@CheckForNull Tree parent,@Nonnull String name,@Nonnull MoveAwarePermissionValidator validator) throws CommitFailedException {
  if (parent == null) {
    return false;
  }
  ImmutableTree child=(ImmutableTree)parent.getChild(name);
  String sourcePath=moveTracker.getSourcePath(child.getPath());
  if (sourcePath != null) {
    ImmutableTree source=(ImmutableTree)rootBefore.getTree(sourcePath);
    if (source.exists()) {
      validator.checkPermissions(child,false,Permissions.ADD_NODE | Permissions.NODE_TYPE_MANAGEMENT);
      checkPermissions(source,Permissions.REMOVE_NODE);
      return diff(source,child,validator);
    }
  }
  return false;
}
Program: 8788
Project: 8788
Buggy source:
@Override public Validator childNodeAdded(String name,NodeState after) throws CommitFailedException {
  if (moveCtx.processAdd((ImmutableTree)getParentAfter().getChild(name),this)) {
    return null;
  }
 else {
    return super.childNodeAdded(name,after);
  }
}

Fixed version (ground truth):
@Override public Validator childNodeAdded(String name,NodeState after) throws CommitFailedException {
  if (moveCtx.processAdd(getParentAfter(),name,this)) {
    return null;
  }
 else {
    return super.childNodeAdded(name,after);
  }
}
Program: 8789
Project: 8789
Buggy source:
public static CompiledPermissions getInstance(){
  return INSTANCE;
}

Fixed version (ground truth):
static CompiledPermissions getInstance(){
  return INSTANCE;
}
Program: 8790
Project: 8790
Buggy source:
public boolean matchesParent(@Nonnull String parentPath){
  return Text.isDescendantOrEqual(path,parentPath) && (restriction == RestrictionPattern.EMPTY || restriction.matches(parentPath));
}

Fixed version (ground truth):
boolean matchesParent(@Nonnull String parentPath){
  return Text.isDescendantOrEqual(path,parentPath) && (restriction == RestrictionPattern.EMPTY || restriction.matches(parentPath));
}
Program: 8791
Project: 8791
Buggy source:
public boolean matches(){
  return restriction == RestrictionPattern.EMPTY || restriction.matches();
}

Fixed version (ground truth):
boolean matches(){
  return restriction == RestrictionPattern.EMPTY || restriction.matches();
}
Program: 8792
Project: 8792
Buggy source:
@Nonnull Collection<PermissionEntry> getEntries(@Nonnull String accessControlledPath);

Fixed version (ground truth):
@Nonnull Collection<PermissionEntry> getEntries(@Nonnull Tree accessControlledTree);
Program: 8793
Project: 8793
Buggy source:
@Nonnull public Iterator<PermissionEntry> getEntryIterator(@Nonnull EntryPredicate predicate){
  if (existingNames.isEmpty()) {
    return Iterators.emptyIterator();
  }
 else {
    return new EntryIterator(predicate);
  }
}

Fixed version (ground truth):
@Override @Nonnull public Iterator<PermissionEntry> getEntryIterator(@Nonnull EntryPredicate predicate){
  if (existingNames.isEmpty()) {
    return Iterators.emptyIterator();
  }
 else {
    return new EntryIterator(predicate);
  }
}
Program: 8794
Project: 8794
Buggy source:
public void flush(){
  cache.flush(principalNames);
  init();
}

Fixed version (ground truth):
@Override public void flush(){
  cache.flush(principalNames);
  init();
}
Program: 8795
Project: 8795
Buggy source:
@Nonnull public Collection<PermissionEntry> getEntries(@Nonnull String path){
  if (existingNames.isEmpty()) {
    return Collections.emptyList();
  }
 else   if (pathEntryMap != null) {
    Collection<PermissionEntry> entries=pathEntryMap.get(path);
    return (entries != null) ? entries : Collections.<PermissionEntry>emptyList();
  }
 else {
    return loadEntries(path);
  }
}

Fixed version (ground truth):
@Nonnull private Collection<PermissionEntry> getEntries(@Nonnull String path){
  if (existingNames.isEmpty()) {
    return Collections.emptyList();
  }
 else   if (pathEntryMap != null) {
    Collection<PermissionEntry> entries=pathEntryMap.get(path);
    return (entries != null) ? entries : Collections.<PermissionEntry>emptyList();
  }
 else {
    return loadEntries(path);
  }
}
Program: 8798
Project: 8798
Buggy source:
@Override public boolean matches(TokenCredentials tokenCredentials){
  String tk=tokenCredentials.getToken();
  int pos=tk.lastIndexOf(DELIM);
  if (pos > -1) {
    tk=tk.substring(pos + 1);
  }
  if (key == null || !PasswordUtil.isSame(key,getKeyValue(tk,userId))) {
    return false;
  }
  for (  String name : mandatoryAttributes.keySet()) {
    String expectedValue=mandatoryAttributes.get(name);
    if (!expectedValue.equals(tokenCredentials.getAttribute(name))) {
      return false;
    }
  }
  Collection<String> attrNames=Arrays.asList(tokenCredentials.getAttributeNames());
  for (  String name : publicAttributes.keySet()) {
    if (!attrNames.contains(name)) {
      tokenCredentials.setAttribute(name,publicAttributes.get(name).toString());
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean matches(TokenCredentials tokenCredentials){
  String tk=tokenCredentials.getToken();
  int pos=tk.lastIndexOf(DELIM);
  if (pos > -1) {
    tk=tk.substring(pos + 1);
  }
  if (key == null || !PasswordUtil.isSame(key,getKeyValue(tk,userId))) {
    return false;
  }
  for (  Map.Entry<String,String> mandatory : mandatoryAttributes.entrySet()) {
    String name=mandatory.getKey();
    String expectedValue=mandatory.getValue();
    if (!expectedValue.equals(tokenCredentials.getAttribute(name))) {
      return false;
    }
  }
  Collection<String> attrNames=Arrays.asList(tokenCredentials.getAttributeNames());
  for (  Map.Entry<String,String> attr : publicAttributes.entrySet()) {
    String name=attr.getKey();
    if (!attrNames.contains(name)) {
      tokenCredentials.setAttribute(name,attr.getValue());
    }
  }
  return true;
}