nus-yam/ex-repair huggingface dataset:
Program: 43287
Project: 43287
Buggy source:
public static ValueAdaptor getAdaptor(Mirror<?> mirror){
  if (mirror.isStringLike())   return Jdbcs.Adaptor.asString;
  if (mirror.isInt())   return Jdbcs.Adaptor.asInteger;
  if (mirror.isBoolean())   return Jdbcs.Adaptor.asBoolean;
  if (mirror.isLong())   return Jdbcs.Adaptor.asLong;
  if (mirror.isEnum())   return Jdbcs.Adaptor.asEnumChar;
  if (mirror.isChar())   return Jdbcs.Adaptor.asChar;
  if (mirror.isOf(Timestamp.class))   return Jdbcs.Adaptor.asTimestamp;
  if (mirror.isByte())   return Jdbcs.Adaptor.asByte;
  if (mirror.isShort())   return Jdbcs.Adaptor.asShort;
  if (mirror.isFloat())   return Jdbcs.Adaptor.asFloat;
  if (mirror.isDouble())   return Jdbcs.Adaptor.asDouble;
  if (mirror.isOf(BigDecimal.class))   return Jdbcs.Adaptor.asBigDecimal;
  if (mirror.isOf(Calendar.class))   return Jdbcs.Adaptor.asCalendar;
  if (mirror.isOf(java.util.Date.class))   return Jdbcs.Adaptor.asDate;
  if (mirror.isOf(java.sql.Date.class))   return Jdbcs.Adaptor.asSqlDate;
  if (mirror.isOf(java.sql.Time.class))   return Jdbcs.Adaptor.asSqlTime;
  if (mirror.isOf(Blob.class))   return new BlobValueAdaptor(conf.getPool());
  if (mirror.isOf(Clob.class))   return new ClobValueAdaptor(conf.getPool());
  return Jdbcs.Adaptor.asString;
}

Fixed version (ground truth):
public static ValueAdaptor getAdaptor(Mirror<?> mirror){
  if (mirror.isStringLike())   return Jdbcs.Adaptor.asString;
  if (mirror.isInt())   return Jdbcs.Adaptor.asInteger;
  if (mirror.isBoolean())   return Jdbcs.Adaptor.asBoolean;
  if (mirror.isLong())   return Jdbcs.Adaptor.asLong;
  if (mirror.isEnum())   return Jdbcs.Adaptor.asEnumChar;
  if (mirror.isChar())   return Jdbcs.Adaptor.asChar;
  if (mirror.isOf(Timestamp.class))   return Jdbcs.Adaptor.asTimestamp;
  if (mirror.isByte())   return Jdbcs.Adaptor.asByte;
  if (mirror.isShort())   return Jdbcs.Adaptor.asShort;
  if (mirror.isFloat())   return Jdbcs.Adaptor.asFloat;
  if (mirror.isDouble())   return Jdbcs.Adaptor.asDouble;
  if (mirror.isOf(BigDecimal.class))   return Jdbcs.Adaptor.asBigDecimal;
  if (mirror.isOf(Calendar.class))   return Jdbcs.Adaptor.asCalendar;
  if (mirror.isOf(java.util.Date.class))   return Jdbcs.Adaptor.asDate;
  if (mirror.isOf(java.sql.Date.class))   return Jdbcs.Adaptor.asSqlDate;
  if (mirror.isOf(java.sql.Time.class))   return Jdbcs.Adaptor.asSqlTime;
  if (mirror.isOf(Blob.class))   return new BlobValueAdaptor(conf.getPool());
  if (mirror.isOf(Clob.class))   return new ClobValueAdaptor(conf.getPool());
  if (mirror.getType().isArray() && mirror.getType().getComponentType() == byte.class) {
    return Jdbcs.Adaptor.asBytes;
  }
  return Jdbcs.Adaptor.asString;
}
Program: 43288
Project: 43288
Buggy source:
public Object get(ResultSet rs,String colName) throws SQLException {
  return rs.getObject(colName);
}

Fixed version (ground truth):
public Object get(ResultSet rs,String colName) throws SQLException {
  return rs.getBytes(colName);
}
Program: 43289
Project: 43289
Buggy source:
/** 
 * 判断两个输入流是否严格相等
 */
public static boolean equals(InputStream sA,InputStream sB) throws IOException {
  int dA;
  while ((dA=sA.read()) != -1) {
    if (dA != sB.read())     return false;
  }
  return sB.read() == -1;
}

Fixed version (ground truth):
/** 
 * 判断两个输入流是否严格相等
 */
public static boolean equals(InputStream sA,InputStream sB) throws IOException {
  int dA;
  while ((dA=sA.read()) != -1) {
    int dB=sB.read();
    if (dA != dB)     return false;
  }
  return sB.read() == -1;
}
Program: 43290
Project: 43290
Buggy source:
public SqlExpressionGroup andNotEquals(String name,Object val){
  return and(eq(name,val).not());
}

Fixed version (ground truth):
public SqlExpressionGroup andNotEquals(String name,Object val){
  if (null == val)   return andNotIsNull(name);
  return and(eq(name,val).not());
}
Program: 43291
Project: 43291
Buggy source:
public SqlExpressionGroup andEquals(String name,Object val){
  return and(eq(name,val));
}

Fixed version (ground truth):
public SqlExpressionGroup andEquals(String name,Object val){
  if (null == val)   return andIsNull(name);
  return and(eq(name,val));
}
Program: 43292
Project: 43292
Buggy source:
public void addComment(Dao dao,Entity<?> en,String commentTable,String commentColumn){
  if (!en.hasTableComment() && !en.hasColumnComment()) {
    return;
  }
  List<Sql> sqls=new ArrayList<Sql>();
  if (en.hasTableComment()) {
    Sql tableCommentSQL=Sqls.create(commentTable);
    tableCommentSQL.vars().set("String_Node_Str",en.getTableName()).set("String_Node_Str",en.getTableComment());
    sqls.add(tableCommentSQL);
  }
  if (en.hasColumnComment()) {
    for (    MappingField mf : en.getMappingFields()) {
      if (mf.hasColumnComment()) {
        Sql columnCommentSQL=Sqls.create(commentColumn);
        columnCommentSQL.vars().set("String_Node_Str",en.getTableName()).set("String_Node_Str",mf.getColumnName()).set("String_Node_Str",mf.getColumnComment());
        sqls.add(columnCommentSQL);
      }
    }
  }
  dao.execute(sqls.toArray(new Sql[sqls.size()]));
}

Fixed version (ground truth):
public void addComment(Dao dao,Entity<?> en,String commentTable,String commentColumn){
  if (!en.hasTableComment() && !en.hasColumnComment()) {
    return;
  }
  List<Sql> sqls=new ArrayList<Sql>();
  if (en.hasTableComment()) {
    Sql tableCommentSQL=Sqls.create(Strings.isBlank(commentTable) ? DEFAULT_COMMENT_TABLE : commentTable);
    tableCommentSQL.vars().set("String_Node_Str",en.getTableName()).set("String_Node_Str",en.getTableComment());
    sqls.add(tableCommentSQL);
  }
  if (en.hasColumnComment()) {
    for (    MappingField mf : en.getMappingFields()) {
      if (mf.hasColumnComment()) {
        Sql columnCommentSQL=Sqls.create(Strings.isBlank(commentColumn) ? DEFAULT_COMMENT_COLUMN : commentColumn);
        columnCommentSQL.vars().set("String_Node_Str",en.getTableName()).set("String_Node_Str",mf.getColumnName()).set("String_Node_Str",mf.getColumnComment());
        sqls.add(columnCommentSQL);
      }
    }
  }
  dao.execute(sqls.toArray(new Sql[sqls.size()]));
}
Program: 43293
Project: 43293
Buggy source:
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isNotNull() || mf.isPk())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.isPk() && en.getPks().size() == 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append(',');
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  if (en.getPks().size() > 1) {
    sb=new StringBuilder();
    sb.append("String_Node_Str").append(en.getTableName()).append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append("String_Node_Str").append(mf.getColumnName());
    }
    sb.append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append(mf.getColumnName()).append("String_Node_Str");
    }
    sb.setCharAt(sb.length() - 1,')');
    dao.execute(Sqls.create(sb.toString()));
  }
  createRelation(dao,en);
  addComment(dao,en,COMMENT_TABLE,COMMENT_COLUMN);
  return true;
}

Fixed version (ground truth):
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isNotNull() || mf.isPk())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.isPk() && en.getPks().size() == 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append(',');
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  if (en.getPks().size() > 1) {
    sb=new StringBuilder();
    sb.append("String_Node_Str").append(en.getTableName()).append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append("String_Node_Str").append(mf.getColumnName());
    }
    sb.append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append(mf.getColumnName()).append("String_Node_Str");
    }
    sb.setCharAt(sb.length() - 1,')');
    dao.execute(Sqls.create(sb.toString()));
  }
  createRelation(dao,en);
  addComment(dao,en);
  return true;
}
Program: 43294
Project: 43294
Buggy source:
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
 else       if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  dao.execute(createIndexs(en).toArray(new Sql[0]));
  createRelation(dao,en);
  addComment(dao,en,COMMENT_TABLE,COMMENT_COLUMN);
  return true;
}

Fixed version (ground truth):
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
 else       if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  dao.execute(createIndexs(en).toArray(new Sql[0]));
  createRelation(dao,en);
  addComment(dao,en);
  return true;
}
Program: 43296
Project: 43296
Buggy source:
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  createRelation(dao,en);
  return true;
}

Fixed version (ground truth):
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  createRelation(dao,en);
  addComment(dao,en,COMMENT_COLUMN);
  return true;
}
Program: 43297
Project: 43297
Buggy source:
public Object[][] getParamMatrix(){
  Object[][] re=new Object[rows.size()][adaptors.length];
  int i=0;
  for (  VarSet row : rows) {
    Object[] cols=re[i++];
    for (    String name : literal.getParamIndexes().names()) {
      Object value=row.get(name);
      int[] is=literal.getParamIndexes().getOrderIndex(name);
      for (      int x : is)       cols[x]=value;
    }
  }
  return re;
}

Fixed version (ground truth):
public Object[][] getParamMatrix(){
  if (rows.size() > 0) {
    VarSet vs=rows.get(rows.size() - 1);
    while (null != vs) {
      if (vs.keys().size() == 0) {
        rows.remove(vs);
        vs=null;
        if (rows.size() > 0)         vs=rows.get(rows.size() - 1);
      }
 else {
        break;
      }
    }
  }
  Object[][] re=new Object[rows.size()][adaptors.length];
  int i=0;
  for (  VarSet row : rows) {
    Object[] cols=re[i++];
    for (    String name : literal.getParamIndexes().names()) {
      Object value=row.get(name);
      int[] is=literal.getParamIndexes().getOrderIndex(name);
      for (      int x : is)       cols[x]=value;
    }
  }
  return re;
}
Program: 43298
Project: 43298
Buggy source:
protected String toStatement(Object[][] mtrx,String sql){
  StringBuilder sb=new StringBuilder();
  String[] ss=sql.split("String_Node_Str");
  int i;
  for (i=0; i < mtrx[0].length; i++) {
    sb.append(ss[i]);
    sb.append(Sqls.formatFieldValue(mtrx[0][i]));
  }
  if (i < ss.length)   sb.append(ss[i]);
  return sb.toString();
}

Fixed version (ground truth):
protected String toStatement(Object[][] mtrx,String sql){
  StringBuilder sb=new StringBuilder();
  String[] ss=sql.split("String_Node_Str");
  int i=0;
  if (mtrx.length > 0) {
    for (; i < mtrx[0].length; i++) {
      sb.append(ss[i]);
      sb.append(Sqls.formatFieldValue(mtrx[0][i]));
    }
  }
  if (i < ss.length)   sb.append(ss[i]);
  return sb.toString();
}
Program: 43299
Project: 43299
Buggy source:
public void render(HttpServletRequest req,HttpServletResponse resp,Object obj) throws Exception {
  String path=evalPath(req,obj);
  if (path.startsWith("String_Node_Str") || path.startsWith("String_Node_Str")) {
  }
 else   if (path.length() > 0 && path.charAt(0) == '/') {
    path=req.getContextPath() + path;
  }
 else {
    String myPath=req.getPathInfo();
    int pos=myPath.lastIndexOf('/');
    if (pos > 0)     path=myPath.substring(0,pos) + "String_Node_Str" + path;
 else     path="String_Node_Str" + path;
  }
  resp.sendRedirect(path);
  resp.flushBuffer();
}

Fixed version (ground truth):
public void render(HttpServletRequest req,HttpServletResponse resp,Object obj) throws Exception {
  String path=evalPath(req,obj);
  if (path.startsWith("String_Node_Str") || path.startsWith("String_Node_Str")) {
  }
 else   if (path.length() > 0 && path.charAt(0) == '/') {
    path=req.getContextPath() + path;
  }
 else {
    String myPath=Mvcs.getRequestPath(req);
    int pos=myPath.lastIndexOf('/');
    if (pos > 0)     path=myPath.substring(0,pos) + "String_Node_Str" + path;
 else     path="String_Node_Str" + path;
  }
  resp.sendRedirect(path);
  resp.flushBuffer();
}
Program: 43300
Project: 43300
Buggy source:
public void render(HttpServletRequest req,HttpServletResponse resp,Object obj) throws Exception {
  String path=evalPath(req,obj);
  if (path.startsWith("String_Node_Str") || path.startsWith("String_Node_Str")) {
  }
 else   if (path.length() > 0 && path.charAt(0) == '/') {
    path=req.getContextPath() + path;
  }
 else {
    String myPath=Mvcs.getRequestPath(req);
    int pos=myPath.lastIndexOf('/');
    if (pos > 0)     path=myPath.substring(0,pos) + "String_Node_Str" + path;
 else     path="String_Node_Str" + path;
  }
  resp.sendRedirect(path);
  resp.flushBuffer();
}

Fixed version (ground truth):
public void render(HttpServletRequest req,HttpServletResponse resp,Object obj) throws Exception {
  String path=evalPath(req,obj);
  if (path.startsWith("String_Node_Str") || path.startsWith("String_Node_Str")) {
  }
 else   if (path.length() > 0 && path.charAt(0) == '/') {
    path=req.getContextPath() + path;
  }
  resp.sendRedirect(path);
  resp.flushBuffer();
}
Program: 43301
Project: 43301
Buggy source:
@SuppressWarnings("String_Node_Str") public Object invoke(Connection conn,ResultSet rs,Pojo pojo) throws SQLException {
  final Each<Object> each=pojo.getContext().attr(Each.class);
  if (null == each)   return null;
  final Entity<?> en=pojo.getEntity();
  ResultSetLooping ing=new ResultSetLooping(){
    protected boolean createObject(    int index,    ResultSet rs,    SqlContext context,    int rowCount){
      Object obj=en.getObject(rs,context.getFieldMatcher());
      try {
        each.invoke(index,obj,rowCount);
      }
 catch (      LoopException e) {
        throw Lang.wrapThrow(e);
      }
      return false;
    }
  }
;
  try {
    ing.doLoop(rs,pojo.getContext());
  }
 catch (  ExitLoop e) {
  }
  return ing.getIndex() + 1;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object invoke(Connection conn,ResultSet rs,Pojo pojo) throws SQLException {
  final Each<Object> each=pojo.getContext().attr(Each.class);
  if (null == each)   return null;
  final Entity<?> en=pojo.getEntity();
  ResultSetLooping ing=new ResultSetLooping(){
    protected boolean createObject(    int index,    ResultSet rs,    SqlContext context,    int rowCount){
      Object obj=en.getObject(rs,context.getFieldMatcher());
      try {
        each.invoke(index,obj,rowCount);
      }
 catch (      LoopException e) {
        throw Lang.wrapThrow(e);
      }
      return false;
    }
  }
;
  try {
    if (each instanceof Loop)     if (!((Loop<?>)each).begin())     return 0;
    ing.doLoop(rs,pojo.getContext());
    if (each instanceof Loop)     ((Loop<?>)each).end();
  }
 catch (  ExitLoop e) {
  }
catch (  LoopException e) {
    throw new SQLException(e.getCause());
  }
  return ing.getIndex() + 1;
}
Program: 43302
Project: 43302
Buggy source:
@SuppressWarnings("String_Node_Str") public Object invoke(Connection conn,ResultSet rs,Pojo pojo) throws SQLException {
  final Each<Object> each=pojo.getContext().attr(Each.class);
  if (null == each)   return null;
  ResultSetLooping ing=new ResultSetLooping(){
    protected boolean createObject(    int index,    ResultSet rs,    SqlContext context,    int rowCount){
      Object obj=Record.create(rs);
      try {
        each.invoke(index,obj,rowCount);
      }
 catch (      LoopException e) {
        throw Lang.wrapThrow(e);
      }
      return false;
    }
  }
;
  try {
    ing.doLoop(rs,pojo.getContext());
  }
 catch (  ExitLoop e) {
  }
  return ing.getIndex() + 1;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object invoke(Connection conn,ResultSet rs,Pojo pojo) throws SQLException {
  final Each<Object> each=pojo.getContext().attr(Each.class);
  if (null == each)   return null;
  ResultSetLooping ing=new ResultSetLooping(){
    protected boolean createObject(    int index,    ResultSet rs,    SqlContext context,    int rowCount){
      Object obj=Record.create(rs);
      try {
        each.invoke(index,obj,rowCount);
      }
 catch (      LoopException e) {
        throw Lang.wrapThrow(e);
      }
      return false;
    }
  }
;
  try {
    if (each instanceof Loop)     if (!((Loop<?>)each).begin())     return 0;
    ing.doLoop(rs,pojo.getContext());
    if (each instanceof Loop)     ((Loop<?>)each).end();
  }
 catch (  ExitLoop e) {
  }
catch (  LoopException e) {
    throw new SQLException(e.getCause());
  }
  return ing.getIndex() + 1;
}
Program: 43304
Project: 43304
Buggy source:
public static Record create(ResultSet rs){
  try {
    Record re=new Record();
    ResultSetMetaData meta=rs.getMetaData();
    int count=meta.getColumnCount();
    for (int i=1; i <= count; i++) {
      String name=meta.getColumnLabel(i);
switch (meta.getColumnType(i)) {
case Types.TIMESTAMP:
{
          re.set(name,re.getTimestamp(name));
          break;
        }
case Types.CLOB:
{
        re.set(name,rs.getString(i));
        break;
      }
default :
    re.set(name,rs.getObject(i));
  break;
}
re.setSqlType(name,meta.getColumnType(i));
}
return re;
}
 catch (SQLException e) {
throw Lang.wrapThrow(e);
}
}

Fixed version (ground truth):
public static Record create(ResultSet rs){
  try {
    Record re=new Record();
    ResultSetMetaData meta=rs.getMetaData();
    int count=meta.getColumnCount();
    for (int i=1; i <= count; i++) {
      String name=meta.getColumnLabel(i);
switch (meta.getColumnType(i)) {
case Types.TIMESTAMP:
{
          re.set(name,rs.getTimestamp(name));
          break;
        }
case Types.CLOB:
{
        re.set(name,rs.getString(i));
        break;
      }
default :
    re.set(name,rs.getObject(i));
  break;
}
re.setSqlType(name,meta.getColumnType(i));
}
return re;
}
 catch (SQLException e) {
throw Lang.wrapThrow(e);
}
}
Program: 43305
Project: 43305
Buggy source:
public AtMap(){
  ats=new HashMap<String,String>();
}

Fixed version (ground truth):
public AtMap(){
  ats=new HashMap<String,String>();
  methods=new HashMap<String,Method>();
}
Program: 43306
Project: 43306
Buggy source:
public AtMap add(String key,String actionPath){
  if (actionPath.endsWith("String_Node_Str"))   actionPath=actionPath.substring(0,actionPath.length() - 2);
  ats.put(Strings.trim(key),Strings.trim(actionPath));
  return this;
}

Fixed version (ground truth):
public void add(String key,String actionPath){
  if (actionPath.endsWith("String_Node_Str"))   actionPath=actionPath.substring(0,actionPath.length() - 2);
  ats.put(Strings.trim(key),Strings.trim(actionPath));
}
Program: 43308
Project: 43308
Buggy source:
public int deleteLinks(Object obj,String regex){
  EntityOperator opt=this._optBy(obj);
  if (null == opt)   return 0;
  opt.entity.visitMany(obj,regex,doDelete(opt));
  opt.entity.visitManyMany(obj,regex,doClearRelationByLinkedField(opt));
  opt.entity.visitManyMany(obj,regex,doDelete(opt));
  opt.entity.visitOne(obj,regex,doDelete(opt));
  return opt.exec().getUpdateCount();
}

Fixed version (ground truth):
public int deleteLinks(Object obj,final String regex){
  if (null == obj)   return 0;
  final int[] re=new int[1];
  Lang.each(obj,new Each<Object>(){
    public void invoke(    int index,    Object ele,    int length) throws ExitLoop, ContinueLoop, LoopException {
      EntityOperator opt=_optBy(ele);
      if (null == opt)       return;
      opt.entity.visitMany(ele,regex,doDelete(opt));
      opt.entity.visitManyMany(ele,regex,doClearRelationByLinkedField(opt));
      opt.entity.visitManyMany(ele,regex,doDelete(opt));
      opt.entity.visitOne(ele,regex,doDelete(opt));
      re[0]+=opt.exec().getUpdateCount();
    }
  }
);
  return re[0];
}
Program: 43309
Project: 43309
Buggy source:
public <T>T clearLinks(T obj,String regex){
  EntityOperator opt=this._optBy(obj);
  if (null == opt)   return null;
  opt.entity.visitMany(obj,regex,doClear(opt));
  opt.entity.visitManyMany(obj,regex,doClearRelationByHostField(opt));
  opt.entity.visitOne(obj,regex,doClear(opt));
  opt.exec();
  return obj;
}

Fixed version (ground truth):
public <T>T clearLinks(T obj,final String regex){
  if (null == obj)   return null;
  Lang.each(obj,new Each<Object>(){
    public void invoke(    int index,    Object ele,    int length) throws ExitLoop, ContinueLoop, LoopException {
      EntityOperator opt=_optBy(ele);
      if (null == opt)       return;
      opt.entity.visitMany(ele,regex,doClear(opt));
      opt.entity.visitManyMany(ele,regex,doClearRelationByHostField(opt));
      opt.entity.visitOne(ele,regex,doClear(opt));
      opt.exec();
    }
  }
);
  return obj;
}
Program: 43310
Project: 43310
Buggy source:
public <T>T updateLinks(T obj,String regex){
  EntityOperator opt=this._optBy(obj);
  if (null == opt)   return null;
  opt.entity.visitOne(obj,regex,doUpdate(opt));
  opt.entity.visitMany(obj,regex,doUpdate(opt));
  opt.entity.visitManyMany(obj,regex,doUpdate(opt));
  opt.exec();
  return obj;
}

Fixed version (ground truth):
public <T>T updateLinks(T obj,final String regex){
  if (null == obj)   return null;
  Lang.each(obj,new Each<Object>(){
    public void invoke(    int index,    Object ele,    int length) throws ExitLoop, ContinueLoop, LoopException {
      EntityOperator opt=_optBy(ele);
      if (null == opt)       return;
      opt.entity.visitOne(ele,regex,doUpdate(opt));
      opt.entity.visitMany(ele,regex,doUpdate(opt));
      opt.entity.visitManyMany(ele,regex,doUpdate(opt));
      opt.exec();
    }
  }
);
  return obj;
}
Program: 43311
Project: 43311
Buggy source:
public <T>T updateWith(T obj,String regex){
  EntityOperator opt=this._optBy(obj);
  if (null == opt)   return null;
  opt.entity.visitOne(obj,regex,doUpdate(opt));
  opt.addUpdate();
  opt.entity.visitMany(obj,regex,doUpdate(opt));
  opt.entity.visitManyMany(obj,regex,doUpdate(opt));
  opt.exec();
  return obj;
}

Fixed version (ground truth):
public <T>T updateWith(T obj,final String regex){
  if (null == obj)   return null;
  Lang.each(obj,new Each<Object>(){
    public void invoke(    int index,    Object ele,    int length) throws ExitLoop, ContinueLoop, LoopException {
      EntityOperator opt=_optBy(ele);
      if (null == opt)       return;
      opt.entity.visitOne(ele,regex,doUpdate(opt));
      opt.addUpdate();
      opt.entity.visitMany(ele,regex,doUpdate(opt));
      opt.entity.visitManyMany(ele,regex,doUpdate(opt));
      opt.exec();
    }
  }
);
  return obj;
}
Program: 43312
Project: 43312
Buggy source:
public <T>T fetchLinks(T obj,String regex){
  EntityOperator opt=this._optBy(obj);
  if (null == opt)   return null;
  opt.entity.visitMany(obj,regex,doFetch(opt));
  opt.entity.visitManyMany(obj,regex,doFetch(opt));
  opt.entity.visitOne(obj,regex,doFetch(opt));
  opt.exec();
  return obj;
}

Fixed version (ground truth):
public <T>T fetchLinks(T obj,final String regex){
  if (null == obj)   return null;
  Lang.each(obj,new Each<Object>(){
    public void invoke(    int index,    Object ele,    int length) throws ExitLoop, ContinueLoop, LoopException {
      EntityOperator opt=_optBy(ele);
      if (null == opt)       return;
      opt.entity.visitMany(ele,regex,doFetch(opt));
      opt.entity.visitManyMany(ele,regex,doFetch(opt));
      opt.entity.visitOne(ele,regex,doFetch(opt));
      opt.exec();
    }
  }
);
  return obj;
}
Program: 43313
Project: 43313
Buggy source:
public int deleteWith(Object obj,String regex){
  EntityOperator opt=this._optBy(obj);
  if (null == opt)   return 0;
  opt.entity.visitMany(obj,regex,doDelete(opt));
  opt.entity.visitManyMany(obj,regex,doClearRelationByLinkedField(opt));
  opt.entity.visitManyMany(obj,regex,doDelete(opt));
  opt.addDeleteSelfOnly();
  opt.entity.visitOne(obj,regex,doDelete(opt));
  return opt.exec().getUpdateCount();
}

Fixed version (ground truth):
public int deleteWith(Object obj,final String regex){
  if (null == obj)   return 0;
  final int[] re=new int[1];
  Lang.each(obj,new Each<Object>(){
    public void invoke(    int index,    Object ele,    int length) throws ExitLoop, ContinueLoop, LoopException {
      EntityOperator opt=_optBy(ele);
      if (null == opt)       return;
      opt.entity.visitMany(ele,regex,doDelete(opt));
      opt.entity.visitManyMany(ele,regex,doClearRelationByLinkedField(opt));
      opt.entity.visitManyMany(ele,regex,doDelete(opt));
      opt.addDeleteSelfOnly();
      opt.entity.visitOne(ele,regex,doDelete(opt));
      re[0]+=opt.exec().getUpdateCount();
    }
  }
);
  return re[0];
}
Program: 43314
Project: 43314
Buggy source:
public static Condition format(String format,Object... args){
  return new SimpleCondition(format,args);
}

Fixed version (ground truth):
public static Condition format(String format,Object... args){
  return Strings.isBlank(format) ? null : new SimpleCondition(format,args);
}
Program: 43315
Project: 43315
Buggy source:
public static Condition wrap(String sql,Object value){
  return new SimpleCondition(new CharSegment(sql).setBy(value));
}

Fixed version (ground truth):
public static Condition wrap(String sql,Object value){
  return Strings.isBlank(sql) ? null : new SimpleCondition(new CharSegment(sql).setBy(value));
}
Program: 43316
Project: 43316
Buggy source:
@Override public Object getValue(Object obj){
  Object value=super.getValue(obj);
  System.out.println("String_Node_Str" + value);
  if (value == null)   return getDefaultValue(obj);
  return value;
}

Fixed version (ground truth):
@Override public Object getValue(Object obj){
  Object value=super.getValue(obj);
  if (value == null)   return getDefaultValue(obj);
  return value;
}
Program: 43317
Project: 43317
Buggy source:
@Test public void fetch_record(){
  Record re=dao.fetch("String_Node_Str",Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str"));
  Pet pet=re.toPojo(Pet.class);
  assertEquals(5,re.getColumnCount());
  assertEquals(4,pet.getId());
  assertEquals("String_Node_Str",pet.getName());
}

Fixed version (ground truth):
@Test public void fetch_record(){
  Record re=dao.fetch("String_Node_Str",Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str"));
  Pet pet=re.toPojo(Pet.class);
  assertEquals(6,re.getColumnCount());
  assertEquals(4,pet.getId());
  assertEquals("String_Node_Str",pet.getName());
}
Program: 43318
Project: 43318
Buggy source:
public int joinParams(Entity<?> en,Object obj,Object[] params,int off){
  List<MappingField> mfs=_mfs(en);
  for (  MappingField mf : mfs)   params[off++]=mf.getValue(obj);
  return off;
}

Fixed version (ground truth):
public int joinParams(Entity<?> en,Object obj,Object[] params,int off){
  List<MappingField> mfs=_mfs(en);
  for (  MappingField mf : mfs) {
    Object v=mf.getValue(obj);
    params[off++]=null == v ? mf.getDefaultValue(obj) : v;
  }
  return off;
}
Program: 43319
Project: 43319
Buggy source:
/** 
 * 获取一个目录下所有的文件。隐藏文件会被忽略。
 * @param dir 目录
 * @param suffix 文件后缀名。如果为 null，则获取全部文件
 * @return 文件数组
 */
public static File[] files(File dir,final String suffix){
  return dir.listFiles(new FileFilter(){
    public boolean accept(    File f){
      return !f.isHidden() && f.isFile() && (null == suffix || f.getName().endsWith(suffix));
    }
  }
);
}

Fixed version (ground truth):
/** 
 * 获取一个目录下所有的文件(不递归，仅仅一层)。隐藏文件会被忽略。
 * @param dir 目录
 * @param suffix 文件后缀名。如果为 null，则获取全部文件
 * @return 文件数组
 */
public static File[] files(File dir,final String suffix){
  return dir.listFiles(new FileFilter(){
    public boolean accept(    File f){
      return !f.isHidden() && f.isFile() && (null == suffix || f.getName().endsWith(suffix));
    }
  }
);
}
Program: 43320
Project: 43320
Buggy source:
@Test public void update_with_null_links(){
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  p.setLeaderName("String_Node_Str");
  dao.updateWith(p,null);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals("String_Node_Str",p.getLeaderName());
}

Fixed version (ground truth):
@Test public void update_with_null_links(){
  pojos.initData();
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  p.setLeaderName("String_Node_Str");
  dao.updateWith(p,null);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals("String_Node_Str",p.getLeaderName());
}
Program: 43321
Project: 43321
Buggy source:
@Test public void test_updateIgnoreNull_by_list(){
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  p.setLeaderName("String_Node_Str");
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  String name=p.getLeaderName();
  assertNotNull(name);
  p.setLeaderName(null);
  int re=dao.updateIgnoreNull(Lang.list(p));
  assertEquals(1,re);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals(name,p.getLeaderName());
  p.setLeaderName(null);
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertNull(p.getLeaderName());
}

Fixed version (ground truth):
@Test public void test_updateIgnoreNull_by_list(){
  pojos.initData();
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  p.setLeaderName("String_Node_Str");
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  String name=p.getLeaderName();
  assertNotNull(name);
  p.setLeaderName(null);
  int re=dao.updateIgnoreNull(Lang.list(p));
  assertEquals(1,re);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals(name,p.getLeaderName());
  p.setLeaderName(null);
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertNull(p.getLeaderName());
}
Program: 43322
Project: 43322
Buggy source:
@Test public void test_updateIgnoreNull(){
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  p.setLeaderName("String_Node_Str");
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  String name=p.getLeaderName();
  assertNotNull(name);
  p.setLeaderName(null);
  int re=dao.updateIgnoreNull(p);
  assertEquals(1,re);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals(name,p.getLeaderName());
  p.setLeaderName(null);
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertNull(p.getLeaderName());
}

Fixed version (ground truth):
@Test public void test_updateIgnoreNull(){
  pojos.initData();
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  p.setLeaderName("String_Node_Str");
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  String name=p.getLeaderName();
  assertNotNull(name);
  p.setLeaderName(null);
  int re=dao.updateIgnoreNull(p);
  assertEquals(1,re);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals(name,p.getLeaderName());
  p.setLeaderName(null);
  dao.update(p);
  p=dao.fetch(Platoon.class,"String_Node_Str");
  assertNull(p.getLeaderName());
}
Program: 43323
Project: 43323
Buggy source:
@Test public void batch_update_relation(){
  dao.updateRelation(Fighter.class,"String_Node_Str",Chain.make("String_Node_Str","String_Node_Str"),Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(13,dao.count("String_Node_Str",Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
@Test public void batch_update_relation(){
  pojos.initData();
  dao.updateRelation(Fighter.class,"String_Node_Str",Chain.make("String_Node_Str","String_Node_Str"),Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(13,dao.count("String_Node_Str",Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str")));
}
Program: 43324
Project: 43324
Buggy source:
@Test public void batch_update_partly(){
  int re=dao.update(Fighter.class,Chain.make("String_Node_Str","String_Node_Str"),Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(1,re);
  int maxId=dao.getMaxId(Fighter.class);
  re=dao.update(Fighter.class,Chain.make("String_Node_Str","String_Node_Str"),Cnd.where("String_Node_Str","String_Node_Str",maxId - 5));
  assertEquals(5,re);
  assertEquals(re,dao.count(Fighter.class,Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
@Test public void batch_update_partly(){
  pojos.initData();
  int re=dao.update(Fighter.class,Chain.make("String_Node_Str","String_Node_Str"),Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(1,re);
  int maxId=dao.getMaxId(Fighter.class);
  re=dao.update(Fighter.class,Chain.make("String_Node_Str","String_Node_Str"),Cnd.where("String_Node_Str","String_Node_Str",maxId - 5));
  assertEquals(5,re);
  assertEquals(re,dao.count(Fighter.class,Cnd.where("String_Node_Str","String_Node_Str","String_Node_Str")));
}
Program: 43325
Project: 43325
Buggy source:
@Test public void fetch_by_name_ignorecase(){
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals("String_Node_Str",p.getName());
}

Fixed version (ground truth):
@Test public void fetch_by_name_ignorecase(){
  pojos.initData();
  Platoon p=dao.fetch(Platoon.class,"String_Node_Str");
  assertEquals("String_Node_Str",p.getName());
}
Program: 43326
Project: 43326
Buggy source:
@Test public void batch_update_all(){
  dao.update(Fighter.class,Chain.make("String_Node_Str",Fighter.TYPE.SU_35.name()),null);
  assertEquals(13,dao.count(Fighter.class,Cnd.where("String_Node_Str","String_Node_Str",Fighter.TYPE.SU_35.name())));
}

Fixed version (ground truth):
@Test public void batch_update_all(){
  pojos.initData();
  dao.update(Fighter.class,Chain.make("String_Node_Str",Fighter.TYPE.SU_35.name()),null);
  assertEquals(13,dao.count(Fighter.class,Cnd.where("String_Node_Str","String_Node_Str",Fighter.TYPE.SU_35.name())));
}
Program: 43327
Project: 43327
Buggy source:
public String getDefaultValue(Object obj){
  if (null == defaultValue)   return null;
  String re;
  if (null == obj)   re=defaultValue.toString();
 else   re=defaultValue.render(new EntityObjectContext(getEntity(),obj)).toString();
  return re.replace("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public String getDefaultValue(Object obj){
  if (null == defaultValue)   return null;
  String re;
  if (null == obj || defaultValue.keyCount() == 0)   re=defaultValue.toString();
 else   re=defaultValue.render(new EntityObjectContext(getEntity(),obj)).toString();
  return re;
}
Program: 43328
Project: 43328
Buggy source:
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isNotNull() || mf.isPk())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(mf.getDefaultValue(null)).append('\'');
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.isPk() && en.getPks().size() == 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append(',');
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  if (en.getPks().size() > 1) {
    sb=new StringBuilder();
    sb.append("String_Node_Str").append(en.getTableName()).append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append("String_Node_Str").append(mf.getColumnName());
    }
    sb.append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append(mf.getColumnName()).append("String_Node_Str");
    }
    sb.setCharAt(sb.length() - 1,')');
    dao.execute(Sqls.create(sb.toString()));
  }
  createRelation(dao,en);
  return true;
}

Fixed version (ground truth):
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isNotNull() || mf.isPk())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.isPk() && en.getPks().size() == 1) {
        sb.append("String_Node_Str");
      }
    }
    sb.append(',');
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  if (en.getPks().size() > 1) {
    sb=new StringBuilder();
    sb.append("String_Node_Str").append(en.getTableName()).append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append("String_Node_Str").append(mf.getColumnName());
    }
    sb.append("String_Node_Str");
    for (    MappingField mf : en.getPks()) {
      sb.append(mf.getColumnName()).append("String_Node_Str");
    }
    sb.setCharAt(sb.length() - 1,')');
    dao.execute(Sqls.create(sb.toString()));
  }
  createRelation(dao,en);
  return true;
}
Program: 43329
Project: 43329
Buggy source:
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
 else       if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(mf.getDefaultValue(null)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  createRelation(dao,en);
  return true;
}

Fixed version (ground truth):
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
 else       if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  dao.execute(Sqls.create(sb.toString()));
  createRelation(dao,en);
  return true;
}
Program: 43330
Project: 43330
Buggy source:
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(mf.getDefaultValue(null)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  if (en.hasMeta(META_ENGINE)) {
    sb.append("String_Node_Str" + en.getMeta(META_ENGINE));
  }
  if (en.hasMeta(META_CHARSET)) {
    sb.append("String_Node_Str" + en.getMeta(META_CHARSET));
  }
 else {
    sb.append("String_Node_Str");
  }
  dao.execute(Sqls.create(sb.toString()));
  createRelation(dao,en);
  return true;
}

Fixed version (ground truth):
public boolean createEntity(Dao dao,Entity<?> en){
  StringBuilder sb=new StringBuilder("String_Node_Str" + en.getTableName() + "String_Node_Str");
  for (  MappingField mf : en.getMappingFields()) {
    sb.append('\n').append(mf.getColumnName());
    sb.append(' ').append(evalFieldType(mf));
    if (mf.isName() && en.getPkType() != PkType.NAME) {
      sb.append("String_Node_Str");
    }
 else {
      if (mf.isUnsigned())       sb.append("String_Node_Str");
      if (mf.isNotNull())       sb.append("String_Node_Str");
      if (mf.isAutoIncreasement())       sb.append("String_Node_Str");
      if (mf.hasDefaultValue())       sb.append("String_Node_Str").append(getDefaultValue(mf)).append('\'');
    }
    sb.append(',');
  }
  List<MappingField> pks=en.getPks();
  if (!pks.isEmpty()) {
    sb.append('\n');
    sb.append("String_Node_Str");
    for (    MappingField pk : pks) {
      sb.append(pk.getColumnName()).append(',');
    }
    sb.setCharAt(sb.length() - 1,')');
    sb.append("String_Node_Str");
  }
  sb.setCharAt(sb.length() - 1,')');
  if (en.hasMeta(META_ENGINE)) {
    sb.append("String_Node_Str" + en.getMeta(META_ENGINE));
  }
  if (en.hasMeta(META_CHARSET)) {
    sb.append("String_Node_Str" + en.getMeta(META_CHARSET));
  }
 else {
    sb.append("String_Node_Str");
  }
  dao.execute(Sqls.create(sb.toString()));
  createRelation(dao,en);
  return true;
}