nus-yam/ex-repair huggingface dataset:
Program: 113256
Project: 113256
Buggy source:
/** 
 * @param resolved an {@link Optional} with an ObjectId to resolve
 * @return an {@link Optional} of the {@link ObjectId} that was resolved, or{@link Optional#absent()} if it did not resolve.
 */
private Optional<ObjectId> call(Optional<ObjectId> resolved){
  if (!resolved.isPresent()) {
    return Optional.absent();
  }
  ObjectId objectId=resolved.get();
  if (objectId.isNull()) {
    return Optional.of(RevTree.EMPTY_TREE_ID);
  }
  final TYPE objectType=command(ResolveObjectType.class).setObjectId(objectId).call();
switch (objectType) {
case TREE:
    break;
case COMMIT:
{
    Optional<RevCommit> commit=command(RevObjectParse.class).setObjectId(objectId).call(RevCommit.class);
    if (commit.isPresent()) {
      objectId=commit.get().getTreeId();
    }
 else {
      objectId=null;
    }
    break;
  }
case TAG:
{
  Optional<RevTag> tag=command(RevObjectParse.class).setObjectId(objectId).call(RevTag.class);
  if (tag.isPresent()) {
    ObjectId commitId=tag.get().getCommitId();
    return call(Optional.of(commitId));
  }
}
default :
throw new IllegalArgumentException(String.format("String_Node_Str",treeishRefSpec,String.valueOf(objectType)));
}
return Optional.fromNullable(objectId);
}

Fixed version (ground truth):
/** 
 * @param resolved an {@link Optional} with an ObjectId to resolve
 * @return an {@link Optional} of the {@link ObjectId} that was resolved, or{@link Optional#absent()} if it did not resolve.
 */
private Optional<ObjectId> call(Optional<ObjectId> resolved){
  if (!resolved.isPresent()) {
    return Optional.absent();
  }
  ObjectId objectId=resolved.get();
  if (objectId.isNull()) {
    return Optional.of(RevTree.EMPTY_TREE_ID);
  }
  ObjectStore source=this.source == null ? objectDatabase() : this.source;
  final TYPE objectType=command(ResolveObjectType.class).setSource(source).setObjectId(objectId).call();
switch (objectType) {
case TREE:
    break;
case COMMIT:
{
    Optional<RevCommit> commit=command(RevObjectParse.class).setSource(source).setObjectId(objectId).call(RevCommit.class);
    if (commit.isPresent()) {
      objectId=commit.get().getTreeId();
    }
 else {
      objectId=null;
    }
    break;
  }
case TAG:
{
  Optional<RevTag> tag=command(RevObjectParse.class).setSource(source).setObjectId(objectId).call(RevTag.class);
  if (tag.isPresent()) {
    ObjectId commitId=tag.get().getCommitId();
    return call(Optional.of(commitId));
  }
}
default :
throw new IllegalArgumentException(String.format("String_Node_Str",treeishRefSpec,String.valueOf(objectType)));
}
return Optional.fromNullable(objectId);
}
Program: 113257
Project: 113257
Buggy source:
/** 
 * Executes the command.
 * @return an {@link Optional} of the {@link ObjectId} that was resolved, or{@link Optional#absent()} if it did not resolve.
 */
@Override protected Optional<ObjectId> _call(){
  checkState(treeishRefSpec != null || treeish != null,"String_Node_Str");
  Optional<ObjectId> resolved;
  if (treeishRefSpec != null) {
    resolved=command(RevParse.class).setRefSpec(treeishRefSpec).call();
  }
 else {
    resolved=Optional.of(treeish);
  }
  return call(resolved);
}

Fixed version (ground truth):
/** 
 * Executes the command.
 * @return an {@link Optional} of the {@link ObjectId} that was resolved, or{@link Optional#absent()} if it did not resolve.
 */
@Override protected Optional<ObjectId> _call(){
  checkState(treeishRefSpec != null || treeish != null,"String_Node_Str");
  ObjectStore source=this.source == null ? objectDatabase() : this.source;
  Optional<ObjectId> resolved;
  if (treeishRefSpec != null) {
    resolved=command(RevParse.class).setSource(source).setRefSpec(treeishRefSpec).call();
  }
 else {
    resolved=Optional.of(treeish);
  }
  return call(resolved);
}
Program: 113258
Project: 113258
Buggy source:
/** 
 * @param clazz the base type of the parsed objects
 * @return the resolved object id
 * @see RevObject
 */
public <T extends RevObject>Optional<T> call(Class<T> clazz){
  final ObjectId resolvedObjectId;
  if (objectId == null) {
    Optional<ObjectId> parsed=command(RevParse.class).setRefSpec(refSpec).call();
    if (parsed.isPresent()) {
      resolvedObjectId=parsed.get();
    }
 else {
      resolvedObjectId=ObjectId.NULL;
    }
  }
 else {
    resolvedObjectId=objectId;
  }
  if (resolvedObjectId.isNull()) {
    return Optional.absent();
  }
  RevObject revObject;
  if (RevTree.EMPTY_TREE_ID.equals(resolvedObjectId)) {
    revObject=RevTree.EMPTY;
  }
 else {
    revObject=objectDatabase().get(resolvedObjectId,clazz);
  }
  Preconditions.checkArgument(clazz.isAssignableFrom(revObject.getClass()),"String_Node_Str",clazz.getName(),revObject.getClass().getName());
  return Optional.of(clazz.cast(revObject));
}

Fixed version (ground truth):
/** 
 * @param clazz the base type of the parsed objects
 * @return the resolved object id
 * @see RevObject
 */
public <T extends RevObject>Optional<T> call(Class<T> clazz){
  this.source=this.source == null ? objectDatabase() : this.source;
  final ObjectId resolvedObjectId;
  if (objectId == null) {
    Optional<ObjectId> parsed=command(RevParse.class).setSource(source).setRefSpec(refSpec).call();
    if (parsed.isPresent()) {
      resolvedObjectId=parsed.get();
    }
 else {
      resolvedObjectId=ObjectId.NULL;
    }
  }
 else {
    resolvedObjectId=objectId;
  }
  if (resolvedObjectId.isNull()) {
    return Optional.absent();
  }
  RevObject revObject;
  if (RevTree.EMPTY_TREE_ID.equals(resolvedObjectId)) {
    revObject=RevTree.EMPTY;
  }
 else {
    revObject=source.get(resolvedObjectId,clazz);
  }
  Preconditions.checkArgument(clazz.isAssignableFrom(revObject.getClass()),"String_Node_Str",clazz.getName(),revObject.getClass().getName());
  return Optional.of(clazz.cast(revObject));
}
Program: 113259
Project: 113259
Buggy source:
private Optional<ObjectId> resolveParent(final ObjectId objectId,final int parentN){
  checkNotNull(objectId);
  checkArgument(parentN > -1);
  if (objectId.isNull()) {
    return Optional.absent();
  }
  if (parentN == 0) {
    Optional<RevObject> object=command(RevObjectParse.class).setObjectId(objectId).call();
    checkArgument(object.isPresent() && object.get() instanceof RevCommit,"String_Node_Str",objectId,(object.isPresent() ? object.get().getType() : "String_Node_Str"));
    return Optional.of(objectId);
  }
  RevCommit commit=resolveCommit(objectId);
  if (parentN > commit.getParentIds().size()) {
    return Optional.absent();
  }
  return commit.parentN(parentN - 1);
}

Fixed version (ground truth):
private Optional<ObjectId> resolveParent(final ObjectId objectId,final int parentN){
  checkNotNull(objectId);
  checkArgument(parentN > -1);
  if (objectId.isNull()) {
    return Optional.absent();
  }
  if (parentN == 0) {
    Optional<RevObject> object=command(RevObjectParse.class).setSource(source).setObjectId(objectId).call();
    checkArgument(object.isPresent() && object.get() instanceof RevCommit,"String_Node_Str",objectId,(object.isPresent() ? object.get().getType() : "String_Node_Str"));
    return Optional.of(objectId);
  }
  RevCommit commit=resolveCommit(objectId);
  if (parentN > commit.getParentIds().size()) {
    return Optional.absent();
  }
  return commit.parentN(parentN - 1);
}
Program: 113260
Project: 113260
Buggy source:
private Optional<ObjectId> verifyId(ObjectId objectId,RevObject.TYPE type){
  final Optional<RevObject> object=command(RevObjectParse.class).setObjectId(objectId).call();
  checkArgument(object.isPresent(),"String_Node_Str",objectId);
  final RevObject revObject=object.get();
  if (type.equals(revObject.getType())) {
    return Optional.of(revObject.getId());
  }
 else {
    throw new IllegalArgumentException(String.format("String_Node_Str",objectId,type,revObject.getType()));
  }
}

Fixed version (ground truth):
private Optional<ObjectId> verifyId(ObjectId objectId,RevObject.TYPE type){
  final Optional<RevObject> object=command(RevObjectParse.class).setSource(source).setObjectId(objectId).call();
  checkArgument(object.isPresent(),"String_Node_Str",objectId);
  final RevObject revObject=object.get();
  if (type.equals(revObject.getType())) {
    return Optional.of(revObject.getId());
  }
 else {
    throw new IllegalArgumentException(String.format("String_Node_Str",objectId,type,revObject.getType()));
  }
}
Program: 113261
Project: 113261
Buggy source:
/** 
 * @param objectId
 * @return
 */
private RevCommit resolveCommit(ObjectId objectId){
  final Optional<RevObject> object=command(RevObjectParse.class).setObjectId(objectId).call();
  checkArgument(object.isPresent(),"String_Node_Str",objectId);
  final RevObject revObject=object.get();
  RevCommit commit;
switch (revObject.getType()) {
case COMMIT:
    commit=(RevCommit)revObject;
  break;
case TAG:
ObjectId commitId=((RevTag)revObject).getCommitId();
commit=command(RevObjectParse.class).setObjectId(commitId).call(RevCommit.class).get();
break;
default :
throw new IllegalArgumentException(String.format("String_Node_Str",objectId,revObject.getType()));
}
return commit;
}

Fixed version (ground truth):
/** 
 * @param objectId
 * @return
 */
private RevCommit resolveCommit(ObjectId objectId){
  final Optional<RevObject> object=command(RevObjectParse.class).setSource(source).setObjectId(objectId).call();
  checkArgument(object.isPresent(),"String_Node_Str",objectId);
  final RevObject revObject=object.get();
  RevCommit commit;
switch (revObject.getType()) {
case COMMIT:
    commit=(RevCommit)revObject;
  break;
case TAG:
ObjectId commitId=((RevTag)revObject).getCommitId();
commit=command(RevObjectParse.class).setSource(source).setObjectId(commitId).call(RevCommit.class).get();
break;
default :
throw new IllegalArgumentException(String.format("String_Node_Str",objectId,revObject.getType()));
}
return commit;
}
Program: 113263
Project: 113263
Buggy source:
/** 
 * @param objectName a ref name or object id
 */
private Optional<ObjectId> resolveObject(final String refSpec){
  ObjectId resolvedTo=null;
  Optional<Ref> ref=command(RefParse.class).setName(refSpec).call();
  if (ref.isPresent()) {
    resolvedTo=ref.get().getObjectId();
  }
 else {
    boolean hexPatternMatches=HEX_PATTERN.matcher(refSpec).matches();
    if (hexPatternMatches) {
      try {
        ObjectId parsed=ObjectId.valueOf(refSpec);
        if (parsed.isNull()) {
          return Optional.of(ObjectId.NULL);
        }
        if (parsed.equals(RevTree.EMPTY_TREE_ID)) {
          return Optional.of(RevTree.EMPTY_TREE_ID);
        }
        if (objectDatabase().exists(parsed)) {
          return Optional.of(parsed);
        }
      }
 catch (      IllegalArgumentException ignore) {
      }
      List<ObjectId> hashMatches=objectDatabase().lookUp(refSpec);
      if (hashMatches.size() > 1) {
        throw new IllegalArgumentException(String.format("String_Node_Str",refSpec,hashMatches.toString()));
      }
      if (hashMatches.size() == 1) {
        resolvedTo=hashMatches.get(0);
      }
 else       if (ObjectId.NULL.toString().startsWith(refSpec)) {
        resolvedTo=ObjectId.NULL;
      }
 else       if (RevTree.EMPTY_TREE_ID.toString().startsWith(refSpec)) {
        resolvedTo=RevTree.EMPTY.getId();
      }
    }
  }
  return Optional.fromNullable(resolvedTo);
}

Fixed version (ground truth):
/** 
 * @param objectName a ref name or object id
 */
