Buggy code:
public class ManagedAuditLoggerImpl implements ManagedAuditLogger , ManagedAuditLogger . AuditLogHandlerUpdater { private static final short MAX_FAILURE_COUNT = 10 ; private final ManagedAuditLoggerImpl . ManagedAuditLogConfiguration config ; private ManagedAuditLoggerImpl . HandlerUpdateTask handlerUpdateTask ; private final List < AuditLogItem > queuedItems = new ArrayList < AuditLogItem > ( ) ; private short failureCount ; public ManagedAuditLoggerImpl ( String asVersion , boolean server ) { } private ManagedAuditLoggerImpl ( ManagedAuditLoggerImpl src , boolean manualCommit ) { } @ Override public void log ( boolean readOnly , boolean booting , ResultAction resultAction , String userId , String domainUUID , AccessMechanism accessMechanism , InetAddress remoteAddress , Resource resultantModel , List < ModelNode > operations ) { } @ Override public void logMethodAccess ( boolean readOnly , boolean booting , String userId , String domainUUID , AccessMechanism accessMechanism , InetAddress remoteAddress , String methodName , String [ ] methodSignature , Object [ ] methodParams , Throwable error ) { } public ManagedAuditLoggerImpl createNewConfiguration ( boolean manualCommit ) { } public boolean isLogReadOnly ( ) { } public void setLogReadOnly ( boolean logReadOnly ) { } public boolean isLogBoot ( ) { } public void setLogBoot ( boolean logBoot ) { } public Status getLoggerStatus ( ) { } @ Override public void recycleHandler ( String name ) { } @ Override public void setLoggerStatus ( final Status newStatus ) { } private void storeLogItem ( AuditLogItem item ) throws IOException { } private void writeLogItem ( AuditLogItem item ) throws IOException { } private void handleLoggingException ( final Exception e ) { } public AuditLogHandlerUpdater getUpdater ( ) { } @ Override public void addHandler ( AuditLogHandler handler ) { } @ Override public void updateHandler ( AuditLogHandler handler ) { config . lock ( ) ; try { AuditLogHandler existing = config . getConfiguredHandler ( handler . getName ( ) ) ; <START_BUG> if ( ! ( handler . compare ( existing ) ) ) { <END_BUG> if ( ( handlerUpdateTask ) == null ) { handlerUpdateTask = new ManagedAuditLoggerImpl . HandlerUpdateTask ( ) ; } handlerUpdateTask . replaceHandler ( handler ) ; } } finally { config . unlock ( ) ; } } @ Override public void removeHandler ( String name ) { } @ Override public void addHandlerReference ( PathAddress referenceAddress ) { } @ Override public void removeHandlerReference ( PathAddress referenceAddress ) { } @ Override public void rollbackChanges ( ) { } @ Override public void applyChanges ( ) { } @ Override public void removeFormatter ( String name ) { } @ Override public void addFormatter ( AuditLogItemFormatter formatter ) { } @ Override public void updateHandlerFormatter ( String name , String formatterName ) { } @ Override public void updateHandlerMaxFailureCount ( String name , int count ) { } @ Override public int getHandlerFailureCount ( String name ) { } @ Override public boolean getHandlerDisabledDueToFailure ( String name ) { } @ Override public JsonAuditLogItemFormatter getJsonFormatter ( String name ) { } abstract static class ManagedAuditLogConfiguration { final boolean manualCommit ; final boolean core ; final ManagedAuditLoggerImpl . SharedConfiguration sharedConfiguration ; private volatile Status status = Status . QUEUEING ; private volatile boolean logBoot = true ; private volatile boolean logReadOnly ; protected final Set < String > handlerReferences = Collections . synchronizedSet ( new HashSet < String > ( ) ) ; ManagedAuditLogConfiguration ( ManagedAuditLoggerImpl . SharedConfiguration sharedConfiguration , boolean core , boolean manualCommit ) { } boolean isManualCommit ( ) { } boolean hasHandlerReference ( String name ) { } void addHandlerReference ( String name ) { } void removeHandlerReference ( String name ) { } List < AuditLogHandler > getHandlersForLogging ( ) { } void lock ( ) { } void unlock ( ) { } String getAsVersion ( ) { } boolean isServer ( ) { } AuditLogItemFormatter getFormatter ( String name ) { } AuditLogHandler getConfiguredHandler ( String name ) { } boolean isLogReadOnly ( ) { } void setLogReadOnly ( boolean logReadOnly ) { } boolean isLogBoot ( ) { } void setLogBoot ( boolean logBoot ) { } Status getLoggerStatus ( ) { } void setLoggerStatus ( final Status newStatus ) { } boolean isCore ( ) { } abstract void putConfiguredHandler ( AuditLogHandler handler ) { } abstract AuditLogHandler removeConfiguredHandler ( String name ) { } abstract void addFormatter ( AuditLogItemFormatter formatter ) { } abstract void removeFormatter ( String name ) { } abstract void recycleHandler ( String name ) { } } private static class CoreAuditLogConfiguration extends ManagedAuditLoggerImpl . ManagedAuditLogConfiguration { CoreAuditLogConfiguration ( String asVersion , boolean server ) { } @ Override void putConfiguredHandler ( AuditLogHandler handler ) { } @ Override AuditLogHandler removeConfiguredHandler ( String name ) { } void addFormatter ( AuditLogItemFormatter formatter ) { } void removeFormatter ( String name ) { } void recycleHandler ( String name ) { } } private static class NewAuditLogConfiguration extends ManagedAuditLoggerImpl . ManagedAuditLogConfiguration { NewAuditLogConfiguration ( ManagedAuditLoggerImpl . CoreAuditLogConfiguration core , boolean manualCommit ) { } @ Override void putConfiguredHandler ( AuditLogHandler handler ) { } @ Override AuditLogHandler removeConfiguredHandler ( String name ) { } @ Override void addFormatter ( AuditLogItemFormatter formatter ) { } @ Override void removeFormatter ( String name ) { } @ Override void recycleHandler ( String name ) { } } private static class SharedConfiguration { private final Lock auditLock = new ReentrantLock ( true ) ; private final String asVersion ; private final boolean server ; private final Map < String , AuditLogItemFormatter > formatters = new HashMap < String , AuditLogItemFormatter > ( ) ; private final Map < String , AuditLogHandler > configuredHandlers = new HashMap < String , AuditLogHandler > ( ) ; SharedConfiguration ( String asVersion , boolean server ) { } public void recycleHandler ( String name ) { } void lock ( ) { } void unlock ( ) { } String getAsVersion ( ) { } boolean isServer ( ) { } Map < String , AuditLogHandler > getConfiguredHandlers ( ) { }

Fix:
if ( ! ( handler . isDifferent ( existing ) ) ) {