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.."