Skip to content

Commit

Permalink
Merge pull request #59 from Wikidata/fix-issue-#58
Browse files Browse the repository at this point in the history
Fix VerifyError, issue #58
  • Loading branch information
julianmendez committed Apr 5, 2014
2 parents 46af3c3 + b37bebd commit 0d214bb
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,24 @@ private List<StatementGroup> getStatementGroups(JSONArray jsonStatements,

// iterate over all the statements in the item and decompose them
for (int i = 0; i < jsonStatements.length(); i++) {

// snak conversion might fail
// so gracefully skip them and log a debug message
JSONObject statementJson = jsonStatements.getJSONObject(i);
try { // only conversion exceptions are to be caught
Statement statement = this.getStatement(statementJson,
entityIdValue);
statementsFromJson.add(statement);
} catch( IllegalArgumentException | JSONException e){
logger.debug("Encountered an exception during statement parsing:\n"
+ e.getMessage() + "\nIn statement\n" + statementJson.toString(2));
Statement statement = this.getStatement(statementJson,
entityIdValue);
statementsFromJson.add(statement);
} catch (IllegalArgumentException e) {
logger.debug("Encountered an illegal argument exception during statement parsing:\n"
+ e.getMessage()
+ "\nIn statement\n"
+ statementJson.toString(2));
} catch (JSONException e) {
logger.debug("Encountered a JSON exception during statement parsing:\n"
+ e.getMessage()
+ "\nIn statement\n"
+ statementJson.toString(2));
}
}

Expand Down

0 comments on commit 0d214bb

Please sign in to comment.