Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Dehm
briar
Commits
544c83a6
Verified
Commit
544c83a6
authored
8 years ago
by
Torsten Grote
Browse files
Options
Downloads
Patches
Plain Diff
Close InputStream from RSS feed and prevent NPE
parent
3800cd5e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
briar-core/src/main/java/org/briarproject/briar/feed/FeedManagerImpl.java
+7
-2
7 additions, 2 deletions
...ain/java/org/briarproject/briar/feed/FeedManagerImpl.java
with
7 additions
and
2 deletions
briar-core/src/main/java/org/briarproject/briar/feed/FeedManagerImpl.java
+
7
−
2
View file @
544c83a6
...
@@ -59,6 +59,7 @@ import okhttp3.Dns;
...
@@ -59,6 +59,7 @@ import okhttp3.Dns;
import
okhttp3.OkHttpClient
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
okhttp3.Request
;
import
okhttp3.Response
;
import
okhttp3.Response
;
import
okhttp3.ResponseBody
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
MILLISECONDS
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
MILLISECONDS
;
import
static
java
.
util
.
logging
.
Level
.
WARNING
;
import
static
java
.
util
.
logging
.
Level
.
WARNING
;
...
@@ -334,7 +335,9 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
...
@@ -334,7 +335,9 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
private
SyndFeed
fetchSyndFeed
(
String
url
)
private
SyndFeed
fetchSyndFeed
(
String
url
)
throws
FeedException
,
IOException
{
throws
FeedException
,
IOException
{
// fetch feed
// fetch feed
SyndFeed
f
=
getSyndFeed
(
getFeedInputStream
(
url
));
InputStream
stream
=
getFeedInputStream
(
url
);
SyndFeed
f
=
getSyndFeed
(
stream
);
stream
.
close
();
if
(
f
.
getEntries
().
size
()
==
0
)
if
(
f
.
getEntries
().
size
()
==
0
)
throw
new
FeedException
(
"Feed has no entries"
);
throw
new
FeedException
(
"Feed has no entries"
);
...
@@ -387,7 +390,9 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
...
@@ -387,7 +390,9 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
// Execute Request
// Execute Request
Response
response
=
client
.
newCall
(
request
).
execute
();
Response
response
=
client
.
newCall
(
request
).
execute
();
return
response
.
body
().
byteStream
();
ResponseBody
body
=
response
.
body
();
if
(
body
!=
null
)
return
body
.
byteStream
();
throw
new
IOException
(
"Empty response body"
);
}
}
private
SyndFeed
getSyndFeed
(
InputStream
stream
)
private
SyndFeed
getSyndFeed
(
InputStream
stream
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment