uschindler commented on a change in pull request #602:
URL: https://github.com/apache/lucene/pull/602#discussion_r784844870



##########
File path: lucene/core/src/java/org/apache/lucene/store/ByteArrayDataInput.java
##########
@@ -109,55 +110,20 @@ public long readLong() {
 
   @Override
   public int readVInt() {
-    byte b = bytes[pos++];
-    if (b >= 0) return b;
-    int i = b & 0x7F;
-    b = bytes[pos++];
-    i |= (b & 0x7F) << 7;
-    if (b >= 0) return i;
-    b = bytes[pos++];
-    i |= (b & 0x7F) << 14;
-    if (b >= 0) return i;
-    b = bytes[pos++];
-    i |= (b & 0x7F) << 21;
-    if (b >= 0) return i;
-    b = bytes[pos++];
-    // Warning: the next ands use 0x0F / 0xF0 - beware copy/paste errors:
-    i |= (b & 0x0F) << 28;
-    if ((b & 0xF0) == 0) return i;
-    throw new RuntimeException("Invalid vInt detected (too many bits)");
+    try {
+      return super.readVInt();
+    } catch (IOException e) {
+      throw new RuntimeException(e);

Review comment:
       This should be an AssertionError. This can never happen, so if it 
happens the assertion that the super's vint method does not throw IOException 
was violated.




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