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

Bug 354755

Summary: Setting exception record's message field gets various Java compile errors
Product: z_Archived Reporter: Kathy Carroll <carrollk>
Component: EDTAssignee: Matt Heitz <mheitz>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mheitz
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 354957    
Bug Blocks:    

Description Kathy Carroll CLA 2011-08-15 14:41:48 EDT
Setting exception record's message field gets various Java compile errors

package explore;

library LogResults {}

    function assertTrue(info string, flag boolean)
        if (flag)
            syslib.writeStdOut("all good");
        else
            syslib.writeStdOut("going to throw the exception");
            throw new AssertionFailedException{message = info};
        end
    end

    function assertTrue2(info string, flag boolean)
        local string = "loc " + info;
        if (flag)
            syslib.writeStdOut("all good");
        else
            syslib.writeStdOut("going to throw the exception");
            oopsy AssertionFailedException;
            oopsy.message = info;
            throw oopsy;
        end
    end

end

Record AssertionFailedException type Exception
end
Comment 1 Matt Heitz CLA 2011-08-15 14:45:14 EDT
I was going to try fixing this today before anybody noticed the problem, but you beat me to it.
Comment 2 Matt Heitz CLA 2011-08-15 17:12:18 EDT
I've changed AnyExceptionTypeTemplate to fix the initial value of an exception.  There's still more work to do before all of this is fixed.
Comment 3 Matt Heitz CLA 2011-08-17 15:16:59 EDT
FYI, the line "oopsy.message = info;" will result in a NullValueException.  The exception "oopsy" declared in the previous line is null.  Add {} to the declaration.
Comment 4 Matt Heitz CLA 2011-08-17 15:38:13 EDT
I changed RecordTemplate to properly generate assignments between two records that are references, such as exceptions.

Bug 354957 must be fixed before your testcase will generate cleanly.
Comment 5 Kathy Carroll CLA 2011-08-17 21:28:03 EDT
verified
Comment 6 Lisa Lasher CLA 2011-10-11 16:24:07 EDT
Closing this defect.