You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Miguel Ferreira <mi...@hotmail.com> on 2015/08/27 13:52:17 UTC

RE: AW: Blaze DS 4.7.1 - bug found

Hi all,
i found the problem in the class: MethodMatcher  

Before we add this code

                if (obj == null || 

                        (desiredParamTypes[i].isAssignableFrom(objClass))
||

                       
(desiredParamTypes[i] == Integer.TYPE && Integer.class.isAssignableFrom(objClass))
||

                       
(desiredParamTypes[i] == Double.TYPE &&
Double.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Long.TYPE &&
Long.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Boolean.TYPE &&
Boolean.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Character.TYPE &&
Character.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Float.TYPE &&
Float.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Short.TYPE &&
Short.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Byte.TYPE &&
Byte.class.isAssignableFrom(objClass)))

               
{

                   
parameters.set(i, obj);

                   
matchCount++;

               
}

So, when the conversion used by the TypeMarshaller returns null then the parameter is added to be use in the method call by reflection


But with the new version:
if (objClass != null && isAssignableFrom(desiredParamTypes[i],
objClass))               
{                   
// See if there's
an exact match before parameter is converted.                   
if (isAssignableFrom(desiredParamTypes[i],
param.getClass()))                       
exactMatchCount++;                    
if (convert) // Convert the parameter.                       
parameters.set(i, obj);                    
matchCount++;



















               
}

