Re: svn commit: r677718 - /maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformer.java

View: New views
2 Messages — Rating Filter:   Alert me  

Re: svn commit: r677718 - /maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformer.java

by Benjamin Bentmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jason van Zyl wrote:

> Author: jvanzyl
> Date: Thu Jul 17 13:48:21 2008
> New Revision: 677718
>
> URL: http://svn.apache.org/viewvc?rev=677718&view=rev
> Log:
> MSHADE-39: add a resource transformer that takes care of MANIFEST.MF files
>
> maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformer.java
>  (added)
> +        +        jos.putNextEntry( new JarEntry( MANIFEST_PATH ) );
> +        StringBuffer sb = new StringBuffer();
> +        for ( Iterator i = attributes.keySet().iterator(); i.hasNext(); )
> +        {
> +            Attributes.Name a = (Attributes.Name) i.next();
> +            sb.append( a.toString() ).append(  ": " ).append( attributes.getValue(  a ) ).append( "\n" );
> +        }       +        InputStream is = new StringInputStream( sb.toString() );
> +        IOUtil.copy( is, jos );

The implementation as is does not respect the Manifest specification
[0], e.g. neither UTF-8 encoding nor 72 bytes maximum line length is
used. Didn't Manifest.write(OutputStream) work for you?


Benjamin


[0]
http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Manifest%20Specification

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r677718 - /maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformer.java

by Jason van Zyl-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There you go. Old habits die hard.

On 17-Jul-08, at 5:41 PM, Benjamin Bentmann wrote:

> Jason van Zyl wrote:
>
>> Author: jvanzyl
>> Date: Thu Jul 17 13:48:21 2008
>> New Revision: 677718
>> URL: http://svn.apache.org/viewvc?rev=677718&view=rev
>> Log:
>> MSHADE-39: add a resource transformer that takes care of  
>> MANIFEST.MF files
>> maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/
>> maven/plugins/shade/resource/ManifestResourceTransformer.java
>> (added)
>> +        +        jos.putNextEntry( new JarEntry( MANIFEST_PATH ) );
>> +        StringBuffer sb = new StringBuffer();
>> +        for ( Iterator i = attributes.keySet().iterator();  
>> i.hasNext(); )
>> +        {
>> +            Attributes.Name a = (Attributes.Name) i.next();
>> +            sb.append( a.toString() ).append(  ":  
>> " ).append( attributes.getValue(  a ) ).append( "\n" );
>> +        }       +        InputStream is = new  
>> StringInputStream( sb.toString() );
>> +        IOUtil.copy( is, jos );
>
> The implementation as is does not respect the Manifest specification  
> [0], e.g. neither UTF-8 encoding nor 72 bytes maximum line length is  
> used. Didn't Manifest.write(OutputStream) work for you?
>
>
> Benjamin
>
>
> [0] http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Manifest%20Specification
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.

   -- Jacques Ellul, The Technological Society


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...

LightInTheBox - Buy quality products at wholesale price