You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@polygene.apache.org by zhuangmz08 <zh...@qq.com> on 2016/04/15 04:46:20 UTC

Property in ValueComposite ok, EntityComposite fail?

hi, 
public enum MyEnum{
 A, B, C, D
}


I use this enum in a ValueComposite and a EntityComposite, and try to ser/deserialize it by using JacksonValueSerializationService. 
However, value composite is ok, but entity composite throw exception caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'A': was expecting ('true', 'false' or 'null')].
I'm wondering whether this is a bug or not.
Thanks a lot.

Re: Property in ValueComposite ok, EntityComposite fail?

Posted by Niclas Hedhman <ni...@hedhman.org>.
No, but it should be quick to look up... Let's see.

There is no fundamental difference as far as I can see. Both use the
ValueDeserializerAdapter, which calls asSimpleValue() and readPlainValue()
(not sure why there are two similar methods) and both implementations seems
to do more or less the same thing (return a string).

Can you check that the output JSON is correct? And also, send in the
stacktrace.

Thanks

On Fri, Apr 15, 2016 at 1:34 PM, zhuangmz08 <zh...@qq.com> wrote:

> Hi, Niclas, I found that If I use OrgJson instead Jackson as
> SerializationService implementation, Property<Enum> in EntityComposite is
> ok.
> Does this remind you what's the difference between these two json
> implementation in order to fix Jackson implementation? Thanks.
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Niclas Hedhman";<ni...@hedhman.org>;
> 发送时间: 2016年4月15日(星期五) 中午12:09
> 收件人: "dev"<de...@zest.apache.org>;
>
> 主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?
>
>
>
> The explanation is that the serialization system for Values and Entities
> are in reality different in 2.1 and older. That is largely due to
> historical reasons, and we are successively trying to narrow the gap. There
> are quite a lot of areas where similar functionality has multiple
> implementations and therefor different set of bugs (or as some people call
> it, undesirable features)
>
> It is great that you uncover some of these, so we can get a regression test
> into the codebase and make sure it is covered during the refactoring that
> is ongoing.
>
> Cheers
>
> On Fri, Apr 15, 2016 at 11:33 AM, zhuangmz08 <zh...@qq.com> wrote:
>
> > Hi, Niclas,
> > I've declare the TestValue.class(containing a TestEnum) as both value and
> > entity composite.
> > Their behavior is different, value is ok, but entity is fail.
> > One interesting thing is that, I put TestValue into a TestEntity, it's
> > ok....
> >
> >
> >
> >
> > ------------------ 原始邮件 ------------------
> > 发件人: "zhuangmz08";<zh...@qq.com>;
> > 发送时间: 2016年4月15日(星期五) 中午11:21
> > 收件人: "dev"<de...@zest.apache.org>;
> >
> > 主题: 回复: Property<enum> in ValueComposite ok, EntityComposite fail?
> >
> >
> >
> > Hi, Niclas,
> > I've post my code into [https://github.com/mingzhou/learn-zest]. Thanks.
> > Do I need to declare every enum as entity or value composite?
> >
> >
> >
> >
> > ------------------ 原始邮件 ------------------
> > 发件人: "Niclas Hedhman";<ni...@hedhman.org>;
> > 发送时间: 2016年4月15日(星期五) 上午10:54
> > 收件人: "dev"<de...@zest.apache.org>;
> >
> > 主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?
> >
> >
> >
> > Do you do the equivalent of;
> >
> > public interface Abc {
> >     Property<MyEnum> myState();
> > }
> >
> > and in assembly doing;
> >
> > module.values( Abc.class );
> > module.entities( Abc.class );
> >
> > and you get different results?? If so, then that is a bug. There should
> be
> > no difference in the behavior here.
> >
> > In general, there should be no difference, but without seeing exactly
> what
> > you are doing, it is difficult to know for sure.
> >
> > If you are only learning, could you publish your sources on GitHub and
> just
> > point us to the code when you hit a snag? Easier for both us and you,  I
> > think
> >
> > Niclas
> >
> >
> > On Fri, Apr 15, 2016 at 10:46 AM, zhuangmz08 <zh...@qq.com> wrote:
> >
> > > hi,
> > > public enum MyEnum{
> > >  A, B, C, D
> > > }
> > >
> > >
> > > I use this enum in a ValueComposite and a EntityComposite, and try to
> > > ser/deserialize it by using JacksonValueSerializationService.
> > > However, value composite is ok, but entity composite throw exception
> > > caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized
> > > token 'A': was expecting ('true', 'false' or 'null')].
> > > I'm wondering whether this is a bug or not.
> > > Thanks a lot.
> >
> >
> >
> >
> > --
> > Niclas Hedhman, Software Developer
> > http://zest.apache.org - New Energy for Java
> >
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

