summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java26
1 files changed, 2 insertions, 24 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java
index df3cd4103d9..92c9eccf2d3 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java
@@ -112,9 +112,8 @@ public class ConstantTensorJsonValidator {
consumeTopObject();
return;
} else if (isScalar()) {
- if (top == JsonToken.VALUE_NUMBER_FLOAT || top == JsonToken.VALUE_NUMBER_INT) {
- return;
- }
+ throw new InvalidConstantTensorException(
+ parser, String.format("Invalid type %s: Only tensors with dimensions can be stored as file constants", tensorType.toString()));
}
throw new InvalidConstantTensorException(
parser, String.format("Unexpected first token '%s' for constant with type %s",
@@ -315,14 +314,6 @@ public class ConstantTensorJsonValidator {
}
}
- private void assertFieldNameIs(String wantedFieldName) throws IOException {
- String actualFieldName = parser.getCurrentName();
-
- if (!actualFieldName.equals(wantedFieldName)) {
- throw new InvalidConstantTensorException(parser, String.format("Expected field name '%s', got '%s'", wantedFieldName, actualFieldName));
- }
- }
-
static class InvalidConstantTensorException extends IllegalArgumentException {
InvalidConstantTensorException(JsonParser parser, String message) {
@@ -338,19 +329,6 @@ public class ConstantTensorJsonValidator {
}
}
- @FunctionalInterface
- private interface SubroutineThrowingIOException {
- void invoke() throws IOException;
- }
-
- private void wrapIOException(SubroutineThrowingIOException lambda) {
- try {
- lambda.invoke();
- } catch (IOException e) {
- throw new InvalidConstantTensorException(parser, e);
- }
- }
-
private void consumeValuesNesting(int level) throws IOException {
assertCurrentTokenIs(JsonToken.START_ARRAY);
if (level >= denseDims.size()) {