Skip to content

Commit

Permalink
fix: throwable
Browse files Browse the repository at this point in the history
yop-wdc committed Nov 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 45210e6 commit 3fd5fcd
Showing 14 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -106,11 +106,11 @@ public void run() {
try {
connectionManager.closeExpiredConnections();
connectionManager.closeIdleConnections(60, TimeUnit.SECONDS);
} catch (Exception t) {
} catch (Throwable t) {
logger.warn("Unable to close idle connections", t);
}
}
} catch (Exception t) {
} catch (Throwable t) {
logger.error("Reaper thread: ", t);
}
}
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
return Long.parseLong(value) * 1000;
}
}
} catch (Exception e) {
} catch (Throwable e) {
logger.warn("KeepAliveDuration Parsed Fail, ex:{}", ExceptionUtils.getMessage(e));
}
return 60 * 1000;
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ public <Input extends BaseRequest, Output extends BaseResponse> Output execute(R
return output;
} catch (YopClientException | YopHttpException | YopUnknownException ex) {
throw ex;
} catch (Exception ex) {
} catch (Throwable ex) {
if (BlockException.isBlockException(ex)) {
final YopHostBlockException hostBlockException = new YopHostBlockException("ServerRoot Blocked, ex:", ex);
invoker.addException(invoker.getExceptionAnalyzer().analyze(hostBlockException));
@@ -230,7 +230,7 @@ private <Input extends BaseRequest, Output extends BaseResponse> Output doExecut
} catch (YopHttpException httpException) {//HTTP调用异常
throwable = httpException;
throw httpException;
} catch (Exception ex) {// 非预期异常
} catch (Throwable ex) {// 非预期异常
throwable = ex;
throw new YopUnknownException("UnExpected Error, ", ex);
} finally {
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ public void run() {
while (!CLOSED) {
try {
sendHostReport(provider, env);
} catch (Exception t) {
} catch (Throwable t) {
LOGGER.error("Unexpected Error, ex:", t);
}
try {
@@ -141,7 +141,7 @@ public void run() {
while (!CLOSED) {
try {
sweepReports(provider, env);
} catch (Exception t) {
} catch (Throwable t) {
LOGGER.error("Unexpected Error, ex:", t);
}
try {
Original file line number Diff line number Diff line change
@@ -127,7 +127,7 @@ public static YopCallbackResponse handle(YopCallbackRequest request) {
try {
YopCallbackHandlerFactory.getHandler(callback.getType()).handle(callback);
result = YopCallbackResponse.success();
} catch (Exception e) {
} catch (Throwable e) {
LOGGER.error("error when handle YopCallbackRequest, ex:", e);
result = YopCallbackResponse.fail(e.getMessage());
}
@@ -160,7 +160,7 @@ private static void signIfNecessary(YopCallbackRequest request, YopCallbackRespo
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("YopCallbackResponse signed:{}", response);
}
} catch (Exception e) {
} catch (Throwable e) {
LOGGER.warn("error when sign the YopCallbackResponse, ex:", e);
}
}
Original file line number Diff line number Diff line change
@@ -172,7 +172,7 @@ public static File saveFile(YosDownloadResponse yosDownloadResponse) {
LOGGER.debug("file downloaded to path:{}, size:{}.", tmpFile.getAbsolutePath(), size);
}
return tmpFile;
} catch (Exception ex) {
} catch (Throwable ex) {
LOGGER.error("fail to save file, response:" + yosDownloadResponse, ex);
throw new YopClientException("fail to save file, response:" + yosDownloadResponse);
} finally {
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public byte[] encrypt(byte[] plain, EncryptOptions options) {
ParametersWithRandom pwr = new ParametersWithRandom(pubKeyParameters, new SecureRandom());
engine.init(true, pwr);
return engine.processBlock(plain, 0, plain.length);
} catch (Exception e) {
} catch (Throwable e) {
throw new YopClientException("SystemError, Encrypt Fail, options:" + options, e);
}
}
@@ -93,7 +93,7 @@ public byte[] decrypt(byte[] cipher, EncryptOptions options) {
((YopPKICredentials) options.getCredentials()).getCredential().getPrivateKey());
engine.init(false, priKeyParameters);
return engine.processBlock(cipher, 0, cipher.length);
} catch (Exception e) {
} catch (Throwable e) {
throw new YopClientException("SystemError, Decrypt Fail, options:" + options, e);
}
}
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ public byte[] encrypt(byte[] plain, EncryptOptions options) {
try {
Cipher initializedCipher = getInitializedCipher(ENCRYPT_MODE, options);
return initializedCipher.doFinal(plain);
} catch (Exception t) {
} catch (Throwable t) {
throw new YopClientException("SystemError, Encrypt Fail, options:" + options + ", ex:", t);
}
}
@@ -108,7 +108,7 @@ public byte[] decrypt(byte[] cipher, EncryptOptions options) {
try {
Cipher initializedCipher = getInitializedCipher(DECRYPT_MODE, options);
return initializedCipher.doFinal(cipher);
} catch (Exception t) {
} catch (Throwable t) {
throw new YopClientException("SystemError, Decrypt Fail, options:" + options, t);
}
}
@@ -150,7 +150,7 @@ private Cipher getInitializedCipher(int mode, EncryptOptions encryptOptions, boo
}
cipher.init(mode, sm4Key);
return cipher;
} catch (Exception throwable) {
} catch (Throwable throwable) {
throw new YopClientException("SystemError, InitCipher Fail, mode:" + mode +
", options:" + encryptOptions + ", ex:", throwable);
}
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ public byte[] encrypt(byte[] plain, EncryptOptions options) {
try {
Cipher initializedCipher = getInitializedCipher(Cipher.ENCRYPT_MODE, options);
return initializedCipher.doFinal(plain);
} catch (Exception t) {
} catch (Throwable t) {
throw new YopClientException("SystemError, Encrypt Fail, options:" + options + ", ex:", t);
}
}
@@ -97,7 +97,7 @@ public byte[] decrypt(byte[] cipher, EncryptOptions options) {
try {
Cipher initializedCipher = getInitializedCipher(Cipher.DECRYPT_MODE, options);
return initializedCipher.doFinal(cipher);
} catch (Exception t) {
} catch (Throwable t) {
throw new YopClientException("SystemError, Decrypt Fail, options:" + options + ", ex:", t);
}
}
@@ -123,7 +123,7 @@ private Cipher getInitializedCipher(int mode, EncryptOptions encryptOptions, boo
Key secretKey = new SecretKeySpec(key, AES);
cipher.init(mode, secretKey);
return cipher;
} catch (Exception throwable) {
} catch (Throwable throwable) {
throw new YopClientException("error happened when initialize cipher", throwable);
}
}
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ public byte[] encrypt(byte[] plain, EncryptOptions options) {
try {
return RSA.encrypt(plain, ((PKICredentialsItem) ((YopPlatformCredentials)
options.getCredentials()).getCredential()).getPublicKey());
} catch (Exception e) {
} catch (Throwable e) {
throw new YopClientException("SystemError, Encrypt Fail, options:" + options + "ex:", e);
}
}
@@ -78,7 +78,7 @@ public InputStream encrypt(InputStream plain, EncryptOptions options) {
public byte[] decrypt(byte[] cipher, EncryptOptions options) {
try {
return RSA.decrypt(cipher, ((YopPKICredentials) options.getCredentials()).getCredential().getPrivateKey());
} catch (Exception e) {
} catch (Throwable e) {
throw new YopClientException("SystemError, Decrypt Fail, options:" + options + "ex:", e);
}
}
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ public Output invoke() {
System.currentTimeMillis() - start, getContext().retryCount());
}
return result;
} catch (java.lang.Exception throwable) {
} catch (Throwable throwable) {
currentEx = throwable;
// 路由异常,客户端配置问题
if (null == lastServerRoot || null == lastServerRoot.getResource()) {
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ public Output invoke() {
System.currentTimeMillis() - start, getContext().retryCount());
}
return result;
} catch (java.lang.Exception throwable) {
} catch (Throwable throwable) {
// 客户端异常、业务异常
if (throwable instanceof YopClientException) {
throw throwable;
Original file line number Diff line number Diff line change
@@ -612,7 +612,7 @@ private static Cipher getInitializedCipher(int mode, String aesKey) {
Key secretKey = new SecretKeySpec(key, "AES");
cipher.init(mode, secretKey);
return cipher;
} catch (Exception throwable) {
} catch (Throwable throwable) {
throw new RuntimeException("error happened when initialize cipher", throwable);
}
}
@@ -763,7 +763,7 @@ public static File saveFile(InputStream content, Map<String, String> headers) {
File tmpFile = File.createTempFile(filePrefix, fileSuffix);
IOUtils.copy(fileContent, Files.newOutputStream(tmpFile.toPath()));
return tmpFile;
} catch (Exception ex) {
} catch (Throwable ex) {
throw new RuntimeException("fail to save file", ex);
} finally {
closeQuietly(fileContent);
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ private boolean doEntry(String resource, boolean mockFail) {
} catch (BlockException e) {
LOGGER.info("blocked");
return true;
} catch (Exception ex) {
} catch (Throwable ex) {
LOGGER.error("error, ex:", ex);
Tracer.trace(ex);
} finally {

0 comments on commit 3fd5fcd

Please sign in to comment.