You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/09/22 12:47:23 UTC

[GitHub] [kafka] viktorsomogyi commented on a change in pull request #4090: [KAFKA-6084] Propagate JSON parsing errors in ReassignPartitionsCommand

viktorsomogyi commented on a change in pull request #4090:
URL: https://github.com/apache/kafka/pull/4090#discussion_r492704280



##########
File path: core/src/test/scala/unit/kafka/utils/JsonTest.scala
##########
@@ -40,25 +40,34 @@ class JsonTest {
   def testJsonParse(): Unit = {
     val jnf = JsonNodeFactory.instance
 
-    assertEquals(Json.parseFull("{}"), Some(JsonValue(new ObjectNode(jnf))))
+    assertEquals(Some(JsonValue(new ObjectNode(jnf))), Json.parseFull("{}"))
+    assertEquals(Right(JsonValue(new ObjectNode(jnf))), Json.tryParseFull("{}"))
+    assertThrows(classOf[IllegalArgumentException], () => Json.tryParseFull(null))
+    assertThrows(classOf[IllegalArgumentException], () => Json.tryParseBytes(null))
 
-    assertEquals(Json.parseFull("""{"foo":"bar"s}"""), None)
+    assertEquals(Option(MissingNode.getInstance()).map(JsonValue(_)), Json.parseFull(""))
+    assertEquals(Right(MissingNode.getInstance()).map(JsonValue(_)), Json.tryParseFull(""))

Review comment:
       You're right, it makes sense to return `None` and `Left` in those cases. Will change it and upload it to this PR.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org