In order to see if I am doing something wrong, I also made a small example and followed the same steps and it works there... So, I am really surprised why it does not work in my primary case! Also, when I execute the primary case strategy via Run Configuration, it just works fine! The only big difference I can see is that in my primary case the metamodel is extending another one and in the small case is only one metamodel to be migrated.

Any suggestions?!

Greetings,
Hristina]]>Hristina Moneva2011-05-26T12:35:43-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/674384/#msg_674384
I'm sorry to read that you're having a problem with the Flock extension point. It's suspicious that your migration works when executed with an Eclipse launch configuration but not via the extension point: this might be a bug.

As I already mentioned in my previous mail, I cannot reproduce the same error in other simple example. I also made the simple example using two ecores, where one extends the other and it works fine.

Any ideas?

Greetings,
Hristina

PS: I cannot send you my primary metamodels, because they are confidential. And by the way, last week I already send another question with an example to your e-mail and I am still waiting for a reply. The question there was about how to create new element and set its attributes within migration strategy... In my case, the element gets created, but the attributes are empty!]]>Hristina Moneva2011-05-30T10:03:06-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/675337/#msg_675337
I checked out the Epsilon SVN projects and decided to debug... What I found is as follows:

Here the problem comes from "bundle.getResource(extPoint.getAttribute("strategyFile")).toURI()". The "extPoint.getAttribute("strategyFile")" returns properly the *.mig file, but the bundle.getResource(...) returns null!

Any idea?

Greetings,
Hristina
]]>Hristina Moneva2011-05-31T08:24:37-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/675463/#msg_675463
Thanks for debugging the problem on your end. Without access to your metamodels, that would have been extremely difficult for me!

If I recall correctly, bundle.getResource(...) will only return null if the requested path cannot be resolved to a bundled resource. Are you sure that the plugin.xml (in the project that causes the error) correctly specifies the path to the migration strategy?

If possible, would you paste the contents of the plugin.xml file for the project that works (your simple example) and the plugin.xml file for the project that does not work? It might be helpful to compare them side-by-side.

And by the way, last week I already send another question with an example to your e-mail and I am still waiting for a reply. The question there was about how to create new element and set its attributes within migration strategy... In my case, the element gets created, but the attributes are empty!

I'm sorry about this. We don't check the epsilon.devs account unless we are expecting to receive a file from someone. We prefer to use the forum to discuss problems, as this provides a public record of any problems, which other users can search in the future.

To answer the question you sent by email, (in general) the values of new properties are set via the migrated variable in the body of a migrate rule. So for a metamodel that evolves from:

Cheers,
Louis.]]>Louis Rose2011-05-31T15:50:28-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/684916/#msg_684916
Thanks for the answer! But... I still cannot manage. The example you gave in your reply was exactly the opposite of what I need - just switching the from and to metamodels. It should be:
FROM:

The result is that a new Property element is created ("par.print()" supports my statement that the attributes are created correctly), but no attributes are set (based on the resulting migrated model).What is the correct way of setting the attributes?!

Thanks in advance,
Hristina]]>Hristina Moneva2011-06-16T13:22:26-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/684935/#msg_684935
And now about the bundle.getResource(...) problem.

The current situation is as follows: I have two examples - small and big. In the small everything works fine - with "Epsilon Flock Migration Strategy" Run Configuration and via Flock extension point. In the big example - the "Epsilon Flock Migration Strategy" Run Configuration works fine, but the Flock extension point ends with the bundle.getResource(...) error.

The result is that a new Property element is created ("par.print()" supports my statement that the attributes are created correctly), but no attributes are set (based on the resulting migrated model).What is the correct way of setting the attributes?!

Hi Hristina,

Thanks for the very clear descriptions of what you'd like to achieve.

The problem is that the type Property is ambiguous: this could refer to the Property in the original model or in the migrated model. We need to be more specific, and indicate that we wish to refer to Property in the metamodel of the migrated model:

Migrated!Property

Admittedly, EOL and hence Flock should probably issue a warning here, as the ambiguity can cause much confusion (as in this case). I'll open a bug to fix this.

Finally, it's worth noting that the for loop is not necessary here: original.multiplicity is always an integer, and iterating over an integer is the same as executing the loop once. So, the final code looks like this:

Cheers,
Louis.]]>Louis Rose2011-06-21T17:52:44-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/686103/#msg_686103
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349972) to cover the ambiguity problem that I discussed above.]]>Louis Rose2011-06-21T18:07:43-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/686112/#msg_686112
With regard to the extension configuration. Is the problem still as you described previously:

