src/java.naming/share/classes/javax/naming/LinkException.java
author darcy
Wed, 09 Oct 2019 18:23:20 -0700
changeset 58531 9b40d05c9f66
parent 47216 71c04702a3d5
permissions -rw-r--r--
8232076: Suppress warnings on non-serializable non-transient instance fields java.naming Reviewed-by: lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58531
9b40d05c9f66 8232076: Suppress warnings on non-serializable non-transient instance fields java.naming
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 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
package javax.naming;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
22974
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
    29
 * This exception is used to describe problems encountered while resolving links.
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
    30
 * Additional information is added to the base NamingException for pinpointing
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * the problem with the link.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *<p>
22974
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
    33
 * Analogously to how NamingException captures name resolution information,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * LinkException captures "link"-name resolution information pinpointing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * the problem encountered while resolving a link. All these fields may
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <li> Link Resolved Name. Portion of link name that has been resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <li> Link Resolved Object. Object to which resolution of link name proceeded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <li> Link Remaining Name. Portion of link name that has not been resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <li> Link Explanation. Detail explaining why link resolution failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
  *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  * A LinkException instance is not synchronized against concurrent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  * multithreaded access. Multiple threads trying to access and modify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  * a single LinkException instance should lock the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
  * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  * @see Context#lookupLink
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  * @see LinkRef
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
  * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  /*<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  * The serialized form of a LinkException object consists of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  * serialized fields of its NamingException superclass, the link resolved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  * name (a Name object), the link resolved object, link remaining name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  * (a Name object), and the link explanation String.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
public class LinkException extends NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Contains the part of the link that has been successfully resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * It is a composite name and can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * This field is initialized by the constructors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * You should access and manipulate this field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * through its get and set methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @see #getLinkResolvedName
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @see #setLinkResolvedName
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    protected Name linkResolvedName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
      * Contains the object to which resolution of the part of the link was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
      * Can be null. This field is initialized by the constructors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
      * You should access and manipulate this field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
      * through its get and set methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
      * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
      * @see #getLinkResolvedObj
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
      * @see #setLinkResolvedObj
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
      */
