[rules-users] Problem with function

Natraj Gudla natraj.forums at gmail.com
Wed Jul 25 23:45:19 EDT 2007


Hello Jones,

I am extremely sorry of not updating the users. After i posted the query, i
realised the problem infact was what you pointed. It was quite
silly.Itworks now.

Thanks a lot for your reply.

Thanks
Natraj Gudla.


On 7/25/07, Dean Jones <dean.m.jones at gmail.com> wrote:
>
> Isn't the problem that the function parameter (loanAmount) doesn't
> have a type? Or am I missing something?
>
> Dean.
>
> On 7/25/07, Edson Tirelli <tirelli at post.com> wrote:
> >
> >     Natraj,
> >
> >     Can you try it with the 4.0GA release please? We fixed a couple
> issues
> > related to functions for the final release.
> >
> >     []s
> >     Edson
> >
> >
> > 2007/7/24, Natraj Gudla < natraj.forums at gmail.com>:
> > >
> > > With 4.0.0 i am getting the run time exception on functions. what
> could be
> > the problem
> > >
> > > Exception
> > >
> > >
> > >
> > > java.lang.NullPointerException
> > >
> > > at
> > org.drools.base.ClassTypeResolver.resolveType(ClassTypeResolver.java
> :127)
> > > at
> > org.drools.rule.builder.dialect.java.JavaFunctionBuilder.build(
> JavaFunctionBuilder.java:72)
> > > at
> > org.drools.rule.builder.dialect.java.JavaDialect.addFunction
> > (JavaDialect.java:434)
> > > at
> > org.drools.compiler.PackageBuilder.addFunction(PackageBuilder.java:350
> > )
> > > at
> > org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:259)
> > > at org.drools.compiler.PackageBuilder.addPackageFromDrl
> > (PackageBuilder.java:147)
> > > at
> > com.drools.sample.ParseDRL.readRuleFromDrl(ParseDRL.java:86
> > )
> > > at com.drools.sample.ParseDRL.main(ParseDRL.java:25)
> > > Exception in thread "main"
> > >
> > >
> > >
> > > My Function:
> > >
> > > function double getROI(loanAmount){
> > >
> > >
> > >
> > > double roI=0.0;
> > > if( loanAmount <= 499000 )
> > > roI = 18;
> > > else if( loanAmount <= 999000 )
> > > roI = 17;
> > > else if( loanAmount <= 1990000 )
> > > roI = 14.5 ;
> > > else if( loanAmount <= 3990000 )
> > > roI = 12;
> > > else if( loanAmount <= 7490000 )
> > > roI = 11.5 ;
> > > else if( loanAmount > 7490000 )
> > > roI = 9.99 ;
> > > return roI;
> > >
> > >
> > >
> > > }
> > >
> > > Thanks
> > > Natraj Gudla
> > >
> > >
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> >
> >
> >
> > --
> >   Edson Tirelli
> >   Software Engineer - JBoss Rules Core Developer
> >   Office: +55 11 3529-6000
> >   Mobile: +55 11 9287-5646
> >   JBoss, a division of Red Hat @ www.jboss.com
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070726/0a419469/attachment.html 


More information about the rules-users mailing list