Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Threaded View
Lucene.Net, mail # dev - Re: svn commit: r1375282 - /incubator/lucene.net/trunk/src/core/Util/Parameter.cs


Copy link to this message
-
Re: svn commit: r1375282 - /incubator/lucene.net/trunk/src/core/Util/Parameter.cs
Itamar Syn-Hershko 2012-08-20, 22:19
This will probably require releasing the core again as well as a new RC...

The spatial module was updated, still doing some integration tests, will
send more updates soon

On Tue, Aug 21, 2012 at 1:14 AM, <[EMAIL PROTECTED]> wrote:

> Author: synhershko
> Date: Mon Aug 20 22:14:01 2012
> New Revision: 1375282
>
> URL: http://svn.apache.org/viewvc?rev=1375282&view=rev
> Log:
> Fixing a possible NRE which can be thrown during a race condition on
> accessing allParameters
>
> This is not an air-tight solution, as an ArgumentException can still be
> thrown. I don't care much about doing this within a lock as it will never
> be a bottleneck.
>
>
> https://groups.google.com/group/ravendb/browse_thread/thread/a5cf07e80f70c856
>
> Modified:
>     incubator/lucene.net/trunk/src/core/Util/Parameter.cs
>
> Modified: incubator/lucene.net/trunk/src/core/Util/Parameter.cs
> URL:
> http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Util/Parameter.cs?rev=1375282&r1=1375281&r2=1375282&view=diff
>
> =============================================================================> --- incubator/lucene.net/trunk/src/core/Util/Parameter.cs (original)
> +++ incubator/lucene.net/trunk/src/core/Util/Parameter.cs Mon Aug 20 22:14:01
> 2012
> @@ -39,11 +39,13 @@ namespace Lucene.Net.Util
>                         // typesafe enum pattern, no public constructor
>                         this.name = name;
>                         string key = MakeKey(name);
> -
> -                       if (allParameters.ContainsKey(key))
> -                               throw new
> System.ArgumentException("Parameter name " + key + " already used!");
> -
> -                       allParameters[key] = this;
> +
> +                       lock (allParameters)
> +                       {
> +                               if (allParameters.ContainsKey(key))
> +                                       throw new
> System.ArgumentException("Parameter name " + key + " already used!");
> +                               allParameters[key] = this;
> +                       }
>                 }
>
>                 private string MakeKey(string name)
>
>
>
>