private Optional<ObjectId> resolveObject(final String refSpec){
  ObjectId resolvedTo=null;
  Optional<Ref> ref=command(RefParse.class).setName(refSpec).call();
  if (ref.isPresent()) {
    resolvedTo=ref.get().getObjectId();
  }
 else {
    boolean hexPatternMatches=HEX_PATTERN.matcher(refSpec).matches();
    if (hexPatternMatches) {
      try {
        ObjectId parsed=ObjectId.valueOf(refSpec);
        if (parsed.isNull()) {
          return Optional.of(ObjectId.NULL);
        }
        if (parsed.equals(RevTree.EMPTY_TREE_ID)) {
          return Optional.of(RevTree.EMPTY_TREE_ID);
        }
        if (source.exists(parsed)) {
          return Optional.of(parsed);
        }
      }
 catch (      IllegalArgumentException ignore) {
      }
      List<ObjectId> hashMatches=source.lookUp(refSpec);
      if (hashMatches.size() > 1) {
        throw new IllegalArgumentException(String.format("String_Node_Str",refSpec,hashMatches.toString()));
      }
      if (hashMatches.size() == 1) {
        resolvedTo=hashMatches.get(0);
      }
 else       if (ObjectId.NULL.toString().startsWith(refSpec)) {
        resolvedTo=ObjectId.NULL;
      }
 else       if (RevTree.EMPTY_TREE_ID.toString().startsWith(refSpec)) {
        resolvedTo=RevTree.EMPTY.getId();
      }
    }
  }
  return Optional.fromNullable(resolvedTo);
}
Program: 113264
Project: 113264
Buggy source:
@SuppressWarnings("String_Node_Str") public static Index deserialize(DataInput in) throws IOException {
  String treeName=(String)DataStreamValueSerializerV2.read(FieldType.STRING,in);
  String attributeName=(String)DataStreamValueSerializerV2.read(FieldType.STRING,in);
  IndexType indexType=IndexType.valueOf((String)DataStreamValueSerializerV2.read(FieldType.STRING,in));
  Map<String,Object> metadata=(Map<String,Object>)DataStreamValueSerializerV2.read(FieldType.MAP,in);
  return new Index(treeName,attributeName,indexType,metadata);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static Index deserialize(DataInput in) throws IOException {
  String treeName=(String)DataStreamValueSerializerV2.read(FieldType.STRING,in);
  String attributeName=(String)DataStreamValueSerializerV2.read(FieldType.STRING,in);
  IndexType indexType=IndexType.valueOf((String)DataStreamValueSerializerV2.read(FieldType.STRING,in));
  Map<String,Object> metadata;
  try {
    metadata=(Map<String,Object>)DataStreamValueSerializerV2.read(FieldType.MAP,in);
  }
 catch (  EOFException e) {
    metadata=null;
  }
  return new Index(treeName,attributeName,indexType,metadata);
}
Program: 113265
Project: 113265
Buggy source:
@Override public int compare(Quadrant[] left,Quadrant[] right){
  final int minDepth=Math.min(left.length,right.length);
  int c;
  for (int d=0; d > minDepth; d++) {
    c=left[d].compareTo(right[d]);
    if (c != 0) {
      return c;
    }
  }
  c=left.length - right.length;
  return c;
}

Fixed version (ground truth):
@Override public int compare(Quadrant[] left,Quadrant[] right){
  final int minDepth=Math.min(left.length,right.length);
  int c;
  for (int d=0; d < minDepth; d++) {
    c=left[d].compareTo(right[d]);
    if (c != 0) {
      return c;
    }
  }
  c=left.length - right.length;
  return c;
}
Program: 113266
Project: 113266
Buggy source:
/** 
 * Constructs a new   {@code RevFeatureType} from the given {@link ObjectId} and{@link FeatureType}.
 * @param id the object id to use for this feature type
 * @param featureType the feature type to use
 */
public RevFeatureTypeImpl(ObjectId id,FeatureType featureType){
  super(id);
  checkNotNull(featureType);
  CoordinateReferenceSystem defaultCrs=featureType.getCoordinateReferenceSystem();
  if (WGS84.equals(defaultCrs)) {
    checkArgument(featureType instanceof SimpleFeatureType);
    try {
      final boolean longitudeFirst=true;
      CoordinateReferenceSystem epsg4326=CRS.decode("String_Node_Str",longitudeFirst);
      String[] includeAllAttributes=null;
      featureType=DataUtilities.createSubType((SimpleFeatureType)featureType,includeAllAttributes,epsg4326);
    }
 catch (    Exception e) {
      throw Throwables.propagate(e);
    }
  }
  this.featureType=featureType;
  sortedDescriptors=ImmutableList.copyOf(featureType.getDescriptors());
}

Fixed version (ground truth):
/** 
 * Constructs a new   {@code RevFeatureType} from the given {@link ObjectId} and{@link FeatureType}.
 * @param id the object id to use for this feature type
 * @param featureType the feature type to use
 */
public RevFeatureTypeImpl(ObjectId id,FeatureType featureType){
  super(id);
  checkNotNull(featureType);
  CoordinateReferenceSystem defaultCrs=featureType.getCoordinateReferenceSystem();
  if (WGS84.equals((org.geotools.referencing.AbstractIdentifiedObject)defaultCrs,false)) {
    checkArgument(featureType instanceof SimpleFeatureType);
    try {
      final boolean longitudeFirst=true;
      CoordinateReferenceSystem epsg4326=CRS.decode("String_Node_Str",longitudeFirst);
      String[] includeAllAttributes=null;
      featureType=DataUtilities.createSubType((SimpleFeatureType)featureType,includeAllAttributes,epsg4326);
    }
 catch (    Exception e) {
      throw Throwables.propagate(e);
    }
  }
  this.featureType=featureType;
  sortedDescriptors=ImmutableList.copyOf(featureType.getDescriptors());
}
Program: 113267
Project: 113267
Buggy source:
@Override public FeatureIterator<F> features(){
  if (delegate.getSchema().getDescriptors().size() != featureType.getDescriptors().size()) {
    throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
  }
  GeometryDescriptor geomDescriptorOrg=delegate.getSchema().getGeometryDescriptor();
  GeometryDescriptor geomDescriptorDest=featureType.getGeometryDescriptor();
  if (!geomDescriptorOrg.getType().getBinding().equals(geomDescriptorDest.getType().getBinding()) || !geomDescriptorOrg.getType().getCoordinateReferenceSystem().equals(geomDescriptorDest.getType().getCoordinateReferenceSystem())) {
    throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
  }
  FeatureIterator<F> iterator=delegate.features();
  SimpleFeatureBuilder builder=new SimpleFeatureBuilder((SimpleFeatureType)featureType);
  return new FeatureTypeConverterIterator<F>(iterator,(SimpleFeatureBuilder)builder);
}

Fixed version (ground truth):
@Override public FeatureIterator<F> features(){
  if (delegate.getSchema().getDescriptors().size() != featureType.getDescriptors().size()) {
    throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
  }
  GeometryDescriptor geomDescriptorOrg=delegate.getSchema().getGeometryDescriptor();
  GeometryDescriptor geomDescriptorDest=featureType.getGeometryDescriptor();
  if (!geomDescriptorOrg.getType().getBinding().equals(geomDescriptorDest.getType().getBinding())) {
    throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
  }
  AbstractReferenceSystem crsOrg=(AbstractReferenceSystem)delegate.getSchema().getCoordinateReferenceSystem();
  AbstractReferenceSystem crsDest=(AbstractReferenceSystem)featureType.getCoordinateReferenceSystem();
  if (!crsOrg.equals(crsDest,false)) {
    throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
  }
  FeatureIterator<F> iterator=delegate.features();
  SimpleFeatureBuilder builder=new SimpleFeatureBuilder((SimpleFeatureType)featureType);
  return new FeatureTypeConverterIterator<F>(iterator,(SimpleFeatureBuilder)builder);
}
Program: 113268
Project: 113268
Buggy source:
@Override public FeatureCollection<T,F> getFeatures(Query query) throws IOException {
  final FeatureCollection<T,F> features=super.getFeatures(query);
  return new ForwardingFeatureCollection<T,F>(features){
    @Override public FeatureIterator<F> features(){
      if (delegate.getSchema().getDescriptors().size() != featureType.getDescriptors().size()) {
        throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
      }
      GeometryDescriptor geomDescriptorOrg=delegate.getSchema().getGeometryDescriptor();
      GeometryDescriptor geomDescriptorDest=featureType.getGeometryDescriptor();
      if (!geomDescriptorOrg.getType().getBinding().equals(geomDescriptorDest.getType().getBinding()) || !geomDescriptorOrg.getType().getCoordinateReferenceSystem().equals(geomDescriptorDest.getType().getCoordinateReferenceSystem())) {
        throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
      }
      FeatureIterator<F> iterator=delegate.features();
      SimpleFeatureBuilder builder=new SimpleFeatureBuilder((SimpleFeatureType)featureType);
      return new FeatureTypeConverterIterator<F>(iterator,(SimpleFeatureBuilder)builder);
    }
    @Override public T getSchema(){
      return featureType;
    }
  }
;
}

Fixed version (ground truth):
@Override public FeatureCollection<T,F> getFeatures(Query query) throws IOException {
  final FeatureCollection<T,F> features=super.getFeatures(query);
  return new ForwardingFeatureCollection<T,F>(features){
    @Override public FeatureIterator<F> features(){
      if (delegate.getSchema().getDescriptors().size() != featureType.getDescriptors().size()) {
        throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
      }
      GeometryDescriptor geomDescriptorOrg=delegate.getSchema().getGeometryDescriptor();
      GeometryDescriptor geomDescriptorDest=featureType.getGeometryDescriptor();
      if (!geomDescriptorOrg.getType().getBinding().equals(geomDescriptorDest.getType().getBinding())) {
        throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
      }
      AbstractReferenceSystem crsOrg=(AbstractReferenceSystem)delegate.getSchema().getCoordinateReferenceSystem();
      AbstractReferenceSystem crsDest=(AbstractReferenceSystem)featureType.getCoordinateReferenceSystem();
      if (!crsOrg.equals(crsDest,false)) {
        throw new GeoToolsOpException(GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
      }
      FeatureIterator<F> iterator=delegate.features();
      SimpleFeatureBuilder builder=new SimpleFeatureBuilder((SimpleFeatureType)featureType);
      return new FeatureTypeConverterIterator<F>(iterator,(SimpleFeatureBuilder)builder);
    }
    @Override public T getSchema(){
      return featureType;
    }
  }
;
}
Program: 113269
Project: 113269
Buggy source:
private static ExecutorService createExecutorService(Environment.ConnectionConfig config,int threadPoolSize){
  String poolName=String.format("String_Node_Str",config.getServer(),config.getPortNumber(),config.getDatabaseName()) + "String_Node_Str";
  return Executors.newFixedThreadPool(threadPoolSize,new ThreadFactoryBuilder().setNameFormat(poolName).setDaemon(true).build());
}

Fixed version (ground truth):
private static ExecutorService createExecutorService(ThreadFactory threadFactory,Environment.ConnectionConfig config,int threadPoolSize){
  String poolName=String.format("String_Node_Str",config.getServer(),config.getPortNumber(),config.getDatabaseName()) + "String_Node_Str";
  return Executors.newFixedThreadPool(threadPoolSize,new ThreadFactoryBuilder().setThreadFactory(threadFactory).setNameFormat(poolName).setDaemon(true).build());
}
Program: 113270
Project: 113270
Buggy source:
public synchronized static void retain(ConfigDatabase configdb,Environment.ConnectionConfig config,String tableNamesPrefix){
  final Key key=new Key(config,tableNamesPrefix);
  SharedResourceReference ref=sharedResources.get(key);
  if (ref == null) {
    int threadPoolSize;
    Optional<Integer> tpoolSize=configdb.get(KEY_THREADPOOL_SIZE,Integer.class).or(configdb.getGlobal(KEY_THREADPOOL_SIZE,Integer.class));
    if (tpoolSize.isPresent()) {
      Integer poolSize=tpoolSize.get();
      Preconditions.checkState(poolSize.intValue() > 0,"String_Node_Str",poolSize);
      threadPoolSize=poolSize;
    }
 else {
      threadPoolSize=Math.max(Runtime.getRuntime().availableProcessors(),2);
    }
    ExecutorService databaseExecutor=createExecutorService(config,threadPoolSize);
    Cache<ObjectId,byte[]> byteCache=createCache(configdb);
    ref=new SharedResourceReference(byteCache,databaseExecutor,threadPoolSize);
    sharedResources.put(key,ref);
  }
 else {
    ref.refCount++;
  }
}

Fixed version (ground truth):
public synchronized static void retain(ConfigDatabase configdb,Environment.ConnectionConfig config,String tableNamesPrefix){
  final Key key=new Key(config,tableNamesPrefix);
  SharedResourceReference ref=sharedResources.get(key);
  if (ref == null) {
    int threadPoolSize;
    Optional<Integer> tpoolSize=configdb.get(KEY_THREADPOOL_SIZE,Integer.class).or(configdb.getGlobal(KEY_THREADPOOL_SIZE,Integer.class));
    if (tpoolSize.isPresent()) {
      Integer poolSize=tpoolSize.get();
      Preconditions.checkState(poolSize.intValue() > 0,"String_Node_Str",poolSize);
      threadPoolSize=poolSize;
    }
 else {
      threadPoolSize=Math.max(Runtime.getRuntime().availableProcessors(),2);
    }
    final String threadGroupName=String.format("String_Node_Str",config.getServer(),config.getPortNumber(),config.getDatabaseName());
    final ThreadGroup threadGroup=new ThreadGroup(threadGroupName);
    final ThreadFactory threadFactory=new ThreadFactory(){
      public Thread newThread(      Runnable r){
        return new Thread(threadGroup,r);
      }
    }
;
    ExecutorService databaseExecutor=createExecutorService(threadFactory,config,threadPoolSize);
    Cache<ObjectId,byte[]> byteCache=createCache(configdb);
    ref=new SharedResourceReference(byteCache,databaseExecutor,threadPoolSize,threadGroup);
    sharedResources.put(key,ref);
  }
 else {
    ref.refCount++;
  }
}
Program: 113271
Project: 113271
Buggy source:
SharedResourceReference(Cache<ObjectId,byte[]> byteCache,ExecutorService executor,int threadPoolSize){
  this.executor=executor;
  this.byteCache=byteCache;
  this.threadPoolSize=threadPoolSize;
}

Fixed version (ground truth):
SharedResourceReference(Cache<ObjectId,byte[]> byteCache,ExecutorService executor,int threadPoolSize,ThreadGroup threadGroup){
  this.executor=executor;
  this.byteCache=byteCache;
  this.threadPoolSize=threadPoolSize;
  this.threadGroup=threadGroup;
}
Program: 113272
Project: 113272
Buggy source:
private Future<List<RevObject>> getAll(final List<ObjectId> ids,final DataSource ds,final BulkOpListener listener,final @Nullable TYPE type){
  checkState(isOpen(),"String_Node_Str");
  GetAllOp getAllOp=new GetAllOp(ids,listener,this,type);
  Future<List<RevObject>> future=executor.submit(getAllOp);
  return future;
}

Fixed version (ground truth):
private Future<List<RevObject>> getAll(final List<ObjectId> ids,final DataSource ds,final BulkOpListener listener,final @Nullable TYPE type){
  checkState(isOpen(),"String_Node_Str");
  GetAllOp getAllOp=new GetAllOp(ids,listener,this,type);
  if (Thread.currentThread().getThreadGroup().equals(threadGroup)) {
    try {
      List<RevObject> objects=getAllOp.call();
      return Futures.immediateFuture(objects);
    }
 catch (    Exception e) {
      propagate(e);
    }
  }
  Future<List<RevObject>> future=executor.submit(getAllOp);
  return future;
}
Program: 113273
Project: 113273
Buggy source:
@Override public void open(){
  if (dataSource != null) {
    return;
  }
  dataSource=connect();
  Optional<Integer> getAllFetchSize=configdb.get(KEY_GETALL_BATCH_SIZE,Integer.class);
  Optional<Integer> putAllBatchSize=configdb.get(KEY_PUTALL_BATCH_SIZE,Integer.class);
  if (getAllFetchSize.isPresent()) {
    Integer fetchSize=getAllFetchSize.get();
    Preconditions.checkState(fetchSize.intValue() > 0,"String_Node_Str",fetchSize);
    this.getAllBatchSize=fetchSize;
  }
  if (putAllBatchSize.isPresent()) {
    Integer batchSize=putAllBatchSize.get();
    Preconditions.checkState(batchSize.intValue() > 0,"String_Node_Str",batchSize);
    this.putAllBatchSize=batchSize;
  }
  final int repositoryId=config.getRepositoryId();
  final String conflictsTable=config.getTables().conflicts();
  final String blobsTable=config.getTables().blobs();
  final String prefix=config.getTables().getPrefix();
  final ConnectionConfig connectionConfig=config.connectionConfig;
  ObjectDatabaseSharedResources.retain(configdb,connectionConfig,prefix);
  executor=ObjectDatabaseSharedResources.getExecutor(connectionConfig,prefix);
  byteCache=ObjectDatabaseSharedResources.getByteCache(connectionConfig,prefix);
  threadPoolSize=ObjectDatabaseSharedResources.getThreadPoolSize(connectionConfig,prefix);
  conflicts=new PGConflictsDatabase(dataSource,conflictsTable,repositoryId);
  blobStore=new PGBlobStore(dataSource,blobsTable,repositoryId);
}

Fixed version (ground truth):
@Override public void open(){
  if (dataSource != null) {
    return;
  }
  dataSource=connect();
  Optional<Integer> getAllFetchSize=configdb.get(KEY_GETALL_BATCH_SIZE,Integer.class);
  Optional<Integer> putAllBatchSize=configdb.get(KEY_PUTALL_BATCH_SIZE,Integer.class);
  if (getAllFetchSize.isPresent()) {
    Integer fetchSize=getAllFetchSize.get();
    Preconditions.checkState(fetchSize.intValue() > 0,"String_Node_Str",fetchSize);
    this.getAllBatchSize=fetchSize;
  }
  if (putAllBatchSize.isPresent()) {
    Integer batchSize=putAllBatchSize.get();
    Preconditions.checkState(batchSize.intValue() > 0,"String_Node_Str",batchSize);
    this.putAllBatchSize=batchSize;
  }
  final int repositoryId=config.getRepositoryId();
  final String conflictsTable=config.getTables().conflicts();
  final String blobsTable=config.getTables().blobs();
  final String prefix=config.getTables().getPrefix();
  final ConnectionConfig connectionConfig=config.connectionConfig;
  ObjectDatabaseSharedResources.retain(configdb,connectionConfig,prefix);
  executor=ObjectDatabaseSharedResources.getExecutor(connectionConfig,prefix);
  byteCache=ObjectDatabaseSharedResources.getByteCache(connectionConfig,prefix);
  threadPoolSize=ObjectDatabaseSharedResources.getThreadPoolSize(connectionConfig,prefix);
  threadGroup=ObjectDatabaseSharedResources.getThreadGroup(connectionConfig,prefix);
  conflicts=new PGConflictsDatabase(dataSource,conflictsTable,repositoryId);
  blobStore=new PGBlobStore(dataSource,blobsTable,repositoryId);
}
Program: 113274
Project: 113274
Buggy source:
/** 
 * Transforms all features to use a feature id that is compatible with GeoPackage. Keeps track of all the mappings so they can be added to the geopackage file after the export.
 * @param featureType the feature type of the features to transform
 * @return the transforming function
 */
@Override protected Function<Feature,Optional<Feature>> getTransformingFunction(final SimpleFeatureType featureType){
  Function<Feature,Optional<Feature>> function=(feature) -> {
    SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
    for (    Property property : feature.getProperties()) {
      if (property instanceof GeometryAttribute) {
        builder.set(featureType.getGeometryDescriptor().getName(),property.getValue());
      }
 else {
        builder.set(property.getName().getLocalPart(),property.getValue());
      }
    }
    Map<Object,Object> userData=feature.getUserData();
    for (    Entry<Object,Object> entry : userData.entrySet()) {
      builder.featureUserData(entry.getKey(),entry.getValue());
    }
    long fidValue=nextId.incrementAndGet();
    builder.featureUserData(Hints.PROVIDED_FID,Long.valueOf(fidValue));
    fidMappings.put(Long.toString(fidValue),feature.getIdentifier().getID());
    Feature modifiedFeature=builder.buildFeature(Long.toString(fidValue));
    return Optional.fromNullable(modifiedFeature);
  }
;
  return function;
}

Fixed version (ground truth):
/** 
 * Transforms all features to use a feature id that is compatible with GeoPackage. Keeps track of all the mappings so they can be added to the geopackage file after the export.
 * @param featureType the feature type of the features to transform
 * @return the transforming function
 */
@Override protected Function<Feature,Optional<Feature>> getTransformingFunction(final SimpleFeatureType featureType){
  Function<Feature,Optional<Feature>> function=(feature) -> {
    SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
    builder.init((SimpleFeature)feature);
    long fidValue=nextId.incrementAndGet();
    builder.featureUserData(Hints.PROVIDED_FID,Long.valueOf(fidValue));
    fidMappings.put(Long.toString(fidValue),feature.getIdentifier().getID());
    Feature modifiedFeature=builder.buildFeature(Long.toString(fidValue));
    return Optional.fromNullable(modifiedFeature);
  }
;
  return function;
}
Program: 113275
Project: 113275
Buggy source:
@Override public SimpleFeature next(){
  SimpleFeature next=super.next();
  SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
  for (  Property property : next.getProperties()) {
    if (property instanceof GeometryAttribute) {
      builder.set(featureType.getGeometryDescriptor().getName(),property.getValue());
    }
 else {
      builder.set(property.getName().getLocalPart(),property.getValue());
    }
  }
  Map<Object,Object> userData=next.getUserData();
  for (  Entry<Object,Object> entry : userData.entrySet()) {
    builder.featureUserData(entry.getKey(),entry.getValue());
  }
  String oldFeatureId=next.getIdentifier().getID();
  String featureId;
  if (fidMappings.containsKey(oldFeatureId)) {
    featureId=fidMappings.get(oldFeatureId);
  }
 else {
    featureId=SimpleFeatureBuilder.createDefaultFeatureId();
  }
  return builder.buildFeature(featureId);
}

Fixed version (ground truth):
@Override public SimpleFeature next(){
  SimpleFeature next=super.next();
  SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
  builder.init(next);
  String oldFeatureId=next.getIdentifier().getID();
  String featureId;
  if (fidMappings.containsKey(oldFeatureId)) {
    featureId=fidMappings.get(oldFeatureId);
  }
 else {
    featureId=SimpleFeatureBuilder.createDefaultFeatureId();
  }
  return builder.buildFeature(featureId);
}
Program: 113276
Project: 113276
Buggy source:
/** 
 * @param featureType the feature type of the features to transform
 * @return a transform function to update and keep track of feature id mappings of exportedfeatures
 */
@Override protected Function<Feature,Optional<Feature>> getTransformingFunction(final SimpleFeatureType featureType){
  Function<Feature,Optional<Feature>> function=(feature) -> {
    String featureId=feature.getIdentifier().getID();
    if (!changedNodes.containsKey(featureId)) {
      return Optional.absent();
    }
    SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
    for (    Property property : feature.getProperties()) {
      if (property instanceof GeometryAttribute) {
        builder.set(featureType.getGeometryDescriptor().getName(),property.getValue());
      }
 else {
        builder.set(property.getName().getLocalPart(),property.getValue());
      }
    }
    Map<Object,Object> userData=feature.getUserData();
    for (    Entry<Object,Object> entry : userData.entrySet()) {
      builder.featureUserData(entry.getKey(),entry.getValue());
    }
    long fidValue=nextId.incrementAndGet();
    builder.featureUserData(Hints.PROVIDED_FID,Long.valueOf(fidValue));
    fidMappings.put(Long.toString(fidValue),featureId);
    Feature modifiedFeature=builder.buildFeature(Long.toString(fidValue));
    return Optional.fromNullable(modifiedFeature);
  }
;
  return function;
}

Fixed version (ground truth):
/** 
 * @param featureType the feature type of the features to transform
 * @return a transform function to update and keep track of feature id mappings of exportedfeatures
 */
@Override protected Function<Feature,Optional<Feature>> getTransformingFunction(final SimpleFeatureType featureType){
  Function<Feature,Optional<Feature>> function=(feature) -> {
    String featureId=feature.getIdentifier().getID();
    if (!changedNodes.containsKey(featureId)) {
      return Optional.absent();
    }
    SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
    builder.init((SimpleFeature)feature);
    long fidValue=nextId.incrementAndGet();
    builder.featureUserData(Hints.PROVIDED_FID,Long.valueOf(fidValue));
    fidMappings.put(Long.toString(fidValue),featureId);
    Feature modifiedFeature=builder.buildFeature(Long.toString(fidValue));
    return Optional.fromNullable(modifiedFeature);
  }
;
  return function;
}
Program: 113277
Project: 113277
Buggy source:
/** 
 * @param featureType the feature type of the features to transform
 * @return a transform function to update and keep track of feature id mappings of exportedfeatures
 */
@Override protected Function<Feature,Optional<Feature>> getTransformingFunction(final SimpleFeatureType featureType){
  Function<Feature,Optional<Feature>> function=(feature) -> {
    SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
    for (    Property property : feature.getProperties()) {
      if (property instanceof GeometryAttribute) {
        builder.set(featureType.getGeometryDescriptor().getName(),property.getValue());
      }
 else {
        builder.set(property.getName().getLocalPart(),property.getValue());
      }
    }
    Map<Object,Object> userData=feature.getUserData();
    for (    Entry<Object,Object> entry : userData.entrySet()) {
      builder.featureUserData(entry.getKey(),entry.getValue());
    }
    long fidValue=nextId.incrementAndGet();
    builder.featureUserData(Hints.PROVIDED_FID,Long.valueOf(fidValue));
    fidMappings.put(Long.toString(fidValue),feature.getIdentifier().getID());
    Feature modifiedFeature=builder.buildFeature(Long.toString(fidValue));
    return Optional.fromNullable(modifiedFeature);
  }
;
  return function;
}

Fixed version (ground truth):
/** 
 * @param featureType the feature type of the features to transform
 * @return a transform function to update and keep track of feature id mappings of exportedfeatures
 */
@Override protected Function<Feature,Optional<Feature>> getTransformingFunction(final SimpleFeatureType featureType){
  Function<Feature,Optional<Feature>> function=(feature) -> {
    SimpleFeatureBuilder builder=new SimpleFeatureBuilder(featureType);
    builder.init((SimpleFeature)feature);
    long fidValue=nextId.incrementAndGet();
    builder.featureUserData(Hints.PROVIDED_FID,Long.valueOf(fidValue));
    fidMappings.put(Long.toString(fidValue),feature.getIdentifier().getID());
    Feature modifiedFeature=builder.buildFeature(Long.toString(fidValue));
    return Optional.fromNullable(modifiedFeature);
  }
;
  return function;
}
Program: 113278
Project: 113278
Buggy source:
public Map<String,String> getFidMappings(String tableName) throws SQLException {
  final String sql=format("String_Node_Str",tableName + "String_Node_Str");
  Map<String,String> mappings=new HashMap<String,String>();
  try (Statement st=cx.createStatement()){
    try (ResultSet rs=st.executeQuery(sql)){
      while (rs.next()) {
        String gpkg_fid=rs.getString(1);
        String geogig_fid=rs.getString(2);
        mappings.put(gpkg_fid,geogig_fid);
      }
    }
   }
   return mappings;
}

Fixed version (ground truth):
public Map<String,String> getFidMappings(String tableName) throws SQLException {
  String fidTable=tableName + "String_Node_Str";
  Map<String,String> mappings=new HashMap<String,String>();
  DatabaseMetaData dbm=cx.getMetaData();
  ResultSet tables=dbm.getTables(null,null,fidTable,null);
  while (tables.next()) {
    if (tables.getString("String_Node_Str").equals(fidTable)) {
      final String sql=format("String_Node_Str",fidTable);
      try (Statement st=cx.createStatement()){
        try (ResultSet rs=st.executeQuery(sql)){
          while (rs.next()) {
            String gpkg_fid=rs.getString(1);
            String geogig_fid=rs.getString(2);
            mappings.put(gpkg_fid,geogig_fid);
          }
        }
       }
     }
  }
  return mappings;
}
Program: 113280
Project: 113280
Buggy source:
@Given("String_Node_Str") public void I_have_a_patch_file() throws Throwable {
  Patch patch=new Patch();
  String path=NodeRef.appendChild(pointsName,points1.getIdentifier().getID());
  Map<PropertyDescriptor,AttributeDiff> map=Maps.newHashMap();
  Optional<?> oldValue=Optional.fromNullable(points1.getProperty("String_Node_Str").getValue());
  GenericAttributeDiffImpl diff=new GenericAttributeDiffImpl(oldValue,Optional.of("String_Node_Str"));
  map.put(pointsType.getDescriptor("String_Node_Str"),diff);
  FeatureDiff feaureDiff=new FeatureDiff(path,map,RevFeatureTypeImpl.build(pointsType),RevFeatureTypeImpl.build(pointsType));
  patch.addModifiedFeature(feaureDiff);
  File file=new File(localRepo.platform.pwd(),"String_Node_Str");
  BufferedWriter writer=Files.newWriter(file,Charsets.UTF_8);
  PatchSerializer.write(writer,patch);
  writer.flush();
  writer.close();
}

Fixed version (ground truth):
@Given("String_Node_Str") public void I_have_a_patch_file() throws Throwable {
  Patch patch=new Patch();
  String path=NodeRef.appendChild(pointsName,points1.getIdentifier().getID());
  Map<PropertyDescriptor,AttributeDiff> map=Maps.newHashMap();
  Object oldValue=points1.getProperty("String_Node_Str").getValue();
  GenericAttributeDiffImpl diff=new GenericAttributeDiffImpl(oldValue,"String_Node_Str");
  map.put(pointsType.getDescriptor("String_Node_Str"),diff);
  FeatureDiff feaureDiff=new FeatureDiff(path,map,RevFeatureTypeImpl.build(pointsType),RevFeatureTypeImpl.build(pointsType));
  patch.addModifiedFeature(feaureDiff);
  File file=new File(localRepo.platform.pwd(),"String_Node_Str");
  BufferedWriter writer=Files.newWriter(file,Charsets.UTF_8);
  PatchSerializer.write(writer,patch);
  writer.flush();
  writer.close();
}
Program: 113281
Project: 113281
Buggy source:
/** 
 * applies the difference on the passed object, if possible.
 * @param obj the object representing the original (old) state of the attribute. If the value isnull, it represents that the attribute did not exist previously
 */
public Optional<?> applyOn(Optional<?> obj);

Fixed version (ground truth):
/** 
 * applies the difference on the passed object, if possible.
 * @param value the object representing the original (old) state of the attribute. If the valueis null, it represents that the attribute did not exist previously
 */
@Nullable public Object applyOn(@Nullable Object value);
Program: 113282
Project: 113282
Buggy source:
/** 
 * Returns true if the diff can be applied on the passed value. Return false if the passed value does not represent the old state represented by this attribute difference
 * @param obj the object representing the original (old) state of the attribute. If the value isnull, it represents that the attribute did not exist previously
 * @return true if the diff can be applied to the passed object
 */
public boolean canBeAppliedOn(Optional<?> obj);

Fixed version (ground truth):
/** 
 * Returns true if the diff can be applied on the passed value. Return false if the passed value does not represent the old state represented by this attribute difference
 * @param value the object representing the original (old) state of the attribute. If the valueis null, it represents that the attribute did not exist previously
 * @return true if the diff can be applied to the passed object
 */
public boolean canBeAppliedOn(@Nullable Object value);
Program: 113283
Project: 113283
Buggy source:
/** 
 * accessor for the old value
 */
public Optional<?> getOldValue();

Fixed version (ground truth):
/** 
 * accessor for the old value
 */
@Nullable public Object getOldValue();
Program: 113284
Project: 113284
Buggy source:
/** 
 * accessor for the new value
 */
public Optional<?> getNewValue();

Fixed version (ground truth):
/** 
 * accessor for the new value
 */
@Nullable public Object getNewValue();
Program: 113285
Project: 113285
Buggy source:
public static AttributeDiff attributeDiffFromText(Class<?> clazz,String s){
  String[] tokens=s.split("String_Node_Str");
  AttributeDiff ad;
  if (Geometry.class.isAssignableFrom(clazz)) {
    ad=new GeometryAttributeDiff(s);
  }
 else {
    if (AttributeDiff.TYPE.REMOVED.name().startsWith(tokens[0])) {
      Preconditions.checkArgument(tokens.length == 2,"String_Node_Str",s);
      Object oldValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[1]);
      ad=new GenericAttributeDiffImpl(Optional.fromNullable(oldValue),null);
    }
 else     if (AttributeDiff.TYPE.ADDED.name().startsWith(tokens[0])) {
      Preconditions.checkArgument(tokens.length == 2,"String_Node_Str",s);
      Object newValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[1]);
      ad=new GenericAttributeDiffImpl(null,Optional.fromNullable(newValue));
    }
 else     if (AttributeDiff.TYPE.MODIFIED.name().startsWith(tokens[0])) {
      Preconditions.checkArgument(tokens.length == 3,"String_Node_Str",s);
      Object oldValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[1]);
      Object newValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[2]);
      ad=new GenericAttributeDiffImpl(Optional.fromNullable(oldValue),Optional.fromNullable(newValue));
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + s);
    }
  }
  return ad;
}

