nus-yam/ex-repair huggingface dataset:
Program: 38472
Project: 38472
Buggy source:
/** 
 * Compute the number of parameters given by method signature "type". Any "this" parameter is not included.
 * @throws IllegalArgumentException  if type == null
 */
static int getParamsCount(String type) throws IllegalArgumentException {
  if (type == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int index=1;
  int count=0;
  while (type.charAt(index) != ')') {
    count++;
    index+=getTypeLength(type,index);
  }
  return count;
}

Fixed version (ground truth):
/** 
 * Compute the number of parameters given by method signature "type". Any "this" parameter is not included.
 * @throws IllegalArgumentException  if type == null
 */
static int getParamsCount(String type) throws IllegalArgumentException {
  if (type == null || type.length() < 2) {
    throw new IllegalArgumentException("String_Node_Str" + type);
  }
  int index=1;
  int count=0;
  while (type.charAt(index) != ')') {
    count++;
    index+=getTypeLength(type,index);
  }
  return count;
}
Program: 38473
Project: 38473
Buggy source:
/** 
 * @return true iff t is a primitive type
 */
public static boolean isPrimitiveType(String t){
  if (t == null) {
    return false;
  }
 else {
switch (t.charAt(0)) {
case 'L':
case '[':
      return false;
default :
    return true;
}
}
}

Fixed version (ground truth):
/** 
 * @return true iff t is a primitive type
 */
public static boolean isPrimitiveType(String t){
  if (t == null || t.length() == 0) {
    return false;
  }
 else {
switch (t.charAt(0)) {
case 'L':
case '[':
      return false;
default :
    return true;
}
}
}
Program: 38474
Project: 38474
Buggy source:
/** 
 * Initialize a verifier.
 * @throws NullPointerException  if info is null
 */
public Verifier(MethodData info) throws NullPointerException {
  super(info);
}

Fixed version (ground truth):
/** 
 * Initialize a verifier.
 * @throws NullPointerException if info is null
 */
public Verifier(MethodData info) throws NullPointerException {
  super(info);
}
Program: 38475
Project: 38475
Buggy source:
public static void main(String[] args){
  for (int i=0; i < args.length; i++) {
    try {
      byte[] data=Util.readFully(new FileInputStream(args[i]));
      ClassReader r=new ClassReader(data);
      System.out.println(Util.makeClass(r.getName()) + "String_Node_Str" + computeSerialVersionUID(r));
    }
 catch (    FileNotFoundException e) {
      System.err.println("String_Node_Str" + args[i]);
    }
catch (    IOException e) {
      System.err.println("String_Node_Str" + args[i]);
    }
catch (    InvalidClassFileException e) {
      System.err.println("String_Node_Str" + args[i]);
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  for (int i=0; i < args.length; i++) {
    if (args[i] == null) {
      throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str");
    }
    try {
      byte[] data=Util.readFully(new FileInputStream(args[i]));
      ClassReader r=new ClassReader(data);
      System.out.println(Util.makeClass(r.getName()) + "String_Node_Str" + computeSerialVersionUID(r));
    }
 catch (    FileNotFoundException e) {
      System.err.println("String_Node_Str" + args[i]);
    }
catch (    IOException e) {
      System.err.println("String_Node_Str" + args[i]);
    }
catch (    InvalidClassFileException e) {
      System.err.println("String_Node_Str" + args[i]);
    }
  }
}
Program: 38476
Project: 38476
Buggy source:
/** 
 * Call this when you're done modifying classes.
 */
final public void close() throws IOException {
  if (passUnmodifiedClasses) {
    writeUnmodifiedClasses();
  }
  if (outputJar != null) {
    outputJar.close();
  }
  if (cachedJar != null) {
    cachedJar.close();
  }
}

Fixed version (ground truth):
/** 
 * Call this when you're done modifying classes.
 */
final public void close() throws IOException, IllegalStateException {
  if (passUnmodifiedClasses) {
    writeUnmodifiedClasses();
  }
  if (outputJar != null) {
    outputJar.close();
  }
  if (cachedJar != null) {
    cachedJar.close();
  }
}
Program: 38477
Project: 38477
Buggy source:
/** 
 * Parse an argument list to find elements to instrument and the name of the output file. The "-o filename" option selects the output JAR file name. Any other argument not starting with "-" is added to the list of elements to instrument, if it appears to be the name of a class file, JAR file, or directory. If any argument starting with "--" is encountered, the rest of the command-line is considered leftover
 * @return the arguments that were not understood
 * @throws IllegalArgumentException  if args == null
 */
final public String[] parseStandardArgs(String[] args) throws IllegalArgumentException, IOException {
  if (args == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ArrayList<String> leftover=new ArrayList<String>();
  for (int i=0; i < args.length; i++) {
    String a=args[i];
    if (a.equals("String_Node_Str") && i + 1 < args.length) {
      setOutputJar(new File(args[i + 1]));
      i++;
      continue;
    }
 else     if (!a.startsWith("String_Node_Str")) {
      if (addInputElement(a)) {
        continue;
      }
    }
 else     if (a.startsWith("String_Node_Str")) {
      for (int j=i; j < args.length; j++) {
        leftover.add(args[j]);
      }
      break;
    }
    leftover.add(a);
  }
  String[] r=new String[leftover.size()];
  leftover.toArray(r);
  return r;
}

Fixed version (ground truth):
/** 
 * Parse an argument list to find elements to instrument and the name of the output file. The "-o filename" option selects the output JAR file name. Any other argument not starting with "-" is added to the list of elements to instrument, if it appears to be the name of a class file, JAR file, or directory. If any argument starting with "--" is encountered, the rest of the command-line is considered leftover
 * @return the arguments that were not understood
 * @throws IllegalArgumentException  if args == null
 */
final public String[] parseStandardArgs(String[] args) throws IllegalArgumentException, IOException {
  if (args == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ArrayList<String> leftover=new ArrayList<String>();
  for (int i=0; i < args.length; i++) {
    String a=args[i];
    if (a == null) {
      throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str");
    }
    if (a.equals("String_Node_Str") && i + 1 < args.length) {
      setOutputJar(new File(args[i + 1]));
      i++;
      continue;
    }
 else     if (!a.startsWith("String_Node_Str")) {
      if (addInputElement(a)) {
        continue;
      }
    }
 else     if (a.startsWith("String_Node_Str")) {
      for (int j=i; j < args.length; j++) {
        leftover.add(args[j]);
      }
      break;
    }
    leftover.add(a);
  }
  String[] r=new String[leftover.size()];
  leftover.toArray(r);
  return r;
}
Program: 38478
Project: 38478
Buggy source:
/** 
 * Set the 4 bytes at offset 'offset' in 'buf' to the signed 32-bit value in v.
 * @throws IllegalArgumentException if buf is null
 */
public static void setInt(byte[] buf,int offset,int v) throws IllegalArgumentException {
  if (buf == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (offset >= buf.length) {
    throw new IllegalArgumentException("String_Node_Str" + offset);
  }
  buf[offset]=(byte)(v >> 24);
  buf[offset + 1]=(byte)(v >> 16);
  buf[offset + 2]=(byte)(v >> 8);
  buf[offset + 3]=(byte)v;
}

Fixed version (ground truth):
/** 
 * Set the 4 bytes at offset 'offset' in 'buf' to the signed 32-bit value in v.
 * @throws IllegalArgumentException if buf is null
 */
public static void setInt(byte[] buf,int offset,int v) throws IllegalArgumentException {
  if (buf == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    buf[offset]=(byte)(v >> 24);
    buf[offset + 1]=(byte)(v >> 16);
    buf[offset + 2]=(byte)(v >> 8);
    buf[offset + 3]=(byte)v;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new IllegalArgumentException("String_Node_Str" + offset);
  }
}
Program: 38479
Project: 38479
Buggy source:
/** 
 * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value in v.
 * @throws IllegalArgumentException if buf is null
 */
public static void setUShort(byte[] buf,int offset,int v) throws IllegalArgumentException {
  if (buf == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (offset + 1 >= buf.length) {
    throw new IllegalArgumentException("String_Node_Str" + buf.length + "String_Node_Str"+ offset);
  }
  buf[offset]=(byte)(v >> 8);
  buf[offset + 1]=(byte)v;
}

Fixed version (ground truth):
/** 
 * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value in v.
 * @throws IllegalArgumentException if buf is null
 */
public static void setUShort(byte[] buf,int offset,int v) throws IllegalArgumentException {
  if (buf == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (offset < 0 || offset + 1 >= buf.length) {
    throw new IllegalArgumentException("String_Node_Str" + buf.length + "String_Node_Str"+ offset);
  }
  try {
    buf[offset]=(byte)(v >> 8);
    buf[offset + 1]=(byte)v;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new IllegalArgumentException("String_Node_Str" + offset);
  }
}
Program: 38480
Project: 38480
Buggy source:
/** 
 * @param bytes the raw class file data
 * @param offset the start of the constant pool data
 * @param itemCount the number of items in the pool
 */
public ConstantPoolParser(byte[] bytes,int offset,int itemCount) throws InvalidClassFileException {
  this.bytes=bytes;
  if (offset < 0) {
    throw new IllegalArgumentException("String_Node_Str" + offset);
  }
  if (itemCount < 0) {
    throw new IllegalArgumentException("String_Node_Str" + itemCount);
  }
  parseConstantPool(offset,itemCount);
}

Fixed version (ground truth):
/** 
 * @param bytes the raw class file data
 * @param offset the start of the constant pool data
 * @param itemCount the number of items in the pool
 */
public ConstantPoolParser(byte[] bytes,int offset,int itemCount) throws InvalidClassFileException {
  this.bytes=bytes;
  if (offset < 0) {
    throw new IllegalArgumentException("String_Node_Str" + offset);
  }
  if (itemCount < 0 || itemCount > MAX_CP_ITEMS) {
    throw new IllegalArgumentException("String_Node_Str" + itemCount);
  }
  parseConstantPool(offset,itemCount);
}
Program: 38481
Project: 38481
Buggy source:
public boolean isPEI(){
  return true;
}

Fixed version (ground truth):
public boolean isPEI(){
  return !isStatic();
}
Program: 38482
Project: 38482
Buggy source:
public boolean isPEI(){
  return true;
}

Fixed version (ground truth):
public boolean isPEI(){
  return !isStatic();
}
Program: 38483
Project: 38483
Buggy source:
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new PolyglotJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,new String[]{"String_Node_Str"});
    }
  }
;
  engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  return engine;
}

Fixed version (ground truth):
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new PolyglotJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,new String[]{"String_Node_Str"});
    }
  }
;
  engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  return engine;
}
Program: 38484
Project: 38484
Buggy source:
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,new String[]{"String_Node_Str"});
}

