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

org.jboss.resteasy.reactive.common.util.QuarkusMultivaluedHashMap Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package org.jboss.resteasy.reactive.common.util;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import jakarta.ws.rs.core.MultivaluedHashMap;

/**
 * QuarkusMultivaluedHashMap without the bug in put/putAll that leaks external mutable storage into our storage.
 */
public class QuarkusMultivaluedHashMap extends MultivaluedHashMap
        implements QuarkusMultivaluedMap {

    private static final long serialVersionUID = 4136263572124588039L;

    @Override
    public List put(Key key, List value) {
        if (value != null) {
            // this is the storage the supertype uses
            value = new LinkedList<>(value);
        }
        return super.put(key, value);
    }

    @Override
    public void putAll(Map> m) {
        for (Entry> entry : m.entrySet()) {
            put(entry.getKey(), entry.getValue());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy