[jboss-jira] [JBoss JIRA] Commented: (JBAOP-618) AspectManager.getTempAdvisorIfNotExist causes infinite loop

Flavia Rainone (JIRA) jira-events at lists.jboss.org
Tue Jul 29 15:54:03 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBAOP-618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12422936#action_12422936 ] 

Flavia Rainone commented on JBAOP-618:
--------------------------------------

I'm afraid my previous comment was not clear. The Class.getDeclaredField is native code, so probably it contains optimizations. If we do this manually, we will have to do string comparison with Java, definitly expensier than the native implementation of getDeclaredField. So, I'm not sure that the gain we will have by avoiding the exception, which should occur 0 to 1 times on avarage, will make it up the extra cost.

> AspectManager.getTempAdvisorIfNotExist causes infinite loop
> -----------------------------------------------------------
>
>                 Key: JBAOP-618
>                 URL: https://jira.jboss.org/jira/browse/JBAOP-618
>             Project: JBoss AOP
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 2.0.0.CR15
>            Reporter: Flavia Rainone
>            Assignee: Flavia Rainone
>             Fix For: 2.0.0.GA
>
>
> This method contains a loop (lines 1207-1227)
>       while (superClass != null)
>        {
>                try
>                {
>                   Field field = superClass.getDeclaredField(Instrumentor.HELPER_FIELD_NAME);
>                   SecurityActions.setAccessible(field);
>                   advisor = (ClassAdvisor) field.get(null);
>                   if (advisor != null)
>                   {
>                      return advisor;
>                   }
>                   else
>                   {
>                      break;
>                   }
>                }
>                catch (NoSuchFieldException e)
>                {
>                   superClass = clazz.getSuperclass();
>                }
>             }
> With an infinite loop. Before entering this loop, superClazz value is assigned to be equal to clazz. If clazz is not advised, we get a NSFE, and go to clazz superclass. But, if this class is not advised, we will enter infinite loop, as we will check clazz's superclass again and again and again.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list