sim51/logisima-play-yml — Issue #11: Bug : exported data can't be imported
Author: Fluor
Created: 2012-01-31 07:45:40+00:00
State: open

I've exported data with 'play yml:generate' command line (version 1.7).

My application use a YML file to populate default data in DB with a usual job like :

```@OnApplicationStart
public class PopulateOnStart extends Job {

@Override
public void doJob() {
Fixtures.deleteAllModels();
Fixtures.loadModels("data.yml");
}
}
```

If I use the exported YML file as input for this job, I got the following exception :
```play.exceptions.TemplateCompilationException: unexpected token: (
at play.templates.GroovyTemplate.compile(GroovyTemplate.java:174)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:195)
at play.templates.Template.render(Template.java:38)
at play.test.Fixtures.loadModels(Fixtures.java:168)
at controllers.PopulateOnStart.doJob(PopulateOnStart.java:19)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
at play.jobs.Job.run(Job.java:132)
at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:486)
at play.Play.start(Play.java:536)
at play.Play.detectChanges(Play.java:618)
at play.Invoker$Invocation.init(Invoker.java:198)
at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:195)
at play.Invoker$Invocation.run(Invoker.java:276)
at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:235)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
23:32:07,251 ERROR ~

@698n4175b
Error during job execution (controllers.PopulateOnStart)

Execution exception (In /app/controllers/PopulateOnStart.java around line 19)
RuntimeException occured : Cannot load fixture init-data.yml: unexpected token: (

play.exceptions.JavaExecutionException: Cannot load fixture init-data.yml: unexpected token: (
at play.jobs.Job.call(Job.java:155)
at Invocation.Job(Play!)
Caused by: java.lang.RuntimeException: Cannot load fixture init-data.yml: unexpected token: (
at play.test.Fixtures.loadModels(Fixtures.java:237)
at controllers.PopulateOnStart.doJob(PopulateOnStart.java:19)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
... 1 more
Caused by: play.exceptions.TemplateCompilationException: unexpected token: (
at play.templates.GroovyTemplate.compile(GroovyTemplate.java:174)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:195)
at play.templates.Template.render(Template.java:38)
at play.test.Fixtures.loadModels(Fixtures.java:168)
... 4 more
23:32:07,418 ERROR ~

@698n4175b
Internal Server Error (500) for request GET /

Execution exception (In /app/controllers/PopulateOnStart.java around line 19)
RuntimeException occured : Cannot load fixture init-data.yml: unexpected token: (

play.exceptions.JavaExecutionException: Cannot load fixture init-data.yml: unexpected token: (
at play.jobs.Job.call(Job.java:155)
at Invocation.Job(Play!)
Caused by: java.lang.RuntimeException: Cannot load fixture init-data.yml: unexpected token: (
at play.test.Fixtures.loadModels(Fixtures.java:237)
at controllers.PopulateOnStart.doJob(PopulateOnStart.java:19)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
... 1 more
Caused by: play.exceptions.TemplateCompilationException: unexpected token: (
at play.templates.GroovyTemplate.compile(GroovyTemplate.java:174)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:195)
at play.templates.Template.render(Template.java:38)
at play.test.Fixtures.loadModels(Fixtures.java:168)
... 4 more```

It's hard to tell where is the faulty '(' character, as line number is not told.
I can provide my exported YML file if it can help. I can't unfortunately do it in a public way, as it contains email and other personal data.