You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Roger Whitcomb (JIRA)" <ji...@apache.org> on 2016/04/22 17:57:13 UTC

[jira] [Updated] (PIVOT-987) Different handling of script return values in BXMLSerializer

     [ https://issues.apache.org/jira/browse/PIVOT-987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Whitcomb updated PIVOT-987:
---------------------------------
    Attachment: 987.patch

Attaching "987.patch" as what I think the fix should be.

Josh, can you please verify that this patch is what you expect to see?  If so, I will check in and you can pull the 2.0.x branch and test.  (The patch file is for "trunk", but the code changes are exactly the same for the 2.0.x branch).

> Different handling of script return values in BXMLSerializer
> ------------------------------------------------------------
>
>                 Key: PIVOT-987
>                 URL: https://issues.apache.org/jira/browse/PIVOT-987
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-serialization
>    Affects Versions: 2.0.4
>         Environment: All
>            Reporter: Josh Highley
>            Assignee: Roger Whitcomb
>            Priority: Minor
>             Fix For: 2.1, 2.0.5
>
>         Attachments: 987.patch
>
>
> In my bxml, I defined a TextInputContentListener method for previewInsertText in script.  The method was getting invoked, but my returned Vote seemed to get ignored.  Stepping through the code, I found that BXMLSerializer never assigns the result variable and ignores the returned value when the method is specified as an attribute but not when it's a child element.  Is there a reason for this, or is this a bug? 
> I'm using 2.0.4, but the same code is in trunk
> BXMLSerializer:
> inner class AttributeInvocationHandler, method invoke(Object proxy, Method method, Object[] args)
> ....
>    // If the function didn't return a value, return the default
>    Class<?> returnType = method.getReturnType();
>    if (returnType == Vote.class) {
>        result = Vote.APPROVE;
>    } else if (returnType == Boolean.TYPE) {
>        result = false;
>    }
>    return result;
> inner class ElementInvocationHandler, method invoke(Object proxy, Method method, Object[] args)
> .....
>    // If the function didn't return a value, return the default
>    if (result == null) {
>       Class<?> returnType = method.getReturnType();
>       if (returnType == Vote.class) {
>          result = Vote.APPROVE;
>       } else if (returnType == Boolean.TYPE) {
>          result = false;
>       }
>    }
>    return result;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Re: [jira] [Updated] (PIVOT-987) Different handling of script return values in BXMLSerializer

Posted by Josh Highley <jo...@gmail.com>.
The JIRA lockdown keeps me from commenting on the issue directly, but, yes,
those are the changes I expected.

Thanks,

Josh


On Fri, Apr 22, 2016 at 10:57 AM, Roger Whitcomb (JIRA) <ji...@apache.org>
wrote:

>
>      [
> https://issues.apache.org/jira/browse/PIVOT-987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
>
> Roger Whitcomb updated PIVOT-987:
> ---------------------------------
>     Attachment: 987.patch
>
> Attaching "987.patch" as what I think the fix should be.
>
> Josh, can you please verify that this patch is what you expect to see?  If
> so, I will check in and you can pull the 2.0.x branch and test.  (The patch
> file is for "trunk", but the code changes are exactly the same for the
> 2.0.x branch).
>
> > Different handling of script return values in BXMLSerializer
> > ------------------------------------------------------------
> >
> >                 Key: PIVOT-987
> >                 URL: https://issues.apache.org/jira/browse/PIVOT-987
> >             Project: Pivot
> >          Issue Type: Bug
> >          Components: core-serialization
> >    Affects Versions: 2.0.4
> >         Environment: All
> >            Reporter: Josh Highley
> >            Assignee: Roger Whitcomb
> >            Priority: Minor
> >             Fix For: 2.1, 2.0.5
> >
> >         Attachments: 987.patch
> >
> >
> > In my bxml, I defined a TextInputContentListener method for
> previewInsertText in script.  The method was getting invoked, but my
> returned Vote seemed to get ignored.  Stepping through the code, I found
> that BXMLSerializer never assigns the result variable and ignores the
> returned value when the method is specified as an attribute but not when
> it's a child element.  Is there a reason for this, or is this a bug?
> > I'm using 2.0.4, but the same code is in trunk
> > BXMLSerializer:
> > inner class AttributeInvocationHandler, method invoke(Object proxy,
> Method method, Object[] args)
> > ....
> >    // If the function didn't return a value, return the default
> >    Class<?> returnType = method.getReturnType();
> >    if (returnType == Vote.class) {
> >        result = Vote.APPROVE;
> >    } else if (returnType == Boolean.TYPE) {
> >        result = false;
> >    }
> >    return result;
> > inner class ElementInvocationHandler, method invoke(Object proxy, Method
> method, Object[] args)
> > .....
> >    // If the function didn't return a value, return the default
> >    if (result == null) {
> >       Class<?> returnType = method.getReturnType();
> >       if (returnType == Vote.class) {
> >          result = Vote.APPROVE;
> >       } else if (returnType == Boolean.TYPE) {
> >          result = false;
> >       }
> >    }
> >    return result;
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)
>