nus-yam/ex-repair huggingface dataset:
Program: 62353
Project: 62353
Buggy source:
public void disableScrollingAndJumping(){
  stopScrolling.setValue(false);
  stopJumping.setValue(false);
}

Fixed version (ground truth):
public void disableScrollingAndJumping(){
  stopScrolling.setValue(true);
  stopJumping.setValue(true);
}
Program: 62354
Project: 62354
Buggy source:
public synchronized void saveDoc(){
  if (!Platform.isFxApplicationThread()) {
    CompletableFuture completableFuture=new CompletableFuture();
    completableFuture.runAsync(() -> {
      Platform.runLater(() -> {
        try {
          saveDoc();
          completableFuture.complete(null);
        }
 catch (        Exception e) {
          completableFuture.completeExceptionally(e);
        }
      }
);
    }
,threadService.executor());
    completableFuture.join();
    return;
  }
  FileTime latestModifiedTime=IOHelper.getLastModifiedTime(getPath());
  if (Objects.nonNull(latestModifiedTime) && Objects.nonNull(getLastModifiedTime())) {
    if (latestModifiedTime.compareTo(getLastModifiedTime()) > 0) {
      this.select();
      ButtonType buttonType=AlertHelper.conflictAlert(getPath()).orElse(ButtonType.CANCEL);
      if (buttonType == ButtonType.CANCEL) {
        return;
      }
      if (buttonType == AlertHelper.LOAD_FILE_SYSTEM_CHANGES) {
        load();
      }
    }
 else {
      if (!isNew() && !isChanged()) {
        return;
      }
    }
  }
  if (Objects.isNull(getPath())) {
    final FileChooser fileChooser=directoryService.newFileChooser(String.format("String_Node_Str"));
    fileChooser.getExtensionFilters().addAll(ExtensionFilters.ASCIIDOC);
    fileChooser.getExtensionFilters().addAll(ExtensionFilters.MARKDOWN);
    fileChooser.getExtensionFilters().addAll(ExtensionFilters.ALL);
    File file=fileChooser.showSaveDialog(null);
    setPath(file.toPath());
    setTabText(file.toPath().getFileName().toString());
  }
  String editorValue=editorPane.getEditorValue();
  IOHelper.createDirectories(getPath().getParent());
  Optional<Exception> exception=IOHelper.writeToFile(getPath(),editorValue,TRUNCATE_EXISTING,CREATE,SYNC);
  if (exception.isPresent()) {
    return;
  }
  setLastModifiedTime(IOHelper.getLastModifiedTime(getPath()));
  changedProperty.set(false);
  ObservableList<String> recentFiles=storedConfigBean.getRecentFiles();
  recentFiles.remove(getPath().toString());
  recentFiles.add(0,getPath().toString());
  directoryService.setInitialDirectory(Optional.ofNullable(getPath().toFile()));
}

