<p dir="ltr">Hi Junxiao,</p>
<p dir="ltr">Well, I guess I'm having an enlightenment. Is a link object decoded first, then processed e.g. add/removeDelegation, signed and stuff?</p>
<p dir="ltr">Thanks,<br>
Sabet</p>
<div class="gmail_extra"><br><div class="gmail_quote">On 23 Oct 2016 6:54 pm, "Junxiao Shi" <<a href="mailto:shijunxiao@email.arizona.edu">shijunxiao@email.arizona.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Sabet<div><br></div><div>#<a href="https://redmine.named-data.net/issues/3803#note-6" target="_blank">3803-6</a> has decided that Link without delegation is invalid. Therefore, it's correct for <font face="monospace, monospace">Link(const Block&)</font> constructor to throw an exception.<br><div>However, the snippet quoted below isn't implemented correctly. It attempts to access m_delegations before calling wireDecode, but m_delegations is not populated until wireDecode is executed. Thus, the exception will always be thrown.</div><div>While moving the check after wireDecode call would solve the problem, the proper place for this check is at the end of wireDecode, because some programs may elect to default-construct a Link instance, and invoke wireDecode with a block to decode ( <font face="monospace, monospace">Link link; link.wireDecode(block);</font> ), and an exception should be thrown in that situation as well.</div><div><br></div><div>Yours, Junxiao<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 20, 2016 at 10:40 AM, Muhammad Hosain Abdollahi Sabet <span dir="ltr"><<a href="mailto:mhasabet@gmail.com" target="_blank">mhasabet@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="tahoma, sans-serif"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Link::Link(const Block& block)<br>{<br>  if(m_delegations.empty()){<br>      BOOST_THROW_EXCEPTION(Error("L<wbr>ink object has no delegationName!"));<br>  }<br>  wireDecode(block);<br>}<br></blockquote><div><br></div></div></font></div></blockquote></div></div></div></div></div>
</blockquote></div></div>