nus-yam/ex-repair huggingface dataset:
Program: 25131
Project: 25131
Buggy source:
public static void main(String[] args){
  setUIFont(new FontUIResource(new Font("String_Node_Str",Font.BOLD,14)));
  try {
    BootLoader.init(System.getProperty("String_Node_Str") + "String_Node_Str");
  }
 catch (  PersistanceException e) {
    e.printStackTrace();
  }
  Application app=new Application();
  app.setPreferredSize(new Dimension(Config.APPLICATION_DEFAULT_FRAME_WIDTH,Config.APPLICATION_DEFAULT_FRAME_HEIGHT));
  app.setVisible(true);
  app.pack();
  app.setLocationRelativeTo(null);
}

Fixed version (ground truth):
public static void main(String[] args){
  setUIFont(new FontUIResource(new Font("String_Node_Str",Font.BOLD,14)));
  try {
    BootLoader.init(System.getProperty("String_Node_Str") + "String_Node_Str");
    Application app=new Application();
    app.setPreferredSize(new Dimension(Config.APPLICATION_DEFAULT_FRAME_WIDTH,Config.APPLICATION_DEFAULT_FRAME_HEIGHT));
    app.setVisible(true);
    app.pack();
    app.setLocationRelativeTo(null);
  }
 catch (  PersistanceException e) {
    new ExceptionView(ExceptionFormatter.format(e,new CurrentClassGetter().getClassName(),"String_Node_Str"));
  }
}
Program: 25132
Project: 25132
Buggy source:
public ExceptionView(String error){
  JLabel title=new JLabel(Config.RESSOURCE_BUNDLE.getString("String_Node_Str"));
  JLabel message=new JLabel(error);
  add(title,BorderLayout.NORTH);
  add(message,BorderLayout.CENTER);
  setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  setModal(true);
  setResizable(false);
  pack();
  setVisible(true);
}

Fixed version (ground truth):
public ExceptionView(String error){
  JLabel title=new JLabel();
  if (Config.RESSOURCE_BUNDLE != null) {
    title.setText(Config.RESSOURCE_BUNDLE.getString("String_Node_Str"));
  }
 else {
    title.setText("String_Node_Str");
  }
  JTextArea message=new JTextArea(error);
  JScrollPane scrollPaneArea=new JScrollPane(message,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  scrollPaneArea.setPreferredSize(new Dimension(400,400));
  add(title,BorderLayout.NORTH);
  add(scrollPaneArea,BorderLayout.CENTER);
  setForeground(Color.white);
  setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  setPreferredSize(new Dimension(400,400));
  setModal(true);
  setResizable(false);
  pack();
  setVisible(true);
}
Program: 25133
Project: 25133
Buggy source:
public static void close(){
  if (conn != null) {
    try {
      conn.close();
    }
 catch (    Exception ex) {
      ErrorHandler.getException(ex,new CurrentClassGetter().getClassName(),"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public static void close(){
  if (conn != null) {
    try {
      conn.close();
      conn=null;
    }
 catch (    Exception ex) {
      ErrorHandler.getException(ex,new CurrentClassGetter().getClassName(),"String_Node_Str");
    }
  }
}
Program: 25134
Project: 25134
Buggy source:
public static Connection open(){
  try {
    Class.forName("String_Node_Str");
    if (conn == null) {
      conn=DriverManager.getConnection(url,user,password);
    }
  }
 catch (  ClassNotFoundException ex) {
    ErrorHandler.getException(ex,new CurrentClassGetter().getClassName(),"String_Node_Str");
  }
catch (  SQLException ex) {
    ErrorHandler.getException(ex,new CurrentClassGetter().getClassName(),"String_Node_Str");
  }
  return conn;
}

Fixed version (ground truth):
public static Connection open(){
  try {
    Class.forName("String_Node_Str").newInstance();
    if (conn == null) {
      conn=DriverManager.getConnection(url,user,password);
    }
  }
 catch (  Exception ex) {
    ErrorHandler.getException(ex,new CurrentClassGetter().getClassName(),"String_Node_Str");
  }
  return conn;
}
Program: 25135
Project: 25135
Buggy source:
public void add(Appointment appointment){
  long id=appointment.getId();
  int client_id=appointment.getClient().getId();
  int employee_id=appointment.getEmployee().getId();
  String title=appointment.getTitle();
  String description=appointment.getDescription();
  String begin=DateHelper.DateToString(appointment.getBegin());
  String end=DateHelper.DateToString(appointment.getEnd());
  String sql_appointment="String_Node_Str" + id + "String_Node_Str"+ client_id+ "String_Node_Str"+ employee_id+ "String_Node_Str"+ "String_Node_Str"+ title+ "String_Node_Str"+ "String_Node_Str"+ description+ "String_Node_Str";
  String sql_dates="String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str"+ begin+ "String_Node_Str"+ "String_Node_Str"+ end+ "String_Node_Str";
  Connection conn;
  Statement stmt;
  try {
    conn=Db.open();
    stmt=conn.createStatement();
    stmt.executeUpdate(sql_appointment);
    stmt.executeUpdate(sql_dates);
  }
 catch (  SQLException ex) {
    ErrorHandler.getException(ex,this.getClass().getName(),"String_Node_Str");
  }
 finally {
    Db.close();
  }
}

Fixed version (ground truth):
public void add(Appointment appointment){
  long id=appointment.getId();
  int client_id=appointment.getClient().getId();
  int employee_id=appointment.getEmployee().getId();
  String title=appointment.getTitle();
  String description=appointment.getDescription();
  String begin=DateHelper.DateToString(appointment.getBegin());
  String end=DateHelper.DateToString(appointment.getEnd());
  String sql_appointment="String_Node_Str" + id + "String_Node_Str"+ client_id+ "String_Node_Str"+ employee_id+ "String_Node_Str"+ "String_Node_Str"+ title+ "String_Node_Str"+ "String_Node_Str"+ description+ "String_Node_Str";
  String sql_dates="String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str"+ begin+ "String_Node_Str"+ "String_Node_Str"+ end+ "String_Node_Str";
  Connection conn;
  Statement stmt;
  try {
    conn=Db.open();
    stmt=conn.createStatement();
    stmt.executeUpdate(sql_appointment);
    stmt.executeUpdate(sql_dates);
    stmt.close();
  }
 catch (  SQLException ex) {
    ErrorHandler.getException(ex,this.getClass().getName(),"String_Node_Str");
  }
 finally {
    Db.close();
  }
}
Program: 25136
Project: 25136
Buggy source:
public static boolean editprofile(String command,Player player,String[] args){
  if (bPermissions.checkPermission(player,command)) {
    if (args.length >= 2) {
      String field=args[0];
      String message="String_Node_Str";
      for (int i=1; i < args.length; i++) {
        message+=args[i] + "String_Node_Str";
      }
      if (editProfile(player,field,message)) {
        bChat.sendMessageToPlayer(player,"String_Node_Str");
      }
 else {
        return true;
      }
    }
    bChat.sendMessageToPlayer(player,bMessageManager.messageWrongCommandUsage);
    bChat.sendMessageToPlayer(player,"String_Node_Str");
    return true;
  }
  return true;
}

Fixed version (ground truth):
public static boolean editprofile(String command,Player player,String[] args){
  if (bPermissions.checkPermission(player,command)) {
    if (args.length >= 2) {
      String field=args[0];
      String message="String_Node_Str";
      for (int i=1; i < args.length; i++) {
        message+=args[i] + "String_Node_Str";
      }
      if (editProfile(player,field,message)) {
        bChat.sendMessageToPlayer(player,"String_Node_Str");
        return true;
      }
 else {
        return true;
      }
    }
    bChat.sendMessageToPlayer(player,bMessageManager.messageWrongCommandUsage);
    bChat.sendMessageToPlayer(player,"String_Node_Str");
    return true;
  }
  return true;
}
Program: 25137
Project: 25137
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Bundle extras=getIntent().getExtras();
  String commanderNumber=extras.getString("String_Node_Str");
  MessageParser mp=new MessageParser(extras.getString("String_Node_Str"));
  String messagestamp=mp.getMessageStamp();
  CustomizeDialog customizeDialog=new CustomizeDialog(this,commanderNumber,messagestamp);
  customizeDialog.setTopTitle(extras.getString("String_Node_Str"));
  customizeDialog.show();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Bundle extras=getIntent().getExtras();
  String commanderNumber=extras.getString("String_Node_Str");
  String msg=extras.getString("String_Node_Str");
  CustomDialog customizeDialog=new CustomDialog(this,commanderNumber,msg);
  customizeDialog.show();
}
Program: 25139
Project: 25139
Buggy source:
public void playLoopedSound(int index){
  float streamVolume=mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
  streamVolume=streamVolume / mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
  mSoundPool.play((Integer)mSoundPoolMap.get(index),streamVolume,streamVolume,1,-1,1f);
}

Fixed version (ground truth):
public void playLoopedSound(int index){
  if (!isSoundPlaying) {
    float streamVolume=mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
    streamVolume=streamVolume / mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    mSoundPool.play((Integer)mSoundPoolMap.get(index),streamVolume,streamVolume,1,-1,1f);
    isSoundPlaying=true;
  }
}
Program: 25140
Project: 25140
Buggy source:
/** 
 * Deallocates the resources and Instance of SoundManager
 */
public static void cleanup(){
  mSoundPool.release();
  mSoundPool=null;
  mSoundPoolMap.clear();
  mAudioManager.unloadSoundEffects();
}

Fixed version (ground truth):
/** 
 * Deallocates the resources and Instance of SoundManager
 */
public static void cleanup(){
  mSoundPool.release();
  mSoundPool=null;
  mSoundPoolMap.clear();
  mAudioManager.unloadSoundEffects();
  isSoundPlaying=false;
}
Program: 25141
Project: 25141
Buggy source:
/** 
 * Delegate method called from  {@link FacesHandler#getNavigationOutcomeLocation(FacesContext,NavigationRequestEvent)} in order to determine theoutcome of a navigation event. By default this implementation will use the {@link NavigationCaseAnnotationLocator} to locate and process {@link NavigationCase} and {@link NavigationRules}annotations.
 * @param request The request
 * @param response The response
 * @param event The JSF navigation event
 * @param handler The handler
 * @return A {@link NavigationLocation} or <tt>null</tt>
 * @throws Exception on error
 */
protected final NavigationLocation getNavigationOutcome(HttpServletRequest request,HttpServletResponse response,NavigationRequestEvent event,Object handler) throws Exception {
  NavigationCaseMethodResolver methodResolver=getMethodResolver(handler);
  ServletWebRequest webRequest=new ServletWebRequest(request,response);
  Method[] navigationMethods=methodResolver.resolveNavigationMethods(request);
  FoundNavigationCase navigationCase=navigationCaseAnnotationLocator.findNavigationCase(navigationMethods,event);
  NavigationOutcomeExpressionContextImpl context=new NavigationOutcomeExpressionContextImpl(handler,webRequest,methodResolver);
  NavigationLocation outcome=navigationCase == null ? null : navigationCase.getOutcome(event,handler,webRequest,context);
  outcome=navigationOutcomeExpressionResolver.resolveNavigationOutcome(context,outcome);
  return outcome;
}

Fixed version (ground truth):
/** 
 * Delegate method called from  {@link FacesHandler#getNavigationOutcomeLocation(FacesContext,NavigationRequestEvent)} in order to determine theoutcome of a navigation event. By default this implementation will use the {@link NavigationCaseAnnotationLocator} to locate and process {@link NavigationCase} and {@link NavigationRules}annotations.
 * @param request The request
 * @param response The response
 * @param event The JSF navigation event
 * @param handler The handler
 * @return A {@link NavigationLocation} or <tt>null</tt>
 * @throws Exception on error
 */
protected final NavigationLocation getNavigationOutcome(HttpServletRequest request,HttpServletResponse response,NavigationRequestEvent event,Object handler) throws Exception {
  NavigationCaseMethodResolver methodResolver=getMethodResolver(handler);
  ServletWebRequest webRequest=new ServletWebRequest(request,response);
  Method[] navigationMethods=methodResolver.resolveNavigationMethods(request);
  FoundNavigationCase navigationCase=navigationCaseAnnotationLocator.findNavigationCase(handler,navigationMethods,event);
  NavigationOutcomeExpressionContextImpl context=new NavigationOutcomeExpressionContextImpl(handler,webRequest,methodResolver);
  NavigationLocation outcome=navigationCase == null ? null : navigationCase.getOutcome(event,handler,webRequest,context);
  outcome=navigationOutcomeExpressionResolver.resolveNavigationOutcome(context,outcome);
  return outcome;
}
Program: 25142
Project: 25142
Buggy source:
public void testLocateWithoutMethods() throws Exception {
  NavigationCaseAnnotationLocator locator=new NavigationCaseAnnotationLocator();
  assertNull(locator.findNavigationCase(null,event("String_Node_Str","String_Node_Str")));
  assertNull(locator.findNavigationCase(new Method[]{},event("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
public void testLocateWithoutMethods() throws Exception {
  Object h=new Object();
  assertNull(locator.findNavigationCase(h,null,event("String_Node_Str","String_Node_Str")));
  assertNull(locator.findNavigationCase(h,new Method[]{},event("String_Node_Str","String_Node_Str")));
}
Program: 25143
Project: 25143
Buggy source:
public void testLocateWithDefault() throws Exception {
  Method method=SampleController.class.getMethod("String_Node_Str",new Class<?>[]{});
  Method[] methods=new Method[]{method};
  NavigationCaseAnnotationLocator locator=new NavigationCaseAnnotationLocator();
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
}

Fixed version (ground truth):
public void testLocateWithDefault() throws Exception {
  useMethod("String_Node_Str");
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
}
Program: 25144
Project: 25144
Buggy source:
public void testLocateForException() throws Exception {
  Method method=SampleController.class.getMethod("String_Node_Str",new Class<?>[]{});
  Method[] methods=new Method[]{method};
  NavigationCaseAnnotationLocator locator=new NavigationCaseAnnotationLocator();
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str",new IllegalStateException())).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str",new RuntimeException(new IllegalStateException()))).getNavigationCase().to());
  assertNull(locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str",new RuntimeException())));
}

Fixed version (ground truth):
public void testLocateForException() throws Exception {
  Method method=SampleController.class.getMethod("String_Node_Str",new Class<?>[]{});
  Method[] methods=new Method[]{method};
  assertEquals("String_Node_Str",locator.findNavigationCase(handler,methods,event("String_Node_Str","String_Node_Str",new IllegalStateException())).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(handler,methods,event("String_Node_Str","String_Node_Str",new RuntimeException(new IllegalStateException()))).getNavigationCase().to());
  assertNull(locator.findNavigationCase(handler,methods,event("String_Node_Str","String_Node_Str",new RuntimeException())));
}
Program: 25145
Project: 25145
Buggy source:
public void testLocate() throws Exception {
  Method method=SampleController.class.getMethod("String_Node_Str",new Class<?>[]{});
  Method[] methods=new Method[]{method};
  NavigationCaseAnnotationLocator locator=new NavigationCaseAnnotationLocator();
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
public void testLocate() throws Exception {
  useMethod("String_Node_Str");
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locate(event("String_Node_Str","String_Node_Str")));
}
Program: 25146
Project: 25146
Buggy source:
public void testLocateWithCatchAll() throws Exception {
  Method method=SampleController.class.getMethod("String_Node_Str",new Class<?>[]{});
  Method[] methods=new Method[]{method};
  NavigationCaseAnnotationLocator locator=new NavigationCaseAnnotationLocator();
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
}

Fixed version (ground truth):
public void testLocateWithCatchAll() throws Exception {
  useMethod("String_Node_Str");
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
}
Program: 25147
Project: 25147
Buggy source:
public void testLocateNoNavigationRules() throws Exception {
  Method method=SampleController.class.getMethod("String_Node_Str",new Class<?>[]{});
  Method[] methods=new Method[]{method};
  NavigationCaseAnnotationLocator locator=new NavigationCaseAnnotationLocator();
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
}

Fixed version (ground truth):
public void testLocateNoNavigationRules() throws Exception {
  useMethod("String_Node_Str");
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
}
Program: 25148
Project: 25148
Buggy source:
public void testLocateWithAction() throws Exception {
  Method method=SampleController.class.getMethod("String_Node_Str",new Class<?>[]{});
  Method[] methods=new Method[]{method};
  NavigationCaseAnnotationLocator locator=new NavigationCaseAnnotationLocator();
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")));
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")));
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locator.findNavigationCase(methods,event("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
public void testLocateWithAction() throws Exception {
  useMethod("String_Node_Str");
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locate(event("String_Node_Str","String_Node_Str")));
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locate(event("String_Node_Str","String_Node_Str")));
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertEquals("String_Node_Str",locate(event("String_Node_Str","String_Node_Str")).getNavigationCase().to());
  assertNull(locate(event("String_Node_Str","String_Node_Str")));
}
Program: 25149
Project: 25149
Buggy source:
private boolean isSuitableOn(Object owner,NavigationCase navigationCase){
  if (navigationCase.on().length == 0) {
    if (navigationCase.onException() != null) {
      return true;
    }
    if ((owner instanceof Method) && (((Method)owner).getName().equals(event.getOutcome()))) {
      return true;
    }
  }
  for (  String on : navigationCase.on()) {
    if (on.equals("String_Node_Str") || on.equals(event.getOutcome())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isSuitableOn(Object owner,NavigationCase navigationCase){
  if (navigationCase.on().length == 0) {
    if (!void.class.equals(navigationCase.onException())) {
      return true;
    }
    if ((owner instanceof Method) && (((Method)owner).getName().equals(event.getOutcome()))) {
      return true;
    }
  }
  for (  String on : navigationCase.on()) {
    if (on.equals("String_Node_Str") || on.equals(event.getOutcome())) {
      return true;
    }
  }
  return false;
}
Program: 25150
Project: 25150
Buggy source:
public ResolvedModelArgument resolve(String modelAttributeName,MethodParameter methodParameter,WebRequest webRequest,boolean failOnErrors){
  ExpressionFactory expressionFactory=facesContext.getApplication().getExpressionFactory();
  ELContext elContext=FacesContext.getCurrentInstance().getELContext();
  ValueExpression valueExpression=expressionFactory.createValueExpression(elContext,"String_Node_Str" + modelAttributeName + "String_Node_Str",Object.class);
  Object resolved=valueExpression.getValue(elContext);
  if (!elContext.isPropertyResolved()) {
    return null;
  }
  return new ResolvedModelArgument(resolved);
}

Fixed version (ground truth):
public ResolvedModelArgument resolve(String modelAttributeName,MethodParameter methodParameter,WebRequest webRequest,boolean failOnErrors){
  if (modelAttributeName == null) {
    modelAttributeName=Conventions.getVariableNameForParameter(methodParameter);
  }
  ExpressionFactory expressionFactory=facesContext.getApplication().getExpressionFactory();
  ELContext elContext=FacesContext.getCurrentInstance().getELContext();
  ValueExpression valueExpression=expressionFactory.createValueExpression(elContext,"String_Node_Str" + modelAttributeName + "String_Node_Str",Object.class);
  Object resolved=valueExpression.getValue(elContext);
  if (!elContext.isPropertyResolved()) {
    return null;
  }
  return new ResolvedModelArgument(resolved);
}
Program: 25151
Project: 25151
Buggy source:
private String typeForElement(Object o){
  return o == null ? "String_Node_Str" : fst.getClass().getName();
}

Fixed version (ground truth):
private String typeForElement(Object o){
  return o == null ? "String_Node_Str" : o.getClass().getName();
}
Program: 25152
Project: 25152
Buggy source:
@Override public int compare(GridPlayer a,GridPlayer b){
  int ret=0;
  if (!a.getColor().equals(b.getColor())) {
    Color[] p=Color.playable;
    int pos1=-1, pos2=-1;
    for (int i=0; i < p.length; i++) {
      if (p[i].equals(a.getColor()))       pos1=i;
 else       if (p[i].equals(b.getColor()))       pos2=i;
    }
    if (pos1 == -1 || pos2 == -1)     throw new RuntimeException("String_Node_Str");
    if (pos1 > pos2) {
      ret=1;
    }
 else     if (pos1 < pos2)     ret=-1;
  }
  return ret;
}

Fixed version (ground truth):
@Override public int compare(GridPlayer a,GridPlayer b){
  return (a.getColor().compareTo(b.getColor()));
}
Program: 25153
Project: 25153
Buggy source:
public void setDateSent(Date dateSent){
  this.dateSent=dateSent;
}

Fixed version (ground truth):
public void setDateSent(Date dateSent){
  this.dateSent=new Date(dateSent.getTime());
}
Program: 25154
Project: 25154
Buggy source:
@Temporal(TemporalType.DATE) public Date getDateSent(){
  return dateSent;
}

Fixed version (ground truth):
@Temporal(TemporalType.DATE) public Date getDateSent(){
  return new Date(dateSent.getTime());
}
Program: 25155
Project: 25155
Buggy source:
@Override public int compareTo(Object o){
  MoveComparator m=new MoveComparator();
  return m.compare(this,(GridMove)o);
}

Fixed version (ground truth):
@Override public int compareTo(Object o){
  if (o instanceof GridMove) {
    GridMove contrast=(GridMove)o;
    if (contrast.getId() > getId())     return 1;
 else     if (contrast.getId() < getId())     return -1;
 else     return 0;
  }
 else {
    return -1;
  }
}
Program: 25156
Project: 25156
Buggy source:
/** 
 * Registers a robot with she specified Game object. TODO:  Make this generic.
 * @throws InvalidRegistrationException
 */
public Game registerPlayer(Game game,Registrant registrant) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.merge(game);
  game.setMessageSender(messageSender);
  registrant=em.merge(registrant);
  registrant.setLastRegistration(System.currentTimeMillis());
  game.registerPlayer(registrant);
  messageSender.sendPlayerChange(game);
  return game;
}

Fixed version (ground truth):
/** 
 * Registers a robot with she specified Game object. TODO:  Make this generic.
 * @throws InvalidRegistrationException
 */
public Game registerPlayer(Game game,Registrant registrant) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  registrant=em.merge(registrant);
  registrant.setLastRegistration(System.currentTimeMillis());
  game.registerPlayer(registrant);
  em.flush();
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25157
Project: 25157
Buggy source:
public Game registerAgent(Game game,Agent agent) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.merge(game);
  game.setMessageSender(messageSender);
  game.registerAgent(agent);
  messageSender.sendPlayerChange(game);
  return game;
}

Fixed version (ground truth):
public Game registerAgent(Game game,Agent agent) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.registerAgent(agent);
  em.flush();
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25159
Project: 25159
Buggy source:
public List<Game> getPendingGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.WAITING);
  List<Game> games=query.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    boolean member=false;
    for (    GamePlayer p : game.listPlayers()) {
      if (p.getRegistrant().equals(player)) {
        member=true;
        break;
      }
    }
    if (!member)     ret.add(game);
  }
  return ret;
}

Fixed version (ground truth):
public List<Game> getPendingGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player.getName());
  query.setParameter("String_Node_Str",GameState.WAITING);
  List<Game> games=query.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    boolean member=false;
    for (    GamePlayer p : game.listPlayers()) {
      if (p.getName().equals(player.getName())) {
        member=true;
        break;
      }
    }
    if (!member)     ret.add(game);
  }
  return ret;
}
Program: 25160
Project: 25160
Buggy source:
public List<Game> getUnfinishedGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> games=query.getResultList();
  for (  Game game : games) {
    ret.add(game);
  }
  return ret;
}

Fixed version (ground truth):
public List<Game> getUnfinishedGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player.getName());
  query.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> games=query.getResultList();
  for (  Game game : games) {
    ret.add(game);
  }
  return ret;
}
Program: 25161
Project: 25161
Buggy source:
public GridPlayer(GridRegistrant registrant,Color color){
  this.registrant=registrant;
  this.color=color;
}

Fixed version (ground truth):
public GridPlayer(GridRegistrant registrant,Color color){
  this.color=color;
  this.name=registrant.getName();
}
Program: 25162
Project: 25162
Buggy source:
@Override public int hashCode(){
  return new HashCodeBuilder().append(id).append(color).append(registrant).append(turn).toHashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return new HashCodeBuilder().append(id).append(color).append(name).append(turn).toHashCode();
}
Program: 25163
Project: 25163
Buggy source:
@Override public boolean equals(Object obj){
  boolean ret=false;
  if (obj instanceof GridPlayer) {
    GridPlayer test=(GridPlayer)obj;
    ret=registrant.getName().equals(test.getRegistrant().getName()) && registrant.getId() == test.getId();
  }
  return ret;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  boolean ret=false;
  if (obj instanceof GridPlayer) {
    GridPlayer test=(GridPlayer)obj;
    ret=(id == test.id);
  }
  return ret;
}
Program: 25164
Project: 25164
Buggy source:
@Override public String toString(){
  return registrant.getName() + "String_Node_Str" + color.name()+ "String_Node_Str"+ turn;
}

