Skip to content

Commit

Permalink
More comments
Browse files Browse the repository at this point in the history
Signed-off-by: Suraj Singh <[email protected]>
  • Loading branch information
dreamer-89 committed Jun 2, 2023
1 parent f92f5ce commit c3d599a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ public void testPrimaryReceivesDocsDuringReplicaRecovery() throws Exception {
}

/**
* This test validates that that segment replications works for any random compression mode
* This test validates that segment replications works with random compression mode
* @throws Exception
*/
public void testCodecWithDifferentCompressionModes() throws Exception {
Expand Down Expand Up @@ -1349,18 +1349,18 @@ public void testCodecWithOlderCodecs() throws Exception {
// Return oldest lucene codec name. It does this by iterating throw all directories under lucene library and filter
// ones matching lucene codec name regex
private String getOlderLuceneCodec() throws IOException {
TreeSet<String> codecNames = new TreeSet<>();
final TreeSet<String> codecNames = new TreeSet<>();
ZipInputStream zip = new ZipInputStream(Codec.class.getProtectionDomain().getCodeSource().getLocation().openStream());
Pattern pattern = Pattern.compile("lucene[0-9]+");
while (true) {
ZipEntry e = zip.getNextEntry();
if (e == null) break;
// Filter lucene codec names from directory
if (e.isDirectory()) {
// Remove trailing `/` file separator
// Remove trailing file separator from path i.e. '../lucene94/' -> '../lucene94'
final String dirPath = e.getName().substring(0, e.getName().length() - 1);
int index = dirPath.lastIndexOf(File.separator);
final String dirName = dirPath.substring(index + 1);
// Fetch name i.e. '../lucene94' -> 'lucene94'
final String dirName = dirPath.substring(dirPath.lastIndexOf(File.separator) + 1);
Matcher matcher = pattern.matcher(dirName);
if (matcher.matches()) {
codecNames.add(dirName);
Expand Down

0 comments on commit c3d599a

Please sign in to comment.