Program: 39865
Project: 39865
Buggy source:
private void processParent(ParentType type,String result,String urlOrMsg){
  removeParent();
switch (type) {
case TITLE:
    Image image=new Image("String_Node_Str");
  ImageView imageView=new ImageView(image);
imageView.setPreserveRatio(true);
double height=Screen.getPrimary().getBounds().getHeight() / 5;
if (height * image.getWidth() / image.getHeight() > Screen.getPrimary().getBounds().getWidth() / 3) {
imageView.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 3);
}
 else {
imageView.setFitHeight(height);
}
parent=imageView;
break;
case GROUP:
container.setPadding(new Insets(0));
try {
XmlV xmlV=new XmlMapper().readValue(result,XmlV.class);
tab.setText(xmlV.getTitle());
if (xmlV.getCsses() != null && xmlV.getCsses().length > 0) {
for (CSS css : xmlV.getCsses()) {
processCss(css);
}
}
Map<String,String> resources=super.parsePreloadString(xmlV.generateResources());
Group group=new Group();
ProgressBar progressBar=new ProgressBar();
Label label=new Label("String_Node_Str");
progressBar.prefWidthProperty().bind(container.widthProperty().multiply(0.8));
label.layoutYProperty().bind(progressBar.layoutYProperty().add(progressBar.heightProperty()));
label.layoutXProperty().bind(progressBar.layoutXProperty().add(progressBar.widthProperty()).subtract(label.widthProperty()));
group.getChildren().addAll(progressBar,label);
parent=group;
loadingTask=new Task(){
@Override protected Object call() throws Exception {
Platform.runLater(() -> progressBar.setProgress(0));
for (int i=0; i < downloadList.size(); i++) {
String url=downloadList.get(i);
Res.downLoadFromUrl(url,Res.getDefaultDirectory(),url.replaceFirst("String_Node_Str","String_Node_Str"),label.textProperty());
double progress=i + 1;
Platform.runLater(() -> progressBar.setProgress(progress / downloadList.size() * 0.5));
}
Platform.runLater(() -> progressBar.setProgress(0.5));
for (String key : resources.keySet()) {
String value=resources.get(key);
String filename=value.replaceFirst("String_Node_Str","String_Node_Str");
String uri=Paths.get(Res.getDefaultDirectory() + File.separator + filename).toUri().toString();
if (resources.get(key).endsWith("String_Node_Str") || resources.get(key).endsWith("String_Node_Str")) {
preload.put(key,new Media(uri));
}
 else if (resources.get(key).endsWith("String_Node_Str")) {
preload.put(key,new AudioClip(uri));
}
 else {
preload.put(key,new Image(uri));
}
Platform.runLater(() -> progressBar.setProgress(((double)preload.size()) / resources.size() * 0.5 + 0.5));
}
return null;
}
}
;
loadingTask.setOnSucceeded(value -> {
try {
context.clear();
parent=xmlV.generateNode(this).getNode();
if (xmlV.getClasses() != null && xmlV.getClasses().length > 0) {
for (Class clazz : xmlV.getClasses()) {
processClass(clazz);
}
}
if (xmlV.getScripts() != null && xmlV.getScripts().length > 0) {
for (Script script : xmlV.getScripts()) {
processScript(script);
}
}
container.getChildren().clear();
container.getChildren().add(0,parent);
container.requestFocus();
}
 catch (Exception e) {
handleExceptionMessage(e);
}
}
);
Thread thread=new Thread(loadingTask);
thread.setDaemon(true);
thread.start();
}
 catch (Throwable e) {
handleExceptionMessage(e,result);
return;
}
break;
case ERROR_MESSAGE:
TextArea errorMsg=new TextArea();
errorMsg.setPrefHeight(container.getHeight() - 20);
errorMsg.setText(result + "String_Node_Str" + urlOrMsg);
container.setPadding(new Insets(10));
parent=errorMsg;
tab.textProperty().unbind();
tab.setText(urlOrMsg);
break;
default :
container.setPadding(new Insets(0));
if (webView == null) {
webView=new WebView();
}
webView.getEngine().loadContent(result);
tab.textProperty().unbind();
tab.textProperty().bind(webView.getEngine().titleProperty());
webView.getEngine().load(urlOrMsg);
parent=webView;
break;
}
urlInput.setText(urlOrMsg);
container.getChildren().add(0,parent);
container.requestFocus();
}

