Program: 91847
Project: 91847
Buggy source:
/** 
 * Creates a new map of authority codes for the specified type.
 * @param connection The connection to the EPSG database.
 * @param table      The table to query.
 * @param type       The type to query.
 * @param factory    The factory originator.
 */
AuthorityCodes(final Connection connection,final TableInfo table,final Class<?> type,final EPSGDataAccess factory) throws SQLException {
  this.factory=factory;
  final StringBuilder buffer=new StringBuilder(100);
  final int columnNameStart=buffer.append("String_Node_Str").length();
  final int columnNameEnd=buffer.append(table.codeColumn).length();
  buffer.append("String_Node_Str").append(table.table);
  boolean hasWhere=false;
  Class<?> tableType=table.type;
  if (table.typeColumn != null) {
    for (int i=0; i < table.subTypes.length; i++) {
      final Class<?> candidate=table.subTypes[i];
      if (candidate.isAssignableFrom(type)) {
        buffer.append("String_Node_Str").append(table.typeColumn).append("String_Node_Str").append(table.typeNames[i]).append("String_Node_Str");
        hasWhere=true;
        tableType=candidate;
        break;
      }
    }
  }
  buffer.append(hasWhere ? "String_Node_Str" : "String_Node_Str");
  final int conditionStart=buffer.length();
  if (table.showColumn != null) {
    buffer.append(table.showColumn).append("String_Node_Str");
  }
  buffer.append("String_Node_Str").append(table.codeColumn);
  sql[ALL]=factory.translator.apply(buffer.toString());
  buffer.setLength(conditionStart);
  if (table.nameColumn != null) {
    buffer.replace(columnNameStart,columnNameEnd,table.nameColumn);
  }
  buffer.append(table.codeColumn).append("String_Node_Str");
  sql[ONE]=factory.translator.apply(buffer.toString());
  this.type=tableType;
  isProjection=Projection.class.isAssignableFrom(tableType);
}

Fixed version (ground truth):
/** 
 * Creates a new map of authority codes for the specified type.
 * @param connection The connection to the EPSG database.
 * @param table      The table to query.
 * @param type       The type to query.
 * @param factory    The factory originator.
 */
AuthorityCodes(final Connection connection,final TableInfo table,final Class<?> type,final EPSGDataAccess factory) throws SQLException {
  this.factory=factory;
  final StringBuilder buffer=new StringBuilder(100);
  final int columnNameStart=buffer.append("String_Node_Str").length();
  final int columnNameEnd=buffer.append(table.codeColumn).length();
  buffer.append("String_Node_Str").append(table.table);
  boolean hasWhere=false;
  Class<?> tableType=table.type;
  if (table.typeColumn != null) {
    for (int i=0; i < table.subTypes.length; i++) {
      final Class<?> candidate=table.subTypes[i];
      if (candidate.isAssignableFrom(type)) {
        buffer.append("String_Node_Str").append(table.typeColumn).append("String_Node_Str").append(TableInfo.ENUM_REPLACEMENT).append("String_Node_Str").append(table.typeNames[i]).append("String_Node_Str");
        hasWhere=true;
        tableType=candidate;
        break;
      }
    }
  }
  buffer.append(hasWhere ? "String_Node_Str" : "String_Node_Str");
  final int conditionStart=buffer.length();
  if (table.showColumn != null) {
    buffer.append(table.showColumn).append("String_Node_Str");
  }
  buffer.append("String_Node_Str").append(table.codeColumn);
  sql[ALL]=factory.translator.apply(buffer.toString());
  buffer.setLength(conditionStart);
  if (table.nameColumn != null) {
    buffer.replace(columnNameStart,columnNameEnd,table.nameColumn);
  }
  buffer.append(table.codeColumn).append("String_Node_Str");
  sql[ONE]=factory.translator.apply(buffer.toString());
  this.type=tableType;
  isProjection=Projection.class.isAssignableFrom(tableType);
}