Fixed version (ground truth):
public void saveDoc(){
  threadService.runActionLater(this::save);
}
Program: 62355
Project: 62355
Buggy source:
private void saveAsSvg(String imagesDir,String imageTarget,String svg,String formula,float width,float height){
  try {
    if (!current.currentPath().isPresent())     controller.saveDoc();
    Path path=current.currentPath().get().getParent();
    Files.createDirectories(path.resolve(imagesDir));
    Files.write(path.resolve(imageTarget),svg.getBytes(Charset.forName("String_Node_Str")),CREATE,WRITE,TRUNCATE_EXISTING);
    logger.debug("String_Node_Str",imageTarget);
    threadService.runActionLater(() -> {
      controller.clearImageCache();
    }
);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void saveAsSvg(String imagesDir,String imageTarget,String svg,String formula,float width,float height){
  try {
    Path path=current.currentTab().getParentOrWorkdir();
    Files.createDirectories(path.resolve(imagesDir));
    Files.write(path.resolve(imageTarget),svg.getBytes(Charset.forName("String_Node_Str")),CREATE,WRITE,TRUNCATE_EXISTING);
    logger.debug("String_Node_Str",imageTarget);
    threadService.runActionLater(() -> {
      controller.clearImageCache();
    }
);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
}
Program: 62356
Project: 62356
Buggy source:
private void saveAsPng(String imagesDir,String imageTarget,String svg,String formula,float width,float height){
  try (StringReader reader=new StringReader(svg);ByteArrayOutputStream ostream=new ByteArrayOutputStream()){
    String uri="String_Node_Str";
    SAXSVGDocumentFactory f=new SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName());
    SVGDocument doc=f.createSVGDocument(uri,reader);
    TranscoderInput transcoderInput=new TranscoderInput(doc);
    TranscoderOutput transcoderOutput=new TranscoderOutput(ostream);
    PNGTranscoder transcoder=new PNGTranscoder();
    transcoder.addTranscodingHint(PNGTranscoder.KEY_WIDTH,width);
    transcoder.addTranscodingHint(PNGTranscoder.KEY_HEIGHT,height);
    transcoder.transcode(transcoderInput,transcoderOutput);
    if (!current.currentPath().isPresent())     controller.saveDoc();
    Path path=current.currentPath().get().getParent();
    Files.createDirectories(path.resolve(imagesDir));
    Files.write(path.resolve(imageTarget),ostream.toByteArray(),CREATE,WRITE,TRUNCATE_EXISTING);
    logger.debug("String_Node_Str",imageTarget);
    threadService.runActionLater(() -> {
      controller.clearImageCache();
    }
);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void saveAsPng(String imagesDir,String imageTarget,String svg,String formula,float width,float height){
  try (StringReader reader=new StringReader(svg);ByteArrayOutputStream ostream=new ByteArrayOutputStream()){
    String uri="String_Node_Str";
    SAXSVGDocumentFactory f=new SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName());
    SVGDocument doc=f.createSVGDocument(uri,reader);
    TranscoderInput transcoderInput=new TranscoderInput(doc);
    TranscoderOutput transcoderOutput=new TranscoderOutput(ostream);
    PNGTranscoder transcoder=new PNGTranscoder();
    transcoder.addTranscodingHint(PNGTranscoder.KEY_WIDTH,width);
    transcoder.addTranscodingHint(PNGTranscoder.KEY_HEIGHT,height);
    transcoder.transcode(transcoderInput,transcoderOutput);
    Path path=current.currentTab().getParentOrWorkdir();
    Files.createDirectories(path.resolve(imagesDir));
    Files.write(path.resolve(imageTarget),ostream.toByteArray(),CREATE,WRITE,TRUNCATE_EXISTING);
    logger.debug("String_Node_Str",imageTarget);
    threadService.runActionLater(() -> {
      controller.clearImageCache();
    }
);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}
Program: 62360
Project: 62360
Buggy source:
public void chartBuild(String chartContent,String imagesDir,String imageTarget,Map<String,String> optMap) throws Exception {
  if (!imageTarget.endsWith("String_Node_Str"))   throw new InterruptedException();
  Integer cacheHit=current.getCache().get(imageTarget);
  int hashCode=(imageTarget + imagesDir + chartContent).hashCode() + optMap.hashCode();
  if (Objects.nonNull(cacheHit))   if (hashCode == cacheHit) {
    throw new InterruptedException();
  }
  current.getCache().put(imageTarget,hashCode);
  if (!current.currentPath().isPresent())   controller.saveDoc();
  currentRoot=current.currentPath().get().getParent();
  imagePath=currentRoot.resolve(imageTarget);
}

Fixed version (ground truth):
public void chartBuild(String chartContent,String imagesDir,String imageTarget,Map<String,String> optMap) throws Exception {
  if (!imageTarget.endsWith("String_Node_Str"))   throw new InterruptedException();
  Integer cacheHit=current.getCache().get(imageTarget);
  int hashCode=(imageTarget + imagesDir + chartContent).hashCode() + optMap.hashCode();
  if (Objects.nonNull(cacheHit))   if (hashCode == cacheHit) {
    throw new InterruptedException();
  }
  current.getCache().put(imageTarget,hashCode);
  currentRoot=current.currentTab().getParentOrWorkdir();
  imagePath=currentRoot.resolve(imageTarget);
}
Program: 62363
Project: 62363
Buggy source:
public void saveDoc(){
  if (Objects.isNull(getPath()))   return;
  if (!isChanged())   return;
  Optional<IOException> exception=IOHelper.writeToFile(getPath(),editorPane.getEditorValue(),TRUNCATE_EXISTING,CREATE);
  if (exception.isPresent())   return;
  setTabText(getPath().getFileName().toString());
  ObservableList<String> recentFiles=storedConfigBean.getRecentFiles();
  recentFiles.remove(getPath().toString());
  recentFiles.add(0,getPath().toString());
  directoryService.setInitialDirectory(Optional.ofNullable(getPath().toFile()));
}

Fixed version (ground truth):
public void saveDoc(){
  if (!isChanged())   return;
  if (Objects.isNull(getPath())) {
    final FileChooser fileChooser=directoryService.newFileChooser(String.format("String_Node_Str"));
    fileChooser.getExtensionFilters().addAll(ExtensionFilters.ASCIIDOC);
    fileChooser.getExtensionFilters().addAll(ExtensionFilters.MARKDOWN);
    fileChooser.getExtensionFilters().addAll(ExtensionFilters.ALL);
    File file=fileChooser.showSaveDialog(null);
    setPath(file.toPath());
    setTabText(file.toPath().getFileName().toString());
  }
  Optional<IOException> exception=IOHelper.writeToFile(getPath(),editorPane.getEditorValue(),TRUNCATE_EXISTING,CREATE);
  if (exception.isPresent())   return;
  setTabText(getPath().getFileName().toString());
  ObservableList<String> recentFiles=storedConfigBean.getRecentFiles();
  recentFiles.remove(getPath().toString());
  recentFiles.add(0,getPath().toString());
  directoryService.setInitialDirectory(Optional.ofNullable(getPath().toFile()));
}
Program: 62364
Project: 62364
Buggy source:
public Path getSaveOutputPath(FileChooser.ExtensionFilter extensionFilter,boolean askPath){
  if (!Platform.isFxApplicationThread()) {
    final CompletableFuture<Path> completableFuture=new CompletableFuture<>();
    completableFuture.runAsync(() -> {
      threadService.runActionLater(() -> {
        try {
          Path outputPath=getSaveOutputPath(extensionFilter,askPath);
          completableFuture.complete(outputPath);
        }
 catch (        Exception e) {
          completableFuture.completeExceptionally(e);
        }
      }
);
    }
,threadService.executor());
    return completableFuture.join();
  }
  final Path currentTabPath=current.currentPath().get();
  final Path currentTabPathDir=currentTabPath.getParent();
  String tabText=current.getCurrentTabText().replace("String_Node_Str","String_Node_Str").trim();
  tabText=tabText.contains("String_Node_Str") ? tabText.split("String_Node_Str")[0] : tabText;
  if (!askPath) {
    return currentTabPathDir.resolve(extensionFilter.getExtensions().get(0).replace("String_Node_Str",tabText));
  }
  final FileChooser fileChooser=this.newFileChooser(String.format("String_Node_Str",extensionFilter.getDescription()));
  fileChooser.getExtensionFilters().addAll(extensionFilter);
  File file=fileChooser.showSaveDialog(null);
  if (Objects.isNull(file)) {
    return currentTabPathDir.resolve(extensionFilter.getExtensions().get(0).replace("String_Node_Str",tabText));
  }
  return file.toPath();
}

Fixed version (ground truth):
public Path getSaveOutputPath(FileChooser.ExtensionFilter extensionFilter,boolean askPath){
  if (!Platform.isFxApplicationThread()) {
    final CompletableFuture<Path> completableFuture=new CompletableFuture<>();
    completableFuture.runAsync(() -> {
      threadService.runActionLater(() -> {
        try {
          Path outputPath=getSaveOutputPath(extensionFilter,askPath);
          completableFuture.complete(outputPath);
        }
 catch (        Exception e) {
          completableFuture.completeExceptionally(e);
        }
      }
);
    }
,threadService.executor());
    return completableFuture.join();
  }
  boolean isNew=current.currentTab().isNew();
  if (isNew) {
    controller.saveDoc();
  }
  final Path currentTabPath=current.currentPath().get();
  final Path currentTabPathDir=currentTabPath.getParent();
  String tabText=current.getCurrentTabText().replace("String_Node_Str","String_Node_Str").trim();
  tabText=tabText.contains("String_Node_Str") ? tabText.split("String_Node_Str")[0] : tabText;
  if (!askPath) {
    return currentTabPathDir.resolve(extensionFilter.getExtensions().get(0).replace("String_Node_Str",tabText));
  }
  final FileChooser fileChooser=this.newFileChooser(String.format("String_Node_Str",extensionFilter.getDescription()));
  fileChooser.getExtensionFilters().addAll(extensionFilter);
  File file=fileChooser.showSaveDialog(null);
  if (Objects.isNull(file)) {
    return currentTabPathDir.resolve(extensionFilter.getExtensions().get(0).replace("String_Node_Str",tabText));
  }
  return file.toPath();
}
Program: 62365
Project: 62365
Buggy source:
@WebkitCall(from="String_Node_Str") public void appendFormula(String formula,String imagesDir,String imageTarget){
  mathJaxService.appendFormula(formula,imagesDir,imageTarget);
}

Fixed version (ground truth):
@WebkitCall(from="String_Node_Str") public void appendFormula(String formula,String imagesDir,String imageTarget){
  threadService.runActionLater(() -> {
    mathJaxService.appendFormula(formula,imagesDir,imageTarget);
  }
);
}
Program: 62366
Project: 62366
Buggy source:
@WebkitCall(from="String_Node_Str") public JSObject getImageInfo(String path,JSObject info){
  if (path.startsWith("String_Node_Str"))   path=path.substring(1);
  Path parent=null;
  try {
    if (current.currentPath().isPresent()) {
      parent=current.currentPath().get().getParent();
    }
 else {
      parent=directoryService.workingDirectory();
    }
  }
 catch (  Exception e) {
    logger.debug("String_Node_Str",e);
  }
  if (Objects.isNull(parent))   return info;
  Path imagePath=parent.resolve(path);
  if (Files.notExists(imagePath))   return info;
  try (ImageInputStream in=ImageIO.createImageInputStream(imagePath.toFile())){
    final Iterator<ImageReader> readers=ImageIO.getImageReaders(in);
    if (readers.hasNext()) {
      ImageReader reader=readers.next();
      try {
        reader.setInput(in);
        int width=reader.getWidth(0);
        int height=reader.getHeight(0);
        info.setMember("String_Node_Str",width);
        info.setMember("String_Node_Str",height);
        reader.dispose();
        return info;
      }
  finally {
        reader.dispose();
      }
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
  return info;
}

Fixed version (ground truth):
@WebkitCall(from="String_Node_Str") public void getImageInfo(final String path,Object info){
  if ((info instanceof JSObject)) {
    threadService.runActionLater(() -> {
      getImageSizeInfo(path,info);
    }
);
  }
 else   if (info instanceof jdk.nashorn.api.scripting.JSObject) {
    getImageSizeInfo(path,info);
  }
}
Program: 62367
Project: 62367
Buggy source:
@WebkitCall(from="String_Node_Str") public void chartBuildFromCsv(String csvFile,String imagesDir,String imageTarget,String chartType,String options){
  if (Objects.isNull(imageTarget) || Objects.isNull(chartType))   return;
  getCurrent().currentPath().map(Path::getParent).ifPresent(root -> {
    threadService.runTaskLater(() -> {
      String csvContent=IOHelper.readFile(root.resolve(csvFile));
      threadService.runActionLater(() -> {
        try {
          Map<String,String> optMap=parseChartOptions(options);
          optMap.put("String_Node_Str",csvFile);
          chartProvider.getProvider(chartType).chartBuild(csvContent,imagesDir,imageTarget,optMap);
        }
 catch (        Exception e) {
          logger.info(e.getMessage(),e);
        }
      }
);
    }
);
  }
);
}

Fixed version (ground truth):
@WebkitCall(from="String_Node_Str") public void chartBuildFromCsv(String csvFile,String imagesDir,String imageTarget,String chartType,String options){
  threadService.runActionLater(() -> {
    if (Objects.isNull(imageTarget) || Objects.isNull(chartType))     return;
    current.currentPath().map(Path::getParent).ifPresent(root -> {
      threadService.runTaskLater(() -> {
        String csvContent=IOHelper.readFile(root.resolve(csvFile));
        threadService.runActionLater(() -> {
          try {
            Map<String,String> optMap=parseChartOptions(options);
            optMap.put("String_Node_Str",csvFile);
            chartProvider.getProvider(chartType).chartBuild(csvContent,imagesDir,imageTarget,optMap);
          }
 catch (          Exception e) {
            logger.info(e.getMessage(),e);
          }
        }
);
      }
);
    }
);
  }
);
}
Program: 62368
Project: 62368
Buggy source:
public Path workingDirectory(){
  return workingDirectory.orElseGet(workingDirectorySupplier);
}

Fixed version (ground truth):
public Path workingDirectory(){
  return workingDirectory.orElseGet(this::workingDirectorySupplier);
}
Program: 62369
Project: 62369
Buggy source:
@Autowired public DirectoryService(final ApplicationController controller,final FileBrowseService fileBrowser,final Current current,PathResolverService pathResolver,StoredConfigBean storedConfigBean,FileWatchService fileWatchService,ThreadService threadService){
  this.controller=controller;
  this.fileBrowser=fileBrowser;
  this.current=current;
  this.pathResolver=pathResolver;
  this.storedConfigBean=storedConfigBean;
  this.fileWatchService=fileWatchService;
  this.threadService=threadService;
  workingDirectorySupplier=() -> {
    final DirectoryChooser directoryChooser=newDirectoryChooser("String_Node_Str");
    final File file=directoryChooser.showDialog(null);
    workingDirectory=Optional.ofNullable(file.toPath());
    workingDirectory.ifPresent(fileBrowser::browse);
    return Objects.nonNull(file) ? file.toPath() : null;
  }
;
  pathSaveSupplier=() -> {
    final FileChooser chooser=newFileChooser("String_Node_Str");
    chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
    chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
    File file=chooser.showSaveDialog(null);
    return Objects.nonNull(file) ? file.toPath() : null;
  }
;
}

Fixed version (ground truth):
@Autowired public DirectoryService(final ApplicationController controller,final FileBrowseService fileBrowser,final Current current,PathResolverService pathResolver,StoredConfigBean storedConfigBean,FileWatchService fileWatchService,ThreadService threadService){
  this.controller=controller;
  this.fileBrowser=fileBrowser;
  this.current=current;
  this.pathResolver=pathResolver;
  this.storedConfigBean=storedConfigBean;
  this.fileWatchService=fileWatchService;
  this.threadService=threadService;
  pathSaveSupplier=() -> {
    final FileChooser chooser=newFileChooser("String_Node_Str");
    chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
    chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
    File file=chooser.showSaveDialog(null);
    return Objects.nonNull(file) ? file.toPath() : null;
  }
;
}
Program: 62370
Project: 62370
Buggy source:
public FXFormNode call(Void aVoid){
  choiceBox.getSelectionModel().selectedItemProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      if (!newValue.equals(choiceBox.getItems().get(0)))       choiceBox.getItems().set(0,newValue);
    }
  }
);
  FXFormNodeWrapper fxFormNodeWrapper=new FXFormNodeWrapper(choiceBox,choiceBox.itemsProperty());
  choiceBox.itemsProperty().addListener(new ChangeListener(){
    @Override public void changed(    ObservableValue observable,    Object oldValue,    Object newValue){
      if (Objects.nonNull(oldValue)) {
        ObservableList observableList=(ObservableList)oldValue;
        observableList.removeListener(this::addListener);
      }
      if (Objects.nonNull(newValue)) {
        ObservableList observableList=(ObservableList)newValue;
        observableList.addListener(this::addListener);
      }
    }
    private void addListener(    ListChangeListener.Change change){
      change.next();
      if (change.wasReplaced()) {
        choiceBox.getSelectionModel().selectFirst();
      }
    }
  }
);
  return fxFormNodeWrapper;
}

Fixed version (ground truth):
public FXFormNode call(Void aVoid){
  choiceBox.getSelectionModel().selectedItemProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      if (!newValue.equals(choiceBox.getItems().get(0))) {
        choiceBox.getItems().removeAll(newValue);
        choiceBox.getItems().add(0,newValue);
      }
    }
  }
);
  FXFormNodeWrapper fxFormNodeWrapper=new FXFormNodeWrapper(choiceBox,choiceBox.itemsProperty());
  choiceBox.itemsProperty().addListener(new ChangeListener(){
    @Override public void changed(    ObservableValue observable,    Object oldValue,    Object newValue){
      if (Objects.nonNull(oldValue)) {
        ObservableList observableList=(ObservableList)oldValue;
        observableList.removeListener(this::addListener);
      }
      if (Objects.nonNull(newValue)) {
        ObservableList observableList=(ObservableList)newValue;
        observableList.addListener(this::addListener);
      }
    }
    private void addListener(    ListChangeListener.Change change){
      change.next();
      if (change.wasReplaced()) {
        choiceBox.getSelectionModel().selectFirst();
      }
    }
  }
);
  return fxFormNodeWrapper;
}
Program: 62371
Project: 62371
Buggy source:
private void bindConfigurations(){
  editorConfigBean.showGutterProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      current.currentEditor().setShowGutter(newValue);
    }
  }
);
  editorConfigBean.useWrapModeProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      current.currentEditor().setUseWrapMode(newValue);
    }
  }
);
  editorConfigBean.wrapLimitProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      current.currentEditor().setWrapLimitRange(newValue);
    }
  }
);
  editorConfigBean.directoryPanelProperty().addListener((observable,oldValue,newValue) -> {
    if (newValue) {
      showFileBrowser();
    }
 else {
      hideFileBrowser(null);
    }
  }
);
  ListChangeListener<String> themeChangeListener=c -> {
    c.next();
    if (c.wasReplaced()) {
      String theme=c.getList().get(0);
      current.currentEditor().setTheme(theme);
    }
  }
