You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/07/16 02:39:05 UTC

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang CharSetUtils.java RandomStringUtils.java CharRange.java ClassUtils.java ObjectUtils.java

scolebourne    2003/07/15 17:39:05

  Modified:    lang/src/java/org/apache/commons/lang CharSetUtils.java
                        RandomStringUtils.java CharRange.java
                        ClassUtils.java ObjectUtils.java
  Log:
  Javadoc null behaviour
  
  Revision  Changes    Path
  1.13      +21 -7     jakarta-commons/lang/src/java/org/apache/commons/lang/CharSetUtils.java
  
  Index: CharSetUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/CharSetUtils.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CharSetUtils.java	14 Jul 2003 22:25:02 -0000	1.12
  +++ CharSetUtils.java	16 Jul 2003 00:39:05 -0000	1.13
  @@ -104,6 +104,8 @@
        *
        * @param str  the string to work from
        * @param set  the character set to use for manipulation
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
        */
       public static String squeeze(String str, String set) {
           String[] strs = new String[1];
  @@ -123,8 +125,9 @@
        * 
        * @param str  the string to work from
        * @param set  the character set to use for manipulation
  -     * @throws NullPointerException if <code>str</code> is
  -     *  <code>null</code>
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
  +     *  or any element is <code>null</code>
        */
       public static String squeeze(String str, String[] set) {
           CharSet chars = evaluateSet(set);
  @@ -157,6 +160,8 @@
        *
        * @param str  String target to count characters in
        * @param set  String set of characters to count
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
        */
       public static int count(String str, String set) {
           String[] strs = new String[1];
  @@ -175,6 +180,9 @@
        *
        * @param str  String target to count characters in
        * @param set  String[] set of characters to count
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
  +     *  or any element is <code>null</code>
        */
       public static int count(String str, String[] set) {
           CharSet chars = evaluateSet(set);
  @@ -200,6 +208,8 @@
        *
        * @param str  String target to keep characters from
        * @param set  String set of characters to keep
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
        */
       public static String keep(String str, String set) {
           String[] strs = new String[1];
  @@ -219,8 +229,9 @@
        *
        * @param str  String target to keep characters from
        * @param set  String[] set of characters to keep
  -     * @throws NullPointerException of <code>str</code> is
  -     *  <code>null</code>
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
  +     *  or any element is <code>null</code>
        */
       public static String keep(String str, String[] set) {
           return modify(str, set, true);
  @@ -237,6 +248,8 @@
        *
        * @param str  String target to delete characters from
        * @param set  String set of characters to delete
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
        */
       public static String delete(String str, String set) {
           String[] strs = new String[1];
  @@ -256,8 +269,9 @@
        *
        * @param str  String target to delete characters from
        * @param set  String[] set of characters to delete
  -     * @throws NullPointerException of <code>str</code> is
  -     *  <code>null</code>
  +     * @throws NullPointerException if <code>str</code> is <code>null</code>
  +     * @throws NullPointerException if <code>set</code> is <code>null</code>
  +     *  or any element is <code>null</code>
        */
       public static String delete(String str, String[] set) {
           return modify(str, set, false);
  
  
  
  1.16      +37 -33    jakarta-commons/lang/src/java/org/apache/commons/lang/RandomStringUtils.java
  
  Index: RandomStringUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/RandomStringUtils.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- RandomStringUtils.java	8 Jul 2003 22:06:35 -0000	1.15
  +++ RandomStringUtils.java	16 Jul 2003 00:39:05 -0000	1.16
  @@ -93,7 +93,7 @@
        *
        * <p>Characters will be chosen from the set of all characters.</p>
        *
  -     * @param count length of random string to create
  +     * @param count  the length of random string to create
        * @return the random string
        */
       public static String random(int count) {
  @@ -107,7 +107,7 @@
        * <p>Characters will be chosen from the set of characters whose
        * ASCII value is between <code>32</code> and <code>126</code> (inclusive).</p>
        *
  -     * @param count length of random string to create
  +     * @param count  the length of random string to create
        * @return the random string
        */
       public static String randomAscii(int count) {
  @@ -121,7 +121,7 @@
        * <p>Characters will be chosen from the set of alphabetic
        * characters.</p>
        *
  -     * @param count length of random string to create
  +     * @param count  the length of random string to create
        * @return the random string
        */
       public static String randomAlphabetic(int count) {
  @@ -135,7 +135,7 @@
        * <p>Characters will be chosen from the set of alpha-numeric
        * characters.</p>
        *
  -     * @param count length of random string to create
  +     * @param count  the length of random string to create
        * @return the random string
        */
       public static String randomAlphanumeric(int count) {
  @@ -149,7 +149,7 @@
        * <p>Characters will be chosen from the set of numeric
        * characters.</p>
        *
  -     * @param count length of random string to create
  +     * @param count  the length of random string to create
        * @return the random string
        */
       public static String randomNumeric(int count) {
  @@ -163,10 +163,10 @@
        * <p>Characters will be chosen from the set of alpha-numeric
        * characters as indicated by the arguments.</p>
        *
  -     * @param count length of random string to create
  -     * @param letters if <code>true</code>, generated string will include
  +     * @param count  the length of random string to create
  +     * @param letters  if <code>true</code>, generated string will include
        *  alphabetic characters
  -     * @param numbers if <code>true</code>, generatd string will include
  +     * @param numbers  if <code>true</code>, generatd string will include
        *  numeric characters
        * @return the random string
        */
  @@ -181,12 +181,12 @@
        * <p>Characters will be chosen from the set of alpha-numeric
        * characters as indicated by the arguments.</p>
        *
  -     * @param count length of random string to create
  -     * @param start position in set of chars to start at
  -     * @param end  position in set of chars to end before
  -     * @param letters if <code>true</code>, generated string will include
  +     * @param count  the length of random string to create
  +     * @param start  the position in set of chars to start at
  +     * @param end  the position in set of chars to end before
  +     * @param letters  if <code>true</code>, generated string will include
        *  alphabetic characters
  -     * @param numbers if <code>true</code>, generated string will include
  +     * @param numbers  if <code>true</code>, generated string will include
        *  numeric characters
        * @return the random string
        */
  @@ -203,13 +203,13 @@
        * instead of using an externally supplied source of randomness, it uses
        * the internal static {@link Random} instance ({@link #RANDOM}).</p>
        *
  -     * @param count length of random string to create
  -     * @param start position in set of chars to start at
  -     * @param end position in set of chars to end before
  -     * @param letters only allow letters?
  -     * @param numbers only allow numbers?
  -     * @param set set of chars to choose randoms from. If <code>null</code>,
  -     *  then it will use the set of all chars.
  +     * @param count  the length of random string to create
  +     * @param start  the position in set of chars to start at
  +     * @param end  the position in set of chars to end before
  +     * @param letters  only allow letters?
  +     * @param numbers  only allow numbers?
  +     * @param set  the set of chars to choose randoms from.
  +     *  If <code>null</code>, then it will use the set of all chars.
        * @return the random string
        * @throws ArrayIndexOutOfBoundsException if there are not
        *  <code>(end - start) + 1</code> characters in the set array.
  @@ -236,14 +236,14 @@
        * usage of <code>RandomStringUtils</code> in situations that need
        * repetitive behaviour.</p>
        *
  -     * @param count length of random string to create
  -     * @param start position in set of chars to start at
  -     * @param end position in set of chars to end before
  -     * @param letters only allow letters?
  -     * @param numbers only allow numbers?
  -     * @param set set of chars to choose randoms from. If <code>null</code>,
  -     *  then it will use the set of all chars.
  -     * @param random source of randomness.
  +     * @param count  the length of random string to create
  +     * @param start  the position in set of chars to start at
  +     * @param end  the position in set of chars to end before
  +     * @param letters  only allow letters?
  +     * @param numbers  only allow numbers?
  +     * @param set  the set of chars to choose randoms from.
  +     *  If <code>null</code>, then it will use the set of all chars.
  +     * @param random  a source of randomness.
        * @return the random string
        * @throws ArrayIndexOutOfBoundsException if there are not
        *  <code>(end - start) + 1</code> characters in the set array.
  @@ -295,9 +295,11 @@
        * <p>Characters will be chosen from the set of characters
        * specified.</p>
        *
  -     * @param count length of random string to create
  -     * @param set String containing the set of characters to use
  +     * @param count  the length of random string to create
  +     * @param set  the String containing the set of characters to use,
  +     *  must not be <code>null</code>
        * @return the random string
  +     * @throws NullPointerException if the set is <code>null</code>
        */
       public static String random(int count, String set) {
           return random(count, set.toCharArray());
  @@ -309,9 +311,11 @@
        *
        * <p>Characters will be chosen from the set of characters specified.</p>
        *
  -     * @param count length of random string to create
  -     * @param set character array containing the set of characters to use
  +     * @param count  the length of random string to create
  +     * @param set  the character array containing the set of characters to use
  +     *  must not be <code>null</code>
        * @return the random string
  +     * @throws NullPointerException if the set is <code>null</code>
        */
       public static String random(int count, char[] set) {
           return random(count, 0, set.length, false, false, set);
  
  
  
  1.7       +2 -1      jakarta-commons/lang/src/java/org/apache/commons/lang/CharRange.java
  
  Index: CharRange.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/CharRange.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CharRange.java	14 Jul 2003 22:25:02 -0000	1.6
  +++ CharRange.java	16 Jul 2003 00:39:05 -0000	1.7
  @@ -101,6 +101,7 @@
        * @param start  String start first character is in this range (inclusive).
        * @param close  String first character is close character in this
        *  range (inclusive).
  +     * @throws NullPointerException if either String is <code>null</code>
        */
       public CharRange(String start, String close) {
           this.start = start.charAt(0);
  
  
  
  1.14      +3 -3      jakarta-commons/lang/src/java/org/apache/commons/lang/ClassUtils.java
  
  Index: ClassUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/ClassUtils.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ClassUtils.java	14 Jul 2003 22:25:02 -0000	1.13
  +++ ClassUtils.java	16 Jul 2003 00:39:05 -0000	1.14
  @@ -102,7 +102,7 @@
       /**
        * <p>Gets the class name minus the package name for an <code>Object</code>.</p>
        * 
  -     * @param object  the class to get the short name for
  +     * @param object  the class to get the short name for, may be null
        * @param valueIfNull  the value to return if null
        * @return the class name of the object without the package name, or the null value
        */
  @@ -158,7 +158,7 @@
       /**
        * <p>Gets the package name of an <code>Object</code>.</p>
        * 
  -     * @param object  the class to get the package name for
  +     * @param object  the class to get the package name for, may be null
        * @param valueIfNull  the value to return if null
        * @return the package name of the object, or the null value
        */
  
  
  
  1.10      +5 -5      jakarta-commons/lang/src/java/org/apache/commons/lang/ObjectUtils.java
  
  Index: ObjectUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/ObjectUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ObjectUtils.java	14 Jul 2003 22:25:03 -0000	1.9
  +++ ObjectUtils.java	16 Jul 2003 00:39:05 -0000	1.10
  @@ -101,8 +101,8 @@
        * <p>Returns a default value if the object passed is
        * <code>null</code>.</p>
        *
  -     * @param object  the <code>Object</code> to test
  -     * @param defaultValue  the default value to return
  +     * @param object  the <code>Object</code> to test, may be <code>null</code>
  +     * @param defaultValue  the default value to return, may be <code>null</code>
        * @return <code>object</code> if it is not <code>null</code>, defaultValue otherwise
        */
       public static Object defaultIfNull(Object object, Object defaultValue) {
  @@ -113,8 +113,8 @@
        * <p>Compares two objects for equality, where either one or both
        * objects may be <code>null</code>.</p>
        *
  -     * @param object1  the first object
  -     * @param object2  the second object
  +     * @param object1  the first object, may be <code>null</code>
  +     * @param object2  the second object, may be <code>null</code>
        * @return <code>true</code> if the values of both objects are the same
        */
       public static boolean equals(Object object1, Object object2) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org