Author: ssteiner
Date: Thu Jun  8 10:11:33 2017
New Revision: 1798040

URL: http://svn.apache.org/viewvc?rev=1798040&view=rev
Log:
FOP-2712: NoSuchElementException on changing IPD

Added:
    
xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_13.xml
   (with props)
Modified:
    
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java

Modified: 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=1798040&r1=1798039&r2=1798040&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java
 (original)
+++ 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java
 Thu Jun  8 10:11:33 2017
@@ -778,10 +778,12 @@ public abstract class AbstractBreaker {
              * Remove the last 3 penalty-filler-forced break elements that 
were added by
              * the Knuth algorithm. They will be re-added later on.
              */
-            ListIterator iter = returnedList.listIterator(returnedList.size());
-            for (int i = 0; i < 3; i++) {
-                iter.previous();
-                iter.remove();
+            if (returnedList.size() > 2) {
+                ListIterator iter = 
returnedList.listIterator(returnedList.size());
+                for (int i = 0; i < 3; i++) {
+                    iter.previous();
+                    iter.remove();
+                }
             }
         } else {
             returnedList = getNextKnuthElements(childLC, alignment, 
positionAtIPDChange,

Added: 
xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_13.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_13.xml?rev=1798040&view=auto
==============================================================================
--- 
xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_13.xml
 (added)
+++ 
xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_13.xml
 Thu Jun  8 10:11:33 2017
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks that the definition of a special page-master for the 
last page with a
+      different width that the previous "rest" page causes FOP to redo the 
line breaking layout.
+    </p>
+  </info>
+  <fo>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"; 
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"; 
xmlns:svg="http://www.w3.org/2000/svg";>
+  <fo:layout-master-set>
+    <fo:simple-page-master margin-top=".50in" margin-right=".75in" 
margin-left=".75in" margin-bottom="0.375in" master-name="Cover" 
page-width="8.5in" page-height="11in">
+      <fo:region-body margin-top="1.25in" margin-bottom=".75in" 
column-gap=".375in" column-count="2" region-name="Body"/>
+      
+    </fo:simple-page-master>
+    <fo:simple-page-master margin-top="0.50in" master-name="Rest" 
page-width="8.5in" page-height="11in" margin-bottom="0.375in" 
margin-right="0.75in" margin-left="0.75in">
+      <fo:region-body margin-top="1in" margin-bottom="0.375in" 
region-name="Body"/>
+      
+    </fo:simple-page-master>
+    <fo:page-sequence-master master-name="all">
+      <fo:repeatable-page-master-reference maximum-repeats="1" 
master-reference="Cover"/>
+      <fo:repeatable-page-master-reference maximum-repeats="no-limit" 
master-reference="Rest"/>
+    </fo:page-sequence-master>
+  </fo:layout-master-set>
+  <fo:page-sequence format="1" id="th_default_sequence1" 
force-page-count="auto" master-reference="all">
+  
+    <fo:flow flow-name="Body">
+      <fo:block margin-bottom=".375in" span="all">
+        <fo:table table-layout="fixed" width="100%">
+          <fo:table-column column-width="proportional-column-width(42.89)" 
column-number="1"/>
+          <fo:table-column column-width="proportional-column-width(57.11)" 
column-number="2"/>
+          <fo:table-body>
+            <fo:table-row>
+              <fo:table-cell text-align="justify" number-columns-spanned="2">
+                <fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal" 
text-align="left">The</fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+            <fo:table-row>
+              <fo:table-cell text-align="justify" number-columns-spanned="2">
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+            <fo:table-row>
+              <fo:table-cell text-align="justify" border-bottom-color="black" 
border-bottom-style="solid" border-bottom-width="0.5pt" 
border-top-color="black" border-top-style="solid" border-top-width="0.5pt">
+                <fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal" 
padding-top="4pt">
+              
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell text-align="justify">
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+            <fo:table-row>
+              <fo:table-cell text-align="justify" number-columns-spanned="2">
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal" 
text-align="left">This</fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal">test test 
test test test test test test test test test test test test test test test test 
test test test test test test test test test test.</fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+          </fo:table-body>
+        </fo:table>
+        <fo:block  font-size="10pt" font-weight="normal">
+          <fo:leader/>
+        </fo:block>
+        <fo:table table-layout="fixed" width="100%">
+          <fo:table-column column-width="proportional-column-width(42.77)" 
column-number="1"/>
+          <fo:table-column column-width="proportional-column-width(57.23)" 
column-number="2"/>
+          <fo:table-body>
+            <fo:table-row>
+              <fo:table-cell border-bottom-color="black" 
border-bottom-style="solid" border-bottom-width="0.5pt" 
border-top-color="black" border-top-style="solid" border-top-width="0.5pt">
+                <fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal" 
padding-top="4pt">
+                   
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+          </fo:table-body>
+        </fo:table>
+        <fo:block  font-size="10pt" font-weight="normal">
+          <fo:leader/>
+        </fo:block>
+        <fo:table table-layout="fixed" width="100%">
+          <fo:table-column column-width="proportional-column-width(100)" 
column-number="1"/>
+          <fo:table-body>
+            <fo:table-row>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal" 
text-align="left">For</fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:list-block  font-size="10pt" font-weight="normal">
+                    <fo:list-item  font-size="10pt" font-weight="normal" 
padding-top="4pt">
+                      <fo:list-item-label  font-size="10pt" >
+                        <fo:block>1.</fo:block>
+                      </fo:list-item-label>
+                      <fo:list-item-body  font-size="10pt" start-indent="18pt">
+                        <fo:block>
+                          </fo:block>
+                      </fo:list-item-body>
+                    </fo:list-item>
+                  </fo:list-block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:list-block  font-size="10pt" font-weight="normal" 
start-indent="18pt">
+                    <fo:list-item  font-size="10pt" font-weight="normal" 
padding-top="4pt">
+                      <fo:list-item-label  font-size="10pt" >
+                        <fo:block>a.</fo:block>
+                      </fo:list-item-label>
+                      <fo:list-item-body  font-size="10pt" start-indent="36pt">
+                        <fo:block>test test test test test test test test test 
test test test test test test test test test test test test test test test test 
test test test.</fo:block>
+                      </fo:list-item-body>
+                    </fo:list-item>
+                  </fo:list-block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:list-block  font-size="10pt" font-weight="normal" 
start-indent="18pt">
+                    <fo:list-item  font-size="10pt" font-weight="normal" 
padding-top="4pt">
+                      <fo:list-item-label  font-size="10pt" >
+                        <fo:block>b.</fo:block>
+                      </fo:list-item-label>
+                      <fo:list-item-body  font-size="10pt" start-indent="36pt">
+                        <fo:block>“Your” original cost of the property 
covered.  If “you” have valued that property covered higher or lower on 
“your” last written physical inventory, as reported on the Application 
attached to this policy, “we” will use that amount.</fo:block>
+                      </fo:list-item-body>
+                    </fo:list-item>
+                  </fo:list-block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:list-block  font-size="10pt" font-weight="normal" 
start-indent="18pt">
+                    <fo:list-item  font-size="10pt" font-weight="normal" 
padding-top="4pt">
+                      <fo:list-item-label  font-size="10pt" >
+                        <fo:block>c.</fo:block>
+                      </fo:list-item-label>
+                      <fo:list-item-body  font-size="10pt" start-indent="36pt">
+                        <fo:block>The</fo:block>
+                      </fo:list-item-body>
+                    </fo:list-item>
+                  </fo:list-block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:list-block  font-size="10pt" font-weight="normal" 
start-indent="18pt">
+                    <fo:list-item  font-size="10pt" font-weight="normal" 
padding-top="4pt">
+                      <fo:list-item-label  font-size="10pt" >
+                        <fo:block>d.</fo:block>
+                      </fo:list-item-label>
+                      <fo:list-item-body  font-size="10pt" start-indent="36pt">
+                        <fo:block>test test test test test test test test test 
test test test test test test test test test test test test test test test test 
test test test.</fo:block>
+                      </fo:list-item-body>
+                    </fo:list-item>
+                  </fo:list-block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal" 
padding-top="4pt" start-indent="18pt" text-align="left">test test test test 
test test test test test test test test test test test test test test test test 
test test test test test test test test.</fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+          </fo:table-body>
+        </fo:table>
+        <fo:block  font-size="10pt" font-weight="normal">
+          <fo:leader/>
+        </fo:block>
+        <fo:table border-collapse="separate"  font-size="10pt" 
font-weight="normal" table-layout="fixed" width="100%">
+          <fo:table-column 
column-width="proportional-column-width(33.3333333333333)" column-number="1"/>
+          <fo:table-column 
column-width="proportional-column-width(33.3333333333333)" column-number="2"/>
+          <fo:table-column 
column-width="proportional-column-width(33.3333333333333)" column-number="3"/>
+          <fo:table-header>
+            <fo:table-row display-align="after" padding-after="-5px" 
space-after="0pt" space-before="0pt">
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+         
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+               
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+          </fo:table-header>
+          <fo:table-body>
+            <fo:table-row display-align="after" padding-after="-5px" 
space-after="0pt" space-before="0pt">
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>1</fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:block>
+    
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+          </fo:table-body>
+          <fo:table-body>
+            <fo:table-row>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+              <fo:table-cell>
+                <fo:block>
+                  <fo:block>
+                    <fo:leader/>
+                  </fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+          </fo:table-body>
+        </fo:table>
+        <fo:table border-collapse="separate"  font-size="10pt" 
font-weight="normal" table-layout="fixed" width="100%">
+          <fo:table-column column-width="proportional-column-width(100)" 
column-number="1"/>
+          <fo:table-body>
+            <fo:table-row>
+              <fo:table-cell>
+                <fo:block>
+
+                  <fo:block  font-size="10pt" font-weight="normal" 
text-align="left">test test test test test test test test test test test test 
test test test test test test test test test test test test test test test 
test.</fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal" 
text-align="left">The insured must maintain a weekly log of all purchases of 
gold and other precious metals from the public.  This log must include the 
name of the customer who you purchased the item from, the amount paid to the 
customer along with the payment type, a description of each item purchased 
including type of metal, weight in grams or pennyweights, and karat weight for 
each item purchased.</fo:block>
+                  <fo:block  font-size="10pt" font-weight="normal">
+                    <fo:leader/>
+                  </fo:block>
+                  <fo:block>Prior to all shipments, a description of the 
various items and their respective weights must be recorded.  This must 
include details of each item being shipped, including a description of each 
item, weight of each item in grams or pennyweights, and karat weight of each 
item being shipped.</fo:block>
+                </fo:block>
+              </fo:table-cell>
+            </fo:table-row>
+          </fo:table-body>
+        </fo:table>
+      </fo:block>
+    </fo:flow>
+  </fo:page-sequence>
+</fo:root>
+</fo>
+  <checks>
+    <eval expected="Prior" xpath="//pageViewport[2]//word[1]"/>
+  </checks>
+</testcase>

Propchange: 
xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_13.xml
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-h...@xmlgraphics.apache.org

Reply via email to