Skip to content

Commit

Permalink
[FbConstraintDocument] Support new schema versions (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
pet-mit authored Aug 9, 2024
1 parent d3b1d3f commit a6074d0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public boolean exists(String filename, InputStream inputStream) {
int flowBasedDocumentVersion = flowBasedDocumentVersion(new ByteArrayInputStream(bytes));
String schemaFile = schemaVersion(flowBasedDocumentVersion);

if (!schemaFile.equals("")) {
if (schemaFile != null) {
Source xmlFile = new StreamSource(new ByteArrayInputStream(bytes));
// The following line triggers sonar issue java:S2755 which prevents us from accessing XSD schema files
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); //NOSONAR
Expand Down Expand Up @@ -129,13 +129,13 @@ private int flowBasedDocumentVersion(InputStream inputStream) {
}

private String schemaVersion(int flowBasedDocumentVersion) {
if (flowBasedDocumentVersion >= 17 && flowBasedDocumentVersion <= 20) {
if (flowBasedDocumentVersion >= 17) {
return FLOWBASED_CONSTRAINT_V18_SCHEMA_FILE;
} else if (flowBasedDocumentVersion == 11) {
return FLOWBASED_CONSTRAINT_V11_SCHEMA_FILE;
} else {
LOGGER.debug("Flow-based constraint document with version {} are not handled by the FbConstraintImporter", flowBasedDocumentVersion);
return "";
return null;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<FlowBasedConstraintDocument DtdRelease="4" DtdVersion="0" xmlns="flowbased" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="flowbasedconstraintdocument-18.xsd">
<FlowBasedConstraintDocument DtdRelease="4" DtdVersion="0" xmlns="flowbased" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="flowbasedconstraintdocument-23.xsd">
<DocumentIdentification v="17XTSO-CS------W-20190108-F301v1"/>
<DocumentVersion v="1"/>
<DocumentType v="B06"/>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<FlowBasedConstraintDocument DtdRelease="4" DtdVersion="0" xmlns="flowbased" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="flowbasedconstraintdocument-17.xsd">
<FlowBasedConstraintDocument DtdRelease="4" DtdVersion="0" xmlns="flowbased" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="flowbasedconstraintdocument-1754.xsd">
<DocumentIdentification v="17XTSO-CS------W-20190108-F301v1"/>
<DocumentVersion v="1"/>
<DocumentType v="B06"/>
Expand Down

0 comments on commit a6074d0

Please sign in to comment.