Program: 147895
Project: 147895
Buggy source:
private void createToolBar(Composite parent){
  Composite toolBarComp=new Composite(parent,SWT.BORDER);
  GridData gd=new GridData(SWT.FILL,SWT.TOP,true,false,2,1);
  gd.heightHint=25;
  toolBarComp.setLayoutData(gd);
  final GridLayout glToolBarBackground=new GridLayout();
  glToolBarBackground.verticalSpacing=0;
  glToolBarBackground.marginWidth=0;
  glToolBarBackground.marginHeight=0;
  glToolBarBackground.horizontalSpacing=0;
  toolBarComp.setLayout(glToolBarBackground);
  ToolBar resultToolBar=new ToolBar(toolBarComp,SWT.FLAT | SWT.HORIZONTAL);
  gd=new GridData(SWT.FILL,SWT.FILL,true,true,1,1);
  resultToolBar.setLayoutData(gd);
  ToolItem importToolItem=new ToolItem(resultToolBar,SWT.PUSH);
  importToolItem.setImage(ImageCache.getCreatedImage(EImage.IMPORT.getPath()));
  importToolItem.setToolTipText("String_Node_Str");
  ToolItem exportToolItem=new ToolItem(resultToolBar,SWT.PUSH);
  exportToolItem.setImage(ImageCache.getCreatedImage(EImage.EXPORT.getPath()));
  exportToolItem.setToolTipText("String_Node_Str");
  ToolItem importSchemalItem=new ToolItem(resultToolBar,SWT.PUSH);
  importSchemalItem.setImage(ImageCache.getCreatedImage(EImage.CHECKIN_ACTION.getPath()));
  importSchemalItem.setToolTipText("String_Node_Str");
  importToolItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      FileDialog fd=new FileDialog(getSite().getShell(),SWT.OPEN);
      fd.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
      fd.setFilterPath(Platform.getInstanceLocation().getURL().getPath().substring(1));
      fd.setText("String_Node_Str");
      String filename=fd.open();
      if (filename == null)       return;
      xsdSchema=null;
      inferXsdFromXml(filename);
    }
    private void inferXsdFromXml(    String xmlFile){
      int infer=0;
      String xsd="String_Node_Str";
      try {
        String inputType=xmlFile.substring(xmlFile.lastIndexOf("String_Node_Str"));
        if (inputType.equals("String_Node_Str")) {
          xsd=Util.getXML(xmlFile);
          xsdSchema=Util.createXsdSchema(xsd,xobject);
          xsd=Util.nodeToString(xsdSchema.getDocument());
        }
 else {
          XSDDriver d=new XSDDriver();
          infer=d.doMain(new String[]{xmlFile,"String_Node_Str"});
          if (infer == 0) {
            xsd=d.outputXSD();
          }
        }
      }
 catch (      Exception e) {
        log.error(e.getMessage(),e);
        infer=2;
      }
 finally {
        if (infer == 0 && !xsd.equals("String_Node_Str")) {
          WSDataModel wsObj=(WSDataModel)(xobject.getWsObject());
          wsObj.setXsdSchema(xsd);
          validateSchema(xsd);
          refreshData();
          markDirtyWithoutCommit();
        }
 else         if (infer != 0) {
          MessageDialog.openError(getSite().getShell(),"String_Node_Str","String_Node_Str");
        }
      }
    }
    void validateSchema(    String xsd){
      try {
        boolean elem=false;
        XSDSchema schema=getXSDSchema(xsd);
        NodeList nodeList=schema.getDocument().getDocumentElement().getChildNodes();
        for (int idx=0; idx < nodeList.getLength(); idx++) {
          Node node=nodeList.item(idx);
          if (node instanceof Element && node.getLocalName().indexOf("String_Node_Str") >= 0) {
            elem=true;
            break;
          }
        }
        if (!elem) {
          MessageDialog.openWarning(getSite().getShell(),"String_Node_Str","String_Node_Str");
        }
      }
 catch (      Exception e) {
        log.error(e.getMessage(),e);
      }
    }
  }
);
  exportToolItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      FileDialog fd=new FileDialog(getSite().getShell(),SWT.SAVE);
      fd.setFilterExtensions(new String[]{"String_Node_Str"});
      fd.setFilterPath(Platform.getInstanceLocation().getURL().getPath().substring(1));
      fd.setText("String_Node_Str");
      String filename=fd.open();
      if (filename == null)       return;
      inferXsdFromDataModule(filename);
    }
    private void inferXsdFromDataModule(    String xmlFile){
      WSDataModel wsObject=(WSDataModel)(xobject.getWsObject());
      XSDDriver d=new XSDDriver();
      if (d.outputXSD_UTF_8(wsObject.getXsdSchema(),xmlFile) != null) {
        MessageDialog.openInformation(getSite().getShell(),"String_Node_Str","String_Node_Str");
      }
 else {
        MessageDialog.openError(getSite().getShell(),"String_Node_Str","String_Node_Str");
      }
    }
  }
);
  importSchemalItem.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      SelectImportedModulesDialog dlg=new SelectImportedModulesDialog(getSite().getShell(),xsdSchema,xobject,"String_Node_Str");
      dlg.create();
      dlg.setBlockOnOpen(true);
      dlg.open();
      if (dlg.getReturnCode() == Window.OK) {
        doImportSchema(dlg.getImportedXSDList(),dlg.getToDelXSDList());
      }
    }
  }
);
}

