Program: 29888
Project: 29888
Buggy source:
public Session getSession(CompositeMetadata metadata) throws IOException {
  if (metadata == null || metadata.getState() == null) {
    return null;
  }
  byte[] state=metadata.getState();
  Session _session=null;
  BufferedInputStream bis=null;
  ByteArrayInputStream bais=null;
  Loader loader=null;
  ClassLoader classLoader=null;
  ObjectInputStream ois=null;
  Container container=manager.getContainer();
  java.security.Principal pal=null;
  String ssoId=null;
  long version=0L;
  try {
    bais=new ByteArrayInputStream(state);
    bis=new BufferedInputStream(bais);
    ssoId=metadata.getStringExtraParam();
    version=metadata.getVersion();
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.finest("String_Node_Str" + state.length);
    }
    if (container != null) {
      loader=container.getLoader();
    }
    if (loader != null) {
      classLoader=loader.getClassLoader();
    }
    if (classLoader != null) {
      try {
        ois=ioUtils.createObjectInputStream(bis,true,classLoader);
      }
 catch (      Exception ex) {
      }
    }
    if (ois == null) {
      ois=new ObjectInputStream(bis);
    }
    if (ois != null) {
      try {
        _session=readSession(manager,ois);
      }
  finally {
        if (ois != null) {
          try {
            ois.close();
            bis=null;
          }
 catch (          IOException e) {
          }
        }
      }
    }
  }
 catch (  ClassNotFoundException e) {
    IOException ex1=(IOException)new IOException("String_Node_Str" + e.getMessage()).initCause(e);
    throw ex1;
  }
catch (  IOException e) {
    throw e;
  }
  String username=((HASession)_session).getUserName();
  if ((username != null) && (!username.equals("String_Node_Str")) && _session.getPrincipal() == null) {
    if (_debug > 0) {
      debug("String_Node_Str" + username);
    }
    pal=((com.sun.web.security.RealmAdapter)container.getRealm()).createFailOveredPrincipal(username);
    if (_debug > 0) {
      debug("String_Node_Str" + pal);
    }
    if (pal != null) {
      _session.setPrincipal(pal);
      if (_debug > 0) {
        debug("String_Node_Str" + pal + "String_Node_Str"+ _session);
      }
    }
  }
  _session.setNew(false);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + ssoId);
  }
  ((HASession)_session).setVersion(version);
  ((HASession)_session).setDirty(false);
  ((ModifiedAttributeHASession)_session).clearAttributeStates();
  byte[] entriesState=metadata.getState();
  Collection entries=null;
  if (entriesState != null) {
    entries=this.deserializeStatesCollection(entriesState);
    loadAttributes((ModifiedAttributeHASession)_session,entries);
  }
  loadAttributes((ModifiedAttributeHASession)_session,metadata.getEntries());
  return _session;
}

Fixed version (ground truth):
public Session getSession(CompositeMetadata metadata) throws IOException {
  if (metadata == null || metadata.getState() == null) {
    return null;
  }
  byte[] state=metadata.getState();
  Session _session=null;
  BufferedInputStream bis=null;
  ByteArrayInputStream bais=null;
  Loader loader=null;
  ClassLoader classLoader=null;
  ObjectInputStream ois=null;
  Container container=manager.getContainer();
  java.security.Principal pal=null;
  String ssoId=null;
  long version=0L;
  try {
    bais=new ByteArrayInputStream(state);
    bis=new BufferedInputStream(bais);
    ssoId=metadata.getStringExtraParam();
    version=metadata.getVersion();
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.finest("String_Node_Str" + state.length);
    }
    if (container != null) {
      loader=container.getLoader();
    }
    if (loader != null) {
      classLoader=loader.getClassLoader();
    }
    if (classLoader != null) {
      try {
        ois=ioUtils.createObjectInputStream(bis,true,classLoader);
      }
 catch (      Exception ex) {
      }
    }
    if (ois == null) {
      ois=new ObjectInputStream(bis);
    }
    if (ois != null) {
      try {
        _session=readSession(manager,ois);
      }
  finally {
        try {
          ois.close();
          bis=null;
        }
 catch (        IOException e) {
        }
      }
    }
  }
 catch (  ClassNotFoundException e) {
    IOException ex1=(IOException)new IOException("String_Node_Str" + e.getMessage()).initCause(e);
    throw ex1;
  }
catch (  IOException e) {
    throw e;
  }
  String username=((HASession)_session).getUserName();
  if ((username != null) && (!username.equals("String_Node_Str")) && _session.getPrincipal() == null) {
    if (_debug > 0) {
      debug("String_Node_Str" + username);
    }
    pal=((com.sun.web.security.RealmAdapter)container.getRealm()).createFailOveredPrincipal(username);
    if (_debug > 0) {
      debug("String_Node_Str" + pal);
    }
    if (pal != null) {
      _session.setPrincipal(pal);
      if (_debug > 0) {
        debug("String_Node_Str" + pal + "String_Node_Str"+ _session);
      }
    }
  }
  _session.setNew(false);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + ssoId);
  }
  ((HASession)_session).setVersion(version);
  ((HASession)_session).setDirty(false);
  ((ModifiedAttributeHASession)_session).clearAttributeStates();
  byte[] entriesState=metadata.getState();
  Collection entries=null;
  if (entriesState != null) {
    entries=this.deserializeStatesCollection(entriesState);
    loadAttributes((ModifiedAttributeHASession)_session,entries);
  }
  loadAttributes((ModifiedAttributeHASession)_session,metadata.getEntries());
  return _session;
}