Buggy code:
public class PortletProcessorImpl implements PortletProcessor { private static Log log = LogFactoryUtil . getLog ( PortletProcessorImpl . class ) ; BuddyController buddyController ; ConversationController conversationController ; GroupController groupController ; SettingsController settingsController ; ServerController serverController ; PropertiesController propertiesController ; private Random random = new Random ( ) ; private static final String QUERY_CREATE_SINGLE_USER_CONVERSATION = "CreateSingleUserConversation" ; private static final String QUERY_READ_SINGLE_USER_CONVERSATION = "ReadSingleUserConversation" ; private static final String QUERY_CLOSE_SINGLE_USER_CONVERSATION = "CloseSingleUserConversation" ; private static final String QUERY_RESET_UNREAD_MESSAGES_COUNTER = "ResetUnreadMessagesCounter" ; private static final String QUERY_READ_OPENED_CONVERSATIONS = "ReadOpenedConversations" ; private static final String QUERY_GET_GROUP_LIST = "GetGroupList" ; private static final String QUERY_CREATE_MESSAGE = "CreateMessage" ; private static final String QUERY_UPDATE_BUDDY_PRESENCE = "UpdateBuddyPresence" ; private static final String QUERY_UPDATE_ACTIVE_PANEL = "UpdateActivePanel" ; private static final String QUERY_UPDATE_SETTINGS = "UpdateSettings" ; private static final String QUERY_GET_SERVER_TIME = "GetServerTime" ; private static final String QUERY_SEARCH_BUDDIES = "SearchBuddies" ; private static final String QUERY_PATCH_PROPERTIES = "PatchProperties" ; public PortletProcessorImpl ( final BuddyController buddyController , final ConversationController conversationController , final GroupController groupController , final SettingsController settingsController , final ServerController serverController , final PropertiesController propertiesController ) { } public void processRequest ( ResourceRequest request , ResourceResponse response ) { } private void dispatchRequest ( ResourceRequest request , ResourceResponse response , String query ) { } private boolean processErrorMode ( ResourceRequest request , ResourceResponse response ) { <START_BUG> if ( Environment . isErrorModeEnabled ( ) ) { <END_BUG> int number = ( random . nextInt ( 10 ) ) + 1 ; String query = request . getParameter ( KEY_QUERY ) ; if ( ( query . equals ( PortletProcessorImpl . QUERY_CREATE_SINGLE_USER_CONVERSATION ) ) && ( number > 5 ) ) { ResponseUtil . writeResponse ( INTERNAL_SERVER_ERROR , response ) ; return true ; } if ( ( query . equals ( PortletProcessorImpl . QUERY_READ_SINGLE_USER_CONVERSATION ) ) && ( number > 5 ) ) { ResponseUtil . writeResponse ( INTERNAL_SERVER_ERROR , response ) ; return true ; } if ( ( query . equals ( PortletProcessorImpl . QUERY_READ_OPENED_CONVERSATIONS ) ) && ( number > 9 ) ) { ResponseUtil . writeResponse ( INTERNAL_SERVER_ERROR , response ) ; return true ; } if ( ( query . equals ( PortletProcessorImpl . QUERY_GET_GROUP_LIST ) ) && ( number > 8 ) ) { ResponseUtil . writeResponse ( INTERNAL_SERVER_ERROR , response ) ; return true ; } if ( ( query . equals ( PortletProcessorImpl . QUERY_CREATE_MESSAGE ) ) && ( number > 6 ) ) { ResponseUtil . writeResponse ( INTERNAL_SERVER_ERROR , response ) ; return true ; } if ( ( query . equals ( PortletProcessorImpl . QUERY_SEARCH_BUDDIES ) ) && ( number > 5 ) ) { ResponseUtil . writeResponse ( INTERNAL_SERVER_ERROR , response ) ; return true ; } } return false ; } private void logRequest ( ResourceRequest request ) { } }

Fix:
if ( ( ( Environment . isErrorModeEnabled ( ) ) != null ) && ( Environment . isErrorModeEnabled ( ) ) ) {