nus-yam/ex-repair huggingface dataset:
Program: 179658
Project: 179658
Buggy source:
private java.sql.Driver getRealDriver(String url,Properties info) throws SQLException {
  java.sql.Driver drv=null;
  try {
    drv=DriverManager.getDriver(url);
  }
 catch (  SQLException e) {
  }
  if (drv == null && info != null && info.keySet().contains(REAL_DRIVER)) {
    drv=registerDriver(info.getProperty(REAL_DRIVER));
  }
  int i=url.indexOf(':',5);
  if (drv == null && i > -1) {
    drv=registerDriver(drivers.getProperty(url.substring(5,i - 1)));
  }
  if (drv == null) {
    Pattern re=Pattern.compile("String_Node_Str" + REAL_DRIVER + "String_Node_Str");
    Matcher matcher=re.matcher(url);
    if (matcher.lookingAt()) {
      drv=registerDriver(matcher.group(1).trim());
    }
  }
  if (drv == null) {
    throw new SQLException("String_Node_Str");
  }
  return drv;
}

Fixed version (ground truth):
private java.sql.Driver getRealDriver(String url,Properties info) throws SQLException {
  java.sql.Driver drv=null;
  try {
    drv=DriverManager.getDriver(url);
  }
 catch (  SQLException e) {
  }
  if (drv == null && info != null && info.keySet().contains(REAL_DRIVER)) {
    drv=registerDriver(info.getProperty(REAL_DRIVER));
  }
  int i=url.indexOf(':',5);
  if (drv == null && i > -1) {
    drv=registerDriver(drivers.getProperty(url.substring(5,i - 1)));
  }
  if (drv == null) {
    Matcher matcher=REAL_DRIVER_PATTERN.matcher(url);
    if (matcher.find()) {
      drv=registerDriver(matcher.group(1));
    }
  }
  if (drv == null) {
    throw new SQLException("String_Node_Str");
  }
  return drv;
}
Program: 179659
Project: 179659
Buggy source:
/** 
 * Class constructor. It loads well known driver list from resource file drivers.properties.
 */
public Driver(){
  try {
    drivers.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("String_Node_Str"));
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
/** 
 * Class constructor. It loads well known driver list from resource file drivers.properties.
 */
public Driver(){
  try {
    InputStream stream=null;
    try {
      stream=Thread.currentThread().getContextClassLoader().getResourceAsStream("String_Node_Str");
      drivers.load(stream);
    }
  finally {
      if (stream != null) {
        stream.close();
      }
    }
  }
 catch (  IOException e) {
  }
}
Program: 179660
Project: 179660
Buggy source:
/** 
 * Opens new Simon proxy driver connection associated with real connection to specified database.
 * @param url jdbc connection string (i.e. jdbc:simon:h2:file:test)
 * @param info properties for connection
 * @return open connection to database or null if provided url is not accepted by this driver
 * @throws SQLException if there is no real driver registered/recognized or opening real connection fails
 * @see org.javasimon.jdbc.Driver
 */
public Connection connect(String url,Properties info) throws SQLException {
  if (!acceptsURL(url)) {
    return null;
  }
  String realUrl=url.replaceFirst(SIMON_JDBC,"String_Node_Str");
  java.sql.Driver driver=getRealDriver(realUrl,info);
  return new org.javasimon.jdbc.Connection(driver.connect(realUrl,info),DEFAULT_PREFIX);
}

Fixed version (ground truth):
/** 
 * Opens new Simon proxy driver connection associated with real connection to specified database.
 * @param url	jdbc connection string (i.e. jdbc:simon:h2:file:test)
 * @param info properties for connection
 * @return open connection to database or null if provided url is not accepted by this driver
 * @throws SQLException if there is no real driver registered/recognized or opening real connection fails
 * @see org.javasimon.jdbc.Driver
 */
public Connection connect(String url,Properties info) throws SQLException {
  if (!acceptsURL(url)) {
    return null;
  }
  String realUrl=url.replaceFirst(SIMON_JDBC,"String_Node_Str");
  java.sql.Driver driver=getRealDriver(realUrl,info);
  return new org.javasimon.jdbc.Connection(driver.connect(realUrl,info),DEFAULT_PREFIX);
}
Program: 179661
Project: 179661
Buggy source:
private static void printSimon(int level,Simon simon){
  for (int i=0; i < level; i++) {
    System.out.print("String_Node_Str");
  }
  System.out.println(localName(simon.getName()) + "String_Node_Str" + (simon.isEnabled() ? '+' : '-')+ "String_Node_Str"+ simon);
}

Fixed version (ground truth):
private static void printSimon(int level,Simon simon,StringBuilder sb){
  for (int i=0; i < level; i++) {
    sb.append("String_Node_Str");
  }
  sb.append(localName(simon.getName())).append('(').append(simon.isEnabled() ? '+' : '-').append("String_Node_Str").append(simon.toString()).append('\n');
}
Program: 179662
Project: 179662
Buggy source:
private static void printSimonTree(int level,Simon simon){
  printSimon(level,simon);
  for (  Simon child : simon.getChildren()) {
    printSimonTree(level + 1,child);
  }
}

Fixed version (ground truth):
private static void printSimonTree(int level,Simon simon,StringBuilder sb){
  printSimon(level,simon,sb);
  for (  Simon child : simon.getChildren()) {
    printSimonTree(level + 1,child,sb);
  }
}
Program: 179663
Project: 179663
Buggy source:
/** 
 * @see org.javakontor.sherlog.application.action.Action#execute()
 */
public void execute(){
  if (isActive()) {
    activate();
  }
 else {
    deactivate();
  }
}

Fixed version (ground truth):
/** 
 * @see org.javakontor.sherlog.application.action.Action#execute()
 */
public void execute(){
  if (!isActive()) {
    activate();
    setActive(true);
  }
 else {
    deactivate();
    setActive(false);
  }
}
Program: 179664
Project: 179664
Buggy source:
@Override public void onModelChanged(ModelChangedEvent<LogEventFilterModel,LogEventFilterModelReasonForChange> event){
switch (event.getReasonForChange()) {
case filterAdded:
{
      createEditor((LogEventFilter)event.getObjects()[0]);
      break;
    }
case filterRemoved:
{
    disposeEditor((LogEventFilter)event.getObjects()[0]);
    break;
  }
case factoryAdded:
{
  handleFactoryAdded((FilterConfigurationEditorFactory)event.getObjects()[0]);
  break;
}
case factoryRemoved:
{
removedFactory((FilterConfigurationEditorFactory)event.getObjects()[0]);
break;
}
case factoryManagerAdded:
{
for (LogEventFilter logEventFilter : getModel().getLogEventFilter()) {
createEditor(logEventFilter);
}
break;
}
case factoryManagerRemoved:
{
for (LogEventFilter logEventFilter : getModel().getLogEventFilter()) {
disposeEditor(logEventFilter);
}
break;
}
default :
break;
}
}

Fixed version (ground truth):
@Override public void onModelChanged(ModelChangedEvent<LogEventFilterModel,LogEventFilterModelReasonForChange> event){
  try {
switch (event.getReasonForChange()) {
case filterAdded:
{
        createEditor((LogEventFilter)event.getObjects()[0]);
        break;
      }
case filterRemoved:
{
      disposeEditor((LogEventFilter)event.getObjects()[0]);
      break;
    }
case factoryAdded:
{
    handleFactoryAdded((FilterConfigurationEditorFactory)event.getObjects()[0]);
    break;
  }
case factoryRemoved:
{
  removedFactory((FilterConfigurationEditorFactory)event.getObjects()[0]);
  break;
}
case factoryManagerAdded:
{
for (LogEventFilter logEventFilter : getModel().getLogEventFilter()) {
  createEditor(logEventFilter);
}
break;
}
case factoryManagerRemoved:
{
for (LogEventFilter logEventFilter : getModel().getLogEventFilter()) {
disposeEditor(logEventFilter);
}
break;
}
default :
break;
}
}
 catch (Exception e) {
}
}
Program: 179665
Project: 179665
Buggy source:
public void run(){
switch (event.getType()) {
case BundleEvent.INSTALLED:
    fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
  break;
case BundleEvent.UNINSTALLED:
removeBundle(event.getBundle());
fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
break;
default :
fireModelChangedEvent(BundleListModelReasonForChange.bundleStateChanged,getBundles().indexOf(event.getBundle()));
break;
}
}

Fixed version (ground truth):
public void run(){
switch (event.getType()) {
case BundleEvent.INSTALLED:
    addBundle(event.getBundle());
  fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
break;
case BundleEvent.UNINSTALLED:
removeBundle(event.getBundle());
fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
break;
default :
fireModelChangedEvent(BundleListModelReasonForChange.bundleStateChanged,getBundles().indexOf(event.getBundle()));
break;
}
}
Program: 179666
Project: 179666
Buggy source:
public void bundleChanged(final BundleEvent event){
  GuiExecutor.execute(new Runnable(){
    public void run(){
switch (event.getType()) {
case BundleEvent.INSTALLED:
        fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
      break;
case BundleEvent.UNINSTALLED:
    removeBundle(event.getBundle());
  fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
break;
default :
fireModelChangedEvent(BundleListModelReasonForChange.bundleStateChanged,getBundles().indexOf(event.getBundle()));
break;
}
}
}
);
}

Fixed version (ground truth):
public void bundleChanged(final BundleEvent event){
  GuiExecutor.execute(new Runnable(){
    public void run(){
switch (event.getType()) {
case BundleEvent.INSTALLED:
        addBundle(event.getBundle());
      fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
    break;
case BundleEvent.UNINSTALLED:
  removeBundle(event.getBundle());
fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
break;
default :
fireModelChangedEvent(BundleListModelReasonForChange.bundleStateChanged,getBundles().indexOf(event.getBundle()));
break;
}
}
}
);
}
Program: 179667
Project: 179667
Buggy source:
public BundleListModel(BundleContext bundleContext){
  super();
  this._bundleContext=bundleContext;
  this._bundles=new HashMap<Long,Bundle>();
  this._selectedBundle=null;
  this._bundleListener=new BundleListener(){
    public void bundleChanged(    final BundleEvent event){
      GuiExecutor.execute(new Runnable(){
        public void run(){
switch (event.getType()) {
case BundleEvent.INSTALLED:
            fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
          break;
case BundleEvent.UNINSTALLED:
        removeBundle(event.getBundle());
      fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
    break;
default :
  fireModelChangedEvent(BundleListModelReasonForChange.bundleStateChanged,getBundles().indexOf(event.getBundle()));
break;
}
}
}
);
}
}
;
this._bundleContext.addBundleListener(this._bundleListener);
Bundle[] bundles=this._bundleContext.getBundles();
for (Bundle bundle : bundles) {
addBundle(bundle);
}
_serviceListener=new ServiceListener(){
public void serviceChanged(ServiceEvent event){
updateStatusMessage();
}
}
;
this._bundleContext.addServiceListener(_serviceListener);
}

Fixed version (ground truth):
public BundleListModel(BundleContext bundleContext){
  super();
  this._bundleContext=bundleContext;
  this._bundles=new HashMap<Long,Bundle>();
  this._selectedBundle=null;
  this._bundleListener=new BundleListener(){
    public void bundleChanged(    final BundleEvent event){
      GuiExecutor.execute(new Runnable(){
        public void run(){
switch (event.getType()) {
case BundleEvent.INSTALLED:
            addBundle(event.getBundle());
          fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
        break;
case BundleEvent.UNINSTALLED:
      removeBundle(event.getBundle());
    fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
  break;
default :
fireModelChangedEvent(BundleListModelReasonForChange.bundleStateChanged,getBundles().indexOf(event.getBundle()));
break;
}
}
}
);
}
}
;
this._bundleContext.addBundleListener(this._bundleListener);
Bundle[] bundles=this._bundleContext.getBundles();
for (Bundle bundle : bundles) {
addBundle(bundle);
}
_serviceListener=new ServiceListener(){
public void serviceChanged(ServiceEvent event){
updateStatusMessage();
}
}
;
this._bundleContext.addServiceListener(_serviceListener);
}
Program: 179668
Project: 179668
Buggy source:
public void installNewBundle(File file){
  URI uri=file.toURI();
  try {
    Bundle installedBundle=_bundleContext.installBundle(uri.toString());
    setSelectedBundle(installedBundle);
  }
 catch (  BundleException ex) {
    _logger.error("String_Node_Str" + uri.toString() + "String_Node_Str"+ ex,ex);
    sendErrorStatusMessage("String_Node_Str" + ex);
  }
}

Fixed version (ground truth):
public void installNewBundle(File file){
  URI uri=file.toURI();
  try {
    Bundle installedBundle=_bundleContext.installBundle(uri.toString());
    installedBundle.start();
    setSelectedBundle(installedBundle);
    fireModelChangedEvent(BundleListModelReasonForChange.bundleListChanged);
  }
 catch (  BundleException ex) {
    _logger.error("String_Node_Str" + uri.toString() + "String_Node_Str"+ ex,ex);
    sendErrorStatusMessage("String_Node_Str" + ex);
  }
}
Program: 179670
Project: 179670
Buggy source:
@DataBoundConstructor public SSOKerberosSecurityRealm(String kdc,String realm){
}

Fixed version (ground truth):
@DataBoundConstructor public SSOKerberosSecurityRealm(String kdc,String realm){
  this.realm=realm;
  this.kdc=kdc;
  try {
    setUpKerberos();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  try {
    PluginServletFilter.addFilter(new KerberosAuthenticationFilter(authenticator));
    setUpKerberos();
  }
 catch (  ServletException e) {
    e.printStackTrace();
  }
catch (  LoginException e) {
    e.printStackTrace();
  }
catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  GSSException e) {
    e.printStackTrace();
  }
catch (  PrivilegedActionException e) {
    e.printStackTrace();
  }
catch (  URISyntaxException e) {
    e.printStackTrace();
  }
}
Program: 179671
Project: 179671
Buggy source:
private void setUpKerberos(){
}

Fixed version (ground truth):
private void setUpKerberos() throws LoginException, FileNotFoundException, GSSException, PrivilegedActionException, URISyntaxException {
  try {
    createConfigFiles();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  Map<String,String> props=new HashMap<String,String>();
  props.put("String_Node_Str",Hudson.getInstance().getRootDir().getPath() + "String_Node_Str");
  props.put("String_Node_Str",Hudson.getInstance().getRootDir().getPath() + "String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  authenticator=new SpnegoAuthenticator(props);
  System.setProperty("String_Node_Str",realm);
  System.setProperty("String_Node_Str",kdc);
  System.setProperty("String_Node_Str","String_Node_Str");
  System.setProperty("String_Node_Str","String_Node_Str");
  System.setProperty("String_Node_Str",Hudson.getInstance().getRootDir().getPath() + "String_Node_Str");
  System.setProperty("String_Node_Str","String_Node_Str");
  System.setProperty("String_Node_Str",Hudson.getInstance().getRootDir().getPath() + "String_Node_Str");
}
Program: 179672
Project: 179672
Buggy source:
private void createConfigFiles() throws IOException {
}

Fixed version (ground truth):
private void createConfigFiles() throws IOException {
  File krbConf=new File(Hudson.getInstance().getRootDir().getPath() + "String_Node_Str");
  if (!krbConf.exists()) {
    krbConf.createNewFile();
    FileWriter writer=new FileWriter(krbConf);
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.flush();
    writer.close();
  }
  File jaasConf=new File(Hudson.getInstance().getRootDir().getPath() + "String_Node_Str");
  if (!jaasConf.exists()) {
    jaasConf.createNewFile();
    FileWriter writer=new FileWriter(jaasConf);
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.write("String_Node_Str");
    writer.flush();
    writer.close();
  }
}
Program: 179674
Project: 179674
Buggy source:
public void onTaskPostExecute(byte[] buffer){
  hideLoading();
  String xml="String_Node_Str";
  try {
    xml=new String(buffer,MENU_XML_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
    showError(R.string.err_exception);
    e.printStackTrace();
    L.e("String_Node_Str",e);
  }
  if ("String_Node_Str".equals(xml)) {
    showError(R.string.err_network);
    return;
  }
  saveXML(xml);
  parseMenu();
  showMenu();
}

Fixed version (ground truth):
public void onTaskPostExecute(byte[] buffer){
  hideLoading();
  if (buffer == null) {
    showError(R.string.err_network);
    return;
  }
  String xml="String_Node_Str";
  try {
    xml=new String(buffer,MENU_XML_ENCODING);
  }
 catch (  UnsupportedEncodingException e) {
    showError(R.string.err_exception);
    e.printStackTrace();
    L.e("String_Node_Str",e);
  }
  if ("String_Node_Str".equals(xml)) {
    showError(R.string.err_network);
    return;
  }
  saveXML(xml);
  parseMenu();
  showMenu();
}
Program: 179675
Project: 179675
Buggy source:
protected void onBackPressed(){
  L.d("String_Node_Str");
switch (currentScreen) {
case MENU:
    L.d("String_Node_Str");
  finish();
break;
case DAY_MENU:
switchToScreen(Screen.MENU);
break;
}
}

Fixed version (ground truth):
public void onBackPressed(){
  L.d("String_Node_Str");
switch (currentScreen) {
case MENU:
    L.d("String_Node_Str");
  finish();
break;
case DAY_MENU:
switchToScreen(Screen.MENU);
break;
}
}
Program: 179676
Project: 179676
Buggy source:
/** 
 * Checks if the value of the holder matches the ValueType.
 * @throws IllegalArgumentException if the value doesn't match the type 
 */
protected void typeCheck(){
  IllegalArgumentException e=new IllegalArgumentException("String_Node_Str" + this.value + "String_Node_Str"+ this.type.name());
  if (this.type.equals(ValueType.STRING)) {
    if (!(this.value instanceof String)) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.INTEGER) || this.type.equals(ValueType.REAL)) {
    if (!(this.value instanceof Number)) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.DATE)) {
    if (!(this.value instanceof Date)) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.BLOB)) {
    if (!(this.value instanceof Blob)) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.BINARY)) {
    if (!(this.value instanceof byte[])) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.BOOLEAN)) {
    if (!(this.value instanceof Boolean)) {
      throw e;
    }
  }
}

Fixed version (ground truth):
/** 
 * Checks if the value of the holder matches the ValueType.
 * @throws IllegalArgumentException if the value doesn't match the type
 */
protected void typeCheck(){
  IllegalArgumentException e=new IllegalArgumentException("String_Node_Str" + this.value + "String_Node_Str"+ this.type.name());
  if (this.type.equals(ValueType.STRING)) {
    if (!(this.value instanceof String)) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.INTEGER) || this.type.equals(ValueType.REAL)) {
    if (!(this.value instanceof Number)) {
      throw e;
    }
    if (this.type.equals(ValueType.INTEGER)) {
      if (((Number)this.value).longValue() != ((Number)this.value).doubleValue()) {
        throw e;
      }
    }
  }
 else   if (this.type.equals(ValueType.DATE)) {
    if (!(this.value instanceof Date)) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.BLOB)) {
    if (!(this.value instanceof Blob)) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.BINARY)) {
    if (!(this.value instanceof byte[])) {
      throw e;
    }
  }
 else   if (this.type.equals(ValueType.BOOLEAN)) {
    if (!(this.value instanceof Boolean)) {
      throw e;
    }
  }
}
Program: 179677
Project: 179677
Buggy source:
@Override public BigInteger getBigInt(BigInteger defaultValue){
  try {
    if (this.value instanceof BigInteger) {
      return (BigInteger)this.value;
    }
 else     if (getType().equals(ValueType.BOOLEAN)) {
      return ((Boolean)this.value).booleanValue() ? BigInteger.ONE : BigInteger.ZERO;
    }
 else     if (getType().equals(ValueType.BINARY) || getType().equals(ValueType.BLOB)) {
      byte[] bytes=getBytes();
      return new BigInteger(bytes);
    }
 else     if (getType().equals(ValueType.STRING)) {
      return new BigInteger(this.value.toString());
    }
 else {
      long l=0;
      if (getType().equals(ValueType.INTEGER) || getType().equals(ValueType.REAL)) {
        l=((Number)this.value).longValue();
      }
 else       if (getType().equals(ValueType.DATE)) {
        l=((Date)this.value).getTime();
      }
 else {
        return defaultValue;
      }
      return new BigInteger(String.valueOf(l));
    }
  }
 catch (  NumberFormatException e) {
  }
  return defaultValue;
}

Fixed version (ground truth):
@Override public BigInteger getBigInt(BigInteger defaultValue){
  try {
    if (this.value instanceof BigInteger) {
      return (BigInteger)this.value;
    }
 else     if (getType().equals(ValueType.BOOLEAN)) {
      return ((Boolean)this.value).booleanValue() ? BigInteger.ONE : BigInteger.ZERO;
    }
 else     if (getType().equals(ValueType.BINARY) || getType().equals(ValueType.BLOB)) {
      byte[] bytes=getBytes();
      return new BigInteger(bytes);
    }
 else     if (getType().equals(ValueType.STRING)) {
      return new BigInteger(this.value.toString());
    }
 else {
      long l=0;
      if (getType().equals(ValueType.INTEGER) || getType().equals(ValueType.REAL)) {
        l=((Number)this.value).longValue();
      }
 else       if (getType().equals(ValueType.DATE)) {
        l=((Date)this.value).getTime();
      }
 else {
        return defaultValue;
      }
      return BigInteger.valueOf(l);
    }
  }
 catch (  NumberFormatException e) {
  }
  return defaultValue;
}
Program: 179678
Project: 179678
Buggy source:
/** 
 * Sets the yaml dumper options. <p> By default it's block style, 4 spaces ident.
 * @param options  yaml dumper options
 */
public void setDumperOptions(DumperOptions options){
  this.options=options;
}

Fixed version (ground truth):
/** 
 * Sets the yaml dumper options. <p> By default it's block style, 4 spaces ident.
 * @param options  yaml dumper options
 * @return         this
 */
public Settings setDumperOptions(DumperOptions options){
  this.options=options;
  return this;
}
Program: 179679
Project: 179679
Buggy source:
/** 
 * NOT IMPLEMENTED YET! Sets the state of multi-document option (off by default). <p> This option allows to read multiple yaml documents from one file (separated by   {@code ---}).
 * @param multiDocument  true to turn on, false to turn off
 */
public void setMultiDocument(boolean multiDocument){
  this.multiDocument=multiDocument;
}

Fixed version (ground truth):
/** 
 * NOT IMPLEMENTED YET! Sets the state of multi-document option (off by default). <p> This option allows to read multiple yaml documents from one file (separated by   {@code ---}).
 * @param multiDocument  true to turn on, false to turn off
 * @return               this
 */
public Settings setMultiDocument(boolean multiDocument){
  this.multiDocument=multiDocument;
  return this;
}
Program: 179680
Project: 179680
Buggy source:
/** 
 * Sets the path separator to be used (default   {@code "."}).
 * @param separator  the path separator
 */
public void setSeparator(String separator){
  this.separator=separator;
}

Fixed version (ground truth):
/** 
 * Sets the path separator to be used (default   {@code "."}).
 * @param separator  the path separator
 * @return           this
 */
public Settings setSeparator(String separator){
  this.separator=separator;
  return this;
}
Program: 179681
Project: 179681
Buggy source:
/** 
 * Sets the yaml representer to be used (  {@link EmptyNullRepresenter} by default).
 * @param representer  the yaml representer
 */
public void setRepresenter(Representer representer){
  this.representer=representer;
}

Fixed version (ground truth):
/** 
 * Sets the yaml representer to be used (  {@link EmptyNullRepresenter} by default).
 * @param representer  the yaml representer
 * @return             this
 */
public Settings setRepresenter(Representer representer){
  this.representer=representer;
  return this;
}
Program: 179682
Project: 179682
Buggy source:
/** 
 * Sets the state of case-sensitive option (off by default). <p> If this option is on, node names will be case-sensitive.
 * @param caseSensitive  true to turn on, false to turn off
 */
public void setCaseSensitive(boolean caseSensitive){
  this.caseSensitive=caseSensitive;
}

Fixed version (ground truth):
/** 
 * Sets the state of case-sensitive option (off by default). <p> If this option is on, node names will be case-sensitive.
 * @param caseSensitive  true to turn on, false to turn off
 * @return               this
 */
public Settings setCaseSensitive(boolean caseSensitive){
  this.caseSensitive=caseSensitive;
  return this;
}
Program: 179683
Project: 179683
Buggy source:
/** 
 * Sets the yaml resolver to be used (  {@link Resolver} by default).
 * @param resolver  the yaml resolver
 */
public void setResolver(Resolver resolver){
  this.resolver=resolver;
}

Fixed version (ground truth):
/** 
 * Sets the yaml resolver to be used (  {@link Resolver} by default).
 * @param resolver  the yaml resolver
 * @return          this
 */
public Settings setResolver(Resolver resolver){
  this.resolver=resolver;
  return this;
}
Program: 179684
Project: 179684
Buggy source:
/** 
 * Sets the yaml constructor to be used (  {@link Constructor} by default).
 * @param constructor  the yaml constructor
 */
public void setConstructor(BaseConstructor constructor){
  this.constructor=constructor;
}

Fixed version (ground truth):
/** 
 * Sets the yaml constructor to be used (  {@link Constructor} by default).
 * @param constructor  the yaml constructor
 * @return             this
 */
public Settings setConstructor(BaseConstructor constructor){
  this.constructor=constructor;
  return this;
}
Program: 179685
Project: 179685
Buggy source:
/** 
 * Sets the logging manager to be used. <p> By default it's   {@code new LoggingManager("CraftFire.YamlManager", "[YamlManager]")}.
 * @param logger                   the logging manager
 * @throws IllegalArgumentException if the logger is null
 */
