Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33683

Hiding ManagementLink is inconsistent with hiding Action

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      When hiding Action, getUrlName and getIconFileName needs to be null. Actually, InvisibleAction suggests it is ok for getDisplayName to be null as well.

      However ManagementLink (that implements Action) requires null for getIconFileName to hide it and throws exception left and right in case getUrlName is null:

      WARNING: Error while serving http://localhost:58800/jenkins/ajaxBuildQueue
      java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
      	at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:388)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:631)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:225)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:85)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
      	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:326)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NullPointerException
      	at jenkins.model.Jenkins.getDynamic(Jenkins.java:2829)
      	... 45 more
      

      This one is especially cryptic:

      javax.servlet.ServletException
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:778)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:631)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:225)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:91)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
      	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:326)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            test/src/test/java/hudson/model/ManagementLinkTest.java
            http://jenkins-ci.org/commit/jenkins/e4d7da6053883be13d8b7398d2d2cbcb87aa01f2
            Log:
            JENKINS-33683 Reproduce

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: test/src/test/java/hudson/model/ManagementLinkTest.java http://jenkins-ci.org/commit/jenkins/e4d7da6053883be13d8b7398d2d2cbcb87aa01f2 Log: JENKINS-33683 Reproduce
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            core/src/main/java/hudson/Functions.java
            core/src/main/java/hudson/model/Action.java
            core/src/main/java/hudson/model/ManagementLink.java
            core/src/main/java/hudson/model/User.java
            core/src/main/java/hudson/model/View.java
            core/src/main/java/jenkins/model/Jenkins.java
            test/src/test/java/hudson/model/ManagementLinkTest.java
            http://jenkins-ci.org/commit/jenkins/eefafb2b38a5ee5cf51c72a1e9c902ec6f38dc8e
            Log:
            [FIXED JENKINS-33683] Clarify Action methods can return null

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/Functions.java core/src/main/java/hudson/model/Action.java core/src/main/java/hudson/model/ManagementLink.java core/src/main/java/hudson/model/User.java core/src/main/java/hudson/model/View.java core/src/main/java/jenkins/model/Jenkins.java test/src/test/java/hudson/model/ManagementLinkTest.java http://jenkins-ci.org/commit/jenkins/eefafb2b38a5ee5cf51c72a1e9c902ec6f38dc8e Log: [FIXED JENKINS-33683] Clarify Action methods can return null
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            test/src/test/java/hudson/model/ManagementLinkTest.java
            http://jenkins-ci.org/commit/jenkins/4c02f1db33820733d9500aaa4e5304b30dc0e2ab
            Log:
            JENKINS-33683 Do not restrict invisible action to single test

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: test/src/test/java/hudson/model/ManagementLinkTest.java http://jenkins-ci.org/commit/jenkins/4c02f1db33820733d9500aaa4e5304b30dc0e2ab Log: JENKINS-33683 Do not restrict invisible action to single test
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            core/src/main/java/hudson/Functions.java
            http://jenkins-ci.org/commit/jenkins/8fdca297132b953b5572c97480b8017695f92d6d
            Log:
            JENKINS-33683 Annotate Function#getActionUrl() as well

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/Functions.java http://jenkins-ci.org/commit/jenkins/8fdca297132b953b5572c97480b8017695f92d6d Log: JENKINS-33683 Annotate Function#getActionUrl() as well
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            core/src/main/java/hudson/Functions.java
            core/src/main/java/hudson/model/Action.java
            core/src/main/java/hudson/model/ManagementLink.java
            core/src/main/java/hudson/model/User.java
            core/src/main/java/hudson/model/View.java
            core/src/main/java/jenkins/model/Jenkins.java
            test/src/test/java/hudson/model/ManagementLinkTest.java
            http://jenkins-ci.org/commit/jenkins/ac566a91e44e3482083355bd5cde3cf65610c4a3
            Log:
            Merge pull request #2146 from olivergondza/hide-management-link

            [FIXED JENKINS-33683] - Fix Management link hiding

            Compare: https://github.com/jenkinsci/jenkins/compare/b17e04c9dc05...ac566a91e44e

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/Functions.java core/src/main/java/hudson/model/Action.java core/src/main/java/hudson/model/ManagementLink.java core/src/main/java/hudson/model/User.java core/src/main/java/hudson/model/View.java core/src/main/java/jenkins/model/Jenkins.java test/src/test/java/hudson/model/ManagementLinkTest.java http://jenkins-ci.org/commit/jenkins/ac566a91e44e3482083355bd5cde3cf65610c4a3 Log: Merge pull request #2146 from olivergondza/hide-management-link [FIXED JENKINS-33683] - Fix Management link hiding Compare: https://github.com/jenkinsci/jenkins/compare/b17e04c9dc05...ac566a91e44e

              People

              Assignee:
              olivergondza Oliver Gondža
              Reporter:
              olivergondza Oliver Gondža
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: