We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Null pointer exception while deleting contact based on contactID, contactListID using JavaAPI

sasik67
Regular Participant

Null pointer exception while deleting contact based on contactID, contactListID using JavaAPI

Hi..

      I am using constant contact java api for integration. Getting null pointer exception while deleting contact from contact list using the following method.

   

                     constantContact.deleteContactFromList(contactID, contactListID)


     Contact is deleting from contact list but throwing exception and contact is deleting after a very long time taking so many refreshes to update the UI. It looks wierd. Is it default behaviour of the system or any problem my browser side?

 

     Here is the stacktrace for the error am getting:

 

     java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:78)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
    at com.constantcontact.util.http.HttpProcessor.executeRequest(HttpProcessor.java:205)
    at com.constantcontact.util.http.HttpProcessor.clientConnection(HttpProcessor.java:165)
    at com.constantcontact.util.http.HttpProcessor.makeHttpRequest(HttpProcessor.java:57)
    at com.constantcontact.util.RestClient.makeHttpRequest(RestClient.java:64)
    at com.constantcontact.util.RestClient.delete(RestClient.java:60)
    at com.constantcontact.services.contacts.ContactService.deleteContactFromList(ContactService.java:249)
    at com.constantcontact.ConstantContact.deleteContactFromList(ConstantContact.java:544)
    at com.clickdesk.plugins.constantcontact.core.ConstantContactAPI.unsubscribe(ConstantContactAPI.java:126)
    at com.clickdesk.plugins.constantcontact.rest.ConstantContact.chat(ConstantContact.java:150)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
    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.RightHandPathRule.accept(RightHandPathRule.java:147)
    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:1480)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1411)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1350)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722) 

1 REPLY 1
DaveBerard
Moderator

We will look into the null pointer exception, thanks for reporting it.

 

Regarding the UI, we do use caching on our UI which is why you're seeing things take a long time.  If you view a Contact in our UI, we cache the Contact record for 5 minutes.   Unfortunately, the API updates do not currently clear that cache (this is something we are planning on updating in a future release but no ETA currently due to the infrequency it happens).  So, you will often times see the UI look like it didn't update for a period of time and that the API is "delayed".  This isn't the case and you should use the API GET Contact to verify that contact changes were done correctly and immediately.

 

Sorry for this caching issue.  We have heard this a couple of times from developers, but given the way this happens it is very infrequent and we have it lower on the priority list to fix over other issues. 

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page