Retrieving usage catalog may throw NPE #688

Closed
sbrossie opened this Issue Jan 9, 2017 · 0 comments

Projects

None yet

1 participant

@sbrossie
Member
sbrossie commented Jan 9, 2017

The issue was reported on the mailing list . Basically uploading our UsageExperimental.xml will work, but fetching the resulting catalog will throw an NPE because the Catalog JSON model does not expects such limits to be null.

2017-01-09T21:43:14,364+0000 lvl='WARN', log='LoggingResponse', th='qtp1442707449-31', xff='', rId='d31409c6-c44f-4514-a8b1-7e96c9ff33f8', aRId='', tRId='5895', Bad request
java.lang.NullPointerException: null
	at org.killbill.billing.jaxrs.json.CatalogJson.buildLimits(CatalogJson.java:165)
	at org.killbill.billing.jaxrs.json.CatalogJson.buildTiers(CatalogJson.java:151)
	at org.killbill.billing.jaxrs.json.CatalogJson.buildUsagesJson(CatalogJson.java:141)
	at org.killbill.billing.jaxrs.json.CatalogJson.<init>(CatalogJson.java:120)
	at org.killbill.billing.jaxrs.resources.CatalogResource.getCatalogJson(CatalogResource.java:138)
	at org.killbill.commons.skeleton.metrics.TimedResourceInterceptor.invoke(TimedResourceInterceptor.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
	at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)

@sbrossie sbrossie added this to the Release-0.18.3 milestone Jan 9, 2017
@sbrossie sbrossie self-assigned this Jan 9, 2017
@sbrossie sbrossie added a commit that closed this issue Jan 11, 2017
@sbrossie sbrossie catalog: Add default initialization for non required `Double` fields …
…in the catalog. Fixes #688

Note that code in JAXRS can now safely assume such fields will be not null and the NPE reported in the bug
disappears (as shown by the new profile test)
275b89e
@sbrossie sbrossie closed this in 275b89e Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment