Program: 44573
Project: 44573
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected JCodeModel generateModel() throws IllegalStateException {
  final JCodeModel codeModel=super.generateModel();
  JFieldVar projectCodeVar=null;
  if (!getProjectCode().isEmpty()) {
    projectCodeVar=getDefinedClass().field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL,String.class,"String_Node_Str");
    projectCodeVar.init(JExpr.lit(getProjectCode()));
  }
  getDefinedClass().constructor(JMod.PROTECTED);
  ClassModelUtil.createReadResolveMethod(getDefinedClass());
  for (  MethodDescriptor methodDesc : methodDescriptor) {
    final JClass returnType=codeModel.ref(methodDesc.returnType());
    final JMethod jMethod=getDefinedClass().method(JMod.PUBLIC | JMod.FINAL,returnType,methodDesc.name());
    jMethod.annotate(Override.class);
    final Message message=methodDesc.message();
    final JMethod msgMethod=addMessageMethod(methodDesc.name(),message.value());
    final JBlock body=jMethod.body();
    final JClass returnField=codeModel.ref(returnType.fullName());
    final JVar result=body.decl(returnField,"String_Node_Str");
    JClass formatter=null;
switch (message.format()) {
case MESSAGE_FORMAT:
      formatter=codeModel.ref(java.text.MessageFormat.class);
    break;
case PRINTF:
  formatter=codeModel.ref(String.class);
break;
}
final JInvocation formatterMethod=formatter.staticInvoke("String_Node_Str");
if (message.id() > Message.NONE && projectCodeVar != null) {
String formatedId=String.format(STRING_ID_FORMAT,message.id());
formatterMethod.arg(projectCodeVar.plus(JExpr.lit(formatedId)).plus(JExpr.invoke(msgMethod)));
}
 else {
formatterMethod.arg(JExpr.invoke(msgMethod));
}
for (MethodDescriptor.MethodParameter param : methodDesc.parameters()) {
final JClass paramType=codeModel.ref(param.fullType());
JVar paramVar=jMethod.param(JMod.FINAL,paramType,param.name());
if (!param.isCause()) {
formatterMethod.arg(paramVar);
}
}
if (codeModel.ref(Throwable.class).isAssignableFrom(returnField)) {
initCause(result,returnField,body,methodDesc,formatterMethod);
}
 else {
result.init(formatterMethod);
}
body._return(result);
}
return codeModel;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected JCodeModel generateModel() throws IllegalStateException {
  final JCodeModel codeModel=super.generateModel();
  JFieldVar projectCodeVar=null;
  if (!getProjectCode().isEmpty()) {
    projectCodeVar=getDefinedClass().field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL,String.class,"String_Node_Str");
    projectCodeVar.init(JExpr.lit(getProjectCode()));
  }
  getDefinedClass().constructor(JMod.PROTECTED);
  ClassModelUtil.createReadResolveMethod(getDefinedClass());
  for (  MethodDescriptor methodDesc : methodDescriptor) {
    final JClass returnType=codeModel.ref(methodDesc.returnType().getReturnTypeAsString());
    final JMethod jMethod=getDefinedClass().method(JMod.PUBLIC | JMod.FINAL,returnType,methodDesc.name());
    jMethod.annotate(Override.class);
    final Message message=methodDesc.message();
    final JMethod msgMethod=addMessageMethod(methodDesc.name(),message.value());
    final JBlock body=jMethod.body();
    final JClass returnField=codeModel.ref(returnType.fullName());
    final JVar result=body.decl(returnField,"String_Node_Str");
    JClass formatter=null;
switch (message.format()) {
case MESSAGE_FORMAT:
      formatter=codeModel.ref(java.text.MessageFormat.class);
    break;
case PRINTF:
  formatter=codeModel.ref(String.class);
break;
}
final JInvocation formatterMethod=formatter.staticInvoke("String_Node_Str");
if (message.id() > Message.NONE && projectCodeVar != null) {
String formatedId=String.format(STRING_ID_FORMAT,message.id());
formatterMethod.arg(projectCodeVar.plus(JExpr.lit(formatedId)).plus(JExpr.invoke(msgMethod)));
}
 else {
formatterMethod.arg(JExpr.invoke(msgMethod));
}
for (MethodDescriptor.MethodParameter param : methodDesc.parameters()) {
final JClass paramType=codeModel.ref(param.fullType());
JVar paramVar=jMethod.param(JMod.FINAL,paramType,param.name());
if (!param.isCause()) {
formatterMethod.arg(paramVar);
}
}
if (methodDesc.returnType().isException()) {
initCause(result,returnField,body,methodDesc,formatterMethod);
}
 else {
result.init(formatterMethod);
}
body._return(result);
}
return codeModel;
}