public void setLogger(LoggingManager logger){
  if (logger == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.logger=logger;
}

Fixed version (ground truth):
/** 
 * Sets the logging manager to be used. <p> By default it's   {@code new LoggingManager("CraftFire.YamlManager", "[YamlManager]")}.
 * @param logger                   the logging manager
 * @return                          this
 * @throws IllegalArgumentException if the logger is null
 */
public Settings setLogger(LoggingManager logger){
  if (logger == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.logger=logger;
  return this;
}
Program: 179686
Project: 179686
Buggy source:
/** 
 * Returns map of child nodes of this map node.
 * @return               a map of child nodes
 * @throws YamlException if the node is not a map
 */
public Map<String,YamlNode> getChildrenMap() throws YamlException {
  if (!isMap()) {
    throw new YamlException("String_Node_Str",getPath());
  }
  if (!this.resolved) {
    this.mapCache=new HashMap<String,YamlNode>();
    for (    Map.Entry<?,?> entry : ((Map<?,?>)getValue()).entrySet()) {
      String name=normalizePath(entry.getKey().toString());
      this.mapCache.put(name,new YamlNode(this,name,entry.getValue()));
    }
    this.holder=new ValueHolderBase(this.holder.getName(),false,null);
    this.resolved=true;
  }
  return new HashMap<String,YamlNode>(this.mapCache);
}

Fixed version (ground truth):
/** 
 * Returns map of child nodes of this map node.
 * @return               a map of child nodes
 * @throws YamlException if the node is not a map
 */
public Map<String,YamlNode> getChildrenMap() throws YamlException {
  if (!isMap()) {
    throw new YamlException("String_Node_Str",getPath());
  }
  if (!this.resolved) {
    this.mapCache=new HashMap<String,YamlNode>();
    for (    Map.Entry<?,?> entry : ((Map<?,?>)this.holder.getValue()).entrySet()) {
      String name=normalizePath(entry.getKey().toString());
      this.mapCache.put(name,new YamlNode(this,name,entry.getValue()));
    }
    this.holder=new ValueHolderBase(this.holder.getName(),false,null);
    this.resolved=true;
  }
  return new HashMap<String,YamlNode>(this.mapCache);
}
Program: 179687
Project: 179687
Buggy source:
/** 
 * Removes specified child node from this node's children.
 * @param node  the node to remove
 * @return      {@code node} if removed, or {@code null} if not this node's child
 */
public YamlNode removeChild(YamlNode node){
  if (isScalar() || node.getParent() != this) {
    return null;
  }
  if (!this.resolved) {
    try {
      getChildrenList();
    }
 catch (    YamlException e) {
      this.manager.getLogger().stackTrace(e);
      return null;
    }
  }
  if (isList()) {
    this.listCache.remove(node);
  }
 else {
    this.mapCache.remove(node.getName());
  }
  node.setParent(null);
  return node;
}

Fixed version (ground truth):
/** 
 * Removes specified child node from this node's children.
 * @param node  the node to remove
 * @return      {@code node} if removed, or {@code null} if not this node's child
 */
public YamlNode removeChild(YamlNode node){
  if (isScalar() || node.getParent() != this) {
    return null;
  }
  if (!this.resolved) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (isList()) {
    this.listCache.remove(node);
  }
 else {
    this.mapCache.remove(node.getName());
  }
  node.setParent(null);
  return node;
}
Program: 179688
Project: 179688
Buggy source:
/** 
 * Checks if this node is a list.
 * @return {@code true} if it's a list, {@code false} otherwise
 */
public boolean isList(){
  if (this.resolved) {
    return this.listCache != null;
  }
  return getValue() instanceof Collection<?>;
}

Fixed version (ground truth):
/** 
 * Checks if this node is a list.
 * @return {@code true} if it's a list, {@code false} otherwise
 */
public boolean isList(){
  if (this.resolved) {
    return this.listCache != null;
  }
  return this.holder.getValue() instanceof Collection<?>;
}
Program: 179689
Project: 179689
Buggy source:
/** 
 * Dumps the node with all children to a standard JRE class (lie Map, List, or Integer), which can be then dumped to file (eg. with SnakeYaml).
 * @return dumped node
 */
public Object dump(){
  if (!this.resolved) {
    return getValue();
  }
  if (isList()) {
    List<Object> list=new ArrayList<Object>();
    for (    YamlNode node : this.listCache) {
      list.add(node.dump());
    }
    return list;
  }
  Map<String,Object> map=new HashMap<String,Object>();
  for (  Map.Entry<String,YamlNode> entry : this.mapCache.entrySet()) {
    map.put(entry.getKey(),entry.getValue().dump());
  }
  return map;
}

Fixed version (ground truth):
/** 
 * Dumps the node with all children to a standard JRE class (lie Map, List, or Integer), which can be then dumped to file (eg. with SnakeYaml).
 * @return dumped node
 */
public Object dump(){
  if (!this.resolved) {
    return this.holder.getValue();
  }
  if (isList()) {
    List<Object> list=new ArrayList<Object>();
    for (    YamlNode node : this.listCache) {
      list.add(node.dump());
    }
    return list;
  }
  Map<String,Object> map=new HashMap<String,Object>();
  for (  Map.Entry<String,YamlNode> entry : this.mapCache.entrySet()) {
    map.put(entry.getKey(),entry.getValue().dump());
  }
  return map;
}
Program: 179690
Project: 179690
Buggy source:
/** 
 * Returns map of child nodes of this list node or map node.
 * @return               a list of child nodes
 * @throws YamlException if the node is a scalar
 */
public List<YamlNode> getChildrenList() throws YamlException {
  if (isMap()) {
    if (this.resolved) {
      return new ArrayList<YamlNode>(this.mapCache.values());
    }
    return new ArrayList<YamlNode>(getChildrenMap().values());
  }
  if (!isList()) {
    throw new YamlException("String_Node_Str",getPath());
  }
  if (!this.resolved) {
    this.listCache=new ArrayList<YamlNode>();
    for (    Object o : (Collection<?>)getValue()) {
      this.listCache.add(new YamlNode(this,"String_Node_Str",o));
    }
    this.holder=new ValueHolderBase(this.holder.getName(),false,null);
    this.resolved=true;
  }
  return new ArrayList<YamlNode>(this.listCache);
}

Fixed version (ground truth):
/** 
 * Returns map of child nodes of this list node or map node.
 * @return               a list of child nodes
 * @throws YamlException if the node is a scalar
 */
public List<YamlNode> getChildrenList() throws YamlException {
  if (isMap()) {
    if (this.resolved) {
      return new ArrayList<YamlNode>(this.mapCache.values());
    }
    return new ArrayList<YamlNode>(getChildrenMap().values());
  }
  if (!isList()) {
    throw new YamlException("String_Node_Str",getPath());
  }
  if (!this.resolved) {
    this.listCache=new ArrayList<YamlNode>();
    for (    Object o : (Collection<?>)this.holder.getValue()) {
      this.listCache.add(new YamlNode(this,"String_Node_Str",o));
    }
    this.holder=new ValueHolderBase(this.holder.getName(),false,null);
    this.resolved=true;
  }
  return new ArrayList<YamlNode>(this.listCache);
}
Program: 179691
Project: 179691
Buggy source:
/** 
 * Checks if this node is a map.
 * @return {@code true} if it's a map, {@code false} otherwise
 */
public boolean isMap(){
  if (this.resolved) {
    return this.mapCache != null;
  }
  return getValue() instanceof Map<?,?>;
}

Fixed version (ground truth):
/** 
 * Checks if this node is a map.
 * @return {@code true} if it's a map, {@code false} otherwise
 */
public boolean isMap(){
  if (this.resolved) {
    return this.mapCache != null;
  }
  return this.holder.getValue() instanceof Map<?,?>;
}
Program: 179692
Project: 179692
Buggy source:
/** 
 * Returns a list of names of all nodes in the path to this node.
 * @return  a list of path elements
 */
public List<String> getPathElements(){
  List<String> elements;
  if (hasParent()) {
    elements=getParent().getPathElements();
  }
 else {
    elements=new ArrayList<String>();
  }
  if (getName() != null) {
    elements.add(getName());
  }
  return elements;
}

Fixed version (ground truth):
/** 
 * Returns a list of names of all nodes in the path to this node.
 * @return  a list of path elements
 */
public List<String> getPathElements(){
  List<String> elements;
  if (hasParent()) {
    elements=getParent().getPathElements();
  }
 else {
    elements=new ArrayList<String>();
  }
  if (this.holder.getName() != null) {
    elements.add(this.holder.getName());
  }
  return elements;
}
Program: 179693
Project: 179693
Buggy source:
/** 
 * Creates a new YamlNode with given parent node, node name, and value.
 * @param parent  the parent node
 * @param name    the name
 * @param value   the value
 */
public YamlNode(YamlNode parent,String name,Object value){
  this(parent.getYamlManager(),name,value);
  this.parent=parent;
}

Fixed version (ground truth):
/** 
 * Creates a new YamlNode with given parent node, node name, and value.
 * @param parent  the parent node
 * @param name    the name
 * @param value   the value
 */
protected YamlNode(YamlNode parent,String name,Object value){
  this(parent.getYamlManager(),name,value);
  this.parent=parent;
}
Program: 179694
Project: 179694
Buggy source:
/** 
 * Returns number of children of the node.
 * @return number of children
 */
public int getChildrenCount(){
  if (isScalar()) {
    return 0;
  }
  try {
    getChildrenList();
  }
 catch (  YamlException e) {
    this.manager.getLogger().stackTrace(e);
    return 0;
  }
  if (isList()) {
    return this.listCache.size();
  }
  return this.mapCache.size();
}

Fixed version (ground truth):
/** 
 * Returns number of children of the node.
 * @return number of children
 */
public int getChildrenCount(){
  if (isScalar()) {
    return 0;
  }
  if (!this.resolved) {
    try {
      getChildrenList();
    }
 catch (    YamlException e) {
      this.manager.getLogger().stackTrace(e);
      return 0;
    }
  }
  if (isList()) {
    return this.listCache.size();
  }
  return this.mapCache.size();
}
Program: 179695
Project: 179695
Buggy source:
/** 
 * Returns a descendant node of this node with given path (relative to this node). <p> If any the nodes in path don't exist, and   {@code add} is {@code true}, then creates them. If the node is null, and attempting to create the child, the node will be turned into a map.
 * @param path           path of the descendant node, separated with this node's YamlManager's path separator
 * @param add            weather or not create the node if doesn't exist
 * @return               the descendant node, or {@code null} if doesn't exist and not being created
 * @throws YamlException if any node in the path is not a map and not null
 */
public YamlNode getNode(String path,boolean add) throws YamlException {
  String[] elements=normalizePath(path).split(Pattern.quote(this.manager.getSeparator()),2);
  if (elements.length == 0) {
    return this;
  }
  YamlNode node=getChild(elements[0],add);
  if (node == null || elements.length == 1) {
    return node;
  }
  return node.getNode(elements[1],add);
}

Fixed version (ground truth):
/** 
 * Returns a descendant node of this node with given path (relative to this node). <p> If any the nodes in path don't exist, and   {@code add} is {@code true}, then creates them. If the node is null, and attempting to create the child, the node will be turned into a map.
 * @param path           path of the descendant node, separated with this node's YamlManager's path separator
 * @param add            weather or not create the node if doesn't exist
 * @return               the descendant node, or {@code null} if doesn't exist and not being created
 * @throws YamlException if any node in the path is not a map and not null
 */
public YamlNode getNode(String path,boolean add) throws YamlException {
  String[] elements=normalizePath(path).split(Pattern.quote(this.manager.getSeparator()),2);
  if (elements.length == 0 || path.isEmpty()) {
    return null;
  }
  YamlNode node=getChild(elements[0],add);
  if (node == null || elements.length == 1) {
    return node;
  }
  return node.getNode(elements[1],add);
}
Program: 179696
Project: 179696
Buggy source:
/** 
 * Checks if the node has a descendant node with given path (relative to this node).
 * @param path  path of the descendant node, separated with this node's YamlManager's path separator
 * @return      {@code true} if has, {@code false} otherwise
 */
public boolean hasNode(String path){
  String[] elements=normalizePath(path).split(Pattern.quote(this.manager.getSeparator()),2);
  if (elements.length == 0 || !hasChild(elements[0])) {
    return false;
  }
  if (elements.length == 1) {
    return true;
  }
  try {
    return getChild(elements[0]).hasNode(elements[1]);
  }
 catch (  YamlException e) {
    this.manager.getLogger().stackTrace(e);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks if the node has a descendant node with given path (relative to this node).
 * @param path  path of the descendant node, separated with this node's YamlManager's path separator
 * @return      {@code true} if has, {@code false} otherwise
 */
public boolean hasNode(String path){
  String[] elements=normalizePath(path).split(Pattern.quote(this.manager.getSeparator()),2);
  if (elements.length == 0 || path.isEmpty() || !hasChild(elements[0])) {
    return false;
  }
  if (elements.length == 1) {
    return true;
  }
  try {
    return getChild(elements[0]).hasNode(elements[1]);
  }
 catch (  YamlException e) {
    this.manager.getLogger().stackTrace(e);
    return false;
  }
}
Program: 179697
Project: 179697
Buggy source:
public void close(boolean force){
  if (this.keepAlive && !this.reconnect && !force) {
    if (this.timeout == 0) {
      return;
    }
 else     if ((System.currentTimeMillis() / 1000) < (this.startup + this.timeout)) {
      return;
    }
  }
  long start=System.currentTimeMillis();
  try {
    getLogging().debug("String_Node_Str" + this.datatype + "String_Node_Str"+ new TimeUtil(getUptime()).toString()+ "String_Node_Str"+ getQueriesCount());
    this.con.close();
    if (this.rs != null) {
      this.rs.close();
      this.rs=null;
    }
    if (this.pStmt != null) {
      this.pStmt.close();
      this.pStmt=null;
    }
    if (this.stmt != null) {
      this.stmt.close();
      this.stmt=null;
    }
    if (this.keepAlive && !force) {
      connect();
    }
  }
 catch (  SQLException e) {
    getLogging().stackTrace(e);
  }
  getLogging().debug("String_Node_Str" + new TimeUtil((System.currentTimeMillis() - start) / 1000).toString() + "String_Node_Str"+ this.datatype+ "String_Node_Str");
}

Fixed version (ground truth):
public void close(boolean force){
  if (this.keepAlive && !this.reconnect && !force) {
    if (this.timeout == 0) {
      return;
    }
 else     if ((System.currentTimeMillis() / 1000) < (this.startup + this.timeout)) {
      return;
    }
  }
  long start=System.currentTimeMillis();
  try {
    getLogging().debug("String_Node_Str" + this.datatype + "String_Node_Str"+ new TimeUtil(getUptime()).toString()+ "String_Node_Str"+ getQueriesCount()+ "String_Node_Str");
    this.con.close();
    if (this.rs != null) {
      this.rs.close();
      this.rs=null;
    }
    if (this.pStmt != null) {
      this.pStmt.close();
      this.pStmt=null;
    }
    if (this.stmt != null) {
      this.stmt.close();
      this.stmt=null;
    }
    if (this.keepAlive && !force) {
      connect();
    }
  }
 catch (  SQLException e) {
    getLogging().stackTrace(e);
  }
  getLogging().debug("String_Node_Str" + new TimeUtil((System.currentTimeMillis() - start) / 1000).toString() + "String_Node_Str"+ this.datatype+ "String_Node_Str");
}
Program: 179698
Project: 179698
Buggy source:
private void log(String query){
  this.lastQuery=query;
  this.queries.put(System.currentTimeMillis(),query);
  this.queriesCount++;
}

Fixed version (ground truth):
private void log(String query){
  getLogging().debug("String_Node_Str" + this.datatype + "String_Node_Str"+ query+ "String_Node_Str");
  this.lastQuery=query;
  this.queries.put(System.currentTimeMillis(),query);
  this.queriesCount++;
}
Program: 179699
Project: 179699
Buggy source:
public void close(boolean force){
  if (this.keepAlive && !this.reconnect && !force) {
    if (this.timeout == 0) {
      return;
    }
 else     if ((System.currentTimeMillis() / 1000) < (this.startup + this.timeout)) {
      return;
    }
  }
  try {
    getLogging().debug("String_Node_Str" + this.datatype + "String_Node_Str"+ new TimeUtil(getUptime()).toString()+ "String_Node_Str"+ getQueriesCount());
    this.con.close();
    if (this.rs != null) {
      this.rs.close();
      this.rs=null;
    }
    if (this.pStmt != null) {
      this.pStmt.close();
      this.pStmt=null;
    }
    if (this.stmt != null) {
      this.stmt.close();
      this.stmt=null;
    }
    if (this.keepAlive) {
      connect();
    }
  }
 catch (  SQLException e) {
    getLogging().stackTrace(e);
  }
}

Fixed version (ground truth):
public void close(boolean force){
  if (this.keepAlive && !this.reconnect && !force) {
    if (this.timeout == 0) {
      return;
    }
 else     if ((System.currentTimeMillis() / 1000) < (this.startup + this.timeout)) {
      return;
    }
  }
  try {
    getLogging().debug("String_Node_Str" + this.datatype + "String_Node_Str"+ new TimeUtil(getUptime()).toString()+ "String_Node_Str"+ getQueriesCount());
    this.con.close();
    if (this.rs != null) {
      this.rs.close();
      this.rs=null;
    }
    if (this.pStmt != null) {
      this.pStmt.close();
      this.pStmt=null;
    }
    if (this.stmt != null) {
      this.stmt.close();
      this.stmt=null;
    }
    if (this.keepAlive && !force) {
      connect();
    }
  }
 catch (  SQLException e) {
    getLogging().stackTrace(e);
  }
}
Program: 179701
Project: 179701
Buggy source:
public YamlManager(String path) throws IOException {
  InputStream yaml=getClass().getClassLoader().getResourceAsStream(path);
  getLogger().debug("String_Node_Str" + path + "String_Node_Str"+ yaml+ "String_Node_Str");
  load(yaml);
}

Fixed version (ground truth):
public YamlManager(String path) throws IOException {
  load(path);
}
Program: 179702
Project: 179702
Buggy source:
public DataField getField(FieldType field,String query) throws SQLException {
  try {
    connect();
    this.stmt=this.con.createStatement();
    this.rs=this.stmt.executeQuery(query);
    log(query);
    if (this.rs.next()) {
      Object value=null;
      if (field.equals(FieldType.STRING)) {
        value=this.rs.getString(1);
      }
 else       if (field.equals(FieldType.INTEGER)) {
        value=this.rs.getInt(1);
      }
 else       if (field.equals(FieldType.DATE)) {
        value=this.rs.getDate(1);
      }
 else       if (field.equals(FieldType.BLOB)) {
        value=this.rs.getBlob(1);
      }
 else       if (field.equals(FieldType.BINARY)) {
        value=this.rs.getBytes(1);
      }
 else       if (field.equals(FieldType.BOOLEAN)) {
        value=this.rs.getBoolean(1);
      }
 else       if (field.equals(FieldType.REAL)) {
        value=this.rs.getDouble(1);
      }
 else       if (field.equals(FieldType.UNKNOWN)) {
        return new DataField(1,this.rs);
      }
      close();
      if (value == null) {
        return null;
      }
      return new DataField(field,this.rs.getMetaData().getColumnDisplaySize(1),value);
    }
  }
  finally {
    close();
  }
  return null;
}

Fixed version (ground truth):
public DataField getField(FieldType field,String query) throws SQLException {
  try {
    connect();
    this.stmt=this.con.createStatement();
    this.rs=this.stmt.executeQuery(query);
    log(query);
    if (this.rs.next()) {
      Object value=null;
      if (field.equals(FieldType.STRING)) {
        value=this.rs.getString(1);
      }
 else       if (field.equals(FieldType.INTEGER)) {
        value=this.rs.getInt(1);
      }
 else       if (field.equals(FieldType.DATE)) {
        value=this.rs.getTimestamp(1);
      }
 else       if (field.equals(FieldType.BLOB)) {
        value=this.rs.getBlob(1);
      }
 else       if (field.equals(FieldType.BINARY)) {
        value=this.rs.getBytes(1);
      }
 else       if (field.equals(FieldType.BOOLEAN)) {
        value=this.rs.getBoolean(1);
      }
 else       if (field.equals(FieldType.REAL)) {
        value=this.rs.getDouble(1);
      }
 else       if (field.equals(FieldType.UNKNOWN)) {
        return new DataField(1,this.rs);
      }
      close();
      if (value == null) {
        return null;
      }
      return new DataField(field,this.rs.getMetaData().getColumnDisplaySize(1),value);
    }
  }
  finally {
    close();
  }
  return null;
}