The condition of the object is removed it should be (if (obj == null ||(objClass != null && isAssignableFrom(desiredParamTypes[i], objClass)))
because the condition to get the objClass is  currentMatch.convertedSuppliedTypes[i] = (obj != null ? (objClass = obj.getClass()) : null);

So with the change of the current code the TypeMarshaller everytime that send null the ObjClass will be null and then the matchCount will no tbe updated and the parameter is not set! Causing the exception that this method don't exist.

Here is the full class from the version 3.2:http://grepcode.com/file/repo1.maven.org/maven2/com.adobe.blazeds/blazeds-core/3.2.0.3978/flex/messaging/util/MethodMatcher.java
Chris, It is possible to make this change or is better to find a "local" solution?
Thanks again in advance.
> From: christofer.dutz@c-ware.de
> To: users@flex.apache.org
> Subject: AW: Blaze DS 4.7.1
> Date: Wed, 26 Aug 2015 20:59:35 +0000
> 
> Does this article of mine eventually help?
> 
> https://dev.c-ware.de/confluence/display/PUBLIC/Fixing+the+mapping+of+null+values+for+numeric+types
> 
> Chris
> 
> ________________________________________
> Von: Mario Souza <ma...@vizexplorer.com>
> Gesendet: Mittwoch, 26. August 2015 22:48
> An: users@flex.apache.org
> Betreff: Re: Blaze DS 4.7.1
> 
> You have a NaN value in Java if you're using the Double or Float
> http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html#NaN
> http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Float.html#NaN
> 
> 
> I'm not sure but I think that BlazeDS serializes the AS3 Number.NaN to a
> Java Double type, then by reflection api, the BlazeDS can't find a method
> with this signature (String, Double) because your signature is a (String,
> Long).
> 
> Change your method signature and make sure that you're sending the correct
> types from AS3.
> 
> 
> Regards.
> 
> 
> 
> 
> ---
> *Mario de Souza*
> UI Developer
> Website: www.vizexplorer.com
> Skype: vizexplorer-mariosouza
> M +6421 082 71135
> <http://www.vizexplorer.com/>
> Level 3, 54-56 Cambridge Terrace
> PO Box 19204, Wellington 6149
> 
> *The information contained in this email may be private and/or
> confidential. It has been sent for the sole use of the intended
> recipient(s). If the reader of this message is not an intended recipient,
> you are hereby notified that any unauthorized review, use, disclosure,
> dissemination, distribution, or copying of this communication, or any of
> its contents, is strictly prohibited. If you have received this
> communication in error, please contact the sender by reply email and
> destroy all copies of the original message.*
> 
> 
> On 27 August 2015 at 04:03, Miguel Ferreira <mi...@hotmail.com>
> wrote:
> 
> > zero and -1 have meaning in the business application.
> > The workaround is to pass a context object as argument.
> >
> > But, this kind of error dint exist before in the old version 3.2 of
> > BlazeDS.
> > I don't know why when is trying to call the remote function BlazeDS don't
> > find the correct signature.
> > I even try to have another method without the last parameter to verify the
> > behavior of it.
> > Maybe someone know how i can try to switch on the debugger of blazeDS.
> > Thanks for the help deepak. I am trying to see a general solution because
> > i have a lot of methods that use Long as an argument.
> > > Date: Wed, 26 Aug 2015 21:27:26 +0530
> > > Subject: Re: Blaze DS 4.7.1
> > > From: megharajdeepak@gmail.com
> > > To: users@flex.apache.org
> > >
> > > Is there any purpose of passing NaN ? You may instead try to pass a
> > > specific number say 0 or -1 in case of NaN.
> >
> >
 		 	   		  

AW: AW: Blaze DS 4.7.1 - bug found

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Miguel,

It took a little for me to dig into your problem, but I think I now know what you are refereing to.
I'll look into it and probably make a 4.8.0-SNAPSHOT available as soon as possible.

Chris

-----Ursprüngliche Nachricht-----
Von: Miguel Ferreira [mailto:miguel.cd.ferreira@hotmail.com] 
Gesendet: Donnerstag, 27. August 2015 13:52
An: users@flex.apache.org
Betreff: RE: AW: Blaze DS 4.7.1 - bug found

Hi all,
i found the problem in the class: MethodMatcher  

Before we add this code

                if (obj == null || 

                        (desiredParamTypes[i].isAssignableFrom(objClass))
||

                       
(desiredParamTypes[i] == Integer.TYPE && Integer.class.isAssignableFrom(objClass))
||

                       
(desiredParamTypes[i] == Double.TYPE &&
Double.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Long.TYPE &&
Long.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Boolean.TYPE &&
Boolean.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Character.TYPE &&
Character.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Float.TYPE &&
Float.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Short.TYPE &&
Short.class.isAssignableFrom(objClass)) ||

                       
(desiredParamTypes[i] == Byte.TYPE &&
Byte.class.isAssignableFrom(objClass)))

               
{

                   
parameters.set(i, obj);

                   
matchCount++;

               
}

So, when the conversion used by the TypeMarshaller returns null then the parameter is added to be use in the method call by reflection


But with the new version:
if (objClass != null && isAssignableFrom(desiredParamTypes[i],
objClass))               
{                   
// See if there's
an exact match before parameter is converted.                   
if (isAssignableFrom(desiredParamTypes[i],
param.getClass()))                       
exactMatchCount++;                    
if (convert) // Convert the parameter.                       
parameters.set(i, obj);                    
matchCount++;



















               
}

The condition of the object is removed it should be (if (obj == null ||(objClass != null && isAssignableFrom(desiredParamTypes[i], objClass))) because the condition to get the objClass is  currentMatch.convertedSuppliedTypes[i] = (obj != null ? (objClass = obj.getClass()) : null);

So with the change of the current code the TypeMarshaller everytime that send null the ObjClass will be null and then the matchCount will no tbe updated and the parameter is not set! Causing the exception that this method don't exist.

Here is the full class from the version 3.2:http://grepcode.com/file/repo1.maven.org/maven2/com.adobe.blazeds/blazeds-core/3.2.0.3978/flex/messaging/util/MethodMatcher.java
Chris, It is possible to make this change or is better to find a "local" solution?
Thanks again in advance.
> From: christofer.dutz@c-ware.de
> To: users@flex.apache.org
> Subject: AW: Blaze DS 4.7.1
> Date: Wed, 26 Aug 2015 20:59:35 +0000
> 
> Does this article of mine eventually help?
> 
> https://dev.c-ware.de/confluence/display/PUBLIC/Fixing+the+mapping+of+
> null+values+for+numeric+types
> 
> Chris
> 
> ________________________________________
> Von: Mario Souza <ma...@vizexplorer.com>
> Gesendet: Mittwoch, 26. August 2015 22:48
> An: users@flex.apache.org
> Betreff: Re: Blaze DS 4.7.1
> 
> You have a NaN value in Java if you're using the Double or Float 
> http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html#NaN
> http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Float.html#NaN
> 
> 
> I'm not sure but I think that BlazeDS serializes the AS3 Number.NaN to 
> a Java Double type, then by reflection api, the BlazeDS can't find a 
> method with this signature (String, Double) because your signature is 
> a (String, Long).
> 
> Change your method signature and make sure that you're sending the 
> correct types from AS3.
> 
> 
> Regards.
> 
> 
> 
> 
> ---
> *Mario de Souza*
> UI Developer
> Website: www.vizexplorer.com
> Skype: vizexplorer-mariosouza
> M +6421 082 71135
> <http://www.vizexplorer.com/>
> Level 3, 54-56 Cambridge Terrace
> PO Box 19204, Wellington 6149
> 
> *The information contained in this email may be private and/or 
> confidential. It has been sent for the sole use of the intended 
> recipient(s). If the reader of this message is not an intended 
> recipient, you are hereby notified that any unauthorized review, use, 
> disclosure, dissemination, distribution, or copying of this 
> communication, or any of its contents, is strictly prohibited. If you 
> have received this communication in error, please contact the sender 
> by reply email and destroy all copies of the original message.*
> 
> 
> On 27 August 2015 at 04:03, Miguel Ferreira 
> <mi...@hotmail.com>
> wrote:
> 
> > zero and -1 have meaning in the business application.
> > The workaround is to pass a context object as argument.
> >
> > But, this kind of error dint exist before in the old version 3.2 of 
> > BlazeDS.
> > I don't know why when is trying to call the remote function BlazeDS 
> > don't find the correct signature.
> > I even try to have another method without the last parameter to 
> > verify the behavior of it.
> > Maybe someone know how i can try to switch on the debugger of blazeDS.
> > Thanks for the help deepak. I am trying to see a general solution 
> > because i have a lot of methods that use Long as an argument.
> > > Date: Wed, 26 Aug 2015 21:27:26 +0530
> > > Subject: Re: Blaze DS 4.7.1
> > > From: megharajdeepak@gmail.com
> > > To: users@flex.apache.org
> > >
> > > Is there any purpose of passing NaN ? You may instead try to pass 
> > > a specific number say 0 or -1 in case of NaN.
> >
> >