1/* GENERATED SOURCE. DO NOT MODIFY. */
2// © 2016 and later: Unicode, Inc. and others.
3// License & terms of use: http://www.unicode.org/copyright.html#License
4/*
5 *******************************************************************************
6 * Copyright (C) 2009-2012, International Business Machines Corporation and    *
7 * others. All Rights Reserved.                                                *
8 *******************************************************************************
9 */
10package android.icu.util;
11
12/**
13 * Thrown by methods in {@link ULocale} and {@link ULocale.Builder} to
14 * indicate that an argument is not a well-formed BCP 47 tag.
15 *
16 * @see ULocale
17 */
18public class IllformedLocaleException extends RuntimeException {
19
20    private static final long serialVersionUID = 1L;
21
22    private int _errIdx = -1;
23
24    /**
25     * Constructs a new <code>IllformedLocaleException</code> with no
26     * detail message and -1 as the error index.
27     */
28    public IllformedLocaleException() {
29        super();
30    }
31
32    /**
33     * Constructs a new <code>IllformedLocaleException</code> with the
34     * given message and -1 as the error index.
35     *
36     * @param message the message
37     */
38    public IllformedLocaleException(String message) {
39        super(message);
40    }
41
42    /**
43     * Constructs a new <code>IllformedLocaleException</code> with the
44     * given message and the error index.  The error index is the approximate
45     * offset from the start of the ill-formed value to the point where the
46     * parse first detected an error.  A negative error index value indicates
47     * either the error index is not applicable or unknown.
48     *
49     * @param message the message
50     * @param errorIndex the index
51     */
52    public IllformedLocaleException(String message, int errorIndex) {
53        super(message + ((errorIndex < 0) ? "" : " [at index " + errorIndex + "]"));
54        _errIdx = errorIndex;
55    }
56
57    /**
58     * Returns the index where the error was found. A negative value indicates
59     * either the error index is not applicable or unknown.
60     *
61     * @return the error index
62     */
63    public int getErrorIndex() {
64        return _errIdx;
65    }
66}
67