lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (LUCENENET-324) System.TypeInitializationException on linux
Date Thu, 10 Dec 2009 06:44:18 GMT

     [ https://issues.apache.org/jira/browse/LUCENENET-324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Digy resolved LUCENENET-324.
----------------------------

    Resolution: Fixed

I just made the change {code}System.Environment.GetEnvironmentVariable("OS") ?? "Linux"{code}
 and committed.

DIGY

> System.TypeInitializationException on linux
> -------------------------------------------
>
>                 Key: LUCENENET-324
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-324
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: debian, vbnc, Visual Basic
>            Reporter: Johannes von Drachenfels
>            Priority: Minor
>         Attachments: Constants.patch, Constants.patch, Constants.patch
>
>
> Problem:
> When the environment variable "OS" is not present a failure occurs when initializing
an  Lucene.Net.Store.FSDirectory 
> --------------------------------------------------------------------
> Exception:
> --------------------------------------------------------------------
> > ################################
> >
> > System.TypeInitializationException: An exception was thrown by the 
> > type initializer for Lucene.Net.Store.FSDirectory --->
> > System.TypeInitializationException: An exception was thrown by the 
> > type initializer for Lucene.Net.Util.Constants --->
> > System.NullReferenceException: Object reference not set to an instance 
> > of an object
> >
> >    at Lucene.Net.Util.Constants..cctor () [0x00000]
> >
> >    --- End of inner exception stack trace ---
> >
> >    at Lucene.Net.Store.FSDirectory..cctor () [0x00000]
> >
> >    --- End of inner exception stack trace ---
> >
> >    at ConsoleApplication1.Module1.Main () [0x00000]
> Solution:
> --------------------------------------------------------------------
> This is probably caused by this line in Lucene.Net.Util.Constants.cs:
> public static readonly System.String OS_NAME = System.Environment.GetEnvironmentVariable("OS");
> Try to assign some value to the env var "OS":
> 	OS=foo mono yourapp.exe
> Robert
> Workarround:
> --------------------------------------------------------------------
>             'bugfix:
>             Dim OSSTRING As String = ""
>             Try
>                 OSSTRING = System.Environment.GetEnvironmentVariable("OS")
>             Catch ex As Exception
>                 OSSTRING = ""
>             End Try
>             If OSSTRING.Trim.Length = 0 Then
>                 System.Environment.SetEnvironmentVariable("OS", "linux")
>             End If

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message