lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject svn commit: r1367342 - in /incubator/lucene.net/trunk/src/core/Index: CompoundFileWriter.cs MergePolicy.cs
Date Mon, 30 Jul 2012 22:29:32 GMT
Author: synhershko
Date: Mon Jul 30 22:29:32 2012
New Revision: 1367342

URL: http://svn.apache.org/viewvc?rev=1367342&view=rev
Log:
Throw the appropriate exceptions

Modified:
    incubator/lucene.net/trunk/src/core/Index/CompoundFileWriter.cs
    incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs

Modified: incubator/lucene.net/trunk/src/core/Index/CompoundFileWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/CompoundFileWriter.cs?rev=1367342&r1=1367341&r2=1367342&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/CompoundFileWriter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/CompoundFileWriter.cs Mon Jul 30 22:29:32 2012
@@ -78,9 +78,9 @@ namespace Lucene.Net.Index
 		internal CompoundFileWriter(Directory dir, System.String name, SegmentMerger.CheckAbort
checkAbort)
 		{
 			if (dir == null)
-				throw new System.NullReferenceException("directory cannot be null");
+				throw new ArgumentNullException("dir");
 			if (name == null)
-				throw new System.NullReferenceException("name cannot be null");
+				throw new ArgumentNullException("name");
 			this.checkAbort = checkAbort;
 			directory = dir;
 			fileName = name;
@@ -112,10 +112,10 @@ namespace Lucene.Net.Index
 		public void  AddFile(String file)
 		{
 			if (merged)
-				throw new SystemException("Can't add extensions after merge has been called");
+				throw new InvalidOperationException("Can't add extensions after merge has been called");
 			
 			if (file == null)
-				throw new NullReferenceException("file cannot be null");
+				throw new ArgumentNullException("file");
 			
             try
             {

Modified: incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs?rev=1367342&r1=1367341&r2=1367342&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs Mon Jul 30 22:29:32 2012
@@ -88,7 +88,7 @@ namespace Lucene.Net.Index
 			public OneMerge(SegmentInfos segments, bool useCompoundFile)
 			{
 				if (0 == segments.Count)
-					throw new System.SystemException("segments must include at least one segment");
+					throw new ArgumentException("segments must include at least one segment", "segments");
 				this.segments = segments;
 				this.useCompoundFile = useCompoundFile;
 			}
@@ -145,9 +145,9 @@ namespace Lucene.Net.Index
 				}
 			}
 			
-			internal virtual System.String SegString(Directory dir)
+			internal virtual String SegString(Directory dir)
 			{
-				System.Text.StringBuilder b = new System.Text.StringBuilder();
+				var b = new System.Text.StringBuilder();
 				int numSegments = segments.Count;
 				for (int i = 0; i < numSegments; i++)
 				{
@@ -189,9 +189,9 @@ namespace Lucene.Net.Index
 				merges.Add(merge);
 			}
 			
-			public virtual System.String SegString(Directory dir)
+			public virtual String SegString(Directory dir)
 			{
-				System.Text.StringBuilder b = new System.Text.StringBuilder();
+				var b = new System.Text.StringBuilder();
 				b.Append("MergeSpec:\n");
 				int count = merges.Count;
 				for (int i = 0; i < count; i++)
@@ -206,7 +206,7 @@ namespace Lucene.Net.Index
 		[Serializable]
 		public class MergeException:System.SystemException
 		{
-			private Directory dir;
+			private readonly Directory dir;
 
 			public MergeException(System.String message, Directory dir):base(message)
 			{



Mime
View raw message