Buggy code:
public class GetUsers extends HttpServlet { private static final long serialVersionUID = 1L ; private static final Logger logger = Logger . getLogger ( GetUsers . class . getName ( ) ) ; List < Key < Developer > > developers ; List < Key < Customer > > customers ; JsonObjectBuilder objBuilder ; JsonArrayBuilder arrBuilder ; public GetUsers ( ) { } protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { response . setContentType ( "application//json" ) ; String username = null ; String usertype = null ; String useremail = null ; HttpSession session = request . getSession ( ) ; try { username = ( ( session . getAttribute ( "username" ) ) == null ) ? "" : ( ( String ) ( session . getAttribute ( "username" ) ) ) ; usertype = ( ( session . getAttribute ( "usertype" ) ) == null ) ? "" : ( ( String ) ( session . getAttribute ( "usertype" ) ) ) ; useremail = ( ( session . getAttribute ( "useremail" ) ) == null ) ? "" : ( ( String ) ( session . getAttribute ( "useremail" ) ) ) ; } catch ( Exception e ) { GetUsers . logger . warning ( "Exception<seq2seq4repair_space>on<seq2seq4repair_space>page<seq2seq4repair_space>settings.jsp<seq2seq4repair_space>while<seq2seq4repair_space>retrieving<seq2seq4repair_space>session<seq2seq4repair_space>variables" ) ; e . printStackTrace ( ) ; } PrintWriter pout = response . getWriter ( ) ; try { if ( ( ( "" . equals ( username ) ) || ( "" . equals ( usertype ) ) ) || ( "" . equals ( useremail ) ) ) { response . sendError ( SC_NOT_FOUND ) ; } else { String query = ( ( request . getParameter ( "query" ) ) == null ) ? "" : request . getParameter ( "query" ) . toLowerCase ( ) ; String action = ( ( request . getParameter ( "action" ) ) == null ) ? "" : request . getParameter ( "action" ) . toLowerCase ( ) ; GetUsers . logger . info ( ( ( ( "Query::<seq2seq4repair_space>" + query ) + "<seq2seq4repair_space>action::<seq2seq4repair_space>" ) + action ) ) ; Developer developer = ofy ( ) . load ( ) . key ( Key . create ( Developer . class , useremail ) ) . now ( ) ; Project project = ofy ( ) . load ( ) . key ( developer . getProject ( ) ) . now ( ) ; if ( "getpeople" . equals ( action ) ) { List < String > allDevelopers = project . getAllDevelopers ( ) ; List < String > allCustomers = project . getAllCustomers ( ) ; for ( String devKey : allDevelopers ) { developer = ( ( Developer ) ( ofy ( ) . load ( ) . key ( Key . create ( devKey ) ) . now ( ) ) ) ; arrBuilder = arrBuilder . add ( objBuilder . add ( "usertype" , "Developer" ) . add ( "name" , developer . getName ( ) ) . add ( "email" , developer . getEmail ( ) ) . build ( ) ) ; } for ( String custKey : allCustomers ) { Customer customer = ( ( Customer ) ( ofy ( ) . load ( ) . key ( Key . create ( custKey ) ) . now ( ) ) ) ; arrBuilder = arrBuilder . add ( objBuilder . add ( "usertype" , "Customer" ) . add ( "name" , customer . getName ( ) ) . add ( "email" , customer . getEmail ( ) ) . build ( ) ) ; } <START_BUG> pout . println ( arrBuilder . toString ( ) ) ; <END_BUG> pout . flush ( ) ; } else { if ( ! ( "" . equals ( query ) ) ) { for ( Key < Developer > devKey : developers ) { if ( ! ( project . getAllDevelopers ( ) . contains ( devKey . getString ( ) ) ) ) { developer = ofy ( ) . load ( ) . key ( devKey ) . now ( ) ; if ( ( developer . getName ( ) . toLowerCase ( ) . contains ( query ) ) || ( developer . getEmail ( ) . toLowerCase ( ) . contains ( query ) ) ) { arrBuilder = arrBuilder . add ( objBuilder . add ( "usertype" , "Developer" ) . add ( "name" , developer . getName ( ) ) . add ( "email" , developer . getEmail ( ) ) . build ( ) ) ; } } } for ( Key < Customer > custKey : customers ) { if ( ! ( project . getAllCustomers ( ) . contains ( custKey . getString ( ) ) ) ) { Customer customer = ofy ( ) . load ( ) . key ( custKey ) . now ( ) ; if ( ( customer . getName ( ) . toLowerCase ( ) . contains ( query ) ) || ( customer . getEmail ( ) . toLowerCase ( ) . contains ( query ) ) ) { arrBuilder = arrBuilder . add ( objBuilder . add ( "usertype" , "Customer" ) . add ( "name" , customer . getName ( ) ) . add ( "email" , customer . getEmail ( ) ) . build ( ) ) ; } } } pout . println ( objBuilder . add ( "results" , arrBuilder ) . build ( ) . toString ( ) ) ; pout . flush ( ) ; } } } } catch ( Exception e ) { GetUsers . logger . warning ( "Exception<seq2seq4repair_space>in<seq2seq4repair_space>Servlet<seq2seq4repair_space>GetUsers.<seq2seq4repair_space>doGet()<seq2seq4repair_space>method" ) ; e . printStackTrace ( ) ; } finally { try { if ( null != pout ) { pout . close ( ) ; pout = null ; } }

Fix:
pout . println ( arrBuilder . build ( ) . toString ( ) ) ;