Bug 521349 - Check of throwed exceptions lists fails on correct method signature (can't throw checked exception)
Summary: Check of throwed exceptions lists fails on correct method signature (can't th...
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: 1.8.9   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-24 04:32 EDT by Denys Khanzhyiev CLA
Modified: 2017-08-24 04:32 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denys Khanzhyiev CLA 2017-08-24 04:32:03 EDT
We have declared following pointcut

 pointcut newIndependent() : execution(@XPTransactionNewIndependent * *.*(..) throws RollbackException) ;

and corresponding advice

Object around() throws RollbackException : newIndependent() { .. }

And sometimes (not every time) we get following error during weaving

can't throw checked exception 'javax.transaction.RollbackException' at this join point 'method-execution(int de.aeb.xnsg.atlas.imp.cusdec.common.bc.ComCodeChange07BC.replaceCommCodesInProductsOrTemplateItemsManuallyTransaction(java.util.Collection, java.lang.String, java.lang.String, int))'

but the method has correct signature

@XPTransactionNewIndependent
	private int replaceCommCodesInProductsOrTemplateItemsManuallyTransaction(
			final Collection<AbstractCusdecItemTempl> productsOrTemplateItems, final String commCodeOld,
			final String commCodeNew, int counter) throws XPLockException, RollbackException { ... }


stack trace:


 -- (AbortException) can't throw checked exception 'javax.transaction.RollbackException' at this join point 'method-execution(int de.aeb.xnsg.atlas.imp.cusdec.common.bc.ComCodeChange07BC.replaceCommCodesInProductsOrTemplateItemsManuallyTransaction(java.util.Collection, java.lang.String, java.lang.String, int))'
10:33:11 can't throw checked exception 'javax.transaction.RollbackException' at this join point 'method-execution(int de.aeb.xnsg.atlas.imp.cusdec.common.bc.ComCodeChange07BC.replaceCommCodesInProductsOrTemplateItemsManuallyTransaction(java.util.Collection, java.lang.String, java.lang.String, int))'
10:33:11 Message: error at de\aeb\xnsg\atlas\imp\cusdec\common\bc\ComCodeChange07BC.java:273::0 can't throw checked exception 'javax.transaction.RollbackException' at this join point 'method-execution(int de.aeb.xnsg.atlas.imp.cusdec.common.bc.ComCodeChange07BC.replaceCommCodesInProductsOrTemplateItemsManuallyTransaction(java.util.Collection, java.lang.String, java.lang.String, int))'
10:33:11 org.aspectj.bridge.AbortException: can't throw checked exception 'javax.transaction.RollbackException' at this join point 'method-execution(int de.aeb.xnsg.atlas.imp.cusdec.common.bc.ComCodeChange07BC.replaceCommCodesInProductsOrTemplateItemsManuallyTransaction(java.util.Collection, java.lang.String, java.lang.String, int))'
10:33:11 	at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHolder.handleMessage(WeavingAdaptor.java:730)
10:33:11 	at org.aspectj.weaver.World.showMessage(World.java:724)
10:33:11 	at org.aspectj.weaver.Shadow.checkCanThrow(Shadow.java:505)
10:33:11 	at org.aspectj.weaver.Shadow.checkMunger(Shadow.java:490)
10:33:11 	at org.aspectj.weaver.Shadow.addMunger(Shadow.java:533)
10:33:11 	at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3312)
10:33:11 	at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2692)
10:33:11 	at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:480)
10:33:11 	at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100)
10:33:11 	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1697)
10:33:11 	at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1641)
10:33:11 	at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1406)
10:33:11 	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1188)
10:33:11 	at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:527)
10:33:11 	at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:363)
10:33:11 	at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:285)
...

So it looks like the problem is in org.aspectj.weaver.Shadow.checkCanThrow()
and so in org.aspectj.weaver.Shadow.isDeclaredException()
either Member.getExcpetions returns wrong list of declared exception 
or  org.aspectj.weaver.World.resolve() fails to resolve 
javax.transaction.RollbackException

the last thing could be caused by wrong class path
but in this case of javax.transaction.RollbackException
a class from JRT and even if so it will fail in other places before weaving...

I also do not understand why it works most of the time. But sometimes fails. 
Even on automatic builds during weekends when there are no changes in source code.