Package org.drools.compiler

Examples of org.drools.compiler.DroolsParserException


    String message = String
        .format(
            DroolsParserExceptionFactory.TRAILING_SEMI_COLON_NOT_ALLOWED_MESSAGE,
            line, column, formatParserLocation());

    return new DroolsParserException("ERR 104", message, line, column,
        offset, null);
  }
View Full Code Here


   *            original exception
   * @return DroolsParserException filled.
   */
  public DroolsParserException createDroolsException(RecognitionException e) {
    List<String> codeAndMessage = createErrorMessage(e);
    return new DroolsParserException(codeAndMessage.get(1), codeAndMessage
        .get(0), e.line, e.charPositionInLine, e.index, e);
  }
View Full Code Here

        builder.addPackageFromDrl( new StringReader( drl ) );
        Package pkg = builder.getPackage();

        if ( !pkg.isValid() ) {
            throw new DroolsParserException( pkg.getErrorSummary() );
        }
        return pkg;
    }
View Full Code Here

        parseDrlFile(file, result, options);
        result.addRuleFile(file);
      } else if (file.getName().endsWith(".xls")) {
        if (result.getRuleFiles().size()>1){
          //this is because the binary data needs a filename associated in the xml, and if there's multiple files when which one do you use?
          throw new DroolsParserException("Can't parse more than one .xls decision table file in a single directory ["+ file.getParentFile().getPath() +"]");
        }
        parseXlsFile(file, result, options);
        result.addRuleFile(file);
      }
    }
View Full Code Here

        return sb.toString();
    }

    List<FactMetaModel> toModel(String drl) throws DroolsParserException {
        if ( drl != null && (drl.startsWith( "#advanced" ) || drl.startsWith( "//advanced" )) ) {
            throw new DroolsParserException( "Using advanced editor" );
        }
        DrlParser parser = new DrlParser();
        PackageDescr pkg = parser.parse( drl );
        if ( parser.hasErrors() ) {
            throw new DroolsParserException( "The model drl " + drl + " is not valid" );
        }

        if ( pkg == null ) return new ArrayList<FactMetaModel>();
        List<TypeDeclarationDescr> types = pkg.getTypeDeclarations();
        List<FactMetaModel> list = new ArrayList<FactMetaModel>( types.size() );
View Full Code Here

        builder.addPackageFromDrl( new StringReader( drl ) );
        Package pkg = builder.getPackage();

        if ( !pkg.isValid() ) {
            throw new DroolsParserException( pkg.getErrorSummary() );
        }
        return pkg;
    }
View Full Code Here

                if ( sb.length() > 0 ) {
                    sb.append( '\n' );
                }
                sb.append( obj );
            }
            throw new DroolsParserException( sb.toString() );
        }
        return pkgBuilder.getPackage();
    }
View Full Code Here

        assertTrue( parser.hasErrors() );
//        for ( String message : this.parser.getErrorMessages() ) {
//            System.out.println( message );
//        }

        final DroolsParserException err = (DroolsParserException) parser.getErrors().get( 0 );
        assertEquals( 1,
                      parser.getErrors().size() );
        assertEquals( 6,
                      err.getLineNumber() );
    }
View Full Code Here

        builder.addPackageFromDrl( new StringReader( drl ) );
        Package pkg = builder.getPackage();

        if ( !pkg.isValid() ) {
            throw new DroolsParserException( pkg.getErrorSummary() );
        }
        return pkg;
    }
View Full Code Here

        builder.addPackageFromDrl( new StringReader( drl ) );
        Package pkg = builder.getPackage();

        if ( !pkg.isValid() ) {
            throw new DroolsParserException( pkg.getErrorSummary() );
        }
        return pkg;
    }
View Full Code Here

TOP

Related Classes of org.drools.compiler.DroolsParserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.