nus-yam/ex-repair huggingface dataset:
Program: 52666
Project: 52666
Buggy source:
public static byte[] urlsafeEncodeBytes(byte[] src){
  return Base64.encodeBase64(src,false,false);
}

Fixed version (ground truth):
public static byte[] urlsafeEncodeBytes(byte[] src){
  if (src.length % 3 == 0) {
    return Base64.encodeBase64(src,false,true);
  }
  byte[] b=Base64.encodeBase64(src,false,true);
  int pad=4 - b.length % 4;
  byte[] b2=new byte[b.length + pad];
  System.arraycopy(b,0,b2,0,b.length);
  b2[b.length]='=';
  if (pad > 1) {
    b2[b.length + 1]='=';
  }
  return b2;
}
Program: 52667
Project: 52667
Buggy source:
public static String urlsafeEncode(String text){
  return new String(Base64.encodeBase64(text.getBytes(),false,false));
}

Fixed version (ground truth):
public static String urlsafeEncode(String text){
  return new String(urlsafeEncodeBytes(text.getBytes()));
}
Program: 52668
Project: 52668
Buggy source:
@Override public void setAuth(HttpMessage httpMessage){
  httpMessage.setHeader("String_Node_Str","String_Node_Str" + token);
}

Fixed version (ground truth):
@Override public void setAuth(HttpMessage httpMessage){
  httpMessage.setHeader("String_Node_Str",token);
}
Program: 52669
Project: 52669
Buggy source:
public UpTokenClient(String token){
  this.token=token;
}

Fixed version (ground truth):
public UpTokenClient(String token){
  this.token="String_Node_Str" + token;
}
Program: 52670
Project: 52670
Buggy source:
public static PutFileRet resumablePutFile(UpService c,String[] checksums,BlockProgress[] progresses,ProgressNotifier progressNotifier,BlockProgressNotifier blockProgressNotifier,String entryUri,String mimeType,RandomAccessFile f,long fsize,String customMeta,String callbackParams){
  ResumablePutRet ret=c.resumablePut(f,fsize,checksums,progresses,progressNotifier,blockProgressNotifier);
  if (!ret.ok()) {
    return new PutFileRet(ret);
  }
  if (mimeType == null || mimeType.isEmpty()) {
    mimeType="String_Node_Str";
  }
  String params="String_Node_Str" + Base64.encodeBase64String(mimeType.getBytes());
  if (customMeta != null && !customMeta.isEmpty()) {
    params+="String_Node_Str" + Base64.encodeBase64String(customMeta.getBytes());
  }
  PutFileRet putFileRet=c.makeFile("String_Node_Str",entryUri,fsize,params,callbackParams,checksums);
  return putFileRet;
}

Fixed version (ground truth):
public static PutFileRet resumablePutFile(UpService c,String[] checksums,BlockProgress[] progresses,ProgressNotifier progressNotifier,BlockProgressNotifier blockProgressNotifier,String bucketName,String key,String mimeType,RandomAccessFile f,long fsize,String customMeta,String callbackParams){
  ResumablePutRet ret=c.resumablePut(f,fsize,checksums,progresses,progressNotifier,blockProgressNotifier);
  if (!ret.ok()) {
    return new PutFileRet(ret);
  }
  if (mimeType == null || mimeType.isEmpty()) {
    mimeType="String_Node_Str";
  }
  String params="String_Node_Str" + Base64.encodeBase64String(mimeType.getBytes());
  if (customMeta != null && !customMeta.isEmpty()) {
    params+="String_Node_Str" + Base64.encodeBase64String(customMeta.getBytes());
  }
  String entryUri=bucketName + "String_Node_Str" + key;
  PutFileRet putFileRet=c.makeFile("String_Node_Str",entryUri,fsize,params,callbackParams,checksums);
  return putFileRet;
}
Program: 52673
Project: 52673
Buggy source:
@Inject public InvestmentPlanDialog(@Named(IServiceConstants.ACTIVE_SHELL) Shell parentShell,Client client,Class<? extends Transaction> planType){
  super(parentShell);
  this.client=client;
  this.planType=planType;
  setModel(new InvestmentPlanModel(client));
}

Fixed version (ground truth):
@Inject public InvestmentPlanDialog(@Named(IServiceConstants.ACTIVE_SHELL) Shell parentShell,Client client,Class<? extends Transaction> planType){
  super(parentShell);
  this.client=client;
  this.planType=planType;
  setModel(new InvestmentPlanModel(client,planType));
}
Program: 52674
Project: 52674
Buggy source:
public InvestmentPlanModel(Client client){
  this.client=client;
}

Fixed version (ground truth):
public InvestmentPlanModel(Client client,Class<? extends Transaction> planType){
  this.client=client;
  if (planType == AccountTransaction.class)   portfolio=DEPOSIT;
}
Program: 52675
Project: 52675
Buggy source:
public void setPortfolio(Portfolio portfolio){
  String oldTransactionCurrency=getTransactionCurrencyCode();
  if (portfolio.equals(InvestmentPlanModel.DEPOSIT))   firePropertyChange(Properties.security.name(),this.security,this.security=null);
  firePropertyChange(Properties.portfolio.name(),this.portfolio,this.portfolio=portfolio);
  firePropertyChange(Properties.transactionCurrencyCode.name(),oldTransactionCurrency,getTransactionCurrencyCode());
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}

Fixed version (ground truth):
public void setPortfolio(Portfolio portfolio){
  String oldTransactionCurrency=getTransactionCurrencyCode();
  if (DEPOSIT.equals(portfolio))   firePropertyChange(Properties.security.name(),this.security,this.security=null);
  firePropertyChange(Properties.portfolio.name(),this.portfolio,this.portfolio=portfolio);
  firePropertyChange(Properties.transactionCurrencyCode.name(),oldTransactionCurrency,getTransactionCurrencyCode());
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}
Program: 52676
Project: 52676
Buggy source:
@Override public void onModified(Object element,Object newValue,Object oldValue){
  InvestmentPlan plan=(InvestmentPlan)element;
  if (plan.getAccount() != null && plan.getAccount().equals(InvestmentPlanModel.DELIVERY))   plan.setAccount(null);
  markDirty();
}

Fixed version (ground truth):
@Override public void onModified(Object element,Object newValue,Object oldValue){
  markDirty();
}
Program: 52678
Project: 52678
Buggy source:
protected void configureShell(Shell shell){
  super.configureShell(shell);
  shell.setText(Messages.LabelReportInterval);
}

Fixed version (ground truth):
@Override protected void configureShell(Shell shell){
  super.configureShell(shell);
  shell.setText(Messages.LabelReportInterval);
}
Program: 52679
Project: 52679
Buggy source:
@Override protected Control createDialogArea(Composite parent){
  Composite container=(Composite)super.createDialogArea(parent);
  Composite tableArea=new Composite(container,SWT.NONE);
  GridDataFactory.fillDefaults().grab(true,true).minSize(SWT.DEFAULT,200).applyTo(tableArea);
  TableColumnLayout layout=new TableColumnLayout();
  tableArea.setLayout(layout);
  tableViewer=new TableViewer(tableArea,SWT.BORDER | SWT.MULTI | SWT.MULTI);
  final Table table=tableViewer.getTable();
  table.setHeaderVisible(false);
  table.setLinesVisible(false);
  TableViewerColumn column=new TableViewerColumn(tableViewer,SWT.None);
  layout.setColumnData(column.getColumn(),new ColumnWeightData(100));
  tableViewer.setLabelProvider(new LabelProvider(){
    @Override public Image getImage(    Object element){
      return Images.TEXT.image();
    }
  }
);
  tableViewer.setContentProvider(ArrayContentProvider.getInstance());
  tableViewer.setInput(periods);
  new ContextMenu(tableViewer.getTable(),m -> fillContextMenu(m)).hook();
  return container;
}

Fixed version (ground truth):
@Override protected Control createDialogArea(Composite parent){
  Composite container=(Composite)super.createDialogArea(parent);
  Composite tableArea=new Composite(container,SWT.NONE);
  GridDataFactory.fillDefaults().grab(true,true).minSize(SWT.DEFAULT,200).applyTo(tableArea);
  TableColumnLayout layout=new TableColumnLayout();
  tableArea.setLayout(layout);
  tableViewer=new TableViewer(tableArea,SWT.BORDER | SWT.MULTI);
  final Table table=tableViewer.getTable();
  table.setHeaderVisible(false);
  table.setLinesVisible(false);
  TableViewerColumn column=new TableViewerColumn(tableViewer,SWT.None);
  layout.setColumnData(column.getColumn(),new ColumnWeightData(100));
  tableViewer.setLabelProvider(new LabelProvider(){
    @Override public Image getImage(    Object element){
      return Images.TEXT.image();
    }
  }
);
  tableViewer.setContentProvider(ArrayContentProvider.getInstance());
  tableViewer.setInput(periods);
  new ContextMenu(tableViewer.getTable(),this::fillContextMenu).hook();
  return container;
}
Program: 52680
Project: 52680
Buggy source:
public void setShares(long shares){
  firePropertyChange(Properties.shares.name(),this.shares,this.shares=shares);
  if (quote.doubleValue() != 0) {
    triggerGrossValue(Math.round(shares * quote.doubleValue() * Values.Amount.factor() / Values.Share.divider()));
  }
 else   if (grossValue != 0 && shares != 0) {
    setQuote(new BigDecimal(grossValue * Values.Share.factor() / (shares * Values.Amount.divider())));
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}

Fixed version (ground truth):
public void setShares(long shares){
  firePropertyChange(Properties.shares.name(),this.shares,this.shares=shares);
  if (quote.doubleValue() != 0) {
    triggerGrossValue(Math.round(shares * quote.doubleValue() * Values.Amount.factor() / Values.Share.divider()));
  }
 else   if (grossValue != 0 && shares != 0) {
    setQuote(BigDecimal.valueOf(grossValue * Values.Share.factor() / (shares * Values.Amount.divider())));
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}
Program: 52681
Project: 52681
Buggy source:
public void setGrossValue(long grossValue){
  triggerGrossValue(grossValue);
  if (shares != 0) {
    BigDecimal newQuote=new BigDecimal(grossValue * Values.Share.factor() / (shares * Values.Amount.divider()));
    firePropertyChange(Properties.quote.name(),this.quote,this.quote=newQuote);
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}

Fixed version (ground truth):
public void setGrossValue(long grossValue){
  triggerGrossValue(grossValue);
  if (shares != 0) {
    BigDecimal newQuote=BigDecimal.valueOf(grossValue * Values.Share.factor() / (shares * Values.Amount.divider()));
    firePropertyChange(Properties.quote.name(),this.quote,this.quote=newQuote);
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}
Program: 52682
Project: 52682
Buggy source:
public void setTotal(long total){
  triggerTotal(total);
  firePropertyChange(Properties.convertedGrossValue.name(),this.convertedGrossValue,this.convertedGrossValue=calculateConvertedGrossValue());
  firePropertyChange(Properties.grossValue.name(),this.grossValue,this.grossValue=Math.round(convertedGrossValue / exchangeRate.doubleValue()));
  if (shares != 0)   firePropertyChange(Properties.quote.name(),this.quote,this.quote=new BigDecimal(grossValue * Values.Share.factor() / (shares * Values.Amount.divider())));
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}

Fixed version (ground truth):
public void setTotal(long total){
  triggerTotal(total);
  firePropertyChange(Properties.convertedGrossValue.name(),this.convertedGrossValue,this.convertedGrossValue=calculateConvertedGrossValue());
  firePropertyChange(Properties.grossValue.name(),this.grossValue,this.grossValue=Math.round(convertedGrossValue / exchangeRate.doubleValue()));
  if (shares != 0)   firePropertyChange(Properties.quote.name(),this.quote,this.quote=BigDecimal.valueOf(grossValue * Values.Share.factor() / (shares * Values.Amount.divider())));
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}
Program: 52683
Project: 52683
Buggy source:
protected void updateSharesAndQuote(){
  if (hasSource())   return;
  if (type == PortfolioTransaction.Type.SELL || type == PortfolioTransaction.Type.DELIVERY_OUTBOUND) {
    boolean hasPosition=false;
    if (portfolio != null) {
      CurrencyConverter converter=new CurrencyConverterImpl(getExchangeRateProviderFactory(),CurrencyUnit.EUR);
      PortfolioSnapshot snapshot=PortfolioSnapshot.create(portfolio,converter,date);
      SecurityPosition position=snapshot.getPositionsBySecurity().get(security);
      if (position != null) {
        setShares(position.getShares());
        setTotal(position.calculateValue().getAmount());
        hasPosition=true;
      }
    }
    if (!hasPosition) {
      setShares(0);
      setQuote(new BigDecimal(security.getSecurityPrice(date).getValue() / Values.Quote.divider()));
    }
  }
 else {
    setQuote(new BigDecimal(security.getSecurityPrice(date).getValue() / Values.Quote.divider()));
  }
}

Fixed version (ground truth):
protected void updateSharesAndQuote(){
  if (hasSource())   return;
  if (type == PortfolioTransaction.Type.SELL || type == PortfolioTransaction.Type.DELIVERY_OUTBOUND) {
    boolean hasPosition=false;
    if (portfolio != null) {
      CurrencyConverter converter=new CurrencyConverterImpl(getExchangeRateProviderFactory(),CurrencyUnit.EUR);
      PortfolioSnapshot snapshot=PortfolioSnapshot.create(portfolio,converter,date);
      SecurityPosition position=snapshot.getPositionsBySecurity().get(security);
      if (position != null) {
        setShares(position.getShares());
        setTotal(position.calculateValue().getAmount());
        hasPosition=true;
      }
    }
    if (!hasPosition) {
      setShares(0);
      setQuote(BigDecimal.valueOf(security.getSecurityPrice(date).getValue() / Values.Quote.divider()));
    }
  }
 else {
    setQuote(BigDecimal.valueOf(security.getSecurityPrice(date).getValue() / Values.Quote.divider()));
  }
}
Program: 52684
Project: 52684
Buggy source:
protected void fillFromTransaction(PortfolioTransaction transaction){
  this.security=transaction.getSecurity();
  LocalDateTime transactionDate=transaction.getDateTime();
  this.date=transactionDate.toLocalDate();
  this.time=transactionDate.toLocalTime();
  this.shares=transaction.getShares();
  this.total=transaction.getAmount();
  this.note=transaction.getNote();
  this.exchangeRate=BigDecimal.ONE;
  transaction.getUnits().forEach(unit -> {
switch (unit.getType()) {
case GROSS_VALUE:
      this.exchangeRate=unit.getExchangeRate();
    this.grossValue=unit.getForex().getAmount();
  this.quote=new BigDecimal(this.grossValue * Values.Share.factor() / (this.shares * Values.Amount.divider()));
break;
case FEE:
if (unit.getForex() != null) this.forexFees+=unit.getForex().getAmount();
 else this.fees+=unit.getAmount().getAmount();
break;
case TAX:
if (unit.getForex() != null) this.forexTaxes+=unit.getForex().getAmount();
 else this.taxes+=unit.getAmount().getAmount();
break;
default :
throw new UnsupportedOperationException();
}
}
);
this.convertedGrossValue=calculateConvertedGrossValue();
if (exchangeRate.equals(BigDecimal.ONE)) {
this.grossValue=convertedGrossValue;
this.quote=transaction.getGrossPricePerShare().toBigDecimal();
}
firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}

Fixed version (ground truth):
protected void fillFromTransaction(PortfolioTransaction transaction){
  this.security=transaction.getSecurity();
  LocalDateTime transactionDate=transaction.getDateTime();
  this.date=transactionDate.toLocalDate();
  this.time=transactionDate.toLocalTime();
  this.shares=transaction.getShares();
  this.total=transaction.getAmount();
  this.note=transaction.getNote();
  this.exchangeRate=BigDecimal.ONE;
  transaction.getUnits().forEach(unit -> {
switch (unit.getType()) {
case GROSS_VALUE:
      this.exchangeRate=unit.getExchangeRate();
    this.grossValue=unit.getForex().getAmount();
  this.quote=BigDecimal.valueOf(this.grossValue * Values.Share.factor() / (this.shares * Values.Amount.divider()));
break;
case FEE:
if (unit.getForex() != null) this.forexFees+=unit.getForex().getAmount();
 else this.fees+=unit.getAmount().getAmount();
break;
case TAX:
if (unit.getForex() != null) this.forexTaxes+=unit.getForex().getAmount();
 else this.taxes+=unit.getAmount().getAmount();
break;
default :
throw new UnsupportedOperationException();
}
}
);
this.convertedGrossValue=calculateConvertedGrossValue();
if (exchangeRate.equals(BigDecimal.ONE)) {
this.grossValue=convertedGrossValue;
this.quote=transaction.getGrossPricePerShare().toBigDecimal();
}
firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}
Program: 52685
Project: 52685
Buggy source:
public void setShares(long shares){
  firePropertyChange(Properties.shares.name(),this.shares,this.shares=shares);
  if (quote.doubleValue() != 0) {
    setAmount(Math.round(shares * quote.doubleValue() * Values.Amount.factor() / Values.Share.divider()));
  }
 else   if (amount != 0 && shares != 0) {
    setQuote(new BigDecimal(amount * Values.Share.factor() / (shares * Values.Amount.divider())));
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}

Fixed version (ground truth):
public void setShares(long shares){
  firePropertyChange(Properties.shares.name(),this.shares,this.shares=shares);
  if (quote.doubleValue() != 0) {
    setAmount(Math.round(shares * quote.doubleValue() * Values.Amount.factor() / Values.Share.divider()));
  }
 else   if (amount != 0 && shares != 0) {
    setQuote(BigDecimal.valueOf(amount * Values.Share.factor() / (shares * Values.Amount.divider())));
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}
Program: 52686
Project: 52686
Buggy source:
private void updateSharesAndQuote(){
  if (source != null)   return;
  SecurityPosition position=null;
  if (security != null) {
    CurrencyConverter converter=new CurrencyConverterImpl(getExchangeRateProviderFactory(),client.getBaseCurrency());
    PortfolioSnapshot snapshot=sourcePortfolio != null ? PortfolioSnapshot.create(sourcePortfolio,converter,date) : ClientSnapshot.create(client,converter,date).getJointPortfolio();
    position=snapshot.getPositionsBySecurity().get(security);
  }
  if (position != null) {
    setShares(position.getShares());
    setAmount(position.calculateValue().getAmount());
  }
 else   if (security != null) {
    setShares(0);
    setQuote(new BigDecimal(security.getSecurityPrice(date).getValue() / Values.Quote.divider()));
  }
 else {
    setShares(0);
    setQuote(BigDecimal.ZERO);
  }
}

Fixed version (ground truth):
private void updateSharesAndQuote(){
  if (source != null)   return;
  SecurityPosition position=null;
  if (security != null) {
    CurrencyConverter converter=new CurrencyConverterImpl(getExchangeRateProviderFactory(),client.getBaseCurrency());
    PortfolioSnapshot snapshot=sourcePortfolio != null ? PortfolioSnapshot.create(sourcePortfolio,converter,date) : ClientSnapshot.create(client,converter,date).getJointPortfolio();
    position=snapshot.getPositionsBySecurity().get(security);
  }
  if (position != null) {
    setShares(position.getShares());
    setAmount(position.calculateValue().getAmount());
  }
 else   if (security != null) {
    setShares(0);
    setQuote(BigDecimal.valueOf(security.getSecurityPrice(date).getValue() / Values.Quote.divider()));
  }
 else {
    setShares(0);
    setQuote(BigDecimal.ZERO);
  }
}
Program: 52687
Project: 52687
Buggy source:
public void setAmount(long amount){
  triggerAmount(amount);
  if (shares != 0) {
    BigDecimal newQuote=new BigDecimal(amount * Values.Share.factor() / (shares * Values.Amount.divider()));
    firePropertyChange(Properties.quote.name(),this.quote,this.quote=newQuote);
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}

Fixed version (ground truth):
public void setAmount(long amount){
  triggerAmount(amount);
  if (shares != 0) {
    BigDecimal newQuote=BigDecimal.valueOf(amount * Values.Share.factor() / (shares * Values.Amount.divider()));
    firePropertyChange(Properties.quote.name(),this.quote,this.quote=newQuote);
  }
  firePropertyChange(Properties.calculationStatus.name(),this.calculationStatus,this.calculationStatus=calculateStatus());
}
Program: 52688
Project: 52688
Buggy source:
public UpdateHelper(IWorkbench workbench,EPartService partService) throws CoreException {
  this.workbench=workbench;
  this.partService=partService;
  this.agent=getService(IProvisioningAgent.class,IProvisioningAgent.SERVICE_NAME);
  IProfileRegistry profileRegistry=(IProfileRegistry)agent.getService(IProfileRegistry.SERVICE_NAME);
  IProfile profile=profileRegistry.getProfile(IProfileRegistry.SELF);
  if (profile == null) {
    IStatus status=new Status(IStatus.ERROR,PortfolioPlugin.PLUGIN_ID,Messages.MsgNoProfileFound);
    throw new CoreException(status);
  }
}

Fixed version (ground truth):
public UpdateHelper(IWorkbench workbench,EPartService partService) throws CoreException {
  this.workbench=workbench;
  this.partService=partService;
  this.agent=getService(IProvisioningAgent.class,IProvisioningAgent.SERVICE_NAME);
  if (agent == null) {
    IStatus status=new Status(IStatus.ERROR,PortfolioPlugin.PLUGIN_ID,Messages.MsgNoProfileFound);
    throw new CoreException(status);
  }
  IProfileRegistry profileRegistry=(IProfileRegistry)agent.getService(IProfileRegistry.SERVICE_NAME);
  IProfile profile=profileRegistry.getProfile(IProfileRegistry.SELF);
  if (profile == null) {
    IStatus status=new Status(IStatus.ERROR,PortfolioPlugin.PLUGIN_ID,Messages.MsgNoProfileFound);
    throw new CoreException(status);
  }
}
Program: 52689
Project: 52689
Buggy source:
private void onTickerSymbolChanged(){
  boolean hasTicker=model.getTickerSymbol() != null && !model.getTickerSymbol().isEmpty();
  if (!hasTicker) {
    clearSampleQuotes();
    setStatus("String_Node_Str");
  }
 else {
    QuoteFeed feed=(QuoteFeed)((IStructuredSelection)comboProvider.getSelection()).getFirstElement();
    showSampleQuotes(feed,null);
    setStatus(null);
  }
}

Fixed version (ground truth):
private void onTickerSymbolChanged(){
  boolean hasTicker=model.getTickerSymbol() != null && !model.getTickerSymbol().isEmpty();
  if (!hasTicker) {
    clearSampleQuotes();
    setStatus(MessageFormat.format(Messages.MsgDialogInputRequired,Messages.ColumnTicker));
  }
 else {
    QuoteFeed feed=(QuoteFeed)((IStructuredSelection)comboProvider.getSelection()).getFirstElement();
    showSampleQuotes(feed,null);
    setStatus(null);
  }
}
Program: 52690
Project: 52690
Buggy source:
@Override public boolean updateHistoricalQuotes(Security security,List<Exception> errors){
  OutputSize outputSize=OutputSize.FULL;
  if (!security.getPrices().isEmpty()) {
    SecurityPrice lastHistoricalQuote=security.getPrices().get(security.getPrices().size() - 1);
    int days=Dates.daysBetween(lastHistoricalQuote.getTime(),LocalDate.now());
    outputSize=days >= DAYS_THRESHOLD ? OutputSize.FULL : OutputSize.COMPACT;
  }
  List<SecurityPrice> prices=getHistoricalQuotes(SecurityPrice.class,security,outputSize,errors);
  boolean isUpdated=false;
  for (  SecurityPrice p : prices) {
    boolean isAdded=security.addPrice(p);
    isUpdated=isUpdated || isAdded;
  }
  return isUpdated;
}

Fixed version (ground truth):
@Override public boolean updateHistoricalQuotes(Security security,List<Exception> errors){
  OutputSize outputSize=OutputSize.FULL;
  if (!security.getPrices().isEmpty()) {
    SecurityPrice lastHistoricalQuote=security.getPrices().get(security.getPrices().size() - 1);
    int days=Dates.daysBetween(lastHistoricalQuote.getDate(),LocalDate.now());
    outputSize=days >= DAYS_THRESHOLD ? OutputSize.FULL : OutputSize.COMPACT;
  }
  List<SecurityPrice> prices=getHistoricalQuotes(SecurityPrice.class,security,outputSize,errors);
  boolean isUpdated=false;
  for (  SecurityPrice p : prices) {
    boolean isAdded=security.addPrice(p);
    isUpdated=isUpdated || isAdded;
  }
  return isUpdated;
}
Program: 52694
Project: 52694
Buggy source:
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,final IWorkbench workbench,final EPartService partService){
  try {
    new ProgressMonitorDialog(shell).run(true,true,new IRunnableWithProgress(){
      @Override public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          UpdateHelper updateHelper=new UpdateHelper(workbench,partService);
          updateHelper.runUpdate(monitor,false);
        }
 catch (        CoreException e) {
          throw new InvocationTargetException(e);
        }
      }
    }
);
  }
 catch (  InvocationTargetException e) {
    PortfolioPlugin.log(e.getCause());
    IStatus status=e.getCause() instanceof CoreException ? ((CoreException)e.getCause()).getStatus() : new Status(Status.ERROR,PortfolioPlugin.PLUGIN_ID,e.getCause().getMessage(),e.getCause());
    ErrorDialog.openError(Display.getDefault().getActiveShell(),Messages.LabelError,Messages.MsgErrorUpdating,status);
  }
catch (  InterruptedException ignore) {
  }
}

Fixed version (ground truth):
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,final IWorkbench workbench,final EPartService partService){
  try {
    new ProgressMonitorDialog(shell).run(true,true,monitor -> {
      try {
        UpdateHelper updateHelper=new UpdateHelper(workbench,partService);
        updateHelper.runUpdate(monitor,false);
      }
 catch (      CoreException e) {
        PortfolioPlugin.log(e);
        Display.getDefault().asyncExec(() -> ErrorDialog.openError(Display.getDefault().getActiveShell(),Messages.LabelError,Messages.MsgErrorUpdating,e.getStatus()));
      }
    }
);
  }
 catch (  InvocationTargetException|InterruptedException e) {
    PortfolioPlugin.log(e);
  }
}
Program: 52695
Project: 52695
Buggy source:
private void runUpdateOperation(IProgressMonitor monitor) throws OperationCanceledException, CoreException {
  if (operation == null)   checkForUpdates(monitor);
  ProvisioningJob job=operation.getProvisioningJob(null);
  IStatus status=job.runModal(monitor);
  if (status.getSeverity() == IStatus.CANCEL)   throw new OperationCanceledException();
}

Fixed version (ground truth):
private void runUpdateOperation(IProgressMonitor monitor) throws OperationCanceledException, CoreException {
  if (operation == null)   checkForUpdates(monitor);
  ProvisioningJob job=operation.getProvisioningJob(null);
  IStatus status=job.runModal(monitor);
  if (status.getSeverity() == IStatus.CANCEL)   throw new OperationCanceledException();
  if (status.getSeverity() != IStatus.OK)   throw new CoreException(status);
}
Program: 52697
Project: 52697
Buggy source:
private Values(String pattern,double divider,int factor){
  this.pattern=pattern;
  this.divider=divider;
  this.factor=factor;
}

Fixed version (ground truth):
private Values(String pattern,double divider,int factor){
  this.pattern=pattern;
  this.divider=divider;
  this.factor=factor;
  this.bdFactor=BigDecimal.valueOf(factor);
}
Program: 52698
Project: 52698
Buggy source:
@Override protected <T extends SecurityPrice>void fillValues(String[] values,T price,DecimalFormat priceFormat,DateTimeFormatter dateFormat) throws ParseException {
  super.fillValues(values,price,priceFormat,dateFormat);
  Number q=priceFormat.parse(values[6]);
  long v=(long)(q.doubleValue() * Values.Quote.factor());
  price.setValue(v);
}

Fixed version (ground truth):
@Override protected <T extends SecurityPrice>void fillValues(String[] values,T price,DateTimeFormatter dateFormat) throws ParseException {
  super.fillValues(values,price,dateFormat);
  price.setValue(YahooHelper.asPrice(values[6]));
}
Program: 52700
Project: 52700
Buggy source:
protected <T extends SecurityPrice>void fillValues(String[] values,T price,DecimalFormat priceFormat,DateTimeFormatter dateFormat) throws ParseException, DateTimeParseException {
  LocalDate date=LocalDate.parse(values[0],dateFormat);
  Number q=priceFormat.parse(values[4]);
  long v=(long)(q.doubleValue() * Values.Quote.factor());
  price.setTime(date);
  price.setValue(v);
  if (price instanceof LatestSecurityPrice) {
    LatestSecurityPrice latest=(LatestSecurityPrice)price;
    q=priceFormat.parse(values[5]);
    latest.setVolume(q.intValue());
    q=priceFormat.parse(values[2]);
    latest.setHigh((long)(q.doubleValue() * Values.Quote.factor()));
    q=priceFormat.parse(values[3]);
    latest.setLow((long)(q.doubleValue() * Values.Quote.factor()));
  }
}

Fixed version (ground truth):
protected <T extends SecurityPrice>void fillValues(String[] values,T price,DateTimeFormatter dateFormat) throws ParseException, DateTimeParseException {
  LocalDate date=LocalDate.parse(values[0],dateFormat);
  long v=asPrice(values[4]);
  price.setTime(date);
  price.setValue(v);
  if (price instanceof LatestSecurityPrice) {
    LatestSecurityPrice latest=(LatestSecurityPrice)price;
    latest.setVolume(asNumber(values[5]));
    latest.setHigh(asPrice(values[2]));
    latest.setLow(asPrice(values[3]));
  }
}
Program: 52701
Project: 52701
Buggy source:
static long asPrice(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return -1;
  return (long)(FMT_PRICE.get().parse(s).doubleValue() * Values.Quote.factor());
}

Fixed version (ground truth):
static long asPrice(String s) throws ParseException {
  if ("String_Node_Str".equals(s))   return -1;
  BigDecimal v=(BigDecimal)FMT_PRICE.get().parse(s);
  return v.multiply(Values.Quote.getBigDecimalFactor()).longValue();
}
Program: 52702
Project: 52702
Buggy source:
@Override protected DecimalFormat initialValue(){
  return new DecimalFormat("String_Node_Str",new DecimalFormatSymbols(Locale.US));
}

Fixed version (ground truth):
@Override protected DecimalFormat initialValue(){
  DecimalFormat fmt=new DecimalFormat("String_Node_Str",new DecimalFormatSymbols(Locale.US));
  fmt.setParseBigDecimal(true);
  return fmt;
}
Program: 52703
Project: 52703
Buggy source:
public void bindBigDecimal(String property,String pattern){
  NumberFormat format=new DecimalFormat(pattern);
  context.bindValue(WidgetProperties.text(SWT.Modify).observe(value),BeanProperties.value(property).observe(model),new UpdateValueStrategy().setConverter(StringToNumberConverter.toBigDecimal()),new UpdateValueStrategy().setConverter(NumberToStringConverter.fromBigDecimal(format)));
}

Fixed version (ground truth):
public void bindBigDecimal(String property,String pattern){
  NumberFormat format=new DecimalFormat(pattern);
  IValidatingConverter converter=IValidatingConverter.wrap(StringToNumberConverter.toBigDecimal());
  context.bindValue(WidgetProperties.text(SWT.Modify).observe(value),BeanProperties.value(property).observe(model),new UpdateValueStrategy().setAfterGetValidator(converter).setConverter(converter),new UpdateValueStrategy().setConverter(NumberToStringConverter.fromBigDecimal(format)));
}
Program: 52704
Project: 52704
Buggy source:
public final ComboViewer bindCurrencyCodeCombo(Composite editArea,String label,String property){
  Label l=new Label(editArea,SWT.NONE);
  l.setText(label);
  ComboViewer combo=new ComboViewer(editArea,SWT.READ_ONLY);
  combo.setContentProvider(ArrayContentProvider.getInstance());
  combo.setLabelProvider(new LabelProvider());
  List<CurrencyUnit> currencies=new ArrayList<CurrencyUnit>();
  currencies.add(CurrencyUnit.EMPTY);
  currencies.addAll(CurrencyUnit.getAvailableCurrencyUnits().stream().sorted().collect(Collectors.toList()));
  combo.setInput(currencies);
  GridDataFactory.fillDefaults().align(SWT.BEGINNING,SWT.FILL).applyTo(combo.getControl());
  UpdateValueStrategy targetToModel=new UpdateValueStrategy();
  targetToModel.setConverter(new CurrencyUnitToStringConverter());
  UpdateValueStrategy modelToTarget=new UpdateValueStrategy();
  modelToTarget.setConverter(new StringToCurrencyUnitConverter());
  context.bindValue(ViewersObservables.observeSingleSelection(combo),BeanProperties.value(property).observe(model),targetToModel,modelToTarget);
  return combo;
}

Fixed version (ground truth):
public final ComboViewer bindCurrencyCodeCombo(Composite editArea,String label,String property){
  Label l=new Label(editArea,SWT.NONE);
  l.setText(label);
  ComboViewer combo=new ComboViewer(editArea,SWT.READ_ONLY);
  combo.setContentProvider(ArrayContentProvider.getInstance());
  combo.setLabelProvider(new LabelProvider());
  List<CurrencyUnit> currencies=new ArrayList<>();
  currencies.add(CurrencyUnit.EMPTY);
  currencies.addAll(CurrencyUnit.getAvailableCurrencyUnits().stream().sorted().collect(Collectors.toList()));
  combo.setInput(currencies);
  GridDataFactory.fillDefaults().align(SWT.BEGINNING,SWT.FILL).applyTo(combo.getControl());
  UpdateValueStrategy targetToModel=new UpdateValueStrategy();
  targetToModel.setConverter(new CurrencyUnitToStringConverter());
  UpdateValueStrategy modelToTarget=new UpdateValueStrategy();
  modelToTarget.setConverter(new StringToCurrencyUnitConverter());
  context.bindValue(ViewersObservables.observeSingleSelection(combo),BeanProperties.value(property).observe(model),targetToModel,modelToTarget);
  return combo;
}
Program: 52705
Project: 52705
Buggy source:
private void bindMandatoryDecimalInput(final String label,String property,Text txtValue,Values<?> type){
  context.bindValue(WidgetProperties.text(SWT.Modify).observe(txtValue),BeanProperties.value(property).observe(model),new UpdateValueStrategy().setConverter(new StringToCurrencyConverter(type)).setAfterConvertValidator(new IValidator(){
    @Override public IStatus validate(    Object value){
      Long v=(Long)value;
      return v != null && v.longValue() > 0 ? ValidationStatus.ok() : ValidationStatus.error(MessageFormat.format(Messages.MsgDialogInputRequired,label));
    }
  }
),new UpdateValueStrategy().setConverter(new CurrencyToStringConverter(type)));
}

Fixed version (ground truth):
private void bindMandatoryDecimalInput(final String label,String property,Text txtValue,Values<?> type){
  StringToCurrencyConverter converter=new StringToCurrencyConverter(type);
  UpdateValueStrategy input2model=new UpdateValueStrategy().setAfterGetValidator(converter).setConverter(converter).setAfterConvertValidator(value -> {
    Long v=(Long)value;
    return v != null && v.longValue() > 0 ? ValidationStatus.ok() : ValidationStatus.error(MessageFormat.format(Messages.MsgDialogInputRequired,label));
  }
);
  context.bindValue(WidgetProperties.text(SWT.Modify).observe(txtValue),BeanProperties.value(property).observe(model),input2model,new UpdateValueStrategy().setConverter(new CurrencyToStringConverter(type)));
}
Program: 52706
Project: 52706
Buggy source:
private void addAttributeBlock(Composite container,final AttributeDesignation attribute){
  final Label label=new Label(container,SWT.NONE);
  label.setText(attribute.getType().getName());
  final Text value=new Text(container,SWT.BORDER);
  value.setText(attribute.getType().getConverter().toString(attribute.getValue()));
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).applyTo(value);
  final Button deleteButton=new Button(container,SWT.PUSH);
  deleteButton.setImage(Images.REMOVE.image());
  final Binding binding=bindings.getBindingContext().bindValue(WidgetProperties.text(SWT.Modify).observe(value),BeanProperties.value("String_Node_Str").observe(attribute),new UpdateValueStrategy().setConverter(new ToAttributeObjectConverter(attribute)),new UpdateValueStrategy().setConverter(new ToAttributeStringConverter(attribute)));
  deleteButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      model.getAttributes().remove(attribute);
      bindings.getBindingContext().removeBinding(binding);
      Composite parent=deleteButton.getParent();
      label.dispose();
      value.dispose();
      deleteButton.dispose();
      parent.getParent().layout(true);
    }
  }
);
}

Fixed version (ground truth):
private void addAttributeBlock(Composite container,final AttributeDesignation attribute){
  final Label label=new Label(container,SWT.NONE);
  label.setText(attribute.getType().getName());
  final Text value=new Text(container,SWT.BORDER);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).applyTo(value);
  final Button deleteButton=new Button(container,SWT.PUSH);
  deleteButton.setImage(Images.REMOVE.image());
  ToAttributeObjectConverter input2model=new ToAttributeObjectConverter(attribute);
  final Binding binding=bindings.getBindingContext().bindValue(WidgetProperties.text(SWT.Modify).observe(value),BeanProperties.value("String_Node_Str").observe(attribute),new UpdateValueStrategy().setAfterGetValidator(input2model).setConverter(input2model),new UpdateValueStrategy().setConverter(new ToAttributeStringConverter(attribute)));
  deleteButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      model.getAttributes().remove(attribute);
      bindings.getBindingContext().removeBinding(binding);
      Composite parent=deleteButton.getParent();
      label.dispose();
      value.dispose();
      deleteButton.dispose();
      parent.getParent().layout(true);
    }
  }
);
}
Program: 52707
Project: 52707
Buggy source:
public void internalSetClient(Client client){
  this.client=client;
  this.dirty.setDirty(false);
  this.context.set(Client.class,client);
  client.addPropertyChangeListener(event -> notifyModelUpdated());
  if (client.getFileVersionAfterRead() < Client.VERSION_WITH_CURRENCY_SUPPORT)   Display.getDefault().asyncExec(new ClientMigrationDialog(Display.getDefault().getActiveShell(),client)::open);
  new ConsistencyChecksJob(client,false).schedule(100);
  scheduleOnlineUpdateJobs();
}

