Skip to content

Commit 744f988

Browse files
committed
misc typos or little code improvements
1 parent 7865992 commit 744f988

11 files changed

+30
-26
lines changed

src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import org.codehaus.plexus.logging.Logger;
5151
import org.codehaus.plexus.logging.console.ConsoleLogger;
5252
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
53-
import org.codehaus.plexus.util.Os;
5453
import static org.codehaus.plexus.archiver.util.DefaultArchivedFileSet.archivedFileSet;
5554
import static org.codehaus.plexus.archiver.util.DefaultFileSet.fileSet;
5655

src/main/java/org/codehaus/plexus/archiver/Archiver.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ void addDirectory( @Nonnull File directory, String prefix )
9595
throws ArchiverException;
9696

9797
/**
98-
* Obsolete, use {@link #addFileSet(FileSet)}.You can use "inline" of this method in your
98+
* Obsolete, use {@link #addFileSet(FileSet)}.
99+
* You can use "inline" of this method in your
99100
* IDE to get the proper implementation for this release.
100101
*
101102
* @deprecated Will go away in next major version
@@ -141,7 +142,8 @@ void addFile( @Nonnull File inputFile, @Nonnull String destFileName, int permiss
141142
throws ArchiverException;
142143

143144
/**
144-
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}. You can use "inline" of this method in your
145+
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}.
146+
* You can use "inline" of this method in your
145147
* IDE to get the proper implementation for this release.
146148
*
147149
* @deprecated Will go away in next major version
@@ -150,7 +152,8 @@ void addArchivedFileSet( @Nonnull File archiveFile )
150152
throws ArchiverException;
151153

152154
/**
153-
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}. You can use "inline" of this method in your
155+
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}.
156+
* You can use "inline" of this method in your
154157
* IDE to get the proper implementation for this release.
155158
*
156159
* @deprecated Will go away in next major version
@@ -160,7 +163,8 @@ void addArchivedFileSet( @Nonnull File archiveFile, String prefix )
160163
throws ArchiverException;
161164

162165
/**
163-
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}. You can use "inline" of this method in your
166+
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}.
167+
* You can use "inline" of this method in your
164168
* IDE to get the proper implementation for this release.
165169
*
166170
* @deprecated Will go away in next major version
@@ -170,7 +174,8 @@ void addArchivedFileSet( File archiveFile, String[] includes, String[] excludes
170174
throws ArchiverException;
171175

172176
/**
173-
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}. You can use "inline" of this method in your
177+
* Obsolete, use {@link #addArchivedFileSet(ArchivedFileSet)}.
178+
* You can use "inline" of this method in your
174179
* IDE to get the proper implementation for this release.
175180
*
176181
* @deprecated Will go away in next major version
@@ -224,7 +229,7 @@ void addResource( PlexusIoResource resource, String destFileName, int permission
224229
/**
225230
* Adds the given resource collection to the archive.
226231
*
227-
* Stream transformers are supported om this method
232+
* Stream transformers are supported on this method
228233
*
229234
* @since 1.0-alpha-10
230235
*/
@@ -298,7 +303,7 @@ ResourceIterator getResources()
298303
* archiver should compare the timestamps of included files with the timestamp of the target archive and rebuild the
299304
* archive only, if the latter timestamp precedes the former timestamps. Checking for timestamps will typically
300305
* offer a performance gain (in particular, if the following steps in a build can be suppressed, if an archive isn't
301-
* recrated) on the cost that you get inaccurate results from time to time. In particular, removal of source files
306+
* recreated) on the cost that you get inaccurate results from time to time. In particular, removal of source files
302307
* won't be detected.
303308
* </p>
304309
* <p>
@@ -320,7 +325,7 @@ ResourceIterator getResources()
320325
* should compare the timestamps of included files with the timestamp of the target archive and rebuild the archive
321326
* only, if the latter timestamp precedes the former timestamps. Checking for timestamps will typically offer a
322327
* performance gain (in particular, if the following steps in a build can be suppressed, if an archive isn't
323-
* recrated) on the cost that you get inaccurate results from time to time. In particular, removal of source files
328+
* recreated) on the cost that you get inaccurate results from time to time. In particular, removal of source files
324329
* won't be detected.
325330
* </p>
326331
* <p>

