aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2022-01-13 13:22:27 +0100
committerHarald Musum <musum@yahooinc.com>2022-01-13 13:22:27 +0100
commit381d5a1b55872b34b54d90aa0b83644e1000be45 (patch)
tree8a9247c626c381dee4db14f66fff4900abd6dddd /config-model
parentbfa87fbb5d684aed0d975e939e4d1fabb62bf00d (diff)
Give a more helpful warning when using invalid or misplaced JVM options
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java8
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java10
2 files changed, 12 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
index 986d5a21c70..3bb1a9d2bf7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
@@ -1152,7 +1152,9 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
if (invalidOptions.isEmpty()) return;
- String message = "Invalid JVM options in services.xml: " + String.join(",", invalidOptions);
+ String message = "Invalid or misplaced JVM options in services.xml: " +
+ String.join(",", invalidOptions) + "." +
+ " See https://docs.vespa.ai/en/reference/services-container.html#jvm";
if (failDeploymentWithInvalidJvmOptions)
throw new IllegalArgumentException(message);
else
@@ -1216,7 +1218,9 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
if (options.isEmpty()) return;
Collections.sort(options);
- String message = "Invalid JVM GC options in services.xml: " + String.join(",", options);
+ String message = "Invalid or misplaced JVM GC options in services.xml: " +
+ String.join(",", options) + "." +
+ " See https://docs.vespa.ai/en/reference/services-container.html#jvm";
if (failDeploymentWithInvalidJvmOptions)
throw new IllegalArgumentException(message);
else
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
index a17459ea800..814b2f94e44 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
@@ -181,7 +181,7 @@ public class JvmOptionsTest extends ContainerModelBuilderTestBase {
"-XX:+ParallelGCThreads=8 foo bar");
fail();
} catch (IllegalArgumentException e) {
- assertTrue(e.getMessage().contains("Invalid JVM GC options in services.xml: bar,foo"));
+ assertTrue(e.getMessage().startsWith("Invalid or misplaced JVM GC options in services.xml: bar,foo"));
}
}
@@ -205,8 +205,10 @@ public class JvmOptionsTest extends ContainerModelBuilderTestBase {
assertEquals(Level.WARNING, firstOption.getFirst());
Collections.sort(strings);
- assertEquals("Invalid JVM " + (optionName.equals("gc-options") ? "GC " : "") +
- "options in services.xml: " + String.join(",", strings), firstOption.getSecond());
+ assertEquals("Invalid or misplaced JVM" + (optionName.equals("gc-options") ? " GC" : "") +
+ " options in services.xml: " + String.join(",", strings) + "." +
+ " See https://docs.vespa.ai/en/reference/services-container.html#jvm"
+ , firstOption.getSecond());
}
private void buildModelWithJvmOptions(boolean isHosted, TestLogger logger, String optionName, String override) throws IOException, SAXException {
@@ -267,7 +269,7 @@ public class JvmOptionsTest extends ContainerModelBuilderTestBase {
"-Xms2G foo bar");
fail();
} catch (IllegalArgumentException e) {
- assertTrue(e.getMessage().contains("Invalid JVM options in services.xml: bar,foo"));
+ assertTrue(e.getMessage().contains("Invalid or misplaced JVM options in services.xml: bar,foo"));
}
}