Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354617 - Problems with try/onException generated code
Summary: Problems with try/onException generated code
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 356123
Blocks:
  Show dependency tree
 
Reported: 2011-08-12 09:19 EDT by Justin Spadea CLA
Modified: 2017-02-23 14:16 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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