@@ -26,13 +26,9 @@ public static String loadWebPage(String url, String parameters)
26
26
connection = (HttpURLConnection ) urlObj .openConnection ();
27
27
connection .setRequestMethod ("GET" );
28
28
connection .connect ();
29
-
30
29
int responseCode = connection .getResponseCode ();
31
30
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 ); }
36
32
InputStream inputStream = connection .getInputStream ();
37
33
BufferedReader reader = new BufferedReader (new InputStreamReader (inputStream ));
38
34
StringBuilder html = new StringBuilder ();
@@ -56,7 +52,6 @@ public static String loadWebPage(String url, String parameters)
56
52
}
57
53
}
58
54
}
59
-
60
55
public static String readWebpage (String query )
61
56
{
62
57
HttpURLConnection connection = null ;
@@ -66,13 +61,9 @@ public static String readWebpage(String query)
66
61
connection = (HttpURLConnection ) url .openConnection ();
67
62
connection .setRequestMethod ("GET" );
68
63
connection .connect ();
69
-
70
64
int responseCode = connection .getResponseCode ();
71
65
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 ); }
76
67
InputStream inputStream = connection .getInputStream ();
77
68
return FileUtils .readStream (inputStream );
78
69
}
0 commit comments