Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 18 matching lines...) Expand all
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 package com.google.protobuf; 31 package com.google.protobuf;
32 32
33 import static org.junit.Assert.assertEquals; 33 import static org.junit.Assert.assertEquals;
34 import static org.junit.Assert.assertFalse; 34 import static org.junit.Assert.assertFalse;
35 import static org.junit.Assert.assertTrue; 35 import static org.junit.Assert.assertTrue;
36 import static org.junit.Assert.fail; 36 import static org.junit.Assert.fail;
37 37
38 import com.google.protobuf.DescriptorProtos.DescriptorProto; 38 import com.google.protobuf.DescriptorProtos.DescriptorProto;
39
40 import org.junit.Test;
41 import org.junit.runner.RunWith;
42 import org.junit.runners.JUnit4;
43
39 import java.io.ByteArrayInputStream; 44 import java.io.ByteArrayInputStream;
40 import java.io.ByteArrayOutputStream; 45 import java.io.ByteArrayOutputStream;
41 import java.io.FilterInputStream; 46 import java.io.FilterInputStream;
42 import java.io.IOException; 47 import java.io.IOException;
43 import java.io.InputStream; 48 import java.io.InputStream;
44 import org.junit.Test;
45 import org.junit.runner.RunWith;
46 import org.junit.runners.JUnit4;
47 49
48 /** 50 /**
49 * Tests the exceptions thrown when parsing from a stream. The methods on the {@ link Parser} 51 * Tests the exceptions thrown when parsing from a stream. The methods on the {@ link Parser}
50 * interface are specified to only throw {@link InvalidProtocolBufferException}. But we really want 52 * interface are specified to only throw {@link InvalidProtocolBufferException}. But we really want
51 * to distinguish between invalid protos vs. actual I/O errors (like failures re ading from a 53 * to distinguish between invalid protos vs. actual I/O errors (like failures re ading from a
52 * socket, etc.). So, when we're not using the parser directly, an {@link IOExce ption} should be 54 * socket, etc.). So, when we're not using the parser directly, an {@link IOExce ption} should be
53 * thrown where appropriate, instead of always an {@link InvalidProtocolBufferEx ception}. 55 * thrown where appropriate, instead of always an {@link InvalidProtocolBufferEx ception}.
54 * 56 *
55 * @author jh@squareup.com (Joshua Humphries) 57 * @author jh@squareup.com (Joshua Humphries)
56 */ 58 */
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 264
263 @Override public int read(byte b[], int off, int len) throws IOException { 265 @Override public int read(byte b[], int off, int len) throws IOException {
264 if ((count += len) >= 50) { 266 if ((count += len) >= 50) {
265 throw new IOException("I'm broken!"); 267 throw new IOException("I'm broken!");
266 } 268 }
267 return super.read(b, off, len); 269 return super.read(b, off, len);
268 } 270 }
269 }; 271 };
270 } 272 }
271 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698