Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352925 - No exception on "Divide by Zero"
Summary: No exception on "Divide by Zero"
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: PDE API Tools Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-23 05:26 EDT by Kanhaiya Choudhary CLA
Modified: 2011-07-27 06:24 EDT (History)
2 users (show)

See Also:


Attachments
It has three scenn shots. One is the output . One is for extention class and the last one is for extention point (360.01 KB, image/jpeg)
2011-07-24 13:27 EDT, Kanhaiya Choudhary CLA
no flags Details
Console log for divide by zero exception (176.57 KB, image/png)
2011-07-26 00:14 EDT, Kanhaiya Choudhary CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kanhaiya Choudhary CLA 2011-07-23 05:26:25 EDT
Build Identifier: Vesion 3.7.0

I made an extensible plugin "Calculator". I put the extention points and then put extentions to it. But when I put extention for Divison, even though I did not handled Divide by Zero exception, its not throwing any exception. e.g. It is showing 6/0 as 6. Here both numerator and denominator are int.

Reproducible: Always

Steps to Reproduce:
1. Don't handle the divide by zero exception.
2. Run as Eclipse Application
3. Put two numbers as 6 and zero
4. output is 6 i.e. 6/0=6
Comment 1 Remy Suen CLA 2011-07-23 07:43:41 EDT
Append -consoleLog as an argument to your program's launch configuration.
Comment 2 Kanhaiya Choudhary CLA 2011-07-24 13:27:42 EDT
Created attachment 200246 [details]
It has three scenn shots. One is the output . One is for extention class and the last one is for extention point
Comment 3 Kanhaiya Choudhary CLA 2011-07-24 13:29:05 EDT
(In reply to comment #1)
> Append -consoleLog as an argument to your program's launch configuration.

Hi, I have attached a zip folder, which has appropriate screen shots. Kindly see.
Thanks.
Comment 4 Remy Suen CLA 2011-07-24 13:54:48 EDT
(In reply to comment #2)
> Created attachment 200246 [details]
> It has three scenn shots. One is the output . One is for extention class and
> the last one is for extention point

These screenshots tell us nothing new. Please see comment 1.
Comment 5 Curtis Windatt CLA 2011-07-25 12:38:12 EDT
It sounds like you have a problem in the implementation of your extensible calculator plug-in.  There is no bug in PDE here.  Closing as INVALID.
Comment 6 Kanhaiya Choudhary CLA 2011-07-26 00:13:36 EDT
(In reply to comment #5)
> It sounds like you have a problem in the implementation of your extensible
> calculator plug-in.  There is no bug in PDE here.  Closing as INVALID.

(In reply to comment #5)
> It sounds like you have a problem in the implementation of your extensible
> calculator plug-in.  There is no bug in PDE here.  Closing as INVALID.

I have Attached the console log. It says that there is a Arithmetic exception of Divide by zero. But then why it is not throwing any exception at run time?
Comment 7 Kanhaiya Choudhary CLA 2011-07-26 00:14:37 EDT
Created attachment 200326 [details]
Console log for divide by zero exception
Comment 8 Remy Suen CLA 2011-07-26 06:09:42 EDT
(In reply to comment #6)
> I have Attached the console log. It says that there is a Arithmetic exception
> of Divide by zero. But then why it is not throwing any exception at run time?

The exception was thrown and it got logged in your other Eclipse's workspace log. I don't see a problem here.
Comment 9 Curtis Windatt CLA 2011-07-26 08:47:17 EDT
(In reply to comment #6)
> I have Attached the console log. It says that there is a Arithmetic exception
> of Divide by zero. But then why it is not throwing any exception at run time?

The exception isn't coming from the Eclipse runtime, it is coming from your calculator plug-in.  We do not have special handling for uncaught exceptions in client code.  The log makes it clear that the Calculator code is not handling divide by zero and it must be fixed there.
Comment 10 Kanhaiya Choudhary CLA 2011-07-26 22:49:37 EDT
(In reply to comment #9)
> (In reply to comment #6)
> > I have Attached the console log. It says that there is a Arithmetic exception
> > of Divide by zero. But then why it is not throwing any exception at run time?
> 
> The exception isn't coming from the Eclipse runtime, it is coming from your
> calculator plug-in.  We do not have special handling for uncaught exceptions in
> client code.  The log makes it clear that the Calculator code is not handling
> divide by zero and it must be fixed there.

Yes that is my point. My Calculator plug-in is not handling the exception and it throws the exception at console log only. If I dispatch such a code to the client or use it for myself as a jar file, then nobody will come to know what exactly would be going throw.You may say it as mine programmatic error and I should not be doing this. But if it happens then what to do?. I think in such a case it should throw the exception at run time too and stop further execution unless caught properly.Thank you.
Comment 11 Remy Suen CLA 2011-07-27 06:24:08 EDT
(In reply to comment #10)
> If I dispatch such a code to the
> client or use it for myself as a jar file, then nobody will come to know what
> exactly would be going throw.You may say it as mine programmatic error and I
> should not be doing this. But if it happens then what to do?

That's for you to decide. You can choose to catch such exceptions and propagate it to the user through a dialog or you can choose to let it silently fail. The Eclipse platform cannot make this decision for your plug-in.

> I think in such a
> case it should throw the exception at run time too and stop further execution
> unless caught properly.

I don't understand your suggestion here. The exception is being thrown already. What do you mean by stop further execution?