Fixed version (ground truth):
public void internalSetClient(Client client){
  this.client=client;
  this.dirty.setDirty(false);
  this.context.set(Client.class,client);
  client.addPropertyChangeListener(event -> notifyModelUpdated());
  if (client.getFileVersionAfterRead() < Client.VERSION_WITH_CURRENCY_SUPPORT) {
    Display.getDefault().asyncExec(() -> {
      Dialog dialog=new ClientMigrationDialog(Display.getDefault().getActiveShell(),client);
      dialog.open();
    }
);
  }
  new ConsistencyChecksJob(client,false).schedule(100);
  scheduleOnlineUpdateJobs();
}
Program: 52709
Project: 52709
Buggy source:
@Override protected void fillContextMenu(IMenuManager manager){
  super.fillContextMenu(manager);
  final TaxonomyNode node=(TaxonomyNode)((IStructuredSelection)getNodeViewer().getSelection()).getFirstElement();
  if (node == null || node.isUnassignedCategory())   return;
  if (node.isClassification() && getModel().hasWeightError(node)) {
    manager.appendToGroup(MENU_GROUP_CUSTOM_ACTIONS,new Action(Messages.MenuTaxonomyWeightFix){
      @Override public void run(){
        doFixClassificationWeights(node);
      }
    }
);
  }
}