Here the problem comes from "bundle.getResource(extPoint.getAttribute("strategyFile")).toURI()". The "extPoint.getAttribute("strategyFile")" returns properly the *.mig file, but the bundle.getResource(...) returns null!

If so, are you certain that the path to the Flock migration strategy file in the plugin.xml below is correct? Maybe it should be "model-migration/M100toM200.mig"?

I ask because the examples that you emailed work on my machine! Do these examples fail on your machine?

If so, are you certain that the path to the Flock migration strategy file in the plugin.xml below is correct?

Yes, I am, because I use the Browse button to select the file (not just manually typing it in the plugin.xml), as you can see in the screenshot (the attached file).

Quote:

Maybe it should be "model-migration/M100toM200.mig"?

No, because such file does not exist. The previous argument holds here as well...

In the screenshot you can see the file hierarchy I use (in the Package Explorer), as well as the selection of the only strategy I have...

About the fact that the simple example I sent you works at your computer - it is the same here. The problem is that identical, but more complex case - does not!

I have no idea how to solve it... I will try with a clean Eclipse installation and importing there anew all the projects. I have no other idea for now... If nothing helps, I have still two options: to use other migration technology or sending you my complete project set (which I hesitate). I will inform you if I have some progress. I would appreciate if you have any other ideas...

Greetings,
Hristina

PS: in the screenshot you can also see the error message for the migration strategy itself on "Migrated!Parameter" (in the simple example should be "Migrated!Property")]]>Hristina Moneva2011-07-01T13:43:28-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/696685/#msg_696685
I rerun my projects and tried the run the migration strategy --> again NullPointerException for the migration strategy...

Hristina]]>Hristina Moneva2011-07-14T15:20:58-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/697649/#msg_697649
Firstly, I'm sorry for the late reply. I've been travelling, and generally very busy for the past couple of weeks.

So it seems that two problems remain. With respect to the "Type Migrated!Property not found" error, could this be because of the way that the migration strategy is being launched? If it's being launched from an Eclipse launch configuration, the "Migrated" part of the name should match exactly the name of the model that has been selected in the launch configuration. For example, in the attached screenshot, I've selected "B" as the migrated model and hence the type would be "B!Property" (and not "Migrated!Property").

For the second problem (the NullPointerException), I'm afraid that I'm out of ideas. It would really help if you could send me a copy of the project that is causing the problem. I'd be happy to sign a non-disclosure or confidentiality agreement if that would be helpful.

Cheers,
Louis.]]>Louis Rose2011-07-17T15:39:43-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/709742/#msg_709742
First of all, thanks for the last reply - it worked! Now I can migrate all properties I wanted...

Second, I am going to send you part of my projects (just the model and tree editors along with the migration strategy) in a mail to the developers mail. I hope that would help to allocate the problem with the NPE. Looking forward to your answer..

Greetings,
Hristina]]>Hristina Moneva2011-08-04T08:53:08-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/714708/#msg_714708
Sorry for the late reply: I've been on vacation for the past 10 days. However, I think that I've finally got to the bottom of this problem...

It seems that the method (Bundle#getResource()) that I use to locate the Flock migration strategy from a user's extensions does not work when the user's plugin builds a JAR file that has a name other than the Eclipse default (which is "."). I've changed Flock to use a different method (Bundle#getEntry()), which seems more tolerant: it can load resources from a bundle that does not have the default name. I've committed this change, and the fix will be available in the next interim release of Epsilon.

As a workaround for now, you can restore the default JAR file name for the plugin that defines your Flock extension:

1) Open "your.plugin/plugin.xml" and select the Build tab.
a) Under the runtime information group (at the top), right-click "your.plugin.jar".
b) Select Rename.
c) Enter a single full stop character as the name. In other words, the name should be: .

2) Now open the MANIFEST.MF tab of the same file ("your.plugin/plugin.xml").
a) Find the line that reads: Bundle-ClassPath: nl.esi.design.model.jar
b) Replace it with a line that reads: Bundle-ClassPath: .

3) Save the changes to the "your.plugin/plugin.xml" file.

4) Relaunch Eclipse.

The above should prevent the NullPointerException for now. When the next interim version of Epsilon is released, you can go back to the previous settings that cause your plugin to build a JAR named "your.plugin.jar"

Finally, you'll need to use Original and Migrated as the model names when launching a Flock migration strategy via the extension point. Specifically, you'll need to change "xxx!Parameter" to "Migrated!Parameter" on line 2 of the migration strategy that you emailed to us.

I hope this helps to finally solve this very mysterious problem! Thanks a lot for all of your patience. I'm sorry that it's taken so long to get to diagnose. As you can see, the issue seems to occur in very specific circumstances that I was previously unable to recreate.

