Skip to content

Commit 83adc92

Browse files
author
Vladimir Kotal
committed
get rid of verbosity flag
1 parent 1eef20a commit 83adc92

File tree

16 files changed

+14
-101
lines changed

16 files changed

+14
-101
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Configuration.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ public final class Configuration {
163163
* Lucene 4.x uses 16MB and 8 threads, so below is a nice tunable.
164164
*/
165165
private double ramBufferSize;
166-
private boolean verbose;
167166
/**
168167
* If below is set, then we count how many files per project we need to
169168
* process and print percentage of completion per project.
@@ -465,7 +464,6 @@ public Configuration() {
465464
// Set to empty string so we can append it to the URL
466465
// unconditionally later.
467466
setUserPageSuffix("");
468-
setVerbose(false);
469467
setWebappLAF("default");
470468
}
471469

@@ -847,14 +845,6 @@ public void setRamBufferSize(double ramBufferSize) {
847845
this.ramBufferSize = ramBufferSize;
848846
}
849847

850-
public boolean isVerbose() {
851-
return verbose;
852-
}
853-
854-
public void setVerbose(boolean verbose) {
855-
this.verbose = verbose;
856-
}
857-
858848
public boolean isPrintProgress() {
859849
return printProgress;
860850
}

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/RuntimeEnvironment.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -821,24 +821,6 @@ public void setPluginStack(AuthorizationStack pluginStack) {
821821
threadConfig.get().setPluginStack(pluginStack);
822822
}
823823

824-
/**
825-
* Is the verbosity flag turned on?
826-
*
827-
* @return true if we can print extra information
828-
*/
829-
public boolean isVerbose() {
830-
return threadConfig.get().isVerbose();
831-
}
832-
833-
/**
834-
* Set the verbosity flag (to add extra debug information in output)
835-
*
836-
* @param verbose new value
837-
*/
838-
public void setVerbose(boolean verbose) {
839-
threadConfig.get().setVerbose(verbose);
840-
}
841-
842824
/**
843825
* Is the progress print flag turned on?
844826
*

opengrok-indexer/src/main/java/org/opengrok/indexer/history/ClearCaseRepository.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,33 +59,13 @@ public class ClearCaseRepository extends Repository {
5959
*/
6060
public static final String CMD_FALLBACK = "cleartool";
6161

62-
private boolean verbose;
63-
6462
public ClearCaseRepository() {
6563
type = "ClearCase";
6664
datePatterns = new String[]{
6765
"yyyyMMdd.HHmmss"
6866
};
6967
}
7068

71-
/**
72-
* Use verbose log messages, or just the summary
73-
*
74-
* @return true if verbose log messages are used for this repository
75-
*/
76-
public boolean isVerbose() {
77-
return verbose;
78-
}
79-
80-
/**
81-
* Specify if verbose log messages or just the summary should be used
82-
*
83-
* @param verbose set to true if verbose messages should be used
84-
*/
85-
public void setVerbose(boolean verbose) {
86-
this.verbose = verbose;
87-
}
88-
8969
/**
9070
* Get an executor to be used for retrieving the history log for the named
9171
* file.

opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryGuru.java

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,8 @@ private Collection<RepositoryInfo> addRepositories(File[] files,
413413
}
414414
}
415415
} else {
416-
if (RuntimeEnvironment.getInstance().isVerbose()) {
417-
LOGGER.log(Level.CONFIG, "Adding <{0}> repository: <{1}>",
418-
new Object[]{repository.getClass().getName(), path});
419-
}
416+
LOGGER.log(Level.CONFIG, "Adding <{0}> repository: <{1}>",
417+
new Object[]{repository.getClass().getName(), path});
420418

421419
repoList.add(new RepositoryInfo(repository));
422420
putRepository(repository);
@@ -497,19 +495,15 @@ public Collection<RepositoryInfo> getRepositories() {
497495
* Update the source contents in all repositories.
498496
*/
499497
public void updateRepositories() {
500-
boolean verbose = RuntimeEnvironment.getInstance().isVerbose();
501-
502498
for (Map.Entry<String, Repository> entry : repositories.entrySet()) {
503499
Repository repository = entry.getValue();
504500

505501
String path = entry.getKey();
506502
String type = repository.getClass().getSimpleName();
507503

508504
if (repository.isWorking()) {
509-
if (verbose) {
510-
LOGGER.info(String.format("Update %s repository in %s",
511-
type, path));
512-
}
505+
LOGGER.info(String.format("Update %s repository in %s",
506+
type, path));
513507

514508
try {
515509
repository.update();
@@ -533,18 +527,14 @@ public void updateRepositories() {
533527
* @param paths A list of files/directories to update
534528
*/
535529
public void updateRepositories(Collection<String> paths) {
536-
boolean verbose = RuntimeEnvironment.getInstance().isVerbose();
537-
538530
List<Repository> repos = getReposFromString(paths);
539531

540532
for (Repository repository : repos) {
541533
String type = repository.getClass().getSimpleName();
542534

543535
if (repository.isWorking()) {
544-
if (verbose) {
545-
LOGGER.info(String.format("Update %s repository in %s", type,
546-
repository.getDirectoryName()));
547-
}
536+
LOGGER.info(String.format("Update %s repository in %s", type,
537+
repository.getDirectoryName()));
548538

549539
try {
550540
repository.update();
@@ -575,13 +565,10 @@ private void createCache(Repository repository, String sinceRevision) {
575565
}
576566

577567
if (repository.isWorking()) {
578-
boolean verbose = RuntimeEnvironment.getInstance().isVerbose();
579568
Statistics elapsed = new Statistics();
580569

581-
if (verbose) {
582-
LOGGER.log(Level.INFO, "Creating historycache for {0} ({1})",
583-
new Object[]{path, type});
584-
}
570+
LOGGER.log(Level.INFO, "Creating historycache for {0} ({1})",
571+
new Object[]{path, type});
585572

586573
try {
587574
repository.createCache(historyCache, sinceRevision);
@@ -591,9 +578,7 @@ private void createCache(Repository repository, String sinceRevision) {
591578
+ type + ")", e);
592579
}
593580

594-
if (verbose) {
595-
elapsed.report(LOGGER, "Done historycache for " + path);
596-
}
581+
elapsed.report(LOGGER, "Done historycache for " + path);
597582
} else {
598583
LOGGER.log(Level.WARNING,
599584
"Skipping creation of historycache of {0} repository in {1}: Missing SCM dependencies?",
@@ -935,11 +920,8 @@ public void invalidateRepositories(Collection<? extends RepositoryInfo> repos, b
935920
Map<String, Repository> newrepos =
936921
Collections.synchronizedMap(new HashMap<>(repos.size()));
937922
Statistics elapsed = new Statistics();
938-
boolean verbose = RuntimeEnvironment.getInstance().isVerbose();
939923

940-
if (verbose) {
941-
LOGGER.log(Level.FINE, "invalidating {0} repositories", repos.size());
942-
}
924+
LOGGER.log(Level.FINE, "invalidating {0} repositories", repos.size());
943925

944926
/*
945927
* getRepository() below does various checks of the repository
@@ -994,9 +976,7 @@ public void run() {
994976
repositories.clear();
995977
newrepos.forEach((_key, repo) -> { putRepository(repo); });
996978

997-
if (verbose) {
998-
elapsed.report(LOGGER, "done invalidating repositories");
999-
}
979+
elapsed.report(LOGGER, "done invalidating repositories");
1000980
}
1001981

1002982
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public final class Indexer {
105105
private static String host = null;
106106

107107
private static OptionParser optParser = null;
108+
private static boolean verbose = false;
108109

109110
public static Indexer getInstance() {
110111
return index;
@@ -164,7 +165,7 @@ public static void main(String argv[]) {
164165
}
165166

166167
// Logging starts here.
167-
if (cfg.isVerbose()) {
168+
if (verbose) {
168169
String fn = LoggerUtil.getFileHandlerPattern();
169170
if (fn != null) {
170171
System.out.println("Logging filehandler pattern: " + fn);
@@ -639,7 +640,6 @@ public static String[] parseOptions(String[] argv) throws ParseException {
639640
});
640641

641642
parser.on("-q", "--quiet", "Run as quietly as possible.").Do( v -> {
642-
cfg.setVerbose(false);
643643
LoggerUtil.setBaseConsoleLogLevel(Level.WARNING);
644644
});
645645

@@ -758,7 +758,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
758758
});
759759

760760
parser.on("-v", "--verbose", "Print progress information as we go along.").Do( v -> {
761-
cfg.setVerbose(true);
761+
verbose = true;
762762
LoggerUtil.setBaseConsoleLogLevel(Level.INFO);
763763
});
764764

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JarAnalyzerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public static void setUpClass() throws Exception {
8181
env.setDataRoot(repository.getDataRoot());
8282
RepositoryFactory.initializeIgnoredNames(env);
8383

84-
env.setVerbose(false);
8584
env.setHistoryEnabled(false);
8685
IndexChangedListener progress = new DefaultIndexChangedListener();
8786
Indexer.getInstance().prepareIndexer(env, true, true,

opengrok-indexer/src/test/java/org/opengrok/indexer/configuration/RuntimeEnvironmentTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,6 @@ public void testRamBufferSize() {
293293
assertEquals(256, instance.getRamBufferSize(), 0);
294294
}
295295

296-
@Test
297-
public void testVerbose() {
298-
RuntimeEnvironment instance = RuntimeEnvironment.getInstance();
299-
assertFalse(instance.isVerbose());
300-
instance.setVerbose(true);
301-
assertTrue(instance.isVerbose());
302-
}
303-
304296
@Test
305297
public void testAllowLeadingWildcard() {
306298
RuntimeEnvironment instance = RuntimeEnvironment.getInstance();

opengrok-indexer/src/test/java/org/opengrok/indexer/history/HistoryGuruTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ public static void setUpClass() throws Exception {
7070
FILES, true);
7171
Assert.assertNotEquals(0, FILES.size());
7272

73-
env.setVerbose(true);
74-
7573
HistoryGuru histGuru = HistoryGuru.getInstance();
7674
assertNotNull(histGuru);
7775
Assert.assertEquals(0, histGuru.getRepositories().size());

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexVersionTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public void tearDown() throws IOException {
8888
* @throws Exception
8989
*/
9090
private void testIndexVersion(boolean projectsEnabled, List<String> subFiles) throws Exception {
91-
env.setVerbose(true);
9291
env.setHistoryEnabled(false);
9392
env.setProjectsEnabled(projectsEnabled);
9493
Indexer.getInstance().prepareIndexer(env, true, true, null,

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ public void testIndexGeneration() throws Exception {
117117
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
118118
env.setSourceRoot(repository.getSourceRoot());
119119
env.setDataRoot(repository.getDataRoot());
120-
env.setVerbose(true);
121120
env.setHistoryEnabled(false);
122121
Indexer.getInstance().prepareIndexer(env, true, true, new TreeSet<>(Collections.singletonList("/c")),
123122
false, false, null, null, new ArrayList<>(), false);

0 commit comments

Comments
 (0)