Skip to content

Commit ea4dc15

Browse files
authored
style: do not suppress try (#5167)
1 parent 37c2a96 commit ea4dc15

File tree

7 files changed

+0
-15
lines changed

7 files changed

+0
-15
lines changed

pom.xml

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
<arg>-Xlint:all</arg>
8080
<arg>-Xlint:-auxiliaryclass</arg>
8181
<arg>-Xlint:-rawtypes</arg>
82-
<arg>-Xlint:-try</arg>
8382
<arg>-Xlint:-unchecked</arg>
8483
<arg>-Xlint:-lossy-conversions</arg>
8584
<arg>-Werror</arg>

src/main/java/com/thealgorithms/ciphers/ProductCipher.java

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public static void main(String[] args) {
6868

6969
System.out.println("Plaintext: ");
7070
System.out.println(plaintext);
71-
sc.close();
7271
}
7372
}
7473
}

src/main/java/com/thealgorithms/datastructures/graphs/BellmanFord.java

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ public void go() { // shows distance to all vertices // Interactive run for unde
116116
System.out.println();
117117
}
118118
}
119-
sc.close();
120119
}
121120
}
122121

src/main/java/com/thealgorithms/datastructures/stacks/ReverseStack.java

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public static void main(String[] args) {
2222
for (i = 0; i < n; i++) {
2323
stack.push(sc.nextInt());
2424
}
25-
sc.close();
2625
reverseStack(stack);
2726
System.out.println("The reversed stack is:");
2827
while (!stack.isEmpty()) {

src/main/java/com/thealgorithms/maths/NonRepeatingElement.java

-7
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ public static void main(String[] args) {
3030
arr[i] = sc.nextInt();
3131
}
3232

33-
try {
34-
sc.close();
35-
} catch (Exception e) {
36-
System.out.println("Unable to close scanner" + e);
37-
}
38-
3933
// Find XOR of the 2 non repeating elements
4034
for (i = 0; i < n; i++) {
4135
res ^= arr[i];
@@ -55,7 +49,6 @@ public static void main(String[] args) {
5549
}
5650

5751
System.out.println("The two non repeating elements are " + num1 + " and " + num2);
58-
sc.close();
5952
}
6053
}
6154
/*

src/main/java/com/thealgorithms/others/InsertDeleteInArray.java

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public static void main(String[] args) {
4747
for (i = 0; i < size2 - 1; i++) {
4848
System.out.println(b[i]);
4949
}
50-
s.close();
5150
}
5251
}
5352
}

src/main/java/com/thealgorithms/sorts/LinkListSort.java

-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
package com.thealgorithms.sorts;
99

1010
import java.util.Arrays;
11-
import java.util.Scanner;
1211

1312
public class LinkListSort {
1413

1514
public static boolean isSorted(int[] p, int option) {
16-
try (Scanner sc = new Scanner(System.in)) {
17-
}
1815
int[] a = p;
1916
// Array is taken as input from test class
2017
int[] b = p;

0 commit comments

Comments
 (0)