History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-2421
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Unassigned
Reporter: AlSt
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Changes REST and velocity template raises NullPointerException because a repository was changed

Created: 27/Apr/15 12:46 PM   Updated: 30/Apr/15 04:06 AM
Component/s: None
Affects Version/s: 5.1.40
Fix Version/s: 6.0.13

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: None
Image Attachments:

1. commitdate-null.PNG
(29 kb)


 Description  « Hide
We changed a repository to use another configuration path as dependency and now the change is shown with "Unknown Date" and "UNKNOWN" user (committer) with the message that the dependency to <old config name> has been removed.

When we use the rest request with /rest/changes/commits/build/<buildid> we get the error:
2015-04-27 14:29:19,040 [qtp1509221534-853415] ERROR com.pmease.quickbuild.rest.providers.GenericExceptionMapper - Error serving restful request.
    java.lang.NullPointerException
        at com.pmease.quickbuild.plugin.report.changes.rest.ChangesetMapper.handle(ChangesetMapper.java:47)
        at com.pmease.quickbuild.plugin.report.changes.rest.ChangesetMapper.handle(ChangesetMapper.java:18)
        at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:396)
        at com.pmease.quickbuild.plugin.report.engine.datastore.DbStore.query(DbStore.java:87)
        at com.pmease.quickbuild.plugin.report.engine.datastore.DbStore.query(DbStore.java:59)
        at com.pmease.quickbuild.plugin.report.changes.ChangesHelper.getBuildChangesets(ChangesHelper.java:283)
        at com.pmease.quickbuild.plugin.report.changes.rest.ChangesResource.getBuildChanges(ChangesResource.java:179)
        at sun.reflect.GeneratedMethodAccessor440.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:149)
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:259)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:990)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:941)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:932)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:384)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:451)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:632)
        at com.pmease.quickbuild.rest.RestServlet.service(RestServlet.java:48)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

The relevant code line is: change.setDate(new Date(rs.getTimestamp("changesets.commitDate").getTime()));
It seems that the commitDate is null and so it raises a NPE.

Also the velocity template failed with a NPE:
2015-04-27 13:21:29,551 [pool-1-thread-17391] ERROR com.pmease.quickbuild.DefaultBuildEngine - Error processing build request.
    com.pmease.quickbuild.QuickbuildException: Failed to evaluate Velocity template.
        at com.pmease.quickbuild.util.ExceptionUtils.wrapException(ExceptionUtils.java:89)
        at com.pmease.quickbuild.util.VelocityUtils.evalTemplate(VelocityUtils.java:44)
        at com.pmease.quickbuild.plugin.notifier.email.EmailNotifier.notify(EmailNotifier.java:113)
        at com.pmease.quickbuild.DefaultBuildEngine.sendNotifications(DefaultBuildEngine.java:898)
        at com.pmease.quickbuild.DefaultBuildEngine.process(DefaultBuildEngine.java:414)
        at com.pmease.quickbuild.DefaultBuildEngine.access$000(DefaultBuildEngine.java:131)
        at com.pmease.quickbuild.DefaultBuildEngine$2.run(DefaultBuildEngine.java:1076)
        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: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getCommitters' in class com.pmease.quickbuild.model.Build threw exception java.lang.NullPointerException at custom_html_notification.vm[line 115, column 48]
        at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223)
        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
        at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567)
        at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:318)
        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
        at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
        at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:260)
        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
        at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1378)
        at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1314)
        at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1265)
        at org.apache.velocity.app.Velocity.evaluate(Velocity.java:180)
        at com.pmease.quickbuild.util.VelocityUtils.evalTemplate(VelocityUtils.java:41)
        ... 10 more
    Caused by: java.lang.NullPointerException

because there is something wrong with the changes.

I just took a look at the source of qb 6.0.10 and I think there is nothing different in the ChangesetMapper so this might also occur there.

 All   Comments   Work Log   Change History      Sort Order:
No work has yet been logged on this issue.