Skip to content

Commit f4f7aa1

Browse files
committed
Code cleanup
1 parent d3fbfc6 commit f4f7aa1

30 files changed

+89
-115
lines changed

src/main/java/org/codehaus/plexus/components/io/attributes/AttributeConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19+
@SuppressWarnings("OctalInteger")
1920
public final class AttributeConstants {
2021

2122
public static final int OCTAL_OWNER_READ = 0400;

src/main/java/org/codehaus/plexus/components/io/attributes/AttributeUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
/**
3434
* @author Kristian Rosenvold
3535
*/
36+
@SuppressWarnings("OctalInteger")
3637
public class AttributeUtils {
3738
/*
3839
Reads last-modified with proper failure handling if something goes wrong.
@@ -101,7 +102,6 @@ public static BasicFileAttributes getFileAttributes(@Nonnull File file) throws I
101102

102103
public static BasicFileAttributes getFileAttributes(Path path) throws IOException {
103104
if (isUnix(path)) {
104-
105105
try {
106106
return Files.readAttributes(path, PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
107107
} catch (UnsupportedOperationException ignore) {

src/main/java/org/codehaus/plexus/components/io/attributes/FileAttributes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ public FileAttributes(@Nonnull File file, boolean followLinks) throws IOExceptio
112112
this.octalMode = attrs.containsKey("mode")
113113
? (Integer) attrs.get("mode") & 0xfff
114114
: PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODE;
115+
//noinspection unchecked
115116
this.permissions = attrs.containsKey("permissions")
116117
? (Set<PosixFilePermission>) attrs.get("permissions")
117-
: Collections.<PosixFilePermission>emptySet();
118+
: Collections.emptySet();
118119
this.size = (Long) attrs.get("size");
119120
this.lastModifiedTime = (FileTime) attrs.get("lastModifiedTime");
120121
}

src/main/java/org/codehaus/plexus/components/io/attributes/PlexusIoResourceAttributes.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ public interface PlexusIoResourceAttributes {
7272
*/
7373
int getOctalMode();
7474

75-
// @Nonnull
76-
// String getOctalModeString();
77-
7875
/**
7976
* Indicates if this is a symbolic link element.
8077
* For file-based resource attributes this value may be always "false" for versions prior to java7.

src/main/java/org/codehaus/plexus/components/io/attributes/SymlinkUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ public class SymlinkUtils {
3535
* @throws java.io.IOException
3636
*/
3737
public static @Nonnull File readSymbolicLink(@Nonnull File symlink) throws IOException {
38-
final java.nio.file.Path path = java.nio.file.Files.readSymbolicLink(symlink.toPath());
39-
return path.toFile();
38+
return Files.readSymbolicLink(symlink.toPath()).toFile();
4039
}
4140

4241
public static @Nonnull File createSymbolicLink(@Nonnull File symlink, File target) throws IOException {
4342
Path link = symlink.toPath();
4443
if (!Files.exists(link, LinkOption.NOFOLLOW_LINKS)) {
45-
link = java.nio.file.Files.createSymbolicLink(link, target.toPath());
44+
link = Files.createSymbolicLink(link, target.toPath());
4645
}
4746
return link.toFile();
4847
}

src/main/java/org/codehaus/plexus/components/io/attributes/proxy/PlexusIoProxyResourceAttributes.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class PlexusIoProxyResourceAttributes implements PlexusIoResourceAttributes {
88

9-
PlexusIoResourceAttributes target;
9+
final PlexusIoResourceAttributes target;
1010

1111
public PlexusIoProxyResourceAttributes(PlexusIoResourceAttributes thisAttr) {
1212
this.target = thisAttr;
@@ -45,11 +45,6 @@ public Integer getUserId() {
4545
return target.getUserId();
4646
}
4747

48-
/* public String getOctalModeString()
49-
{
50-
return target.getOctalModeString();
51-
}
52-
*/
5348
public boolean isOwnerWritable() {
5449
return target.isOwnerWritable();
5550
}

src/main/java/org/codehaus/plexus/components/io/filemappers/AbstractFileMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public abstract class AbstractFileMapper implements FileMapper {
2929
* Checks the input and returns it without modifications.
3030
*/
3131
public @Nonnull String getMappedFileName(@Nonnull String pName) {
32-
if (pName == null || pName.length() == 0) {
32+
if (pName == null || pName.isEmpty()) {
3333
throw new IllegalArgumentException("The source name must not be null.");
3434
}
3535
return pName;

src/main/java/org/codehaus/plexus/components/io/filemappers/FileExtensionMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void setTargetExtension(String pTargetExtension) {
4242
if (pTargetExtension == null) {
4343
throw new IllegalArgumentException("The target extension is null.");
4444
}
45-
if (pTargetExtension.length() == 0) {
45+
if (pTargetExtension.isEmpty()) {
4646
throw new IllegalArgumentException("The target extension is empty.");
4747
}
4848
if (pTargetExtension.charAt(0) == '.') {

src/main/java/org/codehaus/plexus/components/io/filemappers/IdentityMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class IdentityMapper extends AbstractFileMapper {
3131

3232
@Nonnull
3333
public String getMappedFileName(@Nonnull String pName) {
34-
if (pName == null || pName.length() == 0) {
34+
if (pName == null || pName.isEmpty()) {
3535
throw new IllegalArgumentException("The source name must not be null.");
3636
}
3737
return pName;

src/main/java/org/codehaus/plexus/components/io/filemappers/MergeFileMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void setTargetName(String pName) {
4141
if (pName == null) {
4242
throw new IllegalArgumentException("The target name is null.");
4343
}
44-
if (pName.length() == 0) {
44+
if (pName.isEmpty()) {
4545
throw new IllegalArgumentException("The target name is empty.");
4646
}
4747
targetName = pName;

0 commit comments

Comments
 (0)