diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-04-07 20:01:13 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-04-08 06:17:17 +0000 |
commit | 23f86f8016972798db4df5468ec8d37fe6e0f7d6 (patch) | |
tree | 2a9db2454fa064166bc8817d0281878aef023df6 /document | |
parent | df714255eb00139ea9685ddab5343eb77e40dda9 (diff) |
no exception from getDataTypeInternal
* instead of throwing, return null from getDataTypeInternal
* move exception throwing to public getDataType
Diffstat (limited to 'document')
-rw-r--r-- | document/src/main/java/com/yahoo/document/DocumentTypeManager.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java index f3646db6a6b..af7c267c8c4 100644 --- a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java +++ b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java @@ -142,7 +142,11 @@ public class DocumentTypeManager { **/ @Deprecated public DataType getDataType(String name) { - return getDataTypeInternal(name); + var type = getDataTypeInternal(name); + if (type == null) { + throw new IllegalArgumentException("No datatype named " + name); + } + return type; } /** @@ -162,7 +166,7 @@ public class DocumentTypeManager { } } if (foundTypes.isEmpty()) { - throw new IllegalArgumentException("No datatype named " + name); + return null; } else if (foundTypes.size() == 1) { return foundTypes.get(0); } else { |