diff --git a/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java b/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java index 30371cd7..958a9a82 100644 --- a/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java +++ b/src/main/java/io/cryostat/core/templates/RemoteTemplateService.java @@ -33,7 +33,6 @@ import io.cryostat.core.net.JFRConnection; import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; import org.jsoup.select.Elements; @@ -55,7 +54,7 @@ protected TemplateType providedTemplateType() { } @Override - public Optional getXml(String templateName, TemplateType type) + public Optional getXml(String templateName, TemplateType type) throws FlightRecorderException { if (!providedTemplateType().equals(type)) { return Optional.empty(); @@ -68,7 +67,8 @@ public Optional getXml(String templateName, TemplateType type) Elements els = doc.getElementsByTag("configuration"); if (els.isEmpty()) { throw new MalformedXMLException( - "Document did not contain \"configuration\" element"); + "Document did not contain \"configuration\"" + + " element"); } if (els.size() > 1) { throw new MalformedXMLException( @@ -83,6 +83,7 @@ public Optional getXml(String templateName, TemplateType type) } return configuration.attr("label").equals(templateName); }) + .map(doc -> doc.toString()) .findFirst(); } catch (org.openjdk.jmc.flightrecorder.configuration.FlightRecorderException | IOException diff --git a/src/main/java/io/cryostat/core/templates/TemplateService.java b/src/main/java/io/cryostat/core/templates/TemplateService.java index ad039a14..b36d8285 100644 --- a/src/main/java/io/cryostat/core/templates/TemplateService.java +++ b/src/main/java/io/cryostat/core/templates/TemplateService.java @@ -23,18 +23,15 @@ import io.cryostat.core.FlightRecorderException; -import org.jsoup.nodes.Document; - public interface TemplateService { List