Skip to content

Commit 8046826

Browse files
authored
Check source code using ErrorProne static analyzer (#1872)
* Added support for ErrorProne ---------
1 parent 975241f commit 8046826

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

.mvn/jvm.config

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
2+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
3+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
4+
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
5+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
6+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
7+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
8+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
9+
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
10+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

client/src/main/java/org/asynchttpclient/util/AuthenticatorUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.asynchttpclient.uri.Uri;
2222

2323
import java.nio.charset.Charset;
24+
import java.nio.charset.StandardCharsets;
2425
import java.util.Base64;
2526
import java.util.List;
2627

@@ -95,7 +96,7 @@ private static String computeDigestAuthentication(Realm realm) {
9596
builder.setLength(builder.length() - 2); // remove tailing ", "
9697

9798
// FIXME isn't there a more efficient way?
98-
return new String(StringUtils.charSequence2Bytes(builder, ISO_8859_1));
99+
return new String(StringUtils.charSequence2Bytes(builder, ISO_8859_1), StandardCharsets.UTF_8);
99100
}
100101

101102
private static void append(StringBuilder builder, String name, String value, boolean quoted) {

pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,31 @@
211211
<configuration>
212212
<source>11</source>
213213
<target>11</target>
214+
<encoding>UTF-8</encoding>
215+
<compilerArgs>
216+
<arg>-XDcompilePolicy=simple</arg>
217+
<arg>-Xplugin:ErrorProne
218+
-Xep:JavaTimeDefaultTimeZone:ERROR
219+
-Xep:JavaUtilDate:ERROR
220+
-Xep:DateChecker:ERROR
221+
-Xep:DateFormatConstant:ERROR
222+
-Xep:EmptyBlockTag:ERROR
223+
-Xep:VariableNameSameAsType:ERROR
224+
-Xep:DoubleCheckedLocking:ERROR
225+
-Xep:DefaultCharset:ERROR
226+
-Xep:NullablePrimitive:ERROR
227+
-Xep:NullOptional:ERROR
228+
-XepExcludedPaths:.*/src/test/java/.*
229+
</arg>
230+
</compilerArgs>
231+
<annotationProcessorPaths>
232+
<path>
233+
<groupId>com.google.errorprone</groupId>
234+
<artifactId>error_prone_core</artifactId>
235+
<version>2.18.0</version>
236+
</path>
237+
<!-- Other annotation processors go here -->
238+
</annotationProcessorPaths>
214239
</configuration>
215240
</plugin>
216241

0 commit comments

Comments
 (0)