Skip to content

Commit f55c484

Browse files
committed
style: include LEST_LOST_EXCEPTION_STACK_TRACE
1 parent d3bb691 commit f55c484

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

spotbugs-exclude.xml

-3
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,6 @@
255255
<Match>
256256
<Bug pattern="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY" />
257257
</Match>
258-
<Match>
259-
<Bug pattern="LEST_LOST_EXCEPTION_STACK_TRACE" />
260-
</Match>
261258
<Match>
262259
<Bug pattern="PL_PARALLEL_LISTS" />
263260
</Match>

src/main/java/com/thealgorithms/datastructures/heaps/EmptyHeapException.java

+4
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ public class EmptyHeapException extends Exception {
1010
public EmptyHeapException(String message) {
1111
super(message);
1212
}
13+
14+
public EmptyHeapException(String message, Throwable cause) {
15+
super(message, cause);
16+
}
1317
}

src/main/java/com/thealgorithms/datastructures/heaps/MaxHeap.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public HeapElement getElement() throws EmptyHeapException {
123123
try {
124124
return extractMax();
125125
} catch (Exception e) {
126-
throw new EmptyHeapException("Heap is empty. Error retrieving element");
126+
throw new EmptyHeapException("Heap is empty. Error retrieving element", e);
127127
}
128128
}
129129
}

src/main/java/com/thealgorithms/datastructures/heaps/MinHeap.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public HeapElement getElement() throws EmptyHeapException {
117117
try {
118118
return extractMin();
119119
} catch (Exception e) {
120-
throw new EmptyHeapException("Heap is empty. Error retrieving element");
120+
throw new EmptyHeapException("Heap is empty. Error retrieving element", e);
121121
}
122122
}
123123
}

0 commit comments

Comments
 (0)