Error Unable To Access Property Null Parent
post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Nested properties and memberOf Hi,I have the following rules,global java.util.Set accountNumbers;rule "rule 1"when $d : Document() $c : CreditTransferTransactionInformation (dbtrAcct == null || dbtrAcct.id == null || dbtrAcct.id.othr == null || dbtrAcct.id.othr.id == null) from $d.cstmrCdtTrfInitn.cdtTrfTxInf $i : InternalInfo() from $c.internalInfothen $i.setStatus(PaymentStatus.INVALID); $i.setErrorCode("PR002"); $i.setAdditionalInfo("Account number is null");endrule "rule 2" when $d : Document() $c : CreditTransferTransactionInformation(internalInfo.status != PaymentStatus.INVALID && dbtrAcct.id.othr.id not memberOf accountNumbers) from $d.cstmrCdtTrfInitn.cdtTrfTxInf $i : InternalInfo() from $c.internalInfothen $i.setStatus(PaymentStatus.INVALID); $i.setErrorCode("PR002"); $i.setAdditionalInfo("Account number not available in the routing table"); endMy assumption is rule 1 and rule 2 will be executed in the order they appear. Rule 1 checks all the nested attributes are not null and set the status as invalid if any of them is null. Rule 2 uses the and operator and checks the nested attribute is in the collection defined by the global, only if the object is valid. I assume the LHS of rule 2 will be short circuited if the object is invalid. However, if any of the nested property is null I get the following exception from MVEL. Caused by: [Error: unable to access property (null parent): id][Near : {... Unknown ....}] ^[Line: 1, Column: 0] at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:861) RegardsMeeraj _______________________________________________ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users David Sinclair-2 Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Nested properties and memberOf Drools doesn't use short circuit evaluation, so all of those ORs are going to be evaluated. You may want to consider re-writing your rules or you can use MVEL's null safe navigation
[rules-users] Problem with execution server Next message: [rules-users] org.drools.runtime.rule.ConsequenceException: [Error: unable to access property (null parent): add] [Near : {... Unknown ....}] ^ [Line: http://drools-moved.46999.n3.nabble.com/Nested-properties-and-memberOf-td972731.html 1, Column: 0] Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Hi , Can some-one please tell What does this error means. http://lists.jboss.org/pipermail/rules-users/2009-April/008513.html org.drools.runtime.rule.ConsequenceException: [Error: unable to access property (null parent): add] [Near : {... Unknown ....}] ^ [Line: 1, Column: 0] Regards, Ashish -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090401/3040836e/attachment.html Previous message: [rules-users] Problem with execution server Next message: [rules-users] org.drools.runtime.rule.ConsequenceException: [Error: unable to access property (null parent): add] [Near : {... Unknown ....}] ^ [Line: 1, Column: 0] Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the rules-users mailing list
here for a quick overview of the site Help Center Detailed answers to any questions http://stackoverflow.com/questions/28428688/accessing-properties-from-parent-class-returning-null-while-assigned-in-construc you might have Meta Discuss the workings and policies of http://forum.pmease.com/viewtopic.php?f=1&t=3021 this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is error unable a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Accessing properties from parent class returning null while assigned in constructor up vote 0 down vote favorite I am trying to access the property mysqli from class adb inside the controller class error unable to process_loginController, just that $this->mysqli returns null, instead of boolean true (connection to database). In process_loginController.php I have the script that processes the login, but when I do a login I get Fatal error: Call to a member function prepare() on a non-object in cf.class.php on line 3 that would be if ($stmt = $this->mysqli->prepare("SELECT....")) {. I did a var_dump in cf.class.php for $this->mysqli and it return null. adb.class.php class adb{ public $mysqli; // this properties cannot be accessed public $db; public $sql_details; public $hello_there; public function __construct() { $this->mysqli = new mysqli(DBHOST, DBUSER, DBPASS, DBNAME); $this->db = PDOManager::getInstance(); $this->hello_there = '123'; } public function url(){ // this function can be accessed $url = 'http://www.example.com'; return $url; } } cf.class.php class cf extends adb { public function login($email, $password, $db) { if ($stmt = $this->mysqli->prepare("SELECT....")) { // some code here } } } controller_base.class.php Abstract Class baseController extends cf { protected $registry; function __construct($registry) { ob_start(); $this->sec_session
board cookies • All times are UTC Powered by phpBB Forum Software © phpBB Group