Skip to content

Commit dc763ac

Browse files
committed
Reformatted code to code style, removed superfluous log statement
1 parent 6e4a658 commit dc763ac

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

src/main/java/org/codehaus/plexus/archiver/dir/DirectoryArchiver.java

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
import org.codehaus.plexus.archiver.ArchiveEntry;
2121
import org.codehaus.plexus.archiver.ArchiverException;
2222
import org.codehaus.plexus.archiver.ResourceIterator;
23+
import org.codehaus.plexus.archiver.UnixStat;
2324
import org.codehaus.plexus.archiver.util.ArchiveEntryUtils;
2425
import org.codehaus.plexus.archiver.util.ResourceUtils;
25-
import org.codehaus.plexus.archiver.UnixStat;
2626
import org.codehaus.plexus.components.io.attributes.SymlinkUtils;
2727
import org.codehaus.plexus.components.io.functions.SymlinkDestinationSupplier;
2828
import org.codehaus.plexus.components.io.resources.PlexusIoResource;
2929

30-
import java.nio.file.Path;
31-
import java.nio.file.Paths;
3230
import java.io.File;
3331
import java.io.IOException;
3432

@@ -85,12 +83,15 @@ public void execute()
8583
final String destDir = destDirectory.getCanonicalPath();
8684
fileName = destDir + File.separator + fileName;
8785
PlexusIoResource resource = f.getResource();
88-
if (resource instanceof SymlinkDestinationSupplier){
89-
String dest = ((SymlinkDestinationSupplier)resource).getSymlinkDestination();
90-
File target = new File(dest);
91-
SymlinkUtils.createSymbolicLink(new File(fileName), target);
92-
} else {
93-
copyFile(f, fileName);
86+
if ( resource instanceof SymlinkDestinationSupplier )
87+
{
88+
String dest = ( (SymlinkDestinationSupplier) resource ).getSymlinkDestination();
89+
File target = new File( dest );
90+
SymlinkUtils.createSymbolicLink( new File( fileName ), target );
91+
}
92+
else
93+
{
94+
copyFile( f, fileName );
9495
}
9596
}
9697
}
@@ -103,15 +104,12 @@ public void execute()
103104

104105
/**
105106
* Copies the specified file to the specified path, creating any ancestor directory structure as necessary.
106-
*
107-
* @param file
108-
* The file to copy (IOException will be thrown if this does not exist)
109-
* @param vPath
110-
* The fully qualified path to copy the file to.
111-
* @throws ArchiverException
112-
* If there is a problem creating the directory structure
113-
* @throws IOException
114-
* If there is a problem copying the file
107+
*
108+
* @param entry the entry top copy
109+
* The file to copy (IOException will be thrown if this does not exist)
110+
* @param vPath The fully qualified path to copy the file to.
111+
* @throws ArchiverException If there is a problem creating the directory structure
112+
* @throws IOException If there is a problem copying the file
115113
*/
116114
protected void copyFile( final ArchiveEntry entry, final String vPath )
117115
throws ArchiverException, IOException
@@ -153,8 +151,8 @@ protected void copyFile( final ArchiveEntry entry, final String vPath )
153151
{
154152
// should we just delete the file and replace it with a directory?
155153
// throw an exception, let the user delete the file manually.
156-
throw new ArchiverException( "Expected directory and found file at copy destination of "
157-
+ in.getName() + " to " + outFile );
154+
throw new ArchiverException(
155+
"Expected directory and found file at copy destination of " + in.getName() + " to " + outFile );
158156
}
159157
}
160158
else if ( !outFile.mkdirs() )
@@ -164,17 +162,14 @@ else if ( !outFile.mkdirs() )
164162
}
165163
}
166164

167-
if ( !isIgnorePermissions() )
168-
{
169-
// compute relative path
170-
String relative = outFile.getAbsolutePath().replaceFirst(getDestFile().getAbsolutePath(), ".");
171-
getLogger().info( "Set chmod " + Integer.toString( UnixStat.PERM_MASK & entry.getMode() ) + " for " + relative );
172-
// call chmod (java or system)
173-
ArchiveEntryUtils.chmod( outFile, entry.getMode(), getLogger(), isUseJvmChmod() );
174-
}
175-
176-
outFile.setLastModified( inLastModified == PlexusIoResource.UNKNOWN_MODIFICATION_DATE ? System.currentTimeMillis()
177-
: inLastModified );
165+
if ( !isIgnorePermissions() )
166+
{
167+
ArchiveEntryUtils.chmod( outFile, entry.getMode(), getLogger(), isUseJvmChmod() );
168+
}
169+
170+
outFile.setLastModified( inLastModified == PlexusIoResource.UNKNOWN_MODIFICATION_DATE
171+
? System.currentTimeMillis()
172+
: inLastModified );
178173
}
179174

180175
protected void cleanUp()

0 commit comments

Comments
 (0)