equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
67 * @param s the detail message. |
67 * @param s the detail message. |
68 */ |
68 */ |
69 public NullPointerException(String s) { |
69 public NullPointerException(String s) { |
70 super(s); |
70 super(s); |
71 } |
71 } |
|
72 |
|
73 /** |
|
74 * Returns the detail message string of this throwable. |
|
75 * |
|
76 * If no explicit message was passed to the constructor, and as |
|
77 * long as certain internal information is available, a verbose |
|
78 * description of the null entity is returned. After releasing the |
|
79 * internal information, e.g., after serialization, null will be |
|
80 * returned in this case. |
|
81 * |
|
82 * @return the detail message string of this {@code NullPointerException} instance |
|
83 * (which may be {@code null}). |
|
84 */ |
|
85 public String getMessage() { |
|
86 String message = super.getMessage(); |
|
87 if (message == null) { |
|
88 return getExtendedNPEMessage(); |
|
89 } |
|
90 return message; |
|
91 } |
|
92 |
|
93 // Get an extended exception message. This returns a string describing |
|
94 // the location and cause of the exception. It returns null for |
|
95 // exceptions where this is not applicable. |
|
96 private native String getExtendedNPEMessage(); |
72 } |
97 } |