Program: 63320
Project: 63320
Buggy source:
/** 
 * Bug #476018 This test verifies that EclipseLink prints server detection related log messages at appropriate level - FINE in session log, FINER in other cases
 */
public void testServerDetectionLogging(){
  if (isOnServer()) {
    return;
  }
  closeEntityManagerFactory();
  SessionLog original=AbstractSessionLog.getLog();
  try {
    Map<String,Object> properties=new HashMap<>();
    properties.putAll(JUnitTestCaseHelper.getDatabaseProperties());
    properties.put(PersistenceUnitProperties.LOGGING_LEVEL,original.getLevelString());
    properties.put(PersistenceUnitProperties.LOGGING_LOGGER,LogWrapper.class.getName());
    EntityManagerFactoryImpl emf=(EntityManagerFactoryImpl)Persistence.createEntityManagerFactory(getPersistenceUnitName(),properties);
    SimpleSessionLogWrapper wr=(SimpleSessionLogWrapper)emf.getServerSession().getSessionLog();
    assertEquals("String_Node_Str",wr.getLevel() <= SessionLog.FINE,wr.expected());
    LogWrapper lw=new LogWrapper("String_Node_Str");
    AbstractSessionLog.setLog(lw);
    AbstractSessionLog.getLog().setSession(null);
    lw.setSession(null);
    ServerPlatformUtils.detectServerPlatform(null);
    assertEquals("String_Node_Str",lw.getLevel() <= SessionLog.FINER,lw.expected());
    lw=new LogWrapper("String_Node_Str");
    AbstractSessionLog.setLog(lw);
    Session ss=wr.getSession();
    AbstractSessionLog.getLog().setSession(ss);
    AbstractSessionLog.getLog().getSession().setSessionLog(lw);
    lw.setSession(ss);
    ServerPlatformUtils.detectServerPlatform((ServerSession)ss);
    assertEquals("String_Node_Str",lw.getLevel() <= SessionLog.FINER,lw.expected());
  }
  finally {
    AbstractSessionLog.setLog(original);
    closeEntityManagerFactory();
  }
}

Fixed version (ground truth):
/** 
 * Bug #476018 This test verifies that EclipseLink prints server detection related log messages at appropriate level - FINE in session log, FINER in other cases
 */
public void testServerDetectionLogging(){
  if (isOnServer()) {
    return;
  }
  closeEntityManagerFactory();
  SessionLog original=AbstractSessionLog.getLog();
  try {
    AbstractSessionLog.setLog(new LogWrapper());
    Map<String,Object> properties=new HashMap<>();
    properties.putAll(JUnitTestCaseHelper.getDatabaseProperties());
    properties.put(PersistenceUnitProperties.LOGGING_LEVEL,original.getLevelString());
    properties.put(PersistenceUnitProperties.LOGGING_LOGGER,LogWrapper.class.getName());
    EntityManagerFactoryImpl emf=(EntityManagerFactoryImpl)Persistence.createEntityManagerFactory(getPersistenceUnitName(),properties);
    emf.refreshMetadata(properties);
    SimpleSessionLogWrapper wr=(SimpleSessionLogWrapper)emf.getServerSession().getSessionLog();
    assertEquals("String_Node_Str",wr.getLevel() <= SessionLog.FINE,wr.expected());
    LogWrapper lw=new LogWrapper("String_Node_Str");
    AbstractSessionLog.setLog(lw);
    AbstractSessionLog.getLog().setSession(null);
    lw.setSession(null);
    ServerPlatformUtils.detectServerPlatform(null);
    assertEquals("String_Node_Str",lw.getLevel() <= SessionLog.FINER,lw.expected());
    lw=new LogWrapper("String_Node_Str");
    AbstractSessionLog.setLog(lw);
    Session ss=wr.getSession();
    AbstractSessionLog.getLog().setSession(ss);
    AbstractSessionLog.getLog().getSession().setSessionLog(lw);
    lw.setSession(ss);
    ServerPlatformUtils.detectServerPlatform((ServerSession)ss);
    assertEquals("String_Node_Str",lw.getLevel() <= SessionLog.FINER,lw.expected());
  }
  finally {
    AbstractSessionLog.setLog(original);
    closeEntityManagerFactory();
  }
}