]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/classes/core/src/com/ibm/icu/util/IllformedLocaleException.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / classes / core / src / com / ibm / icu / util / IllformedLocaleException.java
1 /*\r
2  *******************************************************************************\r
3  * Copyright (C) 2009, International Business Machines Corporation and         *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 package com.ibm.icu.util;\r
8 \r
9 /**\r
10  * Thrown by methods in Locale class to indicate that a locale string\r
11  * is illformed.\r
12  * \r
13  * @draft ICU 4.2\r
14  * @provisional This API might change or be removed in a future release.\r
15  */\r
16 public class IllformedLocaleException extends IllegalArgumentException {\r
17 \r
18     private static final long serialVersionUID = 1L;\r
19 \r
20     private int _errIdx = -1;\r
21 \r
22     /**\r
23      * Constructs a new <code>IllformedLocaleException</code> with\r
24      * the detail message.\r
25      * @param msg the detail message\r
26      * @draft ICU 4.2\r
27      * @provisional This API might change or be removed in a future release.\r
28      */\r
29     public IllformedLocaleException(String msg) {\r
30         this(msg, -1);\r
31     }\r
32 \r
33     /**\r
34      * Constructs a new <code>IllformedLocaleException</code> with\r
35      * the detail message and the error index.\r
36      * @param msg the detail message\r
37      * @param errIdx the index where the error is found in a locale string\r
38      * @draft ICU 4.2\r
39      * @provisional This API might change or be removed in a future release.\r
40      */\r
41     public IllformedLocaleException(String msg, int errIdx) {\r
42         super(msg + ((errIdx == -1) ? "" : " [at index " + errIdx + "]"));\r
43         _errIdx = errIdx;\r
44     }\r
45 \r
46     /**\r
47      * Returns the index where the error is found in a locale string\r
48      * @return the index where the error is found in a locale string or\r
49      *         -1 if unknown.\r
50      * @draft ICU 4.2\r
51      * @provisional This API might change or be removed in a future release.\r
52      */\r
53     public int getErrorIndex() {\r
54         return _errIdx;\r
55     }\r
56 }\r