Skip to content

Commit 9f5ae80

Browse files
committed
Fix failed test with JDK11
Add find bug suppress warnings for false positive bug found by findbug
1 parent b780909 commit 9f5ae80

File tree

10 files changed

+154
-76
lines changed

10 files changed

+154
-76
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "Netty NIO Http Client",
3+
"type": "bugfix",
4+
"description": "Fix failed test NettyNioAsyncHttpClientSpiVerificationTest when running with JDK11. See [#1038](https://github.com/aws/aws-sdk-java-v2/issues/1038)"
5+
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: java
22
jdk:
33
- oraclejdk8
4+
- openjdk11
45
sudo: true
56
dist: precise
67
install: /bin/true

aws-sdk-java/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
Amazon AutoScaling, etc).
1616
</description>
1717
<url>https://aws.amazon.com/sdkforjava</url>
18+
1819
<dependencies>
1920
<dependency>
2021
<artifactId>pinpoint</artifactId>

build-tools/src/main/resources/software/amazon/awssdk/spotbugs-suppressions.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,14 @@
133133
<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE" />
134134
</Match>
135135

136+
<!-- https://github.com/spotbugs/spotbugs/issues/600 -->
137+
<Match>
138+
<Or>
139+
<Class name="software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory"/>
140+
<Class name="software.amazon.awssdk.protocols.json.internal.dom.JsonDomParser"/>
141+
<Class name="software.amazon.awssdk.testutils.service.AwsIntegrationTestBase"/>
142+
<Class name="software.amazon.awssdk.protocol.asserts.marshalling.XmlAsserts" />
143+
</Or>
144+
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
145+
</Match>
136146
</FindBugsFilter>

bundle/pom.xml

Lines changed: 77 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -58,81 +58,84 @@
5858
</dependencies>
5959

6060
<build>
61-
<plugins>
62-
<plugin>
63-
<artifactId>maven-dependency-plugin</artifactId>
64-
<groupId>org.apache.maven.plugins</groupId>
65-
<configuration>
66-
<ignoredUnusedDeclaredDependencies>
67-
<ignoredUnusedDeclaredDependency>software.amazon.awssdk:aws-sdk-java</ignoredUnusedDeclaredDependency>
68-
</ignoredUnusedDeclaredDependencies>
69-
</configuration>
70-
</plugin>
71-
<plugin>
72-
<groupId>org.apache.maven.plugins</groupId>
73-
<artifactId>maven-shade-plugin</artifactId>
74-
<version>3.1.0</version>
75-
<configuration>
76-
<artifactSet>
77-
<includes>
78-
<include>com.fasterxml.jackson.jr:*</include>
79-
<include>io.netty:*</include>
80-
<include>com.typesafe.netty:*</include>
81-
<include>com.fasterxml.jackson.core:*</include>
82-
<include>com.fasterxml.jackson.dataformat:jackson-dataformat-cbor</include>
83-
<include>org.apache.httpcomponents:*</include>
84-
<include>org.reactivestreams:*</include>
85-
<include>org.slf4j:*</include>
86-
<include>commons-codec:commons-codec</include>
87-
<include>software.amazon.ion:ion-java</include>
88-
<include>software.amazon.awssdk:*</include>
89-
<include>software.amazon:*</include>
90-
<include>commons-logging:*</include>
91-
</includes>
92-
</artifactSet>
93-
<relocations>
94-
<relocation>
95-
<pattern>com.fasterxml.jackson</pattern>
96-
<shadedPattern>software.amazon.awssdk.thirdparty.com.fasterxml.jackson</shadedPattern>
97-
</relocation>
98-
<relocation>
99-
<pattern>org.apache</pattern>
100-
<shadedPattern>software.amazon.awssdk.thirdparty.org.apache</shadedPattern>
101-
</relocation>
102-
<relocation>
103-
<pattern>software.amazon.ion</pattern>
104-
<shadedPattern>software.amazon.awssdk.thirdparty.ion</shadedPattern>
105-
</relocation>
106-
<relocation>
107-
<pattern>io.netty</pattern>
108-
<shadedPattern>software.amazon.awssdk.thirdparty.io.netty</shadedPattern>
109-
</relocation>
110-
<relocation>
111-
<pattern>com.typesafe</pattern>
112-
<shadedPattern>software.amazon.awssdk.thirdparty.com.typesafe</shadedPattern>
113-
</relocation>
114-
<relocation>
115-
<pattern>org.slf4j</pattern>
116-
<shadedPattern>software.amazon.awssdk.thirdparty.org.slf4j</shadedPattern>
117-
</relocation>
118-
</relocations>
119-
<shadedArtifactAttached>false</shadedArtifactAttached>
120-
<createDependencyReducedPom>true</createDependencyReducedPom>
121-
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
122-
</dependencyReducedPomLocation>
123-
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
124-
</configuration>
125-
<executions>
126-
<execution>
127-
<phase>package</phase>
128-
<goals>
129-
<goal>shade</goal>
130-
</goals>
131-
</execution>
132-
</executions>
133-
</plugin>
134-
</plugins>
61+
<pluginManagement>
62+
<plugins>
63+
<plugin>
64+
<artifactId>maven-dependency-plugin</artifactId>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<configuration>
67+
<ignoredUnusedDeclaredDependencies>
68+
<ignoredUnusedDeclaredDependency>software.amazon.awssdk:aws-sdk-java</ignoredUnusedDeclaredDependency>
69+
</ignoredUnusedDeclaredDependencies>
70+
</configuration>
71+
</plugin>
72+
<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-shade-plugin</artifactId>
75+
<version>3.1.0</version>
76+
<configuration>
77+
<artifactSet>
78+
<includes>
79+
<include>com.fasterxml.jackson.jr:*</include>
80+
<include>io.netty:*</include>
81+
<include>com.typesafe.netty:*</include>
82+
<include>com.fasterxml.jackson.core:*</include>
83+
<include>com.fasterxml.jackson.dataformat:jackson-dataformat-cbor</include>
84+
<include>org.apache.httpcomponents:*</include>
85+
<include>org.reactivestreams:*</include>
86+
<include>org.slf4j:*</include>
87+
<include>commons-codec:commons-codec</include>
88+
<include>software.amazon.ion:ion-java</include>
89+
<include>software.amazon.awssdk:*</include>
90+
<include>software.amazon:*</include>
91+
<include>commons-logging:*</include>
92+
</includes>
93+
</artifactSet>
94+
<relocations>
95+
<relocation>
96+
<pattern>com.fasterxml.jackson</pattern>
97+
<shadedPattern>software.amazon.awssdk.thirdparty.com.fasterxml.jackson</shadedPattern>
98+
</relocation>
99+
<relocation>
100+
<pattern>org.apache</pattern>
101+
<shadedPattern>software.amazon.awssdk.thirdparty.org.apache</shadedPattern>
102+
</relocation>
103+
<relocation>
104+
<pattern>software.amazon.ion</pattern>
105+
<shadedPattern>software.amazon.awssdk.thirdparty.ion</shadedPattern>
106+
</relocation>
107+
<relocation>
108+
<pattern>io.netty</pattern>
109+
<shadedPattern>software.amazon.awssdk.thirdparty.io.netty</shadedPattern>
110+
</relocation>
111+
<relocation>
112+
<pattern>com.typesafe</pattern>
113+
<shadedPattern>software.amazon.awssdk.thirdparty.com.typesafe</shadedPattern>
114+
</relocation>
115+
<relocation>
116+
<pattern>org.slf4j</pattern>
117+
<shadedPattern>software.amazon.awssdk.thirdparty.org.slf4j</shadedPattern>
118+
</relocation>
119+
</relocations>
120+
<shadedArtifactAttached>false</shadedArtifactAttached>
121+
<createDependencyReducedPom>true</createDependencyReducedPom>
122+
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
123+
</dependencyReducedPomLocation>
124+
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
125+
</configuration>
126+
<executions>
127+
<execution>
128+
<phase>package</phase>
129+
<goals>
130+
<goal>shade</goal>
131+
</goals>
132+
</execution>
133+
</executions>
134+
</plugin>
135+
</plugins>
136+
</pluginManagement>
135137
</build>
138+
136139
<profiles>
137140
<profile>
138141
<id>publishing</id>

