Damien Raude-Morvan created GORA-331:
----------------------------------------
Summary: Gora 0.4 compiler crash with "enum" type
Key: GORA-331
URL: https://issues.apache.org/jira/browse/GORA-331
Project: Apache Gora
Issue Type: Bug
Components: gora-compiler
Affects Versions: 0.4, 0.5
Reporter: Damien Raude-Morvan
As part of my work on GORA-199 I've updated some Dictanova projects to 0.4
release (more precisly to 0.5-SNAPSHOT) for testing.
Unfortunelly, I've detected that Gora Compiler crash if there is an "enum" type
field inside a record.
{noformat}
{
"name": "RecordWithEnum",
"namespace": "com.drazzib.com",
"type": "record",
"fields": [
{
"name": "type",
"type": {
"name": "MyEnum",
"type": "enum",
"symbols": [
"PERIOD",
"INSTANT"
]
}
}
]
}
{noformat}
If you try to compile this schema with Gora 0.4, you'll get the following error
:
{noformat}
/bin/gora goracompiler record_with_enum.avsc test/
Compiling: record_with_enum.avsc
74 [main] ERROR AvroVelocityLogChute - ResourceManager : unable to find
resource '/org/apache/gora/compiler/templates/enum.vm' in any resource loader.
Exception in thread "main" java.lang.RuntimeException:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource '/org/apache/gora/compiler/templates/enum.vm'
at
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:329)
at
org.apache.avro.compiler.specific.SpecificCompiler.compile(SpecificCompiler.java:371)
at
org.apache.avro.compiler.specific.SpecificCompiler.compileToDestination(SpecificCompiler.java:316)
at
org.apache.gora.compiler.GoraCompiler.compileSchema(GoraCompiler.java:65)
at
org.apache.gora.compiler.cli.GoraCompilerCLI.main(GoraCompilerCLI.java:56)
Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource '/org/apache/gora/compiler/templates/enum.vm'
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
at
org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
at
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:327)
... 4 more
{noformat}
I've managed to workaround this problem by simply dropping avro enum.vm inside
gora source.
You can easily clone this gist
[https://gist.github.com/drazzib/35e504e6e689f96dae8f] so that you can
reproduce this issue.
--
This message was sent by Atlassian JIRA
(v6.2#6252)