2 *******************************************************************************
3 * Copyright (C) 2009-2011, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 package com.ibm.icu.util;
10 * Thrown by methods in {@link ULocale} and {@link ULocale.Builder} to
11 * indicate that an argument is not a well-formed BCP 47 tag.
15 * @provisional This API might change or be removed in a future release.
17 public class IllformedLocaleException extends RuntimeException {
19 private static final long serialVersionUID = 1L;
21 private int _errIdx = -1;
24 * Constructs a new <code>IllformedLocaleException</code> with no
25 * detail message and -1 as the error index.
27 * @provisional This API might change or be removed in a future release.
29 public IllformedLocaleException() {
34 * Constructs a new <code>IllformedLocaleException</code> with the
35 * given message and -1 as the error index.
37 * @param message the message
39 * @provisional This API might change or be removed in a future release.
41 public IllformedLocaleException(String message) {
46 * Constructs a new <code>IllformedLocaleException</code> with the
47 * given message and the error index. The error index is the approximate
48 * offset from the start of the ill-formed value to the point where the
49 * parse first detected an error. A negative error index value indicates
50 * either the error index is not applicable or unknown.
52 * @param message the message
53 * @param errorIndex the index
55 * @provisional This API might change or be removed in a future release.
57 public IllformedLocaleException(String message, int errorIndex) {
58 super(message + ((errorIndex < 0) ? "" : " [at index " + errorIndex + "]"));
63 * Returns the index where the error was found. A negative value indicates
64 * either the error index is not applicable or unknown.
66 * @return the error index
68 * @provisional This API might change or be removed in a future release.
70 public int getErrorIndex() {