ContentByUser Macro broken when users have drafts.

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Medium
    • None
    • Affects Version/s: 2.6.0
    • Component/s: None

      The {content-by-user} macro generates an error stack trace when that user has drafts.

      the error
      java.lang.IllegalArgumentException: Could not check permissions for Draft = { id: 1146892, type: page, title: Home} no suitable delegate found.
      	at com.atlassian.confluence.security.DefaultPermissionManager.findDelegateFor(DefaultPermissionManager.java:119)
      	at com.atlassian.confluence.security.DefaultPermissionManager.hasPermission(DefaultPermissionManager.java:31)
      	at com.atlassian.confluence.security.DefaultPermissionManager.getPermittedEntities(DefaultPermissionManager.java:49)
      	at sun.reflect.GeneratedMethodAccessor494.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
      	at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
      	at $Proxy32.getPermittedEntities(Unknown Source)
      	at com.atlassian.confluence.renderer.radeox.macros.ContentByUserMacro.fetchContent(ContentByUserMacro.java:75)
      	at com.atlassian.confluence.renderer.radeox.macros.ContentByUserMacro.getHtml(ContentByUserMacro.java:46)
      

      The fix for CONF-9701 is not sufficient to fix this bug, because even when a permission delegate is added, the macro fails to render because the Draft object has no URL.

      there's no url
      2007-10-25 14:01:29,350 ERROR [http-8080-Processor3] [confluence.util.velocity.VelocityUtils] getRenderedTemplate Error occurred rendering template: templates/macros/co
      ntentbyuser.vm
       -- url: /display/~admin/cbm+macro | userName: admin | action: viewpage | page: 360453
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getUrlPath' in  class com.atlassian.confluence.pages.Draft threw exception class java.lan
      g.UnsupportedOperationException : null
              at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:188)
              at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:226)
      
      

              Assignee:
              Unassigned
              Reporter:
              Don Willis
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: