Closed bwarncke closed 6 years ago
Hit wrong button....
"saved_segment" and "type_opts" have to be lists. Otherwise this exceptions is thrown:
INFO: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at com.google.gson.Gson.fromJson(Gson.java:815) at com.google.gson.Gson.fromJson(Gson.java:868) at com.ecwid.mailchimp.MailChimpClient.execute(MailChimpClient.java:104) at com.liveyearbook.app.MailChimp.listCampaigns(MailChimp.java:111) at org.apache.jsp.lybAdmin.api.mailChimp.campaignListing_jsp._jspService(campaignListing_jsp.java:125) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 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:219) 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.ajp.AjpProcessor.process(AjpProcessor.java:444) at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:372) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:396) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at com.google.gson.internal.bind.JsonTreeReader.expect(JsonTreeReader.java:139) at com.google.gson.internal.bind.JsonTreeReader.beginObject(JsonTreeReader.java:70) at com.ecwid.mailchimp.internal.gson.MailChimpObjectTypeAdapter.read(MailChimpObjectTypeAdapter.java:86) at com.ecwid.mailchimp.internal.gson.MailChimpObjectTypeAdapter.read(MailChimpObjectTypeAdapter.java:1) at com.ecwid.mailchimp.internal.gson.MailChimpObjectTypeAdapter.read(MailChimpObjectTypeAdapter.java:99) at com.ecwid.mailchimp.internal.gson.MailChimpObjectTypeAdapter.read(MailChimpObjectTypeAdapter.java:1) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60) at com.ecwid.mailchimp.internal.gson.MailChimpObjectTypeAdapter.read(MailChimpObjectTypeAdapter.java:99) at com.ecwid.mailchimp.internal.gson.MailChimpObjectTypeAdapter.read(MailChimpObjectTypeAdapter.java:1) at com.google.gson.Gson.fromJson(Gson.java:803) ... 24 more
Expected BEGIN_OBJECT but was BEGIN_ARRAY: saved_segment should be of type object. But MailChimp api returns an empty array when saved_segment is empty for this campaign. So an object is expected by array was provided.
If one would change saved_segment to list
Any suggestions? Maybe additional checking for empty arrays/values in MailChimpObjectTypeApapter?
saved_segment should be of type object. But MailChimp api returns an empty array when saved_segment is empty for this campaign.
This seems like a bug in the API. Is the field really needed for practical usage? If not, I'd prefer leaving the field unimplemented rather than hacking MailChimpObjectTypeApapter.
Fuh, I must say the API is really a mess.
Can we simple remove the arguable fields? Or they are really needed? If someone really needs the field values, they should be able to obtain them using the http://ecwid.github.io/ecwid-mailchimp/site/apidocs/com/ecwid/mailchimp/MailChimpObject.html#get(java.lang.Object) method.
Hi, I have a question. I want to create a jar file with this wrapper, and use it in my web application created with Netbeans. Is it possible? or which will be the correct way to do that. Thanks.
Added links to function description. Campaigns/list extends MailChimpMethod directly now.