tmf: Make StateValueType and TimeRange exceptions into runtime ones
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 3 Feb 2014 22:38:17 +0000 (17:38 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 4 Feb 2014 20:02:24 +0000 (15:02 -0500)
commit6dd468307826e772f8fb5bedd55f9410b8cf8046
tree31dfab2783f76036a7a63cae4c082c42b06f90d6
parentd6b46913ad62aa237e5c9b76b33e698d893110ed
tmf: Make StateValueType and TimeRange exceptions into runtime ones

After much deliberating, here's a suggestion to make
StateValueTypeException and TimeRangeException subclasses of
RuntimeException instead.

The rationale is that it is possible to check for these in advance
(via ITmfStateValue.getType(), and ITmfStateSystem.getCurrentEndTime()).
If the caller does not do these checks correctly, he deserves getting
a runtime exception in the face.

In practice, somebody doing it correctly would always have to wrap it
in a redudant try/catch, saying "I checked for this, I know, throw new
IllegalStateException()", which kind of defeats the purpose of a
checked exception.

The existing code catching those exceptions will continue to work fine,
it remains possible to do so, but new code may decide to skip it.

Change-Id: I76210eef25a47d3f54c93d9e259c82fc99d80375
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/21489
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/exceptions/StateValueTypeException.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/exceptions/TimeRangeException.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystemBuilder.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/ITmfStateValue.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/TmfStateValue.java
This page took 0.044894 seconds and 5 git commands to generate.