Skip to content

Commit

Permalink
catch exception for incomplete json responses
Browse files Browse the repository at this point in the history
  • Loading branch information
mvetsch committed Jun 20, 2016
1 parent dfab343 commit 77d7efe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nbproject/suite.properties
@@ -1 +1 @@
suite.dir=${basedir}/../../git/autopsy
suite.dir=${basedir}/../Autopsy
Expand Up @@ -32,7 +32,7 @@ public long getTimeUntilNextPossibleRequest() {

Date relevantTimeStamp = lastRequests.get(lastRequests.size() - allowedRequestsPerMinute);
long timeToWait = msOfAMinute - (new Date().getTime() - relevantTimeStamp.getTime());

if (timeToWait < 0) {
timeToWait = 0;
}
Expand Down Expand Up @@ -90,10 +90,13 @@ private VirusTotalReport getResult(URL url) {
return new VirusTotalReport();
}

int positives = response.getInt("positives");
if (positives > 0) {
String permaLink = response.getString("permalink");
return new VirusTotalReport(permaLink);
try {
int positives = response.getInt("positives");
if (positives > 0) {
String permaLink = response.getString("permalink");
return new VirusTotalReport(permaLink);
}
} catch (Exception e) {
}
return new VirusTotalReport();
}
Expand Down

0 comments on commit 77d7efe

Please sign in to comment.