Program: 65546
Project: 65546
Buggy source:
/** 
 * Build a org.eclipse.persistence.internal.helper.DatabaseType  instance  from an org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType instance.  In the the case of PLSQL Packages, the catalog (package) name can be passed in as well.
 */
@SuppressWarnings("String_Node_Str") protected org.eclipse.persistence.internal.helper.DatabaseType buildDatabaseTypeFromMetadataType(DatabaseType dType,String catalog){
  if (dType instanceof ArgumentType) {
    dType=((ArgumentType)dType).getDataType();
  }
  if (dType.isComposite()) {
    String typeName=dType.getTypeName();
    String compatibleType=dType.getTypeName();
    String javaTypeName=(dType.getTypeName()).toLowerCase();
    if (dType instanceof PLSQLType) {
      if (catalog != null) {
        typeName=(catalog + "String_Node_Str").concat(typeName);
        compatibleType=(catalog + "String_Node_Str").concat(compatibleType);
        javaTypeName=(catalog.toLowerCase() + "String_Node_Str").concat(javaTypeName);
      }
      if (dType instanceof PLSQLRecordType) {
        PLSQLrecord plsqlRec=new PLSQLrecord();
        plsqlRec.setTypeName(typeName);
        plsqlRec.setCompatibleType(compatibleType);
        plsqlRec.setJavaTypeName(javaTypeName);
        for (        FieldType fld : ((PLSQLRecordType)dType).getFields()) {
          if (fld.getDataType() instanceof PrecisionType) {
            PrecisionType precisionType=(PrecisionType)fld.getDataType();
            plsqlRec.addField(fld.getFieldName(),buildDatabaseTypeFromMetadataType(precisionType),(int)precisionType.getPrecision(),(int)precisionType.getScale());
          }
 else           if (fld.getDataType() instanceof SizedType) {
            SizedType sizedType=(SizedType)fld.getDataType();
            plsqlRec.addField(fld.getFieldName(),buildDatabaseTypeFromMetadataType(sizedType),(int)sizedType.getSize());
          }
 else {
            plsqlRec.addField(fld.getFieldName(),buildDatabaseTypeFromMetadataType(fld.getDataType(),catalog));
          }
        }
        return plsqlRec;
      }
      PLSQLCollection plsqlCollection=new PLSQLCollection();
      plsqlCollection.setTypeName(typeName);
      plsqlCollection.setCompatibleType(compatibleType);
      plsqlCollection.setJavaTypeName(javaTypeName + COLLECTION_WRAPPER_SUFFIX);
      plsqlCollection.setNestedType(buildDatabaseTypeFromMetadataType(((PLSQLCollectionType)dType).getNestedType(),catalog));
      return plsqlCollection;
    }
    if (dType instanceof VArrayType) {
      OracleArrayType varray=new OracleArrayType();
      varray.setTypeName(typeName);
      varray.setCompatibleType(compatibleType);
      varray.setJavaTypeName(javaTypeName + COLLECTION_WRAPPER_SUFFIX);
      varray.setNestedType(buildDatabaseTypeFromMetadataType(((VArrayType)dType).getEnclosedType(),null));
      return varray;
    }
    if (dType instanceof ObjectType) {
      OracleObjectType objType=new OracleObjectType();
      objType.setTypeName(typeName);
      objType.setCompatibleType(compatibleType);
      objType.setJavaTypeName(javaTypeName);
      Map<String,org.eclipse.persistence.internal.helper.DatabaseType> fields=objType.getFields();
      ObjectType oType=(ObjectType)dType;
      for (      FieldType field : oType.getFields()) {
        fields.put(field.getFieldName(),buildDatabaseTypeFromMetadataType(field.getDataType()));
      }
      return objType;
    }
    if (dType instanceof ObjectTableType) {
      OracleArrayType tableType=new OracleArrayType();
      tableType.setTypeName(typeName);
      tableType.setCompatibleType(compatibleType);
      tableType.setJavaTypeName(javaTypeName + COLLECTION_WRAPPER_SUFFIX);
      org.eclipse.persistence.internal.helper.DatabaseType nestedType=buildDatabaseTypeFromMetadataType(((ObjectTableType)dType).getEnclosedType(),null);
      Class wrapper=getWrapperClass(nestedType);
      if (wrapper != null) {
        ((ComplexDatabaseType)nestedType).setJavaType(wrapper);
      }
      tableType.setNestedType(nestedType);
      return tableType;
    }
    return null;
  }
 else   if (dType instanceof ScalarDatabaseTypeEnum) {
    if (dType == ScalarDatabaseTypeEnum.BOOLEAN_TYPE) {
      return OraclePLSQLTypes.PLSQLBoolean;
    }
  }
  return JDBCTypes.getDatabaseTypeForCode(org.eclipse.persistence.tools.dbws.Util.getJDBCTypeFromTypeName(dType.getTypeName()));
}

