jaroslav@70
|
1 |
/*
|
jaroslav@70
|
2 |
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
|
jaroslav@70
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
jaroslav@70
|
4 |
*
|
jaroslav@70
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
jaroslav@70
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
jaroslav@70
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
jaroslav@70
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
jaroslav@70
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
jaroslav@70
|
10 |
*
|
jaroslav@70
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
jaroslav@70
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
jaroslav@70
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
jaroslav@70
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
jaroslav@70
|
15 |
* accompanied this code).
|
jaroslav@70
|
16 |
*
|
jaroslav@70
|
17 |
* You should have received a copy of the GNU General Public License version
|
jaroslav@70
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
jaroslav@70
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
jaroslav@70
|
20 |
*
|
jaroslav@70
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
jaroslav@70
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
jaroslav@70
|
23 |
* questions.
|
jaroslav@70
|
24 |
*/
|
jaroslav@70
|
25 |
|
jaroslav@70
|
26 |
package java.lang;
|
jaroslav@70
|
27 |
|
jaroslav@70
|
28 |
/**
|
jaroslav@70
|
29 |
* Thrown when an application attempts to use {@code null} in a
|
jaroslav@70
|
30 |
* case where an object is required. These include:
|
jaroslav@70
|
31 |
* <ul>
|
jaroslav@70
|
32 |
* <li>Calling the instance method of a {@code null} object.
|
jaroslav@70
|
33 |
* <li>Accessing or modifying the field of a {@code null} object.
|
jaroslav@70
|
34 |
* <li>Taking the length of {@code null} as if it were an array.
|
jaroslav@70
|
35 |
* <li>Accessing or modifying the slots of {@code null} as if it
|
jaroslav@70
|
36 |
* were an array.
|
jaroslav@70
|
37 |
* <li>Throwing {@code null} as if it were a {@code Throwable}
|
jaroslav@70
|
38 |
* value.
|
jaroslav@70
|
39 |
* </ul>
|
jaroslav@70
|
40 |
* <p>
|
jaroslav@70
|
41 |
* Applications should throw instances of this class to indicate
|
jaroslav@70
|
42 |
* other illegal uses of the {@code null} object.
|
jaroslav@70
|
43 |
*
|
jaroslav@70
|
44 |
* {@code NullPointerException} objects may be constructed by the
|
jaroslav@70
|
45 |
* virtual machine as if {@linkplain Throwable#Throwable(String,
|
jaroslav@70
|
46 |
* Throwable, boolean, boolean) suppression were disabled and/or the
|
jaroslav@70
|
47 |
* stack trace was not writable}.
|
jaroslav@70
|
48 |
*
|
jaroslav@70
|
49 |
* @author unascribed
|
jaroslav@70
|
50 |
* @since JDK1.0
|
jaroslav@70
|
51 |
*/
|
jaroslav@70
|
52 |
public
|
jaroslav@70
|
53 |
class NullPointerException extends RuntimeException {
|
jaroslav@70
|
54 |
private static final long serialVersionUID = 5162710183389028792L;
|
jaroslav@70
|
55 |
|
jaroslav@70
|
56 |
/**
|
jaroslav@70
|
57 |
* Constructs a {@code NullPointerException} with no detail message.
|
jaroslav@70
|
58 |
*/
|
jaroslav@70
|
59 |
public NullPointerException() {
|
jaroslav@70
|
60 |
super();
|
jaroslav@70
|
61 |
}
|
jaroslav@70
|
62 |
|
jaroslav@70
|
63 |
/**
|
jaroslav@70
|
64 |
* Constructs a {@code NullPointerException} with the specified
|
jaroslav@70
|
65 |
* detail message.
|
jaroslav@70
|
66 |
*
|
jaroslav@70
|
67 |
* @param s the detail message.
|
jaroslav@70
|
68 |
*/
|
jaroslav@70
|
69 |
public NullPointerException(String s) {
|
jaroslav@70
|
70 |
super(s);
|
jaroslav@70
|
71 |
}
|
jaroslav@70
|
72 |
}
|