Fixed version (ground truth):
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,new String[]{"String_Node_Str"});
}
Program: 38485
Project: 38485
Buggy source:
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new PolyglotJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
    }
  }
;
  engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  return engine;
}

Fixed version (ground truth):
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new PolyglotJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
    }
  }
;
  engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  return engine;
}
Program: 38486
Project: 38486
Buggy source:
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
}

Fixed version (ground truth):
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
}
Program: 38487
Project: 38487
Buggy source:
protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new PolyglotJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
    }
    public IRTranslatorExtension getTranslatorExtension(){
      JavaIRTranslatorExtension ext=new JavaIRTranslatorExtension();
      ext.setCAstRewriterFactory(new CAstRewriterFactory(){
        public CAstRewriter createCAstRewriter(        CAst ast){
          return new SynchronizedBlockDuplicator(ast,true,testMethod);
        }
      }
);
      return ext;
    }
  }
;
  engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  return engine;
}

Fixed version (ground truth):
protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new PolyglotJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
    }
    public IRTranslatorExtension getTranslatorExtension(){
      JavaIRTranslatorExtension ext=new JavaIRTranslatorExtension();
      ext.setCAstRewriterFactory(new CAstRewriterFactory(){
        public CAstRewriter createCAstRewriter(        CAst ast){
          return new SynchronizedBlockDuplicator(ast,true,testMethod);
        }
      }
);
      return ext;
    }
  }
;
  engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  return engine;
}
Program: 38488
Project: 38488
Buggy source:
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
}

Fixed version (ground truth):
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
}
Program: 38489
Project: 38489
Buggy source:
@Override protected void buildAnalysisScope(){
  try {
    scope=makeSourceAnalysisScope();
    if (getExclusionsFile() != null) {
      scope.setExclusions(new FileOfClasses(new File(getExclusionsFile())));
    }
    EclipseProjectPath epath=getEclipseProjectPath();
    for (    Module m : epath.getModules(Loader.PRIMORDIAL,true)) {
      scope.addToScope(scope.getPrimordialLoader(),m);
    }
    ClassLoaderReference app=scope.getApplicationLoader();
    for (    Module m : epath.getModules(Loader.APPLICATION,true)) {
      scope.addToScope(app,m);
    }
    for (    Module m : epath.getModules(Loader.EXTENSION,true)) {
      if (!(m instanceof BinaryDirectoryTreeModule))       scope.addToScope(app,m);
    }
    ClassLoaderReference src=((JavaSourceAnalysisScope)scope).getSourceLoader();
    for (    Module m : epath.getModules(Loader.SOURCE,false)) {
      scope.addToScope(src,m);
    }
  }
 catch (  IOException e) {
    Assertions.UNREACHABLE(e.toString());
  }
}

Fixed version (ground truth):
@Override protected void buildAnalysisScope(){
  try {
    scope=makeSourceAnalysisScope();
    if (getExclusionsFile() != null) {
      scope.setExclusions(FileOfClasses.createFileOfClasses(new File(getExclusionsFile())));
    }
    EclipseProjectPath epath=getEclipseProjectPath();
    for (    Module m : epath.getModules(Loader.PRIMORDIAL,true)) {
      scope.addToScope(scope.getPrimordialLoader(),m);
    }
    ClassLoaderReference app=scope.getApplicationLoader();
    for (    Module m : epath.getModules(Loader.APPLICATION,true)) {
      scope.addToScope(app,m);
    }
    for (    Module m : epath.getModules(Loader.EXTENSION,true)) {
      if (!(m instanceof BinaryDirectoryTreeModule))       scope.addToScope(app,m);
    }
    ClassLoaderReference src=((JavaSourceAnalysisScope)scope).getSourceLoader();
    for (    Module m : epath.getModules(Loader.APPLICATION,false)) {
      scope.addToScope(src,m);
    }
  }
 catch (  IOException e) {
    Assertions.UNREACHABLE(e.toString());
  }
}
Program: 38490
Project: 38490
Buggy source:
@Override protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha);
}

Fixed version (ground truth):
@Override protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha);
}
Program: 38491
Project: 38491
Buggy source:
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference,IClassHierarchy cha,IClassLoader parent,AnalysisScope scope) throws IOException {
  if (classLoaderReference.equals(EclipseProjectPath.SOURCE_REF)) {
    ClassLoaderImpl cl=new PolyglotSourceLoaderImpl(classLoaderReference,parent,getExclusions(),cha,getExtensionFor(classLoaderReference));
    cl.init(scope.getModules(classLoaderReference));
    return cl;
  }
 else {
    return super.makeNewClassLoader(classLoaderReference,cha,parent,scope);
  }
}

Fixed version (ground truth):
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference,IClassHierarchy cha,IClassLoader parent,AnalysisScope scope) throws IOException {
  if (classLoaderReference.equals(JavaSourceAnalysisScope.SOURCE)) {
    ClassLoaderImpl cl=new PolyglotSourceLoaderImpl(classLoaderReference,parent,getExclusions(),cha,getExtensionFor(classLoaderReference));
    cl.init(scope.getModules(classLoaderReference));
    return cl;
  }
 else {
    return super.makeNewClassLoader(classLoaderReference,cha,parent,scope);
  }
}
Program: 38492
Project: 38492
Buggy source:
public PolyglotClassLoaderFactory(SetOfClasses exclusions,IRTranslatorExtension javaExtInfo){
  super(exclusions);
  fExtensionMap.put(EclipseProjectPath.SOURCE_REF,javaExtInfo);
}

Fixed version (ground truth):
public PolyglotClassLoaderFactory(SetOfClasses exclusions,IRTranslatorExtension javaExtInfo){
  super(exclusions);
  fExtensionMap.put(JavaSourceAnalysisScope.SOURCE,javaExtInfo);
}
Program: 38493
Project: 38493
Buggy source:
public Iterator<T> iterator(){
  return new ArrayIterator<T>(entries);
}

Fixed version (ground truth):
public Iterator<T> iterator(){
  if (entries.length == 0) {
    return EmptyIterator.instance();
  }
  return new ArrayIterator<T>(entries);
}
Program: 38494
Project: 38494
Buggy source:
public boolean containsValue(Object value){
  if (keysAndValues == null) {
    return false;
  }
  for (int i=size(); i < keysAndValues.length; i++) {
    if (keysAndValues[i].equals(value)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean containsValue(Object value){
  if (keysAndValues == null) {
    return false;
  }
  for (int i=size(); i < keysAndValues.length; i++) {
    Object v=keysAndValues[i];
    if (v == null) {
      if (value == null) {
        return true;
      }
    }
 else {
      if (v.equals(value)) {
        return true;
      }
    }
  }
  return false;
}
Program: 38495
Project: 38495
Buggy source:
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new JDTJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
    }
  }
;
  try {
    engine.setExclusionsFile(FileProvider.getFileFromPlugin(CoreTestsPlugin.getDefault(),CallGraphTestUtil.REGRESSION_EXCLUSIONS).getAbsolutePath());
  }
 catch (  IOException e) {
    Assert.assertFalse("String_Node_Str",true);
  }
  return engine;
}

Fixed version (ground truth):
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new JDTJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
    }
  }
;
  try {
    engine.setExclusionsFile(FileProvider.getFileFromPlugin(CoreTestsPlugin.getDefault(),CallGraphTestUtil.REGRESSION_EXCLUSIONS).getAbsolutePath());
  }
 catch (  IOException e) {
    Assert.assertFalse("String_Node_Str",true);
  }
  return engine;
}
Program: 38496
Project: 38496
Buggy source:
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
}

Fixed version (ground truth):
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
}
Program: 38497
Project: 38497
Buggy source:
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new JDTJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
    }
  }
;
  try {
    engine.setExclusionsFile(FileProvider.getFileFromPlugin(CoreTestsPlugin.getDefault(),CallGraphTestUtil.REGRESSION_EXCLUSIONS).getAbsolutePath());
  }
 catch (  IOException e) {
    Assert.assertFalse("String_Node_Str",true);
  }
  return engine;
}

Fixed version (ground truth):
@Override protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors){
  JavaSourceAnalysisEngine engine=new JDTJavaSourceAnalysisEngine(){
    protected Iterable<Entrypoint> makeDefaultEntrypoints(    AnalysisScope scope,    IClassHierarchy cha){
      return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
    }
  }
;
  try {
    engine.setExclusionsFile(FileProvider.getFileFromPlugin(CoreTestsPlugin.getDefault(),CallGraphTestUtil.REGRESSION_EXCLUSIONS).getAbsolutePath());
  }
 catch (  IOException e) {
    Assert.assertFalse("String_Node_Str",true);
  }
  return engine;
}
Program: 38498
Project: 38498
Buggy source:
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha,mainClassDescriptors);
}

Fixed version (ground truth):
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha,mainClassDescriptors);
}
Program: 38499
Project: 38499
Buggy source:
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference,IClassHierarchy cha,IClassLoader parent,AnalysisScope scope) throws IOException {
  if (classLoaderReference.equals(EclipseProjectPath.SOURCE_REF)) {
    ClassLoaderImpl cl=new JDTSourceLoaderImpl(classLoaderReference,parent,getExclusions(),cha);
    cl.init(scope.getModules(classLoaderReference));
    return cl;
  }
 else {
    return super.makeNewClassLoader(classLoaderReference,cha,parent,scope);
  }
}

Fixed version (ground truth):
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference,IClassHierarchy cha,IClassLoader parent,AnalysisScope scope) throws IOException {
  if (classLoaderReference.equals(JavaSourceAnalysisScope.SOURCE)) {
    ClassLoaderImpl cl=new JDTSourceLoaderImpl(classLoaderReference,parent,getExclusions(),cha);
    cl.init(scope.getModules(classLoaderReference));
    return cl;
  }
 else {
    return super.makeNewClassLoader(classLoaderReference,cha,parent,scope);
  }
}
Program: 38500
Project: 38500
Buggy source:
protected static void dumpIR(CallGraph cg,boolean assertReachable) throws IOException {
  Set<IMethod> unreachable=HashSetFactory.make();
  IClassHierarchy cha=cg.getClassHierarchy();
  IClassLoader sourceLoader=cha.getLoader(EclipseProjectPath.SOURCE_REF);
  for (Iterator iter=sourceLoader.iterateAllClasses(); iter.hasNext(); ) {
    IClass clazz=(IClass)iter.next();
    Trace.println(clazz);
    if (clazz.isInterface())     continue;
    for (    IMethod m : clazz.getDeclaredMethods()) {
      if (m.isAbstract()) {
        Trace.println(m);
      }
 else {
        Iterator nodeIter=cg.getNodes(m.getReference()).iterator();
        if (!nodeIter.hasNext()) {
          Trace.println("String_Node_Str" + m.getReference() + "String_Node_Str");
          unreachable.add(m);
          continue;
        }
        CGNode node=(CGNode)nodeIter.next();
        Trace.println(node.getIR());
      }
    }
  }
  if (assertReachable) {
    Assert.assertTrue("String_Node_Str" + unreachable.toString(),unreachable.isEmpty());
  }
}

Fixed version (ground truth):
protected static void dumpIR(CallGraph cg,boolean assertReachable) throws IOException {
  Set<IMethod> unreachable=HashSetFactory.make();
  IClassHierarchy cha=cg.getClassHierarchy();
  IClassLoader sourceLoader=cha.getLoader(JavaSourceAnalysisScope.SOURCE);
  for (Iterator iter=sourceLoader.iterateAllClasses(); iter.hasNext(); ) {
    IClass clazz=(IClass)iter.next();
    Trace.println(clazz);
    if (clazz.isInterface())     continue;
    for (    IMethod m : clazz.getDeclaredMethods()) {
      if (m.isAbstract()) {
        Trace.println(m);
      }
 else {
        Iterator nodeIter=cg.getNodes(m.getReference()).iterator();
        if (!nodeIter.hasNext()) {
          Trace.println("String_Node_Str" + m.getReference() + "String_Node_Str");
          unreachable.add(m);
          continue;
        }
        CGNode node=(CGNode)nodeIter.next();
        Trace.println(node.getIR());
      }
    }
  }
  if (assertReachable) {
    Assert.assertTrue("String_Node_Str" + unreachable.toString(),unreachable.isEmpty());
  }
}
Program: 38501
Project: 38501
Buggy source:
private MethodReference getSliceRootReference(String className,String methodName,String methodDescriptor){
  TypeName clsName=TypeName.string2TypeName("String_Node_Str" + className.replace('.','/'));
  TypeReference clsRef=TypeReference.findOrCreate(EclipseProjectPath.SOURCE_REF,clsName);
  Atom nameAtom=Atom.findOrCreateUnicodeAtom(methodName);
  Descriptor descr=Descriptor.findOrCreateUTF8(methodDescriptor);
  return MethodReference.findOrCreate(clsRef,nameAtom,descr);
}

Fixed version (ground truth):
private MethodReference getSliceRootReference(String className,String methodName,String methodDescriptor){
  TypeName clsName=TypeName.string2TypeName("String_Node_Str" + className.replace('.','/'));
  TypeReference clsRef=TypeReference.findOrCreate(JavaSourceAnalysisScope.SOURCE,clsName);
  Atom nameAtom=Atom.findOrCreateUnicodeAtom(methodName);
  Descriptor descr=Descriptor.findOrCreateUTF8(methodDescriptor);
  return MethodReference.findOrCreate(clsRef,nameAtom,descr);
}
Program: 38502
Project: 38502
Buggy source:
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(EclipseProjectPath.SOURCE_REF,cha);
}

Fixed version (ground truth):
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,IClassHierarchy cha){
  return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha);
}
Program: 38503
Project: 38503
Buggy source:
public ClassLoaderReference getSourceLoader(){
  return getLoader(EclipseProjectPath.SOURCE);
}

Fixed version (ground truth):
public ClassLoaderReference getSourceLoader(){
  return SOURCE;
}
Program: 38504
Project: 38504
Buggy source:
public JavaSourceAnalysisScope(Collection<Language> languages){
  super(languages);
  initForJava();
  EclipseProjectPath.SOURCE_REF.setParent(getLoader(APPLICATION));
  getLoader(SYNTHETIC).setParent(EclipseProjectPath.SOURCE_REF);
  loadersByName.put(EclipseProjectPath.SOURCE,EclipseProjectPath.SOURCE_REF);
  setLoaderImpl(getLoader(SYNTHETIC),"String_Node_Str");
  setLoaderImpl(EclipseProjectPath.SOURCE_REF,"String_Node_Str");
}

Fixed version (ground truth):
public JavaSourceAnalysisScope(Collection<Language> languages){
  super(languages);
  initForJava();
  loadersByName.put(SOURCE.getName(),SOURCE);
  setLoaderImpl(getLoader(SYNTH_SOURCE.getName()),"String_Node_Str");
  setLoaderImpl(SOURCE,"String_Node_Str");
}
Program: 38505
Project: 38505
Buggy source:
/** 
 * create a new field-element
 * @param fld - field element to serve as part of a path
 */
public FieldPathElement(IField fld){
  Assertions.precondition(fld != null,"String_Node_Str");
  this.fld=fld;
}

Fixed version (ground truth):
/** 
 * create a new field-element
 * @param fld - field element to serve as part of a path
 */
public FieldPathElement(IField fld){
  if (fld == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.fld=fld;
}
Program: 38506
Project: 38506
Buggy source:
/** 
 * create a new anchor element
 * @param lpk -anchor element to serve as head of path
 */
public LocalPathElement(AbstractPointerKey lpk){
  this.lpk=lpk;
  if (Assertions.verifyAssertions) {
    Assertions._assert(lpk != null);
  }
}

Fixed version (ground truth):
/** 
 * create a new anchor element
 * @param lpk - anchor element to serve as head of path
 */
public LocalPathElement(AbstractPointerKey lpk){
  this.lpk=lpk;
  if (lpk == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 38507
Project: 38507
Buggy source:
protected HeapGraph(PointerAnalysis pa){
  this.pa=pa;
}

Fixed version (ground truth):
protected HeapGraph(PointerAnalysis pa){
  if (pa == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.pa=pa;
}
Program: 38508
Project: 38508
Buggy source:
public FieldImpl(IClass declaringClass,FieldReference canonicalRef,int accessFlags,Collection<Annotation> annotations){
  this.declaringClass=declaringClass;
  this.fieldRef=canonicalRef;
  this.accessFlags=accessFlags;
  this.annotations=annotations;
  if (Assertions.verifyAssertions) {
    Assertions._assert(declaringClass != null);
    Assertions._assert(fieldRef != null);
  }
}

Fixed version (ground truth):
public FieldImpl(IClass declaringClass,FieldReference canonicalRef,int accessFlags,Collection<Annotation> annotations){
  this.declaringClass=declaringClass;
  this.fieldRef=canonicalRef;
  this.accessFlags=accessFlags;
  this.annotations=annotations;
  if (declaringClass == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (fieldRef == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 38510
Project: 38510
Buggy source:
private void resolvePluginClassPath(IProject p) throws CoreException, IOException {
  BundleDescription bd=findModel(p).getBundleDescription();
  resolveBundleDescriptionClassPath(bd,Loader.APPLICATION);
}

Fixed version (ground truth):
private void resolvePluginClassPath(IProject p) throws CoreException, IOException {
  BundleDescription bd=findModel(p).getBundleDescription();
  if (bd == null) {
    throw new IllegalStateException("String_Node_Str" + p);
  }
  resolveBundleDescriptionClassPath(bd,Loader.APPLICATION);
}
Program: 38511
Project: 38511
Buggy source:
/** 
 * If file extension is not provided, use system default
 * @throws JavaModelException
 * @throws IOException
 */
private void resolveProjectClasspathEntries() throws JavaModelException, IOException {
  resolveClasspathEntries(project.getRawClasspath(),Loader.EXTENSION);
}

Fixed version (ground truth):
private void resolveProjectClasspathEntries() throws JavaModelException, IOException {
  resolveClasspathEntries(project.getRawClasspath(),Loader.EXTENSION);
}
Program: 38512
Project: 38512
Buggy source:
@Override public int getNextD(int current,DIdentifier target,Random rand,Node[] nodes){
  double currentDist=this.idSpaceD.getPartitions()[current].distance(target);
  double minDist=this.idSpaceD.getMaxDistance();
  int minNode=-1;
  for (  int out : nodes[current].getOutgoingEdges()) {
    double dist=this.pD[out].distance(target);
    if (dist < minDist && !done[out]) {
      minDist=dist;
      minNode=out;
    }
  }
  if (minNode == -1 && from.containsKey(current)) {
    done[current]=true;
    return from.get(current);
  }
  if (minNode == -1) {
    return minNode;
  }
  if (!from.containsKey(minNode)) {
    from.put(minNode,current);
  }
  if (minDist >= currentDist) {
    done[current]=true;
  }
  return minNode;
}

Fixed version (ground truth):
@Override public int getNextD(int current,DIdentifier target,Random rand,Node[] nodes){
  if (!from.containsKey(current)) {
    from.put(current,-1);
  }
  double currentDist=this.idSpaceD.getPartitions()[current].distance(target);
  double minDist=this.idSpaceD.getMaxDistance();
  int minNode=-1;
  for (  int out : nodes[current].getOutgoingEdges()) {
    double dist=this.pD[out].distance(target);
    if (dist < minDist && !done[out]) {
      minDist=dist;
      minNode=out;
    }
  }
  if (minNode == -1 && from.containsKey(current)) {
    done[current]=true;
    return from.get(current);
  }
  if (minNode == -1) {
    return minNode;
  }
  if (!from.containsKey(minNode)) {
    from.put(minNode,current);
  }
  if (minDist >= currentDist) {
    done[current]=true;
  }
  return minNode;
}
Program: 38513
Project: 38513
Buggy source:
@Override public int getNextD(int current,DIdentifier target,Random rand,Node[] nodes){
  double currentDist=this.idSpaceD.getPartitions()[current].distance(target);
  double minDist=this.idSpaceD.getMaxDistance();
  int minNode=-1;
  for (  int out : nodes[current].getOutgoingEdges()) {
    double dist=this.pD[out].distance(target);
    if (dist < minDist && !done[out]) {
      minDist=dist;
      minNode=out;
    }
  }
  if (minNode == -1 && from.containsKey(current)) {
    return from.get(current);
  }
  if (minNode == -1) {
    return minNode;
  }
  if (!from.containsKey(minNode)) {
    from.put(minNode,current);
  }
  if (minDist >= currentDist) {
    done[current]=true;
  }
  return minNode;
}

Fixed version (ground truth):
@Override public int getNextD(int current,DIdentifier target,Random rand,Node[] nodes){
  double currentDist=this.idSpaceD.getPartitions()[current].distance(target);
  double minDist=this.idSpaceD.getMaxDistance();
  int minNode=-1;
  for (  int out : nodes[current].getOutgoingEdges()) {
    double dist=this.pD[out].distance(target);
    if (dist < minDist && !done[out]) {
      minDist=dist;
      minNode=out;
    }
  }
  if (minNode == -1 && from.containsKey(current)) {
    done[current]=true;
    return from.get(current);
  }
  if (minNode == -1) {
    return minNode;
  }
  if (!from.containsKey(minNode)) {
    from.put(minNode,current);
  }
  if (minDist >= currentDist) {
    done[current]=true;
  }
  return minNode;
}
Program: 38514
Project: 38514
Buggy source:
/** 
 * @return
 */
public String[] getConfigKeys();

Fixed version (ground truth):
/** 
 * Getter for all the configuration keys.
 * @return A string array containing all the configuration values.
 */
public String[] getConfigKeys();
Program: 38515
Project: 38515
Buggy source:
/** 
 * @return
 */
public String getKey();

Fixed version (ground truth):
/** 
 * Getter for the key of the particular placement model.
 * @return The key of the placement model.
 */
public String getKey();
Program: 38516
Project: 38516
Buggy source:
/** 
 * @return
 */
public double getHeight();

Fixed version (ground truth):
/** 
 * Getter for the height of the field in which the positions are to be determined.
 * @return The height of the field.
 */
public double getHeight();
Program: 38517
Project: 38517
Buggy source:
/** 
 * @return
 */
public String[] getConfigValues();

Fixed version (ground truth):
/** 
 * Getter for all the configuration values.
 * @return A string array containing all the configuration values.
 */
public String[] getConfigValues();
Program: 38518
Project: 38518
Buggy source:
/** 
 * @param hotspots
 * @return
 */
public Point[] place(int hotspots);

Fixed version (ground truth):
/** 
 * Finds and returns <code>number</code> positions.
 * @param number The number of positions to be returned.
 * @return An array of positions.
 */
public Point[] place(int number);
Program: 38519
Project: 38519
Buggy source:
/** 
 * @return
 */
public double getWidth();

Fixed version (ground truth):
/** 
 * Getter for the width of the field in which the positions are to be determined.
 * @return The width of the field.
 */
public double getWidth();
Program: 38520
Project: 38520
Buggy source:
public PlacementModelContainer(int nodes,int hotspots,PlacementModel hotspotPlacer,PlacementModel nodePlacer,Partitioner partitioner,NodeConnector nodeConnector,RoutingAlgorithm r,Transformation[] t){
  super("String_Node_Str",nodes,getConfigKeys(hotspotPlacer,nodePlacer,nodeConnector,partitioner),getConfigValues(hotspotPlacer,nodePlacer,nodeConnector,partitioner),r,t);
  this.nodes=nodes;
  this.hotspots=hotspots;
  this.hotspotPlacer=hotspotPlacer;
  this.nodePlacer=nodePlacer;
  this.partitioner=partitioner;
  this.connector=nodeConnector;
  idSpace=new PlaneIdentifierSpaceSimple(null,hotspotPlacer.getWidth(),hotspotPlacer.getHeight(),false);
}

Fixed version (ground truth):
/** 
 * Standard and only constructor for this class, gets all needed classes and all the needed information.
 * @param nodes The number of nodes in the network.
 * @param hotspots The number of hotspots in the network.
 * @param hotspotPlacer The <code>PlacementModel</code> used to place the hotspots.
 * @param nodePlacer The <code>PlacementModel</code> used to place the nodes within the hotspots.
 * @param partitioner The <code>Partitioner</code> used to determine how much nodes are placed in each hotspot.
 * @param nodeConnector The <code>NodeConnector</code> used to connect nodes depending on their position.
 * @param r The routing to be used in the network.
 * @param t The transformations that should be applied to the graph of the network.
 */
public PlacementModelContainer(int nodes,int hotspots,PlacementModel hotspotPlacer,PlacementModel nodePlacer,Partitioner partitioner,NodeConnector nodeConnector,RoutingAlgorithm r,Transformation[] t){
  super("String_Node_Str",nodes,getConfigKeys(hotspotPlacer,nodePlacer,nodeConnector,partitioner),getConfigValues(hotspotPlacer,nodePlacer,nodeConnector,partitioner),r,t);
  this.nodes=nodes;
  this.hotspots=hotspots;
  this.hotspotPlacer=hotspotPlacer;
  this.nodePlacer=nodePlacer;
  this.partitioner=partitioner;
  this.connector=nodeConnector;
  idSpace=new PlaneIdentifierSpaceSimple(null,hotspotPlacer.getWidth(),hotspotPlacer.getHeight(),false);
}
Program: 38521
Project: 38521
Buggy source:
/** 
 * @param hotspotPlacer
 * @param nodePlacer
 * @return
 */
private static String[] getConfigKeys(PlacementModel hotspotPlacer,PlacementModel nodePlacer,NodeConnector connector,Partitioner partitioner){
  return Util.mergeArrays(new String[]{getKey(hotspotPlacer,nodePlacer)},Util.mergeArrays(Util.addPrefix("String_Node_Str",partitioner.getConfigKeys()),Util.mergeArrays(Util.addPrefix("String_Node_Str",connector.getConfigKeys()),Util.mergeArrays(Util.addPrefix("String_Node_Str",hotspotPlacer.getConfigKeys()),Util.addPrefix("String_Node_Str",nodePlacer.getConfigKeys())))));
}

Fixed version (ground truth):
/** 
 * Constructs an array containing all the configuration keys used for the particular <code>PlacementModelContainer</code>. Basically combines all the configuration keys of both <code>PlacementModels</code> (prefixed by "HP_" and "NP_" respectively), the <code>Partitioner</code> (prefixed by "PART_") and the <code>NodeConnector</code> (prefixed by "NC_") into one big string array and adds "KEY" without a prefix to it.
 * @param hotspotPlacer The <code>PlacementModel</code> used to place the hotspots.
 * @param nodePlacer The <code>PlacementModel</code> used to place the nodes within the hotspots.
 * @param partitioner The <code>Partitioner</code> used to determine the number of nodes in each hotspot.
 * @param nodeConnector The <code>NodeConnector</code> used to connect the nodes after placing them.
 * @return A string array containg all the configuration keys.
 */
private static String[] getConfigKeys(PlacementModel hotspotPlacer,PlacementModel nodePlacer,NodeConnector connector,Partitioner partitioner){
  return Util.mergeArrays(new String[]{"String_Node_Str"},Util.mergeArrays(Util.addPrefix("String_Node_Str",partitioner.getConfigKeys()),Util.mergeArrays(Util.addPrefix("String_Node_Str",connector.getConfigKeys()),Util.mergeArrays(Util.addPrefix("String_Node_Str",hotspotPlacer.getConfigKeys()),Util.addPrefix("String_Node_Str",nodePlacer.getConfigKeys())))));
}
Program: 38522
Project: 38522
Buggy source:
/** 
 * @param hotspotPlacer
 * @param nodePlacer
 * @return
 */
private static String getKey(PlacementModel hotspotPlacer,PlacementModel nodePlacer){
  return "String_Node_Str" + hotspotPlacer.getKey() + "String_Node_Str"+ nodePlacer.getKey();
}

Fixed version (ground truth):
/** 
 * Constructs the key of this network, which will be HSM_<hotspotPlacer.getKey()>_<nodePlacer.getKey()>.
 * @param hotspotPlacer The <code>PlacementModel</code> used to place the hotspots.
 * @param nodePlacer The <code>PlacementModel</code> used to place the nodes within the hotspots.
 * @return The key of this network.
 */
private static String getKey(PlacementModel hotspotPlacer,PlacementModel nodePlacer){
  return "String_Node_Str" + hotspotPlacer.getKey() + "String_Node_Str"+ nodePlacer.getKey();
}
Program: 38523
Project: 38523
Buggy source:
/** 
 * @param hotspotPlacer
 * @param nodePlacer
 * @param partitioner2
 * @param nodeConnector
 * @return
 */
private static String[] getConfigValues(PlacementModel hotspotPlacer,PlacementModel nodePlacer,NodeConnector connector,Partitioner partitioner){
  return Util.mergeArrays(new String[]{"String_Node_Str"},Util.mergeArrays(partitioner.getConfigValues(),Util.mergeArrays(connector.getConfigValues(),Util.mergeArrays(hotspotPlacer.getConfigValues(),nodePlacer.getConfigValues()))));
}

Fixed version (ground truth):
/** 
 * Constructs an array containing all the configuration values used for the particular <code>PlacementModelContainer</code>. Basically combines all the configuration values of both <code>PlacementModels</code>, the <code>Partitioner</code> and the <code>NodeConnector</code> into one big string array and adds the key of the <code>PlacementModelContainer</code> to this array.
 * @param hotspotPlacer The <code>PlacementModel</code> used to place the hotspots.
 * @param nodePlacer The <code>PlacementModel</code> used to place the nodes within the hotspots.
 * @param partitioner The <code>Partitioner</code> used to determine the number of nodes in each hotspot.
 * @param nodeConnector The <code>NodeConnector</code> used to connect the nodes after placing them.
 * @return A string array containg all the configuration values.
 */
private static String[] getConfigValues(PlacementModel hotspotPlacer,PlacementModel nodePlacer,NodeConnector connector,Partitioner partitioner){
  return Util.mergeArrays(new String[]{getKey(hotspotPlacer,nodePlacer)},Util.mergeArrays(partitioner.getConfigValues(),Util.mergeArrays(connector.getConfigValues(),Util.mergeArrays(hotspotPlacer.getConfigValues(),nodePlacer.getConfigValues()))));
}
Program: 38524
Project: 38524
Buggy source:
@Override public Graph generate(){
  Point[] hotspotCoords=hotspotPlacer.place(hotspots);
  PlanePartitionSimple[] coords=new PlanePartitionSimple[nodes];
  int[] nodesPerSpot=partitioner.partition(nodes,hotspots);
  int temp=0;
  int curNodes;
  for (int i=0; i < hotspots; i++) {
    curNodes=nodesPerSpot[i];
    addNodeCoords(coords,nodePlacer.place(curNodes),hotspotCoords[i],temp);
    temp+=curNodes;
  }
  Graph g=new Graph(description());
  idSpace.setPartitions(coords);
  g.addProperty("String_Node_Str",idSpace);
  Node[] nodes=Node.init(this.nodes(),g);
  connector.connect(nodes,idSpace);
  g.setNodes(nodes);
  return g;
}

Fixed version (ground truth):
/** 
 * Creates the graph for this network by first placing the hotspots, then placing the nodes within those hotspots. The coordinates of the nodes are stored in an <code>IdentifierSpace</code>, which is added as "id_space_0" to the attributes of the graph. In the end, the nodes are connected based on that id-space.
 */
@Override public Graph generate(){
  Point[] hotspotCoords=hotspotPlacer.place(hotspots);
  PlanePartitionSimple[] coords=new PlanePartitionSimple[nodes];
  int[] nodesPerSpot=partitioner.partition(nodes,hotspots);
  int temp=0;
  int curNodes;
  for (int i=0; i < hotspots; i++) {
    curNodes=nodesPerSpot[i];
    addNodeCoords(coords,nodePlacer.place(curNodes),hotspotCoords[i],temp);
    temp+=curNodes;
  }
  Graph g=new Graph(description());
  idSpace.setPartitions(coords);
  g.addProperty("String_Node_Str",idSpace);
  Node[] nodes=Node.init(this.nodes(),g);
  connector.connect(nodes,idSpace);
  g.setNodes(nodes);
  return g;
}
Program: 38525
Project: 38525
Buggy source:
/** 
 * @param pps
 * @param nodeCoords
 * @param ds
 */
private void addNodeCoords(PlanePartitionSimple[] pps,Point[] nodeCoords,Point coordOffset,int arrayOffset){
  for (int i=0; i < nodeCoords.length; i++) {
    pps[i + arrayOffset]=new PlanePartitionSimple(new PlaneIdentifier(nodeCoords[i].getX() + coordOffset.getX(),nodeCoords[i].getY() + coordOffset.getY(),idSpace));
  }
}

Fixed version (ground truth):
/** 
 * Convenience method to convert all the node coordinates from <code>Point</code> objects to <code>PlanePartitionSimple</code> objects. In the process, the supplied offset is added to all those coordinates. Instead of returning a newly created array, the <code>PlanePartitionSimple</code>s are stored in the supplied array, starting from the supplied offset. If the array is shorter than required, an Exception will be thrown.
 * @param pps The array to which the resulting <code>PlanePartitionSimple</code>s are to be written, starting at <code>arrayOffset</code>.
 * @param nodeCoords The coordinates at which nodes are to be placed.
 * @param coordOffset The offset for the coordinates.
 * @param arrayOffset The offset for the array, pointing to the first EMPTY element.
 */
private void addNodeCoords(PlanePartitionSimple[] pps,Point[] nodeCoords,Point coordOffset,int arrayOffset){
  for (int i=0; i < nodeCoords.length; i++) {
    pps[i + arrayOffset]=new PlanePartitionSimple(new PlaneIdentifier(nodeCoords[i].getX() + coordOffset.getX(),nodeCoords[i].getY() + coordOffset.getY(),idSpace));
  }
}