Buggy code:
@ Local ( { ClusterManager . class } ) public class ClusterManagerImpl extends ManagerBase implements ClusterManager , Configurable { private static final Logger s_logger = Logger . getLogger ( ClusterManagerImpl . class ) ; private static final int EXECUTOR_SHUTDOWN_TIMEOUT = 1000 ; private static final int DEFAULT_OUTGOING_WORKERS = 5 ; private final List < ClusterManagerListener > _listeners = new ArrayList < ClusterManagerListener > ( ) ; private final Map < Long , ManagementServerHostVO > _activePeers = new HashMap < Long , ManagementServerHostVO > ( ) ; private final Map < String , ClusterService > _clusterPeers ; @ Inject protected ConfigDepot _configDepot ; private final ScheduledExecutorService _heartbeatScheduler = Executors . newScheduledThreadPool ( 1 , new NamedThreadFactory ( "Cluster-Heartbeat" ) ) ; private final ExecutorService _notificationExecutor = Executors . newFixedThreadPool ( 1 , new NamedThreadFactory ( "Cluster-Notification" ) ) ; private final List < ClusterManagerMessage > _notificationMsgs = new ArrayList < ClusterManagerMessage > ( ) ; private ConnectionConcierge _heartbeatConnection = null ; private final ExecutorService _executor ; private ClusterServiceAdapter _currentServiceAdapter ; @ Inject private List < ClusterServiceAdapter > _serviceAdapters ; @ Inject private ManagementServerHostDao _mshostDao ; @ Inject private ManagementServerHostPeerDao _mshostPeerDao ; protected Dispatcher _dispatcher ; private Long _mshostId = null ; protected long _msId = ManagementServerNode . getManagementServerId ( ) ; protected long _runId = System . currentTimeMillis ( ) ; private boolean _peerScanInited = false ; private String _clusterNodeIP = "127.0.0.1" ; private final List < ClusterServicePdu > _clusterPduOutgoingQueue = new ArrayList < ClusterServicePdu > ( ) ; private final List < ClusterServicePdu > _clusterPduIncomingQueue = new ArrayList < ClusterServicePdu > ( ) ; private final Map < Long , ClusterServiceRequestPdu > _outgoingPdusWaitingForAck = new HashMap < Long , ClusterServiceRequestPdu > ( ) ; public ClusterManagerImpl ( ) { } private void registerRequestPdu ( ClusterServiceRequestPdu pdu ) { } @ Override public void registerDispatcher ( Dispatcher dispatcher ) { } private ClusterServiceRequestPdu popRequestPdu ( long ackSequenceId ) { } private void cancelClusterRequestToPeer ( String strPeer ) { } private void addOutgoingClusterPdu ( ClusterServicePdu pdu ) { } private ClusterServicePdu popOutgoingClusterPdu ( long timeoutMs ) { } private void addIncomingClusterPdu ( ClusterServicePdu pdu ) { } private ClusterServicePdu popIncomingClusterPdu ( long timeoutMs ) { } private Runnable getClusterPduSendingTask ( ) { } private Runnable getClusterPduNotificationTask ( ) { } private void onSendingClusterPdu ( ) { } private void onNotifyingClusterPdu ( ) { } @ Override public void OnReceiveClusterServicePdu ( ClusterServicePdu pdu ) { } public static final boolean arePeersRunning ( String notVersion ) { } @ Override public void broadcast ( long agentId , String cmds ) { } public void executeAsync ( String strPeer , long agentId , String cmds , boolean stopOnError ) { } @ Override public String execute ( String strPeer , long agentId , String cmds , boolean stopOnError ) { } @ Override public ManagementServerHostVO getPeer ( String mgmtServerId ) { <START_BUG> return _mshostDao . findByMsid ( Long . valueOf ( mgmtServerId ) ) ; <END_BUG> } @ Override public String getSelfPeerName ( ) { } public String getSelfNodeIP ( ) { } @ Override public void registerListener ( ClusterManagerListener listener ) { } @ Override public void unregisterListener ( ClusterManagerListener listener ) { } public void notifyNodeJoined ( List < ManagementServerHostVO > nodeList ) { } public void notifyNodeLeft ( List < ManagementServerHostVO > nodeList ) { } public void notifyNodeIsolated ( ) { } public ClusterService getPeerService ( String strPeer ) throws RemoteException { } public void invalidatePeerService ( String strPeer ) { } private Runnable getHeartbeatTask ( ) { } private boolean isRootCauseConnectionRelated ( Throwable e ) { } private Connection getHeartbeatConnection ( ) throws SQLException { } private void invalidHeartbeatConnection ( ) { } private Runnable getNotificationTask ( ) { } private void queueNotification ( ClusterManagerMessage msg ) { } private ClusterManagerMessage getNextNotificationMessage ( ) { } private void initPeerScan ( ) { } private void peerScan ( ) throws ActiveFencingException { } private static ManagementServerHostVO getInListById ( Long id , List < ManagementServerHostVO > l ) { } @ Override @ DB public boolean start ( ) { } @ Override @ DB public boolean stop ( ) { } @ Override public boolean configure ( String name , Map < String , Object > params ) throws ConfigurationException { } @ Override public long getManagementNodeId ( ) { } @ Override public long getCurrentRunId ( ) { } @ Override public long getManagementRunId ( long msId ) { } public boolean isManagementNodeAlive ( long msid ) { } public boolean pingManagementNode ( long msid ) { } @ Override public String getConfigComponentName ( ) { } @ Override public ConfigKey < ? > [ ] getConfigKeys ( ) { } private boolean pingManagementNode ( ManagementServerHostVO mshost ) { } public int getHeartbeatInterval ( ) { } private void checkConflicts ( ) throws ConfigurationException { } }

Fix:
return _mshostDao . findByMsid ( Long . parseLong ( mgmtServerId ) ) ;