Skip to content

Commit

Permalink
[#noissue] Fix EmptyCatchBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed May 2, 2022
1 parent cb8efd3 commit 77ca760
Show file tree
Hide file tree
Showing 76 changed files with 125 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static Method findBootstrapClassOrNullMethod() {
Method findBootstrapClass0 = ClassLoader.class.getDeclaredMethod("findBootstrapClass0", String.class);
findBootstrapClass0.setAccessible(true);
return findBootstrapClass0;
} catch (NoSuchMethodException ignore) {
} catch (NoSuchMethodException ignored) {
// skip
}
throw new IllegalStateException("ClassLoader.findBootstrapClassOrNull api not found", rootException);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
} else {
clazz = this.bootLoader.findBootstrapClassOrNull(this, name);
}
} catch (ClassNotFoundException ignore) {
} catch (ClassNotFoundException ignored) {
}
if (clazz == null) {
// if not found, try to load a class by this ClassLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static List<String> getHostIpList() {
Enumeration<NetworkInterface> interfaces = null;
try {
interfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException ignore) {
} catch (SocketException ignored) {
// skip
}

Expand Down Expand Up @@ -154,7 +154,7 @@ private static boolean isSkipNetworkInterface(NetworkInterface networkInterface)
return true;
}
return false;
} catch (Exception ignore) {
} catch (Exception ignored) {
// skip
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void indexSize_0() {
try {
new DefaultInterceptorRegistryAdaptor(-1);
Assert.fail();
} catch (IllegalArgumentException ignore) {
} catch (IllegalArgumentException ignored) {
}

}
Expand All @@ -28,7 +28,7 @@ public void indexSize_1() {
StaticAroundInterceptor mock = mock(StaticAroundInterceptor.class);
interceptorRegistry.addInterceptor(mock);
Assert.fail();
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}
}

