Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/com/mixpanel/mixpanelapi/MixpanelAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.GZIPOutputStream;
import org.json.JSONArray;
import org.json.JSONException;
Expand Down Expand Up @@ -38,6 +40,7 @@
*/
public class MixpanelAPI implements AutoCloseable {

private static final Logger logger = Logger.getLogger(MixpanelAPI.class.getName());
private static final int BUFFER_SIZE = 256; // Small, we expect small responses.

private static final int CONNECT_TIMEOUT_MILLIS = 2000;
Expand Down Expand Up @@ -409,6 +412,7 @@ private String dataString(List<JSONObject> messages) {
return serializer.serializeArray(messages);
} catch (IOException e) {
// Fallback to original implementation if serialization fails
logger.log(Level.WARNING, "Jackson serialization failed, falling back to org.json", e);
JSONArray array = new JSONArray();
for (JSONObject message:messages) {
array.put(message);
Expand Down