Program: 63258
Project: 63258
Buggy source:
/** 
 * Tests a StoredProcedureQuery that does an update though EM API
 */
public void testQueryExecuteUpdate(){
  if (supportsStoredProcedures() && getPlatform().isMySQL()) {
    EntityManager em=createEntityManager();
    try {
      String postalCodeTypo="String_Node_Str";
      String postalCodeCorrection="String_Node_Str";
      StoredProcedureQuery query=em.createStoredProcedureQuery("String_Node_Str");
      query.registerStoredProcedureParameter("String_Node_Str",String.class,ParameterMode.IN);
      query.registerStoredProcedureParameter("String_Node_Str",String.class,ParameterMode.IN);
      try {
        query.setParameter("String_Node_Str",postalCodeCorrection).setParameter("String_Node_Str",postalCodeTypo).executeUpdate();
        fail("String_Node_Str");
      }
 catch (      TransactionRequiredException e) {
      }
      beginTransaction(em);
      Address address1=new Address();
      address1.setCity("String_Node_Str");
      address1.setPostalCode(postalCodeTypo);
      address1.setProvince("String_Node_Str");
      address1.setStreet("String_Node_Str");
      address1.setCountry("String_Node_Str");
      em.persist(address1);
      Address address2=new Address();
      address2.setCity("String_Node_Str");
      address2.setPostalCode(postalCodeTypo);
      address2.setProvince("String_Node_Str");
      address2.setStreet("String_Node_Str");
      address2.setCountry("String_Node_Str");
      em.persist(address2);
      em.flush();
      em.clear();
      clearCache();
      int results=query.setParameter("String_Node_Str",postalCodeCorrection).setParameter("String_Node_Str",postalCodeTypo).executeUpdate();
      assertTrue("String_Node_Str",results == 2);
      Address a1=em.find(Address.class,address1.getId());
      assertTrue("String_Node_Str",a1.getPostalCode().equals(postalCodeCorrection));
      Address a2=em.find(Address.class,address2.getId());
      assertTrue("String_Node_Str",a2.getPostalCode().equals(postalCodeCorrection));
    }
  finally {
      closeEntityManagerAndTransaction(em);
    }
  }
}

Fixed version (ground truth):
/** 
 * Tests a StoredProcedureQuery that does an update though EM API
 */
public void testQueryExecuteUpdate(){
  if (supportsStoredProcedures() && getPlatform().isMySQL()) {
    EntityManager em=createEntityManager();
    try {
      String postalCodeTypo="String_Node_Str";
      String postalCodeCorrection="String_Node_Str";
      StoredProcedureQuery query=em.createStoredProcedureQuery("String_Node_Str");
      query.registerStoredProcedureParameter("String_Node_Str",String.class,ParameterMode.IN);
      query.registerStoredProcedureParameter("String_Node_Str",String.class,ParameterMode.IN);
      try {
        query.setParameter("String_Node_Str",postalCodeCorrection).setParameter("String_Node_Str",postalCodeTypo).executeUpdate();
        fail("String_Node_Str");
      }
 catch (      TransactionRequiredException e) {
      }
      beginTransaction(em);
      Address address1=new Address();
      address1.setCity("String_Node_Str");
      address1.setPostalCode(postalCodeTypo);
      address1.setProvince("String_Node_Str");
      address1.setStreet("String_Node_Str");
      address1.setCountry("String_Node_Str");
      em.persist(address1);
      Address address2=new Address();
      address2.setCity("String_Node_Str");
      address2.setPostalCode(postalCodeTypo);
      address2.setProvince("String_Node_Str");
      address2.setStreet("String_Node_Str");
      address2.setCountry("String_Node_Str");
      em.persist(address2);
      em.flush();
      em.clear();
      clearCache();
      query=em.createStoredProcedureQuery("String_Node_Str");
      query.registerStoredProcedureParameter("String_Node_Str",String.class,ParameterMode.IN);
      query.registerStoredProcedureParameter("String_Node_Str",String.class,ParameterMode.IN);
      int results=query.setParameter("String_Node_Str",postalCodeCorrection).setParameter("String_Node_Str",postalCodeTypo).executeUpdate();
      assertTrue("String_Node_Str",results == 2);
      Address a1=em.find(Address.class,address1.getId());
      assertTrue("String_Node_Str",a1.getPostalCode().equals(postalCodeCorrection));
      Address a2=em.find(Address.class,address2.getId());
      assertTrue("String_Node_Str",a2.getPostalCode().equals(postalCodeCorrection));
    }
  finally {
      closeEntityManagerAndTransaction(em);
    }
  }
}