8
8
import org .jetbrains .annotations .Nullable ;
9
9
10
10
import java .io .BufferedReader ;
11
- import java .io .IOException ;
12
11
import java .io .InputStreamReader ;
13
12
import java .net .HttpURLConnection ;
14
13
import java .net .URI ;
@@ -50,7 +49,7 @@ public static <T> Optional<T> get(@NotNull String userAgent, @NotNull String url
50
49
return Optional .empty ();
51
50
}
52
51
result = function .apply (new InputStreamReader (connection .getInputStream ()));
53
- } catch (final IOException e ) {
52
+ } catch (final Exception e ) {
54
53
if (DEBUG ) e .printStackTrace ();
55
54
}
56
55
if (connection != null ) connection .disconnect ();
@@ -107,7 +106,7 @@ public static int postJson(@NotNull String userAgent, @NotNull String urlString,
107
106
if (connectionConsumer != null ) connectionConsumer .accept (connection );
108
107
if (data != null ) connection .getOutputStream ().write (data .toString ().getBytes ());
109
108
responseCode = connection .getResponseCode ();
110
- } catch (final IOException e ) {
109
+ } catch (final Exception e ) {
111
110
if (DEBUG ) e .printStackTrace ();
112
111
}
113
112
if (connection != null ) connection .disconnect ();
@@ -136,7 +135,7 @@ public static int putJson(@NotNull String userAgent, @NotNull String urlString,
136
135
if (connectionConsumer != null ) connectionConsumer .accept (connection );
137
136
if (data != null ) connection .getOutputStream ().write (data .toString ().getBytes ());
138
137
responseCode = connection .getResponseCode ();
139
- } catch (final IOException e ) {
138
+ } catch (final Exception e ) {
140
139
if (DEBUG ) e .printStackTrace ();
141
140
}
142
141
if (connection != null ) connection .disconnect ();
@@ -161,7 +160,7 @@ public static int delete(@NotNull String userAgent, @NotNull String urlString, @
161
160
connection .setRequestProperty ("User-Agent" , userAgent );
162
161
if (connectionConsumer != null ) connectionConsumer .accept (connection );
163
162
responseCode = connection .getResponseCode ();
164
- } catch (final IOException e ) {
163
+ } catch (final Exception e ) {
165
164
if (DEBUG ) e .printStackTrace ();
166
165
}
167
166
if (connection != null ) connection .disconnect ();
0 commit comments