lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Itamar Syn-Hershko (Created) (JIRA)" <j...@apache.org>
Subject [Lucene.Net] [jira] [Created] (LUCENENET-450) Incorrect use of StreamReader in MoreLikeThis
Date Thu, 27 Oct 2011 10:46:32 GMT
Incorrect use of StreamReader in MoreLikeThis
---------------------------------------------

                 Key: LUCENENET-450
                 URL: https://issues.apache.org/jira/browse/LUCENENET-450
             Project: Lucene.Net
          Issue Type: Bug
          Components: Lucene.Net Contrib
    Affects Versions: Lucene.Net 2.9.2, Lucene.Net 2.9.4, Lucene.Net 3.x, Lucene.Net 2.9.4g
            Reporter: Itamar Syn-Hershko


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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message