Affected file
ojp-jdbc-driver/src/main/java/org/openjproxy/jdbc/Constants.java
Java
public static final List EMPTY_PARAMETERS_LIST = new ArrayList<>();
public static final List EMPTY_OBJECT_LIST = new ArrayList<>();
Problem
Any caller can call .add() or .clear() on these lists and corrupt the shared state for all other callers. The intent is clearly to provide an immutable empty list.
Expected fix
Replace both with immutable equivalents:
Java
public static final List EMPTY_PARAMETERS_LIST = Collections.emptyList();
public static final List EMPTY_OBJECT_LIST = Collections.emptyList();
Or, since the project compiles to Java 11+:
Java
public static final List EMPTY_PARAMETERS_LIST = List.of();
public static final List EMPTY_OBJECT_LIST = List.of();
Affected file
ojp-jdbc-driver/src/main/java/org/openjproxy/jdbc/Constants.java
Java
public static final List EMPTY_PARAMETERS_LIST = new ArrayList<>();
public static final List EMPTY_OBJECT_LIST = new ArrayList<>();
Problem
Any caller can call .add() or .clear() on these lists and corrupt the shared state for all other callers. The intent is clearly to provide an immutable empty list.
Expected fix
Replace both with immutable equivalents:
Java
public static final List EMPTY_PARAMETERS_LIST = Collections.emptyList();
public static final List EMPTY_OBJECT_LIST = Collections.emptyList();
Or, since the project compiles to Java 11+:
Java
public static final List EMPTY_PARAMETERS_LIST = List.of();
public static final List EMPTY_OBJECT_LIST = List.of();