Program: 148574
Project: 148574
Buggy source:
public void doSave(IProgressMonitor monitor){
  super.doSave(monitor);
  if (this.viewName != null && this.viewName.length() > 0) {
    if (viewName.matches("String_Node_Str")) {
      lastDataModelName=XpathSelectDialog.getDataModelName();
      String concept=viewName.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
      java.util.List<String> systemDataModelValues=Util.getChildren(this.getXObject().getServerRoot(),TreeObject.DATA_MODEL);
      ArrayList<String> avaiList=new ArrayList<String>();
      avaiList.addAll(systemDataModelValues);
      if (concept != null && !concept.contains("String_Node_Str")) {
        for (        String datamodel : systemDataModelValues) {
          try {
            WSDataModel dm=Util.getPort(this.getXObject()).getDataModel(new WSGetDataModel(new WSDataModelPK(datamodel)));
            if (dm != null) {
              XSDSchema xsdSchema=Util.getXSDSchema(dm.getXsdSchema());
              String schema=Util.nodeToString(xsdSchema.getDocument());
              XSDSchema xsd=Util.createXsdSchema(schema,this.getXObject().getServerRoot());
              if (!Util.getConcepts(xsd).contains(concept)) {
                avaiList.remove(datamodel);
              }
            }
          }
 catch (          Exception e1) {
            e1.printStackTrace();
          }
        }
      }
      if (concept != null && concept.length() > 0 && lastDataModelName != null && lastDataModelName.length() > 0 && avaiList.size() > 0) {
        java.util.List<String> toAddViewableList=new ArrayList<String>();
        WSGetBusinessConceptKey wsGetBusinessConceptKey=new WSGetBusinessConceptKey(new WSDataModelPK(lastDataModelName),concept);
        WSConceptKey wsConceptKey=null;
        try {
          wsConceptKey=Util.getPort(getXObject()).getBusinessConceptKey(wsGetBusinessConceptKey);
        }
 catch (        RemoteException e) {
          e.printStackTrace();
        }
catch (        XtentisException e) {
          e.printStackTrace();
        }
        if (wsConceptKey != null) {
          java.util.List<String> viewableList=new ArrayList<String>();
          java.util.List<Line> vlines=(java.util.List<Line>)viewableViewer.getViewer().getInput();
          for (int j=0; j < vlines.size(); j++) {
            Line item=vlines.get(j);
            viewableList.add(item.keyValues.get(0).value);
          }
          String[] keys=wsConceptKey.getFields();
          for (int i=0; i < keys.length; i++) {
            if ("String_Node_Str".equals(wsConceptKey.getSelector()))             keys[i]="String_Node_Str" + concept + "String_Node_Str"+ keys[i];
 else             keys[i]=wsConceptKey.getSelector() + keys[i];
          }
          String[] ids=wsConceptKey.getFields();
          for (int i=0; i < ids.length; i++) {
            String id=ids[i];
            if (id.startsWith("String_Node_Str")) {
              id=id.substring(1);
            }
 else             if (id.startsWith("String_Node_Str")) {
              id=id.substring(2);
            }
            if (!viewableList.contains(id)) {
              toAddViewableList.add(0,id);
            }
          }
        }
        if (toAddViewableList.size() > 0) {
          String msg="String_Node_Str";
          for (Iterator iterator=toAddViewableList.iterator(); iterator.hasNext(); ) {
            String toAddItem=(String)iterator.next();
            msg+=(toAddItem + "String_Node_Str");
          }
          msg+="String_Node_Str";
          MessageDialog.openInformation(this.getSite().getShell(),"String_Node_Str",msg);
        }
        IRunnableWithProgress autoFixProcess=new AutoFixProgress(toAddViewableList,viewableViewer,this.getSite().getShell());
        try {
          new ProgressMonitorDialog(this.getSite().getShell()).run(false,true,autoFixProcess);
        }
 catch (        InvocationTargetException e) {
          e.printStackTrace();
        }
catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
  }
}

Fixed version (ground truth):
public void doSave(IProgressMonitor monitor){
  super.doSave(monitor);
  if (this.viewName != null && this.viewName.length() > 0) {
    if (viewName.matches("String_Node_Str")) {
      String concept=viewName.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
      java.util.List<String> avaiList=Util.getDataModel(this.getXObject(),null,concept);
      if (avaiList.size() > 0)       lastDataModelName=avaiList.get(0);
      if (concept != null && concept.length() > 0 && lastDataModelName != null && lastDataModelName.length() > 0) {
        java.util.List<String> toAddViewableList=new ArrayList<String>();
        WSGetBusinessConceptKey wsGetBusinessConceptKey=new WSGetBusinessConceptKey(new WSDataModelPK(lastDataModelName),concept);
        WSConceptKey wsConceptKey=null;
        try {
          wsConceptKey=Util.getPort(getXObject()).getBusinessConceptKey(wsGetBusinessConceptKey);
        }
 catch (        RemoteException e) {
          e.printStackTrace();
        }
catch (        XtentisException e) {
          e.printStackTrace();
        }
        if (wsConceptKey != null) {
          java.util.List<String> viewableList=new ArrayList<String>();
          java.util.List<Line> vlines=(java.util.List<Line>)viewableViewer.getViewer().getInput();
          for (int j=0; j < vlines.size(); j++) {
            Line item=vlines.get(j);
            viewableList.add(item.keyValues.get(0).value);
          }
          String[] keys=wsConceptKey.getFields();
          for (int i=0; i < keys.length; i++) {
            if ("String_Node_Str".equals(wsConceptKey.getSelector()))             keys[i]="String_Node_Str" + concept + "String_Node_Str"+ keys[i];
 else             keys[i]=wsConceptKey.getSelector() + keys[i];
          }
          String[] ids=wsConceptKey.getFields();
          for (int i=0; i < ids.length; i++) {
            String id=ids[i];
            if (id.startsWith("String_Node_Str")) {
              id=id.substring(1);
            }
 else             if (id.startsWith("String_Node_Str")) {
              id=id.substring(2);
            }
            if (!viewableList.contains(id)) {
              toAddViewableList.add(0,id);
            }
          }
        }
        if (toAddViewableList.size() > 0) {
          String msg="String_Node_Str";
          for (Iterator iterator=toAddViewableList.iterator(); iterator.hasNext(); ) {
            String toAddItem=(String)iterator.next();
            msg+=(toAddItem + "String_Node_Str");
          }
          msg+="String_Node_Str";
          MessageDialog.openInformation(this.getSite().getShell(),"String_Node_Str",msg);
        }
        IRunnableWithProgress autoFixProcess=new AutoFixProgress(toAddViewableList,viewableViewer,this.getSite().getShell());
        try {
          new ProgressMonitorDialog(this.getSite().getShell()).run(false,true,autoFixProcess);
        }
 catch (        InvocationTargetException e) {
          e.printStackTrace();
        }
catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
  }
}