Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 3.0.3
-
None
Description
In the MoreLike this implementation (looking at the trunk), line 772 incorrectly creates a new StreamReader instead of using StringReader. This causes the following exception to be thrown, since the ctor expects a file path and not an input string:
System.ArgumentException: Illegal characters in path.
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Boolean detectEncodingFromByteOrderMarks)
at Similarity.Net.MoreLikeThis.RetrieveTerms(Int32 docNum) in MoreLikeThis.cs:line 773
at Similarity.Net.MoreLikeThis.Like(Int32 docNum) in MoreLikeThis.cs:line 507
Simply replacing StreamReader with StringReader will do the job