@@ -26,13 +26,9 @@ public static String loadWebPage(String url, String parameters)
2626 connection = (HttpURLConnection ) urlObj .openConnection ();
2727 connection .setRequestMethod ("GET" );
2828 connection .connect ();
29-
3029 int responseCode = connection .getResponseCode ();
3130 if (responseCode != HttpURLConnection .HTTP_OK )
32- {
33- throw new RuntimeException ("Failed to load web page, response code: " + responseCode );
34- }
35-
31+ { throw new RuntimeException ("Failed to load web page, response code: " + responseCode ); }
3632 InputStream inputStream = connection .getInputStream ();
3733 BufferedReader reader = new BufferedReader (new InputStreamReader (inputStream ));
3834 StringBuilder html = new StringBuilder ();
@@ -56,7 +52,6 @@ public static String loadWebPage(String url, String parameters)
5652 }
5753 }
5854 }
59-
6055 public static String readWebpage (String query )
6156 {
6257 HttpURLConnection connection = null ;
@@ -66,13 +61,9 @@ public static String readWebpage(String query)
6661 connection = (HttpURLConnection ) url .openConnection ();
6762 connection .setRequestMethod ("GET" );
6863 connection .connect ();
69-
7064 int responseCode = connection .getResponseCode ();
7165 if (responseCode != HttpURLConnection .HTTP_OK )
72- {
73- throw new RuntimeException ("Failed to read web page, response code: " + responseCode );
74- }
75-
66+ { throw new RuntimeException ("Failed to read web page, response code: " + responseCode ); }
7667 InputStream inputStream = connection .getInputStream ();
7768 return FileUtils .readStream (inputStream );
7869 }
0 commit comments