回复: Property in ValueComposite ok, EntityComposite fail?

Posted by zhuangmz08 <zh...@qq.com>.
Hi, Niclas, I found that If I use OrgJson instead Jackson as SerializationService implementation, Property<Enum> in EntityComposite is ok.
Does this remind you what's the difference between these two json implementation in order to fix Jackson implementation? Thanks.




------------------ 原始邮件 ------------------
发件人: "Niclas Hedhman";<ni...@hedhman.org>;
发送时间: 2016年4月15日(星期五) 中午12:09
收件人: "dev"<de...@zest.apache.org>; 

主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?



The explanation is that the serialization system for Values and Entities
are in reality different in 2.1 and older. That is largely due to
historical reasons, and we are successively trying to narrow the gap. There
are quite a lot of areas where similar functionality has multiple
implementations and therefor different set of bugs (or as some people call
it, undesirable features)

It is great that you uncover some of these, so we can get a regression test
into the codebase and make sure it is covered during the refactoring that
is ongoing.

Cheers

On Fri, Apr 15, 2016 at 11:33 AM, zhuangmz08 <zh...@qq.com> wrote:

> Hi, Niclas,
> I've declare the TestValue.class(containing a TestEnum) as both value and
> entity composite.
> Their behavior is different, value is ok, but entity is fail.
> One interesting thing is that, I put TestValue into a TestEntity, it's
> ok....
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "zhuangmz08";<zh...@qq.com>;
> 发送时间: 2016年4月15日(星期五) 中午11:21
> 收件人: "dev"<de...@zest.apache.org>;
>
> 主题: 回复: Property<enum> in ValueComposite ok, EntityComposite fail?
>
>
>
> Hi, Niclas,
> I've post my code into [https://github.com/mingzhou/learn-zest]. Thanks.
> Do I need to declare every enum as entity or value composite?
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Niclas Hedhman";<ni...@hedhman.org>;
> 发送时间: 2016年4月15日(星期五) 上午10:54
> 收件人: "dev"<de...@zest.apache.org>;
>
> 主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?
>
>
>
> Do you do the equivalent of;
>
> public interface Abc {
>     Property<MyEnum> myState();
> }
>
> and in assembly doing;
>
> module.values( Abc.class );
> module.entities( Abc.class );
>
> and you get different results?? If so, then that is a bug. There should be
> no difference in the behavior here.
>
> In general, there should be no difference, but without seeing exactly what
> you are doing, it is difficult to know for sure.
>
> If you are only learning, could you publish your sources on GitHub and just
> point us to the code when you hit a snag? Easier for both us and you,  I
> think
>
> Niclas
>
>
> On Fri, Apr 15, 2016 at 10:46 AM, zhuangmz08 <zh...@qq.com> wrote:
>
> > hi,
> > public enum MyEnum{
> >  A, B, C, D
> > }
> >
> >
> > I use this enum in a ValueComposite and a EntityComposite, and try to
> > ser/deserialize it by using JacksonValueSerializationService.
> > However, value composite is ok, but entity composite throw exception
> > caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized
> > token 'A': was expecting ('true', 'false' or 'null')].
> > I'm wondering whether this is a bug or not.
> > Thanks a lot.
>
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Re: Property in ValueComposite ok, EntityComposite fail?

Posted by Niclas Hedhman <ni...@hedhman.org>.
The explanation is that the serialization system for Values and Entities
are in reality different in 2.1 and older. That is largely due to
historical reasons, and we are successively trying to narrow the gap. There
are quite a lot of areas where similar functionality has multiple
implementations and therefor different set of bugs (or as some people call
it, undesirable features)

It is great that you uncover some of these, so we can get a regression test
into the codebase and make sure it is covered during the refactoring that
is ongoing.

Cheers

On Fri, Apr 15, 2016 at 11:33 AM, zhuangmz08 <zh...@qq.com> wrote:

> Hi, Niclas,
> I've declare the TestValue.class(containing a TestEnum) as both value and
> entity composite.
> Their behavior is different, value is ok, but entity is fail.
> One interesting thing is that, I put TestValue into a TestEntity, it's
> ok....
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "zhuangmz08";<zh...@qq.com>;
> 发送时间: 2016年4月15日(星期五) 中午11:21
> 收件人: "dev"<de...@zest.apache.org>;
>
> 主题: 回复: Property<enum> in ValueComposite ok, EntityComposite fail?
>
>
>
> Hi, Niclas,
> I've post my code into [https://github.com/mingzhou/learn-zest]. Thanks.
> Do I need to declare every enum as entity or value composite?
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Niclas Hedhman";<ni...@hedhman.org>;
> 发送时间: 2016年4月15日(星期五) 上午10:54
> 收件人: "dev"<de...@zest.apache.org>;
>
> 主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?
>
>
>
> Do you do the equivalent of;
>
> public interface Abc {
>     Property<MyEnum> myState();
> }
>
> and in assembly doing;
>
> module.values( Abc.class );
> module.entities( Abc.class );
>
> and you get different results?? If so, then that is a bug. There should be
> no difference in the behavior here.
>
> In general, there should be no difference, but without seeing exactly what
> you are doing, it is difficult to know for sure.
>
> If you are only learning, could you publish your sources on GitHub and just
> point us to the code when you hit a snag? Easier for both us and you,  I
> think
>
> Niclas
>
>
> On Fri, Apr 15, 2016 at 10:46 AM, zhuangmz08 <zh...@qq.com> wrote:
>
> > hi,
> > public enum MyEnum{
> >  A, B, C, D
> > }
> >
> >
> > I use this enum in a ValueComposite and a EntityComposite, and try to
> > ser/deserialize it by using JacksonValueSerializationService.
> > However, value composite is ok, but entity composite throw exception
> > caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized
> > token 'A': was expecting ('true', 'false' or 'null')].
> > I'm wondering whether this is a bug or not.
> > Thanks a lot.
>
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

回复: Property in ValueComposite ok, EntityComposite fail?

Posted by zhuangmz08 <zh...@qq.com>.
Hi, Niclas,
I've declare the TestValue.class(containing a TestEnum) as both value and entity composite.
Their behavior is different, value is ok, but entity is fail.
One interesting thing is that, I put TestValue into a TestEntity, it's ok....




------------------ 原始邮件 ------------------
发件人: "zhuangmz08";<zh...@qq.com>;
发送时间: 2016年4月15日(星期五) 中午11:21
收件人: "dev"<de...@zest.apache.org>; 

主题: 回复: Property<enum> in ValueComposite ok, EntityComposite fail?



Hi, Niclas,
I've post my code into [https://github.com/mingzhou/learn-zest]. Thanks.
Do I need to declare every enum as entity or value composite?




------------------ 原始邮件 ------------------
发件人: "Niclas Hedhman";<ni...@hedhman.org>;
发送时间: 2016年4月15日(星期五) 上午10:54
收件人: "dev"<de...@zest.apache.org>; 

主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?



Do you do the equivalent of;

public interface Abc {
    Property<MyEnum> myState();
}

and in assembly doing;

module.values( Abc.class );
module.entities( Abc.class );

and you get different results?? If so, then that is a bug. There should be
no difference in the behavior here.

In general, there should be no difference, but without seeing exactly what
you are doing, it is difficult to know for sure.

If you are only learning, could you publish your sources on GitHub and just
point us to the code when you hit a snag? Easier for both us and you,  I
think

Niclas


On Fri, Apr 15, 2016 at 10:46 AM, zhuangmz08 <zh...@qq.com> wrote:

> hi,
> public enum MyEnum{
>  A, B, C, D
> }
>
>
> I use this enum in a ValueComposite and a EntityComposite, and try to
> ser/deserialize it by using JacksonValueSerializationService.
> However, value composite is ok, but entity composite throw exception
> caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized
> token 'A': was expecting ('true', 'false' or 'null')].
> I'm wondering whether this is a bug or not.
> Thanks a lot.




-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Re: Property in ValueComposite ok, EntityComposite fail?

Posted by Niclas Hedhman <ni...@hedhman.org>.
No, you only declare the composite types, ie. the 'container' of the
Mixins, Concerns and so on. These are the types that can be passed as an
argument to newXyzBuilder() methods and such.


Niclas

On Fri, Apr 15, 2016 at 11:21 AM, zhuangmz08 <zh...@qq.com> wrote:

> Hi, Niclas,
> I've post my code into [https://github.com/mingzhou/learn-zest]. Thanks.
> Do I need to declare every enum as entity or value composite?
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Niclas Hedhman";<ni...@hedhman.org>;
> 发送时间: 2016年4月15日(星期五) 上午10:54
> 收件人: "dev"<de...@zest.apache.org>;
>
> 主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?
>
>
>
> Do you do the equivalent of;
>
> public interface Abc {
>     Property<MyEnum> myState();
> }
>
> and in assembly doing;
>
> module.values( Abc.class );
> module.entities( Abc.class );
>
> and you get different results?? If so, then that is a bug. There should be
> no difference in the behavior here.
>
> In general, there should be no difference, but without seeing exactly what
> you are doing, it is difficult to know for sure.
>
> If you are only learning, could you publish your sources on GitHub and just
> point us to the code when you hit a snag? Easier for both us and you,  I
> think
>
> Niclas
>
>
> On Fri, Apr 15, 2016 at 10:46 AM, zhuangmz08 <zh...@qq.com> wrote:
>
> > hi,
> > public enum MyEnum{
> >  A, B, C, D
> > }
> >
> >
> > I use this enum in a ValueComposite and a EntityComposite, and try to
> > ser/deserialize it by using JacksonValueSerializationService.
> > However, value composite is ok, but entity composite throw exception
> > caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized
> > token 'A': was expecting ('true', 'false' or 'null')].
> > I'm wondering whether this is a bug or not.
> > Thanks a lot.
>
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

回复: Property in ValueComposite ok, EntityComposite fail?

Posted by zhuangmz08 <zh...@qq.com>.
Hi, Niclas,
I've post my code into [https://github.com/mingzhou/learn-zest]. Thanks.
Do I need to declare every enum as entity or value composite?




------------------ 原始邮件 ------------------
发件人: "Niclas Hedhman";<ni...@hedhman.org>;
发送时间: 2016年4月15日(星期五) 上午10:54
收件人: "dev"<de...@zest.apache.org>; 

主题: Re: Property<enum> in ValueComposite ok, EntityComposite fail?



Do you do the equivalent of;

public interface Abc {
    Property<MyEnum> myState();
}

and in assembly doing;

module.values( Abc.class );
module.entities( Abc.class );

and you get different results?? If so, then that is a bug. There should be
no difference in the behavior here.

In general, there should be no difference, but without seeing exactly what
you are doing, it is difficult to know for sure.

If you are only learning, could you publish your sources on GitHub and just
point us to the code when you hit a snag? Easier for both us and you,  I
think

Niclas


On Fri, Apr 15, 2016 at 10:46 AM, zhuangmz08 <zh...@qq.com> wrote:

> hi,
> public enum MyEnum{
>  A, B, C, D
> }
>
>
> I use this enum in a ValueComposite and a EntityComposite, and try to
> ser/deserialize it by using JacksonValueSerializationService.
> However, value composite is ok, but entity composite throw exception
> caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized
> token 'A': was expecting ('true', 'false' or 'null')].
> I'm wondering whether this is a bug or not.
> Thanks a lot.




-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Re: Property in ValueComposite ok, EntityComposite fail?

Posted by Niclas Hedhman <ni...@hedhman.org>.
Do you do the equivalent of;

public interface Abc {
    Property<MyEnum> myState();
}

and in assembly doing;

module.values( Abc.class );
module.entities( Abc.class );

and you get different results?? If so, then that is a bug. There should be
no difference in the behavior here.

In general, there should be no difference, but without seeing exactly what
you are doing, it is difficult to know for sure.

If you are only learning, could you publish your sources on GitHub and just
point us to the code when you hit a snag? Easier for both us and you,  I
think

Niclas


On Fri, Apr 15, 2016 at 10:46 AM, zhuangmz08 <zh...@qq.com> wrote:

> hi,
> public enum MyEnum{
>  A, B, C, D
> }
>
>
> I use this enum in a ValueComposite and a EntityComposite, and try to
> ser/deserialize it by using JacksonValueSerializationService.
> However, value composite is ok, but entity composite throw exception
> caused by [com.fasterxml.jackson.core.JsonParseException: Unrecognized
> token 'A': was expecting ('true', 'false' or 'null')].
> I'm wondering whether this is a bug or not.
> Thanks a lot.




-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java