Skip to content

Commit 0e03ea5

Browse files
committed
Reformat code
1 parent 8c1e78f commit 0e03ea5

File tree

71 files changed

+1901
-2795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1901
-2795
lines changed

pom.xml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34

@@ -15,8 +16,8 @@
1516
<scm>
1617
<connection>scm:git:[email protected]:codehaus-plexus/plexus-io.git</connection>
1718
<developerConnection>scm:git:[email protected]:codehaus-plexus/plexus-io.git</developerConnection>
18-
<url>http://github.com/codehaus-plexus/plexus-io</url>
1919
<tag>HEAD</tag>
20+
<url>http://github.com/codehaus-plexus/plexus-io</url>
2021
</scm>
2122
<issueManagement>
2223
<system>jira</system>
@@ -122,15 +123,17 @@
122123
<groupId>org.apache.maven.plugins</groupId>
123124
<artifactId>maven-scm-publish-plugin</artifactId>
124125
<configuration>
125-
<content>${project.reporting.outputDirectory}</content><!-- mono-module doesn't require site:stage -->
126+
<content>${project.reporting.outputDirectory}</content>
127+
<!-- mono-module doesn't require site:stage -->
126128
</configuration>
127129
<executions>
128130
<execution>
129131
<id>scm-publish</id>
130-
<phase>site-deploy</phase><!-- deploy site with maven-scm-publish-plugin -->
132+
<!-- deploy site with maven-scm-publish-plugin -->
131133
<goals>
132134
<goal>publish-scm</goal>
133135
</goals>
136+
<phase>site-deploy</phase>
134137
</execution>
135138
</executions>
136139
</plugin>
@@ -147,10 +150,10 @@
147150
<executions>
148151
<execution>
149152
<id>enforce-java</id>
150-
<phase>validate</phase>
151153
<goals>
152154
<goal>enforce</goal>
153155
</goals>
156+
<phase>validate</phase>
154157
<configuration>
155158
<rules>
156159
<requireJavaVersion>
@@ -165,22 +168,22 @@
165168
<groupId>org.codehaus.mojo</groupId>
166169
<artifactId>animal-sniffer-maven-plugin</artifactId>
167170
<version>1.23</version>
171+
<configuration>
172+
<signature>
173+
<groupId>org.codehaus.mojo.signature</groupId>
174+
<artifactId>java18</artifactId>
175+
<version>1.0</version>
176+
</signature>
177+
</configuration>
168178
<executions>
169179
<execution>
170180
<id>sniff</id>
171-
<phase>test</phase>
172181
<goals>
173182
<goal>check</goal>
174183
</goals>
184+
<phase>test</phase>
175185
</execution>
176186
</executions>
177-
<configuration>
178-
<signature>
179-
<groupId>org.codehaus.mojo.signature</groupId>
180-
<artifactId>java18</artifactId>
181-
<version>1.0</version>
182-
</signature>
183-
</configuration>
184187
</plugin>
185188
<plugin>
186189
<groupId>org.apache.maven.plugins</groupId>

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
public final class AttributeConstants
20-
{
19+
public final class AttributeConstants {
2120

2221
public static final int OCTAL_OWNER_READ = 0400;
2322

@@ -37,8 +36,5 @@ public final class AttributeConstants
3736

3837
public static final int OCTAL_WORLD_EXECUTE = 01;
3938

40-
private AttributeConstants()
41-
{
42-
}
43-
44-
}
39+
private AttributeConstants() {}
40+
}

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

Lines changed: 47 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package org.codehaus.plexus.components.io.attributes;
1717

18+
import javax.annotation.Nonnull;
19+
import javax.annotation.Nullable;
20+
1821
import java.io.File;
1922
import java.io.IOException;
2023
import java.nio.file.Files;
@@ -27,134 +30,96 @@
2730
import java.util.HashSet;
2831
import java.util.Set;
2932

