Program: 130061
Project: 130061
Buggy source:
/** 
 * Initialize value, forceFocus first field.
 */
@Override protected void initialize(){
  getConnection().setInputModel(true);
  this.treePopulator=new TreePopulator(availableXmlTree);
  if (getConnection().getXmlFilePath() != null) {
    fileFieldXml.setText(getConnection().getXmlFilePath().replace("String_Node_Str","String_Node_Str"));
    checkFieldsValue();
    String xmlFilePath=fileFieldXml.getText();
    if (isContextMode()) {
      ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());
      xmlFilePath=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,fileFieldXml.getText()));
    }
    if (!new File(xmlFilePath).exists() && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0) {
      initFileContent();
      xmlFilePath=tempXmlXsdPath;
    }
    if (XmlUtil.isXSDFile(xmlFilePath)) {
      try {
        XSDSchema schema=TreeUtil.getXSDSchema(xmlFilePath);
        List<ATreeNode> rootNodes=new XSDPopulationUtil2().getAllRootNodes(schema);
        if (rootNodes.size() > 0) {
          if (!getConnection().getRoot().isEmpty()) {
            XMLFileNode selectedNode=getConnection().getRoot().get(0);
            if (selectedNode != null) {
              String xmlPath=selectedNode.getXMLPath();
              if (xmlPath != null && xmlPath.length() > 0) {
                xmlPath=xmlPath.substring(xmlPath.lastIndexOf("String_Node_Str") + 1);
                for (int i=0; i < rootNodes.size(); i++) {
                  ATreeNode node=rootNodes.get(i);
                  if (xmlPath.equals(node.getValue())) {
                    List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
                    valid=treePopulator.populateTree(schema,node,treeNodes);
                    if (treeNodes.size() > 0) {
                      treeNode=treeNodes.get(0);
                    }
                    break;
                  }
                }
              }
            }
          }
 else {
            String xmlPath=getConnection().getSchema().get(0).getAbsoluteXPathQuery();
            if (xmlPath != null && xmlPath.length() > 0) {
              xmlPath=xmlPath.substring(xmlPath.lastIndexOf("String_Node_Str") + 1);
              boolean found=false;
              for (int i=0; i < rootNodes.size(); i++) {
                ATreeNode node=rootNodes.get(i);
                if (xmlPath.equals(node.getValue())) {
                  List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
                  valid=treePopulator.populateTree(schema,node,treeNodes);
                  if (treeNodes.size() > 0) {
                    treeNode=treeNodes.get(0);
                  }
                  found=true;
                  break;
                }
              }
              if (!found) {
                for (int i=0; i < rootNodes.size(); i++) {
                  ATreeNode node=rootNodes.get(i);
                  String[] nodeValue=((String)node.getValue()).split("String_Node_Str");
                  if (nodeValue.length > 1) {
                    if (xmlPath.equals(nodeValue[1])) {
                      List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
                      valid=treePopulator.populateTree(schema,node,treeNodes);
                      if (treeNodes.size() > 0) {
                        treeNode=treeNodes.get(0);
                      }
                      found=true;
                      break;
                    }
                  }
                }
              }
            }
          }
        }
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
 else {
      valid=this.treePopulator.populateTree(xmlFilePath,treeNode);
    }
  }
  if (getConnection().getEncoding() != null && !getConnection().getEncoding().equals("String_Node_Str")) {
    encodingCombo.setText(getConnection().getEncoding());
  }
 else {
    encodingCombo.select(0);
  }
  encodingCombo.clearSelection();
  adaptFormToEditable();
}

Fixed version (ground truth):
/** 
 * Initialize value, forceFocus first field.
 */
@Override protected void initialize(){
  getConnection().setInputModel(true);
  this.treePopulator=new TreePopulator(availableXmlTree);
  if (getConnection().getXmlFilePath() != null) {
    fileFieldXml.setText(getConnection().getXmlFilePath().replace("String_Node_Str","String_Node_Str"));
    checkFieldsValue();
    String xmlFilePath=fileFieldXml.getText();
    if (isContextMode()) {
      ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());
      xmlFilePath=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,fileFieldXml.getText()));
    }
    if (!new File(xmlFilePath).exists() && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0) {
      initFileContent();
      xmlFilePath=tempXmlXsdPath;
    }
    if (XmlUtil.isXSDFile(xmlFilePath)) {
      try {
        XSDSchema schema=TreeUtil.getXSDSchema(xmlFilePath);
        List<ATreeNode> rootNodes=new XSDPopulationUtil2().getAllRootNodes(schema);
        if (rootNodes.size() > 0) {
          ATreeNode rootNode=getDefaultRootNode(rootNodes);
          if (rootNode != null) {
            List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
            valid=treePopulator.populateTree(schema,rootNode,treeNodes);
            if (treeNodes.size() > 0) {
              treeNode=treeNodes.get(0);
            }
          }
 else {
            String xmlPath=getConnection().getSchema().get(0).getAbsoluteXPathQuery();
            if (xmlPath != null && xmlPath.length() > 0) {
              xmlPath=xmlPath.substring(xmlPath.lastIndexOf("String_Node_Str") + 1);
              boolean found=false;
              for (int i=0; i < rootNodes.size(); i++) {
                ATreeNode node=rootNodes.get(i);
                if (xmlPath.equals(node.getValue())) {
                  List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
                  valid=treePopulator.populateTree(schema,node,treeNodes);
                  if (treeNodes.size() > 0) {
                    treeNode=treeNodes.get(0);
                  }
                  found=true;
                  break;
                }
              }
              if (!found) {
                for (int i=0; i < rootNodes.size(); i++) {
                  ATreeNode node=rootNodes.get(i);
                  String[] nodeValue=((String)node.getValue()).split("String_Node_Str");
                  if (nodeValue.length > 1) {
                    if (xmlPath.equals(nodeValue[1])) {
                      List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
                      valid=treePopulator.populateTree(schema,node,treeNodes);
                      if (treeNodes.size() > 0) {
                        treeNode=treeNodes.get(0);
                      }
                      found=true;
                      break;
                    }
                  }
                }
              }
            }
          }
        }
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
 else {
      valid=this.treePopulator.populateTree(xmlFilePath,treeNode);
    }
  }
  if (getConnection().getEncoding() != null && !getConnection().getEncoding().equals("String_Node_Str")) {
    encodingCombo.setText(getConnection().getEncoding());
  }
 else {
    encodingCombo.select(0);
  }
  encodingCombo.clearSelection();
  adaptFormToEditable();
}