Skip to content

Commit b07738a

Browse files
plamentotevmichael-o
authored andcommitted
Remove the pre-Java 7 code related to the file attributes
The classes related to file attributes are depending on features introduced in Java 7. To support Java version prior to 7, plexus IO uses reflection check to choose between two different implementations. The legacy one that parses the output from the `ls` command and the Java 7 one that is pure Java. Because now Java 7 is the minimum required version, remove all the reflection Java version checks and remove any legacy code that executes only for Java versions below 7. There were two version of `FileAttributes` - `FileAttributes` and `Java7FileAttributes`. Remove the legacy `FileAttributes` and rename `Java7FileAttributes` to `FileAttributes`. Rename `Java7AttributeUtils` to `AttributeUtils` as there is no longer Java version specific implementations for attributes related classes. NOTE: The commit diff shows `FileAttributes` as changed but it's actually deleted and `Java7FileAttributes` is renamed to `FileAttributes`. The same goes for `FileAttributesTest` and `Java7FileAttributesTest` Also remove `PlexusIoResourceAttributeUtils#getFileAttributesByPath( File dir, boolean recursive, boolean includeNumericUserId )`. `includeNumericUserId` is related to the `ls` command and is no longer needed. Update the tests. Delete no longer needed resources and tests. All tests and resources related to the `ls` output parsing are no longer needed. Also replace `PlexusIoResourceAttributeUtilsTest#testPermissionDenied` with `testNonExistingDirectory` - when directory is missing we no longer get `cannot access` response from the `ls` command and the new test method name is more suitable. This closes #5
1 parent 2bbfb10 commit b07738a

31 files changed

+217
-4379
lines changed

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

-233
This file was deleted.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/**
3434
* @author Kristian Rosenvold
3535
*/
36-
public class Java7AttributeUtils
36+
public class AttributeUtils
3737
{
3838
/*
3939
Reads last-modified with proper failure handling if something goes wrong.
@@ -65,7 +65,7 @@ public static void chmod( @Nonnull File file, int mode )
6565
@Nonnull
6666
public static Set<PosixFilePermission> getPermissions( int mode )
6767
{
68-
Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>();
68+
Set<PosixFilePermission> perms = new HashSet<>();
6969
//add owners permission
7070
if ( ( mode & 0400 ) > 0 )
7171
{

0 commit comments

Comments
 (0)