(no subject)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

(no subject)

Josh Highley
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;

Thanks,
Josh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE:

Roger Whitcomb-2

Hi Josh,

                That just looks like a bug to me.  Can you file a JIRA and provide a patch along with, and I will commit the change…

 

Thank you!

~Roger

 

From: Josh Highley [mailto:[hidden email]]
Sent: Thursday, April 21, 2016 12:15 PM
To: [hidden email]
Subject:

 

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;
 
Thanks,
Josh
Loading...