Thanks guys, we will mimic the current behavior and ignore the comment.
Mike I did promise to find bugs!

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Lucene.NET committer and PMC member

On Wed, Feb 4, 2015 at 11:20 AM, Uwe Schindler <u...@thetaphi.de> wrote:

> Hi Mike,
>
> This is why I ask here! So I think we should fix this before release of
> 5.0! Maybe Robert has an explanation why he does the createDirectories() on
> ctor.
> In any case I will now commit the removal of the bogus comment in 4.10
> branch.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: u...@thetaphi.de
>
>
> > -----Original Message-----
> > From: Michael McCandless [mailto:luc...@mikemccandless.com]
> > Sent: Wednesday, February 04, 2015 10:07 AM
> > To: Lucene/Solr dev
> > Cc: d...@lucenenet.apache.org
> > Subject: Re: FSDirectory and creating directory
> >
> > In the past we considered this ("mkdir when creating FSDir") a bug:
> > https://issues.apache.org/jira/browse/LUCENE-1464
> >
> > Mike McCandless
> >
> > http://blog.mikemccandless.com
> >
> >
> > On Wed, Feb 4, 2015 at 4:03 AM, Uwe Schindler <uschind...@apache.org>
> > wrote:
> > > Hi,
> > >
> > > on the Lucene.NET mailing list there were some issues with porting over
> > Lucene 4.8's FSDirectory class to .NET. In fact the following comment on
> a
> > method caused confusion:
> > >
> > >   // returns the canonical version of the directory, creating it if it
> doesn't
> > exist.
> > >   private static File getCanonicalPath(File file) throws IOException {
> > >     return new File(file.getCanonicalPath());
> > >   }
> > >
> > > In fact, the comment is not correct (and the whole method is useless -
> one
> > could call file.getCanonicalFile() to do the same. According to Javadocs
> and
> > my tests, this method does *not* generate the directory. If the directory
> > does not exists, it just returns a "synthetic" canonical name (modifying
> only
> > "known" parts of the path). In fact we should maybe fix this comment and
> > remove this method in 4.10.x (if we get a further bugfix release).
> > >
> > > We also have a test that validates that a directory is not created by
> > FSDirectory's ctor (a side effect of some IndexWriter test).
> > >
> > > Nevertheless, in Lucene 5 we changed the behavior of the FSDirectory
> > CTOR with NIO.2:
> > >
> > >   protected FSDirectory(Path path, LockFactory lockFactory) throws
> > IOException {
> > >     super(lockFactory);
> > >     Files.createDirectories(path);  // create directory, if it doesn't
> exist
> > >     directory = path.toRealPath();
> > >   }
> > >
> > > The question is now: Do we really intend to create the directory in
> Lucene 5
> > ? What about opening an IndexReader on a non-existent directory on a
> read-
> > only filesystem? I know that Robert added this to make path.getRealPath()
> > to work correctly?
> > >
> > > I just want to discuss this before we release 5.0. To me it sounds
> wrong to
> > create the directory in the constructor...
> > >
> > > Uwe
> > >
> > > -----
> > > Uwe Schindler
> > > uschind...@apache.org
> > > Apache Lucene PMC Member / Committer
> > > Bremen, Germany
> > > http://lucene.apache.org/
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For
> > > additional commands, e-mail: dev-h...@lucene.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional
> > commands, e-mail: dev-h...@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: dev-h...@lucene.apache.org
>
>

Reply via email to