Program: 29204
Project: 29204
Buggy source:
public void receive_request(ServerRequestInfo ri) throws ForwardRequest {
  SecurityContext seccontext=null;
  ServiceContext sc=null;
  int status=0;
  boolean raise_no_perm=false;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + prname + "String_Node_Str");
  }
  ORB orb=orbHelper.getORB();
  try {
    sc=ri.get_request_service_context(SECURITY_ATTRIBUTE_SERVICE_ID);
    if (sc == null) {
      handle_null_service_context(ri,sc,orb);
      return;
    }
  }
 catch (  org.omg.CORBA.BAD_PARAM e) {
    handle_null_service_context(ri,sc,orb);
    return;
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  Any SasAny=orb.create_any();
  try {
    SasAny=codec.decode_value(sc.context_data,SASContextBodyHelper.type());
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  SASContextBody sasctxbody=SASContextBodyHelper.extract(SasAny);
  short sasdiscr=sasctxbody.discriminator();
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + SvcContextUtils.getMsgname(sasdiscr) + "String_Node_Str");
  }
  if (sasdiscr == MTMessageInContext.value) {
    sasctxbody=createContextError(SvcContextUtils.MessageInContextMinor);
    sc=createSvcContext(sasctxbody,orb);
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str");
      _logger.log(Level.FINE,"String_Node_Str");
    }
    ri.add_reply_service_context(sc,NO_REPLACE);
    throw new NO_PERMISSION();
  }
  if (sasdiscr != MTEstablishContext.value) {
    _logger.log(Level.SEVERE,"String_Node_Str");
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  EstablishContext ec=sasctxbody.establish_msg();
  seccontext=new SecurityContext();
  seccontext.subject=new Subject();
  try {
    if (ec.client_authentication_token.length != 0) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str");
      }
      createAuthCred(seccontext,ec.client_authentication_token,orb);
    }
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  try {
    if (ec.identity_token != null) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str");
      }
      createIdCred(seccontext,ec.identity_token);
    }
  }
 catch (  SecurityException secex) {
    _logger.log(Level.SEVERE,"String_Node_Str",secex);
    sasctxbody=createContextError(INVALID_MECHANISM_MAJOR,INVALID_MECHANISM_MINOR);
    sc=createSvcContext(sasctxbody,orb);
    ri.add_reply_service_context(sc,NO_REPLACE);
    throw new NO_PERMISSION();
  }
catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  status=secContextUtil.setSecurityContext(seccontext,ri.object_id(),ri.operation(),getServerSocket());
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + status);
  }
  if (status == SecurityContextUtil.STATUS_FAILED) {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str");
    }
    sasctxbody=createContextError(status);
    sc=createSvcContext(sasctxbody,orb);
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str");
    }
    ri.add_reply_service_context(sc,NO_REPLACE);
    throw new NO_PERMISSION();
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  sasctxbody=createCompleteEstablishContext(status);
  sc=createSvcContext(sasctxbody,orb);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  ri.add_reply_service_context(sc,NO_REPLACE);
}

Fixed version (ground truth):
public void receive_request(ServerRequestInfo ri) throws ForwardRequest {
  SecurityContext seccontext=null;
  ServiceContext sc=null;
  int status=0;
  boolean raise_no_perm=false;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + prname + "String_Node_Str");
  }
  ORB orb=orbHelper.getORB();
  try {
    sc=ri.get_request_service_context(SECURITY_ATTRIBUTE_SERVICE_ID);
    if (sc == null) {
      handle_null_service_context(ri,orb);
      return;
    }
  }
 catch (  org.omg.CORBA.BAD_PARAM e) {
    handle_null_service_context(ri,orb);
    return;
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  Any SasAny;
  try {
    SasAny=codec.decode_value(sc.context_data,SASContextBodyHelper.type());
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  SASContextBody sasctxbody=SASContextBodyHelper.extract(SasAny);
  short sasdiscr=sasctxbody.discriminator();
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + SvcContextUtils.getMsgname(sasdiscr) + "String_Node_Str");
  }
  if (sasdiscr == MTMessageInContext.value) {
    sasctxbody=createContextError(SvcContextUtils.MessageInContextMinor);
    sc=createSvcContext(sasctxbody,orb);
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str");
      _logger.log(Level.FINE,"String_Node_Str");
    }
    ri.add_reply_service_context(sc,NO_REPLACE);
    throw new NO_PERMISSION();
  }
  if (sasdiscr != MTEstablishContext.value) {
    _logger.log(Level.SEVERE,"String_Node_Str");
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  EstablishContext ec=sasctxbody.establish_msg();
  seccontext=new SecurityContext();
  seccontext.subject=new Subject();
  try {
    if (ec.client_authentication_token.length != 0) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str");
      }
      createAuthCred(seccontext,ec.client_authentication_token,orb);
    }
  }
 catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  try {
    if (ec.identity_token != null) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str");
      }
      createIdCred(seccontext,ec.identity_token);
    }
  }
 catch (  SecurityException secex) {
    _logger.log(Level.SEVERE,"String_Node_Str",secex);
    sasctxbody=createContextError(INVALID_MECHANISM_MAJOR,INVALID_MECHANISM_MINOR);
    sc=createSvcContext(sasctxbody,orb);
    ri.add_reply_service_context(sc,NO_REPLACE);
    throw new NO_PERMISSION();
  }
catch (  Exception e) {
    _logger.log(Level.SEVERE,"String_Node_Str",e);
    throw new SecurityException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  status=secContextUtil.setSecurityContext(seccontext,ri.object_id(),ri.operation(),getServerSocket());
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str" + status);
  }
  if (status == SecurityContextUtil.STATUS_FAILED) {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str");
    }
    sasctxbody=createContextError(status);
    sc=createSvcContext(sasctxbody,orb);
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,"String_Node_Str");
    }
    ri.add_reply_service_context(sc,NO_REPLACE);
    throw new NO_PERMISSION();
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  sasctxbody=createCompleteEstablishContext(status);
  sc=createSvcContext(sasctxbody,orb);
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"String_Node_Str");
  }
  ri.add_reply_service_context(sc,NO_REPLACE);
}