nus-yam/ex-repair huggingface dataset:
Program: 1710
Project: 1710
Buggy source:
@Override public void initialize() throws InitializationException {
  Set<URL> licenseURLs=ClasspathHelper.forPackage(LICENSE_PACKAGE);
  Reflections reflections=new Reflections(new ConfigurationBuilder().setScanners(new ResourcesScanner()).setUrls(licenseURLs).filterInputsBy(new FilterBuilder.Include(FilterBuilder.prefix(LICENSE_PACKAGE))));
  for (  String licenseFile : reflections.getResources(Pattern.compile("String_Node_Str"))) {
    URL licenseUrl=getClass().getClassLoader().getResource(licenseFile);
    try {
      String path=decode(licenseUrl.getPath());
      String name=path.substring(path.lastIndexOf('/') + 1);
      name=name.substring(0,name.length() - "String_Node_Str".length());
      InputStream is=licenseUrl.openStream();
      try {
        List<String> content=IOUtils.readLines(is);
        ExtensionLicense license=new ExtensionLicense(name,content);
        List<String> aliases=new ArrayList<String>();
        aliases.add(name);
        for (        String line : content) {
          if (!line.startsWith(ALIAS_PREFIX)) {
            break;
          }
          aliases.add(line.substring(ALIAS_PREFIX.length()));
        }
        content=content.subList(aliases.size() - 1,content.size());
        for (        String alias : aliases) {
          this.licenses.put(alias.toLowerCase(),license);
        }
      }
  finally {
        is.close();
      }
    }
 catch (    Exception e) {
      this.logger.error("String_Node_Str" + licenseUrl + "String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void initialize() throws InitializationException {
  Set<URL> licenseURLs=ClasspathHelper.forPackage(LICENSE_PACKAGE);
  Reflections reflections=new Reflections(new ConfigurationBuilder().setScanners(new ResourcesScanner()).setUrls(licenseURLs).filterInputsBy(new FilterBuilder.Include(FilterBuilder.prefix(LICENSE_PACKAGE))));
  for (  String licenseFile : reflections.getResources(Pattern.compile("String_Node_Str"))) {
    URL licenseUrl=getClass().getClassLoader().getResource(licenseFile);
    try {
      String path=decode(licenseUrl.getPath());
      String name=path.substring(path.lastIndexOf('/') + 1);
      name=name.substring(0,name.length() - "String_Node_Str".length());
      InputStream is=licenseUrl.openStream();
      try {
        List<String> content=IOUtils.readLines(is);
        List<String> aliases=new ArrayList<String>();
        aliases.add(name);
        for (        String line : content) {
          if (!line.startsWith(ALIAS_PREFIX)) {
            break;
          }
          aliases.add(line.substring(ALIAS_PREFIX.length()));
        }
        content=content.subList(aliases.size() - 1,content.size());
        ExtensionLicense license=new ExtensionLicense(name,content);
        for (        String alias : aliases) {
          this.licenses.put(alias.toLowerCase(),license);
        }
      }
  finally {
        is.close();
      }
    }
 catch (    Exception e) {
      this.logger.error("String_Node_Str" + licenseUrl + "String_Node_Str",e);
    }
  }
}
Program: 1711
Project: 1711
Buggy source:
@Override public String toString(){
  StringBuilder buffer=new StringBuilder(super.toString());
  buffer.append("String_Node_Str").append(getImplementation().getName()).append("String_Node_Str");
  buffer.append("String_Node_Str").append(getInstantiationStrategy()).append("String_Node_Str");
  return buffer.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder buffer=new StringBuilder(super.toString());
  buffer.append("String_Node_Str").append(getImplementation() == null ? null : getImplementation().getName()).append("String_Node_Str");
  buffer.append("String_Node_Str").append(getInstantiationStrategy()).append("String_Node_Str");
  return buffer.toString();
}
Program: 1712
Project: 1712
Buggy source:
@Override public File getLocalRepository(){
  if (this.localRepository == null) {
    String localRepositoryPath=this.configurationSource.getProperty("String_Node_Str");
    if (localRepositoryPath == null) {
      this.localRepository=new File(getHome(),"String_Node_Str");
    }
 else {
      this.localRepository=new File(localRepositoryPath);
    }
  }
  System.out.println(this.localRepository.getAbsolutePath());
  return this.localRepository;
}

Fixed version (ground truth):
@Override public File getLocalRepository(){
  if (this.localRepository == null) {
    String localRepositoryPath=this.configurationSource.getProperty("String_Node_Str");
    if (localRepositoryPath == null) {
      this.localRepository=new File(getHome(),"String_Node_Str");
    }
 else {
      this.localRepository=new File(localRepositoryPath);
    }
  }
  return this.localRepository;
}
Program: 1713
Project: 1713
Buggy source:
/** 
 * Generate a DOM4J Document containing the generated XML.
 * @param files the list of files that we want to include in the generated package XML file.
 * @return the DOM4J Document containing the generated XML
 */
private Document toXML(Collection files){
  Document doc=new DOMDocument();
  Element docel=new DOMElement("String_Node_Str");
  doc.setRootElement(docel);
  Element infosel=new DOMElement("String_Node_Str");
  docel.add(infosel);
  Element el=new DOMElement("String_Node_Str");
  el.addText(this.project.getName());
  infosel.add(el);
  el=new DOMElement("String_Node_Str");
  el.addText(this.project.getDescription());
  infosel.add(el);
  el=new DOMElement("String_Node_Str");
  el.addText("String_Node_Str");
  infosel.add(el);
  el=new DOMElement("String_Node_Str");
  el.addText("String_Node_Str");
  infosel.add(el);
  el=new DOMElement("String_Node_Str");
  el.addText(this.project.getVersion());
  infosel.add(el);
  el=new DOMElement("String_Node_Str");
  el.addText("String_Node_Str");
  infosel.add(el);
  Element filesel=new DOMElement("String_Node_Str");
  docel.add(filesel);
  for (Iterator it=files.iterator(); it.hasNext(); ) {
    ArchiveEntry entry=(ArchiveEntry)it.next();
    if (entry.getFile().getPath().indexOf("String_Node_Str") == -1) {
      XWikiDocument xdoc=getDocFromXML(entry.getFile());
      if (xdoc != null) {
        String fullName=xdoc.getFullName();
        Element el2=new DOMElement("String_Node_Str");
        el2.setText(fullName);
        el2.addAttribute("String_Node_Str",xdoc.getLanguage());
        el2.addAttribute("String_Node_Str","String_Node_Str");
        filesel.add(el2);
      }
    }
  }
  return doc;
}

Fixed version (ground truth):
/** 
 * Generate a DOM4J Document containing the generated XML.
 * @param files the list of files that we want to include in the generated package XML file.
 * @return the DOM4J Document containing the generated XML
 */
private Document toXML(Collection files){
  Document doc=new DOMDocument();
  Element packageElement=new DOMElement("String_Node_Str");
  doc.setRootElement(packageElement);
  Element infoElement=new DOMElement("String_Node_Str");
  packageElement.add(infoElement);
  addInfoElements(infoElement);
  Element filesElement=new DOMElement("String_Node_Str");
  packageElement.add(filesElement);
  addFileElements(files,filesElement);
  return doc;
}
Program: 1714
Project: 1714
Buggy source:
/** 
 * Get the root uri for resources There are 3 conditions this will vary under: + the assets are in internal storage under the assets directory + the assets are on the sd card at a pre-specified location + the assets have been previously pulled via update
 * @return
 */
public String getAssetsBaseUrl(){
  String rootPath=getAssetsRootPath();
  if (shouldUseAssetsOrSdCard()) {
    if (assetsOnExternalStorage()) {
      return "String_Node_Str" + rootPath;
    }
    return "String_Node_Str" + rootPath;
  }
 else   return FileContentProvider.getBaseUri() + rootPath;
}

Fixed version (ground truth):
/** 
 * Get the root uri for resources There are 3 conditions this will vary under: + the assets are in internal storage under the assets directory + the assets are on the sd card at a pre-specified location + the assets have been previously pulled via update
 * @return
 */
public String getAssetsBaseUrl(){
  String rootPath=getAssetsRootPath();
  if (shouldUseAssetsOrSdCard()) {
    if (assetsOnExternalStorage()) {
      return "String_Node_Str" + rootPath;
    }
    return "String_Node_Str" + rootPath;
  }
 else   return rootPath;
}
Program: 1717
Project: 1717
Buggy source:
@Test public void adminTest() throws Exception {
  testLogin();
  testUpdateGlobalSettings();
  testAddApplication();
  testModifyApplication();
  testCreateApplicationVersion();
  testDeleteApplicationVersion();
  testCreateDeployments();
  testDeleteApplication();
}

Fixed version (ground truth):
@Test public void adminTest() throws Exception {
  testLogin();
  testUpdateGlobalSettings();
  testAddApplication();
  testModifyApplication();
  testCreateApplicationVersion();
  testDeleteApplicationVersion();
  testUpdateApplicationVersion();
  testCreateDeployments();
  testDeleteApplication();
}
Program: 1718
Project: 1718
Buggy source:
private <T extends ModelEntity>void _delete(T entity,List<ProcessingEvent> events) throws PersistenceException {
  this._refresh(entity);
  entity.remove();
  entityManager.remove(entity);
}

Fixed version (ground truth):
private <T extends ModelEntity>void _delete(T entity,List<ProcessingEvent> events) throws PersistenceException {
  entity.remove();
  entityManager.remove(entity);
}
Program: 1722
Project: 1722
Buggy source:
/** 
 * Loads MIB file or URL.
 * @param src            the MIB file or URL
 * @throws IOException if the MIB file couldn't be found in theMIB search path
 * @throws MibLoaderException if the MIB file couldn't be loadedcorrectly
 */
public void loadMib(String src) throws IOException, MibLoaderException {
  Mib mib=null;
  File file=new File(src);
  if (file.exists()) {
    if (loader.getMib(file) != null) {
      return;
    }
    if (!loader.hasDir(file.getParentFile())) {
      loader.removeAllDirs();
      loader.addDir(file.getParentFile());
    }
    mib=loader.load(file);
    addFilePref(file.getAbsolutePath());
  }
 else {
    mib=loader.load(src);
    addFilePref(src);
  }
  MibTreeBuilder.getInstance().addMib(mib);
}

Fixed version (ground truth):
/** 
 * Loads MIB file or URL.
 * @param src            the MIB file or URL
 * @throws IOException if the MIB file couldn't be found in theMIB search path
 * @throws MibLoaderException if the MIB file couldn't be loadedcorrectly
 */
public void loadMib(String src) throws IOException, MibLoaderException {
  Mib mib=null;
  File file=new File(src);
  if (loader.getMib(src) != null || loader.getMib(file) != null) {
    return;
  }
 else   if (file.exists()) {
    if (!loader.hasDir(file.getParentFile())) {
      loader.removeAllDirs();
      loader.addDir(file.getParentFile());
    }
    mib=loader.load(file);
    addFilePref(file.getAbsolutePath());
  }
 else {
    mib=loader.load(src);
    addFilePref(src);
  }
  MibTreeBuilder.getInstance().addMib(mib);
}
Program: 1723
Project: 1723
Buggy source:
/** 
 * Initializes the MIB value. This will remove all levels of indirection present, such as references to other values. No value information is lost by this operation. This method may modify this object as a side-effect, and will return the basic value.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @param type           the value type
 * @return the basic MIB value
 * @throws MibException if an error was encountered during theinitialization
 */
public MibValue initialize(MibLoaderLog log,MibType type) throws MibException {
  ValueReference ref=null;
  ObjectIdentifierValue oid;
  if (parent == null) {
    return this;
  }
 else   if (parent instanceof ValueReference) {
    ref=(ValueReference)parent;
  }
  parent=parent.initialize(log,type);
  if (ref != null) {
    if (parent instanceof ObjectIdentifierValue) {
      oid=(ObjectIdentifierValue)parent;
      oid.addChild(log,location,this);
    }
 else {
      throw new MibException(ref.getLocation(),"String_Node_Str" + "String_Node_Str");
    }
  }
  location=null;
  if (parent instanceof ObjectIdentifierValue) {
    return ((ObjectIdentifierValue)parent).getChildByValue(value);
  }
 else {
    return this;
  }
}

Fixed version (ground truth):
/** 
 * Initializes the MIB value. This will remove all levels of indirection present, such as references to other values. No value information is lost by this operation. This method may modify this object as a side-effect, and will return the basic value.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @param type           the value type
 * @return the basic MIB value
 * @throws MibException if an error was encountered during theinitialization
 */
public MibValue initialize(MibLoaderLog log,MibType type) throws MibException {
  ValueReference ref=null;
  ObjectIdentifierValue oid;
  if (parent == null) {
    return this;
  }
 else   if (parent instanceof ValueReference) {
    ref=(ValueReference)parent;
  }
  parent=parent.initialize(log,type);
  if (ref != null) {
    if (parent instanceof ObjectIdentifierValue) {
      oid=(ObjectIdentifierValue)parent;
      oid.addChild(log,location,this);
    }
 else {
      throw new MibException(ref.getLocation(),"String_Node_Str" + "String_Node_Str");
    }
  }
  location=null;
  cachedNumericValue=null;
  if (parent instanceof ObjectIdentifierValue) {
    return ((ObjectIdentifierValue)parent).getChildByValue(value);
  }
 else {
    return this;
  }
}
Program: 1724
Project: 1724
Buggy source:
/** 
 * Parses the MIB input source and returns the MIB modules found. This method will read the MIB either from file, URL or input stream.
 * @param loader         the MIB loader to use for imports
 * @param log            the MIB log to use for errors
 * @return the list of MIB modules created
 * @throws IOException if the MIB couldn't be found
 * @throws MibLoaderException if the MIB couldn't be parsedor analyzed correctly
 */
public ArrayList parseMib(MibLoader loader,MibLoaderLog log) throws IOException, MibLoaderException {
  MibAnalyzer analyzer;
  String msg;
  if (input != null) {
  }
 else   if (url != null) {
    input=new InputStreamReader(url.openStream());
  }
 else {
    input=new FileReader(file);
  }
  analyzer=new MibAnalyzer(file,loader,log);
  try {
    if (parser == null) {
      parser=new Asn1Parser(input,analyzer);
      parser.getTokenizer().setUseTokenList(true);
    }
 else {
      parser.reset(input,analyzer);
    }
    parser.parse();
    return analyzer.getMibs();
  }
 catch (  ParserCreationException e) {
    msg="String_Node_Str" + e.getMessage();
    log.addInternalError(file,msg);
    throw new MibLoaderException(log);
  }
catch (  ParserLogException e) {
    log.addAll(file,e);
    throw new MibLoaderException(log);
  }
 finally {
    analyzer.reset();
  }
}

Fixed version (ground truth):
/** 
 * Parses the MIB input source and returns the MIB modules found. This method will read the MIB either from file, URL or input stream.
 * @param loader         the MIB loader to use for imports
 * @param log            the MIB log to use for errors
 * @return the list of MIB modules created
 * @throws IOException if the MIB couldn't be found
 * @throws MibLoaderException if the MIB couldn't be parsedor analyzed correctly
 */
public ArrayList parseMib(MibLoader loader,MibLoaderLog log) throws IOException, MibLoaderException {
  MibAnalyzer analyzer;
  String msg;
  if (input != null) {
  }
 else   if (url != null) {
    input=new InputStreamReader(url.openStream());
  }
 else {
    input=new FileReader(file);
  }
  analyzer=new MibAnalyzer(file,loader,log);
  try {
    if (parser == null) {
      parser=new Asn1Parser(input,analyzer);
      parser.getTokenizer().setUseTokenList(true);
    }
 else {
      parser.reset(input,analyzer);
    }
    parser.parse();
    return analyzer.getMibs();
  }
 catch (  ParserCreationException e) {
    msg="String_Node_Str" + e.getMessage();
    log.addInternalError(file,msg);
    throw new MibLoaderException(log);
  }
catch (  ParserLogException e) {
    log.addAll(file,e);
    throw new MibLoaderException(log);
  }
 finally {
    try {
      input.close();
    }
 catch (    Throwable ignore) {
    }
    analyzer.reset();
  }
}
Program: 1725
Project: 1725
Buggy source:
/** 
 * Removes the specified number of leading spaces from a string. All tab characters in the string will be converted to spaces before processing. If the string�contains fewer than the specified number of leading spaces, all will be removed. If the indentation count is less than zero (0), all leading spaces in the input string will be removed.
 * @param str            the input string
 * @param indent         the indentation space count
 * @return the unindented string
 */
private static String removeIndent(String str,int indent){
  int pos=0;
  str=replaceTabs(str);
  if (indent < 0) {
    return str.trim();
  }
  for (pos=0; pos < str.length() && pos < indent; pos++) {
    if (str.charAt(pos) != ' ') {
      break;
    }
  }
  return str.substring(pos);
}

Fixed version (ground truth):
/** 
 * Removes the specified number of leading spaces from a string. All tab characters in the string will be converted to spaces before processing. If the string contains fewer than the specified number of leading spaces, all will be removed. If the indentation count is less than zero (0), all leading spaces in the input string will be removed.
 * @param str            the input string
 * @param indent         the indentation space count
 * @return the unindented string
 */
private static String removeIndent(String str,int indent){
  int pos=0;
  str=replaceTabs(str);
  if (indent < 0) {
    return str.trim();
  }
  for (pos=0; pos < str.length() && pos < indent; pos++) {
    if (str.charAt(pos) != ' ') {
      break;
    }
  }
  return str.substring(pos);
}
Program: 1726
Project: 1726
Buggy source:
private int getByteSize(Constraint c){
  ArrayList list;
  ValueConstraint value;
  int size;
  if (c instanceof CompoundConstraint) {
    list=((CompoundConstraint)c).getConstraintList();
    for (int i=0; i < list.size(); i++) {
      size=getByteSize((Constraint)list.get(i));
      if (size > 0) {
        return size;
      }
    }
  }
 else   if (c instanceof SizeConstraint) {
    value=(ValueConstraint)((SizeConstraint)c).getValues().get(0);
    if (value.getValue().toObject() instanceof Number) {
      return ((Number)value.getValue().toObject()).intValue();
    }
  }
  return -1;
}

Fixed version (ground truth):
private int getByteSize(Constraint c){
  ArrayList list;
  MibValue value;
  int size;
  if (c instanceof CompoundConstraint) {
    list=((CompoundConstraint)c).getConstraintList();
    for (int i=0; i < list.size(); i++) {
      size=getByteSize((Constraint)list.get(i));
      if (size > 0) {
        return size;
      }
    }
  }
 else   if (c instanceof SizeConstraint) {
    c=(Constraint)((SizeConstraint)c).getValues().get(0);
    value=null;
    if (c instanceof ValueConstraint) {
      value=((ValueConstraint)c).getValue();
    }
 else     if (c instanceof ValueRangeConstraint) {
      value=((ValueRangeConstraint)c).getLowerBound();
    }
    if (value != null && value.toObject() instanceof Number) {
      return ((Number)value.toObject()).intValue();
    }
  }
  return -1;
}
Program: 1727
Project: 1727
Buggy source:
private int getByteSize(Constraint c){
  ArrayList list;
  ValueConstraint value;
  int size;
  if (c instanceof CompoundConstraint) {
    list=((CompoundConstraint)c).getConstraintList();
    for (int i=0; i < list.size(); i++) {
      size=getByteSize((Constraint)list.get(i));
      if (size >= 0) {
        return size;
      }
    }
  }
 else   if (c instanceof SizeConstraint) {
    value=(ValueConstraint)((SizeConstraint)c).getValues().get(0);
    if (value.getValue().toObject() instanceof Number) {
      return ((Number)value.getValue().toObject()).intValue();
    }
  }
  return -1;
}

Fixed version (ground truth):
private int getByteSize(Constraint c){
  ArrayList list;
  MibValue value;
  int size;
  if (c instanceof CompoundConstraint) {
    list=((CompoundConstraint)c).getConstraintList();
    for (int i=0; i < list.size(); i++) {
      size=getByteSize((Constraint)list.get(i));
      if (size >= 0) {
        return size;
      }
    }
  }
 else   if (c instanceof SizeConstraint) {
    c=(Constraint)((SizeConstraint)c).getValues().get(0);
    value=null;
    if (c instanceof ValueConstraint) {
      value=((ValueConstraint)c).getValue();
    }
 else     if (c instanceof ValueRangeConstraint) {
      value=((ValueRangeConstraint)c).getLowerBound();
    }
    if (value != null && value.toObject() instanceof Number) {
      return ((Number)value.toObject()).intValue();
    }
  }
  return -1;
}
Program: 1728
Project: 1728
Buggy source:
/** 
 * Finds the first SNMP textual convention reference for a type. If the type specified is a textual convention, it will be returned directly.
 * @param type           the MIB type
 * @return the SNMP textual convention reference, ornull if none was found
 * @since 2.7
 */
public static SnmpTextualConvention findReference(MibType type){
  MibTypeSymbol sym;
  if (type instanceof SnmpTextualConvention) {
    return (SnmpTextualConvention)type;
  }
  sym=type.getReferenceSymbol();
  if (sym == null) {
    return null;
  }
 else {
    return findReference(sym.getType());
  }
}

Fixed version (ground truth):
/** 
 * Finds the first SNMP textual convention reference for a type. If the type specified is a textual convention, it will be returned directly.
 * @param type           the MIB type
 * @return the SNMP textual convention reference, ornull if none was found
 * @since 2.7
 */
public static SnmpTextualConvention findReference(MibType type){
  MibTypeSymbol sym;
  if (type instanceof SnmpObjectType) {
    type=((SnmpObjectType)type).getSyntax();
  }
  if (type instanceof SnmpTextualConvention) {
    return (SnmpTextualConvention)type;
  }
  sym=type.getReferenceSymbol();
  return (sym == null) ? null : findReference(sym.getType());
}
Program: 1729
Project: 1729
Buggy source:
/** 
 * Unloads a MIB. This method will remove the loader reference to a previously loaded MIB if no other MIBs are depending on it. This method does not free the memory used by the MIB, but only releases all the loader references (thereby allowing the garbage collector to recover the memory used by the MIB).
 * @param mib            the MIB
 * @throws MibLoaderException if the MIB couldn't be unloadeddue to dependencies from other loaded MIBs
 * @see #reset
 * @since 2.3
 */
public void unload(Mib mib) throws MibLoaderException {
  Mib referer;
  String message;
  int pos;
  pos=mibs.indexOf(mib);
  if (pos >= 0) {
    for (int i=0; i < mibs.size(); i++) {
      referer=(Mib)mibs.get(i);
      if (referer.getImport(mib.getName()) != null) {
        message="String_Node_Str" + referer;
        throw new MibLoaderException(mib.getFile(),message);
      }
    }
    mibs.remove(pos);
  }
}

Fixed version (ground truth):
/** 
 * Unloads a MIB. This method will remove the loader reference to a previously loaded MIB if no other MIBs are depending on it. This method does not free the memory used by the MIB, but only releases all the loader references (thereby allowing the garbage collector to recover the memory used by the MIB).
 * @param mib            the MIB
 * @throws MibLoaderException if the MIB couldn't be unloadeddue to dependencies from other loaded MIBs
 * @see #reset
 * @since 2.3
 */
public void unload(Mib mib) throws MibLoaderException {
  Mib referer;
  String message;
  int pos;
  pos=mibs.indexOf(mib);
  if (pos >= 0) {
    for (int i=0; i < mibs.size(); i++) {
      referer=(Mib)mibs.get(i);
      if (referer.getImport(mib.getName()) != null) {
        message="String_Node_Str" + referer;
        throw new MibLoaderException(mib.getFile(),message);
      }
    }
    mib=(Mib)mibs.remove(pos);
    mib.clear();
  }
}
Program: 1730
Project: 1730
Buggy source:
/** 
 * Sets the symbol connected to this object identifier. This method is called during the value symbol initialization.
 * @param symbol         the value symbol
 */
public void setSymbol(MibValueSymbol symbol){
  if (name == null) {
    name=symbol.getName();
  }
  this.symbol=symbol;
}

Fixed version (ground truth):
/** 
 * Sets the symbol connected to this object identifier.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param symbol         the value symbol
 */
public void setSymbol(MibValueSymbol symbol){
  if (name == null) {
    name=symbol.getName();
  }
  this.symbol=symbol;
}
Program: 1731
Project: 1731
Buggy source:
/** 
 * Creates a new SNMP module compliance declaration.
 * @param group          the group compliance flag
 * @param value          the compliance value
 * @param syntax         the value syntax, or null
 * @param writeSyntax    the value write syntax, or null
 * @param access         the access mode, or null
 * @param description    the compliance description
 */
public SnmpCompliance(boolean group,MibValue value,MibType syntax,MibType writeSyntax,SnmpAccess access,String description){
  this.value=value;
  this.syntax=syntax;
  this.writeSyntax=writeSyntax;
  this.access=access;
  this.description=description;
}

Fixed version (ground truth):
/** 
 * Creates a new SNMP module compliance declaration.
 * @param group          the group compliance flag
 * @param value          the compliance value
 * @param syntax         the value syntax, or null
 * @param writeSyntax    the value write syntax, or null
 * @param access         the access mode, or null
 * @param description    the compliance description
 */
public SnmpCompliance(boolean group,MibValue value,MibType syntax,MibType writeSyntax,SnmpAccess access,String description){
  this.group=group;
  this.value=value;
  this.syntax=syntax;
  this.writeSyntax=writeSyntax;
  this.access=access;
  this.description=description;
}
Program: 1732
Project: 1732
Buggy source:
/** 
 * Initializes the MIB symbol. This will remove all levels of indirection present, such as references to types or values. No information is lost by this operation. This method may modify this object as a side-effect.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @throws MibException if an error was encountered during theinitialization
 */
public void initialize(MibLoaderLog log) throws MibException {
  if (type != null) {
    type=type.initialize(this,log);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the MIB symbol. This will remove all levels of indirection present, such as references to types or values. No information is lost by this operation. This method may modify this object as a side-effect.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @throws MibException if an error was encountered during theinitialization
 */
public void initialize(MibLoaderLog log) throws MibException {
  if (type != null) {
    try {
      type=type.initialize(this,log);
    }
 catch (    MibException e) {
      log.addError(e.getLocation(),e.getMessage());
      type=null;
    }
  }
}
Program: 1733
Project: 1733
Buggy source:
/** 
 * Initializes the MIB symbol. This will remove all levels of indirection present, such as references to types or values. No information is lost by this operation. This method may modify this object as a side-effect.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @throws MibException if an error was encountered during theinitialization
 */
public void initialize(MibLoaderLog log) throws MibException {
  ObjectIdentifierValue oid;
  if (type != null) {
    type=type.initialize(this,log);
  }
  if (value != null) {
    value=value.initialize(log);
  }
  if (type != null && value != null && !type.isCompatible(value)) {
    throw new MibException(getLocation(),"String_Node_Str");
  }
  if (value instanceof ObjectIdentifierValue) {
    oid=(ObjectIdentifierValue)value;
    if (oid.getSymbol() == null) {
      oid.setSymbol(this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Initializes the MIB symbol. This will remove all levels of indirection present, such as references to types or values. No information is lost by this operation. This method may modify this object as a side-effect.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @throws MibException if an error was encountered during theinitialization
 */
public void initialize(MibLoaderLog log) throws MibException {
  ObjectIdentifierValue oid;
  if (type != null) {
    try {
      type=type.initialize(this,log);
    }
 catch (    MibException e) {
      log.addError(e.getLocation(),e.getMessage());
      type=null;
    }
  }
  if (value != null) {
    try {
      value=value.initialize(log);
    }
 catch (    MibException e) {
      log.addError(e.getLocation(),e.getMessage());
      value=null;
    }
  }
  if (type != null && value != null && !type.isCompatible(value)) {
    log.addError(getLocation(),"String_Node_Str");
  }
  if (value instanceof ObjectIdentifierValue) {
    oid=(ObjectIdentifierValue)value;
    if (oid.getSymbol() == null) {
      oid.setSymbol(this);
    }
  }
}
Program: 1734
Project: 1734
Buggy source:
/** 
 * Initializes the MIB type. This will remove all levels of indirection present, such as references to types or values. No information is lost by this operation. This method may modify this object as a side-effect, and will return the basic type.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param symbol         the MIB symbol containing this type
 * @param log            the MIB loader log
 * @return the basic MIB type
 * @throws MibException if an error was encountered during theinitialization
 * @since 2.2
 */
public MibType initialize(MibSymbol symbol,MibLoaderLog log) throws MibException {
  base=base.initialize(symbol,log);
  if (constraint != null) {
    constraint.initialize(this,log);
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Initializes the MIB type. This will remove all levels of indirection present, such as references to types or values. No information is lost by this operation. This method may modify this object as a side-effect, and will return the basic type.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param symbol         the MIB symbol containing this type
 * @param log            the MIB loader log
 * @return the basic MIB type
 * @throws MibException if an error was encountered during theinitialization
 * @since 2.2
 */
public MibType initialize(MibSymbol symbol,MibLoaderLog log) throws MibException {
  base=base.initialize(symbol,log);
  if (base != null && constraint != null) {
    constraint.initialize(this,log);
  }
  return this;
}
Program: 1735
Project: 1735
Buggy source:
/** 
 * Initializes the referenced MIB type symbol. This will remove all levels of indirection present, such as references to other types, and returns the basic type. This method will add any constraints or defined values if possible.
 * @param symbol         the MIB symbol containing this type
 * @param log            the MIB loader log
 * @param ref            the referenced MIB type symbol
 * @return the basic MIB type
 * @throws MibException if an error was encountered during theinitialization
 */
private MibType initializeReference(MibSymbol symbol,MibLoaderLog log,MibTypeSymbol ref) throws MibException {
  MibType type=ref.getType();
  type=type.initialize(symbol,log);
  try {
    if (constraint != null) {
      type=type.createReference(constraint);
    }
 else     if (values != null) {
      type=type.createReference(values);
    }
 else {
      type=type.createReference();
    }
    type=type.initialize(symbol,log);
  }
 catch (  UnsupportedOperationException e) {
    throw new MibException(location,e.getMessage());
  }
  type.setReferenceSymbol(ref);
  initializeTypeTag(type,tag);
  return type;
}

Fixed version (ground truth):
/** 
 * Initializes the referenced MIB type symbol. This will remove all levels of indirection present, such as references to other types, and returns the basic type. This method will add any constraints or defined values if possible.
 * @param symbol         the MIB symbol containing this type
 * @param log            the MIB loader log
 * @param ref            the referenced MIB type symbol
 * @return the basic MIB type
 * @throws MibException if an error was encountered during theinitialization
 */
private MibType initializeReference(MibSymbol symbol,MibLoaderLog log,MibTypeSymbol ref) throws MibException {
  MibType type=ref.getType();
  if (type != null) {
    type=type.initialize(symbol,log);
  }
  if (type == null) {
    return null;
  }
  try {
    if (constraint != null) {
      type=type.createReference(constraint);
    }
 else     if (values != null) {
      type=type.createReference(values);
    }
 else {
      type=type.createReference();
    }
    type=type.initialize(symbol,log);
  }
 catch (  UnsupportedOperationException e) {
    throw new MibException(location,e.getMessage());
  }
  type.setReferenceSymbol(ref);
  initializeTypeTag(type,tag);
  return type;
}
Program: 1737
Project: 1737
Buggy source:
/** 
 * Creates a new log entry.
 * @param type           the log entry type
 * @param location       the log entry file reference
 * @param message        the log entry message
 */
public LogEntry(int type,FileLocation location,String message){
  this.type=type;
  this.location=location;
  this.message=message;
}

Fixed version (ground truth):
/** 
 * Creates a new log entry.
 * @param type           the log entry type
 * @param location       the log entry file reference
 * @param message        the log entry message
 */
public LogEntry(int type,FileLocation location,String message){
  this.type=type;
  if (location == null || location.getFile() == null) {
    this.location=new FileLocation(new File("String_Node_Str"));
  }
 else {
    this.location=location;
  }
  this.message=message;
}
Program: 1738
Project: 1738
Buggy source:
/** 
 * Transfers the contents of one object identifier to another one. The transfer can only be made under certain conditions, for example that no children OID:s conflict. It is also assumed that the two OID:s have the name numerical value.
 * @param location       the file location on error
 * @param src            the source OID value
 * @param dest           the destination OID value
 * @return the destination object identifier value
 * @throws MibException if the transfer couldn't be performed dueto some conflict or invalid state
 */
private ObjectIdentifierValue transfer(FileLocation location,ObjectIdentifierValue src,ObjectIdentifierValue dest) throws MibException {
  ObjectIdentifierValue child;
  if (dest.name == null) {
    dest.name=src.name;
  }
 else   if (src.name != null && !src.name.equals(dest.name)) {
    throw new MibException(location,"String_Node_Str" + "String_Node_Str");
  }
  if (src.symbol != null) {
    throw new MibException(location,"String_Node_Str" + "String_Node_Str");
  }
  for (int i=0; i < src.children.size(); i++) {
    child=(ObjectIdentifierValue)src.children.get(i);
    child.parent=dest;
    dest.addChild(location,child);
  }
  src.children.clear();
  return dest;
}

Fixed version (ground truth):
/** 
 * Transfers the contents of one object identifier to another one. The transfer can only be made under certain conditions, for example that no children OID:s conflict. It is also assumed that the two OID:s have the name numerical value.
 * @param location       the file location on error
 * @param src            the source OID value
 * @param dest           the destination OID value
 * @return the destination object identifier value
 * @throws MibException if the transfer couldn't be performed dueto some conflict or invalid state
 */
private ObjectIdentifierValue transfer(FileLocation location,ObjectIdentifierValue src,ObjectIdentifierValue dest) throws MibException {
  ObjectIdentifierValue child;
  if (dest.name == null) {
    dest.name=src.name;
  }
 else   if (src.name != null && !src.name.equals(dest.name)) {
    throw new MibException(location,"String_Node_Str" + "String_Node_Str");
  }
  if (src.symbol != null) {
    throw new MibException(location,"String_Node_Str" + "String_Node_Str");
  }
  for (int i=0; i < src.children.size(); i++) {
    child=(ObjectIdentifierValue)src.children.get(i);
    child.parent=dest;
    dest.addChild(location,child);
  }
  src.children=null;
  return dest;
}
Program: 1739
Project: 1739
Buggy source:
/** 
 * Initializes the MIB value. This will remove all levels of indirection present, such as references to other values. No value information is lost by this operation. This method may modify this object as a side-effect, and will return the basic value.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @return the basic MIB value
 * @throws MibException if an error was encountered during theinitialization
 */
public MibValue initialize(MibLoaderLog log) throws MibException {
  ValueReference ref=null;
  ObjectIdentifierValue result=this;
  if (parent == null) {
    return this;
  }
 else   if (parent instanceof ValueReference) {
    ref=(ValueReference)parent;
  }
  parent=parent.initialize(log);
  if (ref != null) {
    if (parent instanceof ObjectIdentifierValue) {
      result=(ObjectIdentifierValue)parent;
      result=result.addChild(location,this);
    }
 else {
      throw new MibException(ref.getLocation(),"String_Node_Str" + "String_Node_Str");
    }
  }
  location=null;
  return result;
}

Fixed version (ground truth):
/** 
 * Initializes the MIB value. This will remove all levels of indirection present, such as references to other values. No value information is lost by this operation. This method may modify this object as a side-effect, and will return the basic value.<p> <strong>NOTE:</strong> This is an internal method that should only be called by the MIB loader.
 * @param log            the MIB loader log
 * @return the basic MIB value
 * @throws MibException if an error was encountered during theinitialization
 */
public MibValue initialize(MibLoaderLog log) throws MibException {
  ValueReference ref=null;
  ObjectIdentifierValue oid;
  if (parent == null) {
    return this;
  }
 else   if (parent instanceof ValueReference) {
    ref=(ValueReference)parent;
  }
  parent=parent.initialize(log);
  if (ref != null) {
    if (parent instanceof ObjectIdentifierValue) {
      oid=(ObjectIdentifierValue)parent;
      oid.addChild(location,this);
    }
 else {
      throw new MibException(ref.getLocation(),"String_Node_Str" + "String_Node_Str");
    }
  }
  location=null;
  if (parent instanceof ObjectIdentifierValue) {
    return ((ObjectIdentifierValue)parent).getChildByValue(value);
  }
 else {
    return this;
  }
}
Program: 1740
Project: 1740
Buggy source:
/** 
 * Creates a type symbol and adds it to the MIB. Also removes this node from the parse tree.
 * @param node           the node being exited
 * @return the node to add to the parse tree
 * @throws ParseException if the node analysis discovered errors
 */
protected Node exitTypeAssignment(Production node) throws ParseException {
  String name;
  MibType type;
  MibTypeSymbol symbol;
  name=getStringValue(getChildAt(node,0),0);
  if (mib.getSymbol(name) != null) {
    throw new ParseException(ParseException.ANALYSIS_ERROR,"String_Node_Str" + name + "String_Node_Str",node.getStartLine(),node.getStartColumn());
  }
  if (!Character.isUpperCase(name.charAt(0))) {
    log.addWarning(getLocation(node),"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
  }
  type=(MibType)getValue(getChildAt(node,2),0);
  symbol=new MibTypeSymbol(getLocation(node),mib,name,type);
  return null;
}

Fixed version (ground truth):
/** 
 * Creates a type symbol and adds it to the MIB. Also removes this node from the parse tree.
 * @param node           the node being exited
 * @return the node to add to the parse tree
 * @throws ParseException if the node analysis discovered errors
 */
protected Node exitTypeAssignment(Production node) throws ParseException {
  String name;
  MibType type;
  name=getStringValue(getChildAt(node,0),0);
  if (mib.getSymbol(name) != null) {
    throw new ParseException(ParseException.ANALYSIS_ERROR,"String_Node_Str" + name + "String_Node_Str",node.getStartLine(),node.getStartColumn());
  }
  if (!Character.isUpperCase(name.charAt(0))) {
    log.addWarning(getLocation(node),"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
  }
  type=(MibType)getValue(getChildAt(node,2),0);
  new MibTypeSymbol(getLocation(node),mib,name,type);
  return null;
}
Program: 1741
Project: 1741
Buggy source:
/** 
 * Creates a value symbol and adds it to the MIB. Also removes this node from the parse tree.
 * @param node           the node being exited
 * @return the node to add to the parse tree
 * @throws ParseException if the node analysis discovered errors
 */
protected Node exitValueAssignment(Production node) throws ParseException {
  MibValueSymbol symbol;
  String name;
  MibType type;
  MibValue value;
  name=getStringValue(getChildAt(node,0),0);
  if (mib.getSymbol(name) != null) {
    throw new ParseException(ParseException.ANALYSIS_ERROR,"String_Node_Str" + name + "String_Node_Str",node.getStartLine(),node.getStartColumn());
  }
  if (!Character.isLowerCase(name.charAt(0))) {
    log.addWarning(getLocation(node),"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
  }
  type=(MibType)getValue(getChildAt(node,1),0);
  value=(MibValue)getValue(getChildAt(node,3),0);
  symbol=new MibValueSymbol(getLocation(node),mib,name,type,value);
  return null;
}

Fixed version (ground truth):
/** 
 * Creates a value symbol and adds it to the MIB. Also removes this node from the parse tree.
 * @param node           the node being exited
 * @return the node to add to the parse tree
 * @throws ParseException if the node analysis discovered errors
 */
protected Node exitValueAssignment(Production node) throws ParseException {
  String name;
  MibType type;
  MibValue value;
  name=getStringValue(getChildAt(node,0),0);
  if (mib.getSymbol(name) != null) {
    throw new ParseException(ParseException.ANALYSIS_ERROR,"String_Node_Str" + name + "String_Node_Str",node.getStartLine(),node.getStartColumn());
  }
  if (!Character.isLowerCase(name.charAt(0))) {
    log.addWarning(getLocation(node),"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
  }
  type=(MibType)getValue(getChildAt(node,1),0);
  value=(MibValue)getValue(getChildAt(node,3),0);
  new MibValueSymbol(getLocation(node),mib,name,type,value);
  return null;
}
Program: 1742
Project: 1742
Buggy source:
/** 
 * Returns a previously loaded MIB file. If the MIB file hasn't been loaded, null will be returned. The MIB is identified by it's MIB name (i.e. the module name).
 * @param name           the MIB (module) name
 * @return the MIB module if found, ornull otherwise
 */
public Mib getMib(String name){
  Mib mib;
  for (int i=0; i < mibs.size(); i++) {
    mib=(Mib)mibs.get(i);
    if (name.equals(mib.getName())) {
      return mib;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a previously loaded MIB file. If the MIB file hasn't been loaded, null will be returned. The MIB is identified by it's file name.
 * @param file           the MIB file
 * @return the MIB module if found, ornull otherwise
 * @since 2.3
 */
public Mib getMib(File file){
  Mib mib;
  for (int i=0; i < mibs.size(); i++) {
    mib=(Mib)mibs.get(i);
    if (mib.equals(file)) {
      return mib;
    }
  }
  return null;
}
Program: 1743
Project: 1743
Buggy source:
/** 
 * Schedules the loading of a MIB. The MIB source is added to the queue of MIB:s to be loaded, unless it is already loaded or in the queue.
 * @param src            the MIB source
 */
void scheduleLoad(MibSource src){
  if (!mibs.contains(src.getFile()) && !queue.contains(src)) {
    queue.add(src);
  }
}

Fixed version (ground truth):
/** 
 * Schedules the loading of a MIB. The MIB source is added to the queue of MIB:s to be loaded, unless it is already loaded or in the queue.
 * @param src            the MIB source
 */
private void scheduleLoad(MibSource src){
  if (!mibs.contains(src.getFile()) && !queue.contains(src)) {
    queue.add(src);
  }
}
Program: 1744
Project: 1744
Buggy source:
/** 
 * Returns a value symbol from this MIB.
 * @param value          the symbol value
 * @return the MIB value symbol, or null if not found
 */
public MibValueSymbol getSymbolByValue(MibValue value){
  return (MibValueSymbol)symbolValueMap.get(value);
}

Fixed version (ground truth):
/** 
 * Returns a value symbol from this MIB.
 * @param value          the symbol value
 * @return the MIB value symbol, or null if not found
 */
public MibValueSymbol getSymbolByValue(MibValue value){
  return (MibValueSymbol)symbolValueMap.get(value.toString());
}
Program: 1745
Project: 1745
Buggy source:
/** 
 * Validates the MIB file. This will resolve all type and value references in the MIB symbols, while also validating them for consistency. Note that this method shouldn't be called until all referenced MIB files (and their respective references)  have been initialized.
 * @throws MibLoaderException if the MIB file couldn't be analyzed correctly
 * @see #initialize()
 */
void validate() throws MibLoaderException {
  MibSymbol symbol;
  MibValueSymbol value;
  int errors=log.errorCount();
  for (int i=0; i < symbolList.size(); i++) {
    symbol=(MibSymbol)symbolList.get(i);
    try {
      symbol.initialize(log);
    }
 catch (    MibException e) {
      log.addError(e.getLocation(),e.getMessage());
    }
    if (symbol instanceof MibValueSymbol) {
      value=(MibValueSymbol)symbol;
      if (value.getValue() instanceof NumberValue || value.getValue() instanceof ObjectIdentifierValue) {
        symbolValueMap.put(value.getValue(),value);
      }
    }
  }
  if (errors != log.errorCount()) {
    throw new MibLoaderException(log);
  }
}

Fixed version (ground truth):
/** 
 * Validates the MIB file. This will resolve all type and value references in the MIB symbols, while also validating them for consistency. Note that this method shouldn't be called until all referenced MIB files (and their respective references)  have been initialized.
 * @throws MibLoaderException if the MIB file couldn't be analyzed correctly
 * @see #initialize()
 */
void validate() throws MibLoaderException {
  MibSymbol symbol;
  MibValueSymbol value;
  int errors=log.errorCount();
  for (int i=0; i < symbolList.size(); i++) {
    symbol=(MibSymbol)symbolList.get(i);
    try {
      symbol.initialize(log);
    }
 catch (    MibException e) {
      log.addError(e.getLocation(),e.getMessage());
    }
    if (symbol instanceof MibValueSymbol) {
      value=(MibValueSymbol)symbol;
      if (value.getValue() instanceof NumberValue || value.getValue() instanceof ObjectIdentifierValue) {
        symbolValueMap.put(value.getValue().toString(),symbol);
      }
    }
  }
  if (errors != log.errorCount()) {
    throw new MibLoaderException(log);
  }
}
Program: 1746
Project: 1746
Buggy source:
/** 
 * List albums with filter
 * @param filter
 */
public static void list(String filter){
  List<Album> albums=Album.findAll(filter);
  render(albums);
}

Fixed version (ground truth):
/** 
 * List albums
 */
public static void list(){
  List<Album> albums=Album.all().fetch(100);
  render(albums);
}
Program: 1747
Project: 1747
Buggy source:
/** 
 * Update album
 * @param id
 */
@Check("String_Node_Str") public static void form(Long id){
  Album album=Album.findById(id);
  Artist artist=album.artist;
  render(album,artist);
}

Fixed version (ground truth):
/** 
 * Update album
 * @param id
 */
@Check("String_Node_Str") public static void form(Long id){
  Album album=Album.findById(id);
  Artist artist=album.artist;
  render("String_Node_Str",album,artist);
}