Skip to content

Commit 2ecffa3

Browse files
Updated to upgrade 'plexus-utils' to latest patch release.
This closes #40
1 parent 00e12b8 commit 2ecffa3

File tree

3 files changed

+45
-30
lines changed

3 files changed

+45
-30
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<dependency>
5252
<groupId>org.codehaus.plexus</groupId>
5353
<artifactId>plexus-utils</artifactId>
54-
<version>3.0.23</version>
54+
<version>3.0.24</version>
5555
</dependency>
5656
<dependency>
5757
<groupId>org.codehaus.plexus</groupId>

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

+23-15
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
import java.io.InputStream;
19+
import java.io.IOException;
2020
import java.util.Map;
2121
import java.util.Properties;
2222
import java.util.jar.Attributes;
@@ -33,25 +33,33 @@ class JdkManifestFactory
3333
public static java.util.jar.Manifest getDefaultManifest()
3434
throws ArchiverException
3535
{
36-
final java.util.jar.Manifest defaultManifest = new java.util.jar.Manifest();
37-
defaultManifest.getMainAttributes().putValue( "Manifest-Version", "1.0" );
36+
try
37+
{
38+
final java.util.jar.Manifest defaultManifest = new java.util.jar.Manifest();
39+
defaultManifest.getMainAttributes().putValue( "Manifest-Version", "1.0" );
3840

39-
String createdBy = "Plexus Archiver";
41+
String createdBy = "Plexus Archiver";
4042

41-
InputStream inputStream = JdkManifestFactory.class.getResourceAsStream( "/META-INF/"
42-
+ "maven/org.codehaus.plexus/plexus-archiver/pom.properties" );
43-
Properties properties = PropertyUtils.loadProperties( inputStream );
44-
if ( properties != null )
45-
{
46-
String plexusArchiverVersion = properties.getProperty( "version" );
47-
if ( plexusArchiverVersion != null )
43+
final Properties properties = PropertyUtils.loadProperties( JdkManifestFactory.class.getResourceAsStream(
44+
"/META-INF/maven/org.codehaus.plexus/plexus-archiver/pom.properties" ) );
45+
46+
if ( properties != null )
4847
{
49-
createdBy += " " + plexusArchiverVersion;
48+
String plexusArchiverVersion = properties.getProperty( "version" );
49+
if ( plexusArchiverVersion != null )
50+
{
51+
createdBy += " " + plexusArchiverVersion;
52+
}
5053
}
51-
}
52-
defaultManifest.getMainAttributes().putValue( "Created-By", createdBy );
5354

54-
return defaultManifest;
55+
defaultManifest.getMainAttributes().putValue( "Created-By", createdBy );
56+
57+
return defaultManifest;
58+
}
59+
catch ( final IOException e )
60+
{
61+
throw new ArchiverException( "Failure reading default manifest.", e );
62+
}
5563
}
5664

5765
public static void merge( java.util.jar.Manifest target, java.util.jar.Manifest other, boolean overwriteMain )

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

+21-14
Original file line numberDiff line numberDiff line change
@@ -735,25 +735,32 @@ public Iterator<String> iterator()
735735
public static Manifest getDefaultManifest()
736736
throws ArchiverException
737737
{
738-
final Manifest defaultManifest = new Manifest();
739-
defaultManifest.getMainAttributes().putValue( "Manifest-Version", "1.0" );
738+
try
739+
{
740+
final Manifest defaultManifest = new Manifest();
741+
defaultManifest.getMainAttributes().putValue( "Manifest-Version", "1.0" );
740742

741-
String createdBy = "Plexus Archiver";
743+
String createdBy = "Plexus Archiver";
742744

743-
InputStream inputStream = Manifest.class.getResourceAsStream( "/META-INF/"
744-
+ "maven/org.codehaus.plexus/plexus-archiver/pom.properties" );
745-
Properties properties = PropertyUtils.loadProperties( inputStream );
746-
if ( properties != null )
747-
{
748-
String plexusArchiverVersion = properties.getProperty( "version" );
749-
if ( plexusArchiverVersion != null )
745+
final Properties properties = PropertyUtils.loadProperties( Manifest.class.getResourceAsStream(
746+
"/META-INF/maven/org.codehaus.plexus/plexus-archiver/pom.properties" ) );
747+
748+
if ( properties != null )
750749
{
751-
createdBy += " " + plexusArchiverVersion;
750+
String plexusArchiverVersion = properties.getProperty( "version" );
751+
if ( plexusArchiverVersion != null )
752+
{
753+
createdBy += " " + plexusArchiverVersion;
754+
}
752755
}
753-
}
754-
defaultManifest.getMainAttributes().putValue( "Created-By", createdBy );
756+
defaultManifest.getMainAttributes().putValue( "Created-By", createdBy );
755757

756-
return defaultManifest;
758+
return defaultManifest;
759+
}
760+
catch ( final IOException e )
761+
{
762+
throw new ArchiverException( "Failure reading default manifest.", e );
763+
}
757764
}
758765

759766
/**

0 commit comments

Comments
 (0)