I did apply both changes you suggested and I am step further, but there is still some problem left...

Now, when I execute the migration strategy via extension point there is no NPE. A backup file is created (which can be restored). The problem is that no migrated file is created and error is thrown (see below)!

Called feature name on undefined object (13:48)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:56)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:42)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:130)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.OperatorExecutor.execute(OperatorExecutor.java:62)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.IfStatementExecutor.execute(IfStatementExecutor.java:36)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:33)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.ForStatementExecutor.execute(ForStatementExecutor.java:112)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:33)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.IfStatementExecutor.execute(IfStatementExecutor.java:43)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:33)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.flock.FlockContext.executeBlock(FlockContext.java:93)
at org.eclipse.epsilon.flock.model.Body.applyTo(Body.java:31)
at org.eclipse.epsilon.flock.execution.MigrateRuleBasedEquivalence.applyStrategyToPopulateEquivalent(MigrateRuleBasedEquivalence.java:33)
at org.eclipse.epsilon.flock.execution.Equivalences.populateEachEquivalent(Equivalences.java:61)
at org.eclipse.epsilon.flock.MigrationStrategyRunner.populateEachEquivalent(MigrationStrategyRunner.java:49)
at org.eclipse.epsilon.flock.MigrationStrategyRunner.run(MigrationStrategyRunner.java:37)
at org.eclipse.epsilon.flock.FlockContext.run(FlockContext.java:164)
at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.java:80)
at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.java:75)
at org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor.migrate(MigrationStrategyExecutor.java:87)
at org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor.run(MigrationStrategyExecutor.java:64)
at org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrategy.migrateSelectionUsing(ExecuteMigrationStrategy.java:64)
at org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrategy.run(ExecuteMigrationStrategy.java:54)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
!ENTRY org.eclipse.epsilon.common.dt 4 0 2011-08-18 10:03:54.164
!MESSAGE Error encountered whilst executing Flock migration strategy for: ...
!STACK 0
Exception encountered while executing EOL block.
at org.eclipse.epsilon.flock.FlockContext.executeBlock(FlockContext.java:101)
at org.eclipse.epsilon.flock.model.Body.applyTo(Body.java:31)
at org.eclipse.epsilon.flock.execution.MigrateRuleBasedEquivalence.applyStrategyToPopulateEquivalent(MigrateRuleBasedEquivalence.java:33)
at org.eclipse.epsilon.flock.execution.Equivalences.populateEachEquivalent(Equivalences.java:61)
at org.eclipse.epsilon.flock.MigrationStrategyRunner.populateEachEquivalent(MigrationStrategyRunner.java:49)
at org.eclipse.epsilon.flock.MigrationStrategyRunner.run(MigrationStrategyRunner.java:37)
at org.eclipse.epsilon.flock.FlockContext.run(FlockContext.java:164)
at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.java:80)
at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.java:75)
at org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor.migrate(MigrationStrategyExecutor.java:87)
at org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor.run(MigrationStrategyExecutor.java:64)
at org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrategy.migrateSelectionUsing(ExecuteMigrationStrategy.java:64)
at org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrategy.run(ExecuteMigrationStrategy.java:54)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Caused by: Called feature name on undefined object (13:48)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:56)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:42)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:130)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.OperatorExecutor.execute(OperatorExecutor.java:62)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.IfStatementExecutor.execute(IfStatementExecutor.java:36)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:33)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.ForStatementExecutor.execute(ForStatementExecutor.java:112)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:33)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.IfStatementExecutor.execute(IfStatementExecutor.java:43)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:33)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
at org.eclipse.epsilon.flock.FlockContext.executeBlock(FlockContext.java:93)
... 41 more

]]>Hristina Moneva2011-08-18T08:22:38-00:00Re: [Flock] error while executing migration strategy distributed via pluginhttps://www.eclipse.org/forums/index.php/mv/msg/210216/716873/#msg_716873
Great -- I'm glad that the NullPointerException is fixed for you now.

The error that you're seeing (Called feature name on undefined object) indicates that some part of your migration strategy is attempting to access the feature "name" on a null value.

For example, consider the following program. When x is assigned null (perhaps because there are no instances of SomeMetamodelType in the model, and hence the call to first returns null), then attempting to execute line 2 will result in the runtime error: Called feature name on undefined object

var x = SomeMetamodelType.all.first;
x.name;

To fix this error, take a look at the part of the migration strategy that accesses the name feature and try to determine why the value could be null. I would start by looking at line 13, column 48 as the error message seems to indicate this is the location of the error (though I would have expected the error message to contain the path of a Flock migration strategy too...)