[jboss-jira] [JBoss JIRA] Created: (JBRULES-2588) Error creates null package without generating error message
Thomas Hehl (JIRA)
jira-events at lists.jboss.org
Wed Jul 21 12:48:53 EDT 2010
Error creates null package without generating error message
-----------------------------------------------------------
Key: JBRULES-2588
URL: https://jira.jboss.org/browse/JBRULES-2588
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler
Affects Versions: 5.0.1.FINAL
Environment: Windows XP/Eclipse Ganymeade
Reporter: Thomas Hehl
Assignee: Mark Proctor
Priority: Minor
Fix For: 5.0.2, 5.1.0.CR1, FUTURE
PackageBuilder contains the following method:
public void addPackageFromDrl(final Reader reader) throws DroolsParserException,
IOException {
this.resource = new ReaderResource( reader );
final DrlParser parser = new DrlParser();
final PackageDescr pkg = parser.parse( reader );
this.results.addAll( parser.getErrors() );
if ( !parser.hasErrors() ) {
addPackage( pkg );
}
this.resource = null;
}
The problem is that if the parser generates errors, then the package is null and my application blows up later on with a null pointer exception, but the error messages are lost.
To fix this problem I recommend a code change like:
public void addPackageFromDrl(final Reader reader) throws DroolsParserException,
IOException {
this.resource = new ReaderResource( reader );
final DrlParser parser = new DrlParser();
final PackageDescr pkg = parser.parse( reader );
this.results.addAll( parser.getErrors() );
if ( parser.hasErrors() ) {
System.err.println("Parser errors generating null package:" + this.results.toString());
else{
addPackage( pkg );
}
this.resource = null;
}
This will cause an error dump in the log without changing any functionality.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list