dsmiley commented on code in PR #825:
URL: https://github.com/apache/solr/pull/825#discussion_r862491087


##########
solr/solrj/src/java/org/apache/solr/common/util/Utils.java:
##########
@@ -302,10 +302,18 @@ public static byte[] toUTF8(CharArr out) {
   }
 
   public static Object fromJSON(byte[] utf8) {
+    // Need below check in both fromJSON methods since
+    // utf8.length returns a NPE without this check.
+    if (utf8 == null || utf8.length == 0) {
+      return Collections.emptyMap();
+    }
     return fromJSON(utf8, 0, utf8.length);
   }
 
   public static Object fromJSON(byte[] utf8, int offset, int length) {
+    if (utf8 == null || utf8.length == 0 || length == 0) {

Review Comment:
   nitpick: the test for `utf8.length == 0` is redundant since it'd be covered 
by the `length` check.  But whatever.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to