Skip to content

Commit

Permalink
#169 Accept MISP attribute with null comment
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 10, 2017
1 parent 596fff9 commit 6ac26b0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions thehive-misp/app/connectors/misp/JsonFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ package connectors.misp

import java.util.Date

import play.api.libs.json.{ Json, Reads }
import org.elastic4play.models.JsonFormat.enumFormat
import play.api.libs.json.JsLookupResult.jsLookupResultToJsLookup
import play.api.libs.json.JsValue
import play.api.libs.json.JsValue.jsValueToJsLookup

import org.elastic4play.models.JsonFormat.enumFormat
import org.elastic4play.JsonFormat.dateFormat
import play.api.libs.json.{JsSuccess, JsValue, Json, Reads}

object JsonFormat {
implicit val eventStatusFormat = enumFormat(EventStatus)
Expand Down Expand Up @@ -41,7 +38,7 @@ object JsonFormat {
eventId (json \ "id").validate[String]
timestamp (json \ "timestamp").validate[String]
date = new Date(timestamp.toLong * 1000)
comment (json \ "comment").validate[String]
comment (json \ "comment").validate[String].orElse(JsSuccess(""))
value (json \ "value").validate[String]
} yield MispAttribute(id, tpe, category, uuid, eventId.toLong, date, comment, value))
}

0 comments on commit 6ac26b0

Please sign in to comment.