Skip to content
Permalink
Browse files
OAK-9751 : incorporated review comments to readString instead of retu…
…ning while reaching max size limit
  • Loading branch information
Rishabh Kumar committed Apr 26, 2022
1 parent 0d95ce7 commit ecef552a051f46d29a5cd20162992a712c96af51
Showing 2 changed files with 4 additions and 6 deletions.
@@ -91,11 +91,9 @@ public void addSerializedProperty(@Nullable String json) {
if (!first) {
reader.read(',');
}
String s = reader.readString();
if (sizeWithinLimits()) {
indexedNodes.put(path, reader.readString());
} else {
// return if max limit reached for builder to avoid overflow exception
return;
indexedNodes.put(path, s);
}
}
} while (reader.matches(','));
@@ -60,7 +60,7 @@ public void addJsonLessThanMaxBuilderSize() throws Exception {
a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
builder.addSerializedProperty(a);
}
assertEquals(createdIndexPathMap((IndexedPaths)builder.build()).size(), 998);
assertEquals(998, createdIndexPathMap((IndexedPaths)builder.build()).size());
}

@Test
@@ -70,7 +70,7 @@ public void addJsonBiggerThanMaxBuilderSize() throws Exception {
a = "{\"/var/eventing/jobs/foo/2022/4/19/14/27/af96fcfa9e32_8589" + i + "\" :[\"/oak:index/foo\",\"/oak:index/bar\"]}";
builder.addSerializedProperty(a);
}
assertEquals(createdIndexPathMap((IndexedPaths)builder.build()).size(), 1000);
assertEquals(1000, createdIndexPathMap((IndexedPaths)builder.build()).size());
}
@Test
public void addMulti() throws Exception{

0 comments on commit ecef552

Please sign in to comment.