lucenenet-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/LUCENENET-324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788200#action_12788200
] 

Digy commented on LUCENENET-324:
--------------------------------

Hi Robert, 
Lucene.Java tries to detect whether the OS is Linux or Windows or SunOS. If you have another
solution, feel free to supply a patch.
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
>
>
> 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