Buggy code:
public class Environment implements MessageListener { public static final int NODE_TYPE_PROCESSINGNODE = 1 ; public static final int NODE_TYPE_DISPATCHER = 2 ; public static final int EVENT_TYPE_QUERIES_CHANGED = 1 ; public static final int EVENT_TYPE_NODES_CHANGED = 2 ; public static final int EVENT_TYPE_BUFFERING_START = 3 ; public static final int EVENT_TYPE_EVENTSUBSCIBER_CHANGED = 4 ; public static final int EVENT_TYPE_NODE_START = 5 ; public static final int EVENT_TYPE_NODE_STOP = 6 ; public static final int EVENT_TYPE_ENGINE_PASS = 7 ; public static final int EVENT_TYPE_BUFFERING_STOP = 8 ; private final String ENABLE_DYNAMIC = "ENABLE_DYNAMIC" ; private final String NEW_DISTRIBUTION = "NEW_DISTRIBUTION" ; private final String NODE_READY_MAP = "NODE_READY_MAP" ; private final String UTILIZATION_MAP = "UTILIZATION_MAP" ; private final String NODE_QUERY_MAP = "NODE_QUERY_MAP" ; private final String ORIGINAL_TO_DEPLOYED_MAP = "ORIGINAL_TO_DEPLOYED_MAP" ; private final String SUBSCRIBER_MAP = "SUBSCRIBER_MAP" ; private final String NODE_LIST = "NODE_LIST" ; private final String PERSISTENCE_MAP = "persistenceMap" ; private final String REVISION_MAP = "revisionMap" ; private List < String > bufferingEventList = null ; private EnvironmentChangedCallback changedCallback = null ; private static HazelcastInstance hzInstance = null ; private static Environment instance = null ; private ITopic < Object > topic ; private Environment ( ) { } public void setReady ( ) { } public boolean checkReadyAllNodes ( ) { } public void setNodeType ( int nodeType ) { } public int getNodeType ( ) { } public void setChangedCallback ( EnvironmentChangedCallback callback ) { } public EnvironmentChangedCallback getChangedCallback ( ) { } public void setNodeUtilization ( String nodeIp , Double value ) { } public void addQueryDistribution ( QueryDistribution queryDistribution ) { } public static Environment getInstance ( ) { } public List < String > getNodeIdList ( int nodeType ) { } public Map < Query , List < Query > > getOriginalToDeployedQueriesMapping ( ) { } public Map < String , Map < String , byte [ ] > > getPersistenceMapping ( ) { } public Map < String , List < String > > getRevisionMapping ( ) { } public void stop ( ) { } public String getNodeId ( ) { } public Map < String , List < Query > > getNodeQueryMap ( ) { } public Map < String , Utilization > getNodeUtilizations ( ) { } public void setNodeUtilizations ( Utilization utilization ) { } public List < String > getBufferingEventList ( ) { } public Map < String , List < String > > getSubscriberMapping ( ) { } public Map < String , List < String > > getEventNodeMapping ( ) { } @ Override public void onMessage ( Message event ) { } public void sendEvent ( int eventType ) { } public void createNewTransferable ( Map < String , List < Query > > transferableEngines ) { } public Boolean checkDynamic ( ) { <START_BUG> String temp = ( ( String ) ( Environment . hzInstance . getMap ( "DD" ) . get ( "dd" ) ) ) ; <END_BUG> if ( ( temp != null ) && ( temp . equals ( getNodeId ( ) ) ) ) return true ; else return false ; } public void enableDynamic ( ) { } public void disableDynamic ( ) { } public Boolean checkTransferInprogress ( ) { } public void clearNewAddedQueries ( ) { } public List < Query > getAdditionalQueries ( ) { } }

Fix:
String temp = ( ( String ) ( Environment . hzInstance . getMap ( ENABLE_DYNAMIC ) . get ( ENABLE_DYNAMIC ) ) ) ;