src/java.base/share/classes/java/text/ParseException.java
author naoto
Tue, 15 Oct 2019 09:25:59 -0700
changeset 58603 2312d1a04c49
parent 57956 e0b8b019d2f5
child 59201 b24f4caa1411
permissions -rw-r--r--
8212749: DecimalFormat.setGroupingSize(int) allows setting negative grouping size 8231984: Clarify semantics of DecimalFormat.getGroupingSize(0) Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
57956
e0b8b019d2f5 8229997: Apply java.io.Serial annotations in java.base
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *   The original version of this source code and documentation is copyrighted
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * materials are provided under terms of a License Agreement between Taligent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * and Sun. This technology is protected by multiple US and International
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * patents. This notice and attribution to Taligent may not be removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *   Taligent is a registered trademark of Taligent, Inc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
package java.text;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * Signals that an error has been reached unexpectedly
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * while parsing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @see java.lang.Exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @see java.text.Format
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @see java.text.FieldPosition
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @author      Mark Davis
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 25859
diff changeset
    48
 * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
public
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
class ParseException extends Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
57956
e0b8b019d2f5 8229997: Apply java.io.Serial annotations in java.base
darcy
parents: 47216
diff changeset
    53
    @java.io.Serial
12848
da701d422d2c 7117230: clean up warnings in java.text
dbhole
parents: 5506
diff changeset
    54
    private static final long serialVersionUID = 2703218443322787634L;
da701d422d2c 7117230: clean up warnings in java.text
dbhole
parents: 5506
diff changeset
    55
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * Constructs a ParseException with the specified detail message and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * offset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * A detail message is a String that describes this particular exception.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
    60
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * @param s the detail message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @param errorOffset the position where the error is found while parsing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public ParseException(String s, int errorOffset) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        super(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        this.errorOffset = errorOffset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * Returns the position where the error was found.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
    71
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
    72
     * @return the position where the error was found
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public int getErrorOffset () {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        return errorOffset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    //============ privates ============
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * The zero-based character offset into the string being parsed at which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * the error was found during parsing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    private int errorOffset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
}