Program: 16643
Project: 16643
Buggy source:
/** 
 * Examines the error data returned from Facebook and throws the most applicable exception.
 * @param errorDetails a Map containing a "type" and a "message" corresponding to the Graph API's error response structure.
 */
void handleFacebookError(HttpStatus statusCode,FacebookError error){
  if (error.getCode() != null) {
    int code=error.getCode();
    if (code == UNKNOWN) {
      throw new UncategorizedApiException(FACEBOOK_PROVIDER_ID,error.getMessage(),null);
    }
 else     if (code == SERVICE) {
      throw new ServerException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == TOO_MANY_CALLS || code == USER_TOO_MANY_CALLS || code == EDIT_FEED_TOO_MANY_USER_CALLS || code == EDIT_FEED_TOO_MANY_USER_ACTION_CALLS) {
      throw new RateLimitExceededException(FACEBOOK_PROVIDER_ID);
    }
 else     if (code == PERMISSION_DENIED || isUserPermissionError(code)) {
      throw new InsufficientPermissionException(FACEBOOK_PROVIDER_ID);
    }
 else     if (code == PARAM_SESSION_KEY || code == PARAM_SIGNATURE) {
      throw new InvalidAuthorizationException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == PARAM_ACCESS_TOKEN && error.getSubcode() == null) {
      throw new InvalidAuthorizationException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == PARAM_ACCESS_TOKEN && error.getSubcode() == 463) {
      throw new ExpiredAuthorizationException(FACEBOOK_PROVIDER_ID);
    }
 else     if (code == PARAM_ACCESS_TOKEN) {
      throw new RevokedAuthorizationException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == MESG_DUPLICATE) {
      throw new DuplicateStatusException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == DATA_OBJECT_NOT_FOUND || code == PATH_UNKNOWN) {
      throw new ResourceNotFoundException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else {
      throw new UncategorizedApiException(FACEBOOK_PROVIDER_ID,error.getMessage(),null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Examines the error data returned from Facebook and throws the most applicable exception.
 * @param errorDetails a Map containing a "type" and a "message" corresponding to the Graph API's error response structure.
 */
void handleFacebookError(HttpStatus statusCode,FacebookError error){
  if (error != null && error.getCode() != null) {
    int code=error.getCode();
    if (code == UNKNOWN) {
      throw new UncategorizedApiException(FACEBOOK_PROVIDER_ID,error.getMessage(),null);
    }
 else     if (code == SERVICE) {
      throw new ServerException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == TOO_MANY_CALLS || code == USER_TOO_MANY_CALLS || code == EDIT_FEED_TOO_MANY_USER_CALLS || code == EDIT_FEED_TOO_MANY_USER_ACTION_CALLS) {
      throw new RateLimitExceededException(FACEBOOK_PROVIDER_ID);
    }
 else     if (code == PERMISSION_DENIED || isUserPermissionError(code)) {
      throw new InsufficientPermissionException(FACEBOOK_PROVIDER_ID);
    }
 else     if (code == PARAM_SESSION_KEY || code == PARAM_SIGNATURE) {
      throw new InvalidAuthorizationException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == PARAM_ACCESS_TOKEN && error.getSubcode() == null) {
      throw new InvalidAuthorizationException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == PARAM_ACCESS_TOKEN && error.getSubcode() == 463) {
      throw new ExpiredAuthorizationException(FACEBOOK_PROVIDER_ID);
    }
 else     if (code == PARAM_ACCESS_TOKEN) {
      throw new RevokedAuthorizationException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == MESG_DUPLICATE) {
      throw new DuplicateStatusException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else     if (code == DATA_OBJECT_NOT_FOUND || code == PATH_UNKNOWN) {
      throw new ResourceNotFoundException(FACEBOOK_PROVIDER_ID,error.getMessage());
    }
 else {
      throw new UncategorizedApiException(FACEBOOK_PROVIDER_ID,error.getMessage(),null);
    }
  }
}