anubhav94 / team-piazza

Automatically exported from code.google.com/p/team-piazza
GNU General Public License v3.0
0 stars 0 forks source link

Occasionally team piazza fails with a NullPointerException #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Occasionally team piazza fails completely (presumably something funny 
about the changeset that teamcity has just processed) with the following 
error. We are using the latest version 5.1.2 (build 13430) but have 
observed this on the previous 5.1.x versions as well.

Trace: java.lang.NullPointerException
    at com.natpryce.piazza.BuildTypeMonitorViewState.changesInBuild
(BuildTypeMonitorViewState.java:91)
    at 
com.natpryce.piazza.BuildTypeMonitorViewState.commitMessagesForBuild
(BuildTypeMonitorViewState.java:68)
    at com.natpryce.piazza.BuildTypeMonitorViewState.<init>
(BuildTypeMonitorViewState.java:44)
    at com.natpryce.piazza.ProjectMonitorViewState.<init>
(ProjectMonitorViewState.java:23)
    at com.natpryce.piazza.BuildMonitorController.showProject
(BuildMonitorController.java:64)
    at com.natpryce.piazza.BuildMonitorController.doHandle
(BuildMonitorController.java:50)
    at 
jetbrains.buildServer.controllers.BaseController.handleRequestInternal
(BaseController.java:73)
    at 
org.springframework.web.servlet.mvc.AbstractController.handleRequest
(AbstractController.java:153)
    at 
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle
(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch
(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet.doService
(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest
(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doGet
(FrameworkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at 
jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.service
(TeamCityDispatcherServlet.java:36)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:206)
    at 
jetbrains.buildServer.web.SetThreadNameFilter.runChainWithModifiedThreadName
(SetThreadNameFilter.java:8)
    at jetbrains.buildServer.web.SetThreadNameFilter.doFilter
(SetThreadNameFilter.java:26)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:206)
    at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter
(ResponseFragmentFilter.java:5)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:852)
    at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run
(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)

Original issue reported on code.google.com by willhol...@gmail.com on 26 May 2010 at 9:20

GoogleCodeExporter commented 9 years ago
I have "fixed" this matter by adding this code to line 72 of the 
BuildTypeMonitorViewState class. I'm not sure why the description is null, but 
sometimes it is.. and this works around it.

            if(vcsModification != null)
            {
                commitMessages.add(vcsModification.getDescription().trim());
            }
            else
            {
                System.out.println("vcsModification.getDescription() was null, by this user: " + vcsModification.getUserName());
            }

Original comment by denis.kr...@gmail.com on 30 Sep 2010 at 2:01

GoogleCodeExporter commented 9 years ago
Actually strike that.. without testing I was going to introduce another 
nullpointer.. so now the work-around is;

            if(vcsModification != null)
            {
                commitMessages.add(vcsModification.getDescription().trim());
            }

that's it.

Original comment by denis.kr...@gmail.com on 30 Sep 2010 at 2:05

GoogleCodeExporter commented 9 years ago
who really needs to test their code? Certainly not me! Third time lucky.

if(vcsModification.getDescription() != null)
{
     commitMessages.add(vcsModification.getDescription().trim());
}

Original comment by denis.kr...@gmail.com on 30 Sep 2010 at 11:03

GoogleCodeExporter commented 9 years ago
Hi Denis,

thank you very much for the code pointers. I introduced your suggested null 
checks.

Original comment by timomeinen on 29 Nov 2011 at 3:16