Skip to content

Commit 7bff82f

Browse files
authored
style: include LEST_LOST_EXCEPTION_STACK_TRACE (#5150)
1 parent ee6924a commit 7bff82f

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
@@ -252,9 +252,6 @@
252252
<Match>
253253
<Bug pattern="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY" />
254254
</Match>
255-
<Match>
256-
<Bug pattern="LEST_LOST_EXCEPTION_STACK_TRACE" />
257-
</Match>
258255
<Match>
259256
<Bug pattern="PL_PARALLEL_LISTS" />
260257
</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)