;
  editorConfigBean.editorThemeProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      newValue.addListener(themeChangeListener);
    }
    if (Objects.nonNull(oldValue)) {
      oldValue.removeListener(themeChangeListener);
    }
  }
);
  editorConfigBean.fontSizeProperty().addListener((observable,oldValue,newValue) -> {
    current.currentEditor().setFontSize(newValue.intValue());
  }
);
}

Fixed version (ground truth):
private void bindConfigurations(){
  editorConfigBean.showGutterProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      current.currentEditor().setShowGutter(newValue);
    }
  }
);
  editorConfigBean.useWrapModeProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      current.currentEditor().setUseWrapMode(newValue);
    }
  }
);
  editorConfigBean.wrapLimitProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      current.currentEditor().setWrapLimitRange(newValue);
    }
  }
);
  editorConfigBean.directoryPanelProperty().addListener((observable,oldValue,newValue) -> {
    if (newValue) {
      showFileBrowser();
    }
 else {
      hideFileBrowser(null);
    }
  }
);
  ListChangeListener<String> themeChangeListener=c -> {
    c.next();
    if (c.wasAdded()) {
      String theme=c.getList().get(0);
      current.currentEditor().setTheme(theme);
    }
  }
;
  editorConfigBean.editorThemeProperty().addListener((observable,oldValue,newValue) -> {
    if (Objects.nonNull(newValue)) {
      newValue.addListener(themeChangeListener);
    }
    if (Objects.nonNull(oldValue)) {
      oldValue.removeListener(themeChangeListener);
    }
  }
);
  editorConfigBean.fontSizeProperty().addListener((observable,oldValue,newValue) -> {
    current.currentEditor().setFontSize(newValue.intValue());
  }
);
}
Program: 62372
Project: 62372
Buggy source:
@WebkitCall(from="String_Node_Str") public JSObject getImageInfo(String path,JSObject info){
  Path parent=null;
  try {
    if (current.currentPath().isPresent()) {
      parent=current.currentPath().get().getParent();
    }
 else {
      parent=directoryService.workingDirectory();
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
  Path imagePath=parent.resolve(path);
  if (Files.notExists(imagePath))   return info;
  try (ImageInputStream in=ImageIO.createImageInputStream(imagePath.toFile())){
    final Iterator<ImageReader> readers=ImageIO.getImageReaders(in);
    if (readers.hasNext()) {
      ImageReader reader=readers.next();
      try {
        reader.setInput(in);
        int width=reader.getWidth(0);
        int height=reader.getHeight(0);
        info.setMember("String_Node_Str",width);
        info.setMember("String_Node_Str",height);
        reader.dispose();
        return info;
      }
  finally {
        reader.dispose();
      }
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
  return info;
}

Fixed version (ground truth):
@WebkitCall(from="String_Node_Str") public JSObject getImageInfo(String path,JSObject info){
  Path parent=null;
  try {
    if (current.currentPath().isPresent()) {
      parent=current.currentPath().get().getParent();
    }
 else {
      parent=directoryService.workingDirectory();
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
  if (Objects.isNull(parent))   return info;
  Path imagePath=parent.resolve(path);
  if (Files.notExists(imagePath))   return info;
  try (ImageInputStream in=ImageIO.createImageInputStream(imagePath.toFile())){
    final Iterator<ImageReader> readers=ImageIO.getImageReaders(in);
    if (readers.hasNext()) {
      ImageReader reader=readers.next();
      try {
        reader.setInput(in);
        int width=reader.getWidth(0);
        int height=reader.getHeight(0);
        info.setMember("String_Node_Str",width);
        info.setMember("String_Node_Str",height);
        reader.dispose();
        return info;
      }
  finally {
        reader.dispose();
      }
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
  return info;
}
Program: 62373
Project: 62373
Buggy source:
@WebkitCall(from="String_Node_Str") public String readAsciidoctorResource(String uri,Integer parent){
  if (uri.matches("String_Node_Str") && getIncludeAsciidocResource())   return String.format("String_Node_Str",uri);
  final CompletableFuture<String> completableFuture=new CompletableFuture();
  completableFuture.runAsync(() -> {
    threadService.runTaskLater(() -> {
      PathFinderService fileReader=applicationContext.getBean("String_Node_Str",PathFinderService.class);
      Path path=fileReader.findPath(uri,parent);
      if (!Files.exists(path))       completableFuture.complete("String_Node_Str");
      completableFuture.complete(IOHelper.readFile(path));
    }
);
  }
);
  return completableFuture.join();
}

Fixed version (ground truth):
@WebkitCall(from="String_Node_Str") public String readAsciidoctorResource(String uri,Integer parent){
  if (uri.matches("String_Node_Str") && getIncludeAsciidocResource())   return String.format("String_Node_Str",uri);
  final CompletableFuture<String> completableFuture=new CompletableFuture();
  completableFuture.runAsync(() -> {
    threadService.runTaskLater(() -> {
      PathFinderService fileReader=applicationContext.getBean("String_Node_Str",PathFinderService.class);
      Path path=fileReader.findPath(uri,parent);
      if (!Files.exists(path)) {
        completableFuture.complete("String_Node_Str");
      }
 else {
        completableFuture.complete(IOHelper.readFile(path));
      }
    }
);
  }
);
  return completableFuture.join();
}
Program: 62375
Project: 62375
Buggy source:
public void browse(final Path browserPath){
  TreeView<Item> treeView=controller.getTreeView();
  int selectedIndex=treeView.getSelectionModel().getSelectedIndex();
  if (selectedIndex != -1)   lastSelectedItem=selectedIndex;
  threadService.runActionLater(() -> {
    rootItem=new TreeItem<>(new Item(browserPath,String.format("String_Node_Str",browserPath)),awesomeService.getIcon(browserPath));
    rootItem.setExpanded(true);
    treeView.setRoot(rootItem);
    threadService.runTaskLater(() -> {
      this.addPathToTree(browserPath,path -> {
        threadService.runActionLater(r -> addToTreeView(path,rootItem));
      }
);
      threadService.runActionLater(r -> {
        if (Objects.nonNull(lastSelectedItem))         treeView.getSelectionModel().select(lastSelectedItem);
      }
);
    }
);
  }
);
  logger.debug("String_Node_Str",browserPath);
}

Fixed version (ground truth):
public void browse(final Path browserPath){
  TreeView<Item> treeView=controller.getTreeView();
  int selectedIndex=treeView.getSelectionModel().getSelectedIndex();
  if (selectedIndex != -1)   lastSelectedItem=selectedIndex;
  threadService.runActionLater(() -> {
    rootItem=new TreeItem<>(new Item(browserPath,String.format("String_Node_Str",browserPath)),awesomeService.getIcon(browserPath));
    rootItem.setExpanded(true);
    treeView.setRoot(rootItem);
    this.addPathToTree(browserPath,path -> {
      this.addToTreeView(path,rootItem);
    }
);
    if (Objects.nonNull(lastSelectedItem))     treeView.getSelectionModel().select(lastSelectedItem);
  }
);
  logger.debug("String_Node_Str",browserPath);
}
Program: 62376
Project: 62376
Buggy source:
@WebkitCall public void pasteRaw(){
  JSObject editor=(JSObject)current.currentEngine().executeScript("String_Node_Str");
  if (clipboard.hasFiles()) {
    Optional<String> block=parserService.toImageBlock(clipboard.getFiles());
    if (block.isPresent()) {
      editor.call("String_Node_Str",block.get());
      return;
    }
  }
  editor.call("String_Node_Str",clipboard.getString());
}

Fixed version (ground truth):
@WebkitCall public void pasteRaw(){
  JSObject editor=(JSObject)current.currentEngine().executeScript("String_Node_Str");
  if (clipboard.hasFiles()) {
    Optional<String> block=parserService.toImageBlock(clipboard.getFiles());
    if (block.isPresent()) {
      editor.call("String_Node_Str",block.get());
      return;
    }
  }
  editor.call("String_Node_Str","String_Node_Str");
}
Program: 62377
Project: 62377
Buggy source:
@WebkitCall public void paste(){
  JSObject window=(JSObject)htmlPane.webEngine().executeScript("String_Node_Str");
  JSObject editor=(JSObject)current.currentEngine().executeScript("String_Node_Str");
  if (clipboard.hasFiles()) {
    Optional<String> block=parserService.toImageBlock(clipboard.getFiles());
    if (block.isPresent()) {
      editor.call("String_Node_Str",block.get());
      return;
    }
  }
  try {
    if (clipboard.hasHtml() || (Boolean)window.call("String_Node_Str",clipboard.getString())) {
      String content=Optional.ofNullable(clipboard.getHtml()).orElse(clipboard.getString());
      if (current.currentTab().isAsciidoc() || current.currentTab().isMarkdown())       content=(String)window.call(current.currentTab().htmlToMarkupFunction(),content);
      editor.call("String_Node_Str",content);
      return;
    }
  }
 catch (  Exception e) {
    logger.error(e.getMessage(),e);
  }
  editor.call("String_Node_Str",clipboard.getString());
}

Fixed version (ground truth):
@WebkitCall public void paste(){
  JSObject window=(JSObject)htmlPane.webEngine().executeScript("String_Node_Str");
  JSObject editor=(JSObject)current.currentEngine().executeScript("String_Node_Str");
  if (clipboard.hasFiles()) {
    Optional<String> block=parserService.toImageBlock(clipboard.getFiles());
    if (block.isPresent()) {
      editor.call("String_Node_Str",block.get());
      return;
    }
  }
  try {
    if (clipboard.hasHtml() || (Boolean)window.call("String_Node_Str",clipboard.getString())) {
      String content=Optional.ofNullable(clipboard.getHtml()).orElse(clipboard.getString());
      if (current.currentTab().isAsciidoc() || current.currentTab().isMarkdown())       content=(String)window.call(current.currentTab().htmlToMarkupFunction(),content);
      editor.call("String_Node_Str",content);
      return;
    }
  }
 catch (  Exception e) {
    logger.error(e.getMessage(),e);
  }
  editor.call("String_Node_Str","String_Node_Str");
}
Program: 62378
Project: 62378
Buggy source:
public void newDoc(String content){
  EditorPane editorPane=webviewService.createWebView();
  editorPane.confirmHandler(param -> {
    if ("String_Node_Str".equals(param)) {
      JSObject window=editorPane.getWindow();
      window.setMember("String_Node_Str",controller);
      window.call("String_Node_Str",new Object[]{});
      Map<String,String> shortCuts=controller.getShortCuts();
      Set<String> keySet=shortCuts.keySet();
      for (      String key : keySet) {
        window.call("String_Node_Str",new Object[]{key,shortCuts.get(key)});
      }
      window.call("String_Node_Str");
      if (Objects.nonNull(content)) {
        window.call("String_Node_Str",new Object[]{content});
      }
    }
    return false;
  }
);
  AnchorPane anchorPane=new AnchorPane();
  MyTab tab=tabService.createTab();
  Node editorVBox=editorService.createEditorVBox(editorPane,tab);
  controller.fitToParent(editorVBox);
  anchorPane.getChildren().add(editorVBox);
  tab.setEditorPane(editorPane);
  tab.setContent(anchorPane);
  tab.setTabText("String_Node_Str");
  TabPane tabPane=controller.getTabPane();
  tabPane.getTabs().add(tab);
  tab.select();
  editorPane.focus();
}

Fixed version (ground truth):
public void newDoc(final String content){
  EditorPane editorPane=webviewService.createWebView();
  editorPane.confirmHandler(param -> {
    if ("String_Node_Str".equals(param)) {
      JSObject window=editorPane.getWindow();
      window.setMember("String_Node_Str",controller);
      window.call("String_Node_Str",new Object[]{});
      Map<String,String> shortCuts=controller.getShortCuts();
      Set<String> keySet=shortCuts.keySet();
      for (      String key : keySet) {
        window.call("String_Node_Str",new Object[]{key,shortCuts.get(key)});
      }
      window.call("String_Node_Str");
      String finalContent=content;
      if (Objects.isNull(finalContent))       finalContent="String_Node_Str";
      window.call("String_Node_Str",new Object[]{finalContent});
    }
    return false;
  }
);
  AnchorPane anchorPane=new AnchorPane();
  MyTab tab=tabService.createTab();
  Node editorVBox=editorService.createEditorVBox(editorPane,tab);
  controller.fitToParent(editorVBox);
  anchorPane.getChildren().add(editorVBox);
  tab.setEditorPane(editorPane);
  tab.setContent(anchorPane);
  tab.setTabText("String_Node_Str");
  TabPane tabPane=controller.getTabPane();
  tabPane.getTabs().add(tab);
  tab.select();
  editorPane.focus();
}
Program: 62379
Project: 62379
Buggy source:
public void addImageTab(Path imagePath){
  Tab tab=new PreviewTab();
  tab.setText(imagePath.getFileName().toString());
  Image image=new Image(IOHelper.pathToUrl(imagePath));
  ImageView imageView=new ImageView(image);
  imageView.setPreserveRatio(true);
  TabPane previewTabPane=controller.getPreviewTabPane();
  imageView.setFitWidth(previewTabPane.getWidth());
  previewTabPane.widthProperty().addListener((observable,oldValue,newValue) -> {
    imageView.setFitWidth(previewTabPane.getWidth());
  }
);
  Tooltip tip=new Tooltip(imagePath.toString());
  Tooltip.install(tab.getGraphic(),tip);
  ScrollPane scrollPane=new ScrollPane();
  scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
  scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
  scrollPane.setContent(imageView);
  scrollPane.addEventFilter(ScrollEvent.SCROLL,e -> {
    if (e.isControlDown() && e.getDeltaY() > 0) {
      imageView.setFitWidth(imageView.getFitWidth() + 16.0);
    }
 else     if (e.isControlDown() && e.getDeltaY() < 0) {
      imageView.setFitWidth(imageView.getFitWidth() - 16.0);
    }
  }
);
  tab.setContent(scrollPane);
  TabPane tabPane=previewTabPane;
  tabPane.getTabs().add(tab);
  tabPane.getSelectionModel().select(tab);
}

Fixed version (ground truth):
public void addImageTab(Path imagePath){
  TabPane previewTabPane=controller.getPreviewTabPane();
  ImageTab tab=new ImageTab();
  tab.setPath(imagePath);
  tab.setText(imagePath.getFileName().toString());
  if (previewTabPane.getTabs().contains(tab)) {
    previewTabPane.getSelectionModel().select(tab);
    return;
  }
  Image image=new Image(IOHelper.pathToUrl(imagePath));
  ImageView imageView=new ImageView(image);
  imageView.setPreserveRatio(true);
  imageView.setFitWidth(previewTabPane.getWidth());
  previewTabPane.widthProperty().addListener((observable,oldValue,newValue) -> {
    imageView.setFitWidth(previewTabPane.getWidth());
  }
);
  Tooltip tip=new Tooltip(imagePath.toString());
  Tooltip.install(tab.getGraphic(),tip);
  ScrollPane scrollPane=new ScrollPane();
  scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
  scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
  scrollPane.setContent(imageView);
  scrollPane.addEventFilter(ScrollEvent.SCROLL,e -> {
    if (e.isControlDown() && e.getDeltaY() > 0) {
      imageView.setFitWidth(imageView.getFitWidth() + 16.0);
    }
 else     if (e.isControlDown() && e.getDeltaY() < 0) {
      imageView.setFitWidth(imageView.getFitWidth() - 16.0);
    }
  }
);
  tab.setContent(scrollPane);
  TabPane tabPane=previewTabPane;
  tabPane.getTabs().add(tab);
  tabPane.getSelectionModel().select(tab);
}
Program: 62380
Project: 62380
Buggy source:
public void newDoc(String content){
  EditorPane editorPane=webviewService.createWebView();
  editorPane.confirmHandler(param -> {
    if ("String_Node_Str".equals(param)) {
      JSObject window=editorPane.getWindow();
      window.setMember("String_Node_Str",controller);
      window.call("String_Node_Str",new Object[]{});
      Map<String,String> shortCuts=controller.getShortCuts();
      Set<String> keySet=shortCuts.keySet();
      for (      String key : keySet) {
        window.call("String_Node_Str",new Object[]{key,shortCuts.get(key)});
      }
      if (Objects.nonNull(content)) {
        window.call("String_Node_Str",new Object[]{content});
      }
      window.call("String_Node_Str");
    }
    return false;
  }
);
  AnchorPane anchorPane=new AnchorPane();
  MyTab tab=tabService.createTab();
  Node editorVBox=editorService.createEditorVBox(editorPane,tab);
  controller.fitToParent(editorVBox);
  anchorPane.getChildren().add(editorVBox);
  tab.setEditorPane(editorPane);
  tab.setContent(anchorPane);
  tab.setTabText("String_Node_Str");
  TabPane tabPane=controller.getTabPane();
  tabPane.getTabs().add(tab);
  tab.select();
  editorPane.focus();
}

Fixed version (ground truth):
public void newDoc(String content){
  EditorPane editorPane=webviewService.createWebView();
  editorPane.confirmHandler(param -> {
    if ("String_Node_Str".equals(param)) {
      JSObject window=editorPane.getWindow();
      window.setMember("String_Node_Str",controller);
      window.call("String_Node_Str",new Object[]{});
      Map<String,String> shortCuts=controller.getShortCuts();
      Set<String> keySet=shortCuts.keySet();
      for (      String key : keySet) {
        window.call("String_Node_Str",new Object[]{key,shortCuts.get(key)});
      }
      window.call("String_Node_Str");
      if (Objects.nonNull(content)) {
        window.call("String_Node_Str",new Object[]{content});
      }
    }
    return false;
  }
);
  AnchorPane anchorPane=new AnchorPane();
  MyTab tab=tabService.createTab();
  Node editorVBox=editorService.createEditorVBox(editorPane,tab);
  controller.fitToParent(editorVBox);
  anchorPane.getChildren().add(editorVBox);
  tab.setEditorPane(editorPane);
  tab.setContent(anchorPane);
  tab.setTabText("String_Node_Str");
  TabPane tabPane=controller.getTabPane();
  tabPane.getTabs().add(tab);
  tab.select();
  editorPane.focus();
}
Program: 62381
Project: 62381
Buggy source:
public void replaceSlides(String rendered){
  ((JSObject)getWindow().eval(current.currentSlideType() + "String_Node_Str")).call("String_Node_Str",rendered);
}

Fixed version (ground truth):
public void replaceSlides(String rendered){
  ((JSObject)getWindow().eval(docType + "String_Node_Str")).call("String_Node_Str",rendered);
}
Program: 62382
Project: 62382
Buggy source:
public void flipThePage(String rendered){
  try {
    ((JSObject)getWindow().eval(current.currentSlideType() + "String_Node_Str")).call("String_Node_Str",rendered);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
public void flipThePage(String rendered){
  try {
    ((JSObject)getWindow().eval(docType + "String_Node_Str")).call("String_Node_Str",rendered);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
Program: 62383
Project: 62383
Buggy source:
public void injectExtensions(){
  this.setOnSuccess(() -> {
    String slideType=current.currentSlideType();
    if ("String_Node_Str".equals(slideType))     this.loadJs("String_Node_Str","String_Node_Str");
    if ("String_Node_Str".equals(slideType))     this.loadJs("String_Node_Str");
  }
);
}

Fixed version (ground truth):
public void injectExtensions(){
  this.setOnSuccess(() -> {
    if ("String_Node_Str".equals(docType))     this.loadJs("String_Node_Str","String_Node_Str");
    if ("String_Node_Str".equals(docType))     this.loadJs("String_Node_Str");
  }
);
}
Program: 62384
Project: 62384
Buggy source:
@WebkitCall(from="String_Node_Str") public void textListener(String text,String mode){
  threadService.runTaskLater(() -> {
    threadService.runActionLater(() -> {
      if ("String_Node_Str".equalsIgnoreCase(mode)) {
        ConverterResult result=htmlPane.convertAsciidoc(text);
        result.isBackend("String_Node_Str",lastRendered::setValue,() -> {
          previewTab.setContent(htmlPane);
        }
);
        result.isBackend("String_Node_Str",slideConverter::convert,() -> {
          previewTab.setContent(slidePane);
        }
);
      }
 else       if ("String_Node_Str".equalsIgnoreCase(mode)) {
        if (Objects.isNull(liveReloadPane.getLocation())) {
          liveReloadPane.setOnSuccess(() -> {
            liveReloadPane.setMember("String_Node_Str",this);
            liveReloadPane.initializeDiffReplacer();
          }
);
          liveReloadPane.load(String.format("String_Node_Str",port));
        }
 else {
          liveReloadPane.updateDomdom();
        }
        previewTab.setContent(liveReloadPane);
      }
 else       if ("String_Node_Str".equalsIgnoreCase(mode)) {
        markdownService.convertToAsciidoc(text,asciidoc -> {
          threadService.runActionLater(() -> {
            ConverterResult result=htmlPane.convertAsciidoc(asciidoc);
            result.afterRender(lastRendered::setValue);
          }
);
        }
);
        previewTab.setContent(htmlPane);
      }
    }
);
  }
);
}

Fixed version (ground truth):
@WebkitCall(from="String_Node_Str") public void textListener(String text,String mode){
  threadService.runTaskLater(() -> {
    threadService.runActionLater(() -> {
      if ("String_Node_Str".equalsIgnoreCase(mode)) {
        ConverterResult result=htmlPane.convertAsciidoc(text);
        result.isBackend("String_Node_Str",lastRendered::setValue,() -> {
          previewTab.setContent(htmlPane);
        }
);
        result.isBackend("String_Node_Str",slideConverter::convert,() -> {
          slidePane.setDocType(result.getDoctype());
          previewTab.setContent(slidePane);
        }
);
      }
 else       if ("String_Node_Str".equalsIgnoreCase(mode)) {
        if (Objects.isNull(liveReloadPane.getLocation())) {
          liveReloadPane.setOnSuccess(() -> {
            liveReloadPane.setMember("String_Node_Str",this);
            liveReloadPane.initializeDiffReplacer();
          }
);
          liveReloadPane.load(String.format("String_Node_Str",port));
        }
 else {
          liveReloadPane.updateDomdom();
        }
        previewTab.setContent(liveReloadPane);
      }
 else       if ("String_Node_Str".equalsIgnoreCase(mode)) {
        markdownService.convertToAsciidoc(text,asciidoc -> {
          threadService.runActionLater(() -> {
            ConverterResult result=htmlPane.convertAsciidoc(asciidoc);
            result.afterRender(lastRendered::setValue);
          }
);
        }
);
        previewTab.setContent(htmlPane);
      }
    }
);
  }
);
}
Program: 62385
Project: 62385
Buggy source:
@WebkitCall public void scrollToCurrentLine(String text){
  if (current.currentIsSlide())   slidePane.flipThePage(htmlPane.findRenderedSelection(text));
  try {
    htmlPane.call("String_Node_Str",text);
  }
 catch (  Exception e) {
    logger.debug(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@WebkitCall public void scrollToCurrentLine(String text){
  if (previewTab.getContent() == slidePane) {
    slidePane.flipThePage(htmlPane.findRenderedSelection(text));
  }
  if (previewTab.getContent() == htmlPane) {
    try {
      htmlPane.call("String_Node_Str",text);
    }
 catch (    Exception e) {
      logger.debug(e.getMessage(),e);
    }
  }
}
Program: 62389
Project: 62389
Buggy source:
@Autowired public Epub3Service(final ApplicationController asciiDocController,final Current current,final ThreadService threadService,final DirectoryService directoryService,final IndikatorService indikatorService,final DocBookService docBookService){
  this.asciiDocController=asciiDocController;
  this.current=current;
  this.threadService=threadService;
  this.directoryService=directoryService;
  this.indikatorService=indikatorService;
  this.docBookService=docBookService;
}

Fixed version (ground truth):
@Autowired public Epub3Service(final ApplicationController asciiDocController,final Current current,final ThreadService threadService,final DirectoryService directoryService,final IndikatorService indikatorService,final DocBookService docBookService,PathResolverService pathResolverService){
  this.asciiDocController=asciiDocController;
  this.current=current;
  this.threadService=threadService;
  this.directoryService=directoryService;
  this.indikatorService=indikatorService;
  this.docBookService=docBookService;
  this.pathResolverService=pathResolverService;
}