<br>   Good! Mark did a good job at least once then! ;)<br><br>   []s<br>   Edson<br><br><div class="gmail_quote">2009/3/16 Michal Bali <span dir="ltr">&lt;<a href="mailto:michalbali@gmail.com">michalbali@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Edson, <br><br>I used the last successful build from your CI which is form 9. March. I&#39;ve tried it on the trunk and it works fine. Thank you!<br>
<br>Best Regards,<br>Michal<br><br><br><div class="gmail_quote">2009/3/16 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>&gt;</span><div><div></div><div class="h5">
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>   Michal,<br><br>   Are you using trunk or CR1?<br><br>   I found a bug last Saturday that I believe is the exact same one you found here. Mark fixed it on trunk. So, if you are not using trunk, can you do it and let us know if it is working for you?<br>


<br>   Thanks,<br>      Edson<br><br><div class="gmail_quote">2009/3/16 Michal Bali <span dir="ltr">&lt;<a href="mailto:michalbali@gmail.com" target="_blank">michalbali@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div>
Hi,<br><br>Internal type together with a function in one drl file cause ClassCastException when setting properties of a new instance of this type.<br><br>java.lang.ClassCastException: org.drools.generatedbeans.Cheese cannot be cast to org.drools.generatedbeans.Cheese<br>



    at org.drools.base.org.drools.generatedbeans.Cheese6778431$setType.setValue(Unknown Source)<br>    at org.drools.base.ClassFieldWriter.setValue(ClassFieldWriter.java:195)<br>    at org.drools.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:319)<br>



    at org.drools.factmodel.ClassDefinition.set(ClassDefinition.java:207)<br>    at org.drools.integrationtests.MiscTest.testGeneratedBeansWithFunction(MiscTest.java:1072)<br>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>



    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)<br>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br>    at java.lang.reflect.Method.invoke(Method.java:616)<br>



    at junit.framework.TestCase.runTest(TestCase.java:154)<br>    at junit.framework.TestCase.runBare(TestCase.java:127)<br>    at junit.framework.TestResult$1.protect(TestResult.java:106)<br>    at junit.framework.TestResult.runProtected(TestResult.java:124)<br>



    at junit.framework.TestResult.run(TestResult.java:109)<br>    at junit.framework.TestCase.run(TestCase.java:118)<br>    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)<br>



    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)<br>    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)<br>    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)<br>



    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)<br>    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)<br><br><br>Test case to reproduce:<br>



test_GeneratedBeansWithFunction.drl:<br>-------------------------------<br>package org.drools.generatedbeans;<br><br>function void someFunction(String arg) {<br>    System.out.println(&quot;hello&quot;);<br>}<br><br>declare Cheese<br>



    type: String<br>end<br>-------------------------------<br><br>test method:<br>public void testGeneratedBeansWithFunction() throws Exception {<br>        final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();<br>



        kbuilder.add( ResourceFactory.newInputStreamResource( getClass().getResourceAsStream( &quot;test_GeneratedBeansWithFunction.drl&quot; ) ),<br>                      ResourceType.DRL );<br>        assertFalse( kbuilder.getErrors().toString(),<br>



                     kbuilder.hasErrors() );<br><br>        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();<br>        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );<br><br>        // Retrieve the generated fact type<br>



        FactType cheeseFact = kbase.getFactType( &quot;org.drools.generatedbeans&quot;,<br>                                                 &quot;Cheese&quot; );<br><br>        // Create a new Fact instance<br>        Object cheese = cheeseFact.newInstance();<br>



<br>        cheeseFact.set( cheese,<br>                        &quot;type&quot;,<br>                        &quot;stilton&quot; );<br>    }<br><br>The last line throws the ClassCastException. If we remove the function from the drl file all works fine.<br>



Best Regards,<br><font color="#888888">Michal<br>
</font><br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>


</font><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div></div></div><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>