Program: 79134
Project: 79134
Buggy source:
/** 
 * Perform privileged work as a particular <code>Subject</code>. <p> This method behaves exactly as <code>Subject.doAs</code>, except that instead of retrieving the current Thread's <code>AccessControlContext</code>, it uses the provided <code>AccessControlContext</code>.  If the provided <code>AccessControlContext</code> is <code>null</code>, this method instantiates a new <code>AccessControlContext</code> with an empty collection of ProtectionDomains. <p>
 * @param subject the <code>Subject</code> that the specified<code>action</code> will run as.  This parameter may be <code>null</code>. <p>
 * @param action the code to be run as the specified<code>Subject</code>. <p>
 * @param acc the <code>AccessControlContext</code> to be tied to thespecified <i>subject</i> and <i>action</i>. <p>
 * @return the value returned by thePrivilegedExceptionAction's <code>run</code> method.
 * @exception PrivilegedActionException if the<code>PrivilegedExceptionAction.run</code> method throws a checked exception. <p>
 * @exception NullPointerException if the specified<code>PrivilegedExceptionAction</code> is <code>null</code>. <p>
 * @exception SecurityException if the caller does not have permissionto invoke this method.
 */
public static <T>T doAsPrivileged(final Subject subject,final java.security.PrivilegedExceptionAction<T> action,final java.security.AccessControlContext acc) throws java.security.PrivilegedActionException {
  java.lang.SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
  }
  if (action == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  final AccessControlContext callerAcc=(acc == null ? new AccessControlContext(NULL_PD_ARRAY) : acc);
  return java.security.AccessController.doPrivileged(action,createContext(subject,callerAcc));
}

Fixed version (ground truth):
/** 
 * Perform privileged work as a particular <code>Subject</code>. <p> This method behaves exactly as <code>Subject.doAs</code>, except that instead of retrieving the current Thread's <code>AccessControlContext</code>, it uses the provided <code>AccessControlContext</code>.  If the provided <code>AccessControlContext</code> is <code>null</code>, this method instantiates a new <code>AccessControlContext</code> with an empty collection of ProtectionDomains. <p>
 * @param subject the <code>Subject</code> that the specified<code>action</code> will run as.  This parameter may be <code>null</code>. <p>
 * @param < T > the type of the value returned by thePrivilegedExceptionAction's  {@code run} method.
 * @param action the code to be run as the specified<code>Subject</code>. <p>
 * @param acc the <code>AccessControlContext</code> to be tied to thespecified <i>subject</i> and <i>action</i>. <p>
 * @return the value returned by thePrivilegedExceptionAction's <code>run</code> method.
 * @exception PrivilegedActionException if the<code>PrivilegedExceptionAction.run</code> method throws a checked exception. <p>
 * @exception NullPointerException if the specified<code>PrivilegedExceptionAction</code> is <code>null</code>. <p>
 * @exception SecurityException if the caller does not have permissionto invoke this method.
 */
public static <T>T doAsPrivileged(final Subject subject,final java.security.PrivilegedExceptionAction<T> action,final java.security.AccessControlContext acc) throws java.security.PrivilegedActionException {
  java.lang.SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
  }
  if (action == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  final AccessControlContext callerAcc=(acc == null ? new AccessControlContext(NULL_PD_ARRAY) : acc);
  return java.security.AccessController.doPrivileged(action,createContext(subject,callerAcc));
}