Hey All,
Looking for the best way to resolve this issue.

My line numbers in the stack trace will not match the line numbers I
reference because I am running 4.7 and I am linking the master files.  From
what I can tell by reviewing the code, this has not been fixed in master.
So here goes.

When making a call to listPublicIpAddresses [1] with 'listall=true' and
'projectid=-1', I get the following stacktrace.

java.lang.NullPointerException
at
com.cloud.api.ApiResponseHelper.populateOwner(ApiResponseHelper.java:2258)
at
com.cloud.api.ApiResponseHelper.createIPAddressResponse(ApiResponseHelper.java:718)
at
org.apache.cloudstack.api.command.admin.address.ListPublicIpAddressesCmdByAdmin.execute(ListPublicIpAddressesCmdByAdmin.java:44)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:150)
at com.cloud.api.ApiServer.queueCommand(ApiServer.java:698)
at com.cloud.api.ApiServer.handleRequest(ApiServer.java:529)
at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:297)
at com.cloud.api.ApiServlet$1.run(ApiServlet.java:127)
at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:124)
at com.cloud.api.ApiServlet.doGet(ApiServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
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.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:299)
at
org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:889)
at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:732)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2274)
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)


The stack trace comes from this code [2]:
Project project = ApiDBUtils.findProjectByProjectAccountId(account.getId());
response.setProjectId(project.getUuid());  // <-- Null Pointer
response.setProjectName(project.getName());

In this case, the flow is coming from [3], which comes from [4].

What would be the right way to fix this issue?

Thanks...

[1]
https://cloudstack.apache.org/api/apidocs-4.7/root_admin/listPublicIpAddresses.html
[2]
https://github.com/apache/cloudstack/blob/master/server/src/com/cloud/api/ApiResponseHelper.java#L2303
[3]
https://github.com/apache/cloudstack/blob/master/server/src/com/cloud/api/ApiResponseHelper.java#L761
[4]
https://github.com/apache/cloudstack/blob/master/api/src/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java#L44

*Will Stevens*

Reply via email to