mirror of https://github.com/apache/lucene.git
LUCENE-9232: Fix or suppress 13 resource leak precommit warnings in lucene/replicator
This commit is contained in:
parent
cab4e7d34e
commit
88aff5d006
|
@ -277,6 +277,8 @@ Other
|
|||
|
||||
* LUCENE-9288: poll_mirrors.py release script can handle HTTPS mirrors. (Ignacio Vera)
|
||||
|
||||
* LUCENE-9232: Fix or suppress 13 resource leak precommit warnings in lucene/replicator (Andras Salamon via Erick Erickson)
|
||||
|
||||
Build
|
||||
|
||||
* Upgrade forbiddenapis to version 3.0. (Uwe Schindler)
|
||||
|
|
|
@ -99,10 +99,12 @@ public abstract class ReplicatorTestCase extends LuceneTestCase {
|
|||
HttpConfiguration configuration = new HttpConfiguration();
|
||||
configuration.setSecureScheme("https");
|
||||
configuration.addCustomizer(new SecureRequestCustomizer());
|
||||
@SuppressWarnings("resource")
|
||||
ServerConnector c = new ServerConnector(server, new SslConnectionFactory(sslcontext, "http/1.1"),
|
||||
new HttpConnectionFactory(configuration));
|
||||
connector = c;
|
||||
} else {
|
||||
@SuppressWarnings("resource")
|
||||
ServerConnector c = new ServerConnector(server, new HttpConnectionFactory());
|
||||
connector = c;
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
waitForVersionAndHits(replica, primaryVersion3, 10);
|
||||
|
||||
primaryC.close();
|
||||
|
||||
docs.close();
|
||||
replica.close();
|
||||
primary.close();
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
waitForVersionAndHits(replica, primaryVersion3, 20);
|
||||
|
||||
primaryC.close();
|
||||
|
||||
docs.close();
|
||||
replica.close();
|
||||
primary.close();
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
// Ask replica to sync:
|
||||
replica.newNRTPoint(primaryVersion1, 0, primary.tcpPort);
|
||||
waitForVersionAndHits(replica, primaryVersion1, 10);
|
||||
|
||||
docs.close();
|
||||
replica.close();
|
||||
primary.close();
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
|
||||
// On startup the replica searches the last commit:
|
||||
assertVersionAndHits(replica, primaryVersion1, 10);
|
||||
|
||||
docs.close();
|
||||
replica.close();
|
||||
primary.close();
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
replica.newNRTPoint(primaryVersion2, 0, primary.tcpPort);
|
||||
|
||||
waitForVersionAndHits(replica, primaryVersion2, 20);
|
||||
|
||||
docs.close();
|
||||
replica.close();
|
||||
primary.close();
|
||||
}
|
||||
|
@ -508,6 +508,8 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
// Wait for replica to sync up:
|
||||
waitForVersionAndHits(replica, primaryVersion1, 10);
|
||||
|
||||
docs.close();
|
||||
|
||||
// Crash primary:
|
||||
primary.crash();
|
||||
|
||||
|
@ -586,6 +588,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
// Wait for replica to sync up:
|
||||
waitForVersionAndHits(replica, primaryVersion2, 20);
|
||||
|
||||
docs.close();
|
||||
primary.close();
|
||||
replica.close();
|
||||
}
|
||||
|
@ -693,7 +696,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
assertEquals(100, hitCount);
|
||||
}
|
||||
}
|
||||
|
||||
docs.close();
|
||||
primary.close();
|
||||
replica.close();
|
||||
}
|
||||
|
@ -763,6 +766,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
// Make sure it sees all docs that were indexed while it was down:
|
||||
assertVersionAndHits(primary, primaryVersion2, 110);
|
||||
|
||||
docs.close();
|
||||
replica.close();
|
||||
primary.close();
|
||||
}
|
||||
|
@ -832,6 +836,7 @@ public class TestNRTReplication extends LuceneTestCase {
|
|||
assertVersionAndHits(replica1, primary.initInfosVersion, 50);
|
||||
assertVersionAndHits(replica2, primary.initInfosVersion, 50);
|
||||
|
||||
docs.close();
|
||||
primary.close();
|
||||
replica1.close();
|
||||
replica2.close();
|
||||
|
|
|
@ -1057,9 +1057,9 @@ public class TestStressNRTReplication extends LuceneTestCase {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
LineFileDocs docs=null;
|
||||
try {
|
||||
LineFileDocs docs = new LineFileDocs(random());
|
||||
docs = new LineFileDocs(random());
|
||||
int docCount = 0;
|
||||
|
||||
// How often we do an update/delete vs add:
|
||||
|
@ -1175,6 +1175,8 @@ public class TestStressNRTReplication extends LuceneTestCase {
|
|||
failed.set(true);
|
||||
stop.set(true);
|
||||
throw new RuntimeException(t);
|
||||
} finally {
|
||||
IOUtils.closeWhileHandlingException(docs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue