use of org.drools.compiler.compiler.DroolsParserException in project drools by kiegroup.
the class DroolsParserExceptionFactory method createDroolsException.
public DroolsParserException createDroolsException(Exception e, Token token) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
return new DroolsParserException(String.format(DroolsParserExceptionFactory.UNEXPECTED_EXCEPTION, token.getLine(), token.getCharPositionInLine(), getBetterToken(token), e.toString(), sw.toString()), e);
}
use of org.drools.compiler.compiler.DroolsParserException in project drools-wb by kiegroup.
the class FactModelPersistence method unmarshal.
public static FactModels unmarshal(final String content) {
try {
// De-serialize model
final List<FactMetaModel> models = toModel(content);
final FactModels factModels = new FactModels();
factModels.getModels().addAll(models);
// De-serialize Package name
final String packageName = PackageNameParser.parsePackageName(content);
factModels.setPackageName(packageName);
// De-serialize imports
final Imports imports = ImportsParser.parseImports(content);
factModels.setImports(imports);
return factModels;
} catch (final DroolsParserException e) {
throw new RuntimeException(e);
}
// TODO {porcelli} needs define error handling strategy
// log.error( "Unable to parse the DRL for the model - falling back to text (" + e.getMessage() + ")" );
// RuleContentText text = new RuleContentText();
// text.content = item.getContent();
// asset.setContent( text );
}
Aggregations