nus-yam/ex-repair huggingface dataset:
Program: 42
Project: 42
Buggy source:
public void onSuccess(Object result){
  super.onSuccess(result);
  String newValue=value;
  Document doc=(Document)result;
  XObject obj=doc.getObject(className);
  if (obj != null)   newValue=obj.getViewProperty(propname);
  jscallback(callback,newValue);
}

Fixed version (ground truth):
@Override public void onSuccess(Object result){
  super.onSuccess(result);
  String newValue=value;
  Document doc=(Document)result;
  XObject obj=doc.getObject(className);
  if (obj != null)   newValue=obj.getViewProperty(propname);
  jscallback(callback,newValue);
}
Program: 43
Project: 43
Buggy source:
public String get(String name){
  XObject obj=currentObj;
  if (obj == null)   obj=getFirstObject(name);
  return (String)obj.getViewProperty(name);
}

Fixed version (ground truth):
public String get(String name){
  XObject obj=currentObj;
  if (obj == null)   obj=getFirstObject(name);
  return obj.getViewProperty(name);
}
Program: 44
Project: 44
Buggy source:
public String display(String name,String type){
  XObject obj=currentObj;
  if (obj == null)   obj=getFirstObject(name);
  if (type.equals("String_Node_Str"))   return (String)obj.getEditProperty(name);
 else   return (String)obj.getViewProperty(name);
}

Fixed version (ground truth):
public String display(String name,String type){
  XObject obj=currentObj;
  if (obj == null)   obj=getFirstObject(name);
  if (type.equals("String_Node_Str"))   return obj.getEditProperty(name);
 else   return obj.getViewProperty(name);
}
Program: 45
Project: 45
Buggy source:
public String getMessage(){
  return message;
}

Fixed version (ground truth):
@Override public String getMessage(){
  return message;
}
Program: 46
Project: 46
Buggy source:
public void onSuccess(Object result){
  super.onSuccess(result);
  dictionary=(Dictionary)result;
  if (callback != null) {
    callback.onSuccess(result);
  }
}

Fixed version (ground truth):
@Override public void onSuccess(Object result){
  super.onSuccess(result);
  dictionary=(Dictionary)result;
  if (callback != null) {
    callback.onSuccess(result);
  }
}
Program: 47
Project: 47
Buggy source:
public void onFailure(Throwable caught){
  if (app != null) {
    app.finishLoading();
  }
  app.showError(caught);
}

Fixed version (ground truth):
@Override public void onFailure(Throwable caught){
  if (app != null) {
    app.finishLoading();
  }
  app.showError(caught);
}
Program: 48
Project: 48
Buggy source:
public void onSuccess(Object result){
  if (app != null)   app.finishLoading();
}

Fixed version (ground truth):
@Override public void onSuccess(Object result){
  if (app != null)   app.finishLoading();
}
Program: 49
Project: 49
Buggy source:
public XarInstalledExtension(InstalledExtension installedExtension,XarInstalledExtensionRepository repository,Packager packager) throws IOException {
  super(installedExtension);
  enumeratePages(packager);
}

Fixed version (ground truth):
public XarInstalledExtension(InstalledExtension installedExtension,XarInstalledExtensionRepository repository,Packager packager) throws IOException {
  super(installedExtension);
  this.repository=repository;
  enumeratePages(packager);
}
Program: 50
Project: 50
Buggy source:
public GlobalAction getGlobalAction(){
  return this.question.getGlobalAction();
}

Fixed version (ground truth):
public GlobalAction getGlobalAction(){
  return getWrapped().getGlobalAction();
}
Program: 51
Project: 51
Buggy source:
public void setGlobalAction(GlobalAction globalAction){
  this.question.setGlobalAction(globalAction);
}

Fixed version (ground truth):
public void setGlobalAction(GlobalAction globalAction){
  getWrapped().setGlobalAction(globalAction);
}
Program: 52
Project: 52
Buggy source:
/** 
 * @since 4.1
 */
public void setCustomDocument(Document customDocument){
  try {
    XWikiDocument document=(XWikiDocument)FieldUtils.readField(customDocument,"String_Node_Str",true);
    this.question.setCustomDocument(document);
  }
 catch (  IllegalAccessException e) {
  }
}

Fixed version (ground truth):
/** 
 * @since 4.1
 */
public void setCustomDocument(Document customDocument){
  try {
    XWikiDocument document=(XWikiDocument)FieldUtils.readField(customDocument,"String_Node_Str",true);
    getWrapped().setCustomDocument(document);
  }
 catch (  IllegalAccessException e) {
  }
}
Program: 53
Project: 53
Buggy source:
public Document getCustomDocument(){
  return safe(this.question.getCustomDocument());
}

Fixed version (ground truth):
public Document getCustomDocument(){
  return safe(getWrapped().getCustomDocument());
}
Program: 54
Project: 54
Buggy source:
/** 
 * @param locale the Locale
 * @return the bundle containing translation for the passed Locale
 */
private LocalizedTranslationBundle getLocalizedBundle(Locale locale){
  String localeString=locale.toString();
  LocalizedTranslationBundle bundle=this.bundleCache.get(localeString);
  if (bundle == null) {
    bundle=getSynchLocalizedBundle(locale);
  }
  return bundle;
}

Fixed version (ground truth):
/** 
 * @param locale the Locale
 * @return the bundle containing translation for the passed Locale
 */
private LocalizedTranslationBundle getLocalizedBundle(Locale locale){
  LocalizedTranslationBundle bundle=this.bundleCache.get(locale);
  if (bundle == null) {
    bundle=getSynchLocalizedBundle(locale);
  }
  return bundle;
}
Program: 55
Project: 55
Buggy source:
/** 
 * @param locale the locale
 * @return the URL corresponding to the passed {@link Locale}
 */
protected URL getLocaleURL(Locale locale){
  String urlString=this.baseURL.toString();
  String localeURL=urlString;
  if (!locale.equals(Locale.ROOT)) {
    if (urlString.endsWith(PROPERTIES_EXT)) {
      int index=urlString.lastIndexOf('.');
      localeURL=urlString.substring(0,index);
      localeURL+="String_Node_Str" + locale.toString();
      localeURL+=PROPERTIES_EXT;
    }
 else {
      localeURL=null;
    }
  }
  try {
    return new URL(localeURL);
  }
 catch (  MalformedURLException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * @param locale the locale
 * @return the URL corresponding to the passed {@link Locale}
 */
protected URL getLocaleURL(Locale locale){
  String urlString=this.baseURL.toString();
  String localeURL=urlString;
  if (!locale.equals(Locale.ROOT)) {
    if (urlString.endsWith(PROPERTIES_EXT)) {
      int index=urlString.lastIndexOf('.');
      localeURL=urlString.substring(0,index);
      localeURL+="String_Node_Str" + locale.toString();
      localeURL+=PROPERTIES_EXT;
    }
 else {
      return null;
    }
  }
  try {
    return new URL(localeURL);
  }
 catch (  MalformedURLException e) {
    return null;
  }
}
Program: 56
Project: 56
Buggy source:
/** 
 * @param bundle the {@link TranslationBundle} containing this {@link LocalizedTranslationBundle}
 * @param locale the {@link Locale} associated to this bundle.
 */
public DefaultLocalizedTranslationBundle(TranslationBundle bundle,Locale locale){
  this.locale=locale;
}

Fixed version (ground truth):
/** 
 * @param bundle the {@link TranslationBundle} containing this {@link LocalizedTranslationBundle}
 * @param locale the {@link Locale} associated to this bundle.
 */
public DefaultLocalizedTranslationBundle(TranslationBundle bundle,Locale locale){
  this.bundle=bundle;
  this.locale=locale;
}
Program: 57
Project: 57
Buggy source:
/** 
 * @param index the index of the paramater to return
 * @param plainParser used to parse the String content
 */
public ParameterTranslationMessageElement(int index,Parser plainParser){
  this.index=index;
}

Fixed version (ground truth):
/** 
 * @param index the index of the paramater to return
 * @param plainParser used to parse the String content
 */
public ParameterTranslationMessageElement(int index,Parser plainParser){
  this.index=index;
  this.plainParser=plainParser;
}
Program: 60
Project: 60
Buggy source:
public void stop() throws Exception {
  if (!this.wasStarted) {
    executeCommand(getDefaultStopCommand(getStopPort()));
    if (this.startedProcessHandler != null) {
      this.startedProcessHandler.waitFor(5 * 60L * 1000L);
    }
  }
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
public void stop() throws Exception {
  if (!this.wasStarted) {
    DefaultExecuteResultHandler stopProcessHandler=executeCommand(getDefaultStopCommand(getStopPort()));
    stopProcessHandler.waitFor(5 * 60L * 1000L);
    if (this.startedProcessHandler != null) {
      this.startedProcessHandler.waitFor(5 * 60L * 1000L);
    }
    LOGGER.info("String_Node_Str");
  }
 else {
    LOGGER.info("String_Node_Str");
  }
}
Program: 61
Project: 61
Buggy source:
@Override protected void afterTests(){
  try {
    context.shutdown();
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  super.afterTests();
}

Fixed version (ground truth):
@Override protected void afterTests(){
  try {
    context.shutdown();
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 62
Project: 62
Buggy source:
@Override public void cloneInternal(BaseProperty clone){
  BaseStringProperty property=(BaseStringProperty)clone;
  property.setValue(getValue());
}

Fixed version (ground truth):
@Override protected void cloneInternal(BaseProperty clone){
  BaseStringProperty property=(BaseStringProperty)clone;
  property.setValue(getValue());
}
Program: 63
Project: 63
Buggy source:
@Override public void cloneInternal(BaseProperty clone){
  DateProperty property=(DateProperty)clone;
  property.setValue(getValue());
}

Fixed version (ground truth):
@Override protected void cloneInternal(BaseProperty clone){
  DateProperty property=(DateProperty)clone;
  property.setValue(getValue());
}
Program: 64
Project: 64
Buggy source:
@Override public void cloneInternal(BaseProperty clone){
  NumberProperty property=(NumberProperty)clone;
  property.setValue(getValue());
}

Fixed version (ground truth):
@Override protected void cloneInternal(BaseProperty clone){
  NumberProperty property=(NumberProperty)clone;
  property.setValue(getValue());
}
Program: 65
Project: 65
Buggy source:
public void attachFile(String space,String page,String name,File file,boolean failIfExists) throws Exception {
  if (!pageExists(space,page)) {
    createPage(space,page,null,null);
  }
  StringBuilder url=new StringBuilder(BASE_REST_URL);
  url.append("String_Node_Str");
  url.append(escapeURL(space));
  url.append("String_Node_Str");
  url.append(escapeURL(page));
  url.append("String_Node_Str");
  url.append(escapeURL(file.getName()));
  InputStream is=new FileInputStream(file);
  try {
    if (failIfExists) {
      executePut(url.toString(),is,MediaType.APPLICATION_OCTET_STREAM,Status.CREATED.getStatusCode());
    }
 else {
      executePut(url.toString(),is,MediaType.APPLICATION_OCTET_STREAM,Status.CREATED.getStatusCode(),Status.ACCEPTED.getStatusCode());
    }
  }
  finally {
    is.close();
  }
}

Fixed version (ground truth):
public void attachFile(String space,String page,String name,InputStream is,boolean failIfExists) throws Exception {
  if (!pageExists(space,page)) {
    createPage(space,page,null,null);
  }
  StringBuilder url=new StringBuilder(BASE_REST_URL);
  url.append("String_Node_Str");
  url.append(escapeURL(space));
  url.append("String_Node_Str");
  url.append(escapeURL(page));
  url.append("String_Node_Str");
  url.append(escapeURL(name));
  if (failIfExists) {
    executePut(url.toString(),is,MediaType.APPLICATION_OCTET_STREAM,Status.CREATED.getStatusCode());
  }
 else {
    executePut(url.toString(),is,MediaType.APPLICATION_OCTET_STREAM,Status.CREATED.getStatusCode(),Status.ACCEPTED.getStatusCode());
  }
}
Program: 66
Project: 66
Buggy source:
@Override public int hashCode(){
  return getActionName().hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  if (getActionName() == null) {
    return 0;
  }
  return getActionName().hashCode();
}
Program: 67
Project: 67
Buggy source:
@Override public boolean equals(Object object){
  if (object instanceof ActionExecutedEvent) {
    return getActionName().equals(((ActionExecutedEvent)object).getActionName());
  }
  return getActionName().equals(object);
}

Fixed version (ground truth):
@Override public boolean equals(Object object){
  if (object != null && getClass().isAssignableFrom(object.getClass())) {
    return StringUtils.equals(getActionName(),((ActionExecutionEvent)object).getActionName());
  }
  return false;
}
Program: 68
Project: 68
Buggy source:
@Override public boolean matches(Object otherEvent){
  boolean isMatching=false;
  if (getClass().isAssignableFrom(otherEvent.getClass())) {
    ActionExecutionEvent actionEvent=(ActionExecutionEvent)otherEvent;
    isMatching=getActionName() == null || getActionName().equals(actionEvent.getActionName());
  }
  return isMatching;
}

Fixed version (ground truth):
@Override public boolean matches(Object otherEvent){
  if (otherEvent == null) {
    return false;
  }
  boolean isMatching=false;
  if (getClass().isAssignableFrom(otherEvent.getClass())) {
    ActionExecutionEvent actionEvent=(ActionExecutionEvent)otherEvent;
    isMatching=getActionName() == null || getActionName().equals(actionEvent.getActionName());
  }
  return isMatching;
}
Program: 69
Project: 69
Buggy source:
@Override public List<ExtensionRepositoryId> getRepositories(){
  List<ExtensionRepositoryId> repositories=new ArrayList<ExtensionRepositoryId>();
  List<String> repositoryStrings=this.configuration.get().getProperty("String_Node_Str");
  if (!repositoryStrings.isEmpty()) {
    for (    String repositoryString : repositoryStrings) {
      if (StringUtils.isNotBlank(repositoryString)) {
        try {
          ExtensionRepositoryId extensionRepositoryId=parseRepository(repositoryString);
          repositories.add(extensionRepositoryId);
        }
 catch (        Exception e) {
          this.logger.warn("String_Node_Str" + repositoryString + "String_Node_Str",e);
        }
      }
 else {
        this.logger.debug("String_Node_Str");
      }
    }
  }
 else {
    try {
      repositories.add(new ExtensionRepositoryId("String_Node_Str",TYPE_MAVEN,new URI("String_Node_Str")));
      repositories.add(new ExtensionRepositoryId("String_Node_Str",TYPE_XWIKI,new URI("String_Node_Str")));
    }
 catch (    Exception e) {
    }
  }
  return repositories;
}

Fixed version (ground truth):
@Override public List<ExtensionRepositoryId> getRepositories(){
  List<ExtensionRepositoryId> repositories=new ArrayList<ExtensionRepositoryId>();
  List<String> repositoryStrings=this.configuration.get().getProperty("String_Node_Str");
  if (repositoryStrings != null && !repositoryStrings.isEmpty()) {
    for (    String repositoryString : repositoryStrings) {
      if (StringUtils.isNotBlank(repositoryString)) {
        try {
          ExtensionRepositoryId extensionRepositoryId=parseRepository(repositoryString);
          repositories.add(extensionRepositoryId);
        }
 catch (        Exception e) {
          this.logger.warn("String_Node_Str" + repositoryString + "String_Node_Str",e);
        }
      }
 else {
        this.logger.debug("String_Node_Str");
      }
    }
  }
 else {
    try {
      repositories.add(new ExtensionRepositoryId("String_Node_Str",TYPE_MAVEN,new URI("String_Node_Str")));
      repositories.add(new ExtensionRepositoryId("String_Node_Str",TYPE_XWIKI,new URI("String_Node_Str")));
    }
 catch (    Exception e) {
    }
  }
  return repositories;
}
Program: 70
Project: 70
Buggy source:
public RequestToGroupRenameWork(String migratorDescription,int migratorVersion){
  this.migratorDescription=migratorDescription;
  this.migratorVersion=migratorVersion;
}

Fixed version (ground truth):
/** 
 * @param migratorDescription the migrator description (used in the warning log if the update fails)
 * @param migratorVersion the migration version (used in the warning log if the update fails)
 */
public RequestToGroupRenameWork(String migratorDescription,int migratorVersion){
  this.migratorDescription=migratorDescription;
  this.migratorVersion=migratorVersion;
}
Program: 71
Project: 71
Buggy source:
/** 
 * (Re)-cache the secret token used for CSRF protection. A user with edit rights on Main.WebHome must be logged in. This method must be called before   {@link #getSecretToken()} is called and after each re-login.
 * @see #getSecretToken()
 */
public void recacheSecretToken(){
  getDriver().get(getURL("String_Node_Str","String_Node_Str","String_Node_Str"));
  try {
    WebElement tokenInput=getDriver().findElement(By.xpath("String_Node_Str"));
    this.secretToken=tokenInput.getAttribute("String_Node_Str");
  }
 catch (  NoSuchElementException exception) {
    System.out.println("String_Node_Str");
    exception.printStackTrace();
  }
  getDriver().navigate().back();
}

Fixed version (ground truth):
/** 
 * (Re)-cache the secret token used for CSRF protection. A user with edit rights on Main.WebHome must be logged in. This method must be called before   {@link #getSecretToken()} is called and after each re-login.
 * @see #getSecretToken()
 */
public void recacheSecretToken(){
  String previousURL=getDriver().getCurrentUrl();
  getDriver().get(getURL("String_Node_Str","String_Node_Str","String_Node_Str"));
  try {
    WebElement tokenInput=getDriver().findElement(By.xpath("String_Node_Str"));
    this.secretToken=tokenInput.getAttribute("String_Node_Str");
  }
 catch (  NoSuchElementException exception) {
    System.out.println("String_Node_Str");
    exception.printStackTrace();
  }
  getDriver().get(previousURL);
}
Program: 72
Project: 72
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: 73
Project: 73
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: 74
Project: 74
Buggy source:
/** 
 * @return the work directory indicated in configuration, null if none is configured or if it's invalid
 * @throws ComponentLookupException error when trying to lookup {@link ConfigurationSource} component
 */
private File getConfiguredWorkDirectory() throws ComponentLookupException {
  File workDirectory=null;
  String workDirectoryName=this.componentManager.lookup(ConfigurationSource.class,"String_Node_Str").getProperty(PROPERTY_WORKDIRECTORY);
  if (workDirectoryName != null) {
    workDirectory=new File(workDirectoryName);
    if (workDirectory.exists()) {
      if (!workDirectory.isDirectory()) {
        LOGGER.error("String_Node_Str",workDirectory.getAbsolutePath());
        workDirectory=null;
      }
 else       if (!workDirectory.canWrite()) {
        LOGGER.error("String_Node_Str",workDirectory.getAbsolutePath());
        workDirectory=null;
      }
    }
 else {
      workDirectory.mkdirs();
    }
  }
  return workDirectory;
}

Fixed version (ground truth):
/** 
 * @return the work directory indicated in configuration, null if none is configured or if it's invalid
 * @throws ComponentLookupException error when trying to lookup {@link ConfigurationSource} component
 */
private File getConfiguredWorkDirectory() throws ComponentLookupException {
  File directory=null;
  String workDirectoryName=this.componentManager.lookup(ConfigurationSource.class,"String_Node_Str").getProperty(PROPERTY_WORKDIRECTORY);
  if (workDirectoryName != null) {
    directory=new File(workDirectoryName);
    if (directory.exists()) {
      if (!directory.isDirectory()) {
        LOGGER.error("String_Node_Str",directory.getAbsolutePath());
        directory=null;
      }
 else       if (!directory.canWrite()) {
        LOGGER.error("String_Node_Str",directory.getAbsolutePath());
        directory=null;
      }
    }
 else {
      directory.mkdirs();
    }
  }
  return directory;
}
Program: 75
Project: 75
Buggy source:
/** 
 * @see org.xwiki.contrib.wiki30.WorkspaceManager#editWorkspace(java.lang.String,com.xpn.xwiki.plugin.wikimanager.doc.XWikiServer)
 */
public void editWorkspace(String workspaceName,XWikiServer modifiedWikiXObjectDocument){
  try {
    String currentUser=getPrefixedUserName(getXWikiContext().getUser());
    if (!canEditWorkspace(currentUser,workspaceName)) {
      error(new WorkspaceManagerException(String.format("String_Node_Str",currentUser,workspaceName)));
    }
    if (!getXWikiContext().getWiki().getRightService().hasProgrammingRights(getXWikiContext())) {
      throw new WorkspaceManagerException(String.format("String_Node_Str",workspaceName));
    }
    workspaceManager.editWorkspace(workspaceName,modifiedWikiXObjectDocument);
  }
 catch (  Exception e) {
    error(String.format("String_Node_Str",workspaceName),e);
  }
}

Fixed version (ground truth):
/** 
 * @see org.xwiki.contrib.wiki30.WorkspaceManager#editWorkspace(java.lang.String,com.xpn.xwiki.plugin.wikimanager.doc.XWikiServer)
 */
public void editWorkspace(String workspaceName,XWikiServer modifiedWikiXObjectDocument){
  try {
    String currentUser=getPrefixedUserName(getXWikiContext().getUser());
    if (!canEditWorkspace(currentUser,workspaceName)) {
      throw new WorkspaceManagerException(String.format("String_Node_Str",currentUser,workspaceName));
    }
    if (!getXWikiContext().getWiki().getRightService().hasProgrammingRights(getXWikiContext())) {
      throw new WorkspaceManagerException(String.format("String_Node_Str",workspaceName));
    }
    workspaceManager.editWorkspace(workspaceName,modifiedWikiXObjectDocument);
  }
 catch (  Exception e) {
    error(String.format("String_Node_Str",workspaceName),e);
  }
}
Program: 77
Project: 77
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.xwiki.rendering.macro.Macro#execute(Object,String,MacroTransformationContext)
 */
public List<Block> execute(FootnoteMacroParameters parameters,String content,MacroTransformationContext context) throws MacroExecutionException {
  Block root=context.getXDOM();
  Block matchingBlock=root.getFirstBlock(new MacroBlockMatcher(PutFootnotesMacro.MACRO_NAME),Block.Axes.DESCENDANT);
  if (matchingBlock != null) {
    return Collections.emptyList();
  }
  Block putFootnotesMacro=new MacroBlock(PutFootnotesMacro.MACRO_NAME,Collections.<String,String>emptyMap(),false);
  root.addChild(putFootnotesMacro);
  return Collections.emptyList();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.xwiki.rendering.macro.Macro#execute(Object,String,MacroTransformationContext)
 */
public List<Block> execute(FootnoteMacroParameters parameters,String content,MacroTransformationContext context) throws MacroExecutionException {
  Block root=context.getXDOM();
  Block matchingBlock=root.getFirstBlock(MACRO_BLOCK_MATCHER,Block.Axes.DESCENDANT);
  if (matchingBlock != null) {
    return Collections.emptyList();
  }
  Block putFootnotesMacro=new MacroBlock(PutFootnotesMacro.MACRO_NAME,Collections.<String,String>emptyMap(),false);
  root.addChild(putFootnotesMacro);
  return Collections.emptyList();
}
Program: 78
Project: 78
Buggy source:
/** 
 * {@inheritDoc}
 * @see com.novell.ldap.LDAPAuthHandler#getAuthProvider(java.lang.String,int)
 */
public LDAPAuthProvider getAuthProvider(String host,int port){
  try {
    LOG.debug("String_Node_Str" + host + "String_Node_Str"+ port);
    return new LDAPAuthProvider(this.bindDN,this.bindPassword.getBytes("String_Node_Str"));
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + host + "String_Node_Str"+ port);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see com.novell.ldap.LDAPAuthHandler#getAuthProvider(java.lang.String,int)
 */
public LDAPAuthProvider getAuthProvider(String host,int port){
  try {
    LOG.debug(MessageFormat.format("String_Node_Str",host,port));
    return new LDAPAuthProvider(this.bindDN,this.bindPassword.getBytes("String_Node_Str"));
  }
 catch (  Exception e) {
    LOG.error(MessageFormat.format("String_Node_Str",host,port));
    return null;
  }
}
Program: 80
Project: 80
Buggy source:
/** 
 * Build an   {@link AsyncHttpClientConfig}
 * @return an {@link AsyncHttpClientConfig}
 */
public AsyncHttpClientConfig build(){
  if (applicationThreadPool.isShutdown()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (proxyServer == null && useProxyProperties) {
    proxyServer=ProxyUtils.createProxy(System.getProperties());
  }
  return new AsyncHttpClientConfig(defaultMaxTotalConnections,defaultMaxConnectionPerHost,defaultConnectionTimeOutInMs,defaultIdleConnectionInPoolTimeoutInMs,defaultIdleConnectionTimeoutInMs,defaultRequestTimeoutInMs,redirectEnabled,maxDefaultRedirects,compressionEnabled,userAgent,allowPoolingConnection,reaper,applicationThreadPool,proxyServer,sslContext,sslEngineFactory,providerConfig,connectionsPool,realm,requestFilters,responseFilters,ioExceptionFilters,requestCompressionLevel,maxRequestRetry,allowSslConnectionPool,useRawUrl,removeQueryParamOnRedirect,hostnameVerifier,ioThreadMultiplier);
}

Fixed version (ground truth):
/** 
 * Build an   {@link AsyncHttpClientConfig}
 * @return an {@link AsyncHttpClientConfig}
 */
public AsyncHttpClientConfig build(){
  if (applicationThreadPool.isShutdown()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (proxyServer == null && useProxyProperties) {
    proxyServer=ProxyUtils.createProxy(System.getProperties());
  }
  return new AsyncHttpClientConfig(defaultMaxTotalConnections,defaultMaxConnectionPerHost,defaultConnectionTimeOutInMs,defaultWebsocketTimeoutInMs,defaultIdleConnectionInPoolTimeoutInMs,defaultIdleConnectionTimeoutInMs,defaultRequestTimeoutInMs,redirectEnabled,maxDefaultRedirects,compressionEnabled,userAgent,allowPoolingConnection,reaper,applicationThreadPool,proxyServer,sslContext,sslEngineFactory,providerConfig,connectionsPool,realm,requestFilters,responseFilters,ioExceptionFilters,requestCompressionLevel,maxRequestRetry,allowSslConnectionPool,useRawUrl,removeQueryParamOnRedirect,hostnameVerifier,ioThreadMultiplier);
}
Program: 81
Project: 81
Buggy source:
private Connection obtainConnection0(final String url,final Request request,final GrizzlyResponseFuture requestFuture) throws IOException, ExecutionException, InterruptedException, TimeoutException {
  final URI uri=AsyncHttpProviderUtils.createUri(url);
  ProxyServer proxy=getProxyServer(request);
  if (ProxyUtils.avoidProxy(proxy,request)) {
    proxy=null;
  }
  String host=((proxy != null) ? proxy.getHost() : uri.getHost());
  int port=((proxy != null) ? proxy.getPort() : uri.getPort());
  int cTimeout=provider.clientConfig.getConnectionTimeoutInMs();
  if (cTimeout > 0) {
    return connectionHandler.connect(new InetSocketAddress(host,getPort(uri,port)),createConnectionCompletionHandler(request,requestFuture,null)).get(cTimeout,TimeUnit.MILLISECONDS);
  }
 else {
    return connectionHandler.connect(new InetSocketAddress(host,getPort(uri,port)),createConnectionCompletionHandler(request,requestFuture,null)).get();
  }
}

Fixed version (ground truth):
private Connection obtainConnection0(final String url,final Request request,final GrizzlyResponseFuture requestFuture) throws IOException, ExecutionException, InterruptedException, TimeoutException {
  final URI uri=AsyncHttpProviderUtils.createUri(url);
  ProxyServer proxy=getProxyServer(request);
  if (ProxyUtils.avoidProxy(proxy,request)) {
    proxy=null;
  }
  String host=((proxy != null) ? proxy.getHost() : uri.getHost());
  int port=((proxy != null) ? proxy.getPort() : uri.getPort());
  int cTimeout=provider.clientConfig.getConnectionTimeoutInMs();
  final AtomicReference<Connection> connectionRef=new AtomicReference<Connection>();
  final CountDownLatch latch=new CountDownLatch(1);
  if (cTimeout > 0) {
    connectionHandler.connect(new InetSocketAddress(host,getPort(uri,port)),createConnectionCompletionHandler(request,requestFuture,connectionRef,latch,null));
    latch.await(cTimeout,TimeUnit.MILLISECONDS);
  }
 else {
    connectionHandler.connect(new InetSocketAddress(host,getPort(uri,port)),createConnectionCompletionHandler(request,requestFuture,connectionRef,null,null));
    latch.await();
  }
  return connectionRef.get();
}
Program: 82
Project: 82
Buggy source:
public void completed(Connection connection){
  future.setConnection(connection);
  provider.touchConnection(connection,request);
  if (wrappedHandler != null) {
    connection.addCloseListener(connectionMonitor);
    wrappedHandler.completed(connection);
  }
}

Fixed version (ground truth):
public void completed(Connection connection){
  future.setConnection(connection);
  provider.touchConnection(connection,request);
  if (wrappedHandler != null) {
    connection.addCloseListener(connectionMonitor);
    wrappedHandler.completed(connection);
  }
  if (connectionReference != null) {
    connectionReference.set(connection);
  }
  if (latch != null) {
    latch.countDown();
  }
}
Program: 83
Project: 83
Buggy source:
public void cancelled(){
  if (wrappedHandler != null) {
    wrappedHandler.cancelled();
  }
 else {
    future.cancel(true);
  }
}

Fixed version (ground truth):
public void cancelled(){
  if (wrappedHandler != null) {
    wrappedHandler.cancelled();
  }
 else {
    future.cancel(true);
  }
  if (latch != null) {
    latch.countDown();
  }
}
Program: 85
Project: 85
Buggy source:
CompletionHandler<Connection> createConnectionCompletionHandler(final Request request,final GrizzlyResponseFuture future,final CompletionHandler<Connection> wrappedHandler){
  return new CompletionHandler<Connection>(){
    public void cancelled(){
      if (wrappedHandler != null) {
        wrappedHandler.cancelled();
      }
 else {
        future.cancel(true);
      }
    }
    public void failed(    Throwable throwable){
      if (wrappedHandler != null) {
        wrappedHandler.failed(throwable);
      }
 else {
        future.abort(throwable);
      }
    }
    public void completed(    Connection connection){
      future.setConnection(connection);
      provider.touchConnection(connection,request);
      if (wrappedHandler != null) {
        connection.addCloseListener(connectionMonitor);
        wrappedHandler.completed(connection);
      }
    }
    public void updated(    Connection result){
      if (wrappedHandler != null) {
        wrappedHandler.updated(result);
      }
    }
  }
;
}

Fixed version (ground truth):
CompletionHandler<Connection> createConnectionCompletionHandler(final Request request,final GrizzlyResponseFuture future,final AtomicReference<Connection> connectionReference,final CountDownLatch latch,final CompletionHandler<Connection> wrappedHandler){
  return new CompletionHandler<Connection>(){
    public void cancelled(){
      if (wrappedHandler != null) {
        wrappedHandler.cancelled();
      }
 else {
        future.cancel(true);
      }
      if (latch != null) {
        latch.countDown();
      }
    }
    public void failed(    Throwable throwable){
      if (wrappedHandler != null) {
        wrappedHandler.failed(throwable);
      }
 else {
        future.abort(throwable);
      }
      if (latch != null) {
        latch.countDown();
      }
    }
    public void completed(    Connection connection){
      future.setConnection(connection);
      provider.touchConnection(connection,request);
      if (wrappedHandler != null) {
        connection.addCloseListener(connectionMonitor);
        wrappedHandler.completed(connection);
      }
      if (connectionReference != null) {
        connectionReference.set(connection);
      }
      if (latch != null) {
        latch.countDown();
      }
    }
    public void updated(    Connection result){
      if (wrappedHandler != null) {
        wrappedHandler.updated(result);
      }
    }
  }
;
}
Program: 86
Project: 86
Buggy source:
void doAsyncConnect(final String url,final Request request,final GrizzlyResponseFuture requestFuture,final CompletionHandler<Connection> connectHandler) throws IOException, ExecutionException, InterruptedException {
  final URI uri=AsyncHttpProviderUtils.createUri(url);
  ProxyServer proxy=getProxyServer(request);
  if (ProxyUtils.avoidProxy(proxy,request)) {
    proxy=null;
  }
  String host=((proxy != null) ? proxy.getHost() : uri.getHost());
  int port=((proxy != null) ? proxy.getPort() : uri.getPort());
  connectionHandler.connect(new InetSocketAddress(host,getPort(uri,port)),createConnectionCompletionHandler(request,requestFuture,connectHandler));
}

Fixed version (ground truth):
void doAsyncConnect(final String url,final Request request,final GrizzlyResponseFuture requestFuture,final CompletionHandler<Connection> connectHandler) throws IOException, ExecutionException, InterruptedException {
  final URI uri=AsyncHttpProviderUtils.createUri(url);
  ProxyServer proxy=getProxyServer(request);
  if (ProxyUtils.avoidProxy(proxy,request)) {
    proxy=null;
  }
  String host=((proxy != null) ? proxy.getHost() : uri.getHost());
  int port=((proxy != null) ? proxy.getPort() : uri.getPort());
  connectionHandler.connect(new InetSocketAddress(host,getPort(uri,port)),createConnectionCompletionHandler(request,requestFuture,null,null,connectHandler));
}
Program: 88
Project: 88
Buggy source:
public void failed(Throwable throwable){
  if (wrappedHandler != null) {
    wrappedHandler.failed(throwable);
  }
 else {
    future.abort(throwable);
  }
}

Fixed version (ground truth):
public void failed(Throwable throwable){
  if (wrappedHandler != null) {
    wrappedHandler.failed(throwable);
  }
 else {
    future.abort(throwable);
  }
  if (latch != null) {
    latch.countDown();
  }
}
Program: 89
Project: 89
Buggy source:
private static HttpTransactionContext cleanup(final FilterChainContext ctx,final GrizzlyAsyncHttpProvider provider){
  final Connection c=ctx.getConnection();
  final HttpTransactionContext context=provider.getHttpTransactionContext(c);
  context.provider.setHttpTransactionContext(c,null);
  if (!context.provider.connectionManager.canReturnConnection(c)) {
    context.abort(new IOException("String_Node_Str"));
  }
 else {
    if (!context.provider.connectionManager.returnConnection(context.requestUrl,c)) {
      try {
        ctx.getConnection().close().markForRecycle(true);
      }
 catch (      IOException ignored) {
      }
    }
  }
  return context;
}

Fixed version (ground truth):
private static HttpTransactionContext cleanup(final FilterChainContext ctx,final GrizzlyAsyncHttpProvider provider){
  final Connection c=ctx.getConnection();
  final HttpTransactionContext context=provider.getHttpTransactionContext(c);
  context.provider.setHttpTransactionContext(c,null);
  if (!context.provider.connectionManager.canReturnConnection(c)) {
    context.abort(new IOException("String_Node_Str"));
  }
 else {
    if (!context.provider.connectionManager.returnConnection(context.requestUrl,c)) {
      ctx.getConnection().close().markForRecycle(true);
    }
  }
  return context;
}
Program: 90
Project: 90
Buggy source:
void destroy(){
  try {
    for (    Connection c : queue) {
      c.close().markForRecycle(true);
    }
    queue.clear();
  }
 catch (  IOException ignored) {
  }
  queues.remove(this);
}

Fixed version (ground truth):
void destroy(){
  for (  Connection c : queue) {
    c.close().markForRecycle(true);
  }
  queue.clear();
  queues.remove(this);
}
Program: 91
Project: 91
Buggy source:
private void closeConnection(){
  try {
    if (connection != null && !connection.isOpen()) {
      connection.close().markForRecycle(true);
    }
  }
 catch (  IOException ignored) {
  }
}

Fixed version (ground truth):
private void closeConnection(){
  if (connection != null && !connection.isOpen()) {
    connection.close().markForRecycle(true);
  }
}
Program: 92
Project: 92
Buggy source:
@Override public Request build(){
  if (signatureCalculator != null) {
    String url=baseURL;
    int i=url.indexOf('?');
    if (i >= 0) {
      url=url.substring(0,i);
    }
    signatureCalculator.calculateAndAddSignature(baseURL,request,this);
  }
  return super.build();
}

Fixed version (ground truth):
@Override public Request build(){
  if (signatureCalculator != null) {
    String url=baseURL;
    int i=url.indexOf('?');
    if (i >= 0) {
      url=url.substring(0,i);
    }
    signatureCalculator.calculateAndAddSignature(url,request,this);
  }
  return super.build();
}
Program: 93
Project: 93
Buggy source:
/** 
 * Assemble the response
 */
@Override String getResponse() throws UnsupportedEncodingException {
  int ntRespLen=ntResp.length;
  int lmRespLen=lmResp.length;
  int domainLen=domainBytes.length;
  int hostLen=hostBytes.length;
  int userLen=userBytes.length;
  int lmRespOffset=64;
  int ntRespOffset=lmRespOffset + lmRespLen;
  int domainOffset=ntRespOffset + ntRespLen;
  int userOffset=domainOffset + domainLen;
  int hostOffset=userOffset + userLen;
  int sessionKeyOffset=hostOffset + hostLen;
  int finalLength=sessionKeyOffset + 0;
  prepareResponse(finalLength,3);
  addUShort(lmRespLen);
  addUShort(lmRespLen);
  addULong(lmRespOffset);
  addUShort(ntRespLen);
  addUShort(ntRespLen);
  addULong(ntRespOffset);
  addUShort(domainLen);
  addUShort(domainLen);
  addULong(domainOffset);
  addUShort(userLen);
  addUShort(userLen);
  addULong(userOffset);
  addUShort(hostLen);
  addUShort(hostLen);
  addULong(hostOffset);
  addULong(0);
  addULong(finalLength);
  addULong(FLAG_NEGOTIATE_NTLM | FLAG_UNICODE_ENCODING | FLAG_TARGET_DESIRED| FLAG_NEGOTIATE_128| (type2Flags & FLAG_NEGOTIATE_NTLM2)| (type2Flags & FLAG_NEGOTIATE_SIGN)| (type2Flags & FLAG_NEGOTIATE_SEAL)| (type2Flags & FLAG_NEGOTIATE_KEY_EXCH)| (type2Flags & FLAG_NEGOTIATE_ALWAYS_SIGN));
  addBytes(lmResp);
  addBytes(ntResp);
  addBytes(domainBytes);
  addBytes(userBytes);
  addBytes(hostBytes);
  return super.getResponse();
}

Fixed version (ground truth):
/** 
 * Assemble the response
 */
@Override String getResponse() throws UnsupportedEncodingException {
  int ntRespLen=ntResp.length;
  int lmRespLen=lmResp.length;
  int domainLen=domainBytes.length;
  int hostLen=hostBytes.length;
  int userLen=userBytes.length;
  int lmRespOffset=64;
  int ntRespOffset=lmRespOffset + lmRespLen;
  int domainOffset=ntRespOffset + ntRespLen;
  int userOffset=domainOffset + domainLen;
  int hostOffset=userOffset + userLen;
  int finalLength=hostOffset + hostLen;
  prepareResponse(finalLength,3);
  addUShort(lmRespLen);
  addUShort(lmRespLen);
  addULong(lmRespOffset);
  addUShort(ntRespLen);
  addUShort(ntRespLen);
  addULong(ntRespOffset);
  addUShort(domainLen);
  addUShort(domainLen);
  addULong(domainOffset);
  addUShort(userLen);
  addUShort(userLen);
  addULong(userOffset);
  addUShort(hostLen);
  addUShort(hostLen);
  addULong(hostOffset);
  addULong(0);
  addULong(finalLength);
  addULong(FLAG_NEGOTIATE_NTLM | FLAG_UNICODE_ENCODING | FLAG_TARGET_DESIRED| FLAG_NEGOTIATE_128| (type2Flags & FLAG_NEGOTIATE_NTLM2)| (type2Flags & FLAG_NEGOTIATE_SIGN)| (type2Flags & FLAG_NEGOTIATE_SEAL)| (type2Flags & FLAG_NEGOTIATE_KEY_EXCH)| (type2Flags & FLAG_NEGOTIATE_ALWAYS_SIGN));
  addBytes(lmResp);
  addBytes(ntResp);
  addBytes(domainBytes);
  addBytes(userBytes);
  addBytes(hostBytes);
  return super.getResponse();
}
Program: 94
Project: 94
Buggy source:
public void calculateAndAddSignature(String baseURL,Request request,RequestBuilderBase<?> requestBuilder){
  String method=request.getMethod().toString();
  String nonce=generateNonce();
  long timestamp=System.currentTimeMillis() / 1000L;
  String signature=calculateSignature(method,baseURL,timestamp,nonce,request.getParams(),request.getQueryParams());
  String headerValue=constructAuthHeader(signature,nonce,timestamp);
  requestBuilder=requestBuilder.setHeader(HEADER_AUTHORIZATION,headerValue);
}

Fixed version (ground truth):
public void calculateAndAddSignature(String baseURL,Request request,RequestBuilderBase<?> requestBuilder){
  String method=request.getMethod();
  String nonce=generateNonce();
  long timestamp=System.currentTimeMillis() / 1000L;
  String signature=calculateSignature(method,baseURL,timestamp,nonce,request.getParams(),request.getQueryParams());
  String headerValue=constructAuthHeader(signature,nonce,timestamp);
  requestBuilder.setHeader(HEADER_AUTHORIZATION,headerValue);
}
Program: 95
Project: 95
Buggy source:
/** 
 * {@inheritDoc}
 */
public void save(Map<String,Long> map){
  log.debug("String_Node_Str",properties.toString());
  FileOutputStream os=null;
  try {
    TMP.mkdirs();
    File f=new File(TMP,storeName);
    f.createNewFile();
    if (!f.canWrite()) {
      throw new IllegalStateException();
    }
    os=new FileOutputStream(f);
    for (    Map.Entry<String,Long> e : properties.entrySet()) {
      os.write((append(e)).getBytes("String_Node_Str"));
    }
    os.flush();
  }
 catch (  Throwable e) {
    log.warn(e.getMessage(),e);
  }
 finally {
    if (os != null) {
      try {
        os.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void save(Map<String,Long> map){
  log.debug("String_Node_Str",properties.toString());
  FileOutputStream os=null;
  try {
    if (!TMP.mkdirs()) {
      throw new IllegalStateException("String_Node_Str" + TMP.getAbsolutePath());
    }
    File f=new File(TMP,storeName);
    if (!f.createNewFile()) {
      throw new IllegalStateException("String_Node_Str" + f.getAbsolutePath());
    }
    if (!f.canWrite()) {
      throw new IllegalStateException();
    }
    os=new FileOutputStream(f);
    for (    Map.Entry<String,Long> e : properties.entrySet()) {
      os.write((append(e)).getBytes("String_Node_Str"));
    }
    os.flush();
  }
 catch (  Throwable e) {
    log.warn(e.getMessage(),e);
  }
 finally {
    if (os != null) {
      try {
        os.close();
      }
 catch (      IOException ignored) {
      }
    }
  }
}
Program: 96
Project: 96
Buggy source:
protected RequestBuilderBase(Class<T> derived,Request prototype){
  this.derived=derived;
  request=new RequestImpl(prototype);
}

Fixed version (ground truth):
protected RequestBuilderBase(Class<T> derived,Request prototype){
  this.derived=derived;
  request=new RequestImpl(prototype);
  this.useRawUrl=prototype.isUseRawUrl();
}
Program: 97
Project: 97
Buggy source:
private String buildUrl(String url){
  URI uri=URI.create(url);
  StringBuilder buildedUrl=new StringBuilder();
  if (uri.getScheme() != null) {
    buildedUrl.append(uri.getScheme());
    buildedUrl.append("String_Node_Str");
  }
  if (uri.getAuthority() != null) {
    buildedUrl.append(uri.getAuthority());
  }
  if (uri.getRawPath() != null) {
    buildedUrl.append(uri.getRawPath());
  }
 else {
    if (url.indexOf("String_Node_Str") == -1) {
      String s=buildedUrl.toString();
      url=s + url.substring(uri.getScheme().length() + 1);
      return buildUrl(url);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + uri.toString());
    }
  }
  if (uri.getRawQuery() != null && !uri.getRawQuery().equals("String_Node_Str")) {
    String[] queries=uri.getRawQuery().split("String_Node_Str");
    int pos;
    for (    String query : queries) {
      pos=query.indexOf("String_Node_Str");
      if (pos <= 0) {
        addQueryParameter(query,null);
      }
 else {
        try {
          addQueryParameter(URLDecoder.decode(query.substring(0,pos),"String_Node_Str"),URLDecoder.decode(query.substring(pos + 1),"String_Node_Str"));
        }
 catch (        UnsupportedEncodingException e) {
          throw new RuntimeException(e);
        }
      }
    }
  }
  return buildedUrl.toString();
}

Fixed version (ground truth):
private String buildUrl(String url){
  URI uri=URI.create(url);
  StringBuilder buildedUrl=new StringBuilder();
  if (uri.getScheme() != null) {
    buildedUrl.append(uri.getScheme());
    buildedUrl.append("String_Node_Str");
  }
  if (uri.getAuthority() != null) {
    buildedUrl.append(uri.getAuthority());
  }
  if (uri.getRawPath() != null) {
    buildedUrl.append(uri.getRawPath());
  }
 else {
    if (url.indexOf("String_Node_Str") == -1) {
      String s=buildedUrl.toString();
      url=s + url.substring(uri.getScheme().length() + 1);
      return buildUrl(url);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + uri.toString());
    }
  }
  if (uri.getRawQuery() != null && !uri.getRawQuery().equals("String_Node_Str")) {
    String[] queries=uri.getRawQuery().split("String_Node_Str");
    int pos;
    for (    String query : queries) {
      pos=query.indexOf("String_Node_Str");
      if (pos <= 0) {
        addQueryParameter(query,null);
      }
 else {
        try {
          if (this.useRawUrl) {
            addQueryParameter(query.substring(0,pos),query.substring(pos + 1));
          }
 else {
            addQueryParameter(URLDecoder.decode(query.substring(0,pos),"String_Node_Str"),URLDecoder.decode(query.substring(pos + 1),"String_Node_Str"));
          }
        }
 catch (        UnsupportedEncodingException e) {
          throw new RuntimeException(e);
        }
      }
    }
  }
  return buildedUrl.toString();
}