Fixed version (ground truth):
@Override protected void fillContextMenu(IMenuManager manager){
  super.fillContextMenu(manager);
  final TaxonomyNode node=(TaxonomyNode)((IStructuredSelection)getNodeViewer().getSelection()).getFirstElement();
  if (node == null || node.isUnassignedCategory())   return;
  if (node.isClassification() && getModel().hasWeightError(node)) {
    manager.appendToGroup(MENU_GROUP_CUSTOM_ACTIONS,new SimpleAction(Messages.MenuTaxonomyWeightFix,a -> doFixClassificationWeights(node)));
  }
}
Program: 52711
Project: 52711
Buggy source:
public Stream<Result> search(String query) throws IOException {
  String searchUrl=MessageFormat.format(SEARCH_URL,query);
  List<Result> answer=new ArrayList<>();
  try (Scanner scanner=new Scanner(new URL(searchUrl).openStream(),StandardCharsets.UTF_8.name())){
    String html=scanner.useDelimiter("String_Node_Str").next();
    int start=html.indexOf('(');
    int end=html.lastIndexOf(')');
    html=html.substring(start + 1,end);
    JSONObject response=(JSONObject)JSONValue.parse(html);
    if (response != null) {
      JSONObject resultSet=(JSONObject)response.get("String_Node_Str");
      if (resultSet != null) {
        JSONArray result=(JSONArray)resultSet.get("String_Node_Str");
        if (result != null) {
          for (int ii=0; ii < result.size(); ii++)           answer.add(Result.from((JSONObject)result.get(ii)));
        }
      }
    }
  }
   return answer.stream();
}

Fixed version (ground truth):
public Stream<Result> search(String query) throws IOException {
  String searchUrl=MessageFormat.format(SEARCH_URL,URLEncoder.encode(query,StandardCharsets.UTF_8.name()));
  List<Result> answer=new ArrayList<>();
  try (Scanner scanner=new Scanner(new URL(searchUrl).openStream(),StandardCharsets.UTF_8.name())){
    String html=scanner.useDelimiter("String_Node_Str").next();
    int start=html.indexOf('(');
    int end=html.lastIndexOf(')');
    html=html.substring(start + 1,end);
    JSONObject response=(JSONObject)JSONValue.parse(html);
    if (response != null) {
      JSONObject resultSet=(JSONObject)response.get("String_Node_Str");
      if (resultSet != null) {
        JSONArray result=(JSONArray)resultSet.get("String_Node_Str");
        if (result != null) {
          for (int ii=0; ii < result.size(); ii++)           answer.add(Result.from((JSONObject)result.get(ii)));
        }
      }
    }
  }
   return answer.stream();
}
Program: 52712
Project: 52712
Buggy source:
/** 
 * Export all transactions in 'aktienfreunde.net' Format
 */
public void exportAllTransactions(File file,Client client) throws IOException {
  List<Transaction> transactions=new ArrayList<Transaction>();
  for (  Account a : client.getAccounts())   transactions.addAll(a.getTransactions());
  for (  Portfolio p : client.getPortfolios())   transactions.addAll(p.getTransactions());
  Transaction.sortByDate(transactions);
  DateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
  try (Writer writer=new OutputStreamWriter(new FileOutputStream(file),StandardCharsets.UTF_8)){
    CSVPrinter printer=new CSVPrinter(writer);
    printer.setStrategy(CSVExporter.STRATEGY);
    writeHeader(printer);
    for (    Transaction t : transactions) {
      if (t instanceof AccountTransaction) {
        AccountTransaction ta=(AccountTransaction)t;
        if (ta.getSecurity() != null && (ta.getType() == AccountTransaction.Type.INTEREST || ta.getType() == AccountTransaction.Type.DIVIDENDS))         writeDividend(printer,ta,dateFormat);
      }
 else       if (t instanceof PortfolioTransaction) {
        PortfolioTransaction tp=(PortfolioTransaction)t;
switch (tp.getType()) {
case BUY:
case DELIVERY_INBOUND:
          writeBuySell(printer,tp,"String_Node_Str",dateFormat);
        break;
case SELL:
case DELIVERY_OUTBOUND:
      writeBuySell(printer,tp,"String_Node_Str",dateFormat);
    break;
default :
}
}
}
}
 }