Fixed version (ground truth):
/** 
 * Build a org.eclipse.persistence.internal.helper.DatabaseType  instance  from an org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType instance.  In the the case of PLSQL Packages, the catalog (package) name can be passed in as well.
 */
@SuppressWarnings("String_Node_Str") protected org.eclipse.persistence.internal.helper.DatabaseType buildDatabaseTypeFromMetadataType(DatabaseType dType,String catalog){
  if (dType instanceof ArgumentType) {
    dType=((ArgumentType)dType).getDataType();
  }
  if (dType.isComposite()) {
    String typeName=dType.getTypeName();
    String compatibleType=dType.getTypeName();
    String javaTypeName=(dType.getTypeName()).toLowerCase();
    if (dType instanceof PLSQLType) {
      if (catalog != null) {
        typeName=(catalog + "String_Node_Str").concat(typeName);
        compatibleType=(catalog + "String_Node_Str").concat(compatibleType);
        javaTypeName=(catalog.toLowerCase() + "String_Node_Str").concat(javaTypeName);
      }
      if (dType instanceof PLSQLRecordType) {
        PLSQLrecord plsqlRec=new PLSQLrecord();
        plsqlRec.setTypeName(typeName);
        plsqlRec.setCompatibleType(compatibleType);
        plsqlRec.setJavaTypeName(javaTypeName);
        for (        FieldType fld : ((PLSQLRecordType)dType).getFields()) {
          if (fld.getDataType() instanceof PrecisionType) {
            PrecisionType precisionType=(PrecisionType)fld.getDataType();
            plsqlRec.addField(fld.getFieldName(),buildDatabaseTypeFromMetadataType(precisionType),(int)precisionType.getPrecision(),(int)precisionType.getScale());
          }
 else           if (fld.getDataType() instanceof SizedType) {
            SizedType sizedType=(SizedType)fld.getDataType();
            plsqlRec.addField(fld.getFieldName(),buildDatabaseTypeFromMetadataType(sizedType),(int)sizedType.getSize());
          }
 else {
            plsqlRec.addField(fld.getFieldName(),buildDatabaseTypeFromMetadataType(fld.getDataType(),catalog));
          }
        }
        return plsqlRec;
      }
      PLSQLCollection plsqlCollection=new PLSQLCollection();
      plsqlCollection.setTypeName(typeName);
      plsqlCollection.setCompatibleType(compatibleType);
      plsqlCollection.setJavaTypeName(javaTypeName + COLLECTION_WRAPPER_SUFFIX);
      plsqlCollection.setNestedType(buildDatabaseTypeFromMetadataType(((PLSQLCollectionType)dType).getNestedType(),catalog));
      return plsqlCollection;
    }
    if (dType instanceof VArrayType) {
      OracleArrayType varray=new OracleArrayType();
      varray.setTypeName(typeName);
      varray.setCompatibleType(compatibleType);
      varray.setJavaTypeName(javaTypeName + COLLECTION_WRAPPER_SUFFIX);
      varray.setNestedType(buildDatabaseTypeFromMetadataType(((VArrayType)dType).getEnclosedType(),null));
      return varray;
    }
    if (dType instanceof ObjectType) {
      OracleObjectType objType=new OracleObjectType();
      objType.setTypeName(typeName);
      objType.setCompatibleType(compatibleType);
      objType.setJavaTypeName(javaTypeName);
      Map<String,org.eclipse.persistence.internal.helper.DatabaseType> fields=objType.getFields();
      ObjectType oType=(ObjectType)dType;
      for (      FieldType field : oType.getFields()) {
        fields.put(field.getFieldName(),buildDatabaseTypeFromMetadataType(field.getDataType()));
      }
      return objType;
    }
    if (dType instanceof ObjectTableType) {
      OracleArrayType tableType=new OracleArrayType();
      tableType.setTypeName(typeName);
      tableType.setCompatibleType(compatibleType);
      tableType.setJavaTypeName(javaTypeName + COLLECTION_WRAPPER_SUFFIX);
      org.eclipse.persistence.internal.helper.DatabaseType nestedType=buildDatabaseTypeFromMetadataType(((ObjectTableType)dType).getEnclosedType(),null);
      Class wrapper=getWrapperClass(nestedType);
      if (wrapper != null) {
        ((ComplexDatabaseType)nestedType).setJavaType(wrapper);
      }
      tableType.setNestedType(nestedType);
      return tableType;
    }
    return null;
  }
 else   if (dType instanceof ScalarDatabaseTypeEnum) {
    return OraclePLSQLTypes.getDatabaseTypeForCode(((ScalarDatabaseTypeEnum)dType).getTypeName());
  }
  return JDBCTypes.getDatabaseTypeForCode(org.eclipse.persistence.tools.dbws.Util.getJDBCTypeFromTypeName(dType.getTypeName()));
}