Fixed version (ground truth):
@Override public String toString(){
  return name + "String_Node_Str" + color.name()+ "String_Node_Str"+ turn;
}
Program: 25165
Project: 25165
Buggy source:
public Move doMove(Game game,Move move) throws InvalidMoveException {
  move=em.merge(move);
  game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.move(move);
  em.flush();
  if (move.getStatus().equals(MoveStatus.INVALID))   throw new InvalidMoveException("String_Node_Str" + move.toString() + "String_Node_Str");
  List<GamePlayer> players=game.listPlayers();
  for (int i=0; i < players.size(); i++) {
    GamePlayer p=players.get(i);
    if (p instanceof Agent) {
      Agent a=(Agent)p;
      if (a.ready()) {
        Set<Move> moves=a.determineMoves(game);
        for (        Move m : moves) {
          game.move(m);
          if (m.getStatus() != MoveStatus.INVALID) {
            em.flush();
            break;
          }
        }
      }
    }
  }
  return move;
}

Fixed version (ground truth):
public Move doMove(Game game,Move move) throws InvalidMoveException {
  move=em.merge(move);
  game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.move(move);
  em.flush();
  if (move.getStatus().equals(MoveStatus.INVALID))   throw new InvalidMoveException("String_Node_Str" + move.toString() + "String_Node_Str");
  List<GamePlayer> players=game.listPlayers();
  for (int i=0; i < players.size(); i++) {
    GamePlayer p=players.get(i);
    if (p instanceof Agent) {
      Agent a=(Agent)p;
      if (a.ready()) {
        List<Move> moves=a.determineMoves(game);
        for (        Move m : moves) {
          game.move(m);
          if (m.getStatus() != MoveStatus.INVALID) {
            em.flush();
            break;
          }
        }
      }
    }
  }
  return move;
}
Program: 25166
Project: 25166
Buggy source:
public Set<Move> determineMoves(Game game);

