Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313776

Summary: Querying of metamodel file crashes if metamodel doesn't exist
Product: [Modeling] Epsilon Reporter: Chris Holmes <holmeschrisk>
Component: CoreAssignee: Dimitris Kolovos <dkolovos>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Chris Holmes CLA 2010-05-20 13:13:19 EDT
If the following command is executed on a non-existant metamodel the task will crash:
I run the following from the 'pre' section of a working ETL file:
  -- some diagnostics
  'Source model:'.println();
  ('Source:         ' + Source).println();
  ('EMF model:      ' + Source.target).println();
  'Target model:'.println();
  ('Target:         ' + Target).println();
  ('EMF model:      ' + Target.target).println();
  ('Location:       ' + Target.target.modelFile).println();
  ('Metamodel URI:  ' + Target.target.metamodelUri).println();
  ('Metamodel file: ' + Target.target.metamodelFile).println();

I receive the following output and error message:
Source model:
Source:         org.eclipse.epsilon.workflow.tasks.ModelReference@99c2aa
EMF model:      org.eclipse.epsilon.emc.emf.xml.XmlModel@bb4c22
Target model:
Target:         org.eclipse.epsilon.workflow.tasks.ModelReference@8380df
EMF model:      org.eclipse.epsilon.emc.emf.EmfModel@181b9f7
Location:       C:\EclipseWorkspaces\blah...\MyStuff.model
Metamodel URI:  http://blah../MyStuff
EXCEPTION: Internal error: java.lang.reflect.InvocationTargetException

Notes:
As you're loading the model by metamodel URI, metamodelFile is null and this causes an exception. Could you please add another bug report for this? Until we get this fixed you can get the raw URI of the metamodel file (which will also be null in this case but won't throw an exception) using:

('Metamodel file: ' + Target.target.metamodelFileUri).println();

On a side note, Target.target.xxx will only work when you're launching the transformation through ANT. If at some point you invoke the ETL transformation from Java/launch configuration there'll be no ModelReference so all calls to Target.target.xxx will need to be replaced by Target.xxx.