-
Notifications
You must be signed in to change notification settings - Fork 258
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
Fix LDAPFilter::Match bug #228
Conversation
Fix the bug by taking into account the length of the keys. Fix exception documentation of LDAPFilter::Match function. Add tests to verify the fix. Signed-off-by: The Mathworks Inc <Roy.Lurie@mathworks.com>
Add test to test exception for case variants of same key.
Codecov Report
@@ Coverage Diff @@
## development #228 +/- ##
===============================================
+ Coverage 82.69% 83.46% +0.76%
===============================================
Files 186 186
Lines 13138 13186 +48
===============================================
+ Hits 10865 11006 +141
+ Misses 2273 2180 -93
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OSGi spec for public interface Filter
(Section 10.1.16) only states that matchCase
throws an exception. What's the reason for all the other match
methods throwing?
Addressing Jeff's comment, the reason all the |
alright, closing the loop; I talked to Krish offline and we resolved my confusion on why some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except that minor doc issue.
@@ -130,6 +130,10 @@ class US_Framework_EXPORT LDAPFilter { | |||
* in the match. | |||
* @return <code>true</code> if the bundle's properties match this | |||
* <code>LDAPFilter</code> <code>false</code> otherwise. | |||
* @throws std::runtime_error If the number of keys of the <code>bundle</code> | |||
* exceeds the value returned by std::numeric_limits<int>::max(). | |||
* @throws std::runtime_error If the <code>bundle</code> contains case variants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can never happen, since the Match() function operates on the bundles headers, which is a case insensitive map already.
@@ -130,6 +130,10 @@ class US_Framework_EXPORT LDAPFilter { | |||
* in the match. | |||
* @return <code>true</code> if the bundle's properties match this | |||
* <code>LDAPFilter</code> <code>false</code> otherwise. | |||
* @throws std::runtime_error If the number of keys of the <code>bundle</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the keys are part of the bundle's properties and not the bundle itself.
@@ -130,6 +130,10 @@ class US_Framework_EXPORT LDAPFilter { | |||
* in the match. | |||
* @return <code>true</code> if the bundle's properties match this | |||
* <code>LDAPFilter</code> <code>false</code> otherwise. | |||
* @throws std::runtime_error If the number of keys of the <code>bundle</code> | |||
* exceeds the value returned by std::numeric_limits<int>::max(). | |||
* @throws std::runtime_error If the <code>bundle</code> contains case variants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the keys are part of the bundle's properties and not the bundle itself.
@@ -142,6 +146,10 @@ class US_Framework_EXPORT LDAPFilter { | |||
* in the match. | |||
* @return <code>true</code> if the <code>AnyMap</code>'s values match this | |||
* filter; <code>false</code> otherwise. | |||
* @throws std::runtime_error If the number of keys of the <code>dictionary</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the number of keys of the
dictionary
sounds a little awkward. I'd suggest:
If the number of keys in the
dictionary
@@ -154,6 +162,10 @@ class US_Framework_EXPORT LDAPFilter { | |||
* in the match. | |||
* @return <code>true</code> if the <code>AnyMap</code>'s values match this | |||
* filter; <code>false</code> otherwise. | |||
* @throws std::runtime_error If the number of keys of the <code>dictionary</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest:
If the number of keys in the
dictionary
Amend API documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one other minor thing.
@@ -130,10 +130,8 @@ class US_Framework_EXPORT LDAPFilter { | |||
* in the match. | |||
* @return <code>true</code> if the bundle's properties match this | |||
* <code>LDAPFilter</code> <code>false</code> otherwise. | |||
* @throws std::runtime_error If the number of keys of the <code>bundle</code> | |||
* @throws std::runtime_error If the number of keys of the bundle's properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be careful about the terminology here. It is the bundle's manifest headers that are checked and matched. The return doc above also users the wrong properties term.
Improve API doc based on feedback
* @throws std::runtime_error If the number of keys of the bundle's properties | ||
* exceeds the value returned by std::numeric_limits<int>::max(). | ||
* @throws std::runtime_error If the number of keys of the bundle's manifest | ||
* properties exceeds the value returned by std::numeric_limits<int>::max(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, but elsewhere we really use the term headers (the Match()
implementation really calls bundle.GetHeaders()
) for the manifest data, not properties. properties are accessed via the bundle context and are framework properties. manifest properties now is even more confusing in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues :). The reason I chose the wordings was because the short blurb of this API method says Filter using a bundle's manifest properties
. I'll change as per your feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay. Indeed, we used properties before the introduction of framework properties and the need to differentiate these. So the short blurb should be updated as well. Thanks!
Change API doc per feedback
Addresses #227