Program: 28849
Project: 28849
Buggy source:
/** 
 * This method returns a boolean value indicating whether or not the caller is in the specified role.
 * @param role role name in the form of java.lang.String
 * @return A boolean true/false depending on whether or not the callerhas the specified role.
 */
public boolean isCallerInRole(String role){
  boolean ret=false;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.entering("String_Node_Str","String_Node_Str",role);
  }
  EJBRoleRefPermission ejbrr=new EJBRoleRefPermission(ejbName,role);
  SecurityContext sc;
  if (runAs != null) {
    ComponentInvocation ci=invMgr.getCurrentInvocation();
    sc=(SecurityContext)ci.getOldSecurityContext();
  }
 else {
    sc=SecurityContext.getCurrent();
  }
  Set principalSet=null;
  if (sc != null)   principalSet=sc.getPrincipalSet();
  ProtectionDomain prdm=getCachedProtectionDomain(principalSet,true);
  String oldContextId=null;
  try {
    oldContextId=setPolicyContext(this.contextId);
    ret=policy.implies(prdm,ejbrr);
  }
 catch (  SecurityException se) {
    _logger.log(Level.SEVERE,"String_Node_Str",se);
    ret=false;
  }
catch (  Throwable t) {
    _logger.log(Level.SEVERE,"String_Node_Str",t);
    ret=false;
  }
 finally {
    try {
      resetPolicyContext(oldContextId,this.contextId);
    }
 catch (    Throwable ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      ret=false;
    }
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + ret + "String_Node_Str"+ ejbrr.getName()+ "String_Node_Str"+ ejbrr.getActions()+ "String_Node_Str"+ prdm.getCodeSource());
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * This method returns a boolean value indicating whether or not the caller is in the specified role.
 * @param role role name in the form of java.lang.String
 * @return A boolean true/false depending on whether or not the callerhas the specified role.
 */
public boolean isCallerInRole(String role){
  boolean ret=false;
  if (_logger.isLoggable(Level.FINE)) {
    _logger.entering("String_Node_Str","String_Node_Str",role);
  }
  EJBRoleRefPermission ejbrr=new EJBRoleRefPermission(ejbName,role);
  SecurityContext sc;
  if (runAs != null) {
    ComponentInvocation ci=invMgr.getCurrentInvocation();
    sc=(SecurityContext)ci.getOldSecurityContext();
  }
 else {
    sc=SecurityContext.getCurrent();
  }
  Set principalSet=(sc != null) ? sc.getPrincipalSet() : null;
  ProtectionDomain prdm=getCachedProtectionDomain(principalSet,true);
  String oldContextId=null;
  try {
    oldContextId=setPolicyContext(this.contextId);
    ret=policy.implies(prdm,ejbrr);
  }
 catch (  SecurityException se) {
    _logger.log(Level.SEVERE,"String_Node_Str",se);
    ret=false;
  }
catch (  Throwable t) {
    _logger.log(Level.SEVERE,"String_Node_Str",t);
    ret=false;
  }
 finally {
    try {
      resetPolicyContext(oldContextId,this.contextId);
    }
 catch (    Throwable ex) {
      _logger.log(Level.SEVERE,"String_Node_Str",ex);
      ret=false;
    }
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + ret + "String_Node_Str"+ ejbrr.getName()+ "String_Node_Str"+ ejbrr.getActions()+ "String_Node_Str"+ prdm.getCodeSource());
  }
  return ret;
}