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

Bug 354617

Summary: Problems with try/onException generated code
Product: z_Archived Reporter: Justin Spadea <jspadea>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: greer
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 356123    
Bug Blocks:    

Description Justin Spadea CLA 2011-08-12 09:19:28 EDT
1. try without onException has invalid syntax. It creates a JavaScript try with no finally and no catch. In RBD we would generate an empty catch block. In EGL if you do:
try
    someFunc();
end

Then any errors from someFunc() are simply ignored.


2. The code for multiple onException blocks is incorrect. Each is getting its own catch() but there should only be one.

Instead of:
try{
}
catch(e){
  if (e instanceof foo){
  }
}
catch(e2){
  if (e instanceof bar){
  }
}


It should be:
try{
}
catch(e){
  if (e instanceof foo){
  }
  else if (e instanceof bar){
  }
}

Take a look at StatementGenerator.visit(TryStatement) in the RBD code to see what I mean.
Comment 1 Scott Greer CLA 2011-09-01 13:34:53 EDT
Justin,

Thanks for pointing this;  I wasn't familiar with the nuances involved in exception handlers.  I've ported the logic you referenced and verified the fixes using the FVT tests.
Comment 2 Justin Spadea CLA 2011-09-08 15:13:45 EDT
Verified