You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Fabio Buscaroli (JIRA)" <ji...@apache.org> on 2006/07/13 14:52:29 UTC

[jira] Created: (LUCENENET-11) Avoiding non necessary exceptions

Avoiding non necessary exceptions
---------------------------------

         Key: LUCENENET-11
         URL: http://issues.apache.org/jira/browse/LUCENENET-11
     Project: Lucene.Net
        Type: Improvement

    Reporter: Fabio Buscaroli


As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).

I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.

- FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
- Updated QueryParserTokenManager to support the previous fix
- Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-11?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy closed LUCENENET-11.
-------------------------

    Resolution: Invalid

Invalid for the current state of Lucene.Net

> Avoiding non necessary exceptions
> ---------------------------------
>
>                 Key: LUCENENET-11
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-11
>             Project: Lucene.Net
>          Issue Type: Improvement
>            Reporter: Fabio Buscaroli
>         Attachments: 11_charstream-no-exceptions.patch, lucene-net-exception.patch, patch.zip, patch2.zip
>
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "Fabio Buscaroli (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LUCENENET-11?page=all ]

Fabio Buscaroli updated LUCENENET-11:
-------------------------------------

    Attachment: patch2.zip

Forget the previous patch, it was quite incomplete.
Consider only patch2.zip

> Avoiding non necessary exceptions
> ---------------------------------
>
>          Key: LUCENENET-11
>          URL: http://issues.apache.org/jira/browse/LUCENENET-11
>      Project: Lucene.Net
>         Type: Improvement

>     Reporter: Fabio Buscaroli
>  Attachments: patch.zip, patch2.zip
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "T.H. (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-11?page=comments#action_12447524 ] 
            
T.H. commented on LUCENENET-11:
-------------------------------

Just wanted to say that there is a patch in http://issues.apache.org/jira/browse/LUCENENET-26 that addresses one of these issues as well.

> Avoiding non necessary exceptions
> ---------------------------------
>
>                 Key: LUCENENET-11
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-11
>             Project: Lucene.Net
>          Issue Type: Improvement
>            Reporter: Fabio Buscaroli
>         Attachments: 11_charstream-no-exceptions.patch, lucene-net-exception.patch, patch.zip, patch2.zip
>
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "Joe Shaw (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-11?page=comments#action_12444975 ] 
            
Joe Shaw commented on LUCENENET-11:
-----------------------------------

I think this patch is a decent first step, but I don't think it should go in as-is.

It's not clear to me in the Analyzer part of the patch that it would work (but JavaCC code is really ugly).  This is because the codepaths that depend on the exception being thrown in StandardTokenizerTokenManager aren't changed to handle with the change in return values from ReadChar().

I also don't think that the changes made to ReadChar() and Refill() make it obvious what the behavior is, and I would recommend a different approach: Change the Refill() method to return a boolean value and instead of throwing an exception, return false in the EOF case and true in the normal case.  That return code would have to be checked in ReadChar() and passed out to its callers, which would also have to be changed to handle a new value.

It's not clear to me why the changes to FieldInfos.cs exist in this patch at all.

I didn't really look at the QueryParser side of things (as I don't use that class myself) but it looks like the same thing there, but in that code the ReadChar() return values are handled, but the (now unnecessary) try/catch statements still remain.

> Avoiding non necessary exceptions
> ---------------------------------
>
>                 Key: LUCENENET-11
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-11
>             Project: Lucene.Net
>          Issue Type: Improvement
>            Reporter: Fabio Buscaroli
>         Attachments: lucene-net-exception.patch, patch.zip, patch2.zip
>
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "Fabio Buscaroli (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LUCENENET-11?page=all ]

Fabio Buscaroli updated LUCENENET-11:
-------------------------------------

    Attachment: patch.zip

patch to Lucene.Net 1.9 "final" build 005 

> Avoiding non necessary exceptions
> ---------------------------------
>
>          Key: LUCENENET-11
>          URL: http://issues.apache.org/jira/browse/LUCENENET-11
>      Project: Lucene.Net
>         Type: Improvement

>     Reporter: Fabio Buscaroli
>  Attachments: patch.zip
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "Joe Shaw (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LUCENENET-11?page=all ]

Joe Shaw updated LUCENENET-11:
------------------------------

    Attachment: lucene-net-exception.patch

Here is the patch in GNU unified diff form for slightly easier reading.

> Avoiding non necessary exceptions
> ---------------------------------
>
>                 Key: LUCENENET-11
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-11
>             Project: Lucene.Net
>          Issue Type: Improvement
>            Reporter: Fabio Buscaroli
>         Attachments: lucene-net-exception.patch, patch.zip, patch2.zip
>
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "Joe Shaw (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LUCENENET-11?page=all ]

Joe Shaw updated LUCENENET-11:
------------------------------

    Attachment: 11_charstream-no-exceptions.patch

I just noticed that we've had a similar patch in our tree (for Beagle) for quite some time and have been using it for over a year.  It only addresses the FastCharStream in the StandardAnalyzer, but it should be easy to apply it to the QueryParser as well.

> Avoiding non necessary exceptions
> ---------------------------------
>
>                 Key: LUCENENET-11
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-11
>             Project: Lucene.Net
>          Issue Type: Improvement
>            Reporter: Fabio Buscaroli
>         Attachments: 11_charstream-no-exceptions.patch, lucene-net-exception.patch, patch.zip, patch2.zip
>
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (LUCENENET-11) Avoiding non necessary exceptions

Posted by "Marco Dissel (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-11?page=comments#action_12444726 ] 
            
Marco Dissel commented on LUCENENET-11:
---------------------------------------

I really agree on this one.. We should add this patch and benefit of the perfomance issue..

Thanks

Marco

> Avoiding non necessary exceptions
> ---------------------------------
>
>                 Key: LUCENENET-11
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-11
>             Project: Lucene.Net
>          Issue Type: Improvement
>            Reporter: Fabio Buscaroli
>         Attachments: patch.zip, patch2.zip
>
>
> As already said in previous issues, there are few exceptions that are raised for  no reason (apparently).
> I updated  FastCharStream, QueryParserTokenManager, FieldInfos to avoid these kind of exception.
> - FastCharStream.ReadChar() returns '\0' if we are trying to read byond the end of the stream.
> - Updated QueryParserTokenManager to support the previous fix
> - Update FieldInfos.FieldName. No more reading take place if fieldNumber is -1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira