From dfa4c54704d8c10499557fd6dc2ab4312aa84a2c Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Fri, 7 Jan 2011 21:22:40 +0000 Subject: [PATCH] Bugzilla 50471: Avoid ArrayIndexOutOfBoundsException for codepoints without a linebreak class 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 | 1 + status.xml | 3 +++ .../org/apache/fop/text/linebreak/LineBreakStatusTest.java | 6 ++++++ .../org/apache/fop/text/linebreak/LineBreakUtilsTest.java | 1 + 4 files changed, 11 insertions(+) diff --git a/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java b/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java index df5027373..157a480cc 100644 --- a/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java +++ b/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java @@ -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: diff --git a/status.xml b/status.xml index 16ef4dfe6..7af44400e 100644 --- a/status.xml +++ b/status.xml @@ -58,6 +58,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Bugfix: avoid ArrayIndexOutOfBoundsException for codepoints without a linebreak class + Bugfix: avoid ClassCastException when using fox:widow-content-limit diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java index 8d2936127..e9b2ff90d 100644 --- a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java +++ b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java @@ -320,6 +320,12 @@ public class LineBreakStatusTest extends TestCase { "^^^^^^" + "^" + "_^^^^" )); + // Unassigned codepoint: should yield same result as AL + assertTrue(testBreak( + "No" + "\u1F7E" + "break", + "^^" + "^" + "^^^^^" + )); + } /** diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java index 31ad950c7..bb6d209c2 100644 --- a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java +++ b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java @@ -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() { -- 2.39.5