flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [1/4] flink git commit: [hotfix] Refactor to use multi-catch
Date Thu, 11 May 2017 16:43:08 GMT
Repository: flink
Updated Branches:
  refs/heads/master fca8caea7 -> 704098725


[hotfix] Refactor to use multi-catch

This closes #3866


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/70409872
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/70409872
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/70409872

Branch: refs/heads/master
Commit: 7040987258de276ca446a7bcf8b92a2e9437cb17
Parents: 3ee8c69
Author: Rodrigo Bonifacio <rbonifacio123@gmail.com>
Authored: Wed May 10 11:54:44 2017 -0300
Committer: Greg Hogan <code@greghogan.com>
Committed: Thu May 11 12:42:25 2017 -0400

----------------------------------------------------------------------
 .../java/org/apache/flink/api/java/io/AvroOutputFormat.java  | 4 +---
 .../flink/api/java/typeutils/runtime/PojoComparator.java     | 4 +---
 .../runtime/iterative/concurrent/BlockingBackChannel.java    | 4 +---
 .../flink/runtime/operators/hash/CompactingHashTable.java    | 8 ++------
 .../org/apache/flink/runtime/operators/util/TaskConfig.java  | 4 +---
 5 files changed, 6 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/70409872/flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java
----------------------------------------------------------------------
diff --git a/flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java
b/flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java
index 1db45a5..ae90362 100644
--- a/flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java
+++ b/flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java
@@ -125,9 +125,7 @@ public class AvroOutputFormat<E> extends FileOutputFormat<E>
implements Serializ
 			datumWriter = new SpecificDatumWriter<E>(avroValueType);
 			try {
 				schema = ((org.apache.avro.specific.SpecificRecordBase)avroValueType.newInstance()).getSchema();
-			} catch (InstantiationException e) {
-				throw new RuntimeException(e.getMessage());
-			} catch (IllegalAccessException e) {
+			} catch (InstantiationException | IllegalAccessException e) {
 				throw new RuntimeException(e.getMessage());
 			}
 		} else {

http://git-wip-us.apache.org/repos/asf/flink/blob/70409872/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoComparator.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoComparator.java
b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoComparator.java
index 945abc8..a3f4280 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoComparator.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoComparator.java
@@ -131,9 +131,7 @@ public final class PojoComparator<T> extends CompositeTypeComparator<T>
implemen
 		try {
 			this.serializer = (TypeSerializer<T>) InstantiationUtil.deserializeObject(
 					InstantiationUtil.serializeObject(toClone.serializer), Thread.currentThread().getContextClassLoader());
-		} catch (IOException e) {
-			throw new RuntimeException("Cannot copy serializer", e);
-		} catch (ClassNotFoundException e) {
+		} catch (IOException | ClassNotFoundException e) {
 			throw new RuntimeException("Cannot copy serializer", e);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flink/blob/70409872/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/BlockingBackChannel.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/BlockingBackChannel.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/BlockingBackChannel.java
index 8631c99..067bbfe 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/BlockingBackChannel.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/BlockingBackChannel.java
@@ -51,9 +51,7 @@ public class BlockingBackChannel {
 	public DataInputView getReadEndAfterSuperstepEnded() {
 		try {
 			return queue.take().switchBuffers();
-		} catch (InterruptedException e) {
-			throw new RuntimeException(e);
-		} catch (IOException e) {
+		} catch (InterruptedException | IOException e) {
 			throw new RuntimeException(e);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flink/blob/70409872/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java
index eacb02c..67ca342 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java
@@ -451,12 +451,8 @@ public class CompactingHashTable<T> extends AbstractMutableHashTable<T>
{
 						this.compactionMemory.allocateSegments((int)(newPointer >> this.pageSizeInBits));
 					}
 					return newPointer;
-				}
-				catch (EOFException ex) {
-					throw new RuntimeException("Memory ran out. Compaction failed. " +
-							getMemoryConsumptionString() + " Message: " + ex.getMessage());
-				}
-				catch (IndexOutOfBoundsException ex) {
+				} 
+				catch (EOFException | IndexOutOfBoundsException ex) {
 					throw new RuntimeException("Memory ran out. Compaction failed. " +
 							getMemoryConsumptionString() + " Message: " + ex.getMessage());
 				}

http://git-wip-us.apache.org/repos/asf/flink/blob/70409872/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java
index 71c0405..a5decf4 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java
@@ -286,9 +286,7 @@ public class TaskConfig implements Serializable {
 	public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) {
 		try {
 			return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config,
STUB_OBJECT, cl);
-		} catch (ClassNotFoundException e) {
-			throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(),
e);
-		} catch (IOException e) {
+		} catch (ClassNotFoundException | IOException e) {
 			throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(),
e);
 		}
 	}


Mime
View raw message