28 lines
524 B
Plaintext
28 lines
524 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
public long computeDurationInMilliseconds() {
|
||
|
long duration = (((hours * 60) + minutes) * 60 + seconds ) * 1000 ;
|
||
|
return duration;
|
||
|
}
|
||
|
|
||
|
public void doSomething() {
|
||
|
RuntimeException myException = new RuntimeException();
|
||
|
throw myException;
|
||
|
}
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
public long computeDurationInMilliseconds() {
|
||
|
return (((hours * 60) + minutes) * 60 + seconds ) * 1000 ;
|
||
|
}
|
||
|
|
||
|
public void doSomething() {
|
||
|
throw new RuntimeException();
|
||
|
}
|
||
|
----
|