style: do not suppress try (#5167)

This commit is contained in:
Piotr Idzik
2024-05-26 23:32:36 +02:00
committed by GitHub
parent 37c2a96fe2
commit ea4dc15a24
7 changed files with 0 additions and 15 deletions

View File

@ -79,7 +79,6 @@
<arg>-Xlint:all</arg> <arg>-Xlint:all</arg>
<arg>-Xlint:-auxiliaryclass</arg> <arg>-Xlint:-auxiliaryclass</arg>
<arg>-Xlint:-rawtypes</arg> <arg>-Xlint:-rawtypes</arg>
<arg>-Xlint:-try</arg>
<arg>-Xlint:-unchecked</arg> <arg>-Xlint:-unchecked</arg>
<arg>-Xlint:-lossy-conversions</arg> <arg>-Xlint:-lossy-conversions</arg>
<arg>-Werror</arg> <arg>-Werror</arg>

View File

@ -68,7 +68,6 @@ final class ProductCipher {
System.out.println("Plaintext: "); System.out.println("Plaintext: ");
System.out.println(plaintext); System.out.println(plaintext);
sc.close();
} }
} }
} }

View File

@ -116,7 +116,6 @@ class BellmanFord /*
System.out.println(); System.out.println();
} }
} }
sc.close();
} }
} }

View File

@ -22,7 +22,6 @@ public final class ReverseStack {
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
stack.push(sc.nextInt()); stack.push(sc.nextInt());
} }
sc.close();
reverseStack(stack); reverseStack(stack);
System.out.println("The reversed stack is:"); System.out.println("The reversed stack is:");
while (!stack.isEmpty()) { while (!stack.isEmpty()) {

View File

@ -30,12 +30,6 @@ public final class NonRepeatingElement {
arr[i] = sc.nextInt(); arr[i] = sc.nextInt();
} }
try {
sc.close();
} catch (Exception e) {
System.out.println("Unable to close scanner" + e);
}
// Find XOR of the 2 non repeating elements // Find XOR of the 2 non repeating elements
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
res ^= arr[i]; res ^= arr[i];
@ -55,7 +49,6 @@ public final class NonRepeatingElement {
} }
System.out.println("The two non repeating elements are " + num1 + " and " + num2); System.out.println("The two non repeating elements are " + num1 + " and " + num2);
sc.close();
} }
} }
/* /*

View File

@ -47,7 +47,6 @@ public final class InsertDeleteInArray {
for (i = 0; i < size2 - 1; i++) { for (i = 0; i < size2 - 1; i++) {
System.out.println(b[i]); System.out.println(b[i]);
} }
s.close();
} }
} }
} }

View File

@ -8,13 +8,10 @@
package com.thealgorithms.sorts; package com.thealgorithms.sorts;
import java.util.Arrays; import java.util.Arrays;
import java.util.Scanner;
public class LinkListSort { public class LinkListSort {
public static boolean isSorted(int[] p, int option) { public static boolean isSorted(int[] p, int option) {
try (Scanner sc = new Scanner(System.in)) {
}
int[] a = p; int[] a = p;
// Array is taken as input from test class // Array is taken as input from test class
int[] b = p; int[] b = p;