SLING-7890 fixed incorrectly reported binary size

incorrectly assumed that if a valueMap.get(binaryKey,long) returned the
length for a single InputStream and valueMap.get(binaryKey,long[]) would
return an array of lengths for an array of InputStreams that
valueMap.get(binaryKey,long[]) would convert an entry of a single
InputStream to an Array with a single value. being consistent with how
other adapters work.
diff --git a/src/main/java/org/apache/sling/servlets/get/impl/util/JsonObjectCreator.java b/src/main/java/org/apache/sling/servlets/get/impl/util/JsonObjectCreator.java
index 4b66248..2452747 100644
--- a/src/main/java/org/apache/sling/servlets/get/impl/util/JsonObjectCreator.java
+++ b/src/main/java/org/apache/sling/servlets/get/impl/util/JsonObjectCreator.java
@@ -148,7 +148,7 @@
             // (colon is not allowed as a JCR property name)
             // in the name, and the value should be the size of the binary data
             if (values == null) {
-                obj.add(":" + key, getLength(0, key, (InputStream) value));
+                obj.add(":" + key, getLength(-1, key, (InputStream) value));
             } else {
                 final JsonArrayBuilder result = Json.createArrayBuilder();
                 for (int i = 0; i < values.length; i++) {
@@ -175,13 +175,15 @@
             stream.close();
         } catch (IOException ignore) {
         }
-        long length = -1;
         if (valueMap != null) {
+            if (index == -1) {
+                return valueMap.get(key, index);
+            }
             Long[] lengths = valueMap.get(key, Long[].class);
             if (lengths != null && lengths.length > index) {
-                length = lengths[index];
+                return lengths[index];
             }
         }
-        return length;
+        return -1;
     }
 }