[zeromq-dev] Java binding proposed changes

gonzalo diethelm gdiethelm at dcv.cl
Thu Apr 1 14:44:26 CEST 2010


> > The rule of the thumb is: When the problem shouldn't happen - i.e.
> > there's a bug in 0MQ of Java binding - assert. If the problem can be
> > caused by the user raise an exception.
> 
> Ok, if that is the rule there are several assert() calls that will
stay
> the same; perhaps all of them. I will report back.

Find attached a patch that does the following:

* Move the raise_exception() function to a separate util.{hpp,cpp} file;
it is used from Socket.cpp and Poller.cpp.
* Use assert() only when signaling an error that the user cannot do
anything about; in all other cases, raise an exception.
* Check the error code returned by all calls to 0MQ functions (there
were a few missing). When checking this, always do (rc != 0) instead of
(rc == -1).
* After a call to a 0MQ function, assign errno to err; this is to ensure
errno is not overwritten after the 0MQ call but before raising an
exception that reports that error.
* Make sure multiple initialization / finalizations of Context and
Socket have no effect, to allow explicit calls to term() / close().

I know I have write access to the Java binding repo, but I prefer to
show my changes before committing them. Any comments before I do?

-- 
Gonzalo Diethelm





----------------------------------------- 
Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena. 
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje. 

"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law. 
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message. 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: assert-patch.txt
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100401/f2b365a4/attachment.txt>


More information about the zeromq-dev mailing list