Skip to content

Commit 60d85d3

Browse files
author
Pankaj Agrawal
committed
chore: spotbugs check on pr
1 parent 4e1a34f commit 60d85d3

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.github/workflows/spotbugs.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: SpotBugs
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- 'powertools-core/**'
9+
- 'powertools-logging/**'
10+
- 'powertools-sqs/**'
11+
- 'powertools-tracing/**'
12+
- 'powertools-validation/**'
13+
- 'powertools-parameters/**'
14+
- 'powertools-metrics/**'
15+
- 'pom.xml'
16+
- '.github/workflows/**'
17+
jobs:
18+
codecheck:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Setup java JDK 1.8
23+
uses: actions/setup-java@v2
24+
with:
25+
distribution: 'zulu'
26+
java-version: 8
27+
- name: Build with Maven for spotbugs check to gather reports
28+
run: mvn -Pbuild-with-spotbugs -B install --file pom.xml -DskipTests -Dmaven.javadoc.skip=true -Dspotbugs.failOnError=false
29+
- uses: jwgmeligmeyling/spotbugs-github-action@master
30+
with:
31+
path: '**/spotbugsXml.xml'
32+
# Can be simplified post this issue is fixed https://github.com/jwgmeligmeyling/spotbugs-github-action/issues/9
33+
- name: Build with Maven for spotbugs check to mark build as fail if voilations found
34+
run: mvn -Pbuild-with-spotbugs -B install --file pom.xml -DskipTests -Dmaven.javadoc.skip=true -Dspotbugs.failOnError=true

pom.xml

-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@
419419
</executions>
420420
<configuration>
421421
<xmlOutput>true</xmlOutput>
422-
<failOnError>true</failOnError>
423422
</configuration>
424423
</plugin>
425424
<plugin>

powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/LambdaLoggingAspect.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private Object[] logFromInputStream(final ProceedingJoinPoint pjp) {
236236

237237
private byte[] bytesFromInputStreamSafely(final InputStream inputStream) throws IOException {
238238
try (ByteArrayOutputStream out = new ByteArrayOutputStream();
239-
InputStreamReader reader = new InputStreamReader(inputStream, UTF_8)) {
239+
InputStreamReader reader = new InputStreamReader(inputStream)) {
240240
OutputStreamWriter writer = new OutputStreamWriter(out, UTF_8);
241241

242242
IOUtils.copy(reader, writer);

0 commit comments

Comments
 (0)