[jboss-jira] [JBoss JIRA] Updated: (JBRULES-3057) Misleading error message for missing constructor

Wolfgang Laun (JIRA) jira-events at lists.jboss.org
Mon May 30 05:15:01 EDT 2011


     [ https://issues.jboss.org/browse/JBRULES-3057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wolfgang Laun updated JBRULES-3057:
-----------------------------------

    Description: 
If an undeclared constructor is called in a consequence, a very strange error message is produced:
   - error text is "Failed to compileShared" ("Shared" is not used by the app)
   - The message part meant ot identify the location of the error is misleanding, e.g.,
      Near : {... p3.setName( "Paul" ); ....}
     with the marker ("^") pointing to "Paul".


  public static class Person {
        private String name;

        public Person(String name){
            this.name = name;
        }

        public String getField1() {
            return field1;
        }

        public void setName( String name ) {
            this.name = name;
        }

        public String getName() {
            return name;
        }
    }

    @Test
    public void testExistsIterativeModifyBug() {
        String str = "";
        str += "package org.simple ";
        str += "import Person ";
        str += "rule xxx ";
        str += "when ";
        str += "then ";
        str += "  Person = new Person() ";
        str += "end  ";

        KnowledgeBase kbase = loadKnowledgeBaseFromString( str );

        assertFalse( kBuilder.hasErrors() );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        ksession.fireAllRules();
        ksession.dispose();
    }




  was:
If an undeclared constructor is called in a consequence, a very strange error message is produced:
   - error text is "Failed to compileShared" ("Shared" is not used by the app)
   - The message part meant ot identify the location of the error is misleanding, e.g.,
      Near : {... p3.setName( "Paul" ); ....}
     with the marker ("^") pointing to "Paul".


  public static class Person {
        private String name;

        public Person(String name){
            this.name = name;
        }

        public String getField1() {
            return field1;
        }

        public void setName( String name ) {
            this.name = name;
        }

        public String getName() {
            return name;
        }
    }

    @Test
    public void testExistsIterativeModifyBug() {

        String str = "";
        str += "package org.simple ";
        str += "import Person ";
        str += "rule xxx ";
        str += "when ";
        str += "then ";
        str += "  Person = new Person() ";
        str += "end  ";

        KnowledgeBase kbase = loadKnowledgeBaseFromString( str );

        assertFalse( kBuilder.hasErrors() );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.fireAllRules();
        ksession.dispose();
    }






> Misleading error message for missing constructor
> ------------------------------------------------
>
>                 Key: JBRULES-3057
>                 URL: https://issues.jboss.org/browse/JBRULES-3057
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler (expert)
>    Affects Versions: 5.2.0.CR1
>            Reporter: Wolfgang Laun
>            Assignee: Mark Proctor
>             Fix For: 5.2.0
>
>
> If an undeclared constructor is called in a consequence, a very strange error message is produced:
>    - error text is "Failed to compileShared" ("Shared" is not used by the app)
>    - The message part meant ot identify the location of the error is misleanding, e.g.,
>       Near : {... p3.setName( "Paul" ); ....}
>      with the marker ("^") pointing to "Paul".
>   public static class Person {
>         private String name;
>         public Person(String name){
>             this.name = name;
>         }
>         public String getField1() {
>             return field1;
>         }
>         public void setName( String name ) {
>             this.name = name;
>         }
>         public String getName() {
>             return name;
>         }
>     }
>     @Test
>     public void testExistsIterativeModifyBug() {
>         String str = "";
>         str += "package org.simple ";
>         str += "import Person ";
>         str += "rule xxx ";
>         str += "when ";
>         str += "then ";
>         str += "  Person = new Person() ";
>         str += "end  ";
>         KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
>         assertFalse( kBuilder.hasErrors() );
>         StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
>         ksession.fireAllRules();
>         ksession.dispose();
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list