You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/05/01 15:44:33 UTC

[GitHub] [solr] dsmiley commented on a diff in pull request #825: SOLR-16164: ConfigSet API returns error if untrusted user creates from _default configset

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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org