jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1380360 - /jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java
Date Mon, 03 Sep 2012 22:34:34 GMT
On 3 September 2012 22:21,  <pmouawad@apache.org> wrote:
> Author: pmouawad
> Date: Mon Sep  3 21:21:00 2012
> New Revision: 1380360
>
> URL: http://svn.apache.org/viewvc?rev=1380360&view=rev
> Log:
> Fix Unused encoding

Well spotted.

> Modified:
>     jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java
>
> Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java?rev=1380360&r1=1380359&r2=1380360&view=diff
> ==============================================================================
> --- jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java (original)
> +++ jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java Mon Sep  3 21:21:00
2012
> @@ -99,6 +99,7 @@ public class TextFile extends File {
>       */
>      public TextFile(String filename, String encoding) {
>          super(filename);
> +        setEncoding(encoding);

I wonder if it makes sense to be able to change the encoding after construction?
It's not invoked currently, so might be better to make the field final
and remove the setter.

There are now 2 ctors which call the overridable setEncoding method.
This can cause problems for sub-classes; dropping the method would
solve that too.

>      }
>
>      /**
> @@ -190,18 +191,23 @@ public class TextFile extends File {
>          */
>         @Override
>         public boolean equals(Object obj) {
> -               if (this == obj)
> +               if (this == obj) {
>                         return true;
> -               if (!super.equals(obj))
> +               }
> +               if (!super.equals(obj)) {
>                         return false;
> -               if (!(obj instanceof TextFile))
> +               }
> +               if (!(obj instanceof TextFile)) {
>                         return false;
> +               }
>                 TextFile other = (TextFile) obj;
>                 if (encoding == null) {
> -                       if (other.encoding != null)
> +                       if (other.encoding != null) {
>                                 return false;
> -               } else if (!encoding.equals(other.encoding))
> +                       }
> +               } else if (!encoding.equals(other.encoding)) {
>                         return false;
> +               }
>                 return true;
>         }
>  }
>
>

Mime
View raw message