From c3d599a0af6949abfce06c6bd70fee64e114bd10 Mon Sep 17 00:00:00 2001 From: Suraj Singh Date: Fri, 2 Jun 2023 15:07:52 -0700 Subject: [PATCH] More comments Signed-off-by: Suraj Singh --- .../indices/replication/SegmentReplicationIT.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java index 337a8aa47259d..6651735a7f794 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java @@ -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 { @@ -1349,7 +1349,7 @@ 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 codecNames = new TreeSet<>(); + final TreeSet codecNames = new TreeSet<>(); ZipInputStream zip = new ZipInputStream(Codec.class.getProtectionDomain().getCodeSource().getLocation().openStream()); Pattern pattern = Pattern.compile("lucene[0-9]+"); while (true) { @@ -1357,10 +1357,10 @@ private String getOlderLuceneCodec() throws IOException { 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);