Fixed version (ground truth):
private void processParent(ParentType type,String result,String urlOrMsg){
  removeParent();
  if (tab != null)   tab.textProperty().unbind();
switch (type) {
case TITLE:
    Image image=new Image("String_Node_Str");
  ImageView imageView=new ImageView(image);
imageView.setPreserveRatio(true);
double height=Screen.getPrimary().getBounds().getHeight() / 5;
if (height * image.getWidth() / image.getHeight() > Screen.getPrimary().getBounds().getWidth() / 3) {
imageView.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 3);
}
 else {
imageView.setFitHeight(height);
}
parent=imageView;
break;
case GROUP:
container.setPadding(new Insets(0));
try {
XmlV xmlV=new XmlMapper().readValue(result,XmlV.class);
tab.setText(xmlV.getTitle());
if (xmlV.getCsses() != null && xmlV.getCsses().length > 0) {
for (CSS css : xmlV.getCsses()) {
processCss(css);
}
}
Map<String,String> resources=super.parsePreloadString(xmlV.generateResources());
Group group=new Group();
ProgressBar progressBar=new ProgressBar();
Label label=new Label("String_Node_Str");
progressBar.prefWidthProperty().bind(container.widthProperty().multiply(0.8));
label.layoutYProperty().bind(progressBar.layoutYProperty().add(progressBar.heightProperty()));
label.layoutXProperty().bind(progressBar.layoutXProperty().add(progressBar.widthProperty()).subtract(label.widthProperty()));
group.getChildren().addAll(progressBar,label);
parent=group;
loadingTask=new Task(){
@Override protected Object call() throws Exception {
Platform.runLater(() -> progressBar.setProgress(0));
for (int i=0; i < downloadList.size(); i++) {
String url=downloadList.get(i);
Res.downLoadFromUrl(url,Res.getDefaultDirectory(),url.replaceFirst("String_Node_Str","String_Node_Str"),label.textProperty());
double progress=i + 1;
Platform.runLater(() -> progressBar.setProgress(progress / downloadList.size() * 0.5));
}
Platform.runLater(() -> progressBar.setProgress(0.5));
for (String key : resources.keySet()) {
String value=resources.get(key);
String filename=value.replaceFirst("String_Node_Str","String_Node_Str");
String uri=Paths.get(Res.getDefaultDirectory() + File.separator + filename).toUri().toString();
if (resources.get(key).endsWith("String_Node_Str") || resources.get(key).endsWith("String_Node_Str")) {
preload.put(key,new Media(uri));
}
 else if (resources.get(key).endsWith("String_Node_Str")) {
preload.put(key,new AudioClip(uri));
}
 else {
preload.put(key,new Image(uri));
}
Platform.runLater(() -> progressBar.setProgress(((double)preload.size()) / resources.size() * 0.5 + 0.5));
}
return null;
}
}
;
loadingTask.setOnSucceeded(value -> {
try {
context.clear();
parent=xmlV.generateNode(this).getNode();
if (xmlV.getClasses() != null && xmlV.getClasses().length > 0) {
for (Class clazz : xmlV.getClasses()) {
processClass(clazz);
}
}
if (xmlV.getScripts() != null && xmlV.getScripts().length > 0) {
for (Script script : xmlV.getScripts()) {
processScript(script);
}
}
container.getChildren().clear();
container.getChildren().add(0,parent);
container.requestFocus();
}
 catch (Exception e) {
handleExceptionMessage(e);
}
}
);
Thread thread=new Thread(loadingTask);
thread.setDaemon(true);
thread.start();
}
 catch (Throwable e) {
handleExceptionMessage(e,result);
return;
}
break;
case ERROR_MESSAGE:
TextArea errorMsg=new TextArea();
errorMsg.setPrefHeight(container.getHeight() - 20);
errorMsg.setText(result + "String_Node_Str" + urlOrMsg);
container.setPadding(new Insets(10));
parent=errorMsg;
tab.setText(urlOrMsg);
break;
default :
container.setPadding(new Insets(0));
if (webView == null) {
webView=new WebView();
}
webView.getEngine().loadContent(result);
tab.textProperty().bind(webView.getEngine().titleProperty());
webView.getEngine().load(urlOrMsg);
parent=webView;
break;
}
urlInput.setText(urlOrMsg);
container.getChildren().add(0,parent);
container.requestFocus();
}