You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2012/09/04 00:34:34 UTC

Re: svn commit: r1380360 - /jmeter/trunk/src/jorphan/org/apache/jorphan/io/TextFile.java

On 3 September 2012 22:21,  <pm...@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;
>         }
>  }
>
>