Apache Solr open-source search software
LUCENE-4570: Fix deprecated API usage (otherwise may lead to bugs if Hyphenation filters load files from directories with non-ascii path names)
Uwe Schindler0a68fa66ac07
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilter.javaindex bdb22a27f0f..909b3805e67 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilter.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilter.java@@ -148,7 +148,7 @@ public class HyphenationCompoundWordTokenFilter extends*/public static HyphenationTree getHyphenationTree(File hyphenationFile)throws IOException {- return getHyphenationTree(new InputSource(hyphenationFile.toURL().toExternalForm()));+ return getHyphenationTree(new InputSource(hyphenationFile.toURI().toASCIIString()));}/**diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/HyphenationTree.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/HyphenationTree.javaindex b988c462e7b..119794eaf05 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/HyphenationTree.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/HyphenationTree.java@@ -111,7 +111,7 @@ public class HyphenationTree extends TernaryTree implements PatternConsumer {* @throws IOException In case the parsing fails*/public void loadPatterns(File f) throws IOException {- InputSource src = new InputSource(f.toURL().toExternalForm());+ InputSource src = new InputSource(f.toURI().toASCIIString());loadPatterns(src);}diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.javaindex 448adfb582e..d658977241f 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.java@@ -98,7 +98,7 @@ public class PatternParser extends DefaultHandler {* @throws IOException In case of an exception while parsing*/public void parse(File file) throws IOException {- InputSource src = new InputSource(file.toURL().toExternalForm());+ InputSource src = new InputSource(file.toURI().toASCIIString());parse(src);}