Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lang/csharp/src/apache/main/Schema/ArraySchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public static ArraySchema Create(Schema items, PropertyMap customAttributes = nu
private ArraySchema(Schema items, PropertyMap customAttributes)
: base(Type.Array, customAttributes)
{
if (null == items) throw new ArgumentNullException(nameof(items));
this.ItemSchema = items;
ItemSchema = items ?? throw new ArgumentNullException(nameof(items));
}

/// <summary>
Expand Down
33 changes: 18 additions & 15 deletions lang/csharp/src/apache/main/Schema/Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,7 @@ internal Field ChangePosition(int newPosition)
}

/// <summary>
/// A flag to indicate if reader schema has a field that is missing from writer schema and has a default value
/// This is set in CanRead() which is always be called before deserializing data
/// </summary>

/// <summary>
/// Constructor for the field class
/// Initializes a new instance of the <see cref="Field"/> class.
/// </summary>
/// <param name="schema">schema for the field type</param>
/// <param name="name">name of the field</param>
Expand All @@ -153,21 +148,29 @@ internal Field ChangePosition(int newPosition)
/// <param name="defaultValue">field's default value if it exists</param>
/// <param name="sortorder">sort order of the field</param>
/// <param name="props">dictionary that provides access to custom properties</param>
/// <exception cref="ArgumentNullException">
/// name - name cannot be null.
/// or
/// type - type cannot be null.
/// </exception>
internal Field(Schema schema, string name, IList<string> aliases, int pos, string doc,
JToken defaultValue, SortOrder sortorder, PropertyMap props)
{
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name), "name cannot be null.");
if (null == schema) throw new ArgumentNullException("type", "type cannot be null.");
this.Schema = schema;
this.Name = name;
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name), "name cannot be null.");
}

Schema = schema ?? throw new ArgumentNullException("type", "type cannot be null.");
Name = name;
#pragma warning disable CS0618 // Type or member is obsolete
this.aliases = aliases;
#pragma warning restore CS0618 // Type or member is obsolete
this.Pos = pos;
this.Documentation = doc;
this.DefaultValue = defaultValue;
this.Ordering = sortorder;
this.Props = props;
Pos = pos;
Documentation = doc;
DefaultValue = defaultValue;
Ordering = sortorder;
Props = props;
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions lang/csharp/src/apache/main/Schema/LogicalSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ internal static LogicalSchema NewInstance(JToken jtok, PropertyMap props, Schema

private LogicalSchema(Schema baseSchema, string logicalTypeName, PropertyMap props) : base(Type.Logical, props)
{
if (null == baseSchema) throw new ArgumentNullException(nameof(baseSchema));
BaseSchema = baseSchema;
BaseSchema = baseSchema ?? throw new ArgumentNullException(nameof(baseSchema));
LogicalTypeName = logicalTypeName;
LogicalType = LogicalTypeFactory.Instance.GetFromLogicalSchema(this);
}
Expand Down
3 changes: 1 addition & 2 deletions lang/csharp/src/apache/main/Schema/MapSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ internal static MapSchema NewInstance(JToken jtok, PropertyMap props, SchemaName
private MapSchema(Schema valueSchema, PropertyMap cutsomProperties)
: base(Type.Map, cutsomProperties)
{
if (null == valueSchema) throw new ArgumentNullException(nameof(valueSchema), "valueSchema cannot be null.");
this.ValueSchema = valueSchema;
ValueSchema = valueSchema ?? throw new ArgumentNullException(nameof(valueSchema), "valueSchema cannot be null.");
}

/// <summary>
Expand Down