src/main/java/org/codehaus/plexus/archiver/DotDirectiveArchiveFinalizer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ public void finalizeArchiveCreation( Archiver archiver )
4646
BufferedReader in = null;
4747
try
4848
{
49-
List dotFiles = FileUtils.getFiles( dotFileDirectory, dotFilePrefix + "*", null );
49+
List<File> dotFiles = FileUtils.getFiles( dotFileDirectory, dotFilePrefix + "*", null );
5050

51-
for ( Object dotFile1 : dotFiles )
51+
for ( File dotFile : dotFiles )
5252
{
53-
File dotFile = (File) dotFile1;
54-
5553
in = new BufferedReader( new FileReader( dotFile ) );
5654

5755
for ( String line = in.readLine(); line != null; line = in.readLine() )

src/main/java/org/codehaus/plexus/archiver/diags/TrackingArchiver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ ResourceIterator getResources()
278278
throw new RuntimeException( "Not implemented" );
279279
}
280280

281-
@SuppressWarnings( "rawtypes" )
282281
@Override
283282
public Map<String, ArchiveEntry> getFiles()
284283
{

src/main/java/org/codehaus/plexus/archiver/jar/JarArchiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ protected Manifest createManifest()
375375
private void writeManifest( ConcurrentJarCreator zOut, Manifest manifest )
376376
throws IOException, ArchiverException
377377
{
378-
for ( Enumeration e = manifest.getWarnings(); e.hasMoreElements(); )
378+
for ( Enumeration<String> e = manifest.getWarnings(); e.hasMoreElements(); )
379379
{
380380
getLogger().warn( "Manifest warning: " + e.nextElement() );
381381
}

src/main/java/org/codehaus/plexus/archiver/tar/PlexusIoTarFileResourceCollection.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.io.IOException;
2121
import java.util.Enumeration;
2222
import java.util.Iterator;
23+
24+
import org.apache.commons.compress.archivers.ArchiveEntry;
2325
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
2426
import org.codehaus.plexus.components.io.resources.AbstractPlexusIoArchiveResourceCollection;
2527
import org.codehaus.plexus.components.io.resources.PlexusIoResource;
@@ -69,7 +71,7 @@ protected Iterator<PlexusIoResource> getEntries()
6971
{
7072
tarFile = newTarFile( f );
7173
}
72-
final Enumeration en = tarFile.getEntries();
74+
final Enumeration<ArchiveEntry> en = tarFile.getEntries();
7375
return new Iterator<PlexusIoResource>()
7476
{
7577

src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipArchiver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.IOException;
2323
import java.io.InputStream;
2424
import java.io.OutputStream;
25-
import java.io.SequenceInputStream;
2625
import java.nio.ByteBuffer;
2726
import java.nio.charset.Charset;
2827
import java.util.Hashtable;

src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipUnArchiver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ protected void execute()
166166
try
167167
{
168168
zf = new org.apache.commons.compress.archivers.zip.ZipFile( getSourceFile(), encoding, true );
169-
final Enumeration e = zf.getEntriesInPhysicalOrder();
169+
final Enumeration<ZipArchiveEntry> e = zf.getEntriesInPhysicalOrder();
170170
while ( e.hasMoreElements() )
171171
{
172-
final ZipArchiveEntry ze = (ZipArchiveEntry) e.nextElement();
172+
final ZipArchiveEntry ze = e.nextElement();
173173
final ZipEntryFileInfo fileInfo = new ZipEntryFileInfo( zf, ze );
174174
if ( isSelected( fileInfo.getName(), fileInfo ) )
175175
{
@@ -232,11 +232,11 @@ protected void execute( final String path, final File outputDirectory )
232232
{
233233
zipFile = new org.apache.commons.compress.archivers.zip.ZipFile( getSourceFile(), encoding, true );
234234

235-
final Enumeration e = zipFile.getEntriesInPhysicalOrder();
235+
final Enumeration<ZipArchiveEntry> e = zipFile.getEntriesInPhysicalOrder();
236236

237237
while ( e.hasMoreElements() )
238238
{
239-
final ZipArchiveEntry ze = (ZipArchiveEntry) e.nextElement();
239+
final ZipArchiveEntry ze = e.nextElement();
240240
final ZipEntryFileInfo fileInfo = new ZipEntryFileInfo( zipFile, ze );
241241
if ( !isSelected( ze.getName(), fileInfo ) )
242242
{

src/main/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CloseableIterator
4747
implements Iterator<PlexusIoResource>, Closeable
4848
{
4949

50-
final Enumeration en;
50+
final Enumeration<ZipArchiveEntry> en;
5151

5252
private final ZipFile zipFile;
5353

@@ -66,7 +66,7 @@ public boolean hasNext()
6666
@Override
6767
public PlexusIoResource next()
6868
{
69-
final ZipArchiveEntry entry = (ZipArchiveEntry) en.nextElement();
69+
final ZipArchiveEntry entry = en.nextElement();
7070
return entry.isUnixSymlink()
7171
? new ZipSymlinkResource( zipFile, entry, getStreamTransformer() )
7272
: new ZipResource( zipFile, entry, getStreamTransformer() );

src/test/java/org/codehaus/plexus/archiver/BasePlexusArchiverTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
/**
3535
* Base abstract class that all the test-cases for different archivers
36-
* extend so that they can use its helpful methids.
36+
* extend so that they can use its helpful methods.
3737
*/
3838
public abstract class BasePlexusArchiverTest extends PlexusTestCase
3939
{

src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ public void testZipArchiver()
4545
org.apache.commons.compress.archivers.zip.ZipFile zf =
4646
new org.apache.commons.compress.archivers.zip.ZipFile( archive );
4747

48-
Enumeration e = zf.getEntries();
48+
Enumeration<ZipArchiveEntry> e = zf.getEntries();
4949
int entryCount = 0;
5050
while ( e.hasMoreElements() )
5151
{
52-
ZipArchiveEntry entry = (ZipArchiveEntry) e.nextElement();
52+
ZipArchiveEntry entry = e.nextElement();
5353
System.out.println( entry.getName() );
5454
entryCount++;
5555
}
56+
zf.close();
57+
5658
// Zip file should have 2 entries, 1 for the directory and one for foo.txt
5759
assertEquals( 2, entryCount );
5860
testArchive( archive, "zip" );

0 commit comments

Comments
 (0)