Buggy code:
@ Path ( "//{projectId}" ) @ GET @ Produces ( "application//json" ) public Response getUsersForProject ( @ Context HttpServletRequest request , @ PathParam ( "projectId" ) int projectId ) { } @ POST @ Consumes ( "application//json" ) public Response updateUser ( @ Context HttpServletRequest request , @ FormParam ( "users" ) String users ) { Response response = null ; System . out . println ( ( "User<seq2seq4repair_space>List:" + users ) ) ; try { Class . forName ( "org.postgresql.Driver" ) ; } catch ( ClassNotFoundException e ) { UserList . log . log ( Level . SEVERE , "Error:<seq2seq4repair_space>Can't<seq2seq4repair_space>find<seq2seq4repair_space>PostgreSQL<seq2seq4repair_space>JDBC<seq2seq4repair_space>Driver" , e ) ; response = Response . serverError ( ) . build ( ) ; return response ; } Connection connectionSD = SDDataSource . getConnection ( "surveyKPI-UserList" ) ; aUpdate . isAuthorised ( connectionSD , request . getRemoteUser ( ) ) ; Type type = new TypeToken < ArrayList < User > > ( ) { } . getType ( ) ; ArrayList < User > uArray = new Gson ( ) . fromJson ( users , type ) ; PreparedStatement pstmt = null ; try { String sql = null ; int o_id ; String adminName = null ; ResultSet resultSet = null ; boolean isOrgUser = isOrgUser ( connectionSD , request . getRemoteUser ( ) ) ; connectionSD . setAutoCommit ( false ) ; sql = "SELECT<seq2seq4repair_space>u.o_id,<seq2seq4repair_space>u.name<seq2seq4repair_space>" + ( "<seq2seq4repair_space>FROM<seq2seq4repair_space>users<seq2seq4repair_space>u<seq2seq4repair_space>" + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>u.ident<seq2seq4repair_space>=<seq2seq4repair_space>?;" ) ; pstmt = connectionSD . prepareStatement ( sql ) ; pstmt . setString ( 1 , request . getRemoteUser ( ) ) ; UserList . log . info ( ( ( ( "SQL:<seq2seq4repair_space>" + sql ) + ":" ) + ( request . getRemoteUser ( ) ) ) ) ; resultSet = pstmt . executeQuery ( ) ; if ( resultSet . next ( ) ) { o_id = resultSet . getInt ( 1 ) ; adminName = resultSet . getString ( 2 ) ; for ( int i = 0 ; i < ( uArray . size ( ) ) ; i ++ ) { User u = uArray . get ( i ) ; if ( ( ( u . email ) != null ) && ( u . email . trim ( ) . isEmpty ( ) ) ) { u . email = null ; } if ( ( u . id ) == ( - 1 ) ) { sql = "insert<seq2seq4repair_space>into<seq2seq4repair_space>users<seq2seq4repair_space>(ident,<seq2seq4repair_space>realm,<seq2seq4repair_space>name,<seq2seq4repair_space>email,<seq2seq4repair_space>o_id,<seq2seq4repair_space>password)<seq2seq4repair_space>" + "<seq2seq4repair_space>values<seq2seq4repair_space>(?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>md5(?));" ; String pwdString = ( ( u . ident ) + ":smap:" ) + ( u . password ) ; pstmt = connectionSD . prepareStatement ( sql , Statement . RETURN_GENERATED_KEYS ) ; pstmt . setString ( 1 , u . ident ) ; pstmt . setString ( 2 , "smap" ) ; pstmt . setString ( 3 , u . name ) ; pstmt . setString ( 4 , u . email ) ; pstmt . setInt ( 5 , o_id ) ; pstmt . setString ( 6 , pwdString ) ; UserList . log . info ( ( ( ( ( ( ( ( ( ( ( ( "SQL:<seq2seq4repair_space>" + sql ) + ":" ) + ( u . ident ) ) + ":" ) + "smap" ) + ":" ) + ( u . name ) ) + ":" ) + ( u . email ) ) + ":" ) + o_id ) ) ; pstmt . executeUpdate ( ) ; int u_id = - 1 ; ResultSet rs = pstmt . getGeneratedKeys ( ) ; if ( rs . next ( ) ) { u_id = rs . getInt ( 1 ) ; insertUserGroupsProjects ( connectionSD , u , u_id , isOrgUser ) ; } if ( u . sendEmail ) { System . out . println ( ( "Check<seq2seq4repair_space>if<seq2seq4repair_space>email<seq2seq4repair_space>enabled:<seq2seq4repair_space>" + ( u . sendEmail ) ) ) ; String smtp_host = null ; <START_BUG> if ( ( smtp_host = UtilityMethods . getSmtpHost ( connectionSD , request . getRemoteUser ( ) ) ) != null ) { <END_BUG>

Fix:
if ( ( smtp_host = UtilityMethods . getSmtpHost ( connectionSD , null , request . getRemoteUser ( ) ) ) != null ) {