File tree Expand file tree Collapse file tree 4 files changed +19
-32
lines changed
opengrok-indexer/src/main/java/org/opengrok/indexer/index Expand file tree Collapse file tree 4 files changed +19
-32
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public class Filter implements Serializable {
4646 * The full list of all patterns. This list will be saved in the
4747 * configuration file (if used).
4848 */
49- private final List < String > items ;
49+ private final PatternList items ;
5050
5151 public Filter () {
5252 filenames = new HashSet <>();
@@ -154,7 +154,7 @@ public boolean match(File file) {
154154 * @return true if this pathname matches, false otherwise
155155 */
156156 public boolean match (String name ) {
157- /**
157+ /*
158158 * Creating File object out of relative path would mean the path would be
159159 * checked against current working directory which is usually undesired.
160160 */
Original file line number Diff line number Diff line change 1919
2020/*
2121 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
22+ * Portions Copyright (c) 2019, Chris Fraire <[email protected] >. 2223 */
2324package org .opengrok .indexer .index ;
2425
@@ -45,21 +46,14 @@ public IgnoredDirs() {
4546 }
4647
4748 /**
48- * Should the file be ignored or not?
49- * @param file the file to check
50- * @return true if this file should be ignored, false otherwise
49+ * Should the file (that must be a directory) be ignored or not?
50+ * @return {@code true} if {@code file} has
51+ * {@link File#isDirectory()} () == true} and should be ignored per
52+ * filtering
5153 */
52- public boolean ignore (File file ) {
53- return file .isDirectory () && match (file );
54- }
55-
56- /**
57- * Should the file be ignored or not?
58- * @param name the name of the file to check
59- * @return true if this pathname should be ignored, false otherwise
60- */
61- public boolean ignore (String name ) {
62- return match (name );
54+ @ Override
55+ public boolean match (File file ) {
56+ return file .isDirectory () && super .match (file );
6357 }
6458
6559 private void addDefaultPatterns () {
Original file line number Diff line number Diff line change 1919
2020/*
2121 * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
22+ * Portions Copyright (c) 2019, Chris Fraire <[email protected] >. 2223 */
2324package org .opengrok .indexer .index ;
2425
@@ -67,20 +68,12 @@ public IgnoredFiles() {
6768
6869 /**
6970 * Should the file be ignored or not?
70- * @param file the file to check
71- * @return true if this file should be ignored, false otherwise
71+ * @return {@code true} if {@code file} has {@link File#isFile() == true}
72+ * and should be ignored per filtering
7273 */
73- public boolean ignore (File file ) {
74- return file .isFile () && match (file );
75- }
76-
77- /**
78- * Should the file be ignored or not?
79- * @param name the name of the file to check
80- * @return true if this pathname should be ignored, false otherwise
81- */
82- public boolean ignore (String name ) {
83- return match (name );
74+ @ Override
75+ public boolean match (File file ) {
76+ return file .isFile () && super .match (file );
8477 }
8578
8679 private void addDefaultPatterns () {
Original file line number Diff line number Diff line change @@ -79,9 +79,9 @@ public void add(String pattern) {
7979 */
8080 public boolean ignore (File file ) {
8181 if (file .isFile ()) {
82- return ignoredFiles .ignore (file );
82+ return ignoredFiles .match (file );
8383 } else {
84- return ignoredDirs .ignore (file );
84+ return ignoredDirs .match (file );
8585 }
8686 }
8787
@@ -92,7 +92,7 @@ public boolean ignore(File file) {
9292 * @return true if this pathname should be ignored, false otherwise
9393 */
9494 public boolean ignore (String name ) {
95- return ignoredFiles .ignore (name ) || ignoredDirs .ignore (name );
95+ return ignoredFiles .match (name ) || ignoredDirs .match (name );
9696 }
9797
9898 public void clear () {
You can’t perform that action at this time.
0 commit comments