[JBoss JIRA] Created: (JBRULES-977) Foo(this != $i) fails when using ShadowProxy
by Brian Stiles (JIRA)
Foo(this != $i) fails when using ShadowProxy
--------------------------------------------
Key: JBRULES-977
URL: http://jira.jboss.com/jira/browse/JBRULES-977
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.MR4
Reporter: Brian Stiles
Assigned To: Mark Proctor
The self reference field "this" doesn't behave as expected when shadow proxies are used.
when
$i : Foo()
Foo(this != $i)
the above always fires.
The following code exhibits the problem.
--------
/*
* Created on Apr 26, 2007
*/
package sample;
import java.io.StringReader;
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 ThisProblem {
public static class Foo {
private final int _number;
public Foo(int number) {
_number = number;
}
public int getNumber() {
return _number;
}
public int hashCode() {
return _number;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Foo) {
final Foo other = (Foo) obj;
return _number == other._number;
}
return false;
}
public String toString() {
return String.valueOf(_number);
}
}
public static void main(String[] args) throws Exception {
fail();
System.out.println("********************************************");
succeed();
}
private static void fail() throws Exception {
test(true);
}
private static void succeed() throws Exception {
test(false);
}
private static void test(boolean useShadowProxy) throws Exception {
final PackageBuilderConfiguration packageBuilderConfiguration =
new PackageBuilderConfiguration();
final PackageBuilder packageBuilder = new PackageBuilder(packageBuilderConfiguration);
packageBuilder.addPackageFromDrl(new StringReader("\n"
+ "package sample\n"
+ "\n"
+ "import sample.ThisProblem.Foo;"
+ "\n"
+ "rule MyRule\n"
+ " dialect \"java\"\n"
+ "\n"
+ " when\n"
+ " $i : Foo()\n"
+ " $k : Foo(this != $i)\n"
+ " then \n"
+ " System.out.println(\"-------------\");\n"
+ " System.out.println($i + \": \" + System.identityHashCode($i));\n"
+ " System.out.println($k + \": \" + System.identityHashCode($k));\n"
+ "end \n"));
final RuleBaseConfiguration ruleBaseConfiguration = new RuleBaseConfiguration();
ruleBaseConfiguration.setShadowProxy(useShadowProxy);
final RuleBase ruleBase = RuleBaseFactory.newRuleBase(ruleBaseConfiguration);
ruleBase.addPackage(packageBuilder.getPackage());
final StatefulSession session = ruleBase.newStatefulSession();
session.insert(new Foo(1));
session.fireAllRules();
}
}
--
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
17 years, 2 months
[JBoss JIRA] Created: (JBREM-769) Sucky error message when identity creation fails
by David Lloyd (JIRA)
Sucky error message when identity creation fails
------------------------------------------------
Key: JBREM-769
URL: http://jira.jboss.com/jira/browse/JBREM-769
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: jmx remoting
Affects Versions: 2.2.1.GA, 2.4.0.Beta1 (Pinto)
Reporter: David Lloyd
Assigned To: David Lloyd
If Identity.get(mbeanServer) fails for any reason, the error message is not helpful since it obscures the original exception type and line number.
Example stack trace from a user:
Caused by: java.lang.RuntimeException: Exception creating identity: caesar: caesar
at org.jboss.remoting.ident.Identity.get(Identity.java:211)
at org.jboss.remoting.network.NetworkRegistry.preRegister(NetworkRegistry.java:268)
at org.jboss.mx.server.AbstractMBeanInvoker.invokePreRegister(AbstractMBeanInvoker.java:966)
at org.jboss.mx.modelmbean.ModelMBeanInvoker.invokePreRegister(ModelMBeanInvoker.java:489)
at org.jboss.mx.server.AbstractMBeanInvoker.preRegister(AbstractMBeanInvoker.java:654)
at org.jboss.mx.server.registry.BasicMBeanRegistry.invokePreRegister(BasicMBeanRegistry.java:697)
... 56 more
Need to 1) substitute the original stack trace, and 2) identify original the exception type in the message.
--
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
17 years, 3 months