Skip to content

Commit

Permalink
Changing error message based on review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Nov 18, 2024
1 parent d07cd88 commit bc8a475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ private void parseApplication(Document doc, XPathExpression expression) throws X

NodeList nodeList = (NodeList) expression.evaluate(doc, XPathConstants.NODESET);
if(expression.equals(XPATH_SERVER_SPRINGBOOT_APPLICATION) && nodeList.getLength()>1){
throw new PluginExecutionException("Multiple <springBootApplication/> nodes found in Liberty Config server.xml. Please specify only one");
throw new PluginExecutionException("Found multiple springBootApplication elements specified in the server configuration. Only one springBootApplication can be configured per Liberty server.");
}
for (int i = 0; i < nodeList.getLength(); i++) {
String nodeValue = nodeList.item(i).getAttributes().getNamedItem("location").getNodeValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,11 @@ public void testProcessServerXmlWithMultipleSpringBootNodes() throws IOException
File serversResourceDir = SERVERS_RESOURCES_DIR.toFile();
File springBootServerXmlDir = new File(serversResourceDir, "springBootApplicationTest");
File serverXml = new File(springBootServerXmlDir, "invalid_server.xml");
File newServerXml=new File(springBootServerXmlDir, "server.xml");
Files.copy(serverXml.toPath(),newServerXml.toPath(),StandardCopyOption.REPLACE_EXISTING);
File newServerXml = new File(springBootServerXmlDir, "server.xml");
Files.copy(serverXml.toPath(), newServerXml.toPath(), StandardCopyOption.REPLACE_EXISTING);
Map<String, File> libertyDirPropMap = new HashMap<>();
libertyDirPropMap.put(ServerFeatureUtil.SERVER_CONFIG_DIR, springBootServerXmlDir);
assertThrows(PluginExecutionException.class, ()->new ServerConfigDocument(new TestLogger(), null, libertyDirPropMap));
assertThrows("Found multiple springBootApplication elements specified in the server configuration. Only one springBootApplication can be configured per Liberty server.",
PluginExecutionException.class, () -> new ServerConfigDocument(new TestLogger(), null, libertyDirPropMap));
}
}

0 comments on commit bc8a475

Please sign in to comment.