Skip to content

Commit

Permalink
Fixes #107 No proper null check on some fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sstrickx committed Nov 6, 2017
1 parent af348b1 commit 9c45454
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ protected Stock parseJson(JsonNode node) {
String symbol = node.get("symbol").asText();
Stock stock = new Stock(symbol);

stock.setName(node.get("longName").asText());
stock.setCurrency(node.get("currency").asText());
stock.setStockExchange(node.get("fullExchangeName").asText());
if(node.has("longName")) {
stock.setName(node.get("longName").asText());
} else {
stock.setName(getStringValue(node, "shortName"));
}

stock.setCurrency(getStringValue(node, "currency"));
stock.setStockExchange(getStringValue(node, "fullExchangeName"));

stock.setQuote(this.getQuote(node));
stock.setStats(this.getStats(node));
Expand Down

0 comments on commit 9c45454

Please sign in to comment.