Fixed version (ground truth):
/** 
 * Export all transactions in 'aktienfreunde.net' Format
 */
public void exportAllTransactions(File file,Client client) throws IOException {
  List<? extends Transaction> transactions=Stream.concat(client.getAccounts().stream(),client.getPortfolios().stream()).flatMap(l -> l.getTransactions().stream()).sorted(new Transaction.ByDate()).collect(Collectors.toList());
  try (Writer writer=new OutputStreamWriter(new FileOutputStream(file),StandardCharsets.UTF_8)){
    CSVPrinter printer=new CSVPrinter(writer);
    printer.setStrategy(CSVExporter.STRATEGY);
    writeHeader(printer);
    for (    Transaction t : transactions) {
      if (t instanceof AccountTransaction)       writeDividend(printer,(AccountTransaction)t);
 else       if (t instanceof PortfolioTransaction)       writeBuySell(printer,(PortfolioTransaction)t);
    }
  }
 }
Program: 52713
Project: 52713
Buggy source:
@SuppressWarnings("String_Node_Str") private void writeDividend(CSVPrinter printer,AccountTransaction transaction,DateFormat dateFormat){
  printer.print(dateFormat.format(transaction.getDate()));
  printer.print(CSVExporter.escapeNull(transaction.getSecurity().getIsin()));
  printer.print(CSVExporter.escapeNull(transaction.getSecurity().getName()));
  printer.print("String_Node_Str");
  printer.print("String_Node_Str");
  printer.print(Values.Amount.format(transaction.getAmount()));
  printer.print("String_Node_Str");
  printer.print("String_Node_Str");
  printer.print("String_Node_Str");
  printer.println();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void writeDividend(CSVPrinter printer,AccountTransaction transaction){
  if (transaction.getSecurity() == null)   return;
  if (transaction.getType() != AccountTransaction.Type.INTEREST && transaction.getType() != AccountTransaction.Type.DIVIDENDS)   return;
  printer.print(DATE_FORMAT.format(transaction.getDate()));
  printer.print(CSVExporter.escapeNull(transaction.getSecurity().getIsin()));
  printer.print(CSVExporter.escapeNull(transaction.getSecurity().getName()));
  printer.print("String_Node_Str");
  printer.print("String_Node_Str");
  printer.print(Values.Amount.format(transaction.getAmount()));
  printer.print("String_Node_Str");
  printer.print("String_Node_Str");
  printer.print("String_Node_Str");
  printer.println();
}
Program: 52714
Project: 52714
Buggy source:
@SuppressWarnings("String_Node_Str") private void writeBuySell(CSVPrinter printer,PortfolioTransaction transaction,String type,DateFormat dateFormat){
  printer.print(dateFormat.format(transaction.getDate()));
  printer.print(CSVExporter.escapeNull(transaction.getSecurity().getIsin()));
  printer.print(CSVExporter.escapeNull(transaction.getSecurity().getName()));
  printer.print("String_Node_Str");
  printer.print(type);
  printer.print(Values.Quote.format(transaction.getGrossPricePerShare().getAmount()));
  printer.print(Values.Share.format(transaction.getShares()));
  printer.print(Values.Amount.format(transaction.getUnitSum(Unit.Type.FEE).getAmount()));
  printer.print(Values.Amount.format(transaction.getUnitSum(Unit.Type.TAX).getAmount()));
  printer.println();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void writeBuySell(CSVPrinter printer,PortfolioTransaction transaction){
  String type;
switch (transaction.getType()) {
case BUY:
case DELIVERY_INBOUND:
    type="String_Node_Str";
  break;
case SELL:
case DELIVERY_OUTBOUND:
type="String_Node_Str";
break;
default :
return;
}
printer.print(DATE_FORMAT.format(transaction.getDate()));
printer.print(CSVExporter.escapeNull(transaction.getSecurity().getIsin()));
printer.print(CSVExporter.escapeNull(transaction.getSecurity().getName()));
printer.print("String_Node_Str");
printer.print(type);
printer.print(Values.Quote.format(transaction.getGrossPricePerShare().getAmount()));
printer.print(Values.Share.format(transaction.getShares()));
printer.print(Values.Amount.format(transaction.getUnitSum(Unit.Type.FEE).getAmount()));
printer.print(Values.Amount.format(transaction.getUnitSum(Unit.Type.TAX).getAmount()));
printer.println();
}
Program: 52715
Project: 52715
Buggy source:
public ChartConfig(WidgetDelegate delegate,DataSeries.UseCase useCase){
  this.delegate=delegate;
  String configName=(useCase == DataSeries.UseCase.STATEMENT_OF_ASSETS ? StatementOfAssetsHistoryView.class : PerformanceChartView.class).getSimpleName() + DataSeriesConfigurator.IDENTIFIER_POSTFIX;
  configSet=delegate.getClient().getSettings().getConfigurationSet(configName);
  String uuid=delegate.getWidget().getConfiguration().get(Dashboard.Config.CONFIG_UUID.name());
  config=configSet.lookup(uuid).orElseGet(() -> configSet.getConfigurations().findFirst().get());
}

Fixed version (ground truth):
public ChartConfig(WidgetDelegate delegate,DataSeries.UseCase useCase){
  this.delegate=delegate;
  String configName=(useCase == DataSeries.UseCase.STATEMENT_OF_ASSETS ? StatementOfAssetsHistoryView.class : PerformanceChartView.class).getSimpleName() + DataSeriesConfigurator.IDENTIFIER_POSTFIX;
  configSet=delegate.getClient().getSettings().getConfigurationSet(configName);
  String uuid=delegate.getWidget().getConfiguration().get(Dashboard.Config.CONFIG_UUID.name());
  config=configSet.lookup(uuid).orElseGet(() -> configSet.getConfigurations().findFirst().orElseGet(() -> new ConfigurationSet.Configuration(Messages.LabelNoName,null)));
}
Program: 52716
Project: 52716
Buggy source:
private Color colorFor(AccountTransaction t){
  if (EnumSet.of(Type.REMOVAL,Type.FEES,Type.TAXES,Type.BUY,Type.TRANSFER_OUT).contains(t.getType()))   return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED);
 else   return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
}

Fixed version (ground truth):
private Color colorFor(AccountTransaction t){
  if (t.getType().isNegative())   return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED);
 else   return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
}