Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-704

Java scriptTask compilation error reports invalid line

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 6.1.0.Final
    • None
    • None
    • Hide

      1. Get the sample-jbpm6.bpmn file from http://pastebin.com/Gd5QhDHc
      2. pom.xml to with dependencies:

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
      
          <groupId>com.db</groupId>
          <artifactId>test-jbpm6</artifactId>
          <version>1.0-SNAPSHOT</version>
      
          <dependencies>
      
              <dependency>
                  <groupId>org.kie</groupId>
                  <artifactId>kie-api</artifactId>
                  <version>6.1.0.Final</version>
              </dependency>
      
              <dependency>
                  <groupId>org.jbpm</groupId>
                  <artifactId>jbpm-flow</artifactId>
                  <version>6.1.0.Final</version>
              </dependency>
      
              <dependency>
                  <groupId>org.drools</groupId>
                  <artifactId>drools-compiler</artifactId>
                  <version>6.1.0.Final</version>
              </dependency>
      
              <dependency>
                  <groupId>org.jbpm</groupId>
                  <artifactId>jbpm-bpmn2</artifactId>
                  <version>6.1.0.Final</version>
              </dependency>
      
              <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-simple</artifactId>
                  <version>1.7.2</version>
              </dependency>
      
          </dependencies>
      
      </project>
      
      Show
      1. Get the sample-jbpm6.bpmn file from http://pastebin.com/Gd5QhDHc 2. pom.xml to with dependencies: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.db</groupId> <artifactId>test-jbpm6</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.kie</groupId> <artifactId>kie-api</artifactId> <version>6.1.0.Final</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-flow</artifactId> <version>6.1.0.Final</version> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-compiler</artifactId> <version>6.1.0.Final</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-bpmn2</artifactId> <version>6.1.0.Final</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.2</version> </dependency> </dependencies> </project>

      In case of a compilation error inside the scriptTask java code, the line and the column reported inside the org.drools.compiler.kie.builder.impl.MessageImpl are incorrect.

      The MessageImpl.getPath() should also return a path with the node id that contains the compilation error.

      To reproduce:

      KieHelper kieHelper = new KieHelper();
      kieHelper.addResource(ResourceFactory.newClassPathResource("sample-jbpm6.bpmn"));
      Results res =  kieHelper.verify();
      for (Message msg : res.getMessages()) {
           System.out.println("Error: " + msg);
      }
      if (res.hasMessages(Message.Level.ERROR)) {
           throw new IllegalStateException("Could not verify the workflow");
      }
      
      Error: class org.drools.compiler.kie.builder.impl.MessageImpl
      [main] ERROR org.drools.compiler.kie.builder.impl.AbstractKieModule - Unable to build KieBaseModel:defaultKieBase
      Process Compilation error : Process org.jbpm.Hello World(com.sample.bpmn.hello)
      	org/jbpm/Process_org$u46$jbpm$u46$Hello_World265679914.java (9:416) : Syntax error on token "halskdjfh", delete this token
      
      
      Exception in thread "main" java.lang.IllegalStateException: Could not verify the workflow
      	at Main.main(Main.java:26)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
      
      Process finished with exit code 1
      

      I've tested with both with "ECLIPSE" and "NATIVE" as values of the "drools.dialect.java.compiler".

            Unassigned Unassigned
            mfudi Владимир Боднарчук (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: