Skip to content

Commit

Permalink
Fix Typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Matsuoka authored and andrewazores committed May 21, 2024
1 parent 4863dd6 commit 1179619
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions src/main/java/io/cryostat/core/templates/RemoteTemplateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,31 +60,31 @@ public Optional<String> getXml(String templateName, TemplateType type)
return Optional.empty();
}
try {
return conn.getService().getServerTemplates().stream()
.map(xmlText -> Jsoup.parse(xmlText, "", Parser.xmlParser()))
.filter(
doc -> {
Elements els = doc.getElementsByTag("configuration");
if (els.isEmpty()) {
throw new MalformedXMLException(
"Document did not contain \"configuration\""
+ " element");
}
if (els.size() > 1) {
throw new MalformedXMLException(
"Document contains multiple \"configuration\""
+ " elements");
}
Element configuration = els.first();
if (!configuration.hasAttr("label")) {
throw new MalformedXMLException(
"Configuration element did not have \"label\""
+ " attribute");
}
return configuration.attr("label").equals(templateName);
})
.map(doc -> document.toString())
.findFirst();
return conn.getService().getServerTemplates().stream()
.map(xmlText -> Jsoup.parse(xmlText, "", Parser.xmlParser()))
.filter(
doc -> {
Elements els = doc.getElementsByTag("configuration");
if (els.isEmpty()) {
throw new MalformedXMLException(
"Document did not contain \"configuration\""
+ " element");
}
if (els.size() > 1) {
throw new MalformedXMLException(
"Document contains multiple \"configuration\""
+ " elements");
}
Element configuration = els.first();
if (!configuration.hasAttr("label")) {
throw new MalformedXMLException(
"Configuration element did not have \"label\""
+ " attribute");
}
return configuration.attr("label").equals(templateName);
})
.map(doc -> doc.toString())
.findFirst();
} catch (org.openjdk.jmc.flightrecorder.configuration.FlightRecorderException
| IOException
| ServiceNotAvailableException e) {
Expand Down

0 comments on commit 1179619

Please sign in to comment.