Fixed version (ground truth):
public static AttributeDiff attributeDiffFromText(Class<?> clazz,String s){
  String[] tokens=s.split("String_Node_Str");
  AttributeDiff ad;
  if (Geometry.class.isAssignableFrom(clazz)) {
    ad=new GeometryAttributeDiff(s);
  }
 else {
    if (AttributeDiff.TYPE.REMOVED.name().startsWith(tokens[0])) {
      Preconditions.checkArgument(tokens.length == 2,"String_Node_Str",s);
      Object oldValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[1]);
      ad=new GenericAttributeDiffImpl(oldValue,null);
    }
 else     if (AttributeDiff.TYPE.ADDED.name().startsWith(tokens[0])) {
      Preconditions.checkArgument(tokens.length == 2,"String_Node_Str",s);
      Object newValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[1]);
      ad=new GenericAttributeDiffImpl(null,newValue);
    }
 else     if (AttributeDiff.TYPE.MODIFIED.name().startsWith(tokens[0])) {
      Preconditions.checkArgument(tokens.length == 3,"String_Node_Str",s);
      Object oldValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[1]);
      Object newValue=TextValueSerializer.fromString(FieldType.forBinding(clazz),tokens[2]);
      ad=new GenericAttributeDiffImpl(oldValue,newValue);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + s);
    }
  }
  return ad;
}
Program: 113287
Project: 113287
Buggy source:
public GenericAttributeDiffImpl(@Nullable Optional<?> oldValue,@Nullable Optional<?> newValue){
  if (oldValue == null) {
    this.oldValue=Optional.absent();
  }
 else {
    this.oldValue=oldValue;
  }
  if (newValue == null) {
    this.newValue=Optional.absent();
  }
 else {
    this.newValue=newValue;
  }
}

