summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang@YueqianWang2011-09-14 04:23:21 (EDT)
committer xgu2011-10-25 02:10:04 (EDT)
commit5ebab97f34384b4fa68e24e9a33e939f9dd7f597 (patch)
treee092ff4c49f417798ea9d0d25bc6e322546c8f6d
parentbd10e8a487b85c313203f46943bf777173ba987f (diff)
downloadorg.eclipse.birt-5ebab97f34384b4fa68e24e9a33e939f9dd7f597.zip
org.eclipse.birt-5ebab97f34384b4fa68e24e9a33e939f9dd7f597.tar.gz
org.eclipse.birt-5ebab97f34384b4fa68e24e9a33e939f9dd7f597.tar.bz2
Fix Ted 43237 Resolve the NPE. Fix version check for invalid report file.
-rw-r--r--model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ModuleUtil.java4
-rw-r--r--model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/parser/ModuleParserHandler.java15
2 files changed, 14 insertions, 5 deletions
diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ModuleUtil.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ModuleUtil.java
index d7d33b5..3764e50 100644
--- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ModuleUtil.java
+++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ModuleUtil.java
@@ -649,7 +649,9 @@ public class ModuleUtil
}
catch ( DesignFileException e )
{
- if ( data != null )
+ if ( data != null
+ && !e.getErrorCode( ).equals( DesignFileException.DESIGN_EXCEPTION_INVALID_XML )
+ && !e.getErrorCode( ).equals( DesignFileException.DESIGN_EXCEPTION_SYNTAX_ERROR ) )
{
VersionParserHandler handler = new VersionParserHandler( );
diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/parser/ModuleParserHandler.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/parser/ModuleParserHandler.java
index 9b45415..c880579 100644
--- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/parser/ModuleParserHandler.java
+++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/parser/ModuleParserHandler.java
@@ -281,22 +281,29 @@ public abstract class ModuleParserHandler extends XMLParserHandler
public void doEndDocument( ) throws SAXException
{
+ List<XMLParserException> errors = getErrorHandler( ).getErrors( );
+ if ( module == null )
+ {
+ Exception e = null;
+ if ( errors.size( ) > 0 )
+ e = new DesignFileException( fileName, errors );
+ throw new SAXException( e );
+ }
this.tempValue = null;
// rename invalid names that contains "." , "/".
if ( versionNumber < VersionUtil.VERSION_3_2_13 )
{
- List<Exception> handledExceptions = handleInvalidName( getErrorHandler( )
- .getErrors( ) );
- getErrorHandler( ).getErrors( ).removeAll( handledExceptions );
+ List<Exception> handledExceptions = handleInvalidName( errors );
+ errors.removeAll( handledExceptions );
}
handleUnresolveListingElements( );
// add all the exceptions to the module
- module.getAllExceptions( ).addAll( getErrorHandler( ).getErrors( ) );
+ module.getAllExceptions( ).addAll( errors );
// Check whether duplicate library namespace exists.