|
21 | 21 | import java.io.ByteArrayOutputStream;
|
22 | 22 | import java.io.IOException;
|
23 | 23 | import java.io.InputStream;
|
24 |
| -import java.io.InputStreamReader; |
25 | 24 | import java.io.PrintWriter;
|
26 | 25 | import java.io.Reader;
|
27 | 26 | import java.io.StringWriter;
|
|
34 | 33 | import java.util.StringTokenizer;
|
35 | 34 | import java.util.Vector;
|
36 | 35 | import java.util.jar.Attributes;
|
| 36 | + |
37 | 37 | import org.codehaus.plexus.archiver.ArchiverException;
|
38 |
| -import org.codehaus.plexus.util.IOUtil; |
39 | 38 |
|
40 | 39 | /**
|
41 | 40 | * Holds the data of a jar manifest.
|
@@ -388,7 +387,7 @@ public Iterator<String> iterator()
|
388 | 387 | {
|
389 | 388 | return getKeys(attributes).iterator();
|
390 | 389 | }
|
391 |
| - |
| 390 | + |
392 | 391 | public void setName( String name )
|
393 | 392 | {
|
394 | 393 | throw new UnsupportedOperationException( "Cant do this" );
|
@@ -738,43 +737,13 @@ public Iterator<String> iterator()
|
738 | 737 | public static Manifest getDefaultManifest()
|
739 | 738 | throws ArchiverException
|
740 | 739 | {
|
741 |
| - InputStream in = null; |
742 |
| - Reader reader = null; |
743 |
| - final String defManifest = "/org/codehaus/plexus/archiver/jar/defaultManifest.mf"; |
744 |
| - try |
745 |
| - { |
746 |
| - in = Manifest.class.getResourceAsStream( defManifest ); |
747 |
| - if ( in == null ) |
748 |
| - { |
749 |
| - throw new ArchiverException( "Could not find default manifest: " + defManifest ); |
750 |
| - } |
751 |
| - reader = new InputStreamReader( in, "UTF-8" ); |
752 |
| - final Manifest defaultManifest = new Manifest( reader ); |
753 |
| - defaultManifest.getMainAttributes().putValue( "Created-By", System.getProperty( |
754 |
| - "java.vm.version" ) + " (" + System.getProperty( |
755 |
| - "java.vm.vendor" ) + ")" ); |
756 |
| - |
757 |
| - reader.close(); |
758 |
| - reader = null; |
759 |
| - |
760 |
| - in.close(); |
761 |
| - in = null; |
| 740 | + final Manifest defaultManifest = new Manifest(); |
| 741 | + defaultManifest.getMainAttributes().putValue( "Manifest-Version", "1.0" ); |
| 742 | + defaultManifest.getMainAttributes().putValue( "Created-By", System.getProperty( |
| 743 | + "java.vm.version" ) + " (" + System.getProperty( |
| 744 | + "java.vm.vendor" ) + ")" ); |
762 | 745 |
|
763 |
| - return defaultManifest; |
764 |
| - } |
765 |
| - catch ( ManifestException e ) |
766 |
| - { |
767 |
| - throw new ArchiverException( "Default manifest is invalid !!", e ); |
768 |
| - } |
769 |
| - catch ( IOException e ) |
770 |
| - { |
771 |
| - throw new ArchiverException( "Unable to read default manifest", e ); |
772 |
| - } |
773 |
| - finally |
774 |
| - { |
775 |
| - IOUtil.close( in ); |
776 |
| - IOUtil.close( reader ); |
777 |
| - } |
| 746 | + return defaultManifest; |
778 | 747 | }
|
779 | 748 |
|
780 | 749 | /**
|
|
0 commit comments