jomarko commented on code in PR #6254:
URL:
https://github.com/apache/incubator-kie-drools/pull/6254#discussion_r1958058587
##########
drools-scenario-simulation/drools-scenario-simulation-backend/src/main/java/org/drools/scenariosimulation/backend/util/ScenarioSimulationXMLPersistence.java:
##########
@@ -179,18 +177,17 @@ public String migrateIfNecessary(String rawXml) throws
Exception {
.append(CURRENT_VERSION).toString());
}
migrator = migrator.andThen(getMigrationStrategy().end());
- Document document = DOMParserUtil.getDocument(rawXml);
migrator.accept(document);
return DOMParserUtil.getString(document);
}
- public String extractVersion(String rawXml) {
- Matcher m = p.matcher(rawXml);
-
- if (m.find()) {
- return m.group(1);
+ public String extractVersion(Document document) {
+ try {
+ return
document.getElementsByTagName(SCENARIO_SIMULATION_MODEL_NODE)
+
.item(0).getAttributes().getNamedItem(VERSION_ATTRIBUTE).getTextContent();
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Impossible to extract version
from the file", e);
}
Review Comment:
then, I have nothing to share for this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]