@@ -97,7 +97,7 @@ public NameFileFilter(final List<String> names, final IOCase caseSensitivity) {
9797 throw new IllegalArgumentException ("The list of names must not be null" );
9898 }
9999 this .names = names .toArray (EMPTY_STRING_ARRAY );
100- this .caseSensitivity = caseSensitivity == null ? IOCase . SENSITIVE : caseSensitivity ;
100+ this .caseSensitivity = toIOCase ( caseSensitivity ) ;
101101 }
102102
103103 /**
@@ -107,20 +107,21 @@ public NameFileFilter(final List<String> names, final IOCase caseSensitivity) {
107107 * @throws IllegalArgumentException if the name is null
108108 */
109109 public NameFileFilter (final String name ) {
110- this (name , null );
110+ this (name , IOCase . SENSITIVE );
111111 }
112112
113113 /**
114114 * Constructs a new case-sensitive name file filter for an array of names.
115115 * <p>
116116 * The array is not cloned, so could be changed after constructing the
117117 * instance. This would be inadvisable however.
118+ * </p>
118119 *
119120 * @param names the names to allow, must not be null
120121 * @throws IllegalArgumentException if the names array is null
121122 */
122123 public NameFileFilter (final String ... names ) {
123- this (names , null );
124+ this (names , IOCase . SENSITIVE );
124125 }
125126
126127 /**
@@ -135,7 +136,7 @@ public NameFileFilter(final String name, final IOCase caseSensitivity) {
135136 throw new IllegalArgumentException ("The wildcard must not be null" );
136137 }
137138 this .names = new String [] {name };
138- this .caseSensitivity = caseSensitivity == null ? IOCase . SENSITIVE : caseSensitivity ;
139+ this .caseSensitivity = toIOCase ( caseSensitivity ) ;
139140 }
140141
141142 /**
@@ -151,7 +152,7 @@ public NameFileFilter(final String[] names, final IOCase caseSensitivity) {
151152 }
152153 this .names = new String [names .length ];
153154 System .arraycopy (names , 0 , this .names , 0 , names .length );
154- this .caseSensitivity = caseSensitivity == null ? IOCase . SENSITIVE : caseSensitivity ;
155+ this .caseSensitivity = toIOCase ( caseSensitivity ) ;
155156 }
156157
157158 /**
@@ -198,6 +199,10 @@ private boolean acceptBaseName(final String baseName) {
198199 return false ;
199200 }
200201
202+ private IOCase toIOCase (final IOCase caseSensitivity ) {
203+ return caseSensitivity == null ? IOCase .SENSITIVE : caseSensitivity ;
204+ }
205+
201206 /**
202207 * Provide a String representation of this file filter.
203208 *
0 commit comments