nus-yam/ex-repair huggingface dataset:
Program: 83305
Project: 83305
Buggy source:
/** 
 * Gets any named attribute from an element, as a string.
 * @param elem the element whose attribute is to be retrieved
 * @param attr the name of the attribute
 * @return the attribute's value
 * @deprecated Use the more appropriately named {@link #getElementProperty(Element,String)} instead.
 */
public static String getAttribute(Element elem,String attr){
  return getElementProperty(elem,attr);
}

Fixed version (ground truth):
/** 
 * Gets any named attribute from an element, as a string.
 * @param elem the element whose attribute is to be retrieved
 * @param attr the name of the attribute
 * @return the attribute's value
 * @deprecated Use the more appropriately named{@link #getElementProperty(Element,String)} instead.
 */
public static String getAttribute(Element elem,String attr){
  return getElementProperty(elem,attr);
}
Program: 83306
Project: 83306
Buggy source:
private static void hookWindowClosing(){
  Window.addWindowCloseListener(new WindowCloseListener(){
    public void onWindowClosed(){
      for (Iterator it=rootPanels.values().iterator(); it.hasNext(); ) {
        RootPanel gwt=(RootPanel)it.next();
        gwt.onDetach();
      }
    }
    public String onWindowClosing(){
      return null;
    }
  }
);
}

Fixed version (ground truth):
private static void hookWindowClosing(){
  Window.addWindowCloseListener(new WindowCloseListener(){
    public void onWindowClosed(){
      for (Iterator it=rootPanels.values().iterator(); it.hasNext(); ) {
        RootPanel gwt=(RootPanel)it.next();
        if (gwt.isAttached()) {
          gwt.onDetach();
        }
      }
    }
    public String onWindowClosing(){
      return null;
    }
  }
);
}
Program: 83307
Project: 83307
Buggy source:
public void onWindowClosed(){
  for (Iterator it=rootPanels.values().iterator(); it.hasNext(); ) {
    RootPanel gwt=(RootPanel)it.next();
    gwt.onDetach();
  }
}

Fixed version (ground truth):
public void onWindowClosed(){
  for (Iterator it=rootPanels.values().iterator(); it.hasNext(); ) {
    RootPanel gwt=(RootPanel)it.next();
    if (gwt.isAttached()) {
      gwt.onDetach();
    }
  }
}
Program: 83308
Project: 83308
Buggy source:
public void onBrowserEvent(Event event){
  if (DOM.eventGetType(event) == Event.ONCLICK) {
    int index=getDividerIndex(DOM.eventGetTarget(event));
    if (index != -1) {
      showStack(index);
    }
  }
}

Fixed version (ground truth):
public void onBrowserEvent(Event event){
  if (DOM.eventGetType(event) == Event.ONCLICK) {
    Element target=DOM.eventGetTarget(event);
    if (isDividerOwn(target)) {
      int index=getDividerIndex(target);
      if (index != -1) {
        showStack(index);
      }
    }
  }
}
Program: 83309
Project: 83309
Buggy source:
public boolean hasSideEffects(){
  if (field.isStatic() && (!field.isFinal() || field.constInitializer == null)) {
    JReferenceType fieldEncloser=field.getEnclosingType();
    if (enclosingType != fieldEncloser && program.typeOracle.hasClinit(fieldEncloser)) {
      return true;
    }
  }
  JExpression expr=instance;
  if (expr == null) {
    return false;
  }
  return expr.hasSideEffects();
}

Fixed version (ground truth):
public boolean hasSideEffects(){
  if (field.isStatic() && (!field.isFinal() || field.constInitializer == null)) {
    if (program.typeOracle.checkClinit(enclosingType,field.getEnclosingType())) {
      return true;
    }
  }
  JExpression expr=instance;
  if (expr == null) {
    return false;
  }
  return expr.hasSideEffects();
}
Program: 83310
Project: 83310
Buggy source:
public boolean hasClinit(JReferenceType type){
  return hasClinitSet.contains(type);
}

Fixed version (ground truth):
public boolean hasClinit(JReferenceType type){
  if (hasDirectClinit(type)) {
    return true;
  }
  if (type != null && type.extnds != null) {
    return hasClinit(type.extnds);
  }
  return false;
}
Program: 83311
Project: 83311
Buggy source:
public boolean canTriviallyCast(JReferenceType type,JReferenceType qType){
  JClassType jlo=program.getTypeJavaLangObject();
  if (type == qType || qType == jlo) {
    return true;
  }
  if (type instanceof JArrayType) {
    JArrayType aType=(JArrayType)type;
    if (qType instanceof JArrayType) {
      JArrayType qaType=(JArrayType)qType;
      JType leafType=aType.getLeafType();
      JType qLeafType=qaType.getLeafType();
      int dims=aType.getDims();
      int qDims=qaType.getDims();
      if (dims > qDims && (qLeafType == jlo || qLeafType instanceof JNullType)) {
        return true;
      }
      if (dims == qDims) {
        if (leafType instanceof JReferenceType && qLeafType instanceof JReferenceType) {
          return canTriviallyCast((JReferenceType)leafType,(JReferenceType)qLeafType);
        }
      }
    }
  }
 else   if (type instanceof JClassType) {
    JClassType cType=(JClassType)type;
    if (qType instanceof JClassType) {
      return getOrCreate(superClassMap,cType).contains(qType);
    }
 else     if (qType instanceof JInterfaceType) {
      return getOrCreate(implementsMap,cType).contains(qType);
    }
  }
 else   if (type instanceof JInterfaceType) {
    JInterfaceType iType=(JInterfaceType)type;
    if (qType instanceof JInterfaceType) {
      return getOrCreate(superInterfaceMap,iType).contains(qType);
    }
  }
 else   if (type instanceof JNullType) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean canTriviallyCast(JReferenceType type,JReferenceType qType){
  JClassType jlo=program.getTypeJavaLangObject();
  if (type == qType || qType == jlo) {
    return true;
  }
  if (type instanceof JArrayType) {
    JArrayType aType=(JArrayType)type;
    if (qType instanceof JArrayType) {
      JArrayType qaType=(JArrayType)qType;
      JType leafType=aType.getLeafType();
      JType qLeafType=qaType.getLeafType();
      int dims=aType.getDims();
      int qDims=qaType.getDims();
      if (dims > qDims && (qLeafType == jlo || qLeafType instanceof JNullType)) {
        return true;
      }
      if (dims == qDims) {
        if (leafType instanceof JReferenceType && qLeafType instanceof JReferenceType) {
          return canTriviallyCast((JReferenceType)leafType,(JReferenceType)qLeafType);
        }
      }
    }
  }
 else   if (type instanceof JClassType) {
    JClassType cType=(JClassType)type;
    if (qType instanceof JClassType) {
      return isSuperClass(cType,(JClassType)qType);
    }
 else     if (qType instanceof JInterfaceType) {
      return implementsInterface(cType,(JInterfaceType)qType);
    }
  }
 else   if (type instanceof JInterfaceType) {
    JInterfaceType iType=(JInterfaceType)type;
    if (qType instanceof JInterfaceType) {
      return extendsInterface(iType,(JInterfaceType)qType);
    }
  }
 else   if (type instanceof JNullType) {
    return true;
  }
  return false;
}
Program: 83312
Project: 83312
Buggy source:
public boolean canTheoreticallyCast(JReferenceType type,JReferenceType qType){
  JClassType jlo=program.getTypeJavaLangObject();
  if (type == qType || type == jlo) {
    return true;
  }
  if (canTriviallyCast(type,qType)) {
    return true;
  }
  if (type instanceof JArrayType) {
    JArrayType aType=(JArrayType)type;
    if (qType instanceof JArrayType) {
      JArrayType qaType=(JArrayType)qType;
      JType leafType=aType.getLeafType();
      JType qLeafType=qaType.getLeafType();
      int dims=aType.getDims();
      int qDims=qaType.getDims();
      if (dims < qDims && leafType != program.getTypeJavaLangObject() && !(leafType instanceof JNullType)) {
        return false;
      }
      if (dims == qDims) {
        if (leafType instanceof JReferenceType && qLeafType instanceof JReferenceType) {
          return canTheoreticallyCast((JReferenceType)leafType,(JReferenceType)qLeafType);
        }
      }
    }
  }
 else   if (type instanceof JClassType) {
    JClassType cType=(JClassType)type;
    if (qType instanceof JClassType) {
      return getOrCreate(subClassMap,cType).contains(qType);
    }
 else     if (qType instanceof JInterfaceType) {
      return getOrCreate(couldImplementMap,cType).contains(qType);
    }
  }
 else   if (type instanceof JInterfaceType) {
    JInterfaceType iType=(JInterfaceType)type;
    if (qType instanceof JClassType) {
      return getOrCreate(couldBeImplementedMap,iType).contains(qType);
    }
  }
 else   if (type instanceof JNullType) {
  }
  return true;
}

Fixed version (ground truth):
public boolean canTheoreticallyCast(JReferenceType type,JReferenceType qType){
  JClassType jlo=program.getTypeJavaLangObject();
  if (type == qType || type == jlo) {
    return true;
  }
  if (canTriviallyCast(type,qType)) {
    return true;
  }
  if (type instanceof JArrayType) {
    JArrayType aType=(JArrayType)type;
    if (qType instanceof JArrayType) {
      JArrayType qaType=(JArrayType)qType;
      JType leafType=aType.getLeafType();
      JType qLeafType=qaType.getLeafType();
      int dims=aType.getDims();
      int qDims=qaType.getDims();
      if (dims < qDims && leafType != program.getTypeJavaLangObject() && !(leafType instanceof JNullType)) {
        return false;
      }
      if (dims == qDims) {
        if (leafType instanceof JReferenceType && qLeafType instanceof JReferenceType) {
          return canTheoreticallyCast((JReferenceType)leafType,(JReferenceType)qLeafType);
        }
      }
    }
  }
 else   if (type instanceof JClassType) {
    JClassType cType=(JClassType)type;
    if (qType instanceof JClassType) {
      return isSubClass(cType,(JClassType)qType);
    }
 else     if (qType instanceof JInterfaceType) {
      return getOrCreate(couldImplementMap,cType).contains(qType);
    }
  }
 else   if (type instanceof JInterfaceType) {
    JInterfaceType iType=(JInterfaceType)type;
    if (qType instanceof JClassType) {
      return getOrCreate(couldBeImplementedMap,iType).contains(qType);
    }
  }
 else   if (type instanceof JNullType) {
  }
  return true;
}
Program: 83313
Project: 83313
Buggy source:
private void handleClinit(JsFunction clinitFunc){
  JsExpression asg=createAssignment(clinitFunc.getName().makeRef(),nullMethodName.makeRef());
  clinitFunc.getBody().getStatements().add(0,asg.makeStmt());
}

Fixed version (ground truth):
private void handleClinit(JsFunction clinitFunc,JReferenceType chainTo){
  JsStatements statements=clinitFunc.getBody().getStatements();
  JsExpression asg=createAssignment(clinitFunc.getName().makeRef(),nullMethodName.makeRef());
  statements.add(0,asg.makeStmt());
  if (chainTo != null) {
    JMethod chainToMeth=(JMethod)chainTo.methods.get(0);
    JsInvocation jsInvocation=new JsInvocation();
    JsNameRef qualifier=getName(chainToMeth).makeRef();
    jsInvocation.setQualifier(qualifier);
    statements.add(1,jsInvocation.makeStmt());
  }
}
Program: 83314
Project: 83314
Buggy source:
private JsInvocation maybeCreateClinitCall(JMethod x){
  if (!x.isStatic()) {
    return null;
  }
  JReferenceType enclosingType=x.getEnclosingType();
  if (!typeOracle.hasClinit(enclosingType)) {
    return null;
  }
  if (x == enclosingType.methods.get(0)) {
    return null;
  }
  if (program.isStaticImpl(x)) {
    return null;
  }
  JMethod clinitMethod=(JMethod)enclosingType.methods.get(0);
  JsInvocation jsInvocation=new JsInvocation();
  jsInvocation.setQualifier(getName(clinitMethod).makeRef());
  return jsInvocation;
}

Fixed version (ground truth):
private JsInvocation maybeCreateClinitCall(JMethod x){
  if (!x.isStatic()) {
    return null;
  }
  JReferenceType enclosingType=x.getEnclosingType();
  if (!typeOracle.hasClinit(enclosingType)) {
    return null;
  }
  if (program.isStaticImpl(x)) {
    return null;
  }
  if (x == enclosingType.methods.get(0)) {
    return null;
  }
  while (!typeOracle.hasDirectClinit(enclosingType)) {
    enclosingType=enclosingType.extnds;
  }
  JMethod clinitMethod=(JMethod)enclosingType.methods.get(0);
  JsInvocation jsInvocation=new JsInvocation();
  jsInvocation.setQualifier(getName(clinitMethod).makeRef());
  return jsInvocation;
}
Program: 83315
Project: 83315
Buggy source:
/** 
 * Returns <code>true</code> if inlining the target expression would eliminate a necessary clinit.
 */
private boolean checkClinitViolation(JMethodCall x,JExpression resultExpression){
  JReferenceType targetEnclosingType=x.getTarget().getEnclosingType();
  if (!program.typeOracle.hasClinit(targetEnclosingType)) {
    return false;
  }
  if (program.isStaticImpl(x.getTarget())) {
    return false;
  }
  if (currentMethod.getEnclosingType() == targetEnclosingType) {
    return false;
  }
  if (!(resultExpression instanceof JFieldRef)) {
    return true;
  }
  JFieldRef fieldRefResult=(JFieldRef)resultExpression;
  JField fieldResult=fieldRefResult.getField();
  if (!fieldResult.isStatic()) {
    return true;
  }
  if (fieldResult.getEnclosingType() != targetEnclosingType) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if inlining the target expression would eliminate a necessary clinit.
 */
private boolean checkClinitViolation(JMethodCall x,JExpression resultExpression){
  JReferenceType targetEnclosingType=x.getTarget().getEnclosingType();
  if (!program.typeOracle.checkClinit(currentMethod.getEnclosingType(),targetEnclosingType)) {
    return false;
  }
  if (program.isStaticImpl(x.getTarget())) {
    return false;
  }
  if (!(resultExpression instanceof JFieldRef)) {
    return true;
  }
  JFieldRef fieldRefResult=(JFieldRef)resultExpression;
  JField fieldResult=fieldRefResult.getField();
  if (!fieldResult.isStatic()) {
    return true;
  }
  if (fieldResult.getEnclosingType() != targetEnclosingType) {
    return true;
  }
  return false;
}
Program: 83316
Project: 83316
Buggy source:
public void testClinitSideEffectInlining(){
  sideEffectChecker=0;
  SideEffectCauser.causeClinitSideEffect();
  assertEquals(1,sideEffectChecker);
  SideEffectCauser2.causeClinitSideEffect();
  assertEquals(2,sideEffectChecker);
  SideEffectCauser3.causeClinitSideEffect();
  assertEquals(3,sideEffectChecker);
  String foo=SideEffectCauser4.causeClinitSideEffectOnRead;
  assertEquals(4,sideEffectChecker);
  String bar=jsniReadSideEffectCauser5();
  assertEquals(5,sideEffectChecker);
  String checkRescued=NonSideEffectCauser.NOT_A_COMPILE_TIME_CONSTANT;
  assertEquals(null,checkRescued);
}

Fixed version (ground truth):
public void testClinitSideEffectInlining(){
  sideEffectChecker=0;
  SideEffectCauser.causeClinitSideEffect();
  assertEquals(1,sideEffectChecker);
  SideEffectCauser2.causeClinitSideEffect();
  assertEquals(2,sideEffectChecker);
  SideEffectCauser3.causeClinitSideEffect();
  assertEquals(3,sideEffectChecker);
  String foo=SideEffectCauser4.causeClinitSideEffectOnRead;
  assertEquals(4,sideEffectChecker);
  jsniReadSideEffectCauser5();
  assertEquals(5,sideEffectChecker);
  foo=SideEffectCauser6.causeClinitSideEffectOnRead;
  assertEquals(6,sideEffectChecker);
  String checkRescued=NonSideEffectCauser.NOT_A_COMPILE_TIME_CONSTANT;
  assertEquals(null,checkRescued);
}
Program: 83317
Project: 83317
Buggy source:
private JExpression checkAndReplaceJso(JExpression arg,JType targetType){
  JType argType=arg.getType();
  if (argType == targetType) {
    return arg;
  }
  if (!(targetType instanceof JReferenceType)) {
    return arg;
  }
  if (!program.isJavaScriptObject(argType)) {
    return arg;
  }
  JCastOperation cast=new JCastOperation(program,arg.getSourceInfo(),targetType,arg);
  return cast;
}

Fixed version (ground truth):
/** 
 * Wraps a JSO-typed argument if the target type is a different type.
 */
private JExpression checkAndReplaceJso(JExpression arg,JType targetType){
  JType argType=arg.getType();
  if (argType == targetType) {
    return arg;
  }
  if (!(targetType instanceof JReferenceType)) {
    return arg;
  }
  if (!program.isJavaScriptObject(argType)) {
    return arg;
  }
  JCastOperation cast=new JCastOperation(program,arg.getSourceInfo(),argType,arg);
  return cast;
}
Program: 83318
Project: 83318
Buggy source:
public void testJso(){
  Foo foo=getFoo();
  assertEquals("String_Node_Str",foo.toString());
  JavaScriptObject jso=foo;
  assertEquals("String_Node_Str",jso.toString());
  Object y=noOptimizeFalse() ? new Object() : foo;
  assertEquals("String_Node_Str",y.toString());
  jso=getJso();
  assertEquals("String_Node_Str",jso.toString());
}

Fixed version (ground truth):
public void testJso(){
  Foo foo=getFoo();
  assertEquals("String_Node_Str",foo.toString());
  JavaScriptObject jso=foo;
  assertEquals("String_Node_Str",jso.toString());
  Object y=noOptimizeFalse() ? new Object() : foo;
  assertEquals("String_Node_Str",y.toString());
  jso=getJso();
  assertEquals("String_Node_Str",jso.toString());
  try {
    JavaScriptObject[] typeTightenedFooArray=new Foo[3];
    typeTightenedFooArray[0]=getJso();
    fail();
  }
 catch (  ArrayStoreException e) {
  }
  try {
    JavaScriptObject[] fooArray=noOptimizeFalse() ? new JavaScriptObject[3] : new Foo[3];
    fooArray[0]=getJso();
    fail();
  }
 catch (  ArrayStoreException e) {
  }
  JavaScriptObject[] jsoArray=noOptimizeFalse() ? new Foo[3] : new JavaScriptObject[3];
  jsoArray[0]=getJso();
}
Program: 83319
Project: 83319
Buggy source:
/** 
 * 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);
}

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, or <code>null</code> if the cookie doesn't exist
 */
public static String getCookie(String name){
  Map cookiesMap=ensureCookies();
  return (String)cookiesMap.get(name);
}
Program: 83321
Project: 83321
Buggy source:
protected void writeGetSerializationSignatureMethod(){
  if (!shouldEnforceTypeVersioning()) {
    srcWriter.println("String_Node_Str");
    srcWriter.indentln("String_Node_Str");
    srcWriter.println("String_Node_Str");
  }
 else {
    String serializerTypeName=serializationOracle.getTypeSerializerQualifiedName(getServiceInterface());
    srcWriter.println("String_Node_Str" + '{');
    srcWriter.indent();
    srcWriter.println("String_Node_Str" + serializerTypeName + "String_Node_Str");
    srcWriter.println("String_Node_Str");
    srcWriter.indentln("String_Node_Str" + serializerTypeName + "String_Node_Str");
    srcWriter.println("String_Node_Str");
    srcWriter.println("String_Node_Str");
    srcWriter.outdent();
    srcWriter.println("String_Node_Str");
  }
  srcWriter.println();
}

Fixed version (ground truth):
protected void writeGetSerializationSignatureMethod(){
  if (!shouldEnforceTypeVersioning()) {
    srcWriter.println("String_Node_Str");
    srcWriter.indentln("String_Node_Str");
    srcWriter.println("String_Node_Str");
  }
 else {
    String serializerTypeName=serializationOracle.getTypeSerializerQualifiedName(getServiceInterface());
    srcWriter.println("String_Node_Str" + '{');
    srcWriter.indent();
    srcWriter.println("String_Node_Str" + serializerTypeName + "String_Node_Str");
    srcWriter.println("String_Node_Str");
    srcWriter.outdent();
    srcWriter.println("String_Node_Str");
  }
  srcWriter.println();
}
Program: 83322
Project: 83322
Buggy source:
/** 
 * Convenience methods to get an attribute on a cell.
 * @param row cell's row
 * @param column cell's column
 * @param attr attribute to get
 * @return the attribute's value
 * @throws IndexOutOfBoundsException
 */
protected String getAttr(int row,int column,String attr){
  Element elem=getElement(row,column);
  return DOM.getElementProperty(elem,attr);
}

Fixed version (ground truth):
/** 
 * Convenience methods to get an attribute on a cell.
 * @param row cell's row
 * @param column cell's column
 * @param attr attribute to get
 * @return the attribute's value
 * @throws IndexOutOfBoundsException
 */
protected String getAttr(int row,int column,String attr){
  Element elem=getElement(row,column);
  return DOM.getElementAttribute(elem,attr);
}
Program: 83323
Project: 83323
Buggy source:
/** 
 * Convenience methods to set an attribute on a row.
 * @param row cell's row
 * @param attrName attribute to set
 * @param value value to set
 * @throws IndexOutOfBoundsException
 */
protected void setAttr(int row,String attrName,String value){
  Element elem=ensureElement(row);
  DOM.setElementProperty(elem,attrName,value);
}

Fixed version (ground truth):
/** 
 * Convenience methods to set an attribute on a row.
 * @param row cell's row
 * @param attrName attribute to set
 * @param value value to set
 * @throws IndexOutOfBoundsException
 */
protected void setAttr(int row,String attrName,String value){
  Element elem=ensureElement(row);
  DOM.setElementAttribute(elem,attrName,value);
}
Program: 83324
Project: 83324
Buggy source:
/** 
 * This method is called when a widget is attached to the browser's document. It must not be overridden, except by   {@link Panel}. To receive notification when a widget is attached to the document, override the  {@link #onLoad} method.
 */
protected void onAttach(){
  if (attached) {
    return;
  }
  attached=true;
  DOM.setEventListener(getElement(),this);
  onLoad();
}

Fixed version (ground truth):
/** 
 * This method is called when a widget is attached to the browser's document. It must not be overridden, except by   {@link Panel}. To receive notification when a widget is attached to the document, override the  {@link #onLoad} method.
 * @throws IllegalStateException if this widget is already attached
 */
protected void onAttach(){
  if (attached) {
    throw new IllegalStateException("String_Node_Str");
  }
  attached=true;
  DOM.setEventListener(getElement(),this);
  onLoad();
}
Program: 83325
Project: 83325
Buggy source:
/** 
 * Sets this widget's parent. This method should only be called by  {@link Panel} and {@link Composite}.
 * @param parent the widget's new parent
 */
void setParent(Widget parent){
  this.parent=parent;
  if (parent == null) {
    onDetach();
  }
 else   if (parent.isAttached()) {
    onAttach();
  }
}

Fixed version (ground truth):
/** 
 * Sets this widget's parent. This method should only be called by  {@link Panel} and {@link Composite}.
 * @param parent the widget's new parent
 */
void setParent(Widget parent){
  Widget oldParent=this.parent;
  this.parent=parent;
  if (parent == null) {
    if (oldParent != null && oldParent.isAttached()) {
      onDetach();
    }
  }
 else   if (parent.isAttached()) {
    onAttach();
  }
}
Program: 83326
Project: 83326
Buggy source:
/** 
 * This method is called when a widget is detached from the browser's document. It must not be overridden, except by   {@link Panel}.
 */
protected void onDetach(){
  if (!attached) {
    return;
  }
  attached=false;
  DOM.setEventListener(getElement(),null);
}

Fixed version (ground truth):
/** 
 * This method is called when a widget is detached from the browser's document. It must not be overridden, except by   {@link Panel}.
 * @throws IllegalStateException if this widget is already detached
 */
protected void onDetach(){
  if (!attached) {
    throw new IllegalStateException("String_Node_Str");
  }
  attached=false;
  DOM.setEventListener(getElement(),null);
}
Program: 83327
Project: 83327
Buggy source:
/** 
 * Fired when the user depresses a physical key.
 * @param sender the widget that was focused when the event occurred.
 * @param keyCode the physical key that was depressed. Constants for thisvalue are defined in this interface with the KEYCODE prefix.
 * @param modifiers the modifier keys pressed at when the event occurred. Thisvalue is a combination of the bits defined by {@link KeyboardListener#MODIFIER_SHIFT},  {@link KeyboardListener#MODIFIER_CTRL}, and  {@link KeyboardListener#MODIFIER_ALT}.
 */
void onKeyDown(Widget sender,char keyCode,int modifiers);

Fixed version (ground truth):
/** 
 * Fired when the user depresses a physical key.
 * @param sender the widget that was focused when the event occurred.
 * @param keyCode the physical key that was depressed. Constants for thisvalue are defined in this interface with the KEY prefix.
 * @param modifiers the modifier keys pressed at when the event occurred. Thisvalue is a combination of the bits defined by {@link KeyboardListener#MODIFIER_SHIFT},  {@link KeyboardListener#MODIFIER_CTRL}, and  {@link KeyboardListener#MODIFIER_ALT}.
 */
void onKeyDown(Widget sender,char keyCode,int modifiers);
Program: 83328
Project: 83328
Buggy source:
/** 
 * Fired when the user releases a physical key.
 * @param sender the widget that was focused when the event occurred.
 * @param keyCode the physical key that was released. Constants for this valueare defined in this interface with the KEYCODE prefix.
 * @param modifiers the modifier keys pressed at when the event occurred. Thisvalue is a combination of the bits defined by {@link KeyboardListener#MODIFIER_SHIFT},  {@link KeyboardListener#MODIFIER_CTRL}, and  {@link KeyboardListener#MODIFIER_ALT}.
 */
void onKeyUp(Widget sender,char keyCode,int modifiers);

Fixed version (ground truth):
/** 
 * Fired when the user releases a physical key.
 * @param sender the widget that was focused when the event occurred.
 * @param keyCode the physical key that was released. Constants for this valueare defined in this interface with the KEY prefix.
 * @param modifiers the modifier keys pressed at when the event occurred. Thisvalue is a combination of the bits defined by {@link KeyboardListener#MODIFIER_SHIFT},  {@link KeyboardListener#MODIFIER_CTRL}, and  {@link KeyboardListener#MODIFIER_ALT}.
 */
void onKeyUp(Widget sender,char keyCode,int modifiers);
Program: 83329
Project: 83329
Buggy source:
/** 
 * Fired when a keyboard action generates a character. This occurs after onKeyDown and onKeyUp are fired for the physical key that was pressed.
 * @param sender the widget that was focused when the event occurred.
 * @param keyCode the Unicode character that was generated by the keyboardaction.
 * @param modifiers the modifier keys pressed at when the event occurred. Thisvalue is a combination of the bits defined by {@link KeyboardListener#MODIFIER_SHIFT},  {@link KeyboardListener#MODIFIER_CTRL}, and  {@link KeyboardListener#MODIFIER_ALT}.
 */
void onKeyPress(Widget sender,char keyCode,int modifiers);

Fixed version (ground truth):
/** 
 * Fired when a keyboard action generates a character. This occurs after onKeyDown and onKeyUp are fired for the physical key that was pressed. <p> It should be noted that many browsers do not generate keypress events for non-printing keyCode values, such as   {@link KeyboardListener#KEY_ENTER}or arrow keys.  These keyCodes can be reliably captured either with  {@link KeyboardListener#onKeyDown(Widget,char,int)} or{@link KeyboardListener#onKeyUp(Widget,char,int)}. </p>
 * @param sender the widget that was focused when the event occurred.
 * @param keyCode the Unicode character that was generated by the keyboardaction.
 * @param modifiers the modifier keys pressed at when the event occurred. Thisvalue is a combination of the bits defined by {@link KeyboardListener#MODIFIER_SHIFT},  {@link KeyboardListener#MODIFIER_CTRL}, and  {@link KeyboardListener#MODIFIER_ALT}.
 */
void onKeyPress(Widget sender,char keyCode,int modifiers);
Program: 83330
Project: 83330
Buggy source:
protected GWTShell(boolean forceServer,boolean noURLs){
  registerHandler(new ArgHandlerPort());
  if (!forceServer) {
    registerHandler(new ArgHandlerNoServerFlag());
  }
  registerHandler(new ArgHandlerWhitelist());
  registerHandler(new ArgHandlerBlacklist());
  registerHandler(new ArgHandlerLogLevel(){
    public String[] getDefaultArgs(){
      return new String[]{getTag(),doGetDefaultLogLevel()};
    }
    public void setLogLevel(    Type level){
      logLevel=level;
    }
  }
);
  registerHandler(new ArgHandlerGenDir(){
    public void setDir(    File dir){
      genDir=dir;
    }
  }
);
  if (!noURLs) {
    registerHandler(new ArgHandlerStartupURLs());
  }
  registerHandler(new ArgHandlerOutDir(){
    public void setDir(    File dir){
      outDir=dir;
    }
  }
);
  registerHandler(new ArgHandlerScriptStyle(){
    public void setStyleDetailed(){
      obfuscate=false;
      prettyNames=false;
    }
    public void setStyleObfuscated(){
      obfuscate=true;
    }
    public void setStylePretty(){
      obfuscate=false;
      prettyNames=true;
    }
  }
);
}

Fixed version (ground truth):
protected GWTShell(boolean forceServer,boolean noURLs){
  registerHandler(getArgHandlerPort());
  if (!forceServer) {
    registerHandler(new ArgHandlerNoServerFlag());
  }
  registerHandler(new ArgHandlerWhitelist());
  registerHandler(new ArgHandlerBlacklist());
  registerHandler(new ArgHandlerLogLevel(){
    public String[] getDefaultArgs(){
      return new String[]{getTag(),doGetDefaultLogLevel()};
    }
    public void setLogLevel(    Type level){
      logLevel=level;
    }
  }
);
  registerHandler(new ArgHandlerGenDir(){
    public void setDir(    File dir){
      genDir=dir;
    }
  }
);
  if (!noURLs) {
    registerHandler(new ArgHandlerStartupURLs());
  }
  registerHandler(new ArgHandlerOutDir(){
    public void setDir(    File dir){
      outDir=dir;
    }
  }
);
  registerHandler(new ArgHandlerScriptStyle(){
    public void setStyleDetailed(){
      obfuscate=false;
      prettyNames=false;
    }
    public void setStyleObfuscated(){
      obfuscate=true;
    }
    public void setStylePretty(){
      obfuscate=false;
      prettyNames=true;
    }
  }
);
}
Program: 83331
Project: 83331
Buggy source:
protected boolean startUp(){
  if (started) {
    throw new IllegalStateException("String_Node_Str");
  }
  started=true;
  loadRequiredNativeLibs();
  openAppWindow();
  initializeLogger();
  if (runTomcat) {
    final int serverPort=getPort();
    String whyFailed=EmbeddedTomcatServer.start(getTopLogger(),serverPort,outDir);
    if (whyFailed != null) {
      System.err.println(whyFailed);
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
protected boolean startUp(){
  if (started) {
    throw new IllegalStateException("String_Node_Str");
  }
  started=true;
  loadRequiredNativeLibs();
  openAppWindow();
  initializeLogger();
  if (runTomcat) {
    final int serverPort=getPort();
    String whyFailed=EmbeddedTomcatServer.start(getTopLogger(),serverPort,outDir);
    if (whyFailed != null) {
      System.err.println(whyFailed);
      return false;
    }
    port=EmbeddedTomcatServer.getPort();
  }
  return true;
}
Program: 83333
Project: 83333
Buggy source:
public static synchronized String start(TreeLogger topLogger,int port,File outDir){
  if (sTomcat != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    new EmbeddedTomcatServer(topLogger,port,outDir);
    sTomcat.catEmbedded.start();
    return null;
  }
 catch (  LifecycleException e) {
    String msg=e.getMessage();
    if (msg != null && msg.indexOf("String_Node_Str") != -1) {
      msg="String_Node_Str" + port + "String_Node_Str";
    }
 else {
      msg="String_Node_Str";
    }
    return msg;
  }
}

Fixed version (ground truth):
public static synchronized String start(TreeLogger topLogger,int port,File outDir){
  if (sTomcat != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    new EmbeddedTomcatServer(topLogger,port,outDir);
    return null;
  }
 catch (  LifecycleException e) {
    String msg=e.getMessage();
    if (msg != null && msg.indexOf("String_Node_Str") != -1) {
      msg="String_Node_Str" + port + "String_Node_Str";
    }
 else {
      msg="String_Node_Str";
    }
    return msg;
  }
}
Program: 83334
Project: 83334
Buggy source:
public boolean visit(JsProgram x,JsContext ctx){
  return true;
}

Fixed version (ground truth):
public boolean visit(JsBlock x,JsContext ctx){
  printJsBlockOptionalTruncate(x,false);
  return false;
}
Program: 83335
Project: 83335
Buggy source:
public void setText(String text){
  DOM.setInnerHTML(anchorElem,text);
}

Fixed version (ground truth):
public void setText(String text){
  DOM.setInnerText(anchorElem,text);
}
Program: 83336
Project: 83336
Buggy source:
/** 
 * Get the value associated with the given Dictionary key.
 * @param key to lookup
 * @return the value
 * @throws MissingResourceException if the value is not found
 */
public native String get(String key);

Fixed version (ground truth):
/** 
 * Get the value associated with the given Dictionary key. We have to call Object.hasOwnProperty to verify that the value is defined on this object, rather than a superclass, since normal Object properties are also visible on this object.
 * @param key to lookup
 * @return the value
 * @throws MissingResourceException if the value is not found
 */
public native String get(String key);
Program: 83337
Project: 83337
Buggy source:
/** 
 * Tests whether or not this JSONObject contains the specified key.
 * @param key the key to search for
 * @return <code>true</code> if the JSONObject contains the specified key
 */
public native boolean containsKey(String key);

Fixed version (ground truth):
/** 
 * Tests whether or not this JSONObject contains the specified key. We use Object.hasOwnProperty here to verify that a given key is specified on this object rather than a superclass (such as standard properties defined on Object).
 * @param key the key to search for
 * @return <code>true</code> if the JSONObject contains the specified key
 */
public native boolean containsKey(String key);
Program: 83338
Project: 83338
Buggy source:
/** 
 * Gets the JSONValue associated with the specified key.
 * @param key the key to search for
 * @return if found, the value associated with the specified key, or<code>null</code> otherwise
 */
public native JSONValue get(String key);

Fixed version (ground truth):
/** 
 * Gets the JSONValue associated with the specified key. We use Object.hasOwnProperty here to verify that a given key is specified on this object rather than a superclass (such as standard properties defined on Object).
 * @param key the key to search for
 * @return if found, the value associated with the specified key, or<code>null</code> otherwise
 */
public native JSONValue get(String key);
Program: 83339
Project: 83339
Buggy source:
/** 
 * Inline a call to a method that contains only a return statement.
 */
private boolean tryInlineExpression(JMethodCall x,Context ctx,JExpression targetExpr){
  List params=x.getTarget().params;
  ArrayList args=x.getArgs();
  JExpression resultExpression;
  int magicArg[]=new int[1];
  resultExpression=canInlineExpression(x.getSourceInfo(),targetExpr,params,args,magicArg);
  if (resultExpression == null) {
    return false;
  }
  int iMagicArg=magicArg[0];
  JMultiExpression multi=new JMultiExpression(program,x.getSourceInfo());
  JExpression instance=x.getInstance();
  if (instance != null && instance.hasSideEffects()) {
    multi.exprs.add(x.getInstance());
  }
  for (int i=0; i < params.size(); ++i) {
    if (((JExpression)args.get(i)).hasSideEffects()) {
      if (i < iMagicArg) {
        multi.exprs.add(args.get(i));
      }
 else       if (i == iMagicArg) {
      }
 else {
        assert(i > iMagicArg);
        return true;
      }
    }
  }
  multi.exprs.add(resultExpression);
  ctx.replaceMe(multi);
  return true;
}

Fixed version (ground truth):
/** 
 * Inline a call to a method that contains only a return statement.
 */
private boolean tryInlineExpression(JMethodCall x,Context ctx,JExpression targetExpr){
  List params=x.getTarget().params;
  ArrayList args=x.getArgs();
  JExpression resultExpression;
  int magicArg[]=new int[1];
  resultExpression=canInlineExpression(x.getSourceInfo(),targetExpr,params,args,magicArg);
  if (resultExpression == null) {
    return false;
  }
  if (checkClinitViolation(x,resultExpression)) {
    return true;
  }
  int iMagicArg=magicArg[0];
  JMultiExpression multi=new JMultiExpression(program,x.getSourceInfo());
  JExpression instance=x.getInstance();
  if (instance != null && instance.hasSideEffects()) {
    multi.exprs.add(x.getInstance());
  }
  for (int i=0; i < params.size(); ++i) {
    if (((JExpression)args.get(i)).hasSideEffects()) {
      if (i < iMagicArg) {
        multi.exprs.add(args.get(i));
      }
 else       if (i == iMagicArg) {
      }
 else {
        assert(i > iMagicArg);
        return true;
      }
    }
  }
  multi.exprs.add(resultExpression);
  ctx.replaceMe(multi);
  return true;
}
Program: 83340
Project: 83340
Buggy source:
public void testClinitSideEffectInlining(){
  sideEffectChecker=0;
  SideEffectCauser.causeClinitSideEffect();
  assertEquals(1,sideEffectChecker);
  SideEffectCauser2.causeClinitSideEffect();
  if (GWT.isScript()) {
    ++sideEffectChecker;
  }
  assertEquals(2,sideEffectChecker);
  String checkRescued=NonSideEffectCauser.NOT_A_COMPILE_TIME_CONSTANT;
  assertEquals(null,checkRescued);
}

Fixed version (ground truth):
public void testClinitSideEffectInlining(){
  sideEffectChecker=0;
  SideEffectCauser.causeClinitSideEffect();
  assertEquals(1,sideEffectChecker);
  SideEffectCauser2.causeClinitSideEffect();
  assertEquals(2,sideEffectChecker);
  SideEffectCauser3.causeClinitSideEffect();
  assertEquals(3,sideEffectChecker);
  String checkRescued=NonSideEffectCauser.NOT_A_COMPILE_TIME_CONSTANT;
  assertEquals(null,checkRescued);
}
Program: 83341
Project: 83341
Buggy source:
public static Object causeClinitSideEffect(){
  return null;
}

Fixed version (ground truth):
public static void causeClinitSideEffect(){
}
Program: 83342
Project: 83342
Buggy source:
/** 
 * Returns true if the method is considered to be a valid JUnit test method. The criteria are that the method's name begin with "test", have public access, and not be static. You must choose to include or exclude methods which have arguments.
 */
static boolean isJUnitTestMethod(JMethod method,boolean acceptArgs){
  if (!method.getName().startsWith("String_Node_Str")) {
    return false;
  }
  if (!method.isPublic() || method.isStatic()) {
    return false;
  }
  return acceptArgs || method.getParameters().length == 0 && !acceptArgs;
}

Fixed version (ground truth):
/** 
 * Returns true if the method is considered to be a valid JUnit test method. The criteria are that the method's name begin with "test" and have public access. The method may be static. You must choose to include or exclude methods which have arguments.
 */
static boolean isJUnitTestMethod(JMethod method,boolean acceptArgs){
  if (!method.getName().startsWith("String_Node_Str")) {
    return false;
  }
  if (!method.isPublic()) {
    return false;
  }
  return acceptArgs || method.getParameters().length == 0 && !acceptArgs;
}
Program: 83343
Project: 83343
Buggy source:
/** 
 * Static initialization: generate one call to 'JavaScriptHost.createNative()' for each native method, to define the JavaScript code that will be invoked later.
 */
private char[] genInitializerBlock(String file,char[] source,JMethod[] methods){
  String escapedFile=Jsni.escapeQuotesAndSlashes(file);
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str");
  for (int i=0; i < methods.length; ++i) {
    JMethod method=methods[i];
    JsBlock jsniBody=(JsBlock)parsedJsByMethod.get(method);
    if (jsniBody == null) {
      continue;
    }
    JParameter[] params=method.getParameters();
    String paramNamesArray=getParamNamesArrayExpr(params);
    final String jsTry="String_Node_Str";
    final String jsCatch="String_Node_Str" + "String_Node_Str" + Jsni.JAVASCRIPTHOST_NAME + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    String js=jsTry + Jsni.generateEscapedJavaScript(jsniBody) + jsCatch;
    String jsniSig=Jsni.getJsniSignature(method);
    int bodyStart=method.getBodyStart();
    int line=Jsni.countNewlines(source,0,bodyStart) + 1;
    sb.append("String_Node_Str" + Jsni.JAVASCRIPTHOST_NAME + "String_Node_Str"+ escapedFile+ "String_Node_Str"+ line+ "String_Node_Str"+ "String_Node_Str"+ jsniSig+ "String_Node_Str"+ paramNamesArray+ "String_Node_Str"+ js+ "String_Node_Str");
  }
  sb.append("String_Node_Str");
  return sb.toString().toCharArray();
}

Fixed version (ground truth):
/** 
 * Static initialization: generate one call to 'JavaScriptHost.createNative()' for each native method, to define the JavaScript code that will be invoked later.
 */
private char[] genInitializerBlock(String file,char[] source,JMethod[] methods){
  String escapedFile=Jsni.escapeQuotesAndSlashes(file);
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str");
  for (int i=0; i < methods.length; ++i) {
    JMethod method=methods[i];
    JsBlock jsniBody=(JsBlock)parsedJsByMethod.get(method);
    if (jsniBody == null) {
      continue;
    }
    JParameter[] params=method.getParameters();
    String paramNamesArray=getParamNamesArrayExpr(params);
    final String jsTry="String_Node_Str";
    final String jsCatch="String_Node_Str" + "String_Node_Str" + Jsni.JAVASCRIPTHOST_NAME + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    String js=jsTry + Jsni.generateEscapedJavaScriptForHostedMode(jsniBody) + jsCatch;
    String jsniSig=Jsni.getJsniSignature(method);
    int bodyStart=method.getBodyStart();
    int line=Jsni.countNewlines(source,0,bodyStart) + 1;
    sb.append("String_Node_Str" + Jsni.JAVASCRIPTHOST_NAME + "String_Node_Str"+ escapedFile+ "String_Node_Str"+ line+ "String_Node_Str"+ "String_Node_Str"+ jsniSig+ "String_Node_Str"+ paramNamesArray+ "String_Node_Str"+ js+ "String_Node_Str");
  }
  sb.append("String_Node_Str");
  return sb.toString().toCharArray();
}
Program: 83344
Project: 83344
Buggy source:
public abstract String toString(Element elem);

Fixed version (ground truth):
public native String toString(Element elem);
Program: 83345
Project: 83345
Buggy source:
public void testIsOrHasChild(){
  Element div=DOM.createDiv();
  Element childDiv=DOM.createDiv();
  assertFalse(DOM.isOrHasChild(div,childDiv));
  DOM.appendChild(div,childDiv);
  assertTrue(DOM.isOrHasChild(div,childDiv));
  assertFalse(DOM.isOrHasChild(childDiv,div));
}

Fixed version (ground truth):
/** 
 * Tests that   {@link DOM#isOrHasChild(Element,Element)} works consistentlyacross browsers.
 */
public void testIsOrHasChild(){
  Element div=DOM.createDiv();
  Element childDiv=DOM.createDiv();
  assertFalse(DOM.isOrHasChild(div,childDiv));
  DOM.appendChild(div,childDiv);
  assertTrue(DOM.isOrHasChild(div,childDiv));
  assertFalse(DOM.isOrHasChild(childDiv,div));
}
Program: 83346
Project: 83346
Buggy source:
public void testGetParent(){
  Element element=RootPanel.get().getElement();
  int i=0;
  while (i < 10 && element != null) {
    element=DOM.getParent(element);
    i++;
  }
  if (i == 10) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Tests the ability to do a parent-ward walk in the DOM.
 */
public void testGetParent(){
  Element element=RootPanel.get().getElement();
  int i=0;
  while (i < 10 && element != null) {
    element=DOM.getParent(element);
    i++;
  }
  if (i == 10) {
    fail("String_Node_Str");
  }
}
Program: 83347
Project: 83347
Buggy source:
public void testToString(){
  Button b=new Button("String_Node_Str");
  assertTrue(b.toString().indexOf("String_Node_Str") != -1);
  assertTrue(b.toString().toLowerCase().indexOf("String_Node_Str") != -1);
}

Fixed version (ground truth):
/** 
 * Tests   {@link DOM#toString(Element)} against likely failure points.
 */
public void testToString(){
  Button b=new Button("String_Node_Str");
  assertTrue(b.toString().indexOf("String_Node_Str") != -1);
  assertTrue(b.toString().toLowerCase().indexOf("String_Node_Str") != -1);
  Element image=DOM.createImg();
  String imageUrl="String_Node_Str";
  DOM.setElementProperty(image,"String_Node_Str",imageUrl);
  String imageToString=DOM.toString(image).trim().toLowerCase();
  assertTrue(imageToString.startsWith("String_Node_Str"));
  assertTrue(imageToString.indexOf(imageUrl) != -1);
  Element input=DOM.createInputText();
  DOM.setElementProperty(input,"String_Node_Str","String_Node_Str");
  final String inputToString=DOM.toString(input).trim().toLowerCase();
  assertTrue(inputToString.startsWith("String_Node_Str"));
  Element select=DOM.createSelect();
  for (int i=0; i < 10; i++) {
    final Element option=DOM.createElement("String_Node_Str");
    DOM.appendChild(select,option);
    DOM.setInnerText(option,"String_Node_Str" + i);
  }
  String selectToString=DOM.toString(select).trim().toLowerCase();
  assertTrue(selectToString.startsWith("String_Node_Str"));
  for (int i=0; i < 10; i++) {
    assertTrue(selectToString.indexOf("String_Node_Str" + i) != -1);
  }
  Element meta=DOM.createElement("String_Node_Str");
  DOM.setElementProperty(meta,"String_Node_Str","String_Node_Str");
  String metaToString=DOM.toString(meta).trim().toLowerCase();
  assertTrue(metaToString.startsWith("String_Node_Str"));
}
Program: 83348
Project: 83348
Buggy source:
public void testSetInnerText(){
  Element tableElem=DOM.createTable();
  Element trElem=DOM.createTR();
  Element tdElem=DOM.createTD();
  DOM.setInnerText(tdElem,"String_Node_Str");
  Element emElem=DOM.createElement("String_Node_Str");
  DOM.setInnerText(emElem,"String_Node_Str");
  DOM.appendChild(tdElem,emElem);
  DOM.appendChild(trElem,tdElem);
  DOM.appendChild(tableElem,trElem);
  DOM.appendChild(RootPanel.getBodyElement(),tableElem);
  DOM.setInnerText(tdElem,null);
  assertTrue(getDenormalizedChildCount(tdElem) == 0);
}

Fixed version (ground truth):
/** 
 * Tests that   {@link DOM#setInnerText(Element,String)} works consistentlyacross browsers.
 */
public void testSetInnerText(){
  Element tableElem=DOM.createTable();
  Element trElem=DOM.createTR();
  Element tdElem=DOM.createTD();
  DOM.setInnerText(tdElem,"String_Node_Str");
  Element emElem=DOM.createElement("String_Node_Str");
  DOM.setInnerText(emElem,"String_Node_Str");
  DOM.appendChild(tdElem,emElem);
  DOM.appendChild(trElem,tdElem);
  DOM.appendChild(tableElem,trElem);
  DOM.appendChild(RootPanel.getBodyElement(),tableElem);
  DOM.setInnerText(tdElem,null);
  assertTrue(getDenormalizedChildCount(tdElem) == 0);
}
Program: 83351
Project: 83351
Buggy source:
/** 
 * Validates a string not null and not empty. This method ignores leading and trailing whitespace.
 * @param name the name of the value, used in error messages
 * @param value the string value that needs to be validated
 * @throws IllegalArgumentException if the string is empty, or all whitespace
 * @throws NullPointerException if the string is null
 */
public static void throwIfEmptyOrNull(String name,String value){
  assert(name != null);
  assert(name.trim().length() != 0);
  if (null == value) {
    throw new NullPointerException(name + "String_Node_Str");
  }
  if (0 == value.trim().length()) {
    throw new IllegalArgumentException(name + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Throws if <code>value</code> is <code>null</code> or empty. This method ignores leading and trailing whitespace.
 * @param name the name of the value, used in error messages
 * @param value the string value that needs to be validated
 * @throws IllegalArgumentException if the string is empty, or all whitespace
 * @throws NullPointerException if the string is <code>null</code>
 */
public static void throwIfEmptyOrNull(String name,String value){
  assert(name != null);
  assert(name.trim().length() != 0);
  throwIfNull(name,value);
  if (0 == value.trim().length()) {
    throw new IllegalArgumentException(name + "String_Node_Str");
  }
}