style: include LEST_LOST_EXCEPTION_STACK_TRACE (#5150)

This commit is contained in:
Piotr Idzik
2024-05-09 17:15:36 +02:00
committed by GitHub
parent ee6924a2a0
commit 7bff82f175
4 changed files with 6 additions and 5 deletions

View File

@ -252,9 +252,6 @@
<Match> <Match>
<Bug pattern="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY" /> <Bug pattern="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY" />
</Match> </Match>
<Match>
<Bug pattern="LEST_LOST_EXCEPTION_STACK_TRACE" />
</Match>
<Match> <Match>
<Bug pattern="PL_PARALLEL_LISTS" /> <Bug pattern="PL_PARALLEL_LISTS" />
</Match> </Match>

View File

@ -10,4 +10,8 @@ public class EmptyHeapException extends Exception {
public EmptyHeapException(String message) { public EmptyHeapException(String message) {
super(message); super(message);
} }
public EmptyHeapException(String message, Throwable cause) {
super(message, cause);
}
} }

View File

@ -123,7 +123,7 @@ public class MaxHeap implements Heap {
try { try {
return extractMax(); return extractMax();
} catch (Exception e) { } catch (Exception e) {
throw new EmptyHeapException("Heap is empty. Error retrieving element"); throw new EmptyHeapException("Heap is empty. Error retrieving element", e);
} }
} }
} }

View File

@ -117,7 +117,7 @@ public class MinHeap implements Heap {
try { try {
return extractMin(); return extractMin();
} catch (Exception e) { } catch (Exception e) {
throw new EmptyHeapException("Heap is empty. Error retrieving element"); throw new EmptyHeapException("Heap is empty. Error retrieving element", e);
} }
} }
} }