Bug 428950 - IllegalArgumentException thrown by P2GeneratorImpl.getCanonicalArtifact when generating p2 metadata with P2MetadataMojo
Summary: IllegalArgumentException thrown by P2GeneratorImpl.getCanonicalArtifact when ...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-24 14:21 EST by Gunnar Wagenknecht CLA
Modified: 2021-04-28 16:51 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2014-02-24 14:21:14 EST
The stacktrace is:
Caused by: java.lang.IllegalArgumentException
 at ...P2GeneratorImpl.getCanonicalArtifact(P2GeneratorImpl.java:156)
 at ...P2GeneratorImpl.generateMetadata(P2GeneratorImpl.java:109)
 at ...P2MetadataMojo.attachP2Metadata(P2MetadataMojo.java:143)
 at org.eclipse.tycho.plugins.p2.P2MetadataMojo.execute(P2MetadataMojo.java:104)


The reason is an invalid bundle manifest. 

However, the error is hard to track down because org.eclipse.equinox.p2.publisher.eclipse.BundlesAction.createBundleDescription(Dictionary<String, String>, File) swallows the exception. It does log a status but if running inside Tycho there is no way I can see that error.

I think BundlesAction.createBundleDescription should get an alternate signature which does not suppress the BundleException.

But looking at the caller stack, some are expecting it to throw a BundleException. Thus, maybe the catch has been introduced later and it shouldn't be there at all.
Comment 1 Gunnar Wagenknecht CLA 2014-02-24 14:45:44 EST
BTW, can I somehow access the Eclipse log file that is written by the underlying Equinox framework running within Maven?
Comment 2 Jan Sievers CLA 2014-02-25 03:04:50 EST
(In reply to Gunnar Wagenknecht from comment #0)
> The stacktrace is:
> Caused by: java.lang.IllegalArgumentException
>  at ...P2GeneratorImpl.getCanonicalArtifact(P2GeneratorImpl.java:156)
>  at ...P2GeneratorImpl.generateMetadata(P2GeneratorImpl.java:109)
>  at ...P2MetadataMojo.attachP2Metadata(P2MetadataMojo.java:143)
>  at
> org.eclipse.tycho.plugins.p2.P2MetadataMojo.execute(P2MetadataMojo.java:104)
> 
> 
> The reason is an invalid bundle manifest. 
> 
> However, the error is hard to track down because
> org.eclipse.equinox.p2.publisher.eclipse.BundlesAction.
> createBundleDescription(Dictionary<String, String>, File) swallows the
> exception. It does log a status but if running inside Tycho there is no way
> I can see that error.
> 
> I think BundlesAction.createBundleDescription should get an alternate
> signature which does not suppress the BundleException.

p2 bug 331683 seems related. I did a fix for this one but maybe your case is different. A small sample project to reproduce the problem would help.
Comment 3 Jan Sievers CLA 2014-02-25 03:10:34 EST
(In reply to Gunnar Wagenknecht from comment #1)
> BTW, can I somehow access the Eclipse log file that is written by the
> underlying Equinox framework running within Maven?

maven debug option -X should enable -debug -consoleLog for the embedded equinox instance
Comment 4 Jan Sievers CLA 2014-02-25 03:15:20 EST
> p2 bug 331683 seems related. I did a fix for this one but maybe your case is
> different. A small sample project to reproduce the problem would help.

also see bug 383192 for syntactically correct but semantically invalid MANIFEST
Comment 5 Gunnar Wagenknecht CLA 2014-02-25 06:29:49 EST
Thanks Jan! I was able to get the log to a file using -Dosgi.logfile=... I was using the -X option but maybe I just missed the log output in this case due to the lot of other stuff that got logged.

FWIW, I think it's related to the other mentioned bugs. But because this is still happening, it think the implementation of BundlesAction.createBundleDescription(Dictionary<String, String>, File) is wrong (in Kepler SR2) or whatever Tycho 0.19 uses. BundlesAction.createBundleDescription(File) has a throws signature but BundleException is never thrown by createBundleDescription(Dictionary<String, String>, File). It's silently catched, logged and null is returned. Therefore, BundlesAction.getBundleDescriptions(File[], IProgressMonitor) is not able to catch the BunbleException and to call addPublishingErrorToFinalStatus.


FWIW: this was the incorrect (but syntactically correct) heder:
  Require-Capability: org.slf4j.impl;filter:="(&(version>=1.6.0)(version<1.7.6))"

The 'filter' constraint does not support '<' comparison only '>' and '>='.
Comment 6 Mickael Istria CLA 2021-04-08 18:12:20 EDT
Eclipse Tycho is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/tycho/issues/ instead. If this issue is relevant to you, your action is required.
0. Verify this issue is still happening with latest Tycho 2.4.0-SNAPSHOT
  if issue has disappeared, please change status of this issue to "CLOSED WORKFORME" with some details about your testing environment and how you did verify the issue; and you're done
  if issue is still present when latest release:
* Create a new issue at https://github.com/eclipse/tycho/issues/
  ** Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience)
  ** In the GitHub description, start with a link to this bugzilla ticket
  ** Optionally add new content to the description if it can helps towards resolution
  ** Submit GitHub issue
* Update bugzilla ticket
  ** Add to "See also" property (up right column) the link to the newly created GitHub issue
  ** Add a comment "Migrated to <link-to-newly-created-GitHub-issue>"
  ** Set status as CLOSED MOVED
  ** Submit

All issues that remain open will be automatically closed next week or so. Then the Bugzilla component for Tycho will be archived and made read-only.