2016-09-17 135 views
1

當我能夠在一個詹金斯項目的選項Use github hooks for build triggering,並儘量節省,我得到以下異常:詹金斯拉請求插件拋出一個ArrayIndexOutOfBoundsException異常

javax.servlet.ServletException: java.lang.ArrayIndexOutOfBoundsException: 1 
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796) 
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) 
    at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233) 
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) 
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) 
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) 
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) 
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) 
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) 
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:80) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) 
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) 
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) 
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) 
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) 
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) 
    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) 
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) 
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) 
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) 
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) 
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) 
    at org.eclipse.jetty.server.Server.handle(Server.java:499) 
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) 
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) 
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) 
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1 
    at org.kohsuke.github.GitHub.getRepository(GitHub.java:342) 
    at org.jenkinsci.plugins.ghprb.GhprbRepository.initGhRepository(GhprbRepository.java:112) 
    at org.jenkinsci.plugins.ghprb.GhprbRepository.getGitHubRepo(GhprbRepository.java:401) 
    at org.jenkinsci.plugins.ghprb.GhprbRepository.hookExist(GhprbRepository.java:269) 
    at org.jenkinsci.plugins.ghprb.GhprbRepository.createHook(GhprbRepository.java:292) 
    at org.jenkinsci.plugins.ghprb.GhprbTrigger.start(GhprbTrigger.java:260) 
    at org.jenkinsci.plugins.ghprb.GhprbTrigger.start(GhprbTrigger.java:66) 
    at hudson.model.AbstractProject.submit(AbstractProject.java:1884) 
    at hudson.model.Project.submit(Project.java:230) 
    at hudson.model.Job.doConfigSubmit(Job.java:1246) 
    at hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:796) 
    at sun.reflect.GeneratedMethodAccessor303.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:324) 
    at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:52) 
    at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) 
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167) 
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100) 
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124) 
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) 
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) 
    ... 58 more 

我不知道爲什麼會這樣。有沒有人有想法?在合併pull請求的基礎上工作得很好。如果我禁用該選項,我可以保存該項目,無任何例外。

非常感謝!

+1

聽起來像插件中的錯誤...你應該報告他們的錯誤跟蹤器。 – Tunaki

+0

@Tunaki,如何解決此錯誤?我使用jenkins verion 2.77。 – Karthi

+0

@Oleg Sklyar,如何解決此錯誤?我使用jenkins verion 2.77 – Karthi

回答

1

發生故障的方法是這樣的一個和用於ArrayIndexOutOfBoundsException的唯一原因,可以正確格式化(無/)或缺失(空)的令牌:

public GHRepository getRepository(String name) throws IOException { 
    String[] tokens = name.split("/"); 
    return retrieve().to("/repos/" + tokens[0] + '/' + tokens[1], GHRepository.class).wrap(this); 
} 

這裏是鏈接到源:https://github.com/kohsuke/github-api/blob/master/src/main/java/org/kohsuke/github/GitHub.java

插件文檔爲github提供了以下示例(並且從堆棧跟蹤中可以看到GitHub失敗):

remote { 
    github('test-owner/test-project') 
    refspec('+refs/pull/*:refs/remotes/origin/pr/*') 
} 

我懷疑remote.github必須是包含單斜槓的格式。

+0

雖然這不是一個真正的答案。 OP應該如何解決這個問題?這聽起來更像是一個針對插件開發者的評論。 – Tunaki

+0

我想檢查令牌將是下一步,你怎麼看? –

+0

@Tunaki但我同意你的看法,它是插件中的一個錯誤,因爲它不應該允許它使用不正確的憑證,並且因運行時異常而失敗。 –

相關問題