Lucene.Net.Analysis.Stempel.Egothor.Stemmer: Factored out SystemProperties for 
command line utilities (just use System.Environment)


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/11f987c3
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/11f987c3
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/11f987c3

Branch: refs/heads/api-work
Commit: 11f987c35b3d06f0fb9cdae55e83f498d7c208c7
Parents: 045d13d
Author: Shad Storhaug <[email protected]>
Authored: Sat Mar 18 03:55:27 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Sat Mar 18 04:37:16 2017 +0700

----------------------------------------------------------------------
 .../Egothor.Stemmer/Compile.cs                    | 16 +++++++++++++++-
 .../Egothor.Stemmer/DiffIt.cs                     | 18 +++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/11f987c3/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs 
b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
index 93a4ed1..9d88aae 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
@@ -107,7 +107,21 @@ namespace Egothor.Stemmer
                 qq++;
             }
 
-            string charset = 
SystemProperties.GetProperty("egothor.stemmer.charset", "UTF-8");
+            string charset = null;
+            try
+            {
+                charset = 
System.Environment.GetEnvironmentVariable("egothor.stemmer.charset");
+            }
+            catch
+            {
+            }
+            finally
+            {
+                if (string.IsNullOrEmpty(charset))
+                {
+                    charset = "UTF-8";
+                }
+            }
 
             char[] optimizer = new char[args[0].Length - qq];
             for (int i = 0; i < optimizer.Length; i++)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/11f987c3/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs 
b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs
index 244a383..5a1c9bc 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs
@@ -113,7 +113,23 @@ namespace Egothor.Stemmer
                 TextReader @in;
                 // System.out.println("[" + args[i] + "]");
                 Diff diff = new Diff(ins, del, rep, nop);
-                string charset = 
SystemProperties.GetProperty("egothor.stemmer.charset", "UTF-8");
+
+                string charset = null;
+                try
+                {
+                    charset = 
System.Environment.GetEnvironmentVariable("egothor.stemmer.charset");
+                }
+                catch
+                {
+                }
+                finally
+                {
+                    if (string.IsNullOrEmpty(charset))
+                    {
+                        charset = "UTF-8";
+                    }
+                }
+
                 @in = new StreamReader(new FileStream(args[i], FileMode.Open, 
FileAccess.Read), Encoding.GetEncoding(charset));
                 for (string line = @in.ReadLine(); line != null; line = 
@in.ReadLine())
                 {

Reply via email to