[ 
https://issues.apache.org/jira/browse/QPID-498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507460
 ] 

Rafael H. Schloming commented on QPID-498:
------------------------------------------

I finally got around to looking at this patch and I have a few comments. I 
agree with your comment above that data from constants.py should be loaded from 
the spec file. 

My other comment on codec.py is that it doesn't seem quite right for codec.py 
to be throwing the kinds of exceptions you have in exceptions.py. The 
exceptions you have in exceptions.py correspond to protocol errors used to 
indicate error conditions encountered by the other peer in an AMQP interaction. 
This is not the case the way you have used them in codec.py. For example you've 
used SyntaxErrorException in codec.py to indicate an attempt to locally encode 
a bad value. The error condition is actually defined by the protocol as meaning 
that a bad value was read off of the wire, and as such the SyntaxErrorException 
documentation doesn't acurrately reflect what has occured where you use it in 
codec.py. It also seems to violate the exception hierarchy you have created 
since SyntaxErrorException is a ConnectionException which should indicate that 
the peer closed the connection, but would not in this case. I've always viewed 
codec.py as purely an encoding/decoding utility that may not even know it is 
talking over a socket, so I would probably expand the codec.EOF exception into 
a small exception hierarchy that has the necessary granularity to indicate the 
various overflow conditions you have added.

Additionally I'm not sure I would include all the exceptions you have in 
exceptions.py. The details of each error condition depend on the precise 
version of the spec in question, and in general I've been avoiding putting 
version dependant code into this codebase as it needs to function as a version 
agnostic testing tool. The approach I would take is to stick with only channel 
and connection exceptions, and have them simply include the error code and 
description as fields. I believe this keeps the code version independent and 
permits users of the API to check the details of the particular error case if 
they so wish.


> python code.py handling of data types beyond acceptable range.
> --------------------------------------------------------------
>
>                 Key: QPID-498
>                 URL: https://issues.apache.org/jira/browse/QPID-498
>             Project: Qpid
>          Issue Type: Bug
>          Components: Python Client
>            Reporter: Jimmy John
>            Assignee: Rafael H. Schloming
>            Priority: Minor
>         Attachments: codec.py, constants.py, exception.py
>
>
> Perform range checking on all data types such as octet[0,255], 
> short[0,65535], long etc. [Refer QPID-497 for unit test that detects these 
> bugs]

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

Reply via email to