You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/11/19 13:01:41 UTC

[GitHub] pnowojski commented on a change in pull request #6705: [FLINK-10356][network] add sanity checks to SpillingAdaptiveSpanningRecordDeserializer

pnowojski commented on a change in pull request #6705: [FLINK-10356][network] add sanity checks to SpillingAdaptiveSpanningRecordDeserializer
URL: https://github.com/apache/flink/pull/6705#discussion_r234603127
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpillingAdaptiveSpanningRecordDeserializer.java
 ##########
 @@ -649,4 +713,23 @@ private static String randomString(Random random) {
 			return StringUtils.byteToHexString(bytes);
 		}
 	}
+
+	private static void throwDeserializationError(
+			int len,
+			int remainingBytes,
+			int leftOverDataStart,
+			int leftOverDataLimit,
+			@Nullable Throwable cause) throws IOException {
 
 Review comment:
   `@Nullable` here still has the exact same problems like everywhere else in our code base - it doesn't protect from anything. I would still insist on either:
   1. `Optional<Throwable> cause` and alter in the `format` to call `cause.orElse(null)`, or restructure the body into something like:
   ```
   IOException exception = new IOException(...);
   cause.map(exception.initCause);
   throw exception;
   ```
   2. overloading the `throwDeserializationError()` with and without `Throwable cause`
   3. rewriting `throwDeserializationError` into `private static IOException constructDeserializationError(len, remainingBytes, leftOverDataStart, leftOverDataLimit)` and again throw it directly or append the cause by using `Throwable#initCause()`.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services