Comments (6)
I updated the tests and just pushed 0.5.1 to Maven with this bug fix.
from rulebook.
@Gersee I haven't forgot about you. I just have to prep for a meeting with a client tomorrow.
So, I will check this out and respond later tomorrow.
from rulebook.
@Gersee you are correct. I checked out your example and there is a situation where the @when condition is not evaluated. I corrected this bug and updated it in the 0.5.1-SNAPSHOT and on the develop branch. I will be doing a patch release to push 0.5.1 to Maven Central this weekend.
from rulebook.
Still Facing The Same issue in 0.11. I am currently using POJO Based Rules and the runner skipped the method marked with @when annotation and Directly Called @then
from rulebook.
_rule.setCondition(Arrays.stream(_pojoRule.getClass().getMethods())
.filter(method -> method.getReturnType() == boolean.class || method.getReturnType() == Boolean.class)
.filter(method ->
Arrays.stream(method.getDeclaredAnnotations()).anyMatch(When.class::isInstance))
.findFirst()
.<Predicate>map(method -> object -> {
try {
return (Boolean) method.invoke(_pojoRule);
} catch (InvocationTargetException | IllegalAccessException ex) {
if (_actionType == RuleChainActionType.ERROR_ON_FAILURE) {
throw new RuleException(ex.getCause() == null ? ex : ex.getCause());
}
LOGGER.error(
"Unable to validate condition due to an exception. It will be evaluated as false", ex);
return false;
}
})
//If the condition still can't be determined, then just hand back one that returns true
.orElse(o -> true));
This code is returning no methods.
from rulebook.
I Used The When Method as a private method, because of that the problem arrived as getMethods()
returns only public method. Is there any reason why getDeclaredMethods()
was not used?
from rulebook.
Related Issues (20)
- rule book runner incorrectly eats exceptions so buggy code is not caught. HOT 2
- Why withDefaultResult is mandatory? HOT 4
- How can i write dynamic rules to execute rather than writing in java program .like rules defined in JSON or Yaml? HOT 4
- Q: Rule as a singleton bean HOT 3
- Add the Supplier function to avoid the passage by reference for the default result HOT 2
- Should I fork? HOT 2
- using codegen to improving performance of rule execution HOT 1
- Rule name is dropping when build Rule withFactType. HOT 1
- How to write Unit Tests for a RuleBean? HOT 1
- Switch CI to GitHub Actions HOT 2
- Deprecated classes/methods and non-compiling examples in README.md HOT 1
- Auditor not set on rules when RuleBookBuilder.create(Class) is used HOT 2
- Futures/CompletionStage/Async HOT 2
- Fact checking before evaluating rules HOT 2
- Rulebook in Spring Boot - stop execution
- Project status HOT 2
- Lambdas stack error
- RuleBuilder doesn't create a Rule with action type RuleChainActionType.ERROR_ON_FAILURE HOT 2
- RuleBookRunner4PojoClasses does not run rules according to the order property
- Would need an update on how frequently this project is developed and actively supported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rulebook.