Skip to content
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
8 changes: 5 additions & 3 deletions recog/src/main/java/com/rapid7/recog/RecogMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.io.Serializable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
Expand Down Expand Up @@ -114,9 +116,9 @@ public RecogMatcher(Pattern pattern) {
public RecogMatcher(RecogPatternMatcher matcher) {
this.matcher = matcher;
values = new HashMap<>();
positionalParameters = new HashMap<>();
positionalParameters = new LinkedHashMap<>();
namedParameters = new HashSet<>();
examples = new HashSet<>();
examples = new LinkedHashSet<>();
}

/**
Expand Down Expand Up @@ -259,7 +261,7 @@ public void verifyExamples(BiConsumer<VerifyStatus, String> consumer) {
}

private void verifyExamplesHaveCaptureGroups(BiConsumer<VerifyStatus, String> consumer) {
Map<String, Boolean> captureGroupUsed = new HashMap<>();
Map<String, Boolean> captureGroupUsed = new LinkedHashMap<>();
// get a list of parameters that are defined by capture groups
for (Entry<String, Integer> parameter : positionalParameters.entrySet()) {
if (parameter.getValue() > 0 && !parameter.getKey().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public RecogMatchers parse(Reader reader, String path, String name)
// description (optional)
NodeList description = fingerprint.getElementsByTagName("description");
if (description.getLength() > 0)
fingerprintPattern.setDescription(description.item(0).getTextContent());
fingerprintPattern.setDescription(description.item(0).getTextContent().replaceAll("\\s+", " ").trim());

// example (optional)
NodeList examples = fingerprint.getElementsByTagName("example");
Expand Down