Buggy code:
public class Adis extends BaseApi implements OpacApi { protected static HashMap < String , MediaType > types = new HashMap < > ( ) ; protected static HashSet < String > ignoredFieldNames = new HashSet < > ( ) ; protected String opac_url = "" ; protected JSONObject data ; protected Library library ; protected int s_requestCount = 0 ; protected String s_service ; protected String s_sid ; protected String s_exts ; protected String s_alink ; protected List < NameValuePair > s_pageform ; protected int s_lastpage ; protected Document s_reusedoc ; public static Map < String , List < String > > getQueryParams ( String url ) { } public Document htmlGet ( String url ) throws IOException { } public Document htmlPost ( String url , List < NameValuePair > data ) throws IOException { } @ Override public void start ( ) throws IOException { } @ Override protected String getDefaultEncoding ( ) { } @ Override public SearchRequestResult search ( List < SearchQuery > queries ) throws OpacErrorException , IOException { } private SearchRequestResult parse_search ( Document doc , int page ) throws OpacErrorException { } @ Override public void init ( Library library ) { } @ Override public SearchRequestResult filterResults ( Filter filter , Option option ) throws IOException { } @ Override public SearchRequestResult searchGetPage ( int page ) throws OpacErrorException , IOException { } @ Override public DetailledItem getResultById ( String id , String homebranch ) throws OpacErrorException , IOException { } @ Override public DetailledItem getResult ( int position ) throws OpacErrorException , IOException { } @ Override public ReservationResult reservation ( DetailledItem item , Account account , int useraction , String selection ) throws IOException { } @ Override public ProlongResult prolong ( String media , Account account , int useraction , String selection ) throws IOException { } @ Override public ProlongAllResult prolongAll ( Account account , int useraction , String selection ) throws IOException { } @ Override public CancelResult cancel ( String media , Account account , int useraction , String selection ) throws OpacErrorException , IOException { } @ Override public AccountData account ( Account account ) throws OpacErrorException , IOException , JSONException { } protected Document handleLoginForm ( Document doc , Account account ) throws OpacErrorException , IOException { } @ Override public List < SearchField > getSearchFields ( ) throws IOException , JSONException { if ( ! ( initialised ) ) { start ( ) ; } Document doc = htmlGet ( ( ( ( ( ( ( ( opac_url ) + ";jsessionid=" ) + ( s_sid ) ) + "?service=" ) + ( s_service ) ) + "&sp=" ) + ( s_exts ) ) ) ; List < SearchField > fields = new ArrayList < > ( ) ; Elements searchoptions = doc . select ( "#SUCH01_1<seq2seq4repair_space>option" ) ; <START_BUG> if ( ( searchoptions . size ( ) ) == 0 ) { <END_BUG> searchoptions = doc . select ( "input[fld=FELD01_1]" ) . first ( ) . previousElementSibling ( ) . select ( "option" ) ; } for ( Element opt : searchoptions ) { TextSearchField field = new TextSearchField ( ) ; field . setId ( opt . attr ( "value" ) ) ; field . setDisplayName ( opt . text ( ) ) ; field . setHint ( "" ) ; fields . add ( field ) ; } JSONObject selectableData = new JSONObject ( ) ; selectableData . put ( "selectable" , false ) ; for ( Element row : doc . select ( "div[id~=F\\d+]" ) ) { if ( ( ( row . select ( "input[type=text]" ) . size ( ) ) == 1 ) && ( row . select ( "input,<seq2seq4repair_space>select" ) . first ( ) . tagName ( ) . equals ( "input" ) ) ) { Element input = row . select ( "input[type=text]" ) . first ( ) ; TextSearchField field = new TextSearchField ( ) ; field . setId ( input . attr ( "id" ) ) ; field . setDisplayName ( row . select ( "label" ) . first ( ) . text ( ) ) ; field . setHint ( "" ) ; field . setData ( selectableData ) ; fields . add ( field ) ; } else if ( ( ( row . select ( "select" ) . size ( ) ) == 1 ) && ( ( row . select ( "input[type=text]" ) . size ( ) ) == 0 ) ) { Element select = row . select ( "select" ) . first ( ) ; DropdownSearchField field = new DropdownSearchField ( ) ; field . setId ( select . id ( ) ) ; field . setDisplayName ( row . select ( "label" ) . first ( ) . text ( ) ) ; List < Map < String , String > > values = new ArrayList < > ( ) ; for ( Element opt : select . select ( "option" ) ) { field . addDropdownValue ( opt . attr ( "value" ) , opt . text ( ) ) ; } fields . add ( field ) ; } else if ( ( ( ( row . select ( "select" ) . size ( ) ) == 0 ) && ( ( row . select ( "input[type=text]" ) . size ( ) ) == 3 ) ) && ( ( row . select ( "label" ) . size ( ) ) == 3 ) ) { String name1 = row . select ( "label" ) . get ( 0 ) . text ( ) ; String name2 = row . select ( "label" ) . get ( 1 ) . text ( ) ; String name3 = row . select ( "label" ) . get ( 2 ) . text ( ) ; Element input1 = row . select ( "input[type=text]" ) . get ( 0 ) ;

Fix:
if ( ( ( searchoptions . size ( ) ) == 0 ) && ( ( doc . select ( "input[fld=FELD01_1]" ) . size ( ) ) > 0 ) ) {