Buggy code:
public class MainActivity extends Activity { private MapView mapView ; private GraphHopper hopper ; private LatLong start ; private LatLong end ; private Spinner localSpinner ; private Button localButton ; private Spinner remoteSpinner ; private Button remoteButton ; private volatile boolean prepareInProgress = false ; private volatile boolean shortestPathRunning = false ; private String currentArea = "berlin" ; private String fileListURL = "https:////graphhopper.com//public//maps//0.5//" ; private String prefixURL = fileListURL ; private String downloadURL ; private File mapsFolder ; private TileCache tileCache ; private TileRendererLayer tileRendererLayer ; protected boolean onMapTap ( LatLong tapLatLong , Point layerXY , Point tapXY ) { } @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override protected void onDestroy ( ) { } boolean isReady ( ) { } private void initFiles ( String area ) { } private void chooseAreaFromLocal ( ) { } private void chooseAreaFromRemote ( ) { new GHAsyncTask < Void , Void , List < String > > ( ) { protected List < String > saveDoInBackground ( Void ... params ) throws Exception { <START_BUG> String [ ] lines = new AndroidDownloader ( ) . downloadAsString ( fileListURL ) . split ( "\n" ) ; <END_BUG> List < String > res = new java . util . ArrayList < String > ( ) ; for ( String str : lines ) { int index = str . indexOf ( "href=\"" ) ; if ( index >= 0 ) { index += 6 ; int lastIndex = str . indexOf ( ".ghz" , index ) ; if ( lastIndex >= 0 ) res . add ( ( ( ( prefixURL ) + ( str . substring ( index , lastIndex ) ) ) + ".ghz" ) ) ; } } return res ; } @ Override protected void onPostExecute ( List < String > nameList ) { if ( nameList . isEmpty ( ) ) { logUser ( ( "No<seq2seq4repair_space>maps<seq2seq4repair_space>created<seq2seq4repair_space>for<seq2seq4repair_space>your<seq2seq4repair_space>version!?<seq2seq4repair_space>" + ( fileListURL ) ) ) ; return ; } else if ( hasError ( ) ) { getError ( ) . printStackTrace ( ) ; logUser ( ( "Are<seq2seq4repair_space>you<seq2seq4repair_space>connected<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>internet?<seq2seq4repair_space>Problem<seq2seq4repair_space>while<seq2seq4repair_space>fetching<seq2seq4repair_space>remote<seq2seq4repair_space>area<seq2seq4repair_space>list:<seq2seq4repair_space>" + ( getErrorMessage ( ) ) ) ) ; return ; } MainActivity . MySpinnerListener spinnerListener = new MainActivity . MySpinnerListener ( ) { @ Override public void onSelect ( String selectedArea , String selectedFile ) { if ( ( ( selectedFile == null ) || ( new File ( mapsFolder , ( selectedArea + ".ghz" ) ) . exists ( ) ) ) || ( new File ( mapsFolder , ( selectedArea + "-gh" ) ) . exists ( ) ) ) { downloadURL = null ; } else { downloadURL = selectedFile ; } initFiles ( selectedArea ) ; } } ; chooseArea ( remoteButton , remoteSpinner , nameList , spinnerListener ) ; } } . execute ( ) ; } private void chooseArea ( Button button , final Spinner spinner , List < String > nameList , final MainActivity . MySpinnerListener mylistener ) { } public interface MySpinnerListener { void onSelect ( String selectedArea , String selectedFile ) { } } void downloadingFiles ( ) { } void loadMap ( File areaFolder ) { } void loadGraphStorage ( ) { } private void finishPrepare ( ) { } private Polyline createPolyline ( GHResponse response ) { } private Marker createMarker ( LatLong p , int resource ) { } public void calcPath ( final double fromLat , final double fromLon , final double toLat , final double toLon ) { } private void log ( String str ) { } private void log ( String str , Throwable t ) { } private void logUser ( String str ) { } private static final int NEW_MENU_ID = ( Menu . FIRST ) + 1 ; @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
String [ ] lines = new AndroidDownloader ( ) . downloadAsString ( fileListURL , false ) . split ( "\n" ) ;