src/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


  70                 (sun.security.util.ResourcesMgr.getString
  71                         ("invalid.null.input.value",
  72                         "sun.security.util.AuthResources"));
  73             Object[] source = {"name"};
  74             throw new NullPointerException(form.format(source));
  75         }
  76 
  77         this.name = name;
  78     }
  79 
  80     /**
  81      * Create a <code>UnixNumericUserPrincipal</code> using a
  82      * long representation of the user's identification number (UID).
  83      *
  84      * <p>
  85      *
  86      * @param name the user identification number (UID) for this user
  87      *                  represented as a long.
  88      */
  89     public UnixNumericUserPrincipal(long name) {
  90         this.name = (new Long(name)).toString();
  91     }
  92 
  93     /**
  94      * Return the user identification number (UID) for this
  95      * <code>UnixNumericUserPrincipal</code>.
  96      *
  97      * <p>
  98      *
  99      * @return the user identification number (UID) for this
 100      *          <code>UnixNumericUserPrincipal</code>
 101      */
 102     public String getName() {
 103         return name;
 104     }
 105 
 106     /**
 107      * Return the user identification number (UID) for this
 108      * <code>UnixNumericUserPrincipal</code> as a long.
 109      *
 110      * <p>
 111      *
 112      * @return the user identification number (UID) for this
 113      *          <code>UnixNumericUserPrincipal</code> as a long.
 114      */
 115     public long longValue() {
 116         return ((new Long(name)).longValue());
 117     }
 118 
 119     /**
 120      * Return a string representation of this
 121      * <code>UnixNumericUserPrincipal</code>.
 122      *
 123      * <p>
 124      *
 125      * @return a string representation of this
 126      *          <code>UnixNumericUserPrincipal</code>.
 127      */
 128     public String toString() {
 129         java.text.MessageFormat form = new java.text.MessageFormat
 130                 (sun.security.util.ResourcesMgr.getString
 131                         ("UnixNumericUserPrincipal.name",
 132                         "sun.security.util.AuthResources"));
 133         Object[] source = {name};
 134         return form.format(source);
 135     }
 136 




  70                 (sun.security.util.ResourcesMgr.getString
  71                         ("invalid.null.input.value",
  72                         "sun.security.util.AuthResources"));
  73             Object[] source = {"name"};
  74             throw new NullPointerException(form.format(source));
  75         }
  76 
  77         this.name = name;
  78     }
  79 
  80     /**
  81      * Create a <code>UnixNumericUserPrincipal</code> using a
  82      * long representation of the user's identification number (UID).
  83      *
  84      * <p>
  85      *
  86      * @param name the user identification number (UID) for this user
  87      *                  represented as a long.
  88      */
  89     public UnixNumericUserPrincipal(long name) {
  90         this.name = Long.valueOf(name).toString();
  91     }
  92 
  93     /**
  94      * Return the user identification number (UID) for this
  95      * <code>UnixNumericUserPrincipal</code>.
  96      *
  97      * <p>
  98      *
  99      * @return the user identification number (UID) for this
 100      *          <code>UnixNumericUserPrincipal</code>
 101      */
 102     public String getName() {
 103         return name;
 104     }
 105 
 106     /**
 107      * Return the user identification number (UID) for this
 108      * <code>UnixNumericUserPrincipal</code> as a long.
 109      *
 110      * <p>
 111      *
 112      * @return the user identification number (UID) for this
 113      *          <code>UnixNumericUserPrincipal</code> as a long.
 114      */
 115     public long longValue() {
 116         return Long.valueOf(name);
 117     }
 118 
 119     /**
 120      * Return a string representation of this
 121      * <code>UnixNumericUserPrincipal</code>.
 122      *
 123      * <p>
 124      *
 125      * @return a string representation of this
 126      *          <code>UnixNumericUserPrincipal</code>.
 127      */
 128     public String toString() {
 129         java.text.MessageFormat form = new java.text.MessageFormat
 130                 (sun.security.util.ResourcesMgr.getString
 131                         ("UnixNumericUserPrincipal.name",
 132                         "sun.security.util.AuthResources"));
 133         Object[] source = {name};
 134         return form.format(source);
 135     }
 136