58531
9b40d05c9f66 8232076: Suppress warnings on non-serializable non-transient instance fields java.naming
darcy
parents: 47216
diff changeset
    88
    @SuppressWarnings("serial") // Not statically typed as Serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    protected Object linkResolvedObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * Contains the remaining link name that has not been resolved yet.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * It is a composite name and can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * This field is initialized by the constructors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * You should access and manipulate this field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * through its get and set methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @see #getLinkRemainingName
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @see #setLinkRemainingName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    protected Name linkRemainingName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * Contains the exception of why resolution of the link failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * Can be null. This field is initialized by the constructors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * You should access and manipulate this field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * through its get and set methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @see #getLinkExplanation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @see #setLinkExplanation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    protected String linkExplanation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
22974
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
   115
      * Constructs a new instance of LinkException with an explanation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      * All the other fields are initialized to null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      * @param  explanation     A possibly null string containing additional
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
      *                         detail about this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
      * @see java.lang.Throwable#getMessage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public LinkException(String explanation) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        super(explanation);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        linkResolvedName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        linkResolvedObj = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        linkRemainingName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        linkExplanation = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
      * Constructs a new instance of LinkException.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
      * All the non-link-related and link-related fields are initialized to null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public LinkException() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        linkResolvedName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        linkResolvedObj = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        linkRemainingName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        linkExplanation = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * Retrieves the leading portion of the link name that was resolved
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * successfully.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @return The part of the link name that was resolved successfully.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     *          It is a composite name. It can be null, which means
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     *          the link resolved name field has not been set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @see #getLinkResolvedObj
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @see #setLinkResolvedName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public Name getLinkResolvedName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        return this.linkResolvedName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * Retrieves the remaining unresolved portion of the link name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @return The part of the link name that has not been resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *          It is a composite name. It can be null, which means
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *          the link remaining name field has not been set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * @see #setLinkRemainingName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    public Name getLinkRemainingName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        return this.linkRemainingName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * Retrieves the object to which resolution was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * This is the object to which the resolved link name is bound.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * @return The possibly null object that was resolved so far.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * If null, it means the link resolved object field has not been set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * @see #getLinkResolvedName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @see #setLinkResolvedObj
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    public Object getLinkResolvedObj() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        return this.linkResolvedObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    /**
22974
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
   180
      * Retrieves the explanation associated with the problem encountered
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      * when resolving a link.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      * @return The possibly null detail string explaining more about the problem
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      * with resolving a link.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
      *         If null, it means there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
      *         link detail message for this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
      * @see #setLinkExplanation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    public String getLinkExplanation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        return this.linkExplanation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /**
22974
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
   194
      * Sets the explanation associated with the problem encountered
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
      * when resolving a link.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
      * @param msg The possibly null detail string explaining more about the problem
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
      * with resolving a link. If null, it means no detail will be recorded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      * @see #getLinkExplanation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    public void setLinkExplanation(String msg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        this.linkExplanation = msg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * Sets the resolved link name field of this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   208
     * {@code name} is a composite name. If the intent is to set
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * this field using a compound name or string, you must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * "stringify" the compound name, and create a composite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * name with a single component using the string. You can then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * invoke this method using the resulting composite name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * A copy of <code>name</code> is made and stored.
22974
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
   215
     * Subsequent changes to <code>name</code> do not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * affect the copy in this NamingException and vice versa.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * @param name The name to set resolved link name to. This can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *          If null, it sets the link resolved name field to null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @see #getLinkResolvedName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public void setLinkResolvedName(Name name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        if (name != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            this.linkResolvedName = (Name)(name.clone());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            this.linkResolvedName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * Sets the remaining link name field of this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   234
     * {@code name} is a composite name. If the intent is to set
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * this field using a compound name or string, you must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * "stringify" the compound name, and create a composite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * name with a single component using the string. You can then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * invoke this method using the resulting composite name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * A copy of <code>name</code> is made and stored.
22974
4bf6c0d73bb8 4682009: Typo in javadocs in javax/naming
igerasim
parents: 5506
diff changeset
   241
     * Subsequent changes to <code>name</code> do not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * affect the copy in this NamingException and vice versa.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @param name The name to set remaining link name to. This can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     *  If null, it sets the remaining name field to null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * @see #getLinkRemainingName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    public void setLinkRemainingName(Name name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        if (name != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            this.linkRemainingName = (Name)(name.clone());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            this.linkRemainingName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * Sets the link resolved object field of this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * This indicates the last successfully resolved object of link name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @param obj The object to set link resolved object to. This can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     *            If null, the link resolved object field is set to null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @see #getLinkResolvedObj
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    public void setLinkResolvedObj(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        this.linkResolvedObj = obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * Generates the string representation of this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * This string consists of the NamingException information plus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * the link's remaining name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * This string is used for debugging and not meant to be interpreted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * programmatically.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @return The non-null string representation of this link exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        return super.toString() + "; Link Remaining Name: '" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            this.linkRemainingName + "'";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * Generates the string representation of this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * This string consists of the NamingException information plus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * the additional information of resolving the link.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * If 'detail' is true, the string also contains information on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * the link resolved object. If false, this method is the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * as the form of toString() that accepts no parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * This string is used for debugging and not meant to be interpreted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * programmatically.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * @param   detail  If true, add information about the link resolved
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     *                  object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * @return The non-null string representation of this link exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    public String toString(boolean detail) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        if (!detail || this.linkResolvedObj == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            return this.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        return this.toString() + "; Link Resolved Object: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            this.linkResolvedObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * Use serialVersionUID from JNDI 1.1.1 for interoperability
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    private static final long serialVersionUID = -7967662604076777712L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
};