nus-yam/ex-repair huggingface dataset:
Program: 81479
Project: 81479
Buggy source:
public static void main(String[] args){
  try {
    String verstring=new String(SimpleRequest.get("String_Node_Str"));
    if (verstring.isEmpty())     verstring="String_Node_Str";
    float version;
    try {
      version=Float.parseFloat(verstring);
    }
 catch (    Exception e) {
      version=0;
    }
    System.out.println("String_Node_Str" + VERSION);
    System.out.println("String_Node_Str" + version);
    if (VERSION < version) {
      JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
      System.exit(0);
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  try {
    MineProxy proxy=new MineProxy(proxyPort,VERSION);
    proxy.start();
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str",Integer.toString(proxyPort));
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str",Integer.toString(proxyPort));
    File hackedFile=new File(hackedLauncherFilename);
    if (hackedFile.exists())     hackedFile.delete();
    startLauncher(args);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    System.exit(1);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    byte[] verdata=SimpleRequest.get("String_Node_Str");
    String verstring=new String();
    if (verdata == null)     verstring="String_Node_Str";
 else     verstring=new String(verdata);
    if (verstring.isEmpty())     verstring="String_Node_Str";
    float version;
    try {
      version=Float.parseFloat(verstring);
    }
 catch (    Exception e) {
      version=0;
    }
    System.out.println("String_Node_Str" + VERSION);
    System.out.println("String_Node_Str" + version);
    if (VERSION < version) {
      JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
      System.exit(0);
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
  try {
    MineProxy proxy=new MineProxy(proxyPort,VERSION);
    proxy.start();
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str",Integer.toString(proxyPort));
    System.setProperty("String_Node_Str","String_Node_Str");
    System.setProperty("String_Node_Str",Integer.toString(proxyPort));
    File hackedFile=new File(hackedLauncherFilename);
    if (hackedFile.exists())     hackedFile.delete();
    startLauncher(args);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    System.exit(1);
  }
}
Program: 81480
Project: 81480
Buggy source:
public void run(){
  try {
    ServerSocket server=new ServerSocket(this.port);
    while (true) {
      Socket connection=server.accept();
      MineProxyHandler handler=new MineProxyHandler(this,connection);
      handler.start();
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void run(){
  try {
    ServerSocket server=new ServerSocket(this.port);
    while (true) {
      Socket connection=server.accept();
      MineProxyHandler handler=new MineProxyHandler(this,connection);
      handler.start();
    }
  }
 catch (  IOException e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}
Program: 81482
Project: 81482
Buggy source:
public static byte[] postRequest(String url,byte[] postdata,String contentType){
  try {
    URL u=new URL(url);
    HttpURLConnection c=(HttpURLConnection)new URL(url).openConnection(Proxy.NO_PROXY);
    c.setDoOutput(true);
    c.setRequestMethod("String_Node_Str");
    c.setRequestProperty("String_Node_Str",u.getHost());
    c.setRequestProperty("String_Node_Str",Integer.toString(postdata.length));
    c.setRequestProperty("String_Node_Str",contentType);
    BufferedOutputStream out=new BufferedOutputStream(c.getOutputStream());
    out.write(postdata);
    out.flush();
    out.close();
    byte[] data=grabData(new BufferedInputStream(c.getInputStream()));
    return data;
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public static byte[] postRequest(String url,byte[] postdata,String contentType){
  try {
    URL u=new URL(url);
    HttpURLConnection c=(HttpURLConnection)new URL(url).openConnection(Proxy.NO_PROXY);
    c.setDoOutput(true);
    c.setRequestMethod("String_Node_Str");
    c.setRequestProperty("String_Node_Str",u.getHost());
    c.setRequestProperty("String_Node_Str",Integer.toString(postdata.length));
    c.setRequestProperty("String_Node_Str",contentType);
    BufferedOutputStream out=new BufferedOutputStream(c.getOutputStream());
    out.write(postdata);
    out.flush();
    out.close();
    byte[] data=grabData(new BufferedInputStream(c.getInputStream()));
    return data;
  }
 catch (  java.net.UnknownHostException e) {
    System.out.println("String_Node_Str");
  }
catch (  MalformedURLException e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 81484
Project: 81484
Buggy source:
/** 
 * Convert from PointF p from View coordinats to Model Coordinates
 * @param p
 * @return
 */
public PointF viewToModel(PointF p){
  PointF q=new PointF(p.x * zoom,height - p.y * zoom);
  return q;
}

Fixed version (ground truth):
/** 
 * Convert from PointF p from View coordinats to Model Coordinates
 * @param p
 * @return
 */
public PointF viewToModel(PointF p){
  PointF q=new PointF(p.x * zoom,(height - p.y) * zoom);
  return q;
}
Program: 81485
Project: 81485
Buggy source:
/** 
 * When the activity starts we create a model, view, and controller for the game. The model and controller are separate classes
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  model=new GameModel();
  createLevel(2);
  createPaints();
  setContentView(R.layout.game);
  surface=(SurfaceView)findViewById(R.id.game_surface);
  holder=surface.getHolder();
  surface.getHolder().addCallback(this);
  controller=new GameController(this,model);
  surface.setOnTouchListener(controller);
}

Fixed version (ground truth):
/** 
 * When the activity starts we create a model, view, and controller for the game. The model and controller are separate classes
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  model=new GameModel();
  createPaints();
  setContentView(R.layout.game);
  surface=(SurfaceView)findViewById(R.id.game_surface);
  holder=surface.getHolder();
  surface.getHolder().addCallback(this);
  controller=new GameController(this,model);
  surface.setOnTouchListener(controller);
}
Program: 81486
Project: 81486
Buggy source:
public void draw(){
  Canvas c=null;
  try {
    c=holder.lockCanvas();
    if (c != null) {
      doDraw(c);
      if (model.levelOver) {
        model.resetGame();
        createLevel(2);
        model.levelOver=false;
      }
    }
  }
  finally {
    if (c != null) {
      holder.unlockCanvasAndPost(c);
    }
  }
}

Fixed version (ground truth):
public void draw(){
  Canvas c=null;
  try {
    c=holder.lockCanvas();
    if (c != null) {
      doDraw(c);
    }
  }
  finally {
    if (c != null) {
      holder.unlockCanvasAndPost(c);
    }
  }
}
Program: 81487
Project: 81487
Buggy source:
/** 
 * When the drawing surface is created we start up a game loop, the game loop just draws the scene and updates the model in an infinite loop running in a separate thread. We create the thread and start it up here ...
 */
public void surfaceCreated(SurfaceHolder holder){
  gameLoop=new GameLoop(this,model,controller);
  gameLoop.start();
}

Fixed version (ground truth):
/** 
 * When the drawing surface is created we start up a game loop, the game loop just draws the scene and updates the model in an infinite loop running in a separate thread. We create the thread and start it up here ...
 */
public void surfaceCreated(SurfaceHolder holder){
  gameLoop=new GameLoop(this,model,controller);
  gameLoop.start();
synchronized (model) {
    model.createLevel(2);
  }
}
Program: 81489
Project: 81489
Buggy source:
public void levelOver(){
}

Fixed version (ground truth):
public void levelOver(){
  if (gameModel.levelOver) {
    gameModel.resetGame();
    gameModel.createLevel(2);
    gameModel.levelOver=false;
  }
}
Program: 81490
Project: 81490
Buggy source:
@Override public void addPages(){
  IStructuredSelection selection=MantisUIUtil.getCurrentSelection();
  if (selection != null && !selection.isEmpty()) {
    Object selectedElement=selection.getFirstElement();
    String projectName=null;
    if (selectedElement instanceof ITask) {
      ITask task=(ITask)selectedElement;
      projectName=task.getAttribute(PROJECT.getKey());
    }
 else     if (selectedElement instanceof IRepositoryQuery) {
      IRepositoryQuery query=(IRepositoryQuery)selectedElement;
      projectName=query.getAttribute(IMantisClient.PROJECT_NAME);
    }
 else     if (selectedElement instanceof IAdaptable) {
      IAdaptable adaptable=(IAdaptable)selectedElement;
      ITask task=(ITask)adaptable.getAdapter(ITask.class);
      if (task != null)       projectName=task.getAttribute(PROJECT.getKey());
    }
    if (projectName != null && !MantisProject.ALL_PROJECTS.getName().equals(projectName)) {
      mapping=new ProductOnlyTaskMapping(projectName);
      return;
    }
  }
  newTaskPage=new MantisProjectPage(taskRepository,clientManager);
  addPage(newTaskPage);
}

Fixed version (ground truth):
@Override public void addPages(){
  IStructuredSelection selection=MantisUIUtil.getCurrentSelection();
  if (selection != null && !selection.isEmpty()) {
    Object selectedElement=selection.getFirstElement();
    String projectName=null;
    if (selectedElement instanceof ITask) {
      ITask task=(ITask)selectedElement;
      projectName=task.getAttribute(PROJECT.getKey());
    }
 else     if (selectedElement instanceof IRepositoryQuery) {
      IRepositoryQuery query=(IRepositoryQuery)selectedElement;
      projectName=query.getAttribute(IMantisClient.PROJECT_NAME);
    }
 else     if (selectedElement instanceof IAdaptable) {
      IAdaptable adaptable=(IAdaptable)selectedElement;
      ITask task=(ITask)adaptable.getAdapter(ITask.class);
      if (task != null)       projectName=task.getAttribute(PROJECT.getKey());
    }
    if (projectName != null && !MantisProject.ALL_PROJECTS.getName().equals(projectName)) {
      try {
        MantisCacheData cacheData=clientManager.getRepository(taskRepository).getCacheData();
        for (        MantisProject project : cacheData.getProjects()) {
          if (project.getName().equals(projectName)) {
            mapping=new ProductOnlyTaskMapping(projectName);
            return;
          }
        }
      }
 catch (      MantisException e) {
      }
    }
  }
  newTaskPage=new MantisProjectPage(taskRepository,clientManager);
  addPage(newTaskPage);
}
Program: 81491
Project: 81491
Buggy source:
public void add(String url,MantisCacheData data){
  ensureRead();
  _cacheDataByUrl.put(url,data);
}

Fixed version (ground truth):
public void add(String url,MantisCacheData data){
  ensureRead();
  add0(url,data);
}
Program: 81492
Project: 81492
Buggy source:
private void read(){
  ObjectInputStream in=null;
  try {
    in=new ObjectInputStream(new FileInputStream(cacheFile));
    int size=in.readInt();
    for (int i=0; i < size; i++) {
      String url=(String)in.readObject();
      MantisCacheData data=(MantisCacheData)in.readObject();
      add(url,data);
    }
  }
 catch (  FileNotFoundException cacheDoesNotExist) {
  }
catch (  Throwable e) {
    cleanCache(e);
  }
 finally {
    read=true;
    closeSilently(in);
  }
}

Fixed version (ground truth):
private void read(){
  ObjectInputStream in=null;
  try {
    in=new ObjectInputStream(new FileInputStream(cacheFile));
    int size=in.readInt();
    for (int i=0; i < size; i++) {
      String url=(String)in.readObject();
      MantisCacheData data=(MantisCacheData)in.readObject();
      add0(url,data);
    }
  }
 catch (  FileNotFoundException cacheDoesNotExist) {
  }
catch (  Throwable e) {
    cleanCache(e);
  }
 finally {
    read=true;
    closeSilently(in);
  }
}
Program: 81493
Project: 81493
Buggy source:
@Override protected boolean isAuthenticationException(Exception exception){
  if (!(exception instanceof MantisException))   return false;
  MantisException mantisException=(MantisException)exception;
  return mantisException.getMessage() != null && mantisException.getMessage().toLowerCase().indexOf("String_Node_Str") != -1;
}

Fixed version (ground truth):
@Override protected boolean isAuthenticationException(Exception exception){
  if (!(exception instanceof MantisException))   return false;
  MantisException mantisException=(MantisException)exception;
  return mantisException.getMessage() != null && mantisException.getMessage().toLowerCase(Locale.ENGLISH).indexOf("String_Node_Str") != -1;
}
Program: 81494
Project: 81494
Buggy source:
private MantisRemoteException wrap(RemoteException e){
  StringBuilder message=new StringBuilder();
  if (isSourceforgeRepoWithoutHttpAuth())   message.append("String_Node_Str").append('\n');
  if (location.getUrl().startsWith(SourceForgeConstants.OLD_SF_NET_URL))   message.append("String_Node_Str").append('\n');
  if (e instanceof AxisFault) {
    AxisFault axisFault=(AxisFault)e;
    if (axisFault.getCause() instanceof SAXException)     message.append("String_Node_Str" + String.valueOf(axisFault.getCause().getMessage()) + "String_Node_Str");
 else     if (e.getMessage() != null)     message.append(e.getMessage());
  }
 else   if (e.getMessage() != null)   message.append(e.getMessage());
  return new MantisRemoteException(message.toString(),e);
}

Fixed version (ground truth):
private MantisRemoteException wrap(RemoteException e){
  boolean unexpected=false;
  StringBuilder message=new StringBuilder();
  if (isSourceforgeRepoWithoutHttpAuth())   message.append("String_Node_Str").append('\n');
  if (location.getUrl().startsWith(SourceForgeConstants.OLD_SF_NET_URL))   message.append("String_Node_Str").append('\n');
  if (e instanceof AxisFault) {
    AxisFault axisFault=(AxisFault)e;
    if (axisFault.getCause() instanceof SAXException)     message.append("String_Node_Str" + String.valueOf(axisFault.getCause().getMessage()));
 else     if (e.getMessage() != null)     message.append(e.getMessage());
    unexpected=true;
  }
 else   if (e.getMessage() != null)   message.append(e.getMessage());
  return new MantisRemoteException(message.toString(),e,unexpected);
}
Program: 81495
Project: 81495
Buggy source:
public Status toStatus(String message,Throwable t,TaskRepository repository){
  String actualMessage=message == null ? t.getMessage() : message;
  if (repository == null)   return new Status(IStatus.ERROR,PLUGIN_ID,actualMessage,t);
  if (t instanceof MantisLoginException || "String_Node_Str".equals(actualMessage))   return RepositoryStatus.createLoginError(repository.getRepositoryUrl(),actualMessage);
  if (t instanceof MantisRemoteException)   return new RepositoryStatus(IStatus.ERROR,PLUGIN_ID,RepositoryStatus.ERROR_REPOSITORY,actualMessage);
  if (t instanceof MantisLocalException)   return RepositoryStatus.createInternalError(PLUGIN_ID,actualMessage,t);
  if (t instanceof IOException)   return new RepositoryStatus(IStatus.ERROR,PLUGIN_ID,RepositoryStatus.ERROR_IO,actualMessage);
  return RepositoryStatus.createInternalError(PLUGIN_ID,actualMessage,t);
}

Fixed version (ground truth):
public Status toStatus(String message,Throwable t,TaskRepository repository){
  String actualMessage=message == null ? t.getMessage() : message;
  if (repository == null)   return new Status(IStatus.ERROR,PLUGIN_ID,actualMessage,t);
  if (t instanceof MantisLoginException || (actualMessage != null && actualMessage.toLowerCase(Locale.ENGLISH).contains("String_Node_Str")))   return new RepositoryStatus(IStatus.ERROR,PLUGIN_ID,RepositoryStatus.ERROR_PERMISSION_DENIED,actualMessage);
  if (t instanceof MantisRemoteException) {
    if (t.getCause() instanceof AxisHttpFault)     if (((AxisHttpFault)t.getCause()).getReturnCode() == 404)     return RepositoryStatus.createNotFoundError(repository.getUrl(),PLUGIN_ID);
    if (t.getCause() instanceof AxisFault) {
      AxisFault fault=(AxisFault)t.getCause();
      if (fault.detail instanceof IOException)       return new RepositoryStatus(IStatus.ERROR,PLUGIN_ID,RepositoryStatus.ERROR_PERMISSION_DENIED,"String_Node_Str" + fault.detail.getMessage() + "String_Node_Str");
    }
    if (((MantisRemoteException)t).isUnexpected())     return RepositoryStatus.createInternalError(PLUGIN_ID,actualMessage,t);
    return new RepositoryStatus(IStatus.ERROR,PLUGIN_ID,RepositoryStatus.ERROR_REPOSITORY,actualMessage);
  }
  if (t instanceof MalformedURLException || t.getCause() instanceof MalformedURLException)   return RepositoryStatus.createStatus(repository,RepositoryStatus.ERROR_REPOSITORY_NOT_FOUND,PLUGIN_ID,t.getMessage());
  if (t instanceof MantisLocalException)   return RepositoryStatus.createInternalError(PLUGIN_ID,actualMessage,t);
  if (t instanceof IOException || t.getCause() instanceof IOException)   return new RepositoryStatus(IStatus.ERROR,PLUGIN_ID,RepositoryStatus.ERROR_IO,actualMessage);
  return RepositoryStatus.createInternalError(PLUGIN_ID,actualMessage,t);
}
Program: 81496
Project: 81496
Buggy source:
public MantisRemoteException(String message,Throwable cause){
  super(message,cause);
}

Fixed version (ground truth):
public MantisRemoteException(String message,Throwable cause,boolean unexpected){
  super(message,cause);
  this.unexpected=unexpected;
}
Program: 81497
Project: 81497
Buggy source:
@Override public void stop(BundleContext context) throws Exception {
  TasksUi.getRepositoryManager().removeListener(MantisCorePlugin.getDefault().getConnector().getClientManager());
  plugin=null;
  super.stop(context);
}

Fixed version (ground truth):
@Override public void stop(BundleContext context) throws Exception {
  TasksUi.getRepositoryManager().removeListener(MantisCorePlugin.getDefault().getConnector().getClientManager());
  plugin=null;
  if (formColors != null) {
    formColors.dispose();
    formColors=null;
  }
  super.stop(context);
}
Program: 81498
Project: 81498
Buggy source:
@Override protected void applyValidatorResult(Validator validator){
  super.applyValidatorResult(validator);
  if (validator.getStatus().getSeverity() != IStatus.ERROR)   return;
  if (validator.getStatus().getMessage().toLowerCase(Locale.ENGLISH).indexOf("String_Node_Str") != -1)   return;
  ErrorDialog.openError(getShell(),"String_Node_Str","String_Node_Str",validator.getStatus());
}

Fixed version (ground truth):
@Override protected void applyValidatorResult(Validator validator){
  super.applyValidatorResult(validator);
  if (validator.getStatus().getSeverity() != IStatus.ERROR)   return;
  if (validator.getStatus() instanceof RepositoryStatus) {
    RepositoryStatus status=(RepositoryStatus)validator.getStatus();
    if (status.getCode() != RepositoryStatus.ERROR_INTERNAL)     return;
  }
  new WikiLinkedErrorDialog(getShell(),"String_Node_Str","String_Node_Str",validator.getStatus()).open();
}
Program: 81499
Project: 81499
Buggy source:
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    validate(monitor);
  }
 catch (  MalformedURLException e) {
    throw new CoreException(RepositoryStatus.createStatus(repositoryUrl,IStatus.ERROR,MantisUIPlugin.PLUGIN_ID,INVALID_REPOSITORY_URL));
  }
catch (  MantisException e) {
    throw new CoreException(RepositoryStatus.createStatus(repositoryUrl,IStatus.ERROR,MantisUIPlugin.PLUGIN_ID,e.getMessage()));
  }
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    validate(monitor);
  }
 catch (  MantisException e) {
    throw new CoreException(MantisCorePlugin.getDefault().getStatusFactory().toStatus(null,e,taskRepository));
  }
catch (  MalformedURLException e) {
    throw new CoreException(MantisCorePlugin.getDefault().getStatusFactory().toStatus(null,e,taskRepository));
  }
}
Program: 81500
Project: 81500
Buggy source:
private static URL makeIconFileURL(String prefix,String name) throws MalformedURLException {
  if (baseURL == null)   throw new MalformedURLException();
  StringBuffer buffer=new StringBuffer(prefix);
  if (prefix != "String_Node_Str")   buffer.append('/');
  buffer.append(name);
  return new URL(baseURL,buffer.toString());
}

Fixed version (ground truth):
private static URL makeIconFileURL(String prefix,String name) throws MalformedURLException {
  if (baseURL == null)   throw new MalformedURLException();
  StringBuffer buffer=new StringBuffer(prefix);
  if (!"String_Node_Str".equals(prefix))   buffer.append('/');
  buffer.append(name);
  return new URL(baseURL,buffer.toString());
}
Program: 81501
Project: 81501
Buggy source:
/** 
 * Since for large user counts the reporter retrieval fails, we provide a hook for registering additional reporter users as they are discovered, e.g. in IssueData
 * @param projectId the project id
 * @param reporterName the name of the reporter
 */
void registerAdditionalReporter(int projectId,String reporterName){
  if (cacheData.reportersByProjectId == null) {
    MantisCorePlugin.warn("String_Node_Str",new RuntimeException());
    cacheData.reportersByProjectId=new HashMap<Integer,List<String>>();
  }
  List<String> reporters=cacheData.reportersByProjectId.get(projectId);
  if (reporters == null) {
    MantisCorePlugin.warn("String_Node_Str" + projectId + "String_Node_Str",new RuntimeException());
    cacheData.reportersByProjectId.put(projectId,new ArrayList<String>());
  }
  if (reporters.contains(reporterName))   return;
  reporters.add(reporterName);
}

Fixed version (ground truth):
/** 
 * Since for large user counts the reporter retrieval fails, we provide a hook for registering additional reporter users as they are discovered, e.g. in IssueData
 * @param projectId the project id
 * @param reporterName the name of the reporter
 */
void registerAdditionalReporter(int projectId,String reporterName){
  if (cacheData.reportersByProjectId == null) {
    MantisCorePlugin.warn("String_Node_Str",new RuntimeException());
    cacheData.reportersByProjectId=new HashMap<Integer,List<String>>();
  }
  List<String> reporters=cacheData.reportersByProjectId.get(projectId);
  if (reporters == null) {
    reporters=new ArrayList<String>();
    MantisCorePlugin.warn("String_Node_Str" + projectId + "String_Node_Str",new RuntimeException());
    cacheData.reportersByProjectId.put(projectId,reporters);
  }
  if (reporters.contains(reporterName))   return;
  reporters.add(reporterName);
}
Program: 81503
Project: 81503
Buggy source:
public boolean isTimeTrackingEnabled(IProgressMonitor monitor) throws MantisException {
  cache.refreshIfNeeded(monitor,location.getUrl());
  return cache.getCacheData().timeTrackingEnabled;
}

Fixed version (ground truth):
public boolean isTimeTrackingEnabled(IProgressMonitor monitor) throws MantisException {
  cache.refreshIfNeeded(monitor,location.getUrl());
  return cache.getCacheData().timeTrackingEnabled && cache.getRepositoryVersion().isHasTimeTrackingSupport();
}
Program: 81506
Project: 81506
Buggy source:
public String getGroup(String groupKey){
  if (barcodeMatcher.groupIndex(groupKey) == 0)   return null;
  return barcodeMatcher.group(groupKey).trim();
}

Fixed version (ground truth):
public String getGroup(String groupKey){
  doesMatchPattern();
  if (barcodeMatcher.groupIndex(groupKey) == 0)   return null;
  return barcodeMatcher.group(groupKey).trim();
}
Program: 81507
Project: 81507
Buggy source:
public Map<String,String> namedGroups(){
  Map<String,String> result=new LinkedHashMap<String,String>();
  for (int i=1; i <= groupCount(); i++) {
    String groupName=parentPattern.groupNames().get(i - 1);
    String groupValue=matcher.group(i);
    result.put(groupName,groupValue);
  }
  return result;
}

Fixed version (ground truth):
public Map<String,String> namedGroups(){
  Map<String,String> result=new LinkedHashMap<String,String>();
  matches();
  for (int i=1; i <= groupCount(); i++) {
    String groupName=parentPattern.groupNames().get(i - 1);
    String groupValue=matcher.group(i);
    result.put(groupName,groupValue);
  }
  return result;
}
Program: 81508
Project: 81508
Buggy source:
/** 
 * Constructor for the node model.
 */
protected EchoFileReaderNodeModel(){
  super(0,2,true);
  addModelSetting(EchoFileReaderNodeModel.CFG_FILE_URL,createFileURL());
  addModelSetting(EchoFileReaderNodeModel.CFG_FlowVariable,createFlowVariable());
  addModelSetting(EchoFileReaderNodeModel.CFG_splitDestinationCol,createSplitDestinationCol());
  addModelSetting(EchoFileReaderNodeModel.CFG_splitSourceCol,createSplitSourceCol());
}

Fixed version (ground truth):
/** 
 * Constructor for the node model.
 */
protected EchoFileReaderNodeModel(){
  super(0,2,true);
  addModelSetting(EchoFileReaderNodeModel.CFG_FILE_URL,createFileURL());
  addModelSetting(EchoFileReaderNodeModel.CFG_splitDestinationCol,createSplitDestinationCol());
  addModelSetting(EchoFileReaderNodeModel.CFG_splitSourceCol,createSplitSourceCol());
}
Program: 81516
Project: 81516
Buggy source:
public DataCell getCell(DataRow row){
  DataCell dcell0=row.getCell(idCol);
  DataCell dcell1=row.getCell(idRow);
  String ConvData0=dcell1.toString();
  if (dcell0.isMissing() || dcell1.isMissing()) {
    return DataType.getMissingCell();
  }
 else {
    try {
      Integer.parseInt(ConvData0);
      ConvData0=TdsUtils.mapPlateRowNumberToString(Integer.parseInt(ConvData0));
      if (ConvData0 == null) {
        setWarningMessage("String_Node_Str" + dcell0.toString() + "String_Node_Str");
        return DataType.getMissingCell();
      }
    }
 catch (    NumberFormatException e) {
    }
    String ConvData1=dcell0.toString();
    if (((SettingsModelBoolean)getModelSetting(CFG_formateColumn)).getBooleanValue() == true) {
      if (ConvData0.length() == 1) {
        ConvData0="String_Node_Str" + ConvData0;
      }
      if (ConvData1.length() == 1) {
        return new StringCell(ConvData0.concat("String_Node_Str").concat(ConvData1));
      }
    }
    return new StringCell(ConvData0.concat(ConvData1));
  }
}

Fixed version (ground truth):
public DataCell getCell(DataRow row){
  DataCell dcell0=row.getCell(idCol);
  DataCell dcell1=row.getCell(idRow);
  String ConvData0=dcell0.toString();
  String ConvData1=dcell1.toString();
  if (dcell0.isMissing() || dcell1.isMissing()) {
    return DataType.getMissingCell();
  }
 else {
    try {
      if (Double.parseDouble(ConvData0) > 768) {
        setWarningMessage("String_Node_Str" + dcell0.toString() + "String_Node_Str");
        return DataType.getMissingCell();
      }
      if (ConvData1.matches("String_Node_Str")) {
      }
 else {
        Double ConvDataDouble=Double.parseDouble(ConvData1);
        Integer ConvDataINT=(int)ConvDataDouble.doubleValue();
        ConvData1=TdsUtils.mapPlateRowNumberToString(ConvDataINT);
        if (ConvData1 == null) {
          setWarningMessage("String_Node_Str" + dcell0.toString() + "String_Node_Str");
          return DataType.getMissingCell();
        }
      }
    }
 catch (    NumberFormatException e) {
      setWarningMessage("String_Node_Str" + dcell0.toString());
      return DataType.getMissingCell();
    }
catch (    NullPointerException e) {
      setWarningMessage("String_Node_Str" + dcell0.toString() + "String_Node_Str");
      return DataType.getMissingCell();
    }
catch (    IndexOutOfBoundsException e) {
      setWarningMessage("String_Node_Str" + dcell0.toString());
      return DataType.getMissingCell();
    }
    if (((SettingsModelBoolean)getModelSetting(CFG_formateColumn)).getBooleanValue() == true) {
      if (ConvData1.length() == 1) {
        ConvData1="String_Node_Str" + ConvData1;
      }
      if (ConvData0.length() == 1) {
        return new StringCell(ConvData1.concat("String_Node_Str").concat(ConvData0));
      }
    }
    return new StringCell(ConvData1.concat(ConvData0));
  }
}
Program: 81517
Project: 81517
Buggy source:
/** 
 * Configure Class for configuring and checking the input
 */
public DataTableSpec[] configure(DataTableSpec[] in) throws InvalidSettingsException {
  DataTableSpec tSpec=in[0];
  String plateColumn=null;
  if (getModelSetting(CFG_PlateColumn) != null) {
    plateColumn=((SettingsModelString)getModelSetting(CFG_PlateColumn)).getStringValue();
  }
  String plateRow=null;
  if (getModelSetting(CFG_PlateRow) != null) {
    plateRow=((SettingsModelString)getModelSetting(CFG_PlateRow)).getStringValue();
  }
  if (plateColumn == null) {
    List<String> guessedColums=tryAutoGuessingPlateColumns(tSpec);
    plateColumn=guessedColums.get(0);
    plateRow=guessedColums.get(1);
    ((SettingsModelString)this.getModelSetting(CFG_PlateColumn)).setStringValue(plateColumn);
    ((SettingsModelString)this.getModelSetting(CFG_PlateRow)).setStringValue(plateRow);
  }
  int idCol=tSpec.findColumnIndex(plateColumn);
  int idRow=tSpec.findColumnIndex(plateRow);
  ColumnRearranger rearranged_table=createColumnRearranger(in[0],idCol,idRow);
  DataTableSpec output_table=rearranged_table.createSpec();
  return new DataTableSpec[]{output_table};
}

Fixed version (ground truth):
/** 
 * Configure Class for configuring and checking the input
 */
public DataTableSpec[] configure(DataTableSpec[] in) throws InvalidSettingsException {
  DataTableSpec tSpec=in[0];
  String plateColumn=null;
  if (getModelSetting(CFG_PlateColumn) != null) {
    plateColumn=((SettingsModelString)getModelSetting(CFG_PlateColumn)).getStringValue();
  }
  String plateRow=null;
  if (getModelSetting(CFG_PlateRow) != null) {
    plateRow=((SettingsModelString)getModelSetting(CFG_PlateRow)).getStringValue();
  }
  if (plateColumn == null) {
    List<String> guessedColums=tryAutoGuessingPlateColumns(tSpec);
    plateColumn=guessedColums.get(0);
    plateRow=guessedColums.get(1);
    ((SettingsModelString)this.getModelSetting(CFG_PlateColumn)).setStringValue(plateColumn);
    ((SettingsModelString)this.getModelSetting(CFG_PlateRow)).setStringValue(plateRow);
  }
  int idCol=tSpec.findColumnIndex(plateColumn);
  int idRow=tSpec.findColumnIndex(plateRow);
  ColumnRearranger rearranged_table=createColumnRearranger(in[0],idCol,idRow);
  if (((SettingsModelBoolean)getModelSetting(CFG_deleteSouceCol)).getBooleanValue() == true) {
    rearranged_table.remove(idCol,idRow);
  }
  DataTableSpec output_table=rearranged_table.createSpec();
  return new DataTableSpec[]{output_table};
}
Program: 81518
Project: 81518
Buggy source:
private List<String> tryAutoGuessingPlateColumns(DataTableSpec tSpec) throws InvalidSettingsException {
  List<String> guessedColums=new ArrayList<String>();
  if (tSpec.containsName(CFG_PlateColumn_DFT)) {
    if (tSpec.getColumnSpec(CFG_PlateColumn_DFT).getType().isCompatible(DoubleValue.class)) {
      guessedColums.add(0,CFG_PlateColumn_DFT);
    }
  }
  if (tSpec.containsName(CFG_PlateRow_DFT)) {
    if (tSpec.getColumnSpec(CFG_PlateRow_DFT).getType().isCompatible(DoubleValue.class)) {
      guessedColums.add(1,CFG_PlateRow_DFT);
    }
  }
  String firstStringColumn=null;
  for (  String col : tSpec.getColumnNames()) {
    if (tSpec.getColumnSpec(col).getType().isCompatible(StringValue.class) || tSpec.getColumnSpec(col).getType().isCompatible(DoubleValue.class)) {
      if (col.contains(CFG_PlateColumn_DFT)) {
        guessedColums.add(0,CFG_PlateColumn_DFT);
      }
 else {
        firstStringColumn=col;
        break;
      }
      if (col.contains(CFG_PlateRow_DFT)) {
        guessedColums.add(1,CFG_PlateRow_DFT);
      }
 else       firstStringColumn=col;
      break;
    }
  }
  if (firstStringColumn == null) {
    throw new InvalidSettingsException("String_Node_Str");
  }
  return guessedColums;
}

Fixed version (ground truth):
/** 
 * Auto guessing for plate column and row in a data set 
 */
@SuppressWarnings("String_Node_Str") private List<String> tryAutoGuessingPlateColumns(DataTableSpec tSpec) throws InvalidSettingsException {
  List<String> guessedColums=new ArrayList<String>();
  if (tSpec.containsName(CFG_PlateColumn_DFT)) {
    if (tSpec.getColumnSpec(CFG_PlateColumn_DFT).getType().isCompatible(DoubleValue.class)) {
      guessedColums.add(0,CFG_PlateColumn_DFT);
    }
  }
  if (tSpec.containsName(CFG_PlateRow_DFT)) {
    if (tSpec.getColumnSpec(CFG_PlateRow_DFT).getType().isCompatible(DoubleValue.class)) {
      guessedColums.add(1,CFG_PlateRow_DFT);
    }
  }
  for (  String col : tSpec.getColumnNames()) {
    if (tSpec.getColumnSpec(col).getType().isCompatible(StringValue.class) || tSpec.getColumnSpec(col).getType().isCompatible(DoubleValue.class)) {
      if (col.contains(CFG_PlateColumn_DFT)) {
        guessedColums.add(0,CFG_PlateColumn_DFT);
      }
 else {
        guessedColums.add(0,col);
      }
      if (col.contains(CFG_PlateRow_DFT)) {
        guessedColums.add(1,CFG_PlateRow_DFT);
      }
 else       guessedColums.add(1,col);
    }
  }
  if (guessedColums == null) {
    throw new InvalidSettingsException("String_Node_Str");
  }
  return guessedColums;
}
Program: 81519
Project: 81519
Buggy source:
/** 
 * SettingModel for the option to formate the content for better sorting
 */
static final SettingsModelBoolean createFormateColumn(){
  return new SettingsModelBoolean(CFG_formateColumn,false);
}

Fixed version (ground truth):
/** 
 * SettingModel for the option to formating the content for better sorting
 */
static final SettingsModelBoolean createFormateColumn(){
  return new SettingsModelBoolean(CFG_formateColumn,false);
}
Program: 81521
Project: 81521
Buggy source:
private double[] findMinMax(BufferedDataTable inTable,int idCol){
  double[] MinMax=new double[2];
  double maxTrailing=0;
  double maxLeading=Double.NEGATIVE_INFINITY;
  for (  DataRow row : inTable) {
    double newValue=((DoubleValue)row.getCell(idCol)).getDoubleValue();
    if (newValue > maxLeading)     maxLeading=newValue;
    double[] splitted=getLength(newValue);
    if (splitted[1] > maxTrailing) {
      maxTrailing=splitted[1];
    }
  }
  double[] Leading=new double[2];
  Leading=getLength(maxLeading);
  MinMax[0]=Leading[0];
  MinMax[1]=maxTrailing;
  return MinMax;
}

Fixed version (ground truth):
private double[] findMinMax(BufferedDataTable inTable,int idCol){
  double[] MinMax=new double[2];
  double maxTrailing=0;
  double maxLeading=Double.NEGATIVE_INFINITY;
  for (  DataRow row : inTable) {
    if (row.getCell(idCol).isMissing()) {
      break;
    }
    double newValue=((DoubleValue)row.getCell(idCol)).getDoubleValue();
    if (newValue > maxLeading)     maxLeading=newValue;
    double[] splitted=getLength(newValue);
    if (splitted[1] > maxTrailing) {
      maxTrailing=splitted[1];
    }
  }
  double[] Leading=new double[2];
  Leading=getLength(maxLeading);
  MinMax[0]=Leading[0];
  MinMax[1]=maxTrailing;
  return MinMax;
}
Program: 81522
Project: 81522
Buggy source:
@Override protected DataCell getResultInternal(){
  IPreferenceStore prefStore=HCSToolsBundleActivator.getDefault().getPreferenceStore();
  double madScalingFactor=prefStore.getDouble(HCSToolsPreferenceInitializer.MAD_SCALING_FACTOR);
  if (super.getResultInternal().isMissing())   return super.getResultInternal();
  final List<DataCell> cells=super.getCells();
  ExtDescriptiveStats stats=new ExtDescriptiveStats();
  stats.setMadImpl(new MadStatistic(madScalingFactor));
  for (  DataCell dc : cells) {
    double val=((DoubleCell)dc).getDoubleValue();
    stats.addValue(val);
  }
  try {
    return new DoubleCell(stats.getMad());
  }
 catch (  IllegalMadFactorException e) {
    return new DoubleCell(Double.NaN);
  }
}

Fixed version (ground truth):
@Override protected DataCell getResultInternal(){
  IPreferenceStore prefStore=HCSToolsBundleActivator.getDefault().getPreferenceStore();
  double madScalingFactor=prefStore.getDouble(HCSToolsPreferenceInitializer.MAD_SCALING_FACTOR);
  if (super.getResultInternal().isMissing())   return super.getResultInternal();
  final List<DataCell> cells=super.getCells();
  ExtDescriptiveStats stats=new ExtDescriptiveStats();
  stats.setMadImpl(new MadStatistic(madScalingFactor));
  for (  DataCell dc : cells) {
    double val=((DoubleValue)dc).getDoubleValue();
    stats.addValue(val);
  }
  try {
    return new DoubleCell(stats.getMad());
  }
 catch (  IllegalMadFactorException e) {
    return new DoubleCell(Double.NaN);
  }
}
Program: 81523
Project: 81523
Buggy source:
@Override protected DataCell getResultInternal(){
  IPreferenceStore prefStore=HCSToolsBundleActivator.getDefault().getPreferenceStore();
  double madScalingFactor=prefStore.getDouble(HCSToolsPreferenceInitializer.MAD_SCALING_FACTOR);
  if (super.getResultInternal().isMissing())   return super.getResultInternal();
  final List<DataCell> cells=super.getCells();
  ExtDescriptiveStats stats=new ExtDescriptiveStats();
  stats.setMadImpl(new MadStatistic(madScalingFactor));
  for (  DataCell dc : cells) {
    double val=((DoubleCell)dc).getDoubleValue();
    stats.addValue(val);
  }
  try {
    return new DoubleCell(stats.getMad());
  }
 catch (  IllegalMadFactorException e) {
    return new DoubleCell(Double.NaN);
  }
}

Fixed version (ground truth):
@Override protected DataCell getResultInternal(){
  IPreferenceStore prefStore=HCSToolsBundleActivator.getDefault().getPreferenceStore();
  double madScalingFactor=prefStore.getDouble(HCSToolsPreferenceInitializer.MAD_SCALING_FACTOR);
  if (super.getResultInternal().isMissing())   return super.getResultInternal();
  final List<DataCell> cells=super.getCells();
  ExtDescriptiveStats stats=new ExtDescriptiveStats();
  stats.setMadImpl(new MadStatistic(madScalingFactor));
  for (  DataCell dc : cells) {
    double val=((DoubleValue)dc).getDoubleValue();
    stats.addValue(val);
  }
  try {
    return new DoubleCell(stats.getMad());
  }
 catch (  IllegalMadFactorException e) {
    return new DoubleCell(Double.NaN);
  }
}
Program: 81524
Project: 81524
Buggy source:
/** 
 * Action to control the flag for the global color scale for the heatmaps
 * @param event fired by the menu item
 */
private void globalScalingAction(ActionEvent event){
  JCheckBoxMenuItem item=(JCheckBoxMenuItem)event.getSource();
  if (heatTrellis.plateViewers.isEmpty()) {
    heatMapModel.setGlobalScaling(item.isSelected());
    return;
  }
  Object[] options={"String_Node_Str","String_Node_Str"};
  int optionIndex=JOptionPane.showOptionDialog(getTopLevelAncestor(),"String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[1]);
  if (optionIndex == 0) {
    item.setSelected(heatMapModel.isGlobalScaling());
  }
 else {
    heatMapModel.setGlobalScaling(item.isSelected());
    heatTrellis.closePlateViewers();
  }
}

Fixed version (ground truth):
/** 
 * Action to control the flag for the global color scale for the heatmaps
 * @param event fired by the menu item
 */
private void globalScalingAction(ActionEvent event){
  JCheckBoxMenuItem item=(JCheckBoxMenuItem)event.getSource();
  if (heatTrellis.plateViewers.isEmpty()) {
    heatMapModel.setGlobalScaling(item.isSelected());
    heatMapModel.fireModelChanged();
    return;
  }
  Object[] options={"String_Node_Str","String_Node_Str"};
  int optionIndex=JOptionPane.showOptionDialog(getTopLevelAncestor(),"String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[1]);
  if (optionIndex == 0) {
    item.setSelected(heatMapModel.isGlobalScaling());
  }
 else {
    heatMapModel.setGlobalScaling(item.isSelected());
    heatTrellis.closePlateViewers();
    heatMapModel.fireModelChanged();
  }
}
Program: 81525
Project: 81525
Buggy source:
@Override public void modelChanged(){
  this.colorMapMenu.setEnabled(!heatMapModel.isGlobalScaling());
  this.markSelection.setSelected(heatMapModel.doMarkSelection());
  this.overlayHider.setSelected(this.heatMapModel.doHideMostFreqOverlay());
  if ((heatMapModel != null) && heatMapModel.getReadoutRescaleStrategy().getClass().equals(MinMaxStrategy.class)) {
    this.outlierHandlingMenu.getItem(0).setSelected(true);
  }
 else {
    this.outlierHandlingMenu.getItem(1).setSelected(true);
  }
  colorMapGroup.clearSelection();
  JRadioButtonMenuItem item=colorMap.get(heatMapModel.getColorGradient().getGradientName());
  if (item != null) {
    item.setSelected(true);
  }
}

Fixed version (ground truth):
@Override public void modelChanged(){
  if (parent.getChildViews() == null)   this.colorMapMenu.setEnabled(!heatMapModel.isGlobalScaling());
  this.markSelection.setSelected(heatMapModel.doMarkSelection());
  this.overlayHider.setSelected(this.heatMapModel.doHideMostFreqOverlay());
  if ((heatMapModel != null) && heatMapModel.getReadoutRescaleStrategy().getClass().equals(MinMaxStrategy.class)) {
    this.outlierHandlingMenu.getItem(0).setSelected(true);
  }
 else {
    this.outlierHandlingMenu.getItem(1).setSelected(true);
  }
  colorMapGroup.clearSelection();
  JRadioButtonMenuItem item=colorMap.get(heatMapModel.getColorGradient().getGradientName());
  if (item != null) {
    item.setSelected(true);
  }
}
Program: 81526
Project: 81526
Buggy source:
/** 
 * Configure the gui components with the menu items.
 * @param hmm data model delivering the content
 */
public void configure(HeatMapModel hmm){
  heatMapModel=hmm;
  if (heatMapModel.getScreen() == null) {
    System.err.println("String_Node_Str");
    return;
  }
  List<Plate> subScreen=Arrays.asList(hmm.getScreen().get(0));
  List<String> annotations=new ArrayList<String>();
  annotations.addAll(heatMapModel.getAnnotations());
  if (heatMapModel.hasKnimeColorModel())   annotations.add(0,heatMapModel.getKnimeColorAttributeTitle());
  annotations.add(0,"String_Node_Str");
  overlaySelector.configure(annotations,heatMapModel,AttributeType.OVERLAY_ANNOTATION);
  List<String> readouts=heatMapModel.getReadouts();
  readoutSelector.configure(readouts,heatMapModel,AttributeType.READOUT);
  if ((parent == null) || (parent instanceof ScreenViewer)) {
    Collection<PlateAttribute> plateAttributes=heatMapModel.getPlateAttributes();
    DefaultComboBoxModel model=new DefaultComboBoxModel(PlateUtils.getPlateAttributeTitles(plateAttributes));
    filterSelector.setModel(model);
  }
  String plateFilterString=heatMapModel.getPlateFilterString();
  assert(plateFilterString != null);
  if (plateFilterString.length() > 0)   filterString.setText(plateFilterString);
}

Fixed version (ground truth):
/** 
 * Configure the gui components with the menu items.
 * @param hmm data model delivering the content
 */
public void configure(HeatMapModel hmm){
  heatMapModel=hmm;
  if (heatMapModel.getScreen() == null) {
    System.err.println("String_Node_Str");
    return;
  }
  List<Plate> subScreen=Arrays.asList(hmm.getScreen().get(0));
  List<String> annotations=heatMapModel.getAnnotations();
  overlaySelector.configure(annotations,heatMapModel,AttributeType.OVERLAY_ANNOTATION);
  List<String> readouts=heatMapModel.getReadouts();
  readoutSelector.configure(readouts,heatMapModel,AttributeType.READOUT);
  if ((parent == null) || (parent instanceof ScreenViewer)) {
    Collection<PlateAttribute> plateAttributes=heatMapModel.getPlateAttributes();
    DefaultComboBoxModel model=new DefaultComboBoxModel(PlateUtils.getPlateAttributeTitles(plateAttributes));
    filterSelector.setModel(model);
  }
  String plateFilterString=heatMapModel.getPlateFilterString();
  assert(plateFilterString != null);
  if (plateFilterString.length() > 0)   filterString.setText(plateFilterString);
}
Program: 81527
Project: 81527
Buggy source:
@Override public void modelChanged(){
switch (selectionType) {
case READOUT:
    if (heatMapModel.getSelectedReadOut() != null) {
      setSelectedItem(heatMapModel.getSelectedReadOut());
    }
 else {
      heatMapModel.setCurrentReadout((String)getSelectedItem());
    }
  break;
case OVERLAY_ANNOTATION:
if (heatMapModel.getCurrentOverlay() != null) {
  setSelectedItem(heatMapModel.getCurrentOverlay());
}
 else {
  heatMapModel.setCurrentOverlay((String)getSelectedItem());
}
break;
}
}

Fixed version (ground truth):
@Override public void modelChanged(){
  DefaultComboBoxModel<String> currentModel=(DefaultComboBoxModel<String>)this.getModel();
  this.removeItemListener(m_listener);
  currentModel.removeAllElements();
switch (selectionType) {
case READOUT:
    List<String> readouts=heatMapModel.getReadouts();
  for (  String ro : readouts)   currentModel.addElement(ro);
if (heatMapModel.getSelectedReadOut() != null) {
  setSelectedItem(heatMapModel.getSelectedReadOut());
}
 else {
  heatMapModel.setCurrentReadout((String)getSelectedItem());
}
break;
case OVERLAY_ANNOTATION:
List<String> annotations=heatMapModel.getAnnotations();
String[] items=annotations.toArray(new String[annotations.size()]);
items=addOverlayOptions(items);
for (String an : items) currentModel.addElement(an);
if (heatMapModel.getCurrentOverlay() != null) {
setSelectedItem(heatMapModel.getCurrentOverlay());
}
 else {
heatMapModel.setCurrentOverlay((String)getSelectedItem());
}
break;
}
this.addItemListener(m_listener);
}
Program: 81530
Project: 81530
Buggy source:
/** 
 * Action to control the flag for the global color scale for the heatmaps
 * @param event fired by the menu item
 */
private void globalScalingAction(ActionEvent event){
  JCheckBoxMenuItem item=(JCheckBoxMenuItem)event.getSource();
  if (heatTrellis.plateViewers.isEmpty())   return;
  Object[] options={"String_Node_Str","String_Node_Str"};
  int optionIndex=JOptionPane.showOptionDialog(getTopLevelAncestor(),"String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[1]);
  if (optionIndex == 0) {
    item.setSelected(heatMapModel.isGlobalScaling());
  }
 else {
    heatMapModel.setGlobalScaling(item.isSelected());
    heatTrellis.closePlateViewers();
  }
}

Fixed version (ground truth):
/** 
 * Action to control the flag for the global color scale for the heatmaps
 * @param event fired by the menu item
 */
private void globalScalingAction(ActionEvent event){
  JCheckBoxMenuItem item=(JCheckBoxMenuItem)event.getSource();
  if (heatTrellis.plateViewers.isEmpty()) {
    heatMapModel.setGlobalScaling(item.isSelected());
    return;
  }
  Object[] options={"String_Node_Str","String_Node_Str"};
  int optionIndex=JOptionPane.showOptionDialog(getTopLevelAncestor(),"String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[1]);
  if (optionIndex == 0) {
    item.setSelected(heatMapModel.isGlobalScaling());
  }
 else {
    heatMapModel.setGlobalScaling(item.isSelected());
    heatTrellis.closePlateViewers();
  }
}
Program: 81531
Project: 81531
Buggy source:
/** 
 * Action executed when selecting the sort plate function
 */
private void sortPlatesAction(){
  PlateAttributeDialog dialog=new PlateAttributeDialog(heatMapModel);
  dialog.setVisible(true);
  String[] selectedAttributes=dialog.getSelectedAttributeTitles();
  for (int i=selectedAttributes.length - 1; i >= 0; i--) {
    PlateAttribute attribute=PlateUtils.getPlateAttributeByTitle(selectedAttributes[i]);
    heatMapModel.sortPlates(attribute);
  }
  if (!dialog.isDescending()) {
    heatMapModel.revertScreen();
  }
  heatMapModel.fireModelChanged();
  heatMapModel.setSortAttributeSelectionByTiles(selectedAttributes);
}

Fixed version (ground truth):
/** 
 * Action executed when selecting the sort plate function
 */
private void sortPlatesAction(){
  PlateAttributeDialog dialog=new PlateAttributeDialog(heatMapModel);
  dialog.setVisible(true);
  String[] selectedAttributes=dialog.getSelectedAttributeTitles();
  ArrayList<PlateAttribute> attributeList=new ArrayList<PlateAttribute>();
  for (  String attributeString : selectedAttributes) {
    PlateAttribute attribute=PlateUtils.getPlateAttributeByTitle(attributeString);
    attributeList.add(attribute);
  }
  heatMapModel.sortPlates(attributeList,dialog.isDescending());
  heatMapModel.fireModelChanged();
  heatMapModel.setSortAttributeSelectionByTiles(selectedAttributes);
}