Expand All @@ -39,7 +39,7 @@ public void indexSize_2() {
try {
interceptorRegistry.addInterceptor(mock(StaticAroundInterceptor.class));
Assert.fail();
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void run() {
// referenceTest.changeId(0, i);
try {
Thread.sleep(10);
} catch (InterruptedException ignore) {
} catch (InterruptedException ignored) {
}
i++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
} else {
clazz = bootLoader.findBootstrapClassOrNull(this, name);
}
} catch (ClassNotFoundException ignore) {
} catch (ClassNotFoundException ignored) {
}
if (clazz == null) {
// if not found, try to load a class by this ClassLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void close(Closeable closeable) {
}
try {
closeable.close();
} catch (IOException ignore) {
} catch (IOException ignored) {
// skip
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void shutdown() {
if (reporter instanceof Closeable) {
try {
((Closeable) reporter).close();
} catch (IOException e) {
} catch (IOException ignored) {
// ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ public void test3() throws Exception {
CreateNodeMessage createNodeMessage = new CreateNodeMessage(PATH, new byte[0]);
try {
zookeeperClient.createOrSetNode(createNodeMessage);
} catch (Exception ignore) {
} catch (Exception ignored) {
}

try {
zookeeperClient.createOrSetNode(createNodeMessage);
} catch (Exception ignore) {
} catch (Exception ignored) {
}

waitZookeeperServerData(0, zookeeperClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void dispatchSendMessage(ServerRequest<GeneratedMessageV3> serverRequest)
// System.out.println("## Incoming " + IncomingCounter.addAndGet(1));
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException ignore) {
} catch (InterruptedException ignored) {
}

final GeneratedMessageV3 data = serverRequest.getData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ public void testPadBytes_Error() {
try {
buffer1_1.putPadBytes(new byte[11], 10);
Assert.fail("error");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

Buffer buffer1_2 = new AutomaticBuffer(32);
try {
buffer1_2.putPadBytes(new byte[20], 10);
Assert.fail("error");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

Buffer buffer2 = new AutomaticBuffer(32);
Expand Down Expand Up @@ -122,14 +122,14 @@ public void testPadString_Error() {
try {
buffer1_1.putPadString(StringUtils.repeat("a", 11), 10);
Assert.fail("error");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

Buffer buffer1_2 = new AutomaticBuffer(32);
try {
buffer1_2.putPadString(StringUtils.repeat("a", 20), 10);
Assert.fail("error");
} catch (Exception ignore) {
} catch (Exception ignored) {
}

Buffer buffer2 = new AutomaticBuffer(32);
Expand All @@ -156,7 +156,7 @@ public void testPut2PrefixedBytes() {
byte[] bytes4 = new byte[Short.MAX_VALUE+1];
checkPut2PrefixedBytes(bytes4);
Assert.fail("too large bytes");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ public void testPadBytes_Error() {
try {
buffer1_1.putPadBytes(new byte[11], 10);
Assert.fail("error");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

Buffer buffer1_2 = new FixedBuffer(32);
try {
buffer1_2.putPadBytes(new byte[20], 10);
Assert.fail("error");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

Buffer buffer2 = new FixedBuffer(32);
Expand Down Expand Up @@ -181,14 +181,14 @@ public void testPadString_Error() {
Buffer buffer1_1 = new FixedBuffer(32);
try {
buffer1_1.putPadString(StringUtils.repeat("a", 11), 10);
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

Buffer buffer1_2 = new FixedBuffer(32);
try {
buffer1_2.putPadString(StringUtils.repeat("a", 20), 10);
Assert.fail("error");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

Buffer buffer2 = new FixedBuffer(32);
Expand All @@ -211,7 +211,7 @@ public void testPut2PrefixedBytes() {
byte[] bytes2 = new byte[Short.MAX_VALUE + 1];
checkPut2PrefixedBytes(BytesUtils.toString(bytes2), endExpected, Short.MAX_VALUE * 2);
Assert.fail("too large bytes");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}

}
Expand Down Expand Up @@ -474,7 +474,7 @@ public void readVInt_errorCase() {
try {
buffer.readVInt();
Assert.fail("invalid VInt");
} catch (IllegalArgumentException ignore) {
} catch (IllegalArgumentException ignored) {
}

Assert.assertEquals(0, buffer.getOffset());
Expand All @@ -487,7 +487,7 @@ public void readVLong_errorCase() {
try {
buffer.readVLong();
Assert.fail("invalid VLong");
} catch (IllegalArgumentException ignore) {
} catch (IllegalArgumentException ignored) {
}

Assert.assertEquals(0, buffer.getOffset());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public void testFixedBuffer() {
try {
new OffsetFixedBuffer(new byte[10], 11, 0);
Assert.fail();
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}
try {
new OffsetFixedBuffer(new byte[10], -1, 0);
Assert.fail();
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,13 @@ public void testWriteLong_fail() {
try {
BytesUtils.writeLong(1234, such_long, -1);
fail("negative offset did not catched");
} catch (Exception ignore) {
} catch (Exception ignored) {
}

try {
BytesUtils.writeLong(2222, such_long, 9);
fail("index out of range exception did not catched");
} catch (Exception ignore) {
} catch (Exception ignored) {
}

BytesUtils.writeLong(-1l, such_long, 2);
Expand Down Expand Up @@ -511,19 +511,19 @@ public void testCheckBound_fail() {
try {
BytesUtils.checkBounds(buffer, buffer.length, buffer.length);
Assert.fail("bound check fail");
} catch (Exception ignore) {
} catch (Exception ignored) {
}

try {
BytesUtils.checkBounds(buffer, 2, buffer.length);
Assert.fail("bound check fail");
} catch (Exception ignore) {
} catch (Exception ignored) {
}

try {
BytesUtils.checkBounds(buffer, -1, buffer.length);
Assert.fail("bound check fail");
} catch (Exception ignore) {
} catch (Exception ignored) {
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void closeMutator() {
for (BufferedMutator mutator : this.mutatorMap.values()) {
try {
mutator.close();
} catch (IOException ignore) {
} catch (IOException ignored) {
//
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void createPath(String value) throws PinpointZookeeperException {
if (stat == null) {
try {
curator.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(path);
} catch (KeeperException.NodeExistsException nodeExists) {
} catch (KeeperException.NodeExistsException ignored) {
// skip
} catch (Exception e) {
ZookeeperExceptionResolver.resolveAndThrow(e);
Expand Down Expand Up @@ -218,7 +218,7 @@ public void delete(String path) throws PinpointZookeeperException {
CuratorFramework curator = connectionManager.getCuratorFramework();

curator.delete().forPath(path);
} catch (KeeperException.NoNodeException noNode) {
} catch (KeeperException.NoNodeException ignored) {
// skip
} catch (Exception e) {
ZookeeperExceptionResolver.resolveAndThrow(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void createOrSetNodeTest() throws Exception {
try {
curatorZookeeperClient.createOrSetNode(new CreateNodeMessage(testNodePath, message.getBytes()));
Assert.fail();
} catch (Exception ignore) {
} catch (Exception ignored) {
}

boolean existNode = isExistNode(zooKeeper, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Api parse(ApiMetaDataBo apiMetadata) {
String apiInfo = apiDescription.getApiDescription();

return new Api(method, className, apiInfo, MethodTypeEnum.DEFAULT);
} catch (Exception ignore) {
} catch (Exception ignored) {
// ignore
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Object deserialize(AgentEventType agentEventType, byte[] eventBody) throw
try {
Message<TBase<?, ?>> deserialize = SerializationUtils.deserialize(eventBody, deserializerFactory);
return deserialize.getData();
} catch (TException e) {
} catch (TException ignored) {
// ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testGetTraceIndexRowKey3() {
try {
check(applicationName, time);
Assert.fail("error");
} catch (IndexOutOfBoundsException ignore) {
} catch (IndexOutOfBoundsException ignored) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public long getMaxSize() {
public static long getByteSize(String value, long defaultValue) {
try {
return getByteSize(value);
} catch (Exception ignore) {
} catch (Exception ignored) {
}
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static ClassLoader getDefaultClassLoader(ClassLoaderCallable defaultClass
if (contextClassLoader != null) {
return contextClassLoader;
}
} catch (Throwable ignore) {
} catch (Throwable ignored) {
// skip
}
// Timing for security exceptions is different when the ClassLoader is received as an argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static boolean isLoaded(String name, ClassLoader classLoader) {
try {
classLoaderToUse.loadClass(name);
return true;
} catch (ClassNotFoundException ignore) {
} catch (ClassNotFoundException ignored) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public long getLength(Object context) {
if (context instanceof InputStream) {
try {
return ((InputStream) context).available();
} catch (IOException ignore) {
} catch (IOException ignored) {
// io error
return NOT_EXIST;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static void closeQuietly(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException ignore) {
} catch (IOException ignored) {
// skip
}
}
Expand All @@ -137,7 +137,7 @@ public static void closeQuietly(Socket socket) {
if (socket != null) {
try {
socket.close();
} catch (IOException ignore) {
} catch (IOException ignored) {
// skip
}
}
Expand Down
Loading

0 comments on commit 77ca760

Please sign in to comment.