Example usage for org.eclipse.jgit.storage.file FileBasedConfig getInt

List of usage examples for org.eclipse.jgit.storage.file FileBasedConfig getInt

Introduction

In this page you can find the example usage for org.eclipse.jgit.storage.file FileBasedConfig getInt.

Prototype

public int getInt(final String section, final String name, final int defaultValue) 

Source Link

Document

Obtain an integer value from the configuration.

Usage

From source file:com.gitblit.LuceneExecutor.java

License:Apache License

/**
 * Reads the Lucene config file for the repository to check the index
 * version. If the index version is different, then rebuild the repository
 * index.//from  w w  w. j  av a2  s . c  o m
 * 
 * @param repository
 * @return true of the on-disk index format is different than INDEX_VERSION
 */
private boolean shouldReindex(Repository repository) {
    try {
        FileBasedConfig config = getConfig(repository);
        config.load();
        int indexVersion = config.getInt(CONF_INDEX, CONF_VERSION, 0);
        // reindex if versions do not match
        return indexVersion != INDEX_VERSION;
    } catch (Throwable t) {
    }
    return true;
}