Skip to content

Commit dad51d7

Browse files
authored
Merge branch 'master' into use-session-log
2 parents dda7ccb + 89acf0c commit dad51d7

File tree

30 files changed

+643
-455
lines changed

30 files changed

+643
-455
lines changed

.github/workflows/maven.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
os: [ubuntu-latest, macOS-latest]
16+
os: [ubuntu-latest, macOS-13]
1717
java: [8, 11, 17]
1818
fail-fast: false
1919
max-parallel: 4
@@ -28,7 +28,7 @@ jobs:
2828
java-version: ${{ matrix.java }}
2929
cache: 'maven'
3030
- name: Test with Maven
31-
run: ./mvnw install -B -V -Pminimal-fix-latest -D"java.util.logging.config.file"="./quickfixj-core/src/test/resources/logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"
31+
run: ./mvnw install -B -V -D"maven.javadoc.skip"="true" -P"skipBundlePlugin,minimal-fix-latest" -D"java.util.logging.config.file"="./quickfixj-core/src/test/resources/logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"
3232

3333
test-windows:
3434
runs-on: ${{ matrix.os }}

.mvn/wrapper/maven-wrapper.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
18-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
17+
#
18+
# NOTE: maven version should also be changed in pom.xml
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip
20+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar

pom.xml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,26 @@
7575
<maven.compiler.source>8</maven.compiler.source>
7676
<maven.compiler.target>8</maven.compiler.target>
7777
<mainClass/>
78-
<maven.version>3.8.7</maven.version>
79-
<maven-libs-version>3.9.6</maven-libs-version>
80-
<maven-plugin-api-version>3.9.6</maven-plugin-api-version>
78+
<maven.version>3.9.8</maven.version> <!-- please also change version in .mvn/wrapper/maven-wrapper.properties -->
79+
<maven-libs-version>${maven.version}</maven-libs-version>
80+
<maven-plugin-api-version>${maven.version}</maven-plugin-api-version>
8181
<maven-resources-plugin-version>3.3.1</maven-resources-plugin-version>
8282
<maven-compiler-plugin-version>3.13.0</maven-compiler-plugin-version>
83-
<maven-jar-plugin-version>3.4.0</maven-jar-plugin-version>
84-
<maven-surefire-plugin-version>3.2.5</maven-surefire-plugin-version>
85-
<maven-pmd-plugin-version>3.21.2</maven-pmd-plugin-version>
83+
<maven-jar-plugin-version>3.4.2</maven-jar-plugin-version>
84+
<maven-surefire-plugin-version>3.3.0</maven-surefire-plugin-version>
85+
<maven-pmd-plugin-version>3.23.0</maven-pmd-plugin-version>
8686
<maven-source-plugin-version>3.3.1</maven-source-plugin-version>
87-
<maven-javadoc-plugin-version>3.6.3</maven-javadoc-plugin-version>
88-
<maven-shade-plugin-version>3.5.2</maven-shade-plugin-version>
87+
<maven-javadoc-plugin-version>3.7.0</maven-javadoc-plugin-version>
88+
<maven-shade-plugin-version>3.6.0</maven-shade-plugin-version>
8989
<maven-assembly-plugin-version>3.7.1</maven-assembly-plugin-version>
9090
<maven-bundle-plugin-version>5.1.9</maven-bundle-plugin-version>
91-
<maven-gpg-plugin-version>3.2.3</maven-gpg-plugin-version>
92-
<maven-deploy-plugin-version>3.1.1</maven-deploy-plugin-version>
93-
<nexus-staging-maven-plugin-version>1.6.13</nexus-staging-maven-plugin-version>
94-
<build-helper-maven-plugin-version>3.5.0</build-helper-maven-plugin-version>
91+
<maven-gpg-plugin-version>3.2.4</maven-gpg-plugin-version>
92+
<maven-deploy-plugin-version>3.1.2</maven-deploy-plugin-version>
93+
<nexus-staging-maven-plugin-version>1.7.0</nexus-staging-maven-plugin-version>
94+
<build-helper-maven-plugin-version>3.6.0</build-helper-maven-plugin-version>
9595
<maven-shared-utils.version>3.4.2</maven-shared-utils.version>
9696
<file-management.version>3.0.0</file-management.version>
97-
<maven-plugin-annotations.version>3.12.0</maven-plugin-annotations.version>
97+
<maven-plugin-annotations.version>3.13.1</maven-plugin-annotations.version>
9898
<maven-plugin-testing-harness.version>3.3.0</maven-plugin-testing-harness.version>
9999
<plantuml-maven-plugin-version>1.2</plantuml-maven-plugin-version>
100100
<plantuml-version>8059</plantuml-version>
@@ -229,7 +229,7 @@
229229
<dependency>
230230
<groupId>org.codehaus.plexus</groupId>
231231
<artifactId>plexus-xml</artifactId>
232-
<version>4.0.3</version>
232+
<version>4.0.4</version>
233233
</dependency>
234234
<dependency>
235235
<groupId>com.sleepycat</groupId>
@@ -463,19 +463,19 @@
463463
</plugin>
464464
<plugin>
465465
<artifactId>maven-invoker-plugin</artifactId>
466-
<version>3.6.1</version>
466+
<version>3.7.0</version>
467467
</plugin>
468468
<plugin>
469469
<artifactId>maven-plugin-plugin</artifactId>
470-
<version>3.12.0</version>
470+
<version>3.13.1</version>
471471
</plugin>
472472
<plugin>
473473
<artifactId>maven-install-plugin</artifactId>
474-
<version>3.1.1</version>
474+
<version>3.1.2</version>
475475
</plugin>
476476
<plugin>
477477
<artifactId>maven-clean-plugin</artifactId>
478-
<version>3.3.2</version>
478+
<version>3.4.0</version>
479479
</plugin>
480480
<plugin>
481481
<groupId>org.quickfixj.orchestra</groupId>
@@ -490,7 +490,7 @@
490490
<plugin>
491491
<groupId>org.apache.maven.plugins</groupId>
492492
<artifactId>maven-enforcer-plugin</artifactId>
493-
<version>3.4.1</version>
493+
<version>3.5.0</version>
494494
</plugin>
495495
</plugins>
496496
</pluginManagement>

quickfixj-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
</plugin>
230230
<plugin>
231231
<artifactId>maven-jxr-plugin</artifactId>
232-
<version>3.3.2</version>
232+
<version>3.4.0</version>
233233
</plugin>
234234
</plugins>
235235
</reporting>

quickfixj-base/src/main/java/quickfix/DataDictionary.java

Lines changed: 28 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ private static Supplier<DocumentBuilderFactory> createDocumentBuilderFactorySupp
8888
}
8989

9090
private boolean hasVersion = false;
91-
private boolean checkFieldsOutOfOrder = true;
92-
private boolean checkFieldsHaveValues = true;
93-
private boolean checkUserDefinedFields = true;
94-
private boolean checkUnorderedGroupFields = true;
95-
private boolean allowUnknownMessageFields = false;
9691
private String beginString;
9792
private String fullVersion;
9893
private String majorVersion;
@@ -532,86 +527,6 @@ private boolean isMultipleValueStringField(int field) {
532527
fieldType == FieldType.MULTIPLECHARVALUE;
533528
}
534529

535-
/**
536-
* Controls whether out of order fields are checked.
537-
*
538-
* @param flag true = checked, false = not checked
539-
*/
540-
public void setCheckFieldsOutOfOrder(boolean flag) {
541-
checkFieldsOutOfOrder = flag;
542-
}
543-
544-
public boolean isCheckFieldsOutOfOrder() {
545-
return checkFieldsOutOfOrder;
546-
}
547-
548-
public boolean isCheckUnorderedGroupFields() {
549-
return checkUnorderedGroupFields;
550-
}
551-
552-
public boolean isCheckFieldsHaveValues() {
553-
return checkFieldsHaveValues;
554-
}
555-
556-
public boolean isCheckUserDefinedFields() {
557-
return checkUserDefinedFields;
558-
}
559-
560-
public boolean isAllowUnknownMessageFields() {
561-
return allowUnknownMessageFields;
562-
}
563-
564-
/**
565-
* Controls whether group fields are in the same order
566-
*
567-
* @param flag true = checked, false = not checked
568-
*/
569-
public void setCheckUnorderedGroupFields(boolean flag) {
570-
checkUnorderedGroupFields = flag;
571-
for (Map<Integer, GroupInfo> gm : groups.values()) {
572-
for (GroupInfo gi : gm.values()) {
573-
gi.getDataDictionary().setCheckUnorderedGroupFields(flag);
574-
}
575-
}
576-
}
577-
578-
/**
579-
* Controls whether empty field values are checked.
580-
*
581-
* @param flag true = checked, false = not checked
582-
*/
583-
public void setCheckFieldsHaveValues(boolean flag) {
584-
checkFieldsHaveValues = flag;
585-
for (Map<Integer, GroupInfo> gm : groups.values()) {
586-
for (GroupInfo gi : gm.values()) {
587-
gi.getDataDictionary().setCheckFieldsHaveValues(flag);
588-
}
589-
}
590-
}
591-
592-
/**
593-
* Controls whether user defined fields are checked.
594-
*
595-
* @param flag true = checked, false = not checked
596-
*/
597-
public void setCheckUserDefinedFields(boolean flag) {
598-
checkUserDefinedFields = flag;
599-
for (Map<Integer, GroupInfo> gm : groups.values()) {
600-
for (GroupInfo gi : gm.values()) {
601-
gi.getDataDictionary().setCheckUserDefinedFields(flag);
602-
}
603-
}
604-
}
605-
606-
public void setAllowUnknownMessageFields(boolean allowUnknownFields) {
607-
allowUnknownMessageFields = allowUnknownFields;
608-
for (Map<Integer, GroupInfo> gm : groups.values()) {
609-
for (GroupInfo gi : gm.values()) {
610-
gi.getDataDictionary().setAllowUnknownMessageFields(allowUnknownFields);
611-
}
612-
}
613-
}
614-
615530
private void copyFrom(DataDictionary rhs) {
616531
hasVersion = rhs.hasVersion;
617532
beginString = rhs.beginString;
@@ -632,13 +547,6 @@ private void copyFrom(DataDictionary rhs) {
632547
copyMap(valueNames, rhs.valueNames);
633548
copyGroups(groups, rhs.groups);
634549
copyMap(components, rhs.components);
635-
636-
setCheckFieldsOutOfOrder(rhs.checkFieldsOutOfOrder);
637-
setCheckFieldsHaveValues(rhs.checkFieldsHaveValues);
638-
setCheckUserDefinedFields(rhs.checkUserDefinedFields);
639-
setCheckUnorderedGroupFields(rhs.checkUnorderedGroupFields);
640-
setAllowUnknownMessageFields(rhs.allowUnknownMessageFields);
641-
642550
calculateOrderedFields();
643551
}
644552

@@ -688,34 +596,39 @@ private static <V> void copyCollection(Collection<V> lhs, Collection<V> rhs) {
688596
* Validate a message, including the header and trailer fields.
689597
*
690598
* @param message the message
599+
* @param settings
691600
* @throws IncorrectTagValue if a field value is not valid
692601
* @throws FieldNotFound if a field cannot be found
693602
* @throws IncorrectDataFormat if a field value has a wrong data type
694603
*/
695-
public void validate(Message message) throws IncorrectTagValue, FieldNotFound,
604+
public void validate(Message message, ValidationSettings settings) throws IncorrectTagValue, FieldNotFound,
696605
IncorrectDataFormat {
697-
validate(message, false);
606+
validate(message, false, settings);
698607
}
699608

700609
/**
701610
* Validate the message body, with header and trailer fields being validated conditionally.
702611
*
703612
* @param message the message
704613
* @param bodyOnly whether to validate just the message body, or to validate the header and trailer sections as well.
614+
* @param settings
705615
* @throws IncorrectTagValue if a field value is not valid
706616
* @throws FieldNotFound if a field cannot be found
707617
* @throws IncorrectDataFormat if a field value has a wrong data type
708618
*/
709-
public void validate(Message message, boolean bodyOnly) throws IncorrectTagValue,
619+
public void validate(Message message, boolean bodyOnly, ValidationSettings settings) throws IncorrectTagValue,
710620
FieldNotFound, IncorrectDataFormat {
711-
validate(message, bodyOnly ? null : this, this);
621+
validate(message, bodyOnly ? null : this, this, settings);
712622
}
713623

714624
static void validate(Message message, DataDictionary sessionDataDictionary,
715-
DataDictionary applicationDataDictionary) throws IncorrectTagValue, FieldNotFound,
625+
DataDictionary applicationDataDictionary, ValidationSettings settings) throws IncorrectTagValue, FieldNotFound,
716626
IncorrectDataFormat {
717627
final boolean bodyOnly = sessionDataDictionary == null;
718-
628+
if (settings == null) {
629+
settings = new ValidationSettings();
630+
}
631+
719632
if (isVersionSpecified(sessionDataDictionary)
720633
&& !sessionDataDictionary.getVersion().equals(
721634
message.getHeader().getString(BeginString.FIELD))
@@ -737,38 +650,38 @@ static void validate(Message message, DataDictionary sessionDataDictionary,
737650
}
738651

739652
if (!bodyOnly) {
740-
sessionDataDictionary.iterate(message.getHeader(), HEADER_ID, sessionDataDictionary);
741-
sessionDataDictionary.iterate(message.getTrailer(), TRAILER_ID, sessionDataDictionary);
653+
sessionDataDictionary.iterate(settings, message.getHeader(), HEADER_ID, sessionDataDictionary);
654+
sessionDataDictionary.iterate(settings, message.getTrailer(), TRAILER_ID, sessionDataDictionary);
742655
}
743656

744-
applicationDataDictionary.iterate(message, msgType, applicationDataDictionary);
657+
applicationDataDictionary.iterate(settings, message, msgType, applicationDataDictionary);
745658
}
746659

747660
private static boolean isVersionSpecified(DataDictionary dd) {
748661
return dd != null && dd.hasVersion;
749662
}
750663

751-
private void iterate(FieldMap map, String msgType, DataDictionary dd) throws IncorrectTagValue,
664+
private void iterate(ValidationSettings settings, FieldMap map, String msgType, DataDictionary dd) throws IncorrectTagValue,
752665
IncorrectDataFormat {
753666
for (final Field<?> f : map) {
754667
final StringField field = (StringField) f;
755668

756-
checkHasValue(field);
669+
checkHasValue(settings, field);
757670

758671
if (hasVersion) {
759-
checkValidFormat(field);
672+
checkValidFormat(settings, field);
760673
checkValue(field);
761674
}
762675

763676
if (beginString != null) {
764-
dd.checkField(field, msgType, map instanceof Message);
677+
dd.checkField(settings, field, msgType, map instanceof Message);
765678
dd.checkGroupCount(field, map, msgType);
766679
}
767680
}
768681

769682
for (final List<Group> groups : map.getGroups().values()) {
770683
for (final Group group : groups) {
771-
iterate(group, msgType, dd.getGroup(msgType, group.getFieldTag())
684+
iterate(settings, group, msgType, dd.getGroup(msgType, group.getFieldTag())
772685
.getDataDictionary());
773686
}
774687
}
@@ -789,10 +702,10 @@ void checkValidTagNumber(Field<?> field) {
789702
}
790703

791704
/** Check if field tag is defined for message or group **/
792-
void checkField(Field<?> field, String msgType, boolean message) {
705+
void checkField(ValidationSettings settings, Field<?> field, String msgType, boolean message) {
793706
// use different validation for groups and messages
794707
boolean messageField = message ? isMsgField(msgType, field.getField()) : fields.contains(field.getField());
795-
boolean fail = checkFieldFailure(field.getField(), messageField);
708+
boolean fail = checkFieldFailure(settings, field.getField(), messageField);
796709

797710
if (fail) {
798711
if (fields.contains(field.getField())) {
@@ -803,22 +716,22 @@ void checkField(Field<?> field, String msgType, boolean message) {
803716
}
804717
}
805718

806-
boolean checkFieldFailure(int field, boolean messageField) {
719+
boolean checkFieldFailure(ValidationSettings settings, int field, boolean messageField) {
807720
boolean fail;
808721
if (field < USER_DEFINED_TAG_MIN) {
809-
fail = !messageField && !allowUnknownMessageFields;
722+
fail = !messageField && !settings.allowUnknownMessageFields;
810723
} else {
811-
fail = !messageField && checkUserDefinedFields;
724+
fail = !messageField && settings.checkUserDefinedFields;
812725
}
813726
return fail;
814727
}
815728

816-
private void checkValidFormat(StringField field) throws IncorrectDataFormat {
729+
private void checkValidFormat(ValidationSettings settings, StringField field) throws IncorrectDataFormat {
817730
FieldType fieldType = getFieldType(field.getTag());
818731
if (fieldType == null) {
819732
return;
820733
}
821-
if (!checkFieldsHaveValues && field.getValue().length() == 0) {
734+
if (!settings.checkFieldsHaveValues && field.getValue().length() == 0) {
822735
return;
823736
}
824737
try {
@@ -883,8 +796,8 @@ private void checkValue(StringField field) throws IncorrectTagValue {
883796
}
884797

885798
/** Check if a field has a value. **/
886-
private void checkHasValue(StringField field) {
887-
if (checkFieldsHaveValues && field.getValue().length() == 0) {
799+
private void checkHasValue(ValidationSettings settings, StringField field) {
800+
if (settings.checkFieldsHaveValues && field.getValue().length() == 0) {
888801
throw new FieldException(SessionRejectReason.TAG_SPECIFIED_WITHOUT_A_VALUE,
889802
field.getField());
890803
}

0 commit comments

Comments
 (0)