Fix internal bug when amount of context exceeds the threshold#152
Fix internal bug when amount of context exceeds the threshold#152
Conversation
- NullContext will take effect - Default context will be cached during initialization Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #152 +/- ##
============================================
- Coverage 49.01% 48.97% -0.05%
Complexity 661 661
============================================
Files 122 122
Lines 4172 4180 +8
Branches 573 574 +1
============================================
+ Hits 2045 2047 +2
- Misses 1879 1883 +4
- Partials 248 250 +2
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #152 +/- ##
============================================
- Coverage 49.01% 48.97% -0.05%
Complexity 661 661
============================================
Files 122 122
Lines 4172 4180 +8
Branches 573 574 +1
============================================
+ Hits 2045 2047 +2
- Misses 1879 1883 +4
- Partials 248 250 +2
Continue to review full report at Codecov.
|
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
fedc9c2 to
5b56ad3
Compare
Codecov Report
@@ Coverage Diff @@
## master #152 +/- ##
============================================
+ Coverage 49.01% 50.05% +1.04%
- Complexity 661 672 +11
============================================
Files 122 122
Lines 4172 4193 +21
Branches 573 575 +2
============================================
+ Hits 2045 2099 +54
+ Misses 1879 1833 -46
- Partials 248 261 +13
Continue to review full report at Codecov.
|
| } | ||
|
|
||
| private static void initDefaultContext() { | ||
| contextNameNodeMap.put(Constants.CONTEXT_DEFAULT_NAME, new EntranceNode( |
There was a problem hiding this comment.
Default Context should be child of ROOT, use Constants.ROOT.addChild(node) to add.
| } | ||
| if (parent == null) { | ||
| // Auto-created entry indicates immediate exit. | ||
| if (parent == null && !(context instanceof NullContext)) { |
There was a problem hiding this comment.
Check NullContext at the beginning of this method, if current context is NullContext, this method should return at once.
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
…a#152) - When amount of context exceeds the threshold, the `NullContext` will be set to current thread local. Thus, when checking context in `CtSph#entry`, once `NullContext` detected, the entry will not do rule checking on the slot chain. - Cache the default context during initialization. Then when amount of context exceeds the threshold, entries under default context can do rule checking under default context. - Enhance the error message Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Describe what this PR does / why we need it
Fix internal bug when amount of context exceeds the threshold.
Does this pull request fix one issue?
Fixes #151
Describe how you did it
NullContextwill be set to current thread local. Thus, when checking context inCtSph#entry, onceNullContextdetected, the entry will not do rule checking on the slot chain.Describe how to verify it
See test cases.