[jboss-jira] [JBoss JIRA] Updated: (JBRULES-2588) Error creates null package without generating error message
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Thu Jul 22 17:40:58 EDT 2010
[ https://jira.jboss.org/browse/JBRULES-2588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Proctor updated JBRULES-2588:
----------------------------------
Fix Version/s: 5.2.0.M1
(was: FUTURE)
(was: 5.0.2)
(was: 5.1.0.CR1)
> 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.2.0.M1
>
> Original Estimate: 30 minutes
> Remaining Estimate: 30 minutes
>
> 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