Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311663

Summary: Null pointer exception in InternalTransformationExecutor::doLoad
Product: [Modeling] QVTo Reporter: Alexis Muller <Alexis.Muller>
Component: EngineAssignee: Sergey Boyko <serg.boyko2011>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: serg.boyko2011
Version: unspecified   
Target Milestone: 3.0 M6   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Alexis Muller CLA 2010-05-05 03:43:18 EDT
Build Identifier: I20100312-1448

In InternalTransformationExecutor::doLoad, when a transformation cannot be load it will allays do a null pointer exception.

Here is an extract of the faulty code (line 257-264 on my version).
I added a comment where the problem is and can be corrected.

fTransformation = getTransformation();
if (fTransformation == null) {
  fLoadDiagnostic = new ExecutionDiagnosticImpl(Diagnostic.ERROR,
                    ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS
                     .bind(Messages.NotTransformationInUnitError, fURI));

  /* At this line if fTransformation has been null it is 
   still null. So checkIsExecutable(fTransformation) at next statement will do 
   a null pointer exception.
   A simple return at this line correct the issue.*/
}

ExecutionDiagnosticImpl validForExecution = checkIsExecutable(fTransformation);

Reproducible: Always

Steps to Reproduce:
1. Try to call loadTransformation on a qvt library unit.

InternalTransformationExecutor te =
                new InternalTransformationExecutor(uri_lirary);
te.loadTransformation();
Comment 1 Sergey Boyko CLA 2010-05-14 05:22:22 EDT
(In reply to comment #0)
Hi Alexis,

Thank you for detailed description.
Fixed.

> Build Identifier: I20100312-1448
> 
> In InternalTransformationExecutor::doLoad, when a transformation cannot be load
> it will allays do a null pointer exception.
> 
> Here is an extract of the faulty code (line 257-264 on my version).
> I added a comment where the problem is and can be corrected.
> 
> fTransformation = getTransformation();
> if (fTransformation == null) {
>   fLoadDiagnostic = new ExecutionDiagnosticImpl(Diagnostic.ERROR,
>                     ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS
>                      .bind(Messages.NotTransformationInUnitError, fURI));
> 
>   /* At this line if fTransformation has been null it is 
>    still null. So checkIsExecutable(fTransformation) at next statement will do 
>    a null pointer exception.
>    A simple return at this line correct the issue.*/
> }
> 
> ExecutionDiagnosticImpl validForExecution = checkIsExecutable(fTransformation);
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. Try to call loadTransformation on a qvt library unit.
> 
> InternalTransformationExecutor te =
>                 new InternalTransformationExecutor(uri_lirary);
> te.loadTransformation();