30-
import javax.annotation.Nonnull;
31-
import javax.annotation.Nullable;
32-
3333
/**
3434
* @author Kristian Rosenvold
3535
*/
36-
public class AttributeUtils
37-
{
36+
public class AttributeUtils {
3837
/*
3938
Reads last-modified with proper failure handling if something goes wrong.
4039
*/
41-
public static long getLastModified( @Nonnull File file )
42-
{
43-
try
44-
{
45-
BasicFileAttributes basicFileAttributes = Files.readAttributes( file.toPath(), BasicFileAttributes.class );
40+
public static long getLastModified(@Nonnull File file) {
41+
try {
42+
BasicFileAttributes basicFileAttributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
4643
return basicFileAttributes.lastModifiedTime().toMillis();
44+
} catch (IOException e) {
45+
throw new RuntimeException(e);
4746
}
48-
catch ( IOException e )
49-
{
50-
throw new RuntimeException( e );
51-
}
52-
5347
}
5448

55-
public static void chmod( @Nonnull File file, int mode )
56-
throws IOException
57-
{
49+
public static void chmod(@Nonnull File file, int mode) throws IOException {
5850
final Path path = file.toPath();
59-
if ( !Files.isSymbolicLink( path ) )
60-
{
61-
Files.setPosixFilePermissions( path, getPermissions( mode ) );
51+
if (!Files.isSymbolicLink(path)) {
52+
Files.setPosixFilePermissions(path, getPermissions(mode));
6253
}
6354
}
6455

6556
@Nonnull
66-
public static Set<PosixFilePermission> getPermissions( int mode )
67-
{
57+
public static Set<PosixFilePermission> getPermissions(int mode) {
6858
Set<PosixFilePermission> perms = new HashSet<>();
6959
// add owners permission
70-
if ( ( mode & 0400 ) > 0 )
71-
{
72-
perms.add( PosixFilePermission.OWNER_READ );
60+
if ((mode & 0400) > 0) {
61+
perms.add(PosixFilePermission.OWNER_READ);
7362
}
74-
if ( ( mode & 0200 ) > 0 )
75-
{
76-
perms.add( PosixFilePermission.OWNER_WRITE );
63+
if ((mode & 0200) > 0) {
64+
perms.add(PosixFilePermission.OWNER_WRITE);
7765
}
78-
if ( ( mode & 0100 ) > 0 )
79-
{
80-
perms.add( PosixFilePermission.OWNER_EXECUTE );
66+
if ((mode & 0100) > 0) {
67+
perms.add(PosixFilePermission.OWNER_EXECUTE);
8168
}
8269
// add group permissions
83-
if ( ( mode & 0040 ) > 0 )
84-
{
85-
perms.add( PosixFilePermission.GROUP_READ );
70+
if ((mode & 0040) > 0) {
71+
perms.add(PosixFilePermission.GROUP_READ);
8672
}
87-
if ( ( mode & 0020 ) > 0 )
88-
{
89-
perms.add( PosixFilePermission.GROUP_WRITE );
73+
if ((mode & 0020) > 0) {
74+
perms.add(PosixFilePermission.GROUP_WRITE);
9075
}
91-
if ( ( mode & 0010 ) > 0 )
92-
{
93-
perms.add( PosixFilePermission.GROUP_EXECUTE );
76+
if ((mode & 0010) > 0) {
77+
perms.add(PosixFilePermission.GROUP_EXECUTE);
9478
}
9579
// add others permissions
96-
if ( ( mode & 0004 ) > 0 )
97-
{
98-
perms.add( PosixFilePermission.OTHERS_READ );
80+
if ((mode & 0004) > 0) {
81+
perms.add(PosixFilePermission.OTHERS_READ);
9982
}
100-
if ( ( mode & 0002 ) > 0 )
101-
{
102-
perms.add( PosixFilePermission.OTHERS_WRITE );
83+
if ((mode & 0002) > 0) {
84+
perms.add(PosixFilePermission.OTHERS_WRITE);
10385
}
104-
if ( ( mode & 0001 ) > 0 )
105-
{
106-
perms.add( PosixFilePermission.OTHERS_EXECUTE );
86+
if ((mode & 0001) > 0) {
87+
perms.add(PosixFilePermission.OTHERS_EXECUTE);
10788
}
10889
return perms;
10990
}
11091

11192
@Nonnull
112-
public static PosixFileAttributes getPosixFileAttributes( @Nonnull File file )
113-
throws IOException
114-
{
115-
return Files.readAttributes( file.toPath(), PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS );
93+
public static PosixFileAttributes getPosixFileAttributes(@Nonnull File file) throws IOException {
94+
return Files.readAttributes(file.toPath(), PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
11695
}
11796

11897
@Nonnull
119-
public static BasicFileAttributes getFileAttributes( @Nonnull File file )
120-
throws IOException
121-
{
122-
return getFileAttributes( file.toPath() );
98+
public static BasicFileAttributes getFileAttributes(@Nonnull File file) throws IOException {
99+
return getFileAttributes(file.toPath());
123100
}
124101

125-
public static BasicFileAttributes getFileAttributes( Path path )
126-
throws IOException
127-
{
128-
if ( isUnix( path ) )
129-
{
102+
public static BasicFileAttributes getFileAttributes(Path path) throws IOException {
103+
if (isUnix(path)) {
130104

131-
try
132-
{
133-
return Files.readAttributes( path, PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS );
134-
}
135-
catch ( UnsupportedOperationException ignore )
136-
{
105+
try {
106+
return Files.readAttributes(path, PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
107+
} catch (UnsupportedOperationException ignore) {
137108
// Maybe ignoring is dramatic. Maybe not. But we do get the basic attrs anyway
138109
}
139110
}
140-
return Files.readAttributes( path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS );
111+
return Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
141112
}
142113

143-
public static boolean isUnix( Path path )
144-
{
145-
return path.getFileSystem().supportedFileAttributeViews().contains( "unix" );
114+
public static boolean isUnix(Path path) {
115+
return path.getFileSystem().supportedFileAttributeViews().contains("unix");
146116
}
147117

148118
@Nullable
149-
public static FileOwnerAttributeView getFileOwnershipInfo( @Nonnull File file )
150-
throws IOException
151-
{
152-
try
153-
{
154-
return Files.getFileAttributeView( file.toPath(), FileOwnerAttributeView.class, LinkOption.NOFOLLOW_LINKS );
155-
}
156-
catch ( UnsupportedOperationException e )
157-
{
119+
public static FileOwnerAttributeView getFileOwnershipInfo(@Nonnull File file) throws IOException {
120+
try {
121+
return Files.getFileAttributeView(file.toPath(), FileOwnerAttributeView.class, LinkOption.NOFOLLOW_LINKS);
122+
} catch (UnsupportedOperationException e) {
158123
return null;
159124
}
160125
}

0 commit comments

Comments
 (0)