[ http://jira.codehaus.org/browse/MJAR-50?page=comments#action_70339 ] 
            
Mike Laurie commented on MJAR-50:
---------------------------------

Wow - thanks Mike; you've been busy!
It's good to know the "more than once in the same section" error is already 
fixed in archiver 2.2.

The only thing causing this MJAR issue now seems to be the _possibility_ of 
including \r and \n characters in manifest header fields.  While we're at it, I 
guess that NUL characters also ought to be quashed since they're the only other 
invalid attribute chars according to the sun spec.  I think these characters 
should be replaced with spaces as a matter of course.

Last question: Does the archiver-plugin take responsibility for this, or should 
plexus change their jar.Manifest class to replace them?  I think plexus should 
be changed anyway, since it currently allows invalid jar manifests to be 
created.  However, is it worth changing the archiver-plugin to fix the problem 
now, since it's an easy fix and there needs to be a release soon anyway?

> "Invalid Header" in jar's Manifest (Specification-Title attribute) when tab 
> char in pom Description
> ---------------------------------------------------------------------------------------------------
>
>                 Key: MJAR-50
>                 URL: http://jira.codehaus.org/browse/MJAR-50
>             Project: Maven 2.x Jar Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Mike Laurie
>            Priority: Trivial
>
> I typed a <description> element into my pom; the description spanned 2 lines, 
> and my text editor put a tab char at the beginning of the 2nd line.
> The project built correctly, but another project depended on the resulting 
> jar.
> The compilation of the depending project failed with "invalid header" on the 
> jar I'd just compiled.
> When I looked at the jar's manifest, I saw the Specification-Title attribute 
> had the tab character still in it from the <description> element.
> Replacing the tab with spaces in the pom solved the problem.
> However, this was valid xml that caused a compilation problem, so I think 
> it's a minor bug with the jar production code.
> Note that the full description is trimmed before going into the manifest, so 
> any 
> Easy to work around, but it would be nice if whitespace in the <description> 
> element were consolidated into spaces before copying to the manifest.
> Doesn't need any fancy layout stuff - just any multiple instances of tabs, 
> spaces, lf or cr should be replaced by a single space.
> Try (I haven't tried to compile this!):
> {code}
>     public String consolidateWhitespace(String input){
>         StringTokenizer st = new StringTokenizer(input);
>         StringBuffer rv = new StringBuffer();
>         while (st.hasMoreTokens()){
>             rv.append(st.nextToken() + (st.hasMoreTokens()?" ":""));
>         }
>         return rv.toString();
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to