Fixed version (ground truth):
public List<Move> determineMoves(Game game);
Program: 25167
Project: 25167
Buggy source:
/** 
 * Registers a robot with she specified Game object. TODO:  Make this generic.
 * @throws InvalidRegistrationException
 */
public Game registerPlayer(Game game,Registrant registrant) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.merge(game);
  game.setMessageSender(messageSender);
  registrant=em.merge(registrant);
  registrant.setLastRegistration(System.currentTimeMillis());
  game.registerPlayer(registrant);
  messageSender.sendPlayerChange(game);
  return game;
}

Fixed version (ground truth):
/** 
 * Registers a robot with she specified Game object. TODO:  Make this generic.
 * @throws InvalidRegistrationException
 */
public Game registerPlayer(Game game,Registrant registrant) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  registrant=em.merge(registrant);
  registrant.setLastRegistration(System.currentTimeMillis());
  game.registerPlayer(registrant);
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25168
Project: 25168
Buggy source:
public Game registerAgent(Game game,Agent agent) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.merge(game);
  game.setMessageSender(messageSender);
  game.registerAgent(agent);
  messageSender.sendPlayerChange(game);
  return game;
}

Fixed version (ground truth):
public Game registerAgent(Game game,Agent agent) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.registerAgent(agent);
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25169
Project: 25169
Buggy source:
public Game unregister(Game game,GamePlayer player) throws InvalidRegistrationException {
  player=em.merge(player);
  game=em.find(game.getClass(),game.getId(),LockModeType.PESSIMISTIC_WRITE);
  game.removePlayer(player);
  game.setState(GameState.ENDED);
  messageSender.sendPlayerChange(game);
  return game;
}

