All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.honeybadger.reporter.dto.Session Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package io.honeybadger.reporter.dto;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;
import java.util.LinkedHashMap;

/**
 * Session store when error was triggered.
 * @author Elijah Zupancic
 * @since 1.0.9
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Session extends LinkedHashMap
        implements Serializable {
    private static final long serialVersionUID = 1683674267395812181L;
    /** The maximum amount of characters to dump for a session object. **/
    public static final int MAX_SESSION_OBJ_STRING_SIZE = 4096;

    public Session() {
    }

    @Override
    public Object put(final String key, final Object value) {
        if (key.equals("creation_time")) {
            if (value instanceof CharSequence) {
                return super.put(key, Long.parseLong(value.toString()));
            } else if (value instanceof Number) {
                return super.put(key, ((Number)value).longValue());
            }
        }

        return super.put(key, value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy