You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Vincent Hennebert <vi...@anyware-tech.com> on 2008/05/29 18:23:00 UTC
try without catch in BlockStackingLM.getNextKnuthElements
Hi,
Could anybody explain me what is the purpose of the following piece of
code:
if (!breakBeforeServed) {
try {
if (addKnuthElementsForBreakBefore(returnList, context)) {
return returnList;
}
} finally {
breakBeforeServed = true;
}
}
that we can find, for instance, in BlockStackingLM.getNextKnuthElements?
Isn’t it equivalent to the following:
if (!breakBeforeServed) {
breakBeforeServed = true;
if (addKnuthElementsForBreakBefore(returnList, context)) {
return returnList;
}
}
Maybe I’m missing something obvious...
Thanks,
Vincent
--
Vincent Hennebert Anyware Technologies
http://people.apache.org/~vhennebert http://www.anyware-tech.com
Apache FOP Committer FOP Development/Consulting
Re: try without catch in BlockStackingLM.getNextKnuthElements
Posted by Andreas Delmelle <an...@telenet.be>.
On Jun 1, 2008, at 03:40, Peter B. West wrote:
> Andreas Delmelle wrote:
>> On May 29, 2008, at 18:23, Vincent Hennebert wrote:
>>> Could anybody explain me what is the purpose of the following
>>> piece of
>>> code:
>>> if (!breakBeforeServed) {
>>> try {
>>> if (addKnuthElementsForBreakBefore(returnList,
>>> context)) {
>>> return returnList;
>>> }
>>> } finally {
>>> breakBeforeServed = true;
>>> }
>>> }
>>> that we can find, for instance, in
>>> BlockStackingLM.getNextKnuthElements?
>> Can't explain, other than that it seems to be a remnant of some
>> refactoring cycle without subsequential cleanup...
>>>
>>> Isn’t it equivalent to the following:
>>> if (!breakBeforeServed) {
>>> breakBeforeServed = true;
>>> if (addKnuthElementsForBreakBefore(returnList, context)) {
>>> return returnList;
>>> }
>>> }
>> Indeed, this has the exact same outcome AFAICT.
>>
> What's the scope of breakBeforeServed?
Protected instance member. On top of that, the method call
addKnuthElementsForBreakBefore() can only throw an Exception in case
adding elements to the passed List would fail for some reason, and
the value for breakBeforeServed is definitely not used in that method
(otherwise there would be a good reason why it's set only after the
call).
Cheers
Andreas
Re: try without catch in BlockStackingLM.getNextKnuthElements
Posted by "Peter B. West" <li...@pbw.id.au>.
Andreas Delmelle wrote:
> On May 29, 2008, at 18:23, Vincent Hennebert wrote:
>
>> Could anybody explain me what is the purpose of the following piece of
>> code:
>> if (!breakBeforeServed) {
>> try {
>> if (addKnuthElementsForBreakBefore(returnList, context)) {
>> return returnList;
>> }
>> } finally {
>> breakBeforeServed = true;
>> }
>> }
>> that we can find, for instance, in BlockStackingLM.getNextKnuthElements?
>
> Can't explain, other than that it seems to be a remnant of some
> refactoring cycle without subsequential cleanup...
>
>>
>> Isn’t it equivalent to the following:
>> if (!breakBeforeServed) {
>> breakBeforeServed = true;
>> if (addKnuthElementsForBreakBefore(returnList, context)) {
>> return returnList;
>> }
>> }
>
> Indeed, this has the exact same outcome AFAICT.
>
>
> Cheers
>
> Andreas
>
>
What's the scope of breakBeforeServed?
--
Peter B. West <http://cv.pbw.id.au/>
Folio <http://defoe.sourceforge.net/folio/>
Re: try without catch in BlockStackingLM.getNextKnuthElements
Posted by Andreas Delmelle <an...@telenet.be>.
On May 29, 2008, at 18:23, Vincent Hennebert wrote:
> Could anybody explain me what is the purpose of the following piece of
> code:
> if (!breakBeforeServed) {
> try {
> if (addKnuthElementsForBreakBefore(returnList, context)) {
> return returnList;
> }
> } finally {
> breakBeforeServed = true;
> }
> }
> that we can find, for instance, in
> BlockStackingLM.getNextKnuthElements?
Can't explain, other than that it seems to be a remnant of some
refactoring cycle without subsequential cleanup...
>
> Isn’t it equivalent to the following:
> if (!breakBeforeServed) {
> breakBeforeServed = true;
> if (addKnuthElementsForBreakBefore(returnList, context)) {
> return returnList;
> }
> }
Indeed, this has the exact same outcome AFAICT.
Cheers
Andreas