Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Fix server startup error.
Browse files Browse the repository at this point in the history
When booting up, the Zanata server performs validation checks on the lucene index directory (if one is provided). When this index is not yet created, this validation will fail. This directory is now being created jsut for validation purposes, and lucene will use it afterwards.
  • Loading branch information
Carlos Munoz committed Jul 1, 2013
1 parent 6b0f69a commit e1990d4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions zanata-war/src/main/java/org/zanata/ZanataInit.java
Expand Up @@ -156,6 +156,17 @@ public void initZanata() throws Exception

private void checkLuceneLocks(File indexDir) throws ZanataInitializationException
{
if( !indexDir.exists() )
{
if(indexDir.mkdirs())
{
log.info("Created lucene index directory.");
}
else
{
log.warn("Could not create lucene index directory");
}
}
Collection<File> lockFiles = FileUtils.listFiles(indexDir, new String[]{"lock"}, true);
Collection<String> lockedDirs = Lists.newArrayList();
for (File f : lockFiles)
Expand Down

1 comment on commit e1990d4

@seanf
Copy link
Contributor

@seanf seanf commented on e1990d4 Jul 2, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the directory doesn't exist, it can't have any stale locks in it, so why don't we just exit?

Please sign in to comment.