Program: 85114
Project: 85114
Buggy source:
/** 
 * Returns the serializer for a class.
 * @param cl the class of the object that needs to be serialized.
 * @return a serializer object for the serialization.
 */
public Serializer getSerializer(Class cl) throws HessianProtocolException {
  Serializer serializer;
  serializer=(Serializer)_staticSerializerMap.get(cl);
  if (serializer != null)   return serializer;
  if (_cachedSerializerMap != null) {
synchronized (_cachedSerializerMap) {
      serializer=(Serializer)_cachedSerializerMap.get(cl);
    }
    if (serializer != null)     return serializer;
  }
  for (int i=0; serializer == null && _factories != null && i < _factories.size(); i++) {
    AbstractSerializerFactory factory;
    factory=(AbstractSerializerFactory)_factories.get(i);
    serializer=factory.getSerializer(cl);
  }
  if (serializer != null) {
  }
 else   if (isZoneId(cl))   serializer=ZoneIdSerializer.getInstance();
 else   if (JavaSerializer.getWriteReplace(cl) != null)   serializer=new JavaSerializer(cl,_loader);
 else   if (HessianRemoteObject.class.isAssignableFrom(cl))   serializer=new RemoteSerializer();
 else   if (Map.class.isAssignableFrom(cl)) {
    if (_mapSerializer == null)     _mapSerializer=new MapSerializer();
    serializer=_mapSerializer;
  }
 else   if (Collection.class.isAssignableFrom(cl)) {
    if (_collectionSerializer == null) {
      _collectionSerializer=new CollectionSerializer();
    }
    serializer=_collectionSerializer;
  }
 else   if (cl.isArray())   serializer=new ArraySerializer();
 else   if (Throwable.class.isAssignableFrom(cl))   serializer=new ThrowableSerializer(cl,getClassLoader());
 else   if (InputStream.class.isAssignableFrom(cl))   serializer=new InputStreamSerializer();
 else   if (Iterator.class.isAssignableFrom(cl))   serializer=IteratorSerializer.create();
 else   if (Enumeration.class.isAssignableFrom(cl))   serializer=EnumerationSerializer.create();
 else   if (Calendar.class.isAssignableFrom(cl))   serializer=CalendarSerializer.create();
 else   if (Locale.class.isAssignableFrom(cl))   serializer=LocaleSerializer.create();
 else   if (Enum.class.isAssignableFrom(cl))   serializer=new EnumSerializer(cl);
  if (serializer == null)   serializer=getDefaultSerializer(cl);
  if (_cachedSerializerMap == null)   _cachedSerializerMap=new HashMap(8);
synchronized (_cachedSerializerMap) {
    _cachedSerializerMap.put(cl,serializer);
  }
  return serializer;
}

Fixed version (ground truth):
/** 
 * Returns the serializer for a class.
 * @param cl the class of the object that needs to be serialized.
 * @return a serializer object for the serialization.
 */
public Serializer getSerializer(Class cl) throws HessianProtocolException {
  Serializer serializer;
  serializer=(Serializer)_staticSerializerMap.get(cl);
  if (serializer != null)   return serializer;
  if (_cachedSerializerMap != null) {
synchronized (_cachedSerializerMap) {
      serializer=(Serializer)_cachedSerializerMap.get(cl);
    }
    if (serializer != null)     return serializer;
  }
  for (int i=0; serializer == null && _factories != null && i < _factories.size(); i++) {
    AbstractSerializerFactory factory;
    factory=(AbstractSerializerFactory)_factories.get(i);
    serializer=factory.getSerializer(cl);
  }
  if (serializer != null) {
  }
 else   if (isZoneId(cl))   serializer=ZoneIdSerializer.getInstance();
 else   if (isEnumSet(cl))   serializer=EnumSetSerializer.getInstance();
 else   if (JavaSerializer.getWriteReplace(cl) != null)   serializer=new JavaSerializer(cl,_loader);
 else   if (HessianRemoteObject.class.isAssignableFrom(cl))   serializer=new RemoteSerializer();
 else   if (Map.class.isAssignableFrom(cl)) {
    if (_mapSerializer == null)     _mapSerializer=new MapSerializer();
    serializer=_mapSerializer;
  }
 else   if (Collection.class.isAssignableFrom(cl)) {
    if (_collectionSerializer == null) {
      _collectionSerializer=new CollectionSerializer();
    }
    serializer=_collectionSerializer;
  }
 else   if (cl.isArray())   serializer=new ArraySerializer();
 else   if (Throwable.class.isAssignableFrom(cl))   serializer=new ThrowableSerializer(cl,getClassLoader());
 else   if (InputStream.class.isAssignableFrom(cl))   serializer=new InputStreamSerializer();
 else   if (Iterator.class.isAssignableFrom(cl))   serializer=IteratorSerializer.create();
 else   if (Enumeration.class.isAssignableFrom(cl))   serializer=EnumerationSerializer.create();
 else   if (Calendar.class.isAssignableFrom(cl))   serializer=CalendarSerializer.create();
 else   if (Locale.class.isAssignableFrom(cl))   serializer=LocaleSerializer.create();
 else   if (Enum.class.isAssignableFrom(cl))   serializer=new EnumSerializer(cl);
  if (serializer == null)   serializer=getDefaultSerializer(cl);
  if (_cachedSerializerMap == null)   _cachedSerializerMap=new HashMap(8);
synchronized (_cachedSerializerMap) {
    _cachedSerializerMap.put(cl,serializer);
  }
  return serializer;
}