| OLD | NEW |
| 1 #region Copyright notice and license | 1 #region Copyright notice and license |
| 2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
| 3 // Copyright 2008 Google Inc. All rights reserved. | 3 // Copyright 2008 Google Inc. All rights reserved. |
| 4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
| 5 // | 5 // |
| 6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
| 7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
| 8 // met: | 8 // met: |
| 9 // | 9 // |
| 10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 #endregion | 31 #endregion |
| 32 | 32 |
| 33 using System; |
| 33 using System.IO; | 34 using System.IO; |
| 34 | 35 |
| 35 namespace Google.Protobuf | 36 namespace Google.Protobuf |
| 36 { | 37 { |
| 37 /// <summary> | 38 /// <summary> |
| 38 /// Thrown when a protocol message being parsed is invalid in some way, | 39 /// Thrown when a protocol message being parsed is invalid in some way, |
| 39 /// e.g. it contains a malformed varint or a negative byte length. | 40 /// e.g. it contains a malformed varint or a negative byte length. |
| 40 /// </summary> | 41 /// </summary> |
| 41 public sealed class InvalidProtocolBufferException : IOException | 42 public sealed class InvalidProtocolBufferException : IOException |
| 42 { | 43 { |
| 43 internal InvalidProtocolBufferException(string message) | 44 internal InvalidProtocolBufferException(string message) |
| 44 : base(message) | 45 : base(message) |
| 45 { | 46 { |
| 46 } | 47 } |
| 47 | 48 |
| 49 internal InvalidProtocolBufferException(string message, Exception innerE
xception) |
| 50 : base(message, innerException) |
| 51 { |
| 52 } |
| 53 |
| 48 internal static InvalidProtocolBufferException MoreDataAvailable() | 54 internal static InvalidProtocolBufferException MoreDataAvailable() |
| 49 { | 55 { |
| 50 return new InvalidProtocolBufferException( | 56 return new InvalidProtocolBufferException( |
| 51 "Completed reading a message while more data was available in th
e stream."); | 57 "Completed reading a message while more data was available in th
e stream."); |
| 52 } | 58 } |
| 53 | 59 |
| 54 internal static InvalidProtocolBufferException TruncatedMessage() | 60 internal static InvalidProtocolBufferException TruncatedMessage() |
| 55 { | 61 { |
| 56 return new InvalidProtocolBufferException( | 62 return new InvalidProtocolBufferException( |
| 57 "While parsing a protocol message, the input ended unexpectedly
" + | 63 "While parsing a protocol message, the input ended unexpectedly
" + |
| (...skipping 17 matching lines...) Expand all Loading... |
| 75 | 81 |
| 76 /// <summary> | 82 /// <summary> |
| 77 /// Creates an exception for an error condition of an invalid tag being
encountered. | 83 /// Creates an exception for an error condition of an invalid tag being
encountered. |
| 78 /// </summary> | 84 /// </summary> |
| 79 internal static InvalidProtocolBufferException InvalidTag() | 85 internal static InvalidProtocolBufferException InvalidTag() |
| 80 { | 86 { |
| 81 return new InvalidProtocolBufferException( | 87 return new InvalidProtocolBufferException( |
| 82 "Protocol message contained an invalid tag (zero)."); | 88 "Protocol message contained an invalid tag (zero)."); |
| 83 } | 89 } |
| 84 | 90 |
| 91 internal static InvalidProtocolBufferException InvalidBase64(Exception i
nnerException) |
| 92 { |
| 93 return new InvalidProtocolBufferException("Invalid base64 data", inn
erException); |
| 94 } |
| 95 |
| 85 internal static InvalidProtocolBufferException InvalidEndTag() | 96 internal static InvalidProtocolBufferException InvalidEndTag() |
| 86 { | 97 { |
| 87 return new InvalidProtocolBufferException( | 98 return new InvalidProtocolBufferException( |
| 88 "Protocol message end-group tag did not match expected tag."); | 99 "Protocol message end-group tag did not match expected tag."); |
| 89 } | 100 } |
| 90 | 101 |
| 91 internal static InvalidProtocolBufferException RecursionLimitExceeded() | 102 internal static InvalidProtocolBufferException RecursionLimitExceeded() |
| 92 { | 103 { |
| 93 return new InvalidProtocolBufferException( | 104 return new InvalidProtocolBufferException( |
| 94 "Protocol message had too many levels of nesting. May be malici
ous. " + | 105 "Protocol message had too many levels of nesting. May be malici
ous. " + |
| (...skipping 14 matching lines...) Expand all Loading... |
| 109 "Use CodedInputStream.SetSizeLimit() to increase the size limit.
"); | 120 "Use CodedInputStream.SetSizeLimit() to increase the size limit.
"); |
| 110 } | 121 } |
| 111 | 122 |
| 112 internal static InvalidProtocolBufferException InvalidMessageStreamTag() | 123 internal static InvalidProtocolBufferException InvalidMessageStreamTag() |
| 113 { | 124 { |
| 114 return new InvalidProtocolBufferException( | 125 return new InvalidProtocolBufferException( |
| 115 "Stream of protocol messages had invalid tag. Expected tag is le
ngth-delimited field 1."); | 126 "Stream of protocol messages had invalid tag. Expected tag is le
ngth-delimited field 1."); |
| 116 } | 127 } |
| 117 } | 128 } |
| 118 } | 129 } |
| OLD | NEW |