Source:
protected static byte [ ] doDownload ( java.lang.String url , boolean isProxySet , java.lang.String proxyHost , int proxyPort ) { if ( com.android.server.location.GpsXtraDownloader.DEBUG ) android.util.Log.d ( com.android.server.location.GpsXtraDownloader.TAG , ( "Downloading XTRA data from " + url ) ) ; android.net.http.AndroidHttpClient client = null ; try { client = android.net.http.AndroidHttpClient.newInstance ( "Android" ) ; org.apache.http.client.methods.HttpUriRequest req = new org.apache.http.client.methods.HttpGet ( url ) ; if ( isProxySet ) { org.apache.http.HttpHost proxy = new org.apache.http.HttpHost ( proxyHost , proxyPort ) ; org.apache.http.conn.params.ConnRouteParams.setDefaultProxy ( req.getParams ( ) , proxy ) ; } req.addHeader ( "Accept" , "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic" ) ; req.addHeader ( "x-wap-profile" , "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#" ) ; org.apache.http.HttpResponse response = client.execute ( req ) ; org.apache.http.StatusLine status = response.getStatusLine ( ) ; if ( ( status.getStatusCode ( ) ) != 200 ) { if ( com.android.server.location.GpsXtraDownloader.DEBUG ) android.util.Log.d ( com.android.server.location.GpsXtraDownloader.TAG , ( "HTTP error: " + ( status.getReasonPhrase ( ) ) ) ) ; return null ; } org.apache.http.HttpEntity entity = response.getEntity ( ) ; byte [ ] body = null ; if ( entity != null ) { try { if ( ( entity.getContentLength ( ) ) > 0 ) { body = new byte [ ( ( int ) ( entity.getContentLength ( ) ) ) ] ; java.io.DataInputStream dis = new java.io.DataInputStream ( entity.getContent ( ) ) ; try { dis.readFully ( body ) ; } finally { try { dis.close ( ) ; } catch ( java.io.IOException e ) { android.util.Log.e ( com.android.server.location.GpsXtraDownloader.TAG , "Unexpected IOException." , e ) ; } } } } finally { if ( entity != null ) { entity.consumeContent ( ) ; } } } return body ; } catch ( java.lang.Exception e ) { if ( com.android.server.location.GpsXtraDownloader.DEBUG ) android.util.Log.d ( com.android.server.location.GpsXtraDownloader.TAG , ( "error " + e ) ) ; } finally { if ( client != null ) { client.close ( ) ; } } return null ; }

Target:
protected static byte [ ] doDownload ( java.lang.String url ) { if ( com.android.server.location.GpsXtraDownloader.DEBUG ) android.util.Log.d ( com.android.server.location.GpsXtraDownloader.TAG , ( "Downloading XTRA data from " + url ) ) ; java.net.HttpURLConnection connection = null ; try { connection = ( ( java.net.HttpURLConnection ) ( new java.net.URL ( url ) . openConnection ( ) ) ) ; connection.setRequestProperty ( "Accept" , "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic" ) ; connection.setRequestProperty ( "x-wap-profile" , "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#" ) ; connection.connect ( ) ; int statusCode = connection.getResponseCode ( ) ; if ( statusCode != ( java.net.HttpURLConnection.HTTP_OK ) ) { if ( com.android.server.location.GpsXtraDownloader.DEBUG ) android.util.Log.d ( com.android.server.location.GpsXtraDownloader.TAG , ( "HTTP error downloading gps XTRA: " + statusCode ) ) ; return null ; } return libcore.io.Streams.readFully ( connection.getInputStream ( ) ) ; } catch ( java.io.IOException ioe ) { if ( com.android.server.location.GpsXtraDownloader.DEBUG ) android.util.Log.d ( com.android.server.location.GpsXtraDownloader.TAG , "Error downloading gps XTRA: " , ioe ) ; } finally { if ( connection != null ) { connection.disconnect ( ) ; } } return null ; }