You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "Damien Raude-Morvan (JIRA)" <ji...@apache.org> on 2014/06/05 10:03:01 UTC

[jira] [Commented] (GORA-332) Gora 0.4 compiler generate invalid Java code

    [ https://issues.apache.org/jira/browse/GORA-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14018569#comment-14018569 ] 

Damien Raude-Morvan commented on GORA-332:
------------------------------------------

I've prepared a PR (on GitHub) to fix this issue.
https://github.com/apache/gora/pull/1
[Is that okay for you to use GitHub features for PR ?]

It simply rename _deepCopyToWriteOnlyBuffer_ to _deepCopyToReadOnlyBuffer_ which expected method name in generated java code when schema
contains a **bytes** field type.

> Gora 0.4 compiler generate invalid Java code
> --------------------------------------------
>
>                 Key: GORA-332
>                 URL: https://issues.apache.org/jira/browse/GORA-332
>             Project: Apache Gora
>          Issue Type: Bug
>          Components: gora-compiler
>    Affects Versions: 0.4, 0.5
>            Reporter: Damien Raude-Morvan
>             Fix For: 0.5
>
>
> Pursuing my journey on GORA-199 I've detected another issue with Gora compiler.if there is a "bytes" type field inside a record.
> {noformat}
> {
>     "name": "RecordWityBytes",
>     "namespace": "com.drazzib.com",
>     "type": "record",
>     "fields": [
>         {
>             "name": "type",
>             "type": {
>                 "name": "MyData",
>                 "type": "bytes"
>             }
>         }
>     ]
> }
> {noformat}
> Gora 0.4 will generate java code without crashing but if you try to compile generated code with javac, you'll get the following error :
> {noformat}
> $> ./bin/gora goracompiler record_with_bytes.avsc test/
> Compiling: /home/drazzib/incoming/apache-gora-0.4/record_with_bytes.avsc
> Compiled into: /home/drazzib/incoming/apache-gora-0.4/test
> Compiler executed SUCCESSFULL.
> $> find test/ -name *.java | xargs javac -cp gora-core/target/classes/:gora-core/lib/avro-1.7.4.jar:gora-core/lib/jackson-core-asl-1.6.9.jar -d test/
> test/com/drazzib/com/RecordWityBytes.java:92: error: cannot find symbol
>     this.type = deepCopyToReadOnlyBuffer(value);
>                 ^
>   symbol:   method deepCopyToReadOnlyBuffer(ByteBuffer)
>   location: class RecordWityBytes
> 1 error
> {noformat}
> You can clone this gist [https://gist.github.com/drazzib/263da2ec0dc46afac0d0] to easily reproduce this issue.



--
This message was sent by Atlassian JIRA
(v6.2#6252)