Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319252 - invoke fails when project name != plugin id
Summary: invoke fails when project name != plugin id
Status: CLOSED FIXED
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Linux
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-08 06:45 EDT by Alessio Di Sandro CLA
Modified: 2016-03-23 06:22 EDT (History)
4 users (show)

See Also:


Attachments
Stack trace (3.62 KB, application/octet-stream)
2010-07-08 06:47 EDT, Alessio Di Sandro CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessio Di Sandro CLA 2010-07-08 06:45:05 EDT
Build Identifier: I20100608-0911

The problem arises when the plugin id is different from the project name. Follow the steps to reproduce: the path to file generate.emtl on the file system uses the project name (/something/org.eclipse.acceleo.module.sample/something/generate.emtl). Debugging the exception, the function resolveBundle() of BundleURLConverter class fails to find the bundle org.eclipse.acceleo.module.sample, extracted from the file path. In fact, the bundle name is now different because of step 3.

Reproducible: Always

Steps to Reproduce:
1. Create Acceleo project, using default settings
2. Add an invoke call in generate.mtl main template (example: [invoke('java.lang.String', 'toUpperCase()', Sequence{'foo'})/])
3. Change plugin ID from org.eclipse.acceleo.module.sample to something else (change Bundle-SymbolicName in MANIFEST.MF)
4. Create Acceleo UI Launcher project for the previous project, using default settings
5. Change dependency to reflect the ID change of referenced project (change Require-Bundle in MANIFEST.MF, using the new ID given at 3.)
6. Run the UI as Eclipse application, create an ECore model with at least a class, right click on it, Acceleo Model to Text popup menu -> Generate Sample
7. NPE
Comment 1 Alessio Di Sandro CLA 2010-07-08 06:47:23 EDT
Created attachment 173759 [details]
Stack trace
Comment 2 Ed Willink CLA 2010-07-28 10:47:55 EDT
Similarly, Acceleo fails if the invoke refers to a not-exported package.

It would be helpful if Acceleo provided edit-time warnings of the validity of the invoke call.
Comment 3 Laurent Goubet CLA 2010-07-28 10:55:24 EDT
Ed, could you raise a separate enhancement request for a warning on "non exported class invocation" ? We'll try and add all "warning" enhancements at once and this one might be lost :).
Comment 4 Ed Willink CLA 2010-07-28 12:25:44 EDT
I think there are two sides to the same bug.

In the absence of an edit-time warning you get the reported run-time error (that could be handled more elegantly.) The attached stacktrace is way down stream from the original error; the console log can be quite substantial.
Comment 5 Laurent Goubet CLA 2010-07-30 11:24:03 EDT
Ed,

Adding a warning for invokes on non exported classes is necessary, even when we fix the originally reported NPE. Thus I believe we need two bugs for this.

Moreover, the originally reported NPE (or rather, the path to get to it) is extremelly tedious to solve; I have more than one point in the code with a "FIXME assume that bundle id is the same as the bundle name" since the Eclipse platform doesn't provide an easy lookup for bundles from their name. Not one that I know of at least. Adding the warning you mention is orders of magnitude easier and will be made earlier than the NPE fix.
Comment 6 Ed Willink CLA 2010-08-02 12:27:23 EDT
Request for warning migrated to Bug 321525.
Comment 7 Laurent Goubet CLA 2016-03-23 06:22:33 EDT
This has been fixed when we refactored the way service registration worked, and is functional in 3.6.4.