1--- misc/lucene-2.3.2/src/java/org/apache/lucene/store/FSDirectory.java 2008-05-01 22:27:58.000000000 +0200 2+++ misc/build/lucene-2.3.2/src/java/org/apache/lucene/store/FSDirectory.java 2011-02-23 16:36:26.249515000 +0100 3@@ -165,7 +165,15 @@ 4 public static FSDirectory getDirectory(File file, LockFactory lockFactory) 5 throws IOException 6 { 7- file = new File(file.getCanonicalPath()); 8+ String path = file.getPath(); 9+ //File.getCanonicalPath fails on Windows with long path names 10+ //Tested with Java SE 6u23 11+ //Long path names created by osl_getSystemPathFromFileURL are already 12+ //unique because its implementation replaces the occurrences of .. and . 13+ //That is using the com.sun.star.help.HelpIndexer service from c++ is 14+ //relatively safe. 15+ if (!path.startsWith("\\\\?\\")) 16+ file = new File(file.getCanonicalPath()); 17 18 if (file.exists() && !file.isDirectory()) 19 throw new IOException(file + " not a directory"); 20@@ -455,7 +463,16 @@ 21 public String getLockID() { 22 String dirName; // name to be hashed 23 try { 24- dirName = directory.getCanonicalPath(); 25+ //File.getCanonicalPath fails on Windows with long path names 26+ //Tested with Java SE 6u23 27+ //Long path names created by osl_getSystemPathFromFileURL are already 28+ //unique because its implementation replaces the occurrences of .. and . 29+ //That is using the com.sun.star.help.HelpIndexer service from c++ is 30+ //relatively safe. 31+ if (!directory.getPath().startsWith("\\\\?\\")) 32+ dirName = directory.getCanonicalPath(); 33+ else 34+ dirName = directory.getPath(); 35 } catch (IOException e) { 36 throw new RuntimeException(e.toString(), e); 37 } 38