Harmonize style of igored exceptions across the codebase

This commit is contained in:
Moritz Halbritter
2024-02-12 10:09:29 +01:00
parent 831a98c83c
commit 8ffcfc9b77
51 changed files with 116 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -203,6 +203,7 @@ final class PrivateKeyParser {
return keyFactory.generatePrivate(keySpec);
}
catch (InvalidKeySpecException | NoSuchAlgorithmException ex) {
// Ignore
}
}
return null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,6 +78,7 @@ class TotalProgressListenerTests extends AbstractJsonTests {
Thread.sleep(10);
}
catch (InterruptedException ex) {
// Ignore
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,8 @@ class JSON {
try {
return Double.valueOf((String) value);
}
catch (NumberFormatException ignored) {
catch (NumberFormatException ex) {
// Ignore
}
}
return null;
@@ -68,7 +69,8 @@ class JSON {
try {
return (int) Double.parseDouble((String) value);
}
catch (NumberFormatException ignored) {
catch (NumberFormatException ex) {
// Ignore
}
}
return null;
@@ -85,7 +87,8 @@ class JSON {
try {
return (long) Double.parseDouble((String) value);
}
catch (NumberFormatException ignored) {
catch (NumberFormatException ex) {
// Ignore
}
}
return null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -827,7 +827,8 @@ public class JSONObject {
return o.toString();
}
}
catch (Exception ignored) {
catch (Exception ex) {
// Ignore
}
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -320,7 +320,8 @@ public class JSONTokener {
try {
return Double.valueOf(literal);
}
catch (NumberFormatException ignored) {
catch (NumberFormatException ex) {
// Ignore
}
/* ... finally give up. We have an unquoted string */

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -196,6 +196,7 @@ class BootZipCopyAction implements CopyAction {
outputStream.close();
}
catch (IOException ex) {
// Ignore
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -127,6 +127,7 @@ public class LaunchedURLClassLoader extends URLClassLoader {
return result;
}
catch (ClassNotFoundException ex) {
// Ignore
}
}
if (this.exploded) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -151,6 +151,7 @@ public class JarFileArchive implements Archive {
return unpackDirectory;
}
catch (IOException ex) {
// Ignore
}
}
throw new IllegalStateException("Failed to create unpack directory in directory '" + parent + "'");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -140,6 +140,7 @@ public class Handler extends URLStreamHandler {
return connection;
}
catch (IOException ex) {
// Ignore
}
}
return null;
@@ -154,6 +155,7 @@ public class Handler extends URLStreamHandler {
}
}
catch (Exception ex) {
// Ignore
}
}
return false;
@@ -174,6 +176,7 @@ public class Handler extends URLStreamHandler {
}
}
catch (Exception ex) {
// Ignore
}
return null;
}
@@ -425,6 +428,7 @@ public class Handler extends URLStreamHandler {
}
}
catch (Exception ex) {
// Ignore
}
}
finally {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -144,6 +144,7 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
super.close();
}
catch (IOException ioex) {
// Ignore
}
throw ex;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -329,6 +329,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
.anyMatch((dependency) -> dependency.startsWith("BOOT-INF/lib/log4j-api-2"));
}
catch (IOException ex) {
// Ignore
}
});
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -166,6 +166,7 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
.anyMatch((dependency) -> dependency.startsWith("WEB-INF/lib-provided/"));
}
catch (IOException ex) {
// Ignore
}
});
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -176,6 +176,7 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
return createdBy != null && createdBy.contains("IntelliJ");
}
catch (Exception ex) {
// Ignore
}
}
return false;
@@ -309,6 +310,7 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
}
}
catch (URISyntaxException ex) {
// Ignore
}
}
return false;