Skip to content

Commit

Permalink
Make sure that wildcard lookups including a "*" in the Customization ID
Browse files Browse the repository at this point in the history
will always fail
  • Loading branch information
phax committed Aug 7, 2024
1 parent f0ee5f9 commit 45eb691
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ They depend on several other libraries so I suggest you are going for the Maven

# News and noteworthy

* v9.5.1 - work in progress
* Make sure that wildcard lookups including a "*" in the Customization ID will always fail
* v9.5.0 - 2024-07-29
* Updated to dnsjava 3.6 fixing CVE-2024-25638
* Added new submodule `dbnalliance-xhe`. See [#53](https://github.com/phax/peppol-commons/pull/53) - thx @robinsongarciax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ public void forEachMatchingDocumentType (@Nonnull final ICommonsList <? extends

// Iterate all the peppol-doctype-wildcard stuff
String sRemainingCustomizationID = aParts.getCustomizationID ();
if (sRemainingCustomizationID.indexOf (PeppolIdentifierHelper.DOCUMENT_TYPE_WILDCARD_INDICATOR) >= 0)
{
// If a Customization contains a "*" it is invalid - no match
return EContinue.BREAK;
}

IDocumentTypeIdentifier aSelectedDocTypeID = aFuncCheckExistance.apply (PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_PEPPOL_DOCTYPE_WILDCARD,
aFuncCustIDToDocTypeIDValue.apply (sRemainingCustomizationID +
PeppolIdentifierHelper.DOCUMENT_TYPE_WILDCARD_INDICATOR));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ public void testMatchingModesAll ()
aMatches.clear ();
}

{
final PeppolWildcardSelector aSelector = new PeppolWildcardSelector (EMode.WILDCARD_ONLY);
// Customization ID with * will never match
aSelector.forEachMatchingDocumentType (aSupportedDocTypes,
"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:peppol:pint:billing-1@jp-1*::2.1",
aMatcherCount);
assertEquals (0, aMatches.size ());

// Reset
aMatches.clear ();
}

{
final PeppolWildcardSelector aSelector = new PeppolWildcardSelector (EMode.BUSDOX_THEN_WILDCARD);
aSelector.forEachMatchingDocumentType (aSupportedDocTypes,
Expand Down

0 comments on commit 45eb691

Please sign in to comment.