question: private void handleHtmlSearchSources ( PageWrapper pageWrapper , RequestAndResponse requestAndResponse , String query , String paneId ) throws IOException , ServletException { pageWrapper . addPageIntroText ( servletText . introTextSearchSources ( false ) , servletText . introTextSearchSources ( true ) ) ; try { final StringBuilder result = new StringBuilder ( ) ; User queryUser = null ; if ( null != ( queryUser = canUserSeeUsersData ( requestAndResponse , true ) ) ) { final ArrayList < EntryInfo > entryInfoList = new ArrayList < EntryInfo > ( ) ; if ( query . startsWith ( "http://" ) || query . startsWith ( "https://" ) ) { final Entry entry = dbLogic . getEntryByUserIdAndUrl ( queryUser . getId ( ) , query ) ; if ( entry == null ) { servletText . sentenceThereWereNoMatches ( ) ; } else { startItemList ( result , paneId ) ; addSourceHtml ( entry , result , SourceEmbedContext . InSources , null , 1 , paneId ) ; addEntryToInfoList ( entry , entryInfoList ) ; finishItemList ( result ) ; } } else { final ResultsPaginator paginator = new ResultsPaginator ( requestAndResponse , servletText . sentenceThereWereNoMatches ( ) , result , servletText ) ; try { final List < ? > results = dbLogic . searchEntriesForUserBySourceTitle ( queryUser . getId ( ) , query , paginator . getStartPosition ( ) , paginator . getMaxResults ( ) ) ; startItemList ( result , paneId ) ; for ( final Object entryUncasted : results ) { final Entry entry = ( Entry ) entryUncasted ; final int resultNumber = paginator . next ( ) ; if ( resultNumber == - 1 ) { continue ; } else if ( resultNumber == 0 ) { break ; } addSourceHtml ( entry , result , SourceEmbedContext . InSources , null , resultNumber , paneId ) ; addEntryToInfoList ( entry , entryInfoList ) ; } finishItemList ( result ) ; paginator . done ( ) ; } catch ( EmptyQueryException e ) { requestAndResponse . print ( servletText . errorNeedLongerQuery ( ) ) ; } } result . append ( "\n<script type=\"application/json\" class=\"entryInfoDictJson\">\n" ) ; addJsonForEntryInfos ( result , entryInfoList , paneId ) ; result . append ( "\n</script>\n" ) ; } dbLogic . commit ( ) ; requestAndResponse . print ( result . toString ( ) ) ; } catch ( final PersistenceException e ) { requestAndResponse . print ( servletText . errorInternalDatabase ( ) ) ; } }
target:  Helper method. Handle searching sources. 