nus-yam/ex-repair huggingface dataset:
Program: 83352
Project: 83352
Buggy source:
/** 
 * Returns a string where all characters that are not valid for a complete URL have been escaped. The escaping of a character is done by converting it into its UTF-8 encoding and then encoding each of the resulting bytes as a %xx hexadecimal escape sequence. <p> The following character sets are <em>not</em> escaped by this method: <ul> <li>ASCII digits or letters</li> <li>ASCII punctuation characters: <pre> - _ . ! ~ * ' ( ) </pre> </li> <li>URL component delimiter characters: <pre> ; / ? : &amp; = + $ , # </pre> </li> </ul> </p>
 * @param decodedURL a string containing URL characters that may requireencoding
 * @return a string with all invalid URL characters escaped
 */
public static String encode(String decodedURL){
  StringValidator.throwIfEmptyOrNull("String_Node_Str",decodedURL);
  return encodeImpl(decodedURL);
}

Fixed version (ground truth):
/** 
 * Returns a string where all characters that are not valid for a complete URL have been escaped. The escaping of a character is done by converting it into its UTF-8 encoding and then encoding each of the resulting bytes as a %xx hexadecimal escape sequence. <p> The following character sets are <em>not</em> escaped by this method: <ul> <li>ASCII digits or letters</li> <li>ASCII punctuation characters: <pre> - _ . ! ~ * ' ( ) </pre> </li> <li>URL component delimiter characters: <pre> ; / ? : &amp; = + $ , # </pre> </li> </ul> </p>
 * @param decodedURL a string containing URL characters that may requireencoding
 * @return a string with all invalid URL characters escaped
 * @throws NullPointerException if decodedURL is <code>null</code>
 */
public static String encode(String decodedURL){
  StringValidator.throwIfNull("String_Node_Str",decodedURL);
  return encodeImpl(decodedURL);
}
Program: 83353
Project: 83353
Buggy source:
/** 
 * Returns a string where all URL component escape sequences have been converted back to their original character representations.
 * @param encodedURLComponent string containing encoded URL componentsequences
 * @return string with no encoded URL component encoded sequences
 */
public static String decodeComponent(String encodedURLComponent){
  StringValidator.throwIfEmptyOrNull("String_Node_Str",encodedURLComponent);
  return decodeComponentImpl(encodedURLComponent);
}

Fixed version (ground truth):
/** 
 * Returns a string where all URL component escape sequences have been converted back to their original character representations.
 * @param encodedURLComponent string containing encoded URL componentsequences
 * @return string with no encoded URL component encoded sequences
 * @throws NullPointerException if encodedURLComponent is <code>null</code>
 */
public static String decodeComponent(String encodedURLComponent){
  StringValidator.throwIfNull("String_Node_Str",encodedURLComponent);
  return decodeComponentImpl(encodedURLComponent);
}
Program: 83354
Project: 83354
Buggy source:
/** 
 * Returns a string where all characters that are not valid for a URL component have been escaped. The escaping of a character is done by converting it into its UTF-8 encoding and then encoding each of the resulting bytes as a %xx hexadecimal escape sequence. <p> The following character sets are <em>not</em> escaped by this method: <ul> <li>ASCII digits or letters</li> <li>ASCII punctuation characters: <pre>- _ . ! ~ * ' ( )</pre></li> </ul> </p> <p> Notice that this method <em>does</em> encode the URL component delimiter characters:<blockquote> <pre> ; / ? : &amp; = + $ , # </pre> </blockquote> </p>
 * @param decodedURLComponent a string containing invalid URL characters
 * @return a string with all invalid URL characters escaped
 */
public static String encodeComponent(String decodedURLComponent){
  StringValidator.throwIfEmptyOrNull("String_Node_Str",decodedURLComponent);
  return encodeComponentImpl(decodedURLComponent);
}

Fixed version (ground truth):
/** 
 * Returns a string where all characters that are not valid for a URL component have been escaped. The escaping of a character is done by converting it into its UTF-8 encoding and then encoding each of the resulting bytes as a %xx hexadecimal escape sequence. <p> The following character sets are <em>not</em> escaped by this method: <ul> <li>ASCII digits or letters</li> <li>ASCII punctuation characters: <pre>- _ . ! ~ * ' ( )</pre></li> </ul> </p> <p> Notice that this method <em>does</em> encode the URL component delimiter characters:<blockquote> <pre> ; / ? : &amp; = + $ , # </pre> </blockquote> </p>
 * @param decodedURLComponent a string containing invalid URL characters
 * @return a string with all invalid URL characters escaped
 * @throws NullPointerException if decodedURLComponent is <code>null</code>
 */
public static String encodeComponent(String decodedURLComponent){
  StringValidator.throwIfNull("String_Node_Str",decodedURLComponent);
  return encodeComponentImpl(decodedURLComponent);
}
Program: 83355
Project: 83355
Buggy source:
/** 
 * Returns a string where all URL escape sequences have been converted back to their original character representations.
 * @param encodedURL string containing encoded URL encoded sequences
 * @return string with no encoded URL encoded sequences
 */
public static String decode(String encodedURL){
  StringValidator.throwIfEmptyOrNull("String_Node_Str",encodedURL);
  return decodeImpl(encodedURL);
}

Fixed version (ground truth):
/** 
 * Returns a string where all URL escape sequences have been converted back to their original character representations.
 * @param encodedURL string containing encoded URL encoded sequences
 * @return string with no encoded URL encoded sequences
 * @throws NullPointerException if encodedURL is <code>null</code>
 */
public static String decode(String encodedURL){
  StringValidator.throwIfNull("String_Node_Str",encodedURL);
  return decodeImpl(encodedURL);
}
Program: 83356
Project: 83356
Buggy source:
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#encode(java.lang.String)}.
 */
public void testEncode(){
  try {
    URL.encode(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  try {
    URL.encode("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
  String actualURL=URL.encode(DECODED_URL);
  assertEquals(ENCODED_URL,actualURL);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#encode(java.lang.String)}.
 */
public void testEncode(){
  try {
    URL.encode(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  assertEquals("String_Node_Str",URL.encode("String_Node_Str"));
  assertEquals("String_Node_Str",URL.encode("String_Node_Str"));
  String actualURL=URL.encode(DECODED_URL);
  assertEquals(ENCODED_URL,actualURL);
}
Program: 83357
Project: 83357
Buggy source:
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#decode(java.lang.String)}.
 */
public void testDecode(){
  try {
    URL.decode(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  try {
    URL.decode("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
  String actualURL=URL.decode(ENCODED_URL);
  assertEquals(DECODED_URL,actualURL);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#decode(java.lang.String)}.
 */
public void testDecode(){
  try {
    URL.decode(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  assertEquals("String_Node_Str",URL.decode("String_Node_Str"));
  assertEquals("String_Node_Str",URL.decode("String_Node_Str"));
  String actualURL=URL.decode(ENCODED_URL);
  assertEquals(DECODED_URL,actualURL);
}
Program: 83358
Project: 83358
Buggy source:
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#decodeComponent(java.lang.String)}.
 */
public void testDecodeComponent(){
  try {
    URL.decodeComponent(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  try {
    URL.decodeComponent("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
  String actualURLComponent=URL.decodeComponent(ENCODED_URL_COMPONENT);
  assertEquals(DECODED_URL_COMPONENT,actualURLComponent);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#decodeComponent(java.lang.String)}.
 */
public void testDecodeComponent(){
  try {
    URL.decodeComponent(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  assertEquals("String_Node_Str",URL.decodeComponent("String_Node_Str"));
  assertEquals("String_Node_Str",URL.decodeComponent("String_Node_Str"));
  String actualURLComponent=URL.decodeComponent(ENCODED_URL_COMPONENT);
  assertEquals(DECODED_URL_COMPONENT,actualURLComponent);
}
Program: 83359
Project: 83359
Buggy source:
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#encodeComponent(java.lang.String)}.
 */
public void testEncodeComponent(){
  try {
    URL.encodeComponent(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  try {
    URL.encodeComponent("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
  String actualURLComponent=URL.encodeComponent(DECODED_URL_COMPONENT);
  assertEquals(ENCODED_URL_COMPONENT,actualURLComponent);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link com.google.gwt.http.client.URL#encodeComponent(java.lang.String)}.
 */
public void testEncodeComponent(){
  try {
    URL.encodeComponent(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException ex) {
  }
  assertEquals("String_Node_Str",URL.encodeComponent("String_Node_Str"));
  assertEquals("String_Node_Str",URL.encodeComponent("String_Node_Str"));
  String actualURLComponent=URL.encodeComponent(DECODED_URL_COMPONENT);
  assertEquals(ENCODED_URL_COMPONENT,actualURLComponent);
}
Program: 83362
Project: 83362
Buggy source:
JMethodCall processThisConstructorCall(ExplicitConstructorCall x){
  SourceInfo info=makeSourceInfo(x);
  JMethod ctor=(JMethod)typeMap.get(x.binding);
  JExpression trueQualifier=createThisRef(info,currentClass);
  JMethodCall call=new JMethodCall(program,info,trueQualifier,ctor);
  ReferenceBinding declaringClass=x.binding.declaringClass;
  if (declaringClass instanceof NestedTypeBinding) {
    Iterator paramIt=currentMethod.params.iterator();
    NestedTypeBinding nestedBinding=(NestedTypeBinding)declaringClass;
    if (nestedBinding.enclosingInstances != null) {
      for (int i=0; i < nestedBinding.enclosingInstances.length; ++i) {
        call.getArgs().add(createVariableRef(info,(JParameter)paramIt.next()));
      }
    }
    if (nestedBinding.outerLocalVariables != null) {
      for (int i=0; i < nestedBinding.outerLocalVariables.length; ++i) {
        call.getArgs().add(createVariableRef(info,(JParameter)paramIt.next()));
      }
    }
  }
  assert(x.qualification == null);
  if (x.arguments != null) {
    for (int i=0, n=x.arguments.length; i < n; ++i) {
      call.getArgs().add(dispProcessExpression(x.arguments[i]));
    }
  }
  return call;
}

Fixed version (ground truth):
JMethodCall processThisConstructorCall(ExplicitConstructorCall x){
  SourceInfo info=makeSourceInfo(x);
  JMethod ctor=(JMethod)typeMap.get(x.binding);
  JExpression trueQualifier=createThisRef(info,currentClass);
  JMethodCall call=new JMethodCall(program,info,trueQualifier,ctor);
  assert(x.qualification == null);
  if (x.arguments != null) {
    for (int i=0, n=x.arguments.length; i < n; ++i) {
      call.getArgs().add(dispProcessExpression(x.arguments[i]));
    }
  }
  ReferenceBinding declaringClass=x.binding.declaringClass;
  if (declaringClass instanceof NestedTypeBinding) {
    Iterator paramIt=getSyntheticsIterator(currentMethod);
    NestedTypeBinding nestedBinding=(NestedTypeBinding)declaringClass;
    if (nestedBinding.enclosingInstances != null) {
      for (int i=0; i < nestedBinding.enclosingInstances.length; ++i) {
        call.getArgs().add(createVariableRef(info,(JParameter)paramIt.next()));
      }
    }
    if (nestedBinding.outerLocalVariables != null) {
      for (int i=0; i < nestedBinding.outerLocalVariables.length; ++i) {
        call.getArgs().add(createVariableRef(info,(JParameter)paramIt.next()));
      }
    }
  }
  return call;
}
Program: 83364
Project: 83364
Buggy source:
/** 
 * Retrieves the JUnitShell. This should only be invoked during TestRunner execution of JUnit tests.
 */
private static JUnitShell getUnitTestShell(){
  if (unitTestShell == null) {
    JUnitShell shell=new JUnitShell();
    String[] args=shell.synthesizeArgs();
    if (!shell.processArgs(args)) {
      throw new RuntimeException("String_Node_Str");
    }
    shell.messageQueue=new JUnitMessageQueue(shell.numClients);
    if (!shell.startUp()) {
      throw new RuntimeException("String_Node_Str");
    }
    shell.report=new BenchmarkReport(shell.getTopLogger());
    unitTestShell=shell;
    Runtime.getRuntime().addShutdownHook(new Thread(shell.new Shutdown()));
  }
  return unitTestShell;
}

Fixed version (ground truth):
/** 
 * Retrieves the JUnitShell. This should only be invoked during TestRunner execution of JUnit tests.
 */
private static JUnitShell getUnitTestShell(){
  if (unitTestShell == null) {
    BootStrapPlatform.go();
    JUnitShell shell=new JUnitShell();
    String[] args=shell.synthesizeArgs();
    if (!shell.processArgs(args)) {
      throw new RuntimeException("String_Node_Str");
    }
    shell.messageQueue=new JUnitMessageQueue(shell.numClients);
    if (!shell.startUp()) {
      throw new RuntimeException("String_Node_Str");
    }
    shell.report=new BenchmarkReport(shell.getTopLogger());
    unitTestShell=shell;
    Runtime.getRuntime().addShutdownHook(new Thread(shell.new Shutdown()));
  }
  return unitTestShell;
}
Program: 83365
Project: 83365
Buggy source:
/** 
 * Constructs a JavaScript program object.
 */
public JsProgram(){
  rootScope=new JsRootScope(this);
  globalBlock=new JsGlobalBlock();
  topScope=new JsScope(rootScope,"String_Node_Str");
  objectScope=new JsScope(rootScope,"String_Node_Str");
  JsName debugger=rootScope.findExistingName("String_Node_Str");
  debuggerStmt=new JsExprStmt(debugger.makeRef());
}

Fixed version (ground truth):
/** 
 * Constructs a JavaScript program object.
 */
public JsProgram(){
  rootScope=new JsRootScope(this);
  globalBlock=new JsGlobalBlock();
  topScope=new JsScope(rootScope,"String_Node_Str");
  objectScope=new JsScope(rootScope,"String_Node_Str");
}
Program: 83366
Project: 83366
Buggy source:
/** 
 * Attempts to find an unobfuscatable name object for the specified ident, searching in this scope, and if not found, in the parent scopes.
 * @return <code>null</code> if the identifier has no associated name
 */
public final JsName findExistingUnobfuscatableName(String ident){
  JsName name=findExistingNameNoRecurse(ident);
  if (name != null && name.isObfuscatable()) {
    name=null;
  }
  if (name == null && parent != null) {
    return parent.findExistingUnobfuscatableName(ident);
  }
  return name;
}

Fixed version (ground truth):
/** 
 * Attempts to find an unobfuscatable name object for the specified ident, searching in this scope, and if not found, in the parent scopes.
 * @return <code>null</code> if the identifier has no associated name
 */
public final JsName findExistingUnobfuscatableName(String ident){
  ident=maybeMangleKeyword(ident);
  JsName name=findExistingNameNoRecurse(ident);
  if (name != null && name.isObfuscatable()) {
    name=null;
  }
  if (name == null && parent != null) {
    return parent.findExistingUnobfuscatableName(ident);
  }
  return name;
}
Program: 83367
Project: 83367
Buggy source:
/** 
 * Attempts to find the name object for the specified ident, searching in this scope, and if not found, in the parent scopes.
 * @return <code>null</code> if the identifier has no associated name
 */
public final JsName findExistingName(String ident){
  JsName name=findExistingNameNoRecurse(ident);
  if (name == null && parent != null) {
    return parent.findExistingName(ident);
  }
  return name;
}

Fixed version (ground truth):
/** 
 * Attempts to find the name object for the specified ident, searching in this scope, and if not found, in the parent scopes.
 * @return <code>null</code> if the identifier has no associated name
 */
public final JsName findExistingName(String ident){
  ident=maybeMangleKeyword(ident);
  JsName name=findExistingNameNoRecurse(ident);
  if (name == null && parent != null) {
    return parent.findExistingName(ident);
  }
  return name;
}
Program: 83368
Project: 83368
Buggy source:
/** 
 * Gets a name object associated with the specified ident in this scope, creating it if necessary.
 * @param ident An identifier that is unique within this scope.
 * @param shortIdent A "pretty" name that does not have to be unique.
 * @throws IllegalArgumentException if ident already exists in this scope butthe requested short name does not match the existing short name.
 */
public JsName declareName(String ident,String shortIdent){
  JsName name=findExistingNameNoRecurse(ident);
  if (name != null) {
    if (!name.getShortIdent().equals(shortIdent)) {
      throw new IllegalArgumentException("String_Node_Str" + shortIdent + "String_Node_Str"+ name.getShortIdent()+ "String_Node_Str"+ ident);
    }
    return name;
  }
  if (JsKeywords.isKeyword(ident)) {
    throw new IllegalArgumentException("String_Node_Str" + ident + "String_Node_Str");
  }
  return doCreateName(ident,shortIdent);
}

Fixed version (ground truth):
/** 
 * Gets a name object associated with the specified ident in this scope, creating it if necessary.
 * @param ident An identifier that is unique within this scope.
 * @param shortIdent A "pretty" name that does not have to be unique.
 * @throws IllegalArgumentException if ident already exists in this scope butthe requested short name does not match the existing short name.
 */
public JsName declareName(String ident,String shortIdent){
  ident=maybeMangleKeyword(ident);
  shortIdent=maybeMangleKeyword(shortIdent);
  JsName name=findExistingNameNoRecurse(ident);
  if (name != null) {
    if (!name.getShortIdent().equals(shortIdent)) {
      throw new IllegalArgumentException("String_Node_Str" + shortIdent + "String_Node_Str"+ name.getShortIdent()+ "String_Node_Str"+ ident);
    }
    return name;
  }
  return doCreateName(ident,shortIdent);
}
Program: 83369
Project: 83369
Buggy source:
protected void doAccept(JsCollection collection){
  for (Iterator it=collection.iterator(); it.hasNext(); ) {
    doTraverse((JsNode)it.next(),UNMODIFIABLE_CONTEXT);
  }
}

Fixed version (ground truth):
protected JsNode doAccept(JsNode node){
  doTraverse(node,UNMODIFIABLE_CONTEXT);
  return node;
}
Program: 83370
Project: 83370
Buggy source:
public final void accept(JsCollection collection){
  doAccept(collection);
}

Fixed version (ground truth):
public final JsStatement accept(JsStatement node){
  return (JsStatement)doAccept(node);
}
Program: 83371
Project: 83371
Buggy source:
/** 
 * Returns an iterator containing all the widgets in this table.
 * @return the iterator
 */
public Iterator iterator(){
  return widgetMap.values().iterator();
}

Fixed version (ground truth):
/** 
 * Returns an iterator containing all the widgets in this table.
 * @return the iterator
 */
public Iterator iterator(){
  return widgetMap.widgetIterator();
}
Program: 83372
Project: 83372
Buggy source:
/** 
 * Sets the widget within the specified cell. <p> Inherited implementations may either throw IndexOutOfBounds exception if the cell does not exist, or allocate a new cell to store the content. </p> <p> FlexTable will automatically allocate the cell at the correct location and then set the widget. Grid will set the widget if and only if the cell is within the Grid's bounding box. </p>
 * @param widget The widget to be added
 * @param row the cell's row
 * @param column the cell's column
 * @throws IndexOutOfBoundsException
 */
public void setWidget(int row,int column,Widget widget){
  prepareCell(row,column);
  if (widget != null) {
    widget.removeFromParent();
    Element td=cleanCell(row,column,true);
    String hash=Integer.toString(widget.hashCode());
    Element e=widget.getElement();
    DOM.setElementProperty(e,HASH_ATTR,hash);
    widgetMap.put(hash,widget);
    adopt(widget,td);
  }
}

Fixed version (ground truth):
/** 
 * Sets the widget within the specified cell. <p> Inherited implementations may either throw IndexOutOfBounds exception if the cell does not exist, or allocate a new cell to store the content. </p> <p> FlexTable will automatically allocate the cell at the correct location and then set the widget. Grid will set the widget if and only if the cell is within the Grid's bounding box. </p>
 * @param widget The widget to be added
 * @param row the cell's row
 * @param column the cell's column
 * @throws IndexOutOfBoundsException
 */
public void setWidget(int row,int column,Widget widget){
  prepareCell(row,column);
  if (widget != null) {
    widget.removeFromParent();
    Element td=cleanCell(row,column,true);
    widgetMap.putWidget(widget);
    adopt(widget,td);
  }
}
Program: 83373
Project: 83373
Buggy source:
/** 
 * Gets the Widget associated with the element.
 * @param widgetElement widget's element
 * @return the widget
 */
private Widget getWidget(Element widgetElement){
  Object key=computeKeyForElement(widgetElement);
  if (key != null) {
    Widget widget=(Widget)widgetMap.get(key);
    assert(widget != null);
    return widget;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Gets the widget in the specified cell.
 * @param row the cell's row
 * @param column the cell's column
 * @return the widget in the specified cell, or <code>null</code> if none ispresent
 * @throws IndexOutOfBoundsException
 */
public Widget getWidget(int row,int column){
  checkCellBounds(row,column);
  return widgetMap.getWidget(row,column);
}
Program: 83374
Project: 83374
Buggy source:
/** 
 * Remove the specified widget from the table.
 * @param widget widget to remove
 * @return was the widget removed from the table.
 */
public boolean remove(Widget widget){
  if (widget.getParent() != this) {
    return false;
  }
  removeWidget(widget);
  return true;
}

Fixed version (ground truth):
/** 
 * Remove the specified widget from the table.
 * @param widget widget to remove
 * @return was the widget removed from the table.
 */
public boolean remove(Widget widget){
  if (widget.getParent() != this) {
    return false;
  }
  widgetMap.removeWidgetByElement(widget.getElement());
  disown(widget);
  return true;
}
Program: 83375
Project: 83375
Buggy source:
/** 
 * Does actual clearing, used by clearCell and cleanCell. All HTMLTable methods should use internalClearCell rather than clearCell, as clearCell may be overridden in subclasses to format an empty cell.
 * @param td element to clear
 * @param clearInnerHTML should the cell's inner html be cleared?
 * @return returns whether a widget was cleared
 */
protected boolean internalClearCell(Element td,boolean clearInnerHTML){
  Element maybeChild=DOM.getFirstChild(td);
  Widget widget=null;
  if (maybeChild != null) {
    widget=getWidget(maybeChild);
  }
  if (widget != null) {
    removeWidget(widget);
    return true;
  }
 else {
    if (clearInnerHTML) {
      DOM.setInnerHTML(td,"String_Node_Str");
    }
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Does actual clearing, used by clearCell and cleanCell. All HTMLTable methods should use internalClearCell rather than clearCell, as clearCell may be overridden in subclasses to format an empty cell.
 * @param td element to clear
 * @param clearInnerHTML should the cell's inner html be cleared?
 * @return returns whether a widget was cleared
 */
protected boolean internalClearCell(Element td,boolean clearInnerHTML){
  Element maybeChild=DOM.getFirstChild(td);
  Widget widget=null;
  if (maybeChild != null) {
    widget=widgetMap.getWidget(maybeChild);
  }
  if (widget != null) {
    remove(widget);
    return true;
  }
 else {
    if (clearInnerHTML) {
      DOM.setInnerHTML(td,"String_Node_Str");
    }
    return false;
  }
}
Program: 83376
Project: 83376
Buggy source:
public ColumnFormatter getColumnFormatter(){
  return columnFormatter;
}

Fixed version (ground truth):
/** 
 * Gets the column formatter.
 * @return the column formatter
 */
public ColumnFormatter getColumnFormatter(){
  return columnFormatter;
}
Program: 83377
Project: 83377
Buggy source:
/** 
 * Removes all widgets from this table, but does not remove other HTML or text contents of cells.
 */
public void clear(){
  for (int row=0; row < getRowCount(); ++row) {
    for (int col=0; col < getCellCount(row); ++col) {
      Widget child=getWidget(row,col);
      if (child != null) {
        removeWidget(child);
      }
    }
  }
  assert(widgetMap.size() == 0);
}

Fixed version (ground truth):
/** 
 * Removes all widgets from this table, but does not remove other HTML or text contents of cells.
 */
public void clear(){
  for (int row=0; row < getRowCount(); ++row) {
    for (int col=0; col < getCellCount(row); ++col) {
      Widget child=widgetMap.getWidget(row,col);
      if (child != null) {
        remove(child);
      }
    }
  }
}
Program: 83378
Project: 83378
Buggy source:
/** 
 * Determine whether one element is equal to, or the child of, another.
 * @param parent the potential parent element
 * @param child the potential child element
 * @return <code>true</code> if the relationship holds
 */
public static boolean isOrHasChild(Element parent,Element child){
  return impl.isOrHasChild(parent,child);
}

Fixed version (ground truth):
/** 
 * Determine whether one element is equal to, or the child of, another.
 * @param parent the potential parent element
 * @param child the potential child element
 * @return <code>true</code> if the relationship holds
 * @see #compare(Element,Element)
 */
public static boolean isOrHasChild(Element parent,Element child){
  return impl.isOrHasChild(parent,child);
}
Program: 83379
Project: 83379
Buggy source:
/** 
 * Compares two elements for equality (note that reference equality is not sufficient to determine equality among elements on most browsers).
 * @param elem1 the first element to be compared
 * @param elem2 the second element to be compared
 * @return <code>true</code> if they are in fact the same element
 */
public static boolean compare(Element elem1,Element elem2){
  return impl.compare(elem1,elem2);
}

Fixed version (ground truth):
/** 
 * Compares two elements for equality (note that reference equality is not sufficient to determine equality among elements on most browsers).
 * @param elem1 the first element to be compared
 * @param elem2 the second element to be compared
 * @return <code>true</code> if they are in fact the same element
 * @see #isOrHasChild(Element,Element)
 */
public static boolean compare(Element elem1,Element elem2){
  return impl.compare(elem1,elem2);
}
Program: 83380
Project: 83380
Buggy source:
/** 
 * This method is called when a widget is detached from the browser's document. Overridden because of IE bug that throws away checked state.
 */
protected void onDetach(){
  setChecked(isChecked());
  super.onDetach();
}

Fixed version (ground truth):
/** 
 * This method is called when a widget is detached from the browser's document. Overridden because of IE bug that throws away checked state and in order to clear the event listener off of the <code>inputElem</code>.
 */
protected void onDetach(){
  DOM.setEventListener(inputElem,null);
  setChecked(isChecked());
  super.onDetach();
}
Program: 83381
Project: 83381
Buggy source:
protected CheckBox(Element elem){
  super(DOM.createSpan());
  inputElem=elem;
  labelElem=DOM.createLabel();
  DOM.sinkEvents(inputElem,Event.FOCUSEVENTS | Event.ONCLICK | DOM.getEventsSunk(inputElem));
  DOM.appendChild(getElement(),inputElem);
  DOM.appendChild(getElement(),labelElem);
  String uid="String_Node_Str" + (++uniqueId);
  DOM.setElementProperty(inputElem,"String_Node_Str",uid);
  DOM.setElementProperty(labelElem,"String_Node_Str",uid);
}

Fixed version (ground truth):
protected CheckBox(Element elem){
  super(DOM.createSpan());
  inputElem=elem;
  labelElem=DOM.createLabel();
  DOM.sinkEvents(inputElem,DOM.getEventsSunk(this.getElement()));
  DOM.sinkEvents(this.getElement(),0);
  DOM.appendChild(getElement(),inputElem);
  DOM.appendChild(getElement(),labelElem);
  String uid="String_Node_Str" + (++uniqueId);
  DOM.setElementProperty(inputElem,"String_Node_Str",uid);
  DOM.setElementProperty(labelElem,"String_Node_Str",uid);
}
Program: 83383
Project: 83383
Buggy source:
protected String[] doFindAdditionalTypesUsingRebinds(TreeLogger logger,CompilationUnitDeclaration cud) throws UnableToCompleteException {
  return Empty.STRINGS;
}

Fixed version (ground truth):
protected String[] doFindAdditionalTypesUsingRebinds(TreeLogger logger,CompilationUnitDeclaration cud){
  return Empty.STRINGS;
}
Program: 83384
Project: 83384
Buggy source:
protected String[] doFindAdditionalTypesUsingJsni(TreeLogger logger,CompilationUnitDeclaration cud) throws UnableToCompleteException {
  return Empty.STRINGS;
}

Fixed version (ground truth):
protected String[] doFindAdditionalTypesUsingJsni(TreeLogger logger,CompilationUnitDeclaration cud){
  return Empty.STRINGS;
}
Program: 83385
Project: 83385
Buggy source:
private ReferenceBinding resolvePossiblyNestedType(String typeName){
  ReferenceBinding type=null;
  int p=typeName.indexOf('$');
  if (p > 0) {
    String cupName=typeName.substring(0,p);
    char[][] chars=CharOperation.splitOn('.',cupName.toCharArray());
    if (lookupEnvironment.getType(chars) != null) {
      chars=CharOperation.splitOn('.',typeName.toCharArray());
      type=lookupEnvironment.getCachedType(chars);
      if (type == null) {
        return null;
      }
    }
  }
 else {
    char[][] chars=CharOperation.splitOn('.',typeName.toCharArray());
    type=lookupEnvironment.getType(chars);
  }
  if (type != null) {
    return type;
  }
  p=typeName.lastIndexOf('.');
  if (p >= 0) {
    typeName=typeName.substring(0,p) + "String_Node_Str" + typeName.substring(p + 1);
    return resolvePossiblyNestedType(typeName);
  }
  return null;
}

Fixed version (ground truth):
protected ReferenceBinding resolvePossiblyNestedType(String typeName){
  return compiler.resolvePossiblyNestedType(typeName);
}
Program: 83386
Project: 83386
Buggy source:
public void endVisit(MessageSend messageSend,BlockScope scope){
  final ProblemReporter problemReporter=scope.problemReporter();
  if (messageSend.binding == null) {
    return;
  }
  String methodName=String.valueOf(messageSend.selector);
  if (!methodName.equals(REBIND_MAGIC_METHOD)) {
    return;
  }
  char[][] targetClass=messageSend.binding.declaringClass.compoundName;
  String targetClassName=CharOperation.toString(targetClass);
  if (!targetClassName.equals(REBIND_MAGIC_CLASS)) {
    return;
  }
  Expression[] args=messageSend.arguments;
  if (args.length != 1) {
    problemReporter.abortDueToInternalError("String_Node_Str",messageSend);
    return;
  }
  Expression arg=args[0];
  if (!(arg instanceof ClassLiteralAccess)) {
    problemReporter.abortDueToInternalError("String_Node_Str",messageSend);
    return;
  }
  ClassLiteralAccess cla=(ClassLiteralAccess)arg;
  String typeName=String.valueOf(cla.targetType.readableName());
  results.add(typeName);
}

Fixed version (ground truth):
public void endVisit(MessageSend messageSend,BlockScope scope){
  final ProblemReporter problemReporter=scope.problemReporter();
  if (messageSend.binding == null) {
    return;
  }
  String methodName=String.valueOf(messageSend.selector);
  if (!methodName.equals(REBIND_MAGIC_METHOD)) {
    return;
  }
  char[][] targetClass=messageSend.binding.declaringClass.compoundName;
  String targetClassName=CharOperation.toString(targetClass);
  if (!targetClassName.equals(REBIND_MAGIC_CLASS)) {
    return;
  }
  DeferredBindingSite site=new DeferredBindingSite(messageSend,scope);
  Expression[] args=messageSend.arguments;
  if (args.length != 1) {
    reportRebindProblem(site,"String_Node_Str");
    return;
  }
  Expression arg=args[0];
  if (!(arg instanceof ClassLiteralAccess)) {
    reportRebindProblem(site,"String_Node_Str");
    return;
  }
  ClassLiteralAccess cla=(ClassLiteralAccess)arg;
  String typeName=String.valueOf(cla.targetType.readableName());
  if (!results.containsKey(typeName)) {
    results.put(typeName,site);
  }
}
Program: 83387
Project: 83387
Buggy source:
public FindDeferredBindingSitesVisitor(Set results){
  this.results=results;
}

Fixed version (ground truth):
public FindDeferredBindingSitesVisitor(Map requestedTypes){
  this.results=requestedTypes;
}
Program: 83388
Project: 83388
Buggy source:
/** 
 * Pull in types implicitly referenced through rebind answers.
 */
protected String[] doFindAdditionalTypesUsingRebinds(TreeLogger logger,CompilationUnitDeclaration cud) throws UnableToCompleteException {
  Set dependentTypeNames=new HashSet();
  Set requestedTypes=new HashSet();
  FindDeferredBindingSitesVisitor v=new FindDeferredBindingSitesVisitor(requestedTypes);
  cud.traverse(v,cud.scope);
  for (Iterator iter=requestedTypes.iterator(); iter.hasNext(); ) {
    String reqType=(String)iter.next();
    String[] resultTypes=rebindPermOracle.getAllPossibleRebindAnswers(getLogger(),reqType);
    Util.addAll(dependentTypeNames,resultTypes);
  }
  return (String[])dependentTypeNames.toArray(Empty.STRINGS);
}

Fixed version (ground truth):
/** 
 * Pull in types implicitly referenced through rebind answers.
 */
protected String[] doFindAdditionalTypesUsingRebinds(TreeLogger logger,CompilationUnitDeclaration cud){
  Set dependentTypeNames=new HashSet();
  Map requestedTypes=new HashMap();
  FindDeferredBindingSitesVisitor v=new FindDeferredBindingSitesVisitor(requestedTypes);
  cud.traverse(v,cud.scope);
  for (Iterator iter=requestedTypes.keySet().iterator(); iter.hasNext(); ) {
    String reqType=(String)iter.next();
    DeferredBindingSite site=(DeferredBindingSite)requestedTypes.get(reqType);
    try {
      String[] resultTypes=rebindPermOracle.getAllPossibleRebindAnswers(getLogger(),reqType);
      for (int i=0; i < resultTypes.length; ++i) {
        String typeName=resultTypes[i];
        ReferenceBinding type=resolvePossiblyNestedType(typeName);
        if (type == null) {
          FindDeferredBindingSitesVisitor.reportRebindProblem(site,"String_Node_Str" + typeName + "String_Node_Str");
          continue;
        }
        if (!type.isClass()) {
          FindDeferredBindingSitesVisitor.reportRebindProblem(site,"String_Node_Str" + typeName + "String_Node_Str");
          continue;
        }
        if (type.isAbstract()) {
          FindDeferredBindingSitesVisitor.reportRebindProblem(site,"String_Node_Str" + typeName + "String_Node_Str");
          continue;
        }
        if (type.isNestedType() && !type.isStatic()) {
          FindDeferredBindingSitesVisitor.reportRebindProblem(site,"String_Node_Str" + typeName + "String_Node_Str");
          continue;
        }
        if (type.isLocalType()) {
          FindDeferredBindingSitesVisitor.reportRebindProblem(site,"String_Node_Str" + typeName + "String_Node_Str");
          continue;
        }
        MethodBinding noArgCtor=type.getExactMethod("String_Node_Str".toCharArray(),TypeBinding.NoParameters,cud.scope);
        if (noArgCtor == null) {
          FindDeferredBindingSitesVisitor.reportRebindProblem(site,"String_Node_Str" + typeName + "String_Node_Str");
          continue;
        }
        dependentTypeNames.add(typeName);
      }
      Util.addAll(dependentTypeNames,resultTypes);
    }
 catch (    UnableToCompleteException e) {
      FindDeferredBindingSitesVisitor.reportRebindProblem(site,"String_Node_Str" + reqType + "String_Node_Str");
    }
  }
  return (String[])dependentTypeNames.toArray(Empty.STRINGS);
}
Program: 83389
Project: 83389
Buggy source:
/** 
 * Pull in types referenced only via JSNI.
 */
protected String[] doFindAdditionalTypesUsingJsni(TreeLogger logger,CompilationUnitDeclaration cud) throws UnableToCompleteException {
  Set dependentTypeNames=new HashSet();
  FindJsniRefVisitor v=new FindJsniRefVisitor(dependentTypeNames);
  cud.traverse(v,cud.scope);
  return (String[])dependentTypeNames.toArray(Empty.STRINGS);
}

Fixed version (ground truth):
/** 
 * Pull in types referenced only via JSNI.
 */
protected String[] doFindAdditionalTypesUsingJsni(TreeLogger logger,CompilationUnitDeclaration cud){
  Set dependentTypeNames=new HashSet();
  FindJsniRefVisitor v=new FindJsniRefVisitor(dependentTypeNames);
  cud.traverse(v,cud.scope);
  return (String[])dependentTypeNames.toArray(Empty.STRINGS);
}
Program: 83390
Project: 83390
Buggy source:
/** 
 * Displays a request for information in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons.
 * @param msg the message to be displayed
 * @param initialValue the initial value in the dialog's text field
 * @return the value entered by the user if 'OK' was pressed, or<code>null</code> if 'Cancel' was pressed
 */
public static native String prompt(String msg,String defaultValue);

Fixed version (ground truth):
/** 
 * Displays a request for information in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons.
 * @param msg the message to be displayed
 * @param initialValue the initial value in the dialog's text field
 * @return the value entered by the user if 'OK' was pressed, or<code>null</code> if 'Cancel' was pressed
 */
public static native String prompt(String msg,String initialValue);
Program: 83391
Project: 83391
Buggy source:
public static void sort(Object[] x,Comparator s){
  nativeSort(x,x.length,s);
}

Fixed version (ground truth):
public static void sort(Object[] x,Comparator s){
  nativeSort(x,x.length,s != null ? s : natural);
}
Program: 83392
Project: 83392
Buggy source:
static native JavaScriptObject loadCookies();

Fixed version (ground truth):
static native void loadCookies(HashMap m);
Program: 83393
Project: 83393
Buggy source:
private static native void setCookie(String name,String value,long expires,String domain,String path,boolean secure);

Fixed version (ground truth):
/** 
 * Sets a cookie.
 * @param name the cookie's name
 * @param value the cookie's value
 * @param expires when the cookie expires
 * @param domain the domain to be associated with this cookie
 * @param path the path to be associated with this cookie
 * @param secure <code>true</code> to make this a secure cookie
 */
public static void setCookie(String name,String value,Date expires,String domain,String path,boolean secure){
  setCookieImpl(name,value,expires.toGMTString(),domain,path,secure);
}
Program: 83394
Project: 83394
Buggy source:
/** 
 * Gets the cookie associated with the given key.
 * @param key the key of the cookie to be retrieved
 * @return the cookie's value.
 */
public static native String getCookie(String key);

Fixed version (ground truth):
/** 
 * Gets the cookie associated with the given name.
 * @param name the name of the cookie to be retrieved
 * @return the cookie's value
 */
public static String getCookie(String name){
  Map cookiesMap=ensureCookies();
  return (String)cookiesMap.get(name);
}
Program: 83395
Project: 83395
Buggy source:
JStatement processStatement(WhileStatement x){
  Constant cst=x.condition.optimizedBooleanConstant();
  if (cst != Constant.NotAConstant) {
    if (!cst.booleanValue()) {
      return null;
    }
  }
  SourceInfo info=makeSourceInfo(x);
  JExpression loopTest=dispProcessExpression(x.condition);
  JStatement loopBody=dispProcessStatement(x.action);
  JWhileStatement stmt=new JWhileStatement(program,info,loopTest,loopBody);
  return stmt;
}

Fixed version (ground truth):
JStatement processStatement(WhileStatement x){
  boolean removeBody=isOptimizedFalse(x.condition);
  SourceInfo info=makeSourceInfo(x);
  JExpression loopTest=dispProcessExpression(x.condition);
  JStatement loopBody=removeBody ? null : dispProcessStatement(x.action);
  JWhileStatement stmt=new JWhileStatement(program,info,loopTest,loopBody);
  return stmt;
}
Program: 83396
Project: 83396
Buggy source:
public void testDeadCode(){
  while (returnFalse()) {
    break;
  }
  do {
    break;
  }
 while (false);
  do {
    break;
  }
 while (returnFalse());
  for (; returnFalse(); ) {
  }
  boolean check=false;
  for (check=true; returnFalse(); fail()) {
    fail();
  }
  assertTrue(check);
  if (returnFalse()) {
    fail();
  }
 else {
  }
  if (!returnFalse()) {
  }
 else {
    fail();
  }
}

Fixed version (ground truth):
public void testDeadCode(){
  while (returnFalse()) {
    break;
  }
  do {
    break;
  }
 while (false);
  do {
    break;
  }
 while (returnFalse());
  for (; returnFalse(); ) {
  }
  boolean check=false;
  for (check=true; returnFalse(); fail()) {
    fail();
  }
  assertTrue(check);
  if (returnFalse()) {
    fail();
  }
 else {
  }
  if (!returnFalse()) {
  }
 else {
    fail();
  }
  boolean b=false;
  if ((b=true) ? true : true) {
  }
  assertTrue(b);
  boolean c=true;
  int val=0;
  for (val=1; c=false; ++val) {
  }
  assertFalse(c);
  boolean d=true;
  while (d=false) {
  }
  assertFalse(d);
  boolean e=true;
  if (true | (e=false)) {
  }
  assertFalse(e);
}
Program: 83397
Project: 83397
Buggy source:
private void onSelection(TreeItem item,boolean fireEvents){
  if (item == root) {
    return;
  }
  if (curSelection != null) {
    curSelection.setSelected(false);
  }
  curSelection=item;
  if (curSelection != null) {
    moveFocus(curSelection);
    curSelection.setSelected(true);
    if (fireEvents && (listeners != null)) {
      listeners.fireItemSelected(curSelection);
    }
  }
}

Fixed version (ground truth):
private void onSelection(TreeItem item,boolean fireEvents,boolean moveFocus){
  if (item == root) {
    return;
  }
  if (curSelection != null) {
    curSelection.setSelected(false);
  }
  curSelection=item;
  if (moveFocus && curSelection != null) {
    moveFocus(curSelection);
    curSelection.setSelected(true);
    if (fireEvents && (listeners != null)) {
      listeners.fireItemSelected(curSelection);
    }
  }
}
Program: 83399
Project: 83399
Buggy source:
private boolean elementClicked(TreeItem root,Element hElem){
  Vector chain=new Vector();
  collectElementChain(chain,getElement(),hElem);
  TreeItem item=findItemByChain(chain,0,root);
  if (item != null) {
    if (DOM.compare(item.getImageElement(),hElem)) {
      item.setState(!item.getState(),true);
      return true;
    }
 else     if (DOM.isOrHasChild(item.getElement(),hElem)) {
      onSelection(item,true);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean elementClicked(TreeItem root,Element hElem){
  Vector chain=new Vector();
  collectElementChain(chain,getElement(),hElem);
  TreeItem item=findItemByChain(chain,0,root);
  if (item != null) {
    if (DOM.compare(item.getImageElement(),hElem)) {
      item.setState(!item.getState(),true);
      return true;
    }
 else     if (DOM.isOrHasChild(item.getElement(),hElem)) {
      onSelection(item,true,!shouldTreeDelegateFocusToElement(hElem));
      return true;
    }
  }
  return false;
}
Program: 83400
Project: 83400
Buggy source:
/** 
 * Moves the selected item up one.
 */
private void moveSelectionUp(TreeItem sel){
  TreeItem parent=sel.getParentItem();
  if (parent == null) {
    parent=root;
  }
  int idx=parent.getChildIndex(sel);
  if (idx > 0) {
    TreeItem sibling=parent.getChild(idx - 1);
    onSelection(findDeepestOpenChild(sibling),true);
  }
 else {
    onSelection(parent,true);
  }
}

Fixed version (ground truth):
/** 
 * Moves the selected item up one.
 */
private void moveSelectionUp(TreeItem sel){
  TreeItem parent=sel.getParentItem();
  if (parent == null) {
    parent=root;
  }
  int idx=parent.getChildIndex(sel);
  if (idx > 0) {
    TreeItem sibling=parent.getChild(idx - 1);
    onSelection(findDeepestOpenChild(sibling),true,true);
  }
 else {
    onSelection(parent,true,true);
  }
}
Program: 83401
Project: 83401
Buggy source:
/** 
 * Selects a specified item.
 * @param item the item to be selected, or <code>null</code> to deselect allitems
 * @param fireEvents <code>true</code> to allow selection events to be fired
 */
public void setSelectedItem(TreeItem item,boolean fireEvents){
  if (item == null) {
    if (curSelection == null) {
      return;
    }
    curSelection.setSelected(false);
    curSelection=null;
    return;
  }
  onSelection(item,fireEvents);
}

Fixed version (ground truth):
/** 
 * Selects a specified item.
 * @param item the item to be selected, or <code>null</code> to deselect allitems
 * @param fireEvents <code>true</code> to allow selection events to be fired
 */
public void setSelectedItem(TreeItem item,boolean fireEvents){
  if (item == null) {
    if (curSelection == null) {
      return;
    }
    curSelection.setSelected(false);
    curSelection=null;
    return;
  }
  onSelection(item,fireEvents,true);
}
Program: 83402
Project: 83402
Buggy source:
/** 
 * Moves to the next item, going into children as if dig is enabled.
 */
private void moveSelectionDown(TreeItem sel,boolean dig){
  if (sel == root) {
    return;
  }
  TreeItem parent=sel.getParentItem();
  if (parent == null) {
    parent=root;
  }
  int idx=parent.getChildIndex(sel);
  if (!dig || !sel.getState()) {
    if (idx < parent.getChildCount() - 1) {
      onSelection(parent.getChild(idx + 1),true);
    }
 else {
      moveSelectionDown(parent,false);
    }
  }
 else   if (sel.getChildCount() > 0) {
    onSelection(sel.getChild(0),true);
  }
}

Fixed version (ground truth):
/** 
 * Moves to the next item, going into children as if dig is enabled.
 */
private void moveSelectionDown(TreeItem sel,boolean dig){
  if (sel == root) {
    return;
  }
  TreeItem parent=sel.getParentItem();
  if (parent == null) {
    parent=root;
  }
  int idx=parent.getChildIndex(sel);
  if (!dig || !sel.getState()) {
    if (idx < parent.getChildCount() - 1) {
      onSelection(parent.getChild(idx + 1),true,true);
    }
 else {
      moveSelectionDown(parent,false);
    }
  }
 else   if (sel.getChildCount() > 0) {
    onSelection(sel.getChild(0),true,true);
  }
}
Program: 83403
Project: 83403
Buggy source:
public static int digit(char c,int radix){
  if (radix < MIN_RADIX || radix > MAX_RADIX) {
    return -1;
  }
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
 else   if (c >= 'a' && c < ('a' + radix - 10)) {
    return c - 'a' + 10;
  }
 else   if (c >= 'A' && c < ('A' + radix - 10)) {
    return c - 'A' + 10;
  }
  return -1;
}

Fixed version (ground truth):
public static int digit(char c,int radix){
  if (radix < MIN_RADIX || radix > MAX_RADIX) {
    return -1;
  }
  if (c >= '0' && c < '0' + Math.min(radix,10)) {
    return c - '0';
  }
  if (c >= 'a' && c < (radix + 'a' - 10)) {
    return c - 'a' + 10;
  }
  if (c >= 'A' && c < (radix + 'A' - 10)) {
    return c - 'A' + 10;
  }
  return -1;
}
Program: 83404
Project: 83404
Buggy source:
public abstract char change(char c);

Fixed version (ground truth):
public char change(char c){
  return Character.toUpperCase(c);
}
Program: 83405
Project: 83405
Buggy source:
/** 
 * Sets module name so that javascript compiler can operate 
 */
public String getModuleName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getModuleName(){
  return "String_Node_Str";
}
Program: 83406
Project: 83406
Buggy source:
public static void testToFromDigit(){
  for (int i=0; i < 16; i++) {
    assertEquals(i,Character.digit(Character.forDigit(i,16),16));
  }
  assertEquals(1,Character.digit('1',10));
  assertEquals('9',Character.forDigit(9,10));
  assertEquals(-1,Character.digit('A',10));
}

Fixed version (ground truth):
public void testToFromDigit(){
  for (int i=0; i < 16; i++) {
    assertEquals(i,Character.digit(Character.forDigit(i,16),16));
  }
  assertEquals(1,Character.digit('1',10));
  assertEquals('9',Character.forDigit(9,10));
  assertEquals(-1,Character.digit('7',6));
  assertEquals(-1,Character.digit('8',8));
  assertEquals(-1,Character.digit('A',10));
}