jdk/test/java/text/Bidi/Bug7041232.java
author peytoia
Wed, 11 May 2011 08:02:44 +0900
changeset 9668 13c8e69958e6
permissions -rw-r--r--
7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64 Reviewed-by: okutsu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9668
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     1
/*
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     4
 *
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     7
 * published by the Free Software Foundation.
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     8
 *
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    13
 * accompanied this code).
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    14
 *
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    18
 *
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    21
 * questions.
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    22
 */
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    23
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    24
/*
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    25
 * @test
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    26
 * @bug 7041232
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    27
 * @summary verify that an unexpected exception isn't thrown for unnatural data to keep backward compatibility with JDK 6.
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    28
 */
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    29
import java.text.*;
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    30
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    31
public class Bug7041232 {
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    32
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    33
    public static void main(String[] args) {
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    34
        String UnicodeChars;
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    35
        StringBuffer sb = new StringBuffer();
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    36
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    37
        // Generates String which includes U+2028(line separator) and
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    38
        // U+2029(paragraph separator)
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    39
        for (int i = 0x2000; i < 0x2100; i++) {
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    40
            sb.append((char)i);
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    41
        }
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    42
        UnicodeChars = sb.toString();
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    43
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    44
        Bidi bidi = new Bidi(UnicodeChars, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    45
        bidi.createLineBidi(0, UnicodeChars.length());
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    46
    }
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    47
13c8e69958e6 7041232: IllegalArgumentException in sun.text.bidi.BidiBase.setLine starting from JDK 7 b64
peytoia
parents:
diff changeset
    48
}