Skip to content

Commit 39acf07

Browse files
committed
Replace "String.length()" == 0 with "String.isEmpty()".
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1586504 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0986e79 commit 39acf07

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/org/apache/commons/io/ByteOrderMark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class ByteOrderMark implements Serializable {
7474
* length
7575
*/
7676
public ByteOrderMark(final String charsetName, final int... bytes) {
77-
if (charsetName == null || charsetName.length() == 0) {
77+
if (charsetName == null || charsetName.isEmpty()) {
7878
throw new IllegalArgumentException("No charsetName specified");
7979
}
8080
if (bytes == null || bytes.length == 0) {

src/main/java/org/apache/commons/io/FileSystemUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ long parseDir(final String line, final String path) throws IOException {
378378
* @throws IOException if an error occurs
379379
*/
380380
long freeSpaceUnix(final String path, final boolean kb, final boolean posix, final long timeout) throws IOException {
381-
if (path.length() == 0) {
381+
if (path.isEmpty()) {
382382
throw new IllegalArgumentException("Path must not be empty");
383383
}
384384

src/main/java/org/apache/commons/io/FilenameUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ public static boolean isExtension(final String filename, final String extension)
11561156
if (filename == null) {
11571157
return false;
11581158
}
1159-
if (extension == null || extension.length() == 0) {
1159+
if (extension == null || extension.isEmpty()) {
11601160
return indexOfExtension(filename) == NOT_FOUND;
11611161
}
11621162
final String fileExt = getExtension(filename);

src/main/java/org/apache/commons/io/filefilter/MagicNumberFileFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public MagicNumberFileFilter(final String magicNumber, final long offset) {
163163
if (magicNumber == null) {
164164
throw new IllegalArgumentException("The magic number cannot be null");
165165
}
166-
if (magicNumber.length() == 0) {
166+
if (magicNumber.isEmpty()) {
167167
throw new IllegalArgumentException("The magic number must contain at least one byte");
168168
}
169169
if (offset < 0) {

0 commit comments

Comments
 (0)