lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: void touchFile() should return the boolean result of the setLastModified
Date Wed, 04 Nov 2009 10:08:41 GMT
I agree it's not great that touchFile swallows the return status from
File.setLastModified, but, technically changing it would break our jar
drop-in back compat.

Actually, I think instead, we should deprecate the method?  As best I
can tell, Lucene does not use this anywhere.

I'll open an issue, but I think we have to wait for 3.1 (we're trying
not to add new deprecations in 3.0).

Mike

On Tue, Nov 3, 2009 at 8:05 PM,  <Peter_Lenahan@ibi.com> wrote:
> This is an issue found by Findbugs.
> In the file FSDirectory the method void touchFile() should return the boolean result
of the setLastModified method call.
>
>
> public abstract class FSDirectory extends Directory {
>
>
> @Override
>  public void touchFile(String name) {
>    ensureOpen();
>    File file = new File(directory, name);
>    file.setLastModified(System.currentTimeMillis());
>  }
>
> Because this class is abstract this method may be overridden, and this may create an
upward compatibility issue.
>
>
> Suggested change
>
> @Override
>  public Boolean touchFile(String name) {
>    ensureOpen();
>    File file = new File(directory, name);
>    Return file.setLastModified(System.currentTimeMillis());
>  }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message