Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FbConstraintDocument] Support new schema versions #1107

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading