Author: pfg
Date: Sun Dec  9 01:02:22 2012
New Revision: 1418804

URL: http://svn.apache.org/viewvc?rev=1418804&view=rev
Log:
jl164 - Java help indexer service did not work with long file paths

This patch was left out from the lucene update in r1337602
and apparently has an origin in BZ #i109096#.
No one so far seems to have noticed negative effects but
after consulting in ApacheConEU it seems a good idea to
keep it.

Special thanks to Steve Rowe.
 


Added:
    openoffice/trunk/main/lucene/long_path.patch   (with props)
Modified:
    openoffice/trunk/main/lucene/makefile.mk

Added: openoffice/trunk/main/lucene/long_path.patch
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/lucene/long_path.patch?rev=1418804&view=auto
==============================================================================
--- openoffice/trunk/main/lucene/long_path.patch (added)
+++ openoffice/trunk/main/lucene/long_path.patch Sun Dec  9 01:02:22 2012
@@ -0,0 +1,35 @@
+--- misc/lucene-2.9.4/src/java/org/apache/lucene/store/FSDirectory.java        
2010-11-27 19:21:44.000000000 -0500
++++ misc/build/lucene-2.9.4/src/java/org/apache/lucene/store/FSDirectory.java  
2012-12-08 19:23:23.000000000 -0500
+@@ -266,7 +266,14 @@
+   public static FSDirectory getDirectory(File file, LockFactory lockFactory)
+     throws IOException
+   {
+-    file = getCanonicalPath(file);
++    String path = file.getPath();
++    //File.getCanonicalPath fails on Windows with long path names
++    //Long path names created by osl_getSystemPathFromFileURL are already
++    //unique because its implementation replaces the occurrences of .. and .
++    //That is using the com.sun.star.help.HelpIndexer service from c++ is
++    //relatively safe.
++    if (!path.startsWith("\\\\?\\"))
++      file = getCanonicalPath(file);
+ 
+     FSDirectory dir;
+     synchronized (DIRECTORIES) {
+@@ -721,7 +728,15 @@
+     ensureOpen();
+     String dirName;                               // name to be hashed
+     try {
+-      dirName = directory.getCanonicalPath();
++      //File.getCanonicalPath fails on Windows with long path names
++      //Long path names created by osl_getSystemPathFromFileURL are already
++      //unique because its implementation replaces the occurrences of .. and .
++      //That is using the com.sun.star.help.HelpIndexer service from c++ is
++      //relatively safe.
++      if (!directory.getPath().startsWith("\\\\?\\"))
++        dirName = directory.getCanonicalPath();
++      else
++        dirName = directory.getPath();
+     } catch (IOException e) {
+       throw new RuntimeException(e.toString(), e);
+     }

Propchange: openoffice/trunk/main/lucene/long_path.patch
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openoffice/trunk/main/lucene/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/lucene/makefile.mk?rev=1418804&r1=1418803&r2=1418804&view=diff
==============================================================================
--- openoffice/trunk/main/lucene/makefile.mk (original)
+++ openoffice/trunk/main/lucene/makefile.mk Sun Dec  9 01:02:22 2012
@@ -50,6 +50,10 @@ TARFILE_ROOTDIR=$(LUCENE_NAME)
 
 PATCH_FILES=lucene.patch 
 
+.IF "$(OS)" == "WNT"
+PATCH_FILES+= long_path.patch
+.ENDIF
+
 BUILD_DIR=.
 BUILD_ACTION= ${ANT} -buildfile .$/contrib$/analyzers$/build.xml
 


Reply via email to