Page 1 of 1 [ 1 post ] 

mouthyb
Deinonychus
Deinonychus

User avatar

Joined: 5 Aug 2013
Age: 46
Gender: Female
Posts: 323
Location: Somewhar dusty and hot.

24 Feb 2014, 6:34 pm

So far, I've really liked the tech discussions on these threads and found them helpful, so I'm interested in posting tech-y questions here when I can't find/don't understand the answers elsewhere. So thank you in advance.

The set-up to the question: I've been asked to write a set of custom runtime exceptions in a program which store (of all the weird s**t) doubles instead of messages and/or causes for the exception. I wrote these exceptions, which function the way they're supposed to for the most part. However, the double field on one of the exceptions, which is an object in Java, is not accepting the double I send it. Instead, it returns a double from elsewhere in the program, which it was not sent, as far as I can tell, in my code or the test code. The value sent to the constructor for the exception is the difference between two doubles, which I sent both directly and then indirectly, by doing the calculation before calling the constructor.

I did not write and cannot alter the test code, and all the rest of the exception code works as requested.

Thinking this may have been an updating issue, I closed down and restarted my IDE (Eclipse, in this case). I also added print statements to see which parts of the exception and the code which triggers the exception were being reached. The exception is triggered correctly, but no print statements ever emerge from the code in those areas, which is.... weird.

My question is this: is there some sort of threading issue here (since the exception essentially interrupts the processor) which would prevent print statements and/or the value of the double from appearing? I've read the API for runtime exceptions, which conspicuously does not list primitive values outside the boolean or the non-primitive String, as being able to be associated with exceptions. Could it be because we're being asked to store a double as a field for the exception object?

I'm turning the code in tomorrow either way, so I'm not actually asking anyone to do it for me, I'm just seeking a deeper understanding of what the exception is actually doing to the threading (or at least an understanding of why it's probably not a good idea to store other primitives in the exception object.)


_________________
RAADS-R: 181
Eye Expression Test: 19
Alexithymic: Please explain conclusions if asked

The feels are shipped in by train once a week--Friday, I'm in love.