-Added CheckAdditionalContent to JsonSerializer/JsonSerializerSettings

-Fixed bad JSON in an array with error handling creating an infinite loop
-JsonTextReader no longer returns no content after consecutive underlying content read failures
This commit is contained in:
James Newton-King
2012-05-17 15:27:26 +12:00
parent e47a0eab58
commit bdc73900b5
12 changed files with 182 additions and 79 deletions
+9 -4
View File
@@ -112,6 +112,7 @@ namespace Newtonsoft.Json
private int? _maxDepth;
private bool _hasExceededMaxDepth;
internal DateParseHandling _dateParseHandling;
private readonly List<JsonPosition> _stack;
/// <summary>
/// Gets the current reader state.
@@ -122,8 +123,6 @@ namespace Newtonsoft.Json
get { return _currentState; }
}
private readonly List<JsonPosition> _stack;
/// <summary>
/// Gets or sets a value indicating whether the underlying stream or
/// <see cref="TextReader"/> should be closed when the reader is closed.
@@ -239,6 +238,14 @@ namespace Newtonsoft.Json
set { _culture = value; }
}
internal JsonPosition GetPosition(int depth)
{
if (depth < _stack.Count)
return _stack[depth];
return _currentPosition;
}
/// <summary>
/// Initializes a new instance of the <see cref="JsonReader"/> class with the specified <see cref="TextReader"/>.
/// </summary>
@@ -705,8 +712,6 @@ namespace Newtonsoft.Json
/// <param name="value">The value.</param>
protected void SetToken(JsonToken newToken, object value)
{
JsonToken previousToken = _tokenType;
_tokenType = newToken;
_value = value;