Program: 78872
Project: 78872
Buggy source:
/** 
 * A method to obtain a mask for any existing mouse button. The returned mask may be used for different purposes. Following are some of them: <ul> <li>   {@link java.awt.Robot#mousePress(int) mousePress(buttons)} and{@link java.awt.Robot#mouseRelease(int) mouseRelease(buttons)}<li> as a   {@code modifiers} parameter when creating a new {@link MouseEvent} instance<li> to check  {@link MouseEvent#getModifiersEx() modifiersEx} of existing {@code MouseEvent}</ul>
 * @param button is a number to represent a button starting from 1.For example, <pre> int button = InputEvent.getMaskForButton(1); </pre> will have the same meaning as <pre> int button = InputEvent.getMaskForButton(MouseEvent.BUTTON1); </pre> because  {@link MouseEvent#BUTTON1 MouseEvent.BUTTON1} equals to 1.If a mouse has three enabled buttons(see  {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}) then the values from the left column passed into the method will return corresponding values from the right column: <PRE> <b>button </b>   <b>returned mask</b>  {@link MouseEvent#BUTTON1 BUTTON1}  {@link MouseEvent#BUTTON1_DOWN_MASK BUTTON1_DOWN_MASK}{@link MouseEvent#BUTTON2 BUTTON2}  {@link MouseEvent#BUTTON2_DOWN_MASK BUTTON2_DOWN_MASK}{@link MouseEvent#BUTTON3 BUTTON3}  {@link MouseEvent#BUTTON3_DOWN_MASK BUTTON3_DOWN_MASK}</PRE> If a mouse has more than three enabled buttons then more values are admissible (4, 5, etc.). There is no assigned constants for these extended buttons. The button masks for the extra buttons returned by this method have no assigned names like the first three button masks. <p> This method has the following implementation restriction. It returns masks for a limited number of buttons only. The maximum number is implementation dependent and may vary. This limit is defined by the relevant number of buttons that may hypothetically exist on the mouse but it is greater than the  {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}. <p>
 * @throws IllegalArgumentException if {@code button} is less than zero or greater than the numberof button masks reserved for buttons
 * @since 7.0
 * @see java.awt.MouseInfo#getNumberOfButtons()
 * @see Toolkit#areExtraMouseButtonsEnabled()
 * @see MouseEvent#getModifiers()
 * @see MouseEvent#getModifiersEx()
 */
public static int getMaskForButton(int button){
  if (button <= 0 || button > BUTTON_DOWN_MASK.length) {
    throw new IllegalArgumentException("String_Node_Str" + button);
  }
  return BUTTON_DOWN_MASK[button - 1];
}

Fixed version (ground truth):
/** 
 * A method to obtain a mask for any existing mouse button. The returned mask may be used for different purposes. Following are some of them: <ul> <li>   {@link java.awt.Robot#mousePress(int) mousePress(buttons)} and{@link java.awt.Robot#mouseRelease(int) mouseRelease(buttons)}<li> as a   {@code modifiers} parameter when creating a new {@link MouseEvent} instance<li> to check  {@link MouseEvent#getModifiersEx() modifiersEx} of existing {@code MouseEvent}</ul>
 * @param button is a number to represent a button starting from 1.For example, <pre> int button = InputEvent.getMaskForButton(1); </pre> will have the same meaning as <pre> int button = InputEvent.getMaskForButton(MouseEvent.BUTTON1); </pre> because  {@link MouseEvent#BUTTON1 MouseEvent.BUTTON1} equals to 1.If a mouse has three enabled buttons(see  {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}) then the values from the left column passed into the method will return corresponding values from the right column: <PRE> <b>button </b>   <b>returned mask</b>  {@link MouseEvent#BUTTON1 BUTTON1}  {@link MouseEvent#BUTTON1_DOWN_MASK BUTTON1_DOWN_MASK}{@link MouseEvent#BUTTON2 BUTTON2}  {@link MouseEvent#BUTTON2_DOWN_MASK BUTTON2_DOWN_MASK}{@link MouseEvent#BUTTON3 BUTTON3}  {@link MouseEvent#BUTTON3_DOWN_MASK BUTTON3_DOWN_MASK}</PRE> If a mouse has more than three enabled buttons then more values are admissible (4, 5, etc.). There is no assigned constants for these extended buttons. The button masks for the extra buttons returned by this method have no assigned names like the first three button masks. <p> This method has the following implementation restriction. It returns masks for a limited number of buttons only. The maximum number is implementation dependent and may vary. This limit is defined by the relevant number of buttons that may hypothetically exist on the mouse but it is greater than the  {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}.
 * @return a mask for an existing mouse button.
 * @throws IllegalArgumentException if {@code button} is less than zero or greater than the numberof button masks reserved for buttons
 * @since 7.0
 * @see java.awt.MouseInfo#getNumberOfButtons()
 * @see Toolkit#areExtraMouseButtonsEnabled()
 * @see MouseEvent#getModifiers()
 * @see MouseEvent#getModifiersEx()
 */
public static int getMaskForButton(int button){
  if (button <= 0 || button > BUTTON_DOWN_MASK.length) {
    throw new IllegalArgumentException("String_Node_Str" + button);
  }
  return BUTTON_DOWN_MASK[button - 1];
}