File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
src/main/java/run/ikaros/server/service Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -144,17 +144,25 @@ public String downloadRssXmlFile(@Nonnull String url) {
144
144
bufferedOutputStream .write (buffer , 0 , len );
145
145
}
146
146
LOGGER .info ("download rss xml file to cache path: {}" , cacheFilePath );
147
- } catch (IOException e ) {
147
+ } catch (Exception e ) {
148
148
String msg = "fail write rss url xml file bytes to cache path: " + cacheFilePath ;
149
149
LOGGER .warn (msg , e );
150
150
throw new RssOperateException (msg , e );
151
151
} finally {
152
152
try {
153
- bufferedOutputStream .close ();
154
- outputStream .close ();
155
- bufferedInputStream .close ();
156
- inputStream .close ();
157
- } catch (IOException e ) {
153
+ if (bufferedOutputStream != null ) {
154
+ bufferedOutputStream .close ();
155
+ }
156
+ if (outputStream != null ) {
157
+ outputStream .close ();
158
+ }
159
+ if (bufferedInputStream != null ) {
160
+ bufferedInputStream .close ();
161
+ }
162
+ if (inputStream != null ) {
163
+ inputStream .close ();
164
+ }
165
+ } catch (Exception e ) {
158
166
throw new RssOperateException (e );
159
167
}
160
168
}
You can’t perform that action at this time.
0 commit comments