mirror of https://github.com/apache/activemq.git
Protect against cache overwrites.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@383546 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c3e10f5438
commit
db9144a985
|
@ -400,13 +400,25 @@ final public class OpenWireFormat implements WireFormat {
|
|||
nextMarshallCacheIndex=0;
|
||||
}
|
||||
|
||||
marshallCache[i] = o;
|
||||
Short index = new Short(i);
|
||||
marshallCacheMap.put(o, index);
|
||||
return index;
|
||||
// We can only cache that item if there is space left.
|
||||
if( marshallCacheMap.size() < MARSHAL_CACHE_SIZE ) {
|
||||
marshallCache[i] = o;
|
||||
Short index = new Short(i);
|
||||
marshallCacheMap.put(o, index);
|
||||
return index;
|
||||
} else {
|
||||
// Use -1 to indicate that the value was not cached due to cache being full.
|
||||
return new Short((short)-1);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInUnmarshallCache(short index, DataStructure o) {
|
||||
|
||||
// There was no space left in the cache, so we can't
|
||||
// put this in the cache.
|
||||
if( index == -1 )
|
||||
return;
|
||||
|
||||
unmarshallCache[index]=o;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue