[JBoss JIRA] Created: (JBRULES-1001) NullPointerException when a function is used inside a predicate expression
by Edgardo Carena (JIRA)
NullPointerException when a function is used inside a predicate expression
---------------------------------------------------------------------------
Key: JBRULES-1001
URL: http://jira.jboss.com/jira/browse/JBRULES-1001
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.MR3
Reporter: Edgardo Carena
Assigned To: Mark Proctor
Priority: Minor
if you change the FibonacciExample like this:
(...)
import java.lang.Math;
function boolean approxEqual(double val1, double val2) {
return (Math.abs(val1-val2)<0.01);
}
(....)
rule Calculate
when
f1 : Fibonacci( s1 : sequence, value != -1 )
f2 : Fibonacci( s2 : sequence -> (approxEqual(sequence,(s1 + 1))), value != -1 )
f3 : Fibonacci( sequence == (s2 + 1 ), value == -1 )
then
f3.setValue( f1.getValue() + f2.getValue() );
update( f3 );
retract( f1 );
System.out.println( f3.getSequence() + " == " + f3.getValue() );
end
thus introducing a function inside a predicate expression, the example works well, however a NullPointerException is printed out during the call of the addPackageFromDrl method.
I tried in many examples, also calling directly the java.lang.Math.abs function, and the message is always printed with no apparent side effect.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years
[JBoss JIRA] Created: (JBRULES-1004) Using JDK dynamic proxies without packages crashes drools
by Chris West (JIRA)
Using JDK dynamic proxies without packages crashes drools
---------------------------------------------------------
Key: JBRULES-1004
URL: http://jira.jboss.com/jira/browse/JBRULES-1004
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.MR3
Reporter: Chris West
Assigned To: Mark Proctor
Attachments: test.zip
Hello,
I'm trying to use objects that are generated as dynamic proxies (through the java.lang.reflect.Proxy class) as facts in JBoss Rules 4.0 MR3. My project was using CGLib to generate proxies, and they were working just fine in 3.0.6. However, when I tried 4.0, the CGLib based proxies seemed to have a final method that kept the proxies from being proxied as shadow facts. So I rewrote my code to try to use JDK based proxies, and version 4.0 MR3 accepts them and apparently creates shadow facts, but now my rules don't fire correctly.
So, in an attempt to create a simple program to illustrate the problem, I ran into a different problem. The attached eclipse project illustrates this problem.
The error is:
java.lang.NullPointerException
at org.drools.reteoo.Rete$ObjectTypeConf.<init>(Rete.java:333)
at org.drools.reteoo.Rete.assertObject(Rete.java:152)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772)
at org.drools.common.AbstractWorkingMemory.insert (AbstractWorkingMemory.java:584)
at com.sample.DroolsTest.main(DroolsTest.java:42)
My proxy had no package, since the jdk based proxy is only in a package if it has at least 1 non public interface, according to the javadoc.
The suspect code beginning on line 333 is:
String pkgName = cls.getPackage().getName();
if ( "org.drools.reteoo".equals( pkgName ) || "org.drools.base".equals( pkgName ) ) {
// We don't shadow internal classes
this.shadowEnabled = false;
return;
}
The getPackage() method returns null. In this case, it would be good if JBoss Rules handled the null and went on to shadow the object anyway, since it is obviously not in the org.drools packages.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years
[JBoss JIRA] Created: (JBRULES-1003) NullPointerException being thrown while removing a package from RuleBase
by Sarika Khamitkar (JIRA)
NullPointerException being thrown while removing a package from RuleBase
------------------------------------------------------------------------
Key: JBRULES-1003
URL: http://jira.jboss.com/jira/browse/JBRULES-1003
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Reteoo
Affects Versions: 4.0.0.MR3
Environment: Windows XP
Reporter: Sarika Khamitkar
Assigned To: Mark Proctor
I get the following exception while removing a rule package from the RuleBase.
java.lang.NullPointerException
at org.drools.reteoo.CompositeObjectSinkAdapter.removeObjectSink(CompositeObjectSinkAdapter.java:125)
at org.drools.reteoo.ObjectSource.removeObjectSink(ObjectSource.java:123)
at org.drools.reteoo.ObjectTypeNode.removeObjectSink(ObjectTypeNode.java:297)
at org.drools.reteoo.ObjectTypeNode.remove(ObjectTypeNode.java:232)
at org.drools.reteoo.AlphaNode.remove(AlphaNode.java:187)
at org.drools.reteoo.AlphaNode.remove(AlphaNode.java:187)
at org.drools.reteoo.BetaNode.remove(BetaNode.java:185)
at org.drools.reteoo.BetaNode.remove(BetaNode.java:187)
at org.drools.reteoo.RuleTerminalNode.remove(RuleTerminalNode.java:439)
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:135)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:259)
at org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:408)
....
----------------------------------
A sample of the drl files:
package rule2392016206
import com.servlets.Record;
import com.servlets.Field;
import com.servlets.rules.RulesTrigger;
rule "Property damage"
when
rulesTrigger: RulesTrigger(clientID == 123, triggerType == 2)
record: Record(coreTypeIDList contains "123")
(Field (ID == 123, dateValue >= "04-Jul-2000") and Field (ID == 456, fieldValue > 10) )
then
rulesTrigger.sendEmail(2392016206L, record);
end
--------------------------
The NullPointerException occurs when I execute the following code.
ruleBase.removePackage("rule2392016206");
Before removing the package, I am iterating through all the packages in the ruleBase and I can see this package name in the list. One more thing I noticed was that if the number of packages in the ruleBase is lesss than 4, then the exception is not thrown.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years
[JBoss JIRA] Created: (JBRULES-997) PackageBuilderConfiguration line 156 swallows exception cause
by Alexandre Gattiker (JIRA)
PackageBuilderConfiguration line 156 swallows exception cause
-------------------------------------------------------------
Key: JBRULES-997
URL: http://jira.jboss.com/jira/browse/JBRULES-997
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.MR3
Reporter: Alexandre Gattiker
Assigned To: Mark Proctor
PackageBuilderConfiguration line 156:
is:
throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + "'" );
should be:
throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + "'" , e);
Symptom:
When a required library is missing (such as mvel), an Exception "java.lang.RuntimeException: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialect:java'" is thrown. With the fix, it will say "Caused by: java.lang.NoClassDefFoundError: org/mvel/integration/VariableResolverFactory..."
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years
[JBoss JIRA] Created: (JBRULES-984) NullPointerException on conditions using contains evaluator when collection is null
by Emily Harsh (JIRA)
NullPointerException on conditions using contains evaluator when collection is null
-----------------------------------------------------------------------------------
Key: JBRULES-984
URL: http://jira.jboss.com/jira/browse/JBRULES-984
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.MR3
Reporter: Emily Harsh
Assigned To: Mark Proctor
Rule condition is as follows:
myItem : MyItem( )
MyObject( myCollection contains myItem )
A NullPointerException is thrown when myCollection is null.
Proposed solution:
All evaluate* methods in org.drools.base.evaluators.ObjectFactory$ObjectContainsEvaluator need to have null checks surrounding the col.contains( value ) statements. For example, evaluateCachedLeft should be changed to:
public boolean evaluateCachedLeft(final VariableContextEntry context,
final Object right) {
final Object value = ((ObjectVariableContextEntry) context).left;
final Collection col = (Collection) context.extractor.getValue( right );
return col == null ? false : col.contains( value );
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years
[JBoss JIRA] Created: (JBRULES-1006) NullPointerException when using "from collect"
by Brian Stiles (JIRA)
NullPointerException when using "from collect"
----------------------------------------------
Key: JBRULES-1006
URL: http://jira.jboss.com/jira/browse/JBRULES-1006
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Reporter: Brian Stiles
Assigned To: Mark Proctor
It seems that using more than one rule with "from collect"--or possibly "from collect ( Foo() from someCall() )--causes Declaration.getPattern().getOffset() to be incorrect, resulting in a NullPointerException in ReteTuple.get(int). This should be more clear after running the included code.
The following test case demonstrates the problem.
--
package sample;
import java.io.StringReader;
import java.util.HashSet;
import java.util.Set;
import org.drools.RuleBase;
import org.drools.RuleBaseConfiguration;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
public class FromProblem {
public static void main(String[] args) throws Exception {
final PackageBuilderConfiguration packageBuilderConfiguration =
new PackageBuilderConfiguration();
final PackageBuilder packageBuilder = new PackageBuilder(packageBuilderConfiguration);
packageBuilder.addPackageFromDrl(new StringReader("\n"
+ "package sample\n"
+ "\n"
+ "import java.util.ArrayList;"
+ "import sample.FromProblem;"
+ "global sample.FromProblem x;"
+ "\n"
+ "rule MyRule\n"
+ " dialect \"java\"\n"
+ "\n"
+ " when\n"
+ " $i : ArrayList() from collect(Integer() from x.getIntegers())\n"
+ " $k : ArrayList() from collect(Integer() from x.getIntegers())\n"
+ " then \n"
+ " System.out.println($i);\n"
+ " System.out.println($k);\n"
+ "end \n"));
final RuleBaseConfiguration ruleBaseConfiguration = new RuleBaseConfiguration();
final RuleBase ruleBase = RuleBaseFactory.newRuleBase(ruleBaseConfiguration);
ruleBase.addPackage(packageBuilder.getPackage());
final StatefulSession session = ruleBase.newStatefulSession();
session.setGlobal("x", new FromProblem());
session.fireAllRules();
}
public Set<Integer> getIntegers() {
final HashSet<Integer> set = new HashSet<Integer>();
set.add(1);
return set;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years
[JBoss JIRA] Created: (JBPORTAL-1546) WSRP admin screen
by Andrew Oliver (JIRA)
WSRP admin screen
-----------------
Key: JBPORTAL-1546
URL: http://jira.jboss.com/jira/browse/JBPORTAL-1546
Project: JBoss Portal
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Portal Core Admin
Affects Versions: 2.6 Final
Environment: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20061201 Firefox/2.0.0.4 (Ubuntu-feisty) Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing), JBoss 4.2, Portal 2.6
Reporter: Andrew Oliver
1. Go to CMS tab on Admin
2. create consumer BEA
3. cache expiration 100
4. Check WSDL (the fields do not change as in the documentation)
5. hit cancel (the fields then change and the "Endoint configuration" field appears)
6. type http://wsrp.bea.com:7001/producer/producer?WSDL
7. hit save/refresh (the button is not named exactly as in the docs)
8. get screen " * Producer 'bea' requires registration Missing value for property 'registration/consumerRole' Registration configuration is NOT valid Producer 'bea' requires registration Missing value for property 'registration/consumerRole' Registration configuration is NOT valid Producer information successfully refreshed " (consumer role field appears along w/validate button)
9. enter "public", click validate
10. "Error:missing value" appears next for consumer role despite entering it
11. save/refresh (modify registration appears)
12. modify registration ... nothing works
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years