felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stuart McCulloch (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FELIX-333) <Include_Resouce> can create a corrupt manifest file.
Date Mon, 13 Aug 2007 15:45:30 GMT

    [ https://issues.apache.org/jira/browse/FELIX-333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519449
] 

Stuart McCulloch commented on FELIX-333:
----------------------------------------

Actually there is a problem with the manifest, but it's not initially obvious unless you open
it using Linux.
Here's a similar example, note that there's a Unix newline that's not followed by a space
on the next line:

   Include-Resource: foo=bar,
                           zzz=bar^M

The exception thrown from Java is as follows:

   org.osgi.framework.BundleException: The manifest line
      "                 zzz=bar" is invalid; it has no colon : character after the header
key.
        at org.eclipse.osgi.framework.util.Headers.parseManifest(Headers.java:283)
        at org.eclipse.osgi.internal.baseadaptor.AdaptorUtil.loadManifestFrom(AdaptorUtil.java:193)

and the standard Jar utility class also barfs with this exception:

   java.io.IOException: invalid header field
        at java.util.jar.Attributes.read(Attributes.java:383)
        at java.util.jar.Manifest.read(Manifest.java:167)
        at java.util.jar.JarInputStream.<init>(JarInputStream.java:66)
        at java.util.jar.JarInputStream.<init>(JarInputStream.java:43)

The easy solution is to strip newlines from properties in the bundle-plugin before passing
them to BND.
Of course Peter might prefer to handle this inside BND instead, as it might also be caused
when using
BND from ant, etc. and a more robust library is always good :)

BTW, this only seems to happen with instructions passed in via the pom.xml, possibly because
extra
whitespace is automatically removed when they're read in from a properties file using <_include>...
whereas with XML the whitespace is preserved.


> <Include_Resouce> can create a corrupt manifest file.
> -----------------------------------------------------
>
>                 Key: FELIX-333
>                 URL: https://issues.apache.org/jira/browse/FELIX-333
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven Bundle Plugin
>    Affects Versions: 1.0.0
>         Environment: Confirmed on Win32. Not sure about *nix.
>            Reporter: Thomas Dewire
>             Fix For: 1.0.0
>
>         Attachments: felix-bug-example.zip
>
>
> Please see the attached maven project. It should demonstrate the issue. The generated
manifest file is in the root directory as an example of the bad manifest syntax.
> Whitespace is not being stripped from the contents of the <Include-Resource> tag.
These end up in the manifest file, and corrupt it so the bundle cannot load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message