axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven.Blo...@gebit.de
Subject Re: BUG [?] in BeanUtil
Date Thu, 09 Oct 2008 20:00:55 GMT
Hi,
i can confrm that this is indeed a bug in BeanUtil. There are already two 
issues open for this (AXIS2-3538,AXIS2-3765) 
and i would be really happy if someone would commit my proposed bugfix (
AXIS2-3538) since we are using a self-patched version in our project and 
are going into qa shortly.

Best wishes,
Sven. 




Andrea Spinelli <andrea.spinelli@imteam.it> 
10.09.2008 16:06
Bitte antworten an
axis-user@ws.apache.org


An
axis-user@ws.apache.org
Kopie

Thema
BUG [?] in BeanUtil






Hi everybody, 

our company is using axis2 to make available to multiple platforms a 
document management service. 

Documents are represented by Java beans, with a property of type byte[], 
the content of the document. We have a method which sends a document from 
the client to the server. 

I noticed that the content of the document is received empty or garbled at 
the server side. I googled a lot about this issue, but found nothing. So I 
tried to debug the axis2 code (using Eclipse) and I think I isolated the 
problem. The XML SOAP request contains a fragment like (simplified and 
translated): 

...<document><field1>foo</field1>... <documentText>...(base64 encoded

content>...</documentText> ... <lastField>...</lastField></document>...


The axis2 code is contained in the ADB module, in the class 
org.apache.axis2.databinding.utils.BeanUtil. The program iterates over the 
properties of the javabean "document" until it finds the property 
"documentText"; it recognizes it is an array and calls recursively the 
deserialize method: 

                           } else if (parameters.isArray()) { 
                               partObj = deserialize(parameters, 
(OMElement)parts.getParent(), 
                                       objectSupplier, prty.getName()); 

Here "parts" is the element <documentText>, and its getParent() is 
"<document>". 

Then the following code is executed: 

           if (beanClass.isArray()) { 
               ArrayList valueList = new ArrayList(); 
               Class arrayClassType = beanClass.getComponentType(); 
               if ("byte".equals(arrayClassType.getName())) { 
                   return 
Base64.decode(beanElement.getFirstElement().getText()); 

Here "beanElement" is the second parameter of "deserialize", a structure 
representing the whole <document> element. 

So the Base64 decoder is called on the text of the first element of 
"<document>", which is "foo" in the above example, and is actually the 
value of field1 - not good. 

I modified the code deleting the call to getParent (passing directly 
"parts"), and calling the Base64 decoder on the text of the current 
element: 

                       return Base64.decode(beanElement.getText()); 

and it works fine for me, both from a .NET client and a axis1 client. 
Moreover, all the tests of the ADB module are OK. 

After all this explanation, my question is: is this a bug, or I 
misunderstood something? If my modifications are actually a fix, how can I 
submit it? 

TIA 
  Andrea 

-- 
dott. Andrea Spinelli - IMTeam 
e-mail: andrea dot spinelli at imteam dot it 
phone: +39-035-636029 
fax: +39-035-638129 
www: http://www.imteam.it/ 
IANA enterprise number: 1.3.6.1.4.1.30916 


--------------------------------------------------------------------- To 
unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org For additional 
commands, e-mail: axis-user-help@ws.apache.org 

Mime
View raw message