Skip to content

Commit eb8404d

Browse files
author
Vladimir Kotal
committed
swallow exceptions in markProjectIndexed()
fixes #3373
1 parent 0323aec commit eb8404d

File tree

1 file changed

+33
-21
lines changed

1 file changed

+33
-21
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.io.InputStream;
3434
import java.io.OutputStreamWriter;
3535
import java.io.Writer;
36+
import java.net.ConnectException;
3637
import java.nio.file.Files;
3738
import java.nio.file.Path;
3839
import java.nio.file.Paths;
@@ -354,27 +355,38 @@ private void markProjectIndexed(Project project) {
354355
// Successfully indexed the project. The message is sent even if
355356
// the project's isIndexed() is true because it triggers RepositoryInfo
356357
// refresh.
357-
if (project != null) {
358-
// Also need to store the correct value in configuration
359-
// when indexer writes it to a file.
360-
project.setIndexed(true);
361-
362-
if (env.getConfigURI() != null) {
363-
Response r = ClientBuilder.newClient()
364-
.target(env.getConfigURI())
365-
.path("api")
366-
.path("v1")
367-
.path("projects")
368-
.path(Util.URIEncode(project.getName()))
369-
.path("indexed")
370-
.request()
371-
.put(Entity.text(""));
372-
373-
if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
374-
LOGGER.log(Level.WARNING, "Couldn''t notify the webapp that project {0} was indexed: {1}",
375-
new Object[] {project, r});
376-
}
377-
}
358+
if (project == null) {
359+
return;
360+
}
361+
362+
// Also need to store the correct value in configuration
363+
// when indexer writes it to a file.
364+
project.setIndexed(true);
365+
366+
if (env.getConfigURI() == null) {
367+
return;
368+
}
369+
370+
Response r;
371+
try {
372+
r = ClientBuilder.newClient()
373+
.target(env.getConfigURI())
374+
.path("api")
375+
.path("v1")
376+
.path("projects")
377+
.path(Util.URIEncode(project.getName()))
378+
.path("indexed")
379+
.request()
380+
.put(Entity.text(""));
381+
} catch (RuntimeException e) {
382+
LOGGER.log(Level.WARNING, "Couldn''t notify the webapp that project {0} was indexed: {1}",
383+
new Object[] {project, e});
384+
return;
385+
}
386+
387+
if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
388+
LOGGER.log(Level.WARNING, "Couldn''t notify the webapp that project {0} was indexed: {1}",
389+
new Object[] {project, r});
378390
}
379391
}
380392

0 commit comments

Comments
 (0)