facebook

Invalid "Unreachable code" error [Closed]

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #209250 Reply

    rakarnik
    Member

    I have a trivial JSP, that I use to test the error handling code for my application (in a nutshell, I get e-mail about all unhandled Exceptions). So I use the simple JSP shown below to trigger the error handler.

    
    <%@
            page session="true"
    %>
    <%
            throw new Exception();
    %>
    

    Unfortunately, MyEclipse marks this JSP as invalid due to “Unreachable code”. Is there some way to get around this? The problem is purely cosmetic, since I know the code is valid, but sometimes I incorrectly assume it is the reason for the project not being marked clean, which of course is quite dangerous.

    More details:
    Windows 2000
    Eclipse 2.1.3
    MyEclipse 2.8 Beta 1

    #209261

    Riyad Kalla
    Member

    Workaround is to add “if(true)” before the throw clause.

    I believe this error is correct since throwing an error would cause the page evaluation to stop in the servlet container… much like adding a return statement in the middle of the page would screw up rendering.

    #209350

    rakarnik
    Member

    The workaround worked perfectly; thanks!

    #209352

    Riyad Kalla
    Member

    No problem, I’m glad it worked (albeit a little strange).

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Invalid "Unreachable code" error [Closed]

You must be logged in to post in the forum log in