Program: 127100
Project: 127100
Buggy source:
@Override protected void addFieldsListeners(){
  xmlXsdFilePath.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent event){
      if (xmlXsdFilePath.getResult() == null) {
        return;
      }
      String text=xmlXsdFilePath.getText();
      if (isContextMode()) {
        ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
        text=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,text));
      }
      File file=new File(text);
      if (file.exists()) {
        List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
        if (XmlUtil.isXSDFile(text)) {
          try {
            XSDSchema xsdSchema=updateXSDSchema(text);
            List<ATreeNode> list=updateRootNodes(xsdSchema,true);
            if (list.size() > 1) {
              RootNodeSelectDialog dialog=new RootNodeSelectDialog(null,list);
              if (dialog.open() == IDialogConstants.OK_ID) {
                ATreeNode selectedNode=dialog.getSelectedNode();
                valid=treePopulator.populateTree(xsdSchema,selectedNode,treeNodes);
              }
 else {
                return;
              }
            }
 else {
              valid=treePopulator.populateTree(xsdSchema,list.get(0),treeNodes);
            }
          }
 catch (          Exception e) {
            ExceptionHandler.process(e);
          }
        }
 else {
          valid=treePopulator.populateTree(text,treeNode);
        }
        checkFieldsValue();
        if (!valid) {
          return;
        }
        if (treeNodes.size() > 0) {
          treeNode=treeNodes.get(0);
        }
        updateConnection(text);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  xmlXsdFilePath.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent event){
      String text=xmlXsdFilePath.getText();
      if (isContextMode()) {
        ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
        text=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,text));
      }
      if (getConnection().getXmlFilePath() != null && !getConnection().getXmlFilePath().equals(text)) {
        getConnection().getLoop().clear();
        getConnection().getRoot().clear();
        getConnection().getGroup().clear();
        xsdPathChanged=true;
      }
 else {
        xsdPathChanged=false;
      }
      getConnection().setXmlFilePath(PathUtils.getPortablePath(xmlXsdFilePath.getText()));
      StringBuilder fileContent=new StringBuilder();
      BufferedReader in=null;
      File file=null;
      if (tempXmlXsdPath != null && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0 && !isModifing) {
        file=new File(tempXmlXsdPath);
        if (!file.exists()) {
          try {
            file.createNewFile();
          }
 catch (          IOException e2) {
            ExceptionHandler.process(e2);
          }
          FileOutputStream outStream;
          try {
            outStream=new FileOutputStream(file);
            outStream.write(getConnection().getFileContent());
            outStream.close();
          }
 catch (          FileNotFoundException e1) {
            ExceptionHandler.process(e1);
          }
catch (          IOException e) {
            ExceptionHandler.process(e);
          }
        }
      }
 else {
        file=new File(text);
      }
      if (!XmlUtil.isXMLFile(file.getPath())) {
        setFileContent(file);
      }
      String str;
      try {
        Charset guessCharset=CharsetToolkit.guessEncoding(file,4096);
        in=new BufferedReader(new InputStreamReader(new FileInputStream(file),guessCharset.displayName()));
        while ((str=in.readLine()) != null) {
          fileContent.append(str + "String_Node_Str");
          if (str.contains("String_Node_Str")) {
            String regex="String_Node_Str";
            Perl5Compiler compiler=new Perl5Compiler();
            Perl5Matcher matcher=new Perl5Matcher();
            Pattern pattern=null;
            try {
              pattern=compiler.compile(regex);
              if (matcher.contains(str,pattern)) {
                MatchResult matchResult=matcher.getMatch();
                if (matchResult != null) {
                  encoding=matchResult.group(1);
                }
              }
            }
 catch (            MalformedPatternException malE) {
              ExceptionHandler.process(malE);
            }
          }
        }
        fileContentText.setText(new String(fileContent));
      }
 catch (      Exception e) {
        String msgError=Messages.getString("String_Node_Str") + "String_Node_Str" + xmlXsdFilePath.getText().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str";
        if (e instanceof FileNotFoundException) {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
 else         if (e instanceof EOFException) {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
 else         if (e instanceof IOException) {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
 else {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
        fileContentText.setText(msgError);
        if (!isReadOnly()) {
          updateStatus(IStatus.ERROR,msgError);
        }
      }
 finally {
        try {
          if (in != null) {
            in.close();
          }
        }
 catch (        Exception exception) {
          ExceptionHandler.process(exception);
        }
      }
      if (getConnection().getEncoding() == null || "String_Node_Str".equals(getConnection().getEncoding())) {
        getConnection().setEncoding(encoding);
        if (encoding != null && !"String_Node_Str".equals(encoding)) {
          encodingCombo.setText(encoding);
        }
 else {
          encodingCombo.setText("String_Node_Str");
        }
      }
      valid=treePopulator.populateTree(text,treeNode);
      checkFieldsValue();
      isModifing=true;
    }
  }
);
  encodingCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getConnection().setEncoding(encodingCombo.getText());
      checkFieldsValue();
    }
  }
);
  commonNodesLimitation.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      String str=commonNodesLimitation.getText();
      if ((!str.matches("String_Node_Str")) || (Integer.valueOf(str) < 0)) {
        commonNodesLimitation.setText(String.valueOf(treePopulator.getLimit()));
      }
 else {
        treePopulator.setLimit(Integer.valueOf(str));
      }
      valid=treePopulator.populateTree(xmlXsdFilePath.getText(),treeNode);
      checkFieldsValue();
    }
  }
);
  commonNodesLimitation.addFocusListener(new FocusListener(){
    @Override public void focusGained(    FocusEvent e){
    }
    @Override public void focusLost(    FocusEvent e){
      commonNodesLimitation.setText(String.valueOf(TreePopulator.getLimit()));
    }
  }
);
  outputFilePath.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getConnection().setOutputFilePath(PathUtils.getPortablePath(outputFilePath.getText()));
      checkFieldsValue();
    }
  }
);
}

Fixed version (ground truth):
@Override protected void addFieldsListeners(){
  xmlXsdFilePath.addSelectionListener(new SelectionListener(){
    @Override public void widgetSelected(    SelectionEvent event){
      if (xmlXsdFilePath.getResult() == null) {
        return;
      }
      String text=xmlXsdFilePath.getText();
      if (isContextMode()) {
        ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
        text=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,text));
      }
      File file=new File(text);
      if (file.exists()) {
        List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
        if (XmlUtil.isXSDFile(text)) {
          try {
            XSDSchema xsdSchema=updateXSDSchema(text);
            List<ATreeNode> list=updateRootNodes(xsdSchema,true);
            if (list.size() > 1) {
              RootNodeSelectDialog dialog=new RootNodeSelectDialog(null,list);
              if (dialog.open() == IDialogConstants.OK_ID) {
                ATreeNode selectedNode=dialog.getSelectedNode();
                valid=treePopulator.populateTree(xsdSchema,selectedNode,treeNodes);
              }
 else {
                return;
              }
            }
 else {
              valid=treePopulator.populateTree(xsdSchema,list.get(0),treeNodes);
            }
          }
 catch (          Exception e) {
            ExceptionHandler.process(e);
          }
        }
 else {
          valid=treePopulator.populateTree(text,treeNode);
        }
        checkFieldsValue();
        if (!valid) {
          return;
        }
        if (treeNodes.size() > 0) {
          treeNode=treeNodes.get(0);
        }
        updateConnection(text);
      }
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
    }
  }
);
  xmlXsdFilePath.addFocusListener(new FocusListener(){
    @Override public void focusLost(    FocusEvent e){
      String text=xmlXsdFilePath.getText();
      if (isContextMode()) {
        ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(),true);
        text=TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,text));
      }
      if (getConnection().getXmlFilePath() != null && !getConnection().getXmlFilePath().equals(text)) {
        getConnection().getLoop().clear();
        getConnection().getRoot().clear();
        getConnection().getGroup().clear();
        xsdPathChanged=true;
      }
 else {
        xsdPathChanged=false;
      }
      getConnection().setXmlFilePath(PathUtils.getPortablePath(xmlXsdFilePath.getText()));
      StringBuilder fileContent=new StringBuilder();
      BufferedReader in=null;
      File file=null;
      if (tempXmlXsdPath != null && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0 && !isModifing) {
        file=new File(tempXmlXsdPath);
        if (!file.exists()) {
          try {
            file.createNewFile();
          }
 catch (          IOException e2) {
            ExceptionHandler.process(e2);
          }
          FileOutputStream outStream;
          try {
            outStream=new FileOutputStream(file);
            outStream.write(getConnection().getFileContent());
            outStream.close();
          }
 catch (          FileNotFoundException e1) {
            ExceptionHandler.process(e1);
          }
catch (          IOException e2) {
            ExceptionHandler.process(e2);
          }
        }
      }
 else {
        file=new File(text);
      }
      if (!XmlUtil.isXMLFile(file.getPath())) {
        setFileContent(file);
      }
      String str;
      try {
        Charset guessCharset=CharsetToolkit.guessEncoding(file,4096);
        in=new BufferedReader(new InputStreamReader(new FileInputStream(file),guessCharset.displayName()));
        while ((str=in.readLine()) != null) {
          fileContent.append(str + "String_Node_Str");
          if (str.contains("String_Node_Str")) {
            String regex="String_Node_Str";
            Perl5Compiler compiler=new Perl5Compiler();
            Perl5Matcher matcher=new Perl5Matcher();
            Pattern pattern=null;
            try {
              pattern=compiler.compile(regex);
              if (matcher.contains(str,pattern)) {
                MatchResult matchResult=matcher.getMatch();
                if (matchResult != null) {
                  encoding=matchResult.group(1);
                }
              }
            }
 catch (            MalformedPatternException malE) {
              ExceptionHandler.process(malE);
            }
          }
        }
        fileContentText.setText(new String(fileContent));
      }
 catch (      Exception e1) {
        String msgError=Messages.getString("String_Node_Str") + "String_Node_Str" + xmlXsdFilePath.getText().replace("String_Node_Str","String_Node_Str")+ "String_Node_Str";
        if (e1 instanceof FileNotFoundException) {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
 else         if (e1 instanceof EOFException) {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
 else         if (e1 instanceof IOException) {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
 else {
          msgError=msgError + Messages.getString("String_Node_Str");
        }
        fileContentText.setText(msgError);
        if (!isReadOnly()) {
          updateStatus(IStatus.ERROR,msgError);
        }
      }
 finally {
        try {
          if (in != null) {
            in.close();
          }
        }
 catch (        Exception exception) {
          ExceptionHandler.process(exception);
        }
      }
      if (getConnection().getEncoding() == null || "String_Node_Str".equals(getConnection().getEncoding())) {
        getConnection().setEncoding(encoding);
        if (encoding != null && !"String_Node_Str".equals(encoding)) {
          encodingCombo.setText(encoding);
        }
 else {
          encodingCombo.setText("String_Node_Str");
        }
      }
      if (file.exists()) {
        List<ATreeNode> treeNodes=new ArrayList<ATreeNode>();
        if (XmlUtil.isXSDFile(text)) {
          try {
            XSDSchema xsdSchema=updateXSDSchema(text);
            List<ATreeNode> list=updateRootNodes(xsdSchema,true);
            if (list.size() > 1) {
              RootNodeSelectDialog dialog=new RootNodeSelectDialog(null,list);
              if (dialog.open() == IDialogConstants.OK_ID) {
                ATreeNode selectedNode=dialog.getSelectedNode();
                valid=treePopulator.populateTree(xsdSchema,selectedNode,treeNodes);
              }
 else {
                return;
              }
            }
 else {
              valid=treePopulator.populateTree(xsdSchema,list.get(0),treeNodes);
            }
          }
 catch (          Exception e1) {
            ExceptionHandler.process(e1);
          }
        }
 else {
          valid=treePopulator.populateTree(text,treeNode);
        }
        checkFieldsValue();
        if (!valid) {
          return;
        }
        if (treeNodes.size() > 0) {
          treeNode=treeNodes.get(0);
        }
        updateConnection(text);
      }
      valid=treePopulator.populateTree(text,treeNode);
      checkFieldsValue();
      isModifing=true;
    }
    @Override public void focusGained(    FocusEvent e){
    }
  }
);
  encodingCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getConnection().setEncoding(encodingCombo.getText());
      checkFieldsValue();
    }
  }
);
  commonNodesLimitation.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      String str=commonNodesLimitation.getText();
      if ((!str.matches("String_Node_Str")) || (Integer.valueOf(str) < 0)) {
        commonNodesLimitation.setText(String.valueOf(treePopulator.getLimit()));
      }
 else {
        treePopulator.setLimit(Integer.valueOf(str));
      }
      valid=treePopulator.populateTree(xmlXsdFilePath.getText(),treeNode);
      checkFieldsValue();
    }
  }
);
  commonNodesLimitation.addFocusListener(new FocusListener(){
    @Override public void focusGained(    FocusEvent e){
    }
    @Override public void focusLost(    FocusEvent e){
      commonNodesLimitation.setText(String.valueOf(TreePopulator.getLimit()));
    }
  }
);
  outputFilePath.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      getConnection().setOutputFilePath(PathUtils.getPortablePath(outputFilePath.getText()));
      checkFieldsValue();
    }
  }
);
}