nus-yam/ex-repair huggingface dataset:
Program: 95491
Project: 95491
Buggy source:
/** 
 * {@inheritDoc} 
 */
public Object executeImpl(ExecutionEvent event){
  String newTestCaseName=getNewTestCaseName(event);
  if (newTestCaseName != null) {
    ISpecTestCasePO newSpecTC=null;
    IStructuredSelection ss=getSelection();
    final List<INodePO> nodesToClone=new ArrayList<INodePO>(ss.size());
    Iterator it=ss.iterator();
    while (it.hasNext()) {
      nodesToClone.add((INodePO)it.next());
    }
    newSpecTC=createAndPerformNodeDuplication(newTestCaseName,nodesToClone);
    DataEventDispatcher.getInstance().fireDataChangedListener(newSpecTC,DataState.Added,UpdateState.all);
    TestCaseBrowser tcb=MultipleTCBTracker.getInstance().getMainTCB();
    if (tcb != null) {
      tcb.getTreeViewer().setSelection(new StructuredSelection(newSpecTC),true);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public Object executeImpl(ExecutionEvent event){
  String newTestCaseName=getNewTestCaseName(event);
  if (newTestCaseName != null) {
    ISpecTestCasePO newSpecTC=null;
    IStructuredSelection ss=getSelection();
    final List<INodePO> nodesToClone=new ArrayList<INodePO>(ss.size());
    Iterator it=ss.iterator();
    while (it.hasNext()) {
      nodesToClone.add((INodePO)it.next());
    }
    newSpecTC=createAndPerformNodeDuplication(newTestCaseName,nodesToClone);
    newSpecTC=GeneralStorage.getInstance().getMasterSession().find(newSpecTC.getClass(),newSpecTC.getId());
    DataEventDispatcher.getInstance().fireDataChangedListener(newSpecTC,DataState.Added,UpdateState.all);
    TestCaseBrowser tcb=MultipleTCBTracker.getInstance().getMainTCB();
    if (tcb != null) {
      tcb.getTreeViewer().setSelection(new StructuredSelection(newSpecTC),true);
    }
  }
  return null;
}
Program: 95493
Project: 95493
Buggy source:
/** 
 * Updates the test data manager of the passed node by writing the value contained in converter into the appropriate cell.
 * @param conv converter contains parameter value to write
 * @param dataSetRow The row of the test data manager
 */
protected void writeTestDataEntry(GuiParamValueConverter conv,int dataSetRow){
  String oldTd=null;
  final IParamDescriptionPO desc=conv.getDesc();
  try {
    oldTd=conv.getCurrentNode().getDataManager().getCell(dataSetRow,desc);
  }
 catch (  IndexOutOfBoundsException e) {
  }
  String td=createOrUpdateTestData(oldTd,conv);
  conv.getCurrentNode().getDataManager().updateCell(td,dataSetRow,desc.getUniqueId());
}

Fixed version (ground truth):
/** 
 * Updates the test data manager of the passed node by writing the value contained in converter into the appropriate cell.
 * @param conv converter contains parameter value to write
 * @param dataSetRow The row of the test data manager
 */
protected void writeTestDataEntry(GuiParamValueConverter conv,int dataSetRow){
  String oldTd=null;
  final IParamDescriptionPO desc=conv.getDesc();
  IParameterInterfacePO currentNode=conv.getCurrentNode();
  ITDManager dataManager=currentNode.getDataManager();
  try {
    oldTd=dataManager.getCell(dataSetRow,desc);
  }
 catch (  IndexOutOfBoundsException e) {
  }
  String td=createOrUpdateTestData(oldTd,conv);
  if (dataManager.getDataSetCount() <= dataSetRow) {
    addDataSet(currentNode,dataSetRow);
  }
  dataManager.updateCell(td,dataSetRow,desc.getUniqueId());
}
Program: 95494
Project: 95494
Buggy source:
/** 
 * Adds a new data set into the given row of the given IParameterInterface
 * @param obj the IParameterInterface object
 * @param row the row to insert
 */
public void addDataSet(IParameterInterfacePO obj,int row){
  obj.getDataManager().insertDataSet(row);
}

Fixed version (ground truth):
/** 
 * Adds a new data set into the given row of the given IParameterInterface
 * @param obj the IParameterInterface object
 * @param row the row to insert
 */
public void addDataSet(IParameterInterfacePO obj,int row){
  IExecTestCasePO exec=(IExecTestCasePO)obj;
  ISpecTestCasePO spec=exec.getSpecTestCase();
  ITDManager dataManager=exec.getDataManager();
  int i=0;
  List<String> list=new ArrayList<String>();
  while (i < dataManager.getUniqueIds().size()) {
    String uuid=dataManager.getUniqueIds().get(i);
    IParamDescriptionPO uniqueID=exec.getParameterForUniqueId(uuid);
    String value=getValueForSpecNodeWithParamDesc(uniqueID,spec);
    list.add(value);
    i++;
  }
  IDataSetPO dataSet=PoMaker.createListWrapperPO(list);
  obj.getDataManager().insertDataSet(dataSet,row);
}
Program: 95495
Project: 95495
Buggy source:
/** 
 * Gets the value (including default value if there is a cap in the spec)
 * @param srcDesc the {@link IParamDescriptionPO} of the parameter to get the value for
 * @param specNode the spec node to check
 * @param column the column number
 * @return the value for a combination of {@link ISpecTestCasePO} column and {@link IParamDescriptionPO}
 */
public static String getValueForSpecNodeWithParamDesc(IParamDescriptionPO srcDesc,ISpecTestCasePO specNode,int column){
  List<INodePO> list=specNode.getUnmodifiableNodeList();
  if (list.size() == 1) {
    INodePO possibleCap=list.get(0);
    if (possibleCap instanceof ICapPO) {
      ICapPO cap=(ICapPO)possibleCap;
      List<IDataSetPO> datasets=cap.getDataManager().getDataSets();
      if (datasets.size() == 1) {
        IDataSetPO set=datasets.get(0);
        int i=0;
        for (        String string : set.getColumnStringValues()) {
          if (string.contains(srcDesc.getUniqueId())) {
            return getDefaultValue(cap,i);
          }
          i++;
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the value (including default value if there is a cap in the spec)
 * @param srcDesc the {@link IParamDescriptionPO} of the parameter to get the value for
 * @param specNode the spec node to check
 * @return the value for a combination of {@link ISpecTestCasePO} column and {@link IParamDescriptionPO}
 */
public static String getValueForSpecNodeWithParamDesc(IParamDescriptionPO srcDesc,ISpecTestCasePO specNode){
  List<INodePO> list=specNode.getUnmodifiableNodeList();
  if (list.size() == 1) {
    INodePO possibleCap=list.get(0);
    if (possibleCap instanceof ICapPO) {
      ICapPO cap=(ICapPO)possibleCap;
      List<IDataSetPO> datasets=cap.getDataManager().getDataSets();
      if (datasets.size() == 1) {
        IDataSetPO set=datasets.get(0);
        int i=0;
        for (        String string : set.getColumnStringValues()) {
          if (string.contains(srcDesc.getUniqueId())) {
            return getDefaultValue(cap,i);
          }
          i++;
        }
      }
    }
  }
  return null;
}
Program: 95497
Project: 95497
Buggy source:
/** 
 * This method is also searching for default values if in the Exec there is only one CAP
 * @param node if this is a {@link IExecTestCasePO} we are also searching ifthere are default values
 * @param desc the {@link IParamDescriptionPO} to get the correct value forthe parameter
 * @param tdManager the data manger
 * @param dataSetIndex the index for the data set
 * @return the value (also default value) for the node
 */
private String getDataForExec(INodePO node,IParamDescriptionPO desc,ITDManager tdManager,int dataSetIndex){
  String data=StringConstants.EMPTY;
  try {
    data=tdManager.getCell(dataSetIndex,desc);
  }
 catch (  IndexOutOfBoundsException e) {
  }
  if (StringUtils.isBlank(data) && node instanceof IExecTestCasePO) {
    INodePO specNode=((IExecTestCasePO)node).getSpecTestCase();
    if (specNode instanceof ISpecTestCasePO) {
      data=AbstractParamInterfaceBP.getValueForSpecNodeWithParamDesc(desc,(ISpecTestCasePO)specNode,dataSetIndex);
    }
  }
  return data;
}

Fixed version (ground truth):
/** 
 * This method is also searching for default values if in the Exec there is only one CAP
 * @param node if this is a {@link IExecTestCasePO} we are also searching ifthere are default values
 * @param desc the {@link IParamDescriptionPO} to get the correct value forthe parameter
 * @param tdManager the data manger
 * @param dataSetIndex the index for the data set
 * @return the value (also default value) for the node
 */
private String getDataForExec(INodePO node,IParamDescriptionPO desc,ITDManager tdManager,int dataSetIndex){
  String data=StringConstants.EMPTY;
  boolean cellNotFound=false;
  try {
    data=tdManager.getCell(dataSetIndex,desc);
  }
 catch (  IndexOutOfBoundsException e) {
    cellNotFound=true;
  }
  if (cellNotFound && StringUtils.isBlank(data) && node instanceof IExecTestCasePO) {
    INodePO specNode=((IExecTestCasePO)node).getSpecTestCase();
    if (specNode instanceof ISpecTestCasePO) {
      data=AbstractParamInterfaceBP.getValueForSpecNodeWithParamDesc(desc,(ISpecTestCasePO)specNode);
    }
  }
  return data;
}
Program: 95498
Project: 95498
Buggy source:
/** 
 * fill test jobs
 * @param tjDTO will be contained the test jobs info
 * @param tj test job object
 */
private void fillTestJob(TestJobDTO tjDTO,ITestJobPO tj){
  for (  Object child : tj.getUnmodifiableNodeList()) {
    if (child instanceof IRefTestSuitePO) {
      IRefTestSuitePO rts=(IRefTestSuitePO)child;
      RefTestSuiteDTO rtsDTO=new RefTestSuiteDTO(rts);
      rtsDTO.setName(rts.getRealName());
      rtsDTO.setUuid(rts.getGuid());
      rtsDTO.setTsUuid(rts.getTestSuiteGuid());
      rtsDTO.setAutId(rts.getTestSuiteAutID());
      tjDTO.addRefTestSuite(rtsDTO);
    }
  }
}

Fixed version (ground truth):
/** 
 * fill test jobs
 * @param tjDTO will be contained the test jobs info
 * @param tj test job object
 */
private void fillTestJob(TestJobDTO tjDTO,ITestJobPO tj){
  for (  INodePO child : tj.getUnmodifiableNodeList()) {
    if (child instanceof IRefTestSuitePO) {
      IRefTestSuitePO rts=(IRefTestSuitePO)child;
      RefTestSuiteDTO rtsDTO=new RefTestSuiteDTO(rts);
      rtsDTO.setName(rts.getRealName());
      rtsDTO.setUuid(rts.getGuid());
      rtsDTO.setTsUuid(rts.getTestSuiteGuid());
      rtsDTO.setAutId(rts.getTestSuiteAutID());
      tjDTO.addRefTestSuite(rtsDTO);
    }
 else     if (child instanceof ICommentPO) {
      tjDTO.addComment(new CommentDTO((ICommentPO)child));
    }
  }
}
Program: 95499
Project: 95499
Buggy source:
/** 
 * fill test suites
 * @param tsDTO will be contained the test suites info
 * @param po test suite object
 */
private void fillTestsuite(TestSuiteDTO tsDTO,ITestSuitePO po){
  if (po.getAut() != null) {
    tsDTO.setSelectedAut(ImportExportUtil.i2str(po.getAut().getId()));
  }
 else {
    tsDTO.setSelectedAut(null);
  }
  tsDTO.setStepDelay(po.getStepDelay());
  tsDTO.setRelevant(po.getRelevant());
  for (  INodePO o : po.getUnmodifiableNodeList()) {
    if (o instanceof IExecTestCasePO) {
      IExecTestCasePO tc=(IExecTestCasePO)o;
      RefTestCaseDTO rtcDTO=new RefTestCaseDTO(tc);
      fillRefTestCase(rtcDTO,tc);
      tsDTO.addUsedTestcase(rtcDTO);
    }
  }
  for (  Object o : po.getDefaultEventHandler().keySet()) {
    String eventType=(String)o;
    Integer evProp=po.getDefaultEventHandler().get(eventType);
    ReentryProperty.Enum reentryProperty=ReentryProperty.Enum.forInt(evProp);
    DefaultEventHandlerDTO ehDTO=new DefaultEventHandlerDTO();
    ehDTO.setEvent(eventType);
    ehDTO.setReentryProperty(reentryProperty.toString());
    if (reentryProperty == ReentryProperty.RETRY) {
      ehDTO.setMaxRetries(1);
    }
    tsDTO.addEventHandler(ehDTO);
  }
}

Fixed version (ground truth):
/** 
 * fill test suites
 * @param tsDTO will be contained the test suites info
 * @param po test suite object
 */
private void fillTestsuite(TestSuiteDTO tsDTO,ITestSuitePO po){
  if (po.getAut() != null) {
    tsDTO.setSelectedAut(ImportExportUtil.i2str(po.getAut().getId()));
  }
 else {
    tsDTO.setSelectedAut(null);
  }
  tsDTO.setStepDelay(po.getStepDelay());
  tsDTO.setRelevant(po.getRelevant());
  for (  INodePO o : po.getUnmodifiableNodeList()) {
    if (o instanceof IExecTestCasePO) {
      IExecTestCasePO tc=(IExecTestCasePO)o;
      RefTestCaseDTO rtcDTO=new RefTestCaseDTO(tc);
      fillRefTestCase(rtcDTO,tc);
      tsDTO.addUsedTestCase(rtcDTO);
    }
 else     if (o instanceof ICommentPO) {
      ICommentPO commentPO=(ICommentPO)o;
      CommentDTO commentDTO=new CommentDTO(commentPO);
      tsDTO.addUsedTestCase(commentDTO);
    }
  }
  for (  Object o : po.getDefaultEventHandler().keySet()) {
    String eventType=(String)o;
    Integer evProp=po.getDefaultEventHandler().get(eventType);
    ReentryProperty.Enum reentryProperty=ReentryProperty.Enum.forInt(evProp);
    DefaultEventHandlerDTO ehDTO=new DefaultEventHandlerDTO();
    ehDTO.setEvent(eventType);
    ehDTO.setReentryProperty(reentryProperty.toString());
    if (reentryProperty == ReentryProperty.RETRY) {
      ehDTO.setMaxRetries(1);
    }
    tsDTO.addEventHandler(ehDTO);
  }
}
Program: 95502
Project: 95502
Buggy source:
/** 
 * @param dto test case dto
 * @param proj currently projectPO
 * @param stcPo if assignNewGuid is false then it is need the spec test case
 * @param assignNewGuid need we a new Guid or not
 * @throws InvalidDataException
 */
private void generateRefTestCase(TestCaseDTO dto,IProjectPO proj,ISpecTestCasePO stcPo,boolean assignNewGuid) throws InvalidDataException {
  try {
    ISpecTestCasePO tc=!assignNewGuid && stcPo != null ? stcPo : m_tcRef.get(m_oldToNewGuids.get(dto.getUuid()));
    for (    NodeDTO stepDto : dto.getTestSteps()) {
      if (stepDto instanceof CapDTO) {
        tc.addNode(createCap(proj,(CapDTO)stepDto,assignNewGuid));
      }
 else       if (stepDto instanceof RefTestCaseDTO) {
        tc.addNode(createExecTestCase(proj,(RefTestCaseDTO)stepDto,assignNewGuid));
      }
    }
    for (    EventTestCaseDTO evTcDto : dto.getEventTestcases()) {
      tc.addEventTestCase(createEventExecTestCase(proj,tc,evTcDto,assignNewGuid));
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * @param dto test case dto
 * @param proj currently projectPO
 * @param stcPo if assignNewGuid is false then it is need the spec test case
 * @param assignNewGuid need we a new Guid or not
 * @throws InvalidDataException
 */
private void generateRefTestCase(TestCaseDTO dto,IProjectPO proj,ISpecTestCasePO stcPo,boolean assignNewGuid) throws InvalidDataException {
  try {
    ISpecTestCasePO tc=!assignNewGuid && stcPo != null ? stcPo : m_tcRef.get(m_oldToNewGuids.get(dto.getUuid()));
    for (    NodeDTO stepDto : dto.getTestSteps()) {
      if (stepDto instanceof CapDTO) {
        tc.addNode(createCap(proj,(CapDTO)stepDto,assignNewGuid));
      }
 else       if (stepDto instanceof RefTestCaseDTO) {
        tc.addNode(createExecTestCase(proj,(RefTestCaseDTO)stepDto,assignNewGuid));
      }
 else       if (stepDto instanceof CommentDTO) {
        tc.addNode(createComment((CommentDTO)stepDto,assignNewGuid));
      }
    }
    for (    EventTestCaseDTO evTcDto : dto.getEventTestcases()) {
      tc.addEventTestCase(createEventExecTestCase(proj,tc,evTcDto,assignNewGuid));
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw e;
  }
}
Program: 95505
Project: 95505
Buggy source:
/** 
 * @param testStep 
 */
public void addTestStep(NodeDTO testStep){
  if (!(testStep instanceof RefTestCaseDTO || testStep instanceof CapDTO)) {
    throw new IllegalArgumentException();
  }
  this.m_testSteps.add(testStep);
}

Fixed version (ground truth):
/** 
 * @param testStep 
 */
public void addTestStep(NodeDTO testStep){
  if (!(testStep instanceof RefTestCaseDTO || testStep instanceof CapDTO || testStep instanceof CommentDTO)) {
    throw new IllegalArgumentException();
  }
  this.m_testSteps.add(testStep);
}
Program: 95506
Project: 95506
Buggy source:
/** 
 * @return refTestSuites
 */
@JsonProperty("String_Node_Str") public List<RefTestSuiteDTO> getRefTestSuites(){
  return m_refTestSuites;
}

Fixed version (ground truth):
/** 
 * @return refTestSuites
 */
@JsonProperty("String_Node_Str") public List<NodeDTO> getRefTestSuites(){
  return m_refTestSuites;
}
Program: 95507
Project: 95507
Buggy source:
/** 
 * activate the editor
 */
private void activateEditor(){
  if (canModify()) {
    m_editor.setEditor(createEditor());
    Control editorCtrl=m_editor.getEditor();
    if ((editorCtrl != null) && !editorCtrl.isDisposed()) {
      editorCtrl.addFocusListener(m_focusListener);
    }
    TextControlBP.selectAll(m_editor.getEditor());
  }
}

Fixed version (ground truth):
/** 
 * activate the editor
 */
private void activateEditor(){
  if (canModify()) {
    m_editor.setEditor(createEditor());
    Control editorCtrl=m_editor.getEditor();
    if ((editorCtrl != null) && !editorCtrl.isDisposed()) {
      editorCtrl.addFocusListener(m_focusListener);
    }
    TextControlBP.selectAll(m_editor.getEditor());
    m_currentEditorIndex=getSelectedDataSet();
  }
}
Program: 95508
Project: 95508
Buggy source:
/** 
 * Writes the data to the selected data set
 * @param property the column property
 * @param value the value to write
 * @param edit the editor
 */
private void writeDataSetData(String property,Object value,AbstractJBEditor edit){
  final int langIndex=getColumnIndexOfProperty(property);
  final int dsNumber=getSelectedDataSet();
  final int paramIndex=getTable().getSelectionIndex();
  setValueToModel(value,edit,paramIndex,dsNumber);
  getTable().getItem(paramIndex).setText(langIndex,value == null ? StringConstants.EMPTY : (String)value);
}

Fixed version (ground truth):
/** 
 * Writes the data to the selected data set
 * @param property the column property
 * @param value the value to write
 * @param edit the editor
 */
private void writeDataSetData(String property,Object value,AbstractJBEditor edit){
  final int langIndex=getColumnIndexOfProperty(property);
  setValueToModel(value,edit,m_currentEditorIndex,m_currentEditorIndex);
  getTable().getItem(m_currentEditorIndex).setText(langIndex,value == null ? StringConstants.EMPTY : (String)value);
}
Program: 95511
Project: 95511
Buggy source:
@Override public Boolean call() throws Exception {
  final Stage tmpS=getStageByTitle(title,operator);
  return tmpS == null;
}

Fixed version (ground truth):
@Override public Boolean call() throws Exception {
  final Stage tmpS=getStageByTitle(title,operator);
  return tmpS == null || !tmpS.isShowing();
}
Program: 95513
Project: 95513
Buggy source:
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param operator the RegEx operator
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPath(String pathType,int preAscend,String treePath,String operator,boolean exists){
  try {
    rcExpand(pathType,preAscend,treePath,operator);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      throw new StepVerifyFailedException("String_Node_Str" + treePath,EventFactory.createVerifyFailed(treePath,StringConstants.EMPTY));
    }
    return;
  }
  if (!exists) {
    throw new StepVerifyFailedException("String_Node_Str",EventFactory.createVerifyFailed(StringConstants.EMPTY,treePath));
  }
}

Fixed version (ground truth):
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param operator the RegEx operator
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPath(String pathType,int preAscend,String treePath,String operator,boolean exists){
  try {
    rcExpand(pathType,preAscend,treePath,operator);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      Verifier.equals(exists,false);
    }
    return;
  }
  if (!exists) {
    Verifier.equals(exists,true);
  }
}
Program: 95514
Project: 95514
Buggy source:
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPathByIndices(String pathType,int preAscend,String treePath,boolean exists){
  try {
    rcExpandByIndices(pathType,preAscend,treePath);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      throw new StepVerifyFailedException("String_Node_Str" + treePath,EventFactory.createVerifyFailed(treePath,StringConstants.EMPTY));
    }
    return;
  }
  if (!exists) {
    throw new StepVerifyFailedException("String_Node_Str",EventFactory.createVerifyFailed(StringConstants.EMPTY,treePath));
  }
}

Fixed version (ground truth):
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPathByIndices(String pathType,int preAscend,String treePath,boolean exists){
  try {
    rcExpandByIndices(pathType,preAscend,treePath);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      Verifier.equals(exists,false);
    }
    return;
  }
  if (!exists) {
    Verifier.equals(exists,true);
  }
}
Program: 95515
Project: 95515
Buggy source:
/** 
 * creates the TableColumns with Parameter
 */
private void initTableViewerParameterColumns(){
  if (getParamInterfaceObj() == null) {
    return;
  }
  final Table table=getTable();
  if (m_paramId == getParamInterfaceObj().getId()) {
    TableColumn[] tableColumns=table.getColumns();
    if (tableColumns != null && tableColumns.length != 0) {
      m_columnWidths=new int[tableColumns.length];
      int i=0;
      for (      TableColumn column : tableColumns) {
        m_columnWidths[i++]=column.getWidth();
      }
    }
  }
 else {
    m_paramId=getParamInterfaceObj().getId();
    m_columnWidths=null;
  }
  String[] columnProperties=new String[getParamInterfaceObj().getParameterList().size() + 1];
  columnProperties[0]=initDataSetColumn();
  int i=1;
  for (  IParamDescriptionPO descr : getParamInterfaceObj().getParameterList()) {
    TableColumn column=new TableColumn(table,SWT.NONE);
    String columnName=descr.getName();
    column.setText(columnName);
    columnProperties[i]=columnName;
    if (m_columnWidths == null || m_columnWidths.length <= i) {
      if (column.getWidth() < COLUMN_WIDTH) {
        column.setWidth(COLUMN_WIDTH);
      }
    }
 else {
      column.setWidth(m_columnWidths[i]);
    }
    i++;
  }
  getTableViewer().setColumnProperties(columnProperties);
}

Fixed version (ground truth):
/** 
 * creates the TableColumns with Parameter
 */
private void initTableViewerParameterColumns(){
  if (getParamInterfaceObj() == null) {
    return;
  }
  final Table table=getTable();
  if (m_paramId == getParamInterfaceObj().getId()) {
    TableColumn[] tableColumns=table.getColumns();
    if (tableColumns != null && tableColumns.length != 0) {
      m_columnWidths=new int[tableColumns.length];
      int i=0;
      for (      TableColumn column : tableColumns) {
        m_columnWidths[i++]=column.getWidth();
      }
      m_columnCount=tableColumns.length;
    }
  }
 else {
    m_paramId=getParamInterfaceObj().getId();
    m_columnWidths=null;
  }
  String[] columnProperties=new String[getParamInterfaceObj().getParameterList().size() + 1];
  columnProperties[0]=initDataSetColumn();
  int i=1;
  int parameterListSize=getParamInterfaceObj().getParameterListSize();
  for (  IParamDescriptionPO descr : getParamInterfaceObj().getParameterList()) {
    TableColumn column=new TableColumn(table,SWT.NONE);
    String columnName=descr.getName();
    column.setText(columnName);
    columnProperties[i]=columnName;
    if (m_columnWidths == null || m_columnWidths.length <= i || m_columnCount != (parameterListSize + 1)) {
      column.setWidth(COLUMN_WIDTH);
    }
 else {
      column.setWidth(m_columnWidths[i]);
    }
    i++;
  }
  getTableViewer().setColumnProperties(columnProperties);
}
Program: 95516
Project: 95516
Buggy source:
/** 
 * Packs the table.
 */
private void packTable(){
  final Table table=getTable();
  final TableColumn[] columns=table.getColumns();
  final int columnCount=columns.length;
  columns[0].setWidth((m_columnWidths != null && m_columnWidths.length > 0) ? m_columnWidths[0] : DATASET_NUMBER_COLUMNWIDTH);
  for (int i=1; i < columnCount; i++) {
    final TableColumn column=columns[i];
    column.pack();
    column.setWidth((m_columnWidths != null && m_columnWidths.length > i) ? m_columnWidths[i] : COLUMN_WIDTH);
  }
}

Fixed version (ground truth):
/** 
 * Packs the table.
 */
private void packTable(){
  final Table table=getTable();
  final TableColumn[] columns=table.getColumns();
  final int columnCount=columns.length;
  if ((m_columnWidths != null && m_columnWidths.length > 0) && m_columnCount == columns.length) {
    columns[0].setWidth(m_columnWidths[0]);
  }
 else {
    columns[0].setWidth(DATASET_NUMBER_COLUMNWIDTH);
  }
  for (int i=1; i < columnCount; i++) {
    final TableColumn column=columns[i];
    column.pack();
    if ((m_columnWidths != null && m_columnWidths.length > i) && m_columnCount == columns.length) {
      column.setWidth(m_columnWidths[i]);
    }
 else {
      column.setWidth(COLUMN_WIDTH);
    }
  }
}
Program: 95517
Project: 95517
Buggy source:
/** 
 * Inits and creates the column for the data set numbers
 * @return the name of the column
 */
private String initDataSetColumn(){
  clearTableViewer();
  final Table table=getTable();
  TableColumn dataSetNumberCol=new TableColumn(table,SWT.NONE);
  dataSetNumberCol.setText(Messages.DataSetViewControllerDataSetNumber);
  dataSetNumberCol.setWidth((m_columnWidths != null && m_columnWidths.length > 0) ? m_columnWidths[0] : DATASET_NUMBER_COLUMNWIDTH);
  return dataSetNumberCol.getText();
}

Fixed version (ground truth):
/** 
 * Inits and creates the column for the data set numbers
 * @return the name of the column
 */
private String initDataSetColumn(){
  clearTableViewer();
  final Table table=getTable();
  TableColumn dataSetNumberCol=new TableColumn(table,SWT.NONE);
  dataSetNumberCol.setText(Messages.DataSetViewControllerDataSetNumber);
  if ((m_columnWidths != null && m_columnWidths.length > 0) && m_columnCount == table.getColumnCount()) {
    dataSetNumberCol.setWidth(m_columnWidths[0]);
  }
 else {
    dataSetNumberCol.setWidth(DATASET_NUMBER_COLUMNWIDTH);
  }
  return dataSetNumberCol.getText();
}
Program: 95518
Project: 95518
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (m_searchString == null || m_searchString.length() == 0 || !(element instanceof IDataSetPO)) {
    return true;
  }
  for (  String value : ((IDataSetPO)element).getColumnStringValues()) {
    if (value.matches(m_searchString)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (m_searchString == null || m_searchString.length() == 0 || !(element instanceof IDataSetPO)) {
    return true;
  }
  for (  String value : ((IDataSetPO)element).getColumnStringValues()) {
    if (value != null && value.matches(m_searchString)) {
      return true;
    }
  }
  return false;
}
Program: 95519
Project: 95519
Buggy source:
/** 
 * @param desc desc of removed parameter of specTc
 * @param childrenIt the Iterator of the children which References are to remove.
 */
private void removeReferences(IParamDescriptionPO desc,Iterator childrenIt){
  while (childrenIt.hasNext()) {
    final IParamNodePO child=(IParamNodePO)childrenIt.next();
    final ITDManager mgr=child.getDataManager();
    final Iterator<TDCell> refIt=child.getParamReferencesIterator();
    while (refIt.hasNext()) {
      final TDCell cell=refIt.next();
      final String guid=mgr.getUniqueIds().get(cell.getCol());
      final IParamDescriptionPO childDesc=child.getParameterForUniqueId(guid);
      final ModelParamValueConverter conv=new ModelParamValueConverter(cell.getTestData(),child,childDesc);
      if (conv.containsReferences()) {
        final boolean isModified=conv.removeReference(desc.getUniqueId());
        if (isModified) {
          cell.setTestData(conv.getModelString());
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param desc desc of removed parameter of specTc
 * @param childrenIt the Iterator of the children which References are to remove.
 */
private void removeReferences(IParamDescriptionPO desc,Iterator<? extends INodePO> childrenIt){
  while (childrenIt.hasNext()) {
    INodePO node=childrenIt.next();
    if (node instanceof IParamNodePO) {
      final IParamNodePO child=(IParamNodePO)node;
      final ITDManager mgr=child.getDataManager();
      final Iterator<TDCell> refIt=child.getParamReferencesIterator();
      while (refIt.hasNext()) {
        final TDCell cell=refIt.next();
        final String guid=mgr.getUniqueIds().get(cell.getCol());
        final IParamDescriptionPO childDesc=child.getParameterForUniqueId(guid);
        final ModelParamValueConverter conv=new ModelParamValueConverter(cell.getTestData(),child,childDesc);
        if (conv.containsReferences()) {
          final boolean isModified=conv.removeReference(desc.getUniqueId());
          if (isModified) {
            cell.setTestData(conv.getModelString());
          }
        }
      }
    }
  }
}
Program: 95521
Project: 95521
Buggy source:
/** 
 * public constructor
 * @param message the detailed message
 * @param id An ErrorMessage.ID.  {@inheritDoc}
 */
public ConfigXmlException(String message,Integer id){
  super(message,id);
}

Fixed version (ground truth):
/** 
 * public constructor
 * @param toolkitDescriptor the name of the {@link org.eclipse.jubula.tools.internal.xml.businessmodell.ToolkitDescriptor}
 * @param message the detailed message
 * @param id An ErrorMessage.ID. {@inheritDoc}
 */
public ConfigXmlException(String toolkitDescriptor,String message,Integer id){
  super(message,id);
  m_toolkitDescriptor=toolkitDescriptor;
}
Program: 95522
Project: 95522
Buggy source:
/** 
 * Validates the Components.
 */
private void validateComponents(){
  for (  AbstractComponent ac : m_abstractComponents) {
    if (ac.getRealizers().isEmpty()) {
      String message="String_Node_Str" + ac.getType() + "String_Node_Str";
      if (ac.isVisible()) {
        log.error("String_Node_Str" + message);
        throw new ConfigXmlException("String_Node_Str" + message,MessageIDs.E_NO_ABSTRACT_COMPONENT);
      }
      log.warn(message);
    }
  }
  for (  ConcreteComponent cc : m_concreteComponents) {
    if (cc.isExtender() && !StringUtils.isBlank(cc.getComponentClass().getName())) {
      final String msg="String_Node_Str" + cc.getType() + "String_Node_Str";
      log.error(msg);
      throw new ConfigXmlException(msg,MessageIDs.E_GENERAL_COMPONENT_ERROR);
    }
  }
}

Fixed version (ground truth):
/** 
 * Validates the Components.
 */
private void validateComponents(){
  for (  AbstractComponent ac : m_abstractComponents) {
    if (ac.getRealizers().isEmpty()) {
      String message="String_Node_Str" + ac.getType() + "String_Node_Str";
      if (ac.isVisible()) {
        log.error("String_Node_Str" + message);
        throw new ConfigXmlException(ac.getToolkitDesriptor().getToolkitID(),"String_Node_Str" + message,MessageIDs.E_NO_ABSTRACT_COMPONENT);
      }
      log.warn(message);
    }
  }
  for (  ConcreteComponent cc : m_concreteComponents) {
    if (cc.isExtender() && !StringUtils.isBlank(cc.getComponentClass().getName())) {
      final String msg="String_Node_Str" + cc.getType() + "String_Node_Str";
      log.error(msg);
      throw new ConfigXmlException(cc.getToolkitDesriptor().getToolkitID(),msg,MessageIDs.E_GENERAL_COMPONENT_ERROR);
    }
  }
}
Program: 95523
Project: 95523
Buggy source:
/** 
 * Checks if there are multiple components with the same type.
 * @param component A <code>org.eclipse.jubula.tools.internal.xml.businessmodell.Component</code> object
 */
private void check(Component component){
  for (  Component current : getComponents()) {
    if (current.getType().equals(component.getType())) {
      final String msg="String_Node_Str" + component.getType();
      log.error(msg);
      throw new ConfigXmlException(msg,MessageIDs.E_MULTIPLE_COMPONENT);
    }
  }
}

Fixed version (ground truth):
/** 
 * Checks if there are multiple components with the same type.
 * @param component A <code>org.eclipse.jubula.tools.internal.xml.businessmodell.Component</code> object
 */
private void check(Component component){
  for (  Component current : getComponents()) {
    if (current.getType().equals(component.getType())) {
      final String msg="String_Node_Str" + component.getType();
      log.error(msg);
      String descriptor=current.getToolkitDesriptor().getToolkitID() + StringConstants.COMMA + StringConstants.SPACE+ component.getToolkitDesriptor().getToolkitID();
      throw new ConfigXmlException(descriptor,msg,MessageIDs.E_MULTIPLE_COMPONENT);
    }
  }
}
Program: 95524
Project: 95524
Buggy source:
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param operator the RegEx operator
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPath(String pathType,int preAscend,String treePath,String operator,boolean exists){
  try {
    rcExpand(pathType,preAscend,treePath,operator);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      throw new StepVerifyFailedException("String_Node_Str" + treePath,EventFactory.createVerifyFailed(treePath,StringConstants.EMPTY));
    }
    return;
  }
  if (!exists) {
    throw new StepVerifyFailedException("String_Node_Str",EventFactory.createVerifyFailed(StringConstants.EMPTY,treePath));
  }
}

Fixed version (ground truth):
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param operator the RegEx operator
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPath(String pathType,int preAscend,String treePath,String operator,boolean exists){
  try {
    rcExpand(pathType,preAscend,treePath,operator);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      Verifier.equals(exists,false);
    }
    return;
  }
  if (!exists) {
    Verifier.equals(exists,true);
  }
}
Program: 95525
Project: 95525
Buggy source:
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPathByIndices(String pathType,int preAscend,String treePath,boolean exists){
  try {
    rcExpandByIndices(pathType,preAscend,treePath);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      throw new StepVerifyFailedException("String_Node_Str" + treePath,EventFactory.createVerifyFailed(treePath,StringConstants.EMPTY));
    }
    return;
  }
  if (!exists) {
    throw new StepVerifyFailedException("String_Node_Str",EventFactory.createVerifyFailed(StringConstants.EMPTY,treePath));
  }
}

Fixed version (ground truth):
/** 
 * Tests whether the given treePath exists or not
 * @param pathType whether the path is relative or absolute
 * @param preAscend Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
 * @param treePath the path to check
 * @param exists if true, the verify succeeds if the path DOES exist.If false, the verify succeeds if the path DOES NOT exist.
 */
public void rcVerifyPathByIndices(String pathType,int preAscend,String treePath,boolean exists){
  try {
    rcExpandByIndices(pathType,preAscend,treePath);
  }
 catch (  StepExecutionException e) {
    if (exists) {
      Verifier.equals(exists,false);
    }
    return;
  }
  if (!exists) {
    Verifier.equals(exists,true);
  }
}
Program: 95527
Project: 95527
Buggy source:
@Override public void mouseDown(MouseEvent e){
  getClearButton().setImage(pressedImage);
  m_moveListener=new MouseMoveListener(){
    private boolean m_isMouseInButton=true;
    @Override public void mouseMove(    MouseEvent e){
      boolean isMouseInButton=isMouseInButton(e);
      if (isMouseInButton != m_isMouseInButton) {
        m_isMouseInButton=isMouseInButton;
        getClearButton().setImage(isMouseInButton ? pressedImage : inactiveImage);
      }
    }
  }
;
  getClearButton().addMouseMoveListener(m_moveListener);
}

Fixed version (ground truth):
@Override public void mouseDown(MouseEvent e){
  getClearButton().setImage(pressedImage);
  m_moveListener=new MouseMoveListener(){
    private boolean m_isMouseInButton=true;
    @Override public void mouseMove(    MouseEvent e2){
      boolean isMouseInButton=isMouseInButton(e2);
      if (isMouseInButton != m_isMouseInButton) {
        m_isMouseInButton=isMouseInButton;
        getClearButton().setImage(isMouseInButton ? pressedImage : inactiveImage);
      }
    }
  }
;
  getClearButton().addMouseMoveListener(m_moveListener);
}
Program: 95528
Project: 95528
Buggy source:
/** 
 * {@inheritDoc}
 */
public Object getAdapter(Class adapter){
  return null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public <T>T getAdapter(Class<T> adapter){
  return null;
}
Program: 95529
Project: 95529
Buggy source:
@Override public void mouseMove(MouseEvent e){
  boolean isMouseInButton=isMouseInButton(e);
  if (isMouseInButton != m_isMouseInButton) {
    m_isMouseInButton=isMouseInButton;
    getClearButton().setImage(isMouseInButton ? pressedImage : inactiveImage);
  }
}

Fixed version (ground truth):
@Override public void mouseMove(MouseEvent e2){
  boolean isMouseInButton=isMouseInButton(e2);
  if (isMouseInButton != m_isMouseInButton) {
    m_isMouseInButton=isMouseInButton;
    getClearButton().setImage(isMouseInButton ? pressedImage : inactiveImage);
  }
}
Program: 95530
Project: 95530
Buggy source:
/** 
 * attachs the detached workVersion to a new session to use for postprocessing of Persistence (JPA / EclipseLink) exceptions without refresh of objects 
 * @throws PMException in case of any db error
 */
public void reinitializeEditSupport() throws PMException {
  try {
    IPersistentObject workVersion=m_workVersion;
    close();
    init();
    m_workVersion=workVersion;
    m_compMapper.setCompNameCache(new ComponentNamesDecorator(getSession()));
    m_compMapper.setContext(m_workVersion);
    m_workVersion=m_session.merge(m_workVersion);
  }
 catch (  PersistenceException e) {
    final String msg=Messages.ReinitOfSessionFailed;
    log.error(msg);
    throw new PMException(msg,MessageIDs.E_DATABASE_GENERAL);
  }
}

Fixed version (ground truth):
/** 
 * attachs the detached workVersion to a new session to use for postprocessing of Persistence (JPA / EclipseLink) exceptions without refresh of objects 
 * @throws PMException in case of any db error
 */
public void reinitializeEditSupport() throws PMException {
  try {
    IPersistentObject workVersion=m_workVersion;
    close();
    init();
    m_workVersion=workVersion;
    m_compMapper.setCompNameCache(new ComponentNamesDecorator(getSession()));
    m_workVersion=m_session.merge(m_workVersion);
    m_compMapper.setContext(m_workVersion);
  }
 catch (  PersistenceException e) {
    final String msg=Messages.ReinitOfSessionFailed;
    log.error(msg);
    throw new PMException(msg,MessageIDs.E_DATABASE_GENERAL);
  }
}
Program: 95531
Project: 95531
Buggy source:
/** 
 * executes the right update
 * @param event int
 * @param obj Object
 */
private void switchEvent(int event,Object obj){
switch (event) {
case IObjectMappingObserver.EVENT_STEP_RECORDED:
    IAUTMainPO aut=(IAUTMainPO)obj;
  if (getAut().equals(aut)) {
    cleanupNames();
  }
break;
case IObjectMappingObserver.EVENT_COMPONENT_MAPPED:
IAUTMainPO connectedAut=TestExecution.getInstance().getConnectedAut();
if (getAut().equals(connectedAut)) {
IComponentIdentifier[] comp=(IComponentIdentifier[])obj;
createNewTechnicalNames(comp);
}
break;
default :
}
}

Fixed version (ground truth):
/** 
 * executes the right update
 * @param event int
 * @param obj Object
 */
private void switchEvent(int event,Object obj){
switch (event) {
case IObjectMappingObserver.EVENT_STEP_RECORDED:
    IAUTMainPO aut=(IAUTMainPO)obj;
  if (getAut().equals(aut)) {
    cleanupNames();
    synchronizeViewers();
  }
break;
case IObjectMappingObserver.EVENT_COMPONENT_MAPPED:
IAUTMainPO connectedAut=TestExecution.getInstance().getConnectedAut();
if (getAut().equals(connectedAut)) {
IComponentIdentifier[] comp=(IComponentIdentifier[])obj;
createNewTechnicalNames(comp);
}
break;
default :
}
}
Program: 95533
Project: 95533
Buggy source:
/** 
 * @param toDelete The items to delete.
 * @param editor The editor in which the delete is taking place.
 * @return the parent of one of the given elements before its deletion, or <code>null</code> if no elements are deleted.
 */
public static Object deleteMultipleElements(Object[] toDelete,ObjectMappingMultiPageEditor editor){
  IObjectMappingCategoryPO lastParent=null;
  for (  Object node : toDelete) {
    if (node instanceof IComponentNamePO) {
      lastParent=editor.getOmEditorBP().deleteCompName((IComponentNamePO)node);
    }
 else     if (node instanceof IObjectMappingAssoziationPO) {
      lastParent=editor.getOmEditorBP().deleteAssociation((IObjectMappingAssoziationPO)node);
    }
 else     if (node instanceof IObjectMappingCategoryPO) {
      lastParent=editor.getOmEditorBP().deleteCategory((IObjectMappingCategoryPO)node);
    }
  }
  if (toDelete.length > 0) {
    editor.getEditorHelper().setDirty(true);
    editor.cleanupNames();
  }
  return lastParent;
}

Fixed version (ground truth):
/** 
 * @param toDelete The items to delete.
 * @param editor The editor in which the delete is taking place.
 * @return the parent of one of the given elements before its deletion, or <code>null</code> if no elements are deleted.
 */
public static Object deleteMultipleElements(Object[] toDelete,ObjectMappingMultiPageEditor editor){
  IObjectMappingCategoryPO lastParent=null;
  for (  Object node : toDelete) {
    if (node instanceof IComponentNamePO) {
      lastParent=editor.getOmEditorBP().deleteCompName((IComponentNamePO)node);
    }
 else     if (node instanceof IObjectMappingAssoziationPO) {
      lastParent=editor.getOmEditorBP().deleteAssociation((IObjectMappingAssoziationPO)node);
    }
 else     if (node instanceof IObjectMappingCategoryPO) {
      lastParent=editor.getOmEditorBP().deleteCategory((IObjectMappingCategoryPO)node);
    }
  }
  if (toDelete.length > 0) {
    editor.getEditorHelper().setDirty(true);
    editor.cleanupNames();
    editor.synchronizeViewers();
  }
  return lastParent;
}
Program: 95534
Project: 95534
Buggy source:
/** 
 * {@inheritDoc}
 */
@Transient public Set<IAUTMainPO> getAutMainList(){
  return Collections.unmodifiableSet(getHbmAutCont().getAutMainList());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Transient public Set<IAUTMainPO> getAutMainList(){
  AUTContPO autCont=getHbmAutCont();
  if (autCont != null) {
    Set<IAUTMainPO> autMainList=autCont.getAutMainList();
    if (autMainList != null) {
      return Collections.unmodifiableSet(autMainList);
    }
    log.error("String_Node_Str");
  }
 else {
    log.error("String_Node_Str");
  }
  return null;
}
Program: 95535
Project: 95535
Buggy source:
/** 
 * @return AUTs, which support working language
 */
private Set<IAUTMainPO> getAUTs(){
  Set<IAUTMainPO> autsForLang=new HashSet<IAUTMainPO>();
  Set<IAUTMainPO> autsOfProject=GeneralStorage.getInstance().getProject().getAutMainList();
  for (  IAUTMainPO aut : autsOfProject) {
    autsForLang.add(aut);
  }
  return autsForLang;
}

Fixed version (ground truth):
/** 
 * @return AUTs, which support working language
 */
private Set<IAUTMainPO> getAUTs(){
  return GeneralStorage.getInstance().getProject().getAutMainList();
}
Program: 95536
Project: 95536
Buggy source:
/** 
 * @param userName The user name.
 * @param pwd The password.
 * @param url connection string / URL
 * @param monitor the progress monitor to use           
 * @return the only instance of the Persistor, building the connection tothe database
 * @throws JBFatalException .
 * @throws JBException .
 */
private static Persistor instance(String userName,String pwd,String url,IProgressMonitor monitor) throws JBFatalException, JBException {
  if (instance == null) {
    try {
      instance=new Persistor(userName,pwd,url,monitor);
      DatabaseStateDispatcher.notifyListener(new DatabaseStateEvent(DatabaseState.DB_LOGIN_SUCCEEDED));
    }
 catch (    DatabaseVersionConflictException e) {
      final Integer dbMajorVersion=e.getDatabaseMajorVersion();
      final Integer dbMinorVersion=e.getDatabaseMinorVersion();
      final Integer cDBMajorVersion=MODEL_VERSION.getMajor();
      final Integer cDBMinorVersion=MODEL_VERSION.getMinor();
      final String errorMessage=NLS.bind(Messages.DBVersionProblem,new Object[]{dbMajorVersion,dbMinorVersion,cDBMajorVersion,cDBMinorVersion});
      if (cDBMajorVersion > dbMajorVersion || (cDBMajorVersion.equals(dbMajorVersion) && cDBMinorVersion > dbMinorVersion)) {
        if (!handleDatabaseVersionConflict(e)) {
          throw new PMDatabaseConfException(errorMessage,MessageIDs.E_INVALID_DB_VERSION);
        }
      }
 else {
        throw new PMDatabaseConfException(errorMessage,MessageIDs.E_INVALID_DB_VERSION);
      }
    }
    LockManager.instance().startKeepAlive();
  }
  return instance;
}

Fixed version (ground truth):
/** 
 * @param userName The user name.
 * @param pwd The password.
 * @param url connection string / URL
 * @param monitor the progress monitor to use           
 * @return the only instance of the Persistor, building the connection tothe database
 * @throws JBFatalException .
 * @throws JBException .
 */
private static Persistor instance(String userName,String pwd,String url,IProgressMonitor monitor) throws JBFatalException, JBException {
  if (instance == null) {
    try {
      instance=new Persistor(userName,pwd,url,monitor);
      DatabaseStateDispatcher.notifyListener(new DatabaseStateEvent(DatabaseState.DB_LOGIN_SUCCEEDED));
    }
 catch (    DatabaseVersionConflictException e) {
      final Integer dbMajorVersion=e.getDatabaseMajorVersion();
      final Integer dbMinorVersion=e.getDatabaseMinorVersion();
      final Integer cDBMajorVersion=MODEL_VERSION.getMajor();
      final Integer cDBMinorVersion=MODEL_VERSION.getMinor();
      final String errorMessage=NLS.bind(Messages.DBVersionProblem,new Object[]{dbMajorVersion,dbMinorVersion,cDBMajorVersion,cDBMinorVersion});
      if (!handleDatabaseVersionConflict(e)) {
        throw new PMDatabaseConfException(errorMessage,MessageIDs.E_INVALID_DB_VERSION);
      }
    }
    LockManager.instance().startKeepAlive();
  }
  return instance;
}