Skip to content

Commit f1f2a53

Browse files
committed
use entrySet()
1 parent 5eeb448 commit f1f2a53

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

opengrok-web/src/main/java/org/opengrok/web/WebappListener.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,22 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
118118
*/
119119
private void checkIndex(RuntimeEnvironment env) {
120120
if (env.isProjectsEnabled()) {
121-
LOGGER.log(Level.FINE, "Checking indexes for all projects");
122121
Map<String, Project> projects = env.getProjects();
123122
File indexRoot = new File(env.getDataRootPath(), IndexDatabase.INDEX_DIR);
124123
if (indexRoot.exists()) {
125-
projects.keySet().forEach(projectName -> {
124+
LOGGER.log(Level.FINE, "Checking indexes for all projects");
125+
for (Map.Entry<String, Project> projectEntry : projects.entrySet()) {
126126
try {
127-
IndexCheck.checkDir(new File(indexRoot, projectName));
127+
IndexCheck.checkDir(new File(indexRoot, projectEntry.getKey()));
128128
} catch (Exception e) {
129129
LOGGER.log(Level.WARNING,
130-
String.format("Project %s index check failed, marking as not indexed", projectName), e);
131-
projects.get(projectName).setIndexed(false);
130+
String.format("Project %s index check failed, marking as not indexed",
131+
projectEntry.getKey()), e);
132+
projectEntry.getValue().setIndexed(false);
132133
}
133-
});
134+
}
135+
LOGGER.log(Level.FINE, "Index check for all projects done");
134136
}
135-
LOGGER.log(Level.FINE, "Index check for all projects done");
136137
} else {
137138
LOGGER.log(Level.FINE, "Checking index");
138139
try {

0 commit comments

Comments
 (0)