Fixed version (ground truth):
private void createToolBar(Composite parent){
  Composite toolBarComp=new Composite(parent,SWT.BORDER);
  GridData gd=new GridData(SWT.FILL,SWT.TOP,true,false,2,1);
  gd.heightHint=25;
  toolBarComp.setLayoutData(gd);
  final GridLayout glToolBarBackground=new GridLayout();
  glToolBarBackground.verticalSpacing=0;
  glToolBarBackground.marginWidth=0;
  glToolBarBackground.marginHeight=0;
  glToolBarBackground.horizontalSpacing=0;
  toolBarComp.setLayout(glToolBarBackground);
  ToolBar resultToolBar=new ToolBar(toolBarComp,SWT.FLAT | SWT.HORIZONTAL);
  gd=new GridData(SWT.FILL,SWT.FILL,true,true,1,1);
  resultToolBar.setLayoutData(gd);
  ToolItem importToolItem=new ToolItem(resultToolBar,SWT.PUSH);
  importToolItem.setImage(ImageCache.getCreatedImage(EImage.IMPORT.getPath()));
  importToolItem.setToolTipText("String_Node_Str");
  ToolItem exportToolItem=new ToolItem(resultToolBar,SWT.PUSH);
  exportToolItem.setImage(ImageCache.getCreatedImage(EImage.EXPORT.getPath()));
  exportToolItem.setToolTipText("String_Node_Str");
  ToolItem importSchemalItem=new ToolItem(resultToolBar,SWT.PUSH);
  importSchemalItem.setImage(ImageCache.getCreatedImage(EImage.CHECKIN_ACTION.getPath()));
  importSchemalItem.setToolTipText("String_Node_Str");
  importToolItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      FileDialog fd=new FileDialog(getSite().getShell(),SWT.OPEN);
      fd.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
      fd.setFilterPath(Platform.getInstanceLocation().getURL().getPath().substring(1));
      fd.setText("String_Node_Str");
      String filename=fd.open();
      if (filename == null)       return;
      xsdSchema=null;
      inferXsdFromXml(filename);
    }
    private void inferXsdFromXml(    String xmlFile){
      int infer=0;
      String xsd="String_Node_Str";
      try {
        String inputType=xmlFile.substring(xmlFile.lastIndexOf("String_Node_Str"));
        if (inputType.equals("String_Node_Str")) {
          xsd=Util.getXML(xmlFile);
          xsdSchema=Util.createXsdSchema(xsd,xobject);
          xsd=Util.nodeToString(xsdSchema.getDocument());
        }
 else {
          XSDDriver d=new XSDDriver();
          infer=d.doMain(new String[]{xmlFile,"String_Node_Str"});
          if (infer == 0) {
            xsd=d.outputXSD();
          }
        }
      }
 catch (      Exception e) {
        log.error(e.getMessage(),e);
        infer=2;
      }
 finally {
        if (infer == 0 && !xsd.equals("String_Node_Str")) {
          WSDataModel wsObj=(WSDataModel)(xobject.getWsObject());
          wsObj.setXsdSchema(xsd);
          validateSchema(xsd);
          refreshData();
          markDirtyWithoutCommit();
        }
 else         if (infer != 0) {
          MessageDialog.openError(getSite().getShell(),"String_Node_Str","String_Node_Str");
        }
      }
    }
    void validateSchema(    String xsd){
      try {
        boolean elem=false;
        XSDSchema schema=getXSDSchema(xsd);
        NodeList nodeList=schema.getDocument().getDocumentElement().getChildNodes();
        for (int idx=0; idx < nodeList.getLength(); idx++) {
          Node node=nodeList.item(idx);
          if (node instanceof Element && node.getLocalName().indexOf("String_Node_Str") >= 0) {
            elem=true;
            break;
          }
        }
        if (!elem) {
          MessageDialog.openWarning(getSite().getShell(),"String_Node_Str","String_Node_Str");
        }
      }
 catch (      Exception e) {
        log.error(e.getMessage(),e);
      }
    }
  }
);
  exportToolItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      FileDialog fd=new FileDialog(getSite().getShell(),SWT.SAVE);
      fd.setFilterExtensions(new String[]{"String_Node_Str"});
      fd.setFilterPath(Platform.getInstanceLocation().getURL().getPath().substring(1));
      fd.setText("String_Node_Str");
      String filename=fd.open();
      if (filename == null)       return;
      inferXsdFromDataModule(filename);
    }
    private void inferXsdFromDataModule(    String xmlFile){
      WSDataModel wsObject=(WSDataModel)(xobject.getWsObject());
      XSDDriver d=new XSDDriver();
      if (d.outputXSD_UTF_8(wsObject.getXsdSchema(),xmlFile) != null) {
        MessageDialog.openInformation(getSite().getShell(),"String_Node_Str","String_Node_Str");
      }
 else {
        MessageDialog.openError(getSite().getShell(),"String_Node_Str","String_Node_Str");
      }
    }
  }
);
  importSchemalItem.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      SelectImportedModulesDialog dlg=createSelectImportedModulesDialog();
      dlg.create();
      dlg.setBlockOnOpen(true);
      dlg.open();
      if (dlg.getReturnCode() == Window.OK) {
        doImportSchema(dlg.getImportedXSDList(),dlg.getToDelXSDList());
      }
    }
  }
);
}