Fixed version (ground truth):
public Game unregister(Game game,GamePlayer player) throws InvalidRegistrationException {
  player=em.merge(player);
  game=em.find(game.getClass(),game.getId());
  game.removePlayer(player);
  game.setState(GameState.ENDED);
  em.flush();
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25170
Project: 25170
Buggy source:
public List<Game> getPendingGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.WAITING);
  List<Game> games=query.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    boolean member=false;
    for (    GamePlayer p : game.listPlayers()) {
      if (p.getRegistrant().equals(player)) {
        member=true;
        break;
      }
    }
    if (!member)     ret.add(game);
  }
  return ret;
}

Fixed version (ground truth):
public List<Game> getPendingGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player.getName());
  query.setParameter("String_Node_Str",GameState.WAITING);
  List<Game> games=query.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    boolean member=false;
    for (    GamePlayer p : game.listPlayers()) {
      if (p.getName().equals(player.getName())) {
        member=true;
        break;
      }
    }
    if (!member)     ret.add(game);
  }
  return ret;
}
Program: 25171
Project: 25171
Buggy source:
public List<Game> getUnfinishedGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> games=query.getResultList();
  for (  Game game : games) {
    ret.add(game);
  }
  return ret;
}

Fixed version (ground truth):
public List<Game> getUnfinishedGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player.getName());
  query.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> games=query.getResultList();
  for (  Game game : games) {
    ret.add(game);
  }
  return ret;
}
Program: 25172
Project: 25172
Buggy source:
public GridPlayer(GridRegistrant registrant,Color color){
  this.registrant=registrant;
  this.color=color;
}

Fixed version (ground truth):
public GridPlayer(GridRegistrant registrant,Color color){
  this.color=color;
  this.name=registrant.getName();
}
Program: 25173
Project: 25173
Buggy source:
@Override public int hashCode(){
  return new HashCodeBuilder().append(id).append(color).append(registrant).append(turn).toHashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return new HashCodeBuilder().append(id).append(color).append(name).append(turn).toHashCode();
}
Program: 25174
Project: 25174
Buggy source:
@Override public boolean equals(Object obj){
  boolean ret=false;
  if (obj instanceof GridPlayer) {
    GridPlayer test=(GridPlayer)obj;
    ret=registrant.getName().equals(test.getRegistrant().getName()) && registrant.getId() == test.getId();
  }
  return ret;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  boolean ret=false;
  if (obj instanceof GridPlayer) {
    GridPlayer test=(GridPlayer)obj;
    ret=(id == test.id);
  }
  return ret;
}
Program: 25175
Project: 25175
Buggy source:
@Override public String toString(){
  return registrant.getName() + "String_Node_Str" + color.name()+ "String_Node_Str"+ turn;
}

Fixed version (ground truth):
@Override public String toString(){
  return name + "String_Node_Str" + color.name()+ "String_Node_Str"+ turn;
}
Program: 25176
Project: 25176
Buggy source:
public List<Game> getPendingGames(Registrant player){
  em.clear();
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.WAITING);
  List<Game> games=query.getResultList();
  Query q=em.createNamedQuery("String_Node_Str");
  q.setParameter("String_Node_Str",player);
  q.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> joinedGames=q.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    if (joinedGames.contains(game))     continue;
    ret.add(game);
  }
  return ret;
}

Fixed version (ground truth):
public List<Game> getPendingGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.WAITING);
  List<Game> games=query.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    boolean member=false;
    for (    GamePlayer p : game.listPlayers()) {
      if (p.getRegistrant().equals(player)) {
        member=true;
        break;
      }
    }
    if (!member)     ret.add(game);
  }
  return ret;
}
Program: 25177
Project: 25177
Buggy source:
public List<Game> getUnfinishedGames(Registrant player){
  em.clear();
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> games=query.getResultList();
  for (  Game game : games) {
    ret.add(game);
  }
  return ret;
}

Fixed version (ground truth):
public List<Game> getUnfinishedGames(Registrant player){
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> games=query.getResultList();
  for (  Game game : games) {
    ret.add(game);
  }
  return ret;
}
Program: 25178
Project: 25178
Buggy source:
/** 
 * Registers a robot with she specified Game object. TODO:  Make this generic.
 * @throws InvalidRegistrationException
 */
public Game registerPlayer(Game game,Registrant registrant) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  registrant=em.find(registrant.getClass(),registrant.getId());
  registrant.setLastRegistration(System.currentTimeMillis());
  game.registerPlayer(registrant);
  em.flush();
  messageSender.sendPlayerChange(game);
  return game;
}

Fixed version (ground truth):
/** 
 * Registers a robot with she specified Game object. TODO:  Make this generic.
 * @throws InvalidRegistrationException
 */
public Game registerPlayer(Game game,Registrant registrant) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  registrant=em.find(registrant.getClass(),registrant.getId());
  registrant.setLastRegistration(System.currentTimeMillis());
  game.registerPlayer(registrant);
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25179
Project: 25179
Buggy source:
public Game registerAgent(Game game,Agent agent) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.registerAgent(agent);
  messageSender.sendPlayerChange(game);
  em.flush();
  return game;
}

Fixed version (ground truth):
public Game registerAgent(Game game,Agent agent) throws InvalidRegistrationException {
  if (game.getId() == 0)   em.persist(game);
 else   game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.registerAgent(agent);
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25180
Project: 25180
Buggy source:
public Game unregister(Game game,GamePlayer player) throws InvalidRegistrationException {
  game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.removePlayer(player);
  game.setState(GameState.ENDED);
  messageSender.sendPlayerChange(game);
  em.flush();
  return game;
}

Fixed version (ground truth):
public Game unregister(Game game,GamePlayer player) throws InvalidRegistrationException {
  game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  game.removePlayer(player);
  game.setState(GameState.ENDED);
  messageSender.sendPlayerChange(game);
  return game;
}
Program: 25181
Project: 25181
Buggy source:
public Suggestion makeSuggestion(Game game,Suggestion suggestion) throws InvalidSuggestionException {
  Move move=suggestion.listMove();
  GamePlayer player=suggestion.listSuggestor();
  Cell current=move.getCurrentCell();
  Cell destination=move.getDestinationCell();
  if (suggestion.getId() == 0) {
    suggestion.attachSuggestor(null);
    suggestion.attachMove(null);
    em.persist(suggestion);
  }
  if (move.getId() == 0) {
    move.setPlayerModel(null);
    move.setCurrentCell(null);
    move.setDestinationCell(null);
    em.persist(move);
    move.setPlayerModel(player);
    move.setDestinationCell(destination);
    move.setCurrentCell(current);
  }
  suggestion.attachSuggestor(player);
  suggestion.attachMove(move);
  move=em.merge(move);
  suggestion=em.merge(suggestion);
  game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  suggestion=game.suggest(suggestion);
  if (suggestion.getStatus().equals(SuggestionStatus.INVALID))   throw new InvalidSuggestionException("String_Node_Str");
  return suggestion;
}

Fixed version (ground truth):
public Suggestion makeSuggestion(Game game,Suggestion suggestion) throws InvalidSuggestionException {
  Move move=suggestion.listMove();
  GamePlayer suggestor=suggestion.listSuggestor();
  GamePlayer player=move.getPlayerModel();
  Cell current=move.getCurrentCell();
  Cell destination=move.getDestinationCell();
  if (suggestion.getId() == 0) {
    suggestion.attachSuggestor(null);
    suggestion.attachMove(null);
    em.persist(suggestion);
    if (move.getId() == 0) {
      move.setPlayerModel(null);
      move.setCurrentCell(null);
      move.setDestinationCell(null);
      em.persist(move);
      move.setPlayerModel(player);
      move.setDestinationCell(destination);
      move.setCurrentCell(current);
    }
    suggestion.attachSuggestor(suggestor);
    suggestion.attachMove(move);
  }
  suggestion=em.merge(suggestion);
  move=em.merge(move);
  suggestion.attachMove(move);
  game=em.find(game.getClass(),game.getId());
  game.setMessageSender(messageSender);
  suggestion=game.suggest(suggestion);
  if (suggestion.getStatus().equals(SuggestionStatus.INVALID))   throw new InvalidSuggestionException("String_Node_Str");
  return suggestion;
}
Program: 25183
Project: 25183
Buggy source:
public List<Game> getPendingGames(Registrant player){
  em.clear();
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.WAITING);
  query.setLockMode(LockModeType.PESSIMISTIC_READ);
  List<Game> joinedGames=getUnfinishedGames(player);
  List<Game> games=query.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    if (joinedGames.contains(game))     continue;
    ret.add(game);
  }
  return ret;
}

Fixed version (ground truth):
public List<Game> getPendingGames(Registrant player){
  em.clear();
  List<Game> ret=new ArrayList<Game>();
  Query query=em.createNamedQuery("String_Node_Str");
  query.setParameter("String_Node_Str",player);
  query.setParameter("String_Node_Str",GameState.WAITING);
  List<Game> games=query.getResultList();
  Query q=em.createNamedQuery("String_Node_Str");
  q.setParameter("String_Node_Str",player);
  q.setParameter("String_Node_Str",GameState.ENDED);
  List<Game> joinedGames=q.getResultList();
  for (  Game impl : games) {
    Game game=impl;
    if (joinedGames.contains(game))     continue;
    ret.add(game);
  }
  return ret;
}