]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla 50471: Avoid ArrayIndexOutOfBoundsException for codepoints without a linebre...
authorAndreas L. Delmelle <adelmelle@apache.org>
Fri, 7 Jan 2011 21:22:40 +0000 (21:22 +0000)
committerAndreas L. Delmelle <adelmelle@apache.org>
Fri, 7 Jan 2011 21:22:40 +0000 (21:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1056518 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/text/linebreak/LineBreakStatus.java
status.xml
test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java
test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java

index df5027373031b5155b87be3f1161b84f8f921afc..157a480cc8bd341b6c2d413acb091acf9f22da3c 100644 (file)
@@ -87,6 +87,7 @@ public class LineBreakStatus {
 
         /* Initial conversions */
         switch (currentClass) {
+            case 0: // Unassigned codepoint: same treatment as AI
             case LineBreakUtils.LINE_BREAK_PROPERTY_AI:
             case LineBreakUtils.LINE_BREAK_PROPERTY_SG:
             case LineBreakUtils.LINE_BREAK_PROPERTY_XX:
index 16ef4dfe6f36b306367b3541c99d0fce6e99626c..7af44400e353017cf94c7c432ccb7aca58ae5dc7 100644 (file)
@@ -58,6 +58,9 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Code" dev="AD" type="fix" fixes-bug="50471">
+        Bugfix: avoid ArrayIndexOutOfBoundsException for codepoints without a linebreak class
+      </action>
       <action context="Layout" dev="AD" type="fix" fixes-bug="48380">
         Bugfix: avoid ClassCastException when using fox:widow-content-limit
       </action>
index 8d29361272ee10dd59d7dd69b51e534e61087968..e9b2ff90dfdac06da4cb0205f54586f88289505c 100644 (file)
@@ -320,6 +320,12 @@ public class LineBreakStatusTest extends TestCase {
             "^^^^^^" + "^"      + "_^^^^"
             ));
 
+        // Unassigned codepoint: should yield same result as AL
+        assertTrue(testBreak(
+            "No" + "\u1F7E" + "break",
+            "^^" + "^"      + "^^^^^"
+            ));
+
     }
 
     /**
index 31ad950c75fe47338d1ab3586cfbc62befcef146..bb6d209c226652c0ce7a3ebcc7b12303b3911d2c 100644 (file)
@@ -41,6 +41,7 @@ public class LineBreakUtilsTest extends TestCase {
         assertEquals(LineBreakUtils.getLineBreakProperty('\n'), LineBreakUtils.LINE_BREAK_PROPERTY_LF);
         assertEquals(LineBreakUtils.getLineBreakProperty('\r'), LineBreakUtils.LINE_BREAK_PROPERTY_CR);
         assertEquals(LineBreakUtils.getLineBreakProperty('('), LineBreakUtils.LINE_BREAK_PROPERTY_OP);
+        assertEquals(LineBreakUtils.getLineBreakProperty('\u1F7E'), 0);
     }
 
     public void testLineBreakPair() {