Fixed version (ground truth):
/** 
 * @param oldValue The new value. {@code null} if it does not exist (the attribute has beenremoved)
 * @param newValue The old value. {@code null} if it did not exist (the attribute has beenadded)
 */
public GenericAttributeDiffImpl(@Nullable Object oldValue,@Nullable Object newValue){
  checkArgument(!(oldValue instanceof Optional));
  checkArgument(!(newValue instanceof Optional));
  this.oldValue=oldValue;
  this.newValue=newValue;
}
Program: 113288
Project: 113288
Buggy source:
@Override public TYPE getType(){
  TYPE type;
  if (!oldValue.isPresent() && !newValue.isPresent()) {
    type=TYPE.NO_CHANGE;
  }
 else   if (!newValue.isPresent()) {
    type=TYPE.REMOVED;
  }
 else   if (!oldValue.isPresent()) {
    type=TYPE.ADDED;
  }
 else   if (oldValue.equals(newValue)) {
    type=TYPE.NO_CHANGE;
  }
 else {
    type=TYPE.MODIFIED;
  }
  return type;
}

Fixed version (ground truth):
@Override public TYPE getType(){
  TYPE type;
  if (java.util.Objects.equals(oldValue,newValue)) {
    type=TYPE.NO_CHANGE;
  }
 else   if (null == newValue) {
    type=TYPE.REMOVED;
  }
 else   if (null == oldValue) {
    type=TYPE.ADDED;
  }
 else {
    type=TYPE.MODIFIED;
  }
  return type;
}
Program: 113289
Project: 113289
Buggy source:
@Override public Optional<?> applyOn(Optional<?> obj){
  Preconditions.checkState(canBeAppliedOn(obj));
  return newValue;
}

Fixed version (ground truth):
@Override public Object applyOn(@Nullable Object obj){
  Preconditions.checkState(canBeAppliedOn(obj));
  return newValue;
}
Program: 113290
Project: 113290
Buggy source:
@Override public boolean canBeAppliedOn(Optional<?> obj){
  if (obj == null) {
    obj=Optional.absent();
  }
  return obj.equals(oldValue) || obj.equals(newValue);
}

Fixed version (ground truth):
@Override public boolean canBeAppliedOn(@Nullable Object obj){
  checkArgument(!(obj instanceof Optional));
  return Objects.equal(obj,oldValue) || Objects.equal(obj,newValue);
}
Program: 113291
Project: 113291
Buggy source:
@Override public Optional<?> getOldValue(){
  return oldValue;
}

Fixed version (ground truth):
@Override public Object getOldValue(){
  return oldValue;
}
Program: 113292
Project: 113292
Buggy source:
@Override public Optional<?> getNewValue(){
  return newValue;
}

Fixed version (ground truth):
@Override public Object getNewValue(){
  return newValue;
}