From:
aspectj-dev-admin@xxxxxxxxxxx [mailto:aspectj-dev-admin@xxxxxxxxxxx]
On Behalf Of Sascha
Benkart
Sent: Sunday,
February 08, 2004 4:22 AM
To:
aspectj-dev@xxxxxxxxxxx
Subject: [aspectj-dev] Weaved
code is faulty
I'm using AspectJ 1.1.1
with webMethods Integration
Server 6.0.1
(IS, eEnabling
platform), running on Java 1.4.
After weaving a so called
flow service (a Java class), I can't run the flow service within the
IS. First I didn't know what's wrong with the code, because outside IS
there is no problem to run AspectJ weaved
code.
So I decompiled a class
weaved by AspectJ. First lets have a look at the source before
weaving:
// Source code before
using AspaectJ
import
com.wm.app.b2b.server.ServiceException;
import
com.wm.data.*;
public final class
sandbox
{
static sandbox
_newInstance()
{
return new
sandbox();
}
static sandbox
_cast(Object o)
{
return
(sandbox)o;
}
public static
final void mergeDocToPipeline(IData pipeline)
throws
ServiceException
{
IDataCursor pipelineCursor
= pipeline.getCursor();
IData document =
IDataUtil.getIData(pipelineCursor,
"document");
pipelineCursor.destroy();
if(document
!= null)
IDataUtil.append(document,
pipeline);
}
static final
sandbox _instance = new sandbox();
Method _newInstance and
_cast are standard methods of a IS class. Method
mergeDocToPipeline defines a flow service and is not from great
interest of this problem.
Now, lets look at the
decompiled class after WEAVING:
// Source code after
using AspectJ
import
com.wm.app.b2b.server.ServiceException;
import
com.wm.data.*;
public final class
sandbox
{
static sandbox
_newInstance()
{
MethodTracing.aspectOf().ajc$before$MethodTracing$1b3();
new
sandbox();
break
MISSING_BLOCK_LABEL_25;
Throwable
throwable;
throwable;
MethodTracing.aspectOf().ajc$after$MethodTracing$1fc();
throw
throwable;
MethodTracing.aspectOf().ajc$after$MethodTracing$1fc();
return;
Exception
exception;
exception;
MethodTracing.aspectOf().ajc$afterThrowing$MethodTracing$241(exception);
throw
exception;
}
static sandbox
_cast(Object
o)
{
MethodTracing.aspectOf().ajc$before$MethodTracing$1b3();
(sandbox)o;
break
MISSING_BLOCK_LABEL_22;
Throwable
throwable;
throwable;
MethodTracing.aspectOf().ajc$after$MethodTracing$1fc();
throw
throwable;
MethodTracing.aspectOf().ajc$after$MethodTracing$1fc();
return;
Exception
exception;
exception;
MethodTracing.aspectOf().ajc$afterThrowing$MethodTracing$241(exception);
throw
exception;
}
public static
final void mergeDocToPipeline(IData pipeline)
throws
ServiceException
{
try
{
try
{
MethodTracing.aspectOf().ajc$before$MethodTracing$1b3();
IDataCursor
pipelineCursor =
pipeline.getCursor();
IData document =
IDataUtil.getIData(pipelineCursor,
"document");
pipelineCursor.destroy();
if(document
!= null)
IDataUtil.append(document,
pipeline);
}
catch(Throwable
throwable)
{
MethodTracing.aspectOf().ajc$after$MethodTracing$1fc();
throw
throwable;
}
MethodTracing.aspectOf().ajc$after$MethodTracing$1fc();
return;
}
catch(Exception
exception)
{
MethodTracing.aspectOf().ajc$afterThrowing$MethodTracing$241(exception);
throw
exception;
}
}
static final
sandbox _instance = new sandbox();
Looking again at methods
_newInstance and _cast. Both methods return nothing (See code
return;)!
I'm not sure if this is a problem of the decompiler, so I
decompiled the class not weaved by AspectJ and it looks like the
original former class.
Is it possible that
AspectJ weaves classes with methods _cast or _newInstance in a wrong
way?