You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Thomas Calmant <th...@gmail.com> on 2011/06/28 12:27:46 UTC

[iPOJO] iPOJO returns an empty array working on already manipulated classes

Hi,

I've a strange behavior while working on the iPOJO builder for Eclipse :
when the iPOJO manipulator works on an already manipulated class, it returns
an empty array.
I've seen it comes from the method
"org.apache.felix.ipojo.manipulation.Manipulator.manipulate(byte[])"
(around line 70), where the test "ck.isalreadyManipulated()" is visible.

Wouldn't be a better behavior to return the original byte array ("origin")
instead of an empty one ?
According to the Pojoization class, the setBytecode() method is called
without tests, so it may erase the current class file content and imply an
invalid build state...

At least, it may be useful to indicate that behavior in the javadoc.

Regards,
Thomas.

Re: [iPOJO] iPOJO returns an empty array working on already manipulated classes

Posted by Thomas Calmant <th...@gmail.com>.
Ok

I've patched the eclipse builder source, waiting for the 1.8.2.

Regards,
Thomas.

2011/6/30 Clement Escoffier <cl...@gmail.com>

> Hi,
>
> I've opened and resolved https://issues.apache.org/jira/browse/FELIX-3017in the trunk.
>
> Regards,
>
> Clement
>
> On 30.06.2011, at 08:14, Clement Escoffier wrote:
>
> > Hi,
> >
> > On 28.06.2011, at 12:27, Thomas Calmant wrote:
> >
> >> Hi,
> >>
> >> I've a strange behavior while working on the iPOJO builder for Eclipse :
> >> when the iPOJO manipulator works on an already manipulated class, it
> returns
> >> an empty array.
> >> I've seen it comes from the method
> >> "org.apache.felix.ipojo.manipulation.Manipulator.manipulate(byte[])"
> >> (around line 70), where the test "ck.isalreadyManipulated()" is visible.
> >>
> >> Wouldn't be a better behavior to return the original byte array
> ("origin")
> >> instead of an empty one ?
> >
> > I think it's a former convention to determine is the class was
> manipulated, but I agree it would be better to return the same array, and
> use the isAlreadyManipulated method.
> >
> >> According to the Pojoization class, the setBytecode() method is called
> >> without tests, so it may erase the current class file content and imply
> an
> >> invalid build state...
> >
> > I'm not sure, but it should be tested... I will have a look to confirm
> it.
> >
> >>
> >> At least, it may be useful to indicate that behavior in the javadoc.
> >
> > Will do,
> >
> > Regards,
> >
> > Clement
> >
> >>
> >> Regards,
> >> Thomas.
> >
>
>

Re: [iPOJO] iPOJO returns an empty array working on already manipulated classes

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

I've opened and resolved https://issues.apache.org/jira/browse/FELIX-3017 in the trunk.

Regards,

Clement

On 30.06.2011, at 08:14, Clement Escoffier wrote:

> Hi,
> 
> On 28.06.2011, at 12:27, Thomas Calmant wrote:
> 
>> Hi,
>> 
>> I've a strange behavior while working on the iPOJO builder for Eclipse :
>> when the iPOJO manipulator works on an already manipulated class, it returns
>> an empty array.
>> I've seen it comes from the method
>> "org.apache.felix.ipojo.manipulation.Manipulator.manipulate(byte[])"
>> (around line 70), where the test "ck.isalreadyManipulated()" is visible.
>> 
>> Wouldn't be a better behavior to return the original byte array ("origin")
>> instead of an empty one ?
> 
> I think it's a former convention to determine is the class was manipulated, but I agree it would be better to return the same array, and use the isAlreadyManipulated method.
> 
>> According to the Pojoization class, the setBytecode() method is called
>> without tests, so it may erase the current class file content and imply an
>> invalid build state...
> 
> I'm not sure, but it should be tested... I will have a look to confirm it.
> 
>> 
>> At least, it may be useful to indicate that behavior in the javadoc.
> 
> Will do,
> 
> Regards,
> 
> Clement
> 
>> 
>> Regards,
>> Thomas.
> 


Re: [iPOJO] iPOJO returns an empty array working on already manipulated classes

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

On 28.06.2011, at 12:27, Thomas Calmant wrote:

> Hi,
> 
> I've a strange behavior while working on the iPOJO builder for Eclipse :
> when the iPOJO manipulator works on an already manipulated class, it returns
> an empty array.
> I've seen it comes from the method
> "org.apache.felix.ipojo.manipulation.Manipulator.manipulate(byte[])"
> (around line 70), where the test "ck.isalreadyManipulated()" is visible.
> 
> Wouldn't be a better behavior to return the original byte array ("origin")
> instead of an empty one ?

I think it's a former convention to determine is the class was manipulated, but I agree it would be better to return the same array, and use the isAlreadyManipulated method.

> According to the Pojoization class, the setBytecode() method is called
> without tests, so it may erase the current class file content and imply an
> invalid build state...

I'm not sure, but it should be tested... I will have a look to confirm it.

> 
> At least, it may be useful to indicate that behavior in the javadoc.

Will do,

Regards,

Clement

> 
> Regards,
> Thomas.