core/sdk-core/src/main/java/software/amazon/awssdk/core/interceptor/ClasspathInterceptorChainFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ private Stream<ExecutionInterceptor> createExecutionInterceptorFromResource(URL
108108
}
109109

110110
private ExecutionInterceptor createExecutionInterceptor(String interceptorClassName) {
111+
if (interceptorClassName == null) {
112+
return null;
113+
}
114+
111115
interceptorClassName = interceptorClassName.trim();
112116
if (interceptorClassName.equals("")) {
113117
return null;

http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClientSpiVerificationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ public static void tearDown() throws Exception {
6767
client.close();
6868
}
6969

70+
// CONNECTION_RESET_BY_PEER does not work on JDK 11. See https://github.com/tomakehurst/wiremock/issues/1009
7071
@Test
7172
public void signalsErrorViaOnErrorAndFuture() throws InterruptedException, ExecutionException, TimeoutException {
72-
stubFor(any(urlEqualTo("/")).willReturn(aResponse().withFault(Fault.CONNECTION_RESET_BY_PEER)));
73+
stubFor(any(urlEqualTo("/")).willReturn(aResponse().withFault(Fault.RANDOM_DATA_THEN_CLOSE)));
7374

7475
CompletableFuture<Boolean> errorSignaled = new CompletableFuture<>();
7576

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
# Set up logging implementation
17+
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
18+
org.eclipse.jetty.LEVEL=OFF
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
log4j.rootLogger=ERROR, A1
17+
log4j.appender.A1=org.apache.log4j.ConsoleAppender
18+
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
19+
20+
# Print the date in ISO 8601 format
21+
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
22+
23+
# Adjust to see more / less logging
24+
#log4j.logger.com.amazonaws.ec2=DEBUG
25+
26+
# HttpClient 3 Wire Logging
27+
#log4j.logger.httpclient.wire=DEBUG
28+
29+
# HttpClient 4 Wire Logging
30+
# log4j.logger.org.apache.http.wire=INFO
31+
# log4j.logger.org.apache.http=DEBUG
32+
# log4j.logger.org.apache.http.wire=DEBUG
33+
# log4j.logger.software.amazonaws.awssdk=DEBUG
34+
35+

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<unitils.version>3.3</unitils.version>
9696
<xmlunit.version>1.3</xmlunit.version>
9797
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
98-
<spotbugs.version>3.1.9</spotbugs.version>
98+
<spotbugs.version>3.1.11</spotbugs.version>
9999
<netty-reactive-streams-http.version>2.0.0</netty-reactive-streams-http.version>
100100
<freemarker.version>2.3.24-incubating</freemarker.version>
101101
<javapoet.verion>1.11.1</javapoet.verion>

0 commit comments

Comments
 (0)