Adding item to HashMap throws ArrayIndexOutofBoundsException in java 1.7.0_45
In my application, I have some code that puts elements in the HasSet
most classic way:
@OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
@XmlElementWrapper
private Set<ParameterDefinition> parameterDefinitions = new HashSet<ParameterDefinition>();
// .... in a method far below ...
this.parameterDefinitions.add(createParameterDefinitionFor);
This code has been in use for two years and has never shown any sign of failure.
however, we recently moved our codebase to java 7 (there was a time). And from this step onwards, this exact instruction only fails * on our Linux machine using Suse 10 and Java 1.7.0_45 with the following stack trace.
Daemon Thread [p: thread-pool-1; w: 9] (Suspended (exception java.lang.ArrayIndexOutOfBoundsException))
java.util.HashMap<K,V>.put(K, V) line: 498
java.util.HashSet<E>.add(E) line: 217
Testing on Windows with any version of Java 7 does not provide this behavior.
So ... is there any reason for this strange behavior?
+3
source to share
1 answer
Are you using Glassfish? In this case, this is most likely the problem: https://java.net/jira/browse/GLASSFISH-20814
0
source to share