本文整理了Java中software.amazon.awssdk.utils.Logger.warn()
方法的一些代码示例,展示了Logger.warn()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.warn()
方法的具体详情如下:
包路径:software.amazon.awssdk.utils.Logger
类名称:Logger
方法名:warn
[英]Checks if warn is enabled and if so logs the supplied message
[中]检查是否启用警告,如果启用,则记录提供的消息
代码示例来源:origin: software.amazon.awssdk/aws-xml-protocol
private void closeStream(SdkHttpFullResponse response) {
response.content().ifPresent(i -> {
try {
i.close();
} catch (IOException e) {
log.warn(() -> "Error closing HTTP content.", e);
}
});
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public String getEnumValueName(String enumValue) {
String result = enumValue;
// Special cases
result = result.replaceAll("textORcsv", "TEXT_OR_CSV");
// Split into words
result = String.join("_", splitOnWordBoundaries(result));
// Enums should be upper-case
result = StringUtils.upperCase(result);
if (!result.matches("^[A-Z][A-Z0-9_]*$")) {
String attempt = result;
log.warn(() -> "Invalid enum member generated for input '" + enumValue + "'. Best attempt: '" + attempt + "' If this "
+ "enum is not customized out, the build will fail.");
}
return result;
}
代码示例来源:origin: aws/aws-sdk-java-v2
private void closeStream(SdkHttpFullResponse response) {
response.content().ifPresent(i -> {
try {
i.close();
} catch (IOException e) {
log.warn(() -> "Error closing HTTP content.", e);
}
});
}
代码示例来源:origin: software.amazon.awssdk/codegen
@Override
public String getEnumValueName(String enumValue) {
String result = enumValue;
// Special cases
result = result.replaceAll("textORcsv", "TEXT_OR_CSV");
// Split into words
result = String.join("_", splitOnWordBoundaries(result));
// Enums should be upper-case
result = StringUtils.upperCase(result);
if (!result.matches("^[A-Z][A-Z0-9_]*$")) {
String attempt = result;
log.warn(() -> "Invalid enum member generated for input '" + enumValue + "'. Best attempt: '" + attempt + "' If this "
+ "enum is not customized out, the build will fail.");
}
return result;
}
代码示例来源:origin: aws/aws-sdk-java-v2
private SSLContext getSslContext(AttributeMap standardOptions) {
TrustManager[] trustManagers = null;
if (standardOptions.get(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES)) {
log.warn(() -> "SSL Certificate verification is disabled. This is not a safe setting and should only be "
+ "used for testing.");
trustManagers = trustAllTrustManager();
}
try {
SSLContext sslcontext = SSLContext.getInstance("TLS");
// http://download.java.net/jdk9/docs/technotes/guides/security/jsse/JSSERefGuide.html
sslcontext.init(null, trustManagers, null);
return sslcontext;
} catch (final NoSuchAlgorithmException | KeyManagementException ex) {
throw new SSLInitializationException(ex.getMessage(), ex);
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
standardizedProfileName = "default";
} else {
log.warn(() -> "Ignoring profile '" + rawProfileName + "' on line " + state.currentLineNumber + " because it " +
"did not start with 'profile ' and it was not 'default'.");
return Optional.empty();
log.warn(() -> "Ignoring profile '" + standardizedProfileName + "' on line " + state.currentLineNumber + " because " +
"it was not alphanumeric with dashes or underscores.");
return Optional.empty();
log.warn(() -> "Ignoring profile '[default]' on line " + state.currentLineNumber + ", because " +
"'[profile default]' was already seen in the same file.");
return Optional.empty();
} else if (hasProfilePrefix && !state.seenDefaultProfileWithProfilePrefix) {
log.warn(() -> "Ignoring earlier-seen '[default]', because '[profile default]' was found on line " +
state.currentLineNumber);
state.profiles.remove("default");
代码示例来源:origin: aws/aws-sdk-java-v2
/**
* Given a property line, load the property key and value. If the property line is invalid and should be ignored, this will
* return empty.
*/
private static Optional<Pair<String, String>> parsePropertyDefinition(ParserState state, String line) {
int firstEqualsLocation = line.indexOf('=');
Validate.isTrue(firstEqualsLocation != -1, "Expected an '=' sign defining a property on line " + state.currentLineNumber);
String propertyKey = StringUtils.trim(line.substring(0, firstEqualsLocation));
String propertyValue = StringUtils.trim(line.substring(firstEqualsLocation + 1));
Validate.isTrue(!propertyKey.isEmpty(), "Property did not have a name on line " + state.currentLineNumber);
// If the profile name includes invalid characters, it should be ignored.
if (!isValidIdentifier(propertyKey)) {
log.warn(() -> "Ignoring property '" + propertyKey + "' on line " + state.currentLineNumber + " because " +
"its name was not alphanumeric with dashes or underscores.");
return Optional.empty();
}
return Optional.of(Pair.of(propertyKey, propertyValue));
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public T handle(SdkHttpFullResponse response, ExecutionAttributes executionAttributes) throws Exception {
try {
return unmarshallResponse(response);
} finally {
response.content().ifPresent(i -> {
try {
i.close();
} catch (IOException e) {
log.warn(() -> "Error closing HTTP content.", e);
}
});
}
}
代码示例来源:origin: software.amazon.awssdk/profiles
standardizedProfileName = "default";
} else {
log.warn(() -> "Ignoring profile '" + rawProfileName + "' on line " + state.currentLineNumber + " because it " +
"did not start with 'profile ' and it was not 'default'.");
return Optional.empty();
log.warn(() -> "Ignoring profile '" + standardizedProfileName + "' on line " + state.currentLineNumber + " because " +
"it was not alphanumeric with dashes or underscores.");
return Optional.empty();
log.warn(() -> "Ignoring profile '[default]' on line " + state.currentLineNumber + ", because " +
"'[profile default]' was already seen in the same file.");
return Optional.empty();
} else if (hasProfilePrefix && !state.seenDefaultProfileWithProfilePrefix) {
log.warn(() -> "Ignoring earlier-seen '[default]', because '[profile default]' was found on line " +
state.currentLineNumber);
state.profiles.remove("default");
代码示例来源:origin: software.amazon.awssdk/aws-query-protocol
@Override
public T handle(SdkHttpFullResponse response, ExecutionAttributes executionAttributes) throws Exception {
try {
return unmarshallResponse(response);
} finally {
response.content().ifPresent(i -> {
try {
i.close();
} catch (IOException e) {
log.warn(() -> "Error closing HTTP content.", e);
}
});
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
boolean channelInUse = getAttribute(ctx, ChannelAttributeKey.IN_USE).orElse(false);
if (channelInUse) {
ctx.fireExceptionCaught(cause);
} else {
ctx.close();
Optional<CompletableFuture<Void>> executeFuture = getAttribute(ctx, ChannelAttributeKey.EXECUTE_FUTURE_KEY);
if (executeFuture.isPresent() && !executeFuture.get().isDone()) {
log.error(() -> "An exception occurred on an channel (" + ctx.channel().id() + ") that was not in use, " +
"but was associated with a future that wasn't completed. This indicates a bug in the " +
"Java SDK, where a future was not completed while the channel was in use. The channel has " +
"been closed, and the future will be completed to prevent any ongoing issues.", cause);
executeFuture.get().completeExceptionally(cause);
} else if (cause instanceof IOException) {
log.debug(() -> "An I/O exception (" + cause.getMessage() + ") occurred on a channel (" + ctx.channel().id() +
") that was not in use. The channel has been closed. This is usually normal.");
} else {
log.warn(() -> "A non-I/O exception occurred on a channel (" + ctx.channel().id() + ") that was not in use. " +
"The channel has been closed to prevent any ongoing issues.", cause);
}
}
}
代码示例来源:origin: software.amazon.awssdk/profiles
/**
* Given a property line, load the property key and value. If the property line is invalid and should be ignored, this will
* return empty.
*/
private static Optional<Pair<String, String>> parsePropertyDefinition(ParserState state, String line) {
int firstEqualsLocation = line.indexOf('=');
Validate.isTrue(firstEqualsLocation != -1, "Expected an '=' sign defining a property on line " + state.currentLineNumber);
String propertyKey = StringUtils.trim(line.substring(0, firstEqualsLocation));
String propertyValue = StringUtils.trim(line.substring(firstEqualsLocation + 1));
Validate.isTrue(!propertyKey.isEmpty(), "Property did not have a name on line " + state.currentLineNumber);
// If the profile name includes invalid characters, it should be ignored.
if (!isValidIdentifier(propertyKey)) {
log.warn(() -> "Ignoring property '" + propertyKey + "' on line " + state.currentLineNumber + " because " +
"its name was not alphanumeric with dashes or underscores.");
return Optional.empty();
}
return Optional.of(Pair.of(propertyKey, propertyValue));
}
代码示例来源:origin: software.amazon.awssdk/netty-nio-client
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
boolean channelInUse = getAttribute(ctx, ChannelAttributeKey.IN_USE).orElse(false);
if (channelInUse) {
ctx.fireExceptionCaught(cause);
} else {
ctx.close();
Optional<CompletableFuture<Void>> executeFuture = getAttribute(ctx, ChannelAttributeKey.EXECUTE_FUTURE_KEY);
if (executeFuture.isPresent() && !executeFuture.get().isDone()) {
log.error(() -> "An exception occurred on an channel (" + ctx.channel().id() + ") that was not in use, " +
"but was associated with a future that wasn't completed. This indicates a bug in the " +
"Java SDK, where a future was not completed while the channel was in use. The channel has " +
"been closed, and the future will be completed to prevent any ongoing issues.", cause);
executeFuture.get().completeExceptionally(cause);
} else if (cause instanceof IOException) {
log.debug(() -> "An I/O exception (" + cause.getMessage() + ") occurred on a channel (" + ctx.channel().id() +
") that was not in use. The channel has been closed. This is usually normal.");
} else {
log.warn(() -> "A non-I/O exception occurred on a channel (" + ctx.channel().id() + ") that was not in use. " +
"The channel has been closed to prevent any ongoing issues.", cause);
}
}
}
代码示例来源:origin: software.amazon.awssdk/profiles
log.warn(() -> "Warning: Duplicate property '" + property.left() + "' detected on line " + state.currentLineNumber +
". The later one in the file will be used.");
代码示例来源:origin: aws/aws-sdk-java-v2
log.warn(() -> "Warning: Duplicate property '" + property.left() + "' detected on line " + state.currentLineNumber +
". The later one in the file will be used.");
代码示例来源:origin: software.amazon.awssdk/sdk-core
/**
* Report the failure to the execution interceptors. Swallow any exceptions thrown from the interceptor since
* we don't want to replace the execution failure.
*
* @param context The execution context.
* @param failure The execution failure.
*/
public static Throwable reportFailureToInterceptors(RequestExecutionContext context, Throwable failure) {
DefaultFailedExecutionContext modifiedContext = runModifyException(context, failure);
try {
context.interceptorChain().onExecutionFailure(modifiedContext, context.executionAttributes());
} catch (Exception exception) {
log.warn(() -> "Interceptor chain threw an error from onExecutionFailure().", exception);
}
return modifiedContext.exception();
}
内容来源于网络,如有侵权,请联系作者删除!