Skip to content

Commit 8d48781

Browse files
committed
Minor adjustments to pull #11
1 parent f713c5d commit 8d48781

File tree

4 files changed

+74
-21
lines changed

4 files changed

+74
-21
lines changed

Diff for: src/main/java/org/codehaus/plexus/archiver/tar/PlexusIoTarFileResourceCollection.java

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
package org.codehaus.plexus.archiver.tar;
2+
/*
3+
* Copyright 2010-2015 The plexus developers.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
217

318
import java.io.Closeable;
419
import java.io.File;
@@ -54,9 +69,9 @@ public boolean hasNext()
5469
public PlexusIoResource next()
5570
{
5671
final TarArchiveEntry entry = (TarArchiveEntry) en.nextElement();
57-
return !entry.isSymbolicLink()
58-
? new TarResource( tarFile, entry )
59-
: new TarSymlinkResource( tarFile, entry );
72+
return entry.isSymbolicLink()
73+
? new TarSymlinkResource( tarFile, entry )
74+
: new TarResource( tarFile, entry );
6075
}
6176

6277
public void remove()

Diff for: src/main/java/org/codehaus/plexus/archiver/tar/TarSymlinkResource.java

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
package org.codehaus.plexus.archiver.tar;
2-
3-
import java.io.IOException;
2+
/*
3+
* Copyright 2010-2015 The plexus developers.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
417

518
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
619
import org.codehaus.plexus.components.io.functions.SymlinkDestinationSupplier;
720

21+
import java.io.IOException;
22+
823
/**
924
* A {@link TarResource} that represents symbolic link.
1025
*/
@@ -14,18 +29,22 @@ public class TarSymlinkResource
1429
{
1530
private final String symlinkDestination;
1631

17-
public TarSymlinkResource(TarFile tarFile, TarArchiveEntry entry) {
18-
super(tarFile, entry);
32+
public TarSymlinkResource( TarFile tarFile, TarArchiveEntry entry )
33+
{
34+
super( tarFile, entry );
1935
symlinkDestination = entry.getLinkName();
2036
}
2137

2238
@Override
23-
public String getSymlinkDestination() throws IOException {
39+
public String getSymlinkDestination()
40+
throws IOException
41+
{
2442
return symlinkDestination;
2543
}
2644

2745
@Override
28-
public boolean isSymbolicLink() {
46+
public boolean isSymbolicLink()
47+
{
2948
return true;
3049
}
3150

Diff for: src/main/java/org/codehaus/plexus/archiver/zip/PlexusArchiverZipFileResourceCollection.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public PlexusIoResource next()
5757
{
5858
final ZipArchiveEntry entry = (ZipArchiveEntry) en.nextElement();
5959

60-
return !entry.isUnixSymlink()
61-
? new ZipResource( zipFile, entry, getStreamTransformer() )
62-
: new ZipSymlinkResource( zipFile, entry, getStreamTransformer() );
60+
return entry.isUnixSymlink()
61+
? new ZipSymlinkResource( zipFile, entry, getStreamTransformer() )
62+
: new ZipResource( zipFile, entry, getStreamTransformer() );
6363
}
6464

6565
public void remove()

Diff for: src/main/java/org/codehaus/plexus/archiver/zip/ZipSymlinkResource.java

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
package org.codehaus.plexus.archiver.zip;
2-
3-
import java.io.IOException;
2+
/*
3+
* Copyright 2010-2015 The plexus developers.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
417

518
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
619
import org.apache.commons.compress.archivers.zip.ZipFile;
720
import org.codehaus.plexus.components.io.functions.InputStreamTransformer;
821
import org.codehaus.plexus.components.io.functions.SymlinkDestinationSupplier;
922

23+
import java.io.IOException;
24+
1025
/**
1126
* A {@link ZipResource} that represents symbolic link.
1227
*/
@@ -16,18 +31,22 @@ public class ZipSymlinkResource
1631
{
1732
private final String symlinkDestination;
1833

19-
public ZipSymlinkResource(ZipFile zipFile, ZipArchiveEntry entry, InputStreamTransformer streamTransformer)
34+
public ZipSymlinkResource( ZipFile zipFile, ZipArchiveEntry entry, InputStreamTransformer streamTransformer )
2035
{
21-
super(zipFile, entry, streamTransformer);
22-
try {
23-
symlinkDestination = zipFile.getUnixSymlink(entry);
24-
} catch (IOException e) {
25-
throw new RuntimeException(e);
36+
super( zipFile, entry, streamTransformer );
37+
try
38+
{
39+
symlinkDestination = zipFile.getUnixSymlink( entry );
40+
}
41+
catch ( IOException e )
42+
{
43+
throw new RuntimeException( e );
2644
}
2745
}
2846

2947
@Override
30-
public String getSymlinkDestination() throws IOException
48+
public String getSymlinkDestination()
49+
throws IOException
3150
{
3251
return symlinkDestination;
3352
}

0 commit comments

Comments
 (0)