You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2017/07/23 19:25:29 UTC
flink git commit: [FLINK-7225] [core] Fix exception message in
StateDescriptor
Repository: flink
Updated Branches:
refs/heads/master 02850545e -> 3c7560853
[FLINK-7225] [core] Fix exception message in StateDescriptor
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/3c756085
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/3c756085
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/3c756085
Branch: refs/heads/master
Commit: 3c756085375a003c7fbf8d477924f5b17efcb115
Parents: 0285054
Author: Stephan Ewen <se...@apache.org>
Authored: Sun Jul 23 21:17:24 2017 +0200
Committer: Stephan Ewen <se...@apache.org>
Committed: Sun Jul 23 21:18:37 2017 +0200
----------------------------------------------------------------------
.../org/apache/flink/api/common/state/StateDescriptor.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/3c756085/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java b/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java
index 199f8d5..b603c71 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java
@@ -128,7 +128,7 @@ public abstract class StateDescriptor<S extends State, T> implements Serializabl
* @param name The name of the {@code StateDescriptor}.
* @param type The class of the type of values in the state.
* @param defaultValue The default value that will be set when requesting state without setting
- * a value before.
+ * a value before.
*/
protected StateDescriptor(String name, Class<T> type, T defaultValue) {
this.name = requireNonNull(name, "name must not be null");
@@ -137,7 +137,12 @@ public abstract class StateDescriptor<S extends State, T> implements Serializabl
try {
this.typeInfo = TypeExtractor.createTypeInfo(type);
} catch (Exception e) {
- throw new RuntimeException("Cannot create full type information based on the given class. If the type has generics, please", e);
+ throw new RuntimeException(
+ "Could not create the type information for '" + type.getName() + "'. " +
+ "The most common reason is failure to infer the generic type information, due to Java's type erasure. " +
+ "In that case, please pass a 'TypeHint' instead of a class to describe the type. " +
+ "For example, to describe 'Tuple2<String, String>' as a generic type, use " +
+ "'new PravegaDeserializationSchema<>(new TypeHint<Tuple2<String, String>>(){}, serializer);'", e);
}
this.defaultValue = defaultValue;