[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Strange Happenings with AspectJ

Hi All,

 

When applying around advice on a method it rewrites the method wrongly.  This happens only when I try to apply aspects to bytecode as against source code.

 

Without Aspects

 

int i;

        for(; rs.next(); transactionList.add(new Transaction(rs.getString(i++), rs.getFloat(i++), rs.getString(i++), rs.getString(i++), rs.getString(i++), rs.getString(i++), rs.getString(i++), rs.getString(i++), rs.getString(i++), rs.getString(i++), rs.getFloat(i++), rs.getDate(i++), rs.getString(i++), rs.getString(i++), rs.getString(i++))))

            i = 1;

 

With Aspects

 

        for(; resultset.next(); arraylist.add(new Transaction(resultset.getString(j), resultset.getFloat(j), resultset.getString(j), resultset.getString(j), resultset.getString(j), resultset.getString(j), resultset.getString(j), resultset.getString(j), resultset.getString(j), resultset.getString(j), resultset.getFloat(j), resultset.getDate(j), resultset.getString(j), resultset.getString(j), resultset.getString(j))))

        {

            int j = 1;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

            i++;

        }

 

Obviously since j is never incremented our program fails with returning an invalid value for getFloat() call.

 

The actual size of this method is around 220 lines. I’ve reduced the size of this method to around 175 odd lines. Then I’m not facing this problem.It works fine giving me the following result

 

preparedstatement = (PreparedStatement)definePreparedStatement_aroundBody21$advice(transactiondao, dbconnectionwrapper9, s20,         preparedstatement.setString(1, s);

        int i;

        for(resultset = preparedstatement.executeQuery(); resultset.next(); arraylist.add(new Transaction(resultset.getString(i++),             i = 1;

(i++), resultset.getString(i++), resultset.getString(i++), resultset.getString(i++), resultset.getFloat(i++), resultset.getDate(i++), resultset.getString(i++))

 

 

Is it something to do with the size of the method??

 

Any ideas why this would be happening and how to solve it?

 

 

 

Regards,

 

Hari Prabu S.K.

Software Engineer(SETLabs)

x- 59224

mobile-09341733228

 

"Never love a love that hurts,never hurt a heart that loves.."

 

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

GIF image