jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Gomes Rodrigues <ra0...@gmail.com>
Subject Another analyze with errorprone
Date Mon, 11 Sep 2017 20:06:13 GMT
Hi,

i have analyse jmeter source with error prone (http://errorprone.info/) and
I have some questions


1.
It detect a lot of "[DefaultCharset] Implicit use of the platform default
charset, which can result in e.g. non-ASCII characters being silently
replaced with '?' in many environments"

e.g.

    [javac]
/home/ra77/Utils/ErrorProne/trunk/src/functions/org/apache/jmeter/functions/FileRowColContainer.java:75:
warning: [DefaultCharset] Implicit use of the platform default charset,
which can result in e.g. non-ASCII characters being silently replaced with
'?' in many environments
    [javac]         try ( FileReader fis = new FileReader(fileName);
    [javac]                                ^
    [javac]     (see http://errorprone.info/bugpattern/DefaultCharset)
    [javac]   Did you mean 'try ( Reader fis =
Files.newBufferedReader(Paths.get(fileName), UTF_8);' or 'try ( Reader fis
= Files.newBufferedReader(Paths.get(fileName), Charset.defaultCharset());'?
    [javac]
/home/ra77/Utils/ErrorProne/trunk/src/functions/org/apache/jmeter/functions/Groovy.java:158:
warning: [DefaultCharset] Implicit use of the platform default charset,
which can result in e.g. non-ASCII characters being silently replaced with
'?' in many environments
    [javac]             try (FileReader fr = new FileReader(file);
BufferedReader reader = new BufferedReader(fr)) {
    [javac]                                  ^
    [javac]     (see http://errorprone.info/bugpattern/DefaultCharset)
    [javac]   Did you mean 'try (Reader fr =
Files.newBufferedReader(file.toPath(), UTF_8); BufferedReader reader = new
BufferedReader(fr)) {' or 'try (Reader fr =
Files.newBufferedReader(file.toPath(), Charset.defaultCharset());
BufferedReader reader = new BufferedReader(fr)) {'?

I don't have checked the source code yet but I would like to know if it is
wanted or if it is a bug?


2.
Like before, I don't have the time to study it yet but in
TransactionSampler.java we cast a long to an it


    [javac]
/home/ra77/Utils/ErrorProne/trunk/src/core/org/apache/jmeter/control/TransactionSampler.java:121:
warning: [NarrowingCompoundAssignment] Compound assignments from long to
int hide lossy casts
    [javac]         totalTime += res.getTime();
    [javac]                   ^
    [javac]     (see
http://errorprone.info/bugpattern/NarrowingCompoundAssignment)
    [javac]   Did you mean 'totalTime = (int) (totalTime + res.getTime());'?

Is it wanted?


3.
Like before, I don't have the time to study it yet

    [javac]
/home/ra77/Utils/ErrorProne/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/hc/HttpPoolEntry.java:52:
warning: [UnsynchronizedOverridesSynchronized] Unsynchronized method
isExpired overrides synchronized method in PoolEntry
    [javac]     public boolean isExpired(final long now) {
    [javac]                    ^
    [javac]     (see
http://errorprone.info/bugpattern/UnsynchronizedOverridesSynchronized)
    [javac]   Did you mean 'public synchronized boolean isExpired(final
long now) {'?

    [javac]
/home/ra77/Utils/ErrorProne/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DirectAccessByteArrayOutputStream.java:36:
warning: [UnsynchronizedOverridesSynchronized] Unsynchronized method
toByteArray overrides synchronized method in ByteArrayOutputStream
    [javac]     public byte[] toByteArray() {
    [javac]                   ^
    [javac]     (see
http://errorprone.info/bugpattern/UnsynchronizedOverridesSynchronized)

Is it wanted?


Antonio

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message