geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james_strac...@yahoo.co.uk>
Subject Re: [PATCH][org.apache.geronimo.common]package.html / cvsignore / various comments add-ons / NullArgumentExceptionTest
Date Tue, 26 Aug 2003 10:57:48 GMT
Patch applied.

(Apologies Emmanuel - I used Siva's name in the CVS commit comment by  
accident).


On Monday, August 18, 2003, at 10:39  pm, Emmanuel Bernard wrote:

> Index: .cvsignore
> ===================================================================
> RCS file: .cvsignore
> diff -N .cvsignore
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ .cvsignore	18 Aug 2003 21:26:05 -0000
> @@ -0,0 +1,4 @@
> +target
> +.classpath
> +.project
> +maven.log
> Index: src/java/org/apache/geronimo/common/NestedThrowable.java
> ===================================================================
> RCS file:  
> /home/cvspublic/incubator-geronimo/modules/common/src/java/org/apache/ 
> geronimo/common/NestedThrowable.java,v
> retrieving revision 1.4
> diff -u -r1.4 NestedThrowable.java
> --- src/java/org/apache/geronimo/common/NestedThrowable.java	16 Aug  
> 2003 15:14:11 -0000	1.4
> +++ src/java/org/apache/geronimo/common/NestedThrowable.java	18 Aug  
> 2003 21:26:06 -0000
> @@ -138,7 +138,7 @@
>       
> ////////////////////////////////////////////////////////////////////// 
> ///
>
>      /**
> -     * Utilitiy methods for the various flavors of
> +     * Utility methods for the various flavors of
>       * <code>NestedThrowable</code>.
>       */
>      final class Util
> @@ -148,7 +148,7 @@
>
>          /**
>           * Something is very broken with class nesting, which can  
> sometimes
> -         * leave log uninitialized durring one of the following  
> method calls.
> +         * leave log uninitialized during one of the following method  
> calls.
>           *
>           * <p>
>           * This is a HACK to keep those methods from NPE until this  
> problem
> @@ -162,7 +162,14 @@
>              return log;
>          }
>
> -        /** A helper to get a boolean property. */
> +        /** A helper to get a boolean property.
> +         * <p>
> +         * Assuming this property isn't set, defaultValue is returned
> +         *
> +         * @param name property name
> +         * @param defaultValue returned if property is not set
> +         * @return
> +         */
>          protected static boolean getBoolean(String name, boolean  
> defaultValue)
>          {
>              name = NestedThrowable.class.getName() + "." + name;
> Index: src/java/org/apache/geronimo/common/Strings.java
> ===================================================================
> RCS file:  
> /home/cvspublic/incubator-geronimo/modules/common/src/java/org/apache/ 
> geronimo/common/Strings.java,v
> retrieving revision 1.7
> diff -u -r1.7 Strings.java
> --- src/java/org/apache/geronimo/common/Strings.java	16 Aug 2003  
> 15:14:11 -0000	1.7
> +++ src/java/org/apache/geronimo/common/Strings.java	18 Aug 2003  
> 21:26:07 -0000
> @@ -613,10 +613,8 @@
>       * @return           True if string is empty
>       */
>      public static boolean isEmpty(final String string) {
> -        if (string == null) {
> -            throw new NullArgumentException("string");
> -        }
> -
> +        NullArgumentException.checkForNull("string", string);
> +
>          return string.equals(EMPTY);
>      }
>
> @@ -650,8 +648,7 @@
>       * @throws IllegalArgumentException    String is <kk>null</kk> or  
> empty.
>       */
>      public static String capitalize(final String string) {
> -        if (string == null)
> -            throw new NullArgumentException("string");
> +    	NullArgumentException.checkForNull("string", string);
>          if (string.equals(""))
>              throw new IllegalArgumentException("string is empty");
>
> Index: src/java/org/apache/geronimo/common/package.html
> ===================================================================
> RCS file: src/java/org/apache/geronimo/common/package.html
> diff -N src/java/org/apache/geronimo/common/package.html
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ src/java/org/apache/geronimo/common/package.html	18 Aug 2003  
> 21:26:07 -0000
> @@ -0,0 +1,14 @@
> +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
> +<html>
> +<head>
> +<title></title>
> +</head>
> +<body>
> +Common utilities classes used by other modules. This include the  
> following topics
> +<ul>
> +  <li>Throwable and nested related materials
> +  <li>Basic exceptions including NullArgumentException
> +  <li>Helpers over Basic Classes (String, etc...)
> +</ul>
> +</body>
> +</html>
> Index: src/java/org/apache/geronimo/common/platform/package.html
> ===================================================================
> RCS file: src/java/org/apache/geronimo/common/platform/package.html
> diff -N src/java/org/apache/geronimo/common/platform/package.html
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ src/java/org/apache/geronimo/common/platform/package.html	18 Aug  
> 2003 21:26:07 -0000
> @@ -0,0 +1,9 @@
> +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
> +<html>
> +<head>
> +<title></title>
> +</head>
> +<body>
> +Provides platform related informations.
> +</body>
> +</html>
> Index:  
> src/test/org/apache/geronimo/common/NullArgumentExceptionTest.java
> ===================================================================
> RCS file:  
> src/test/org/apache/geronimo/common/NullArgumentExceptionTest.java
> diff -N  
> src/test/org/apache/geronimo/common/NullArgumentExceptionTest.java
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++  
> src/test/org/apache/geronimo/common/NullArgumentExceptionTest.java	18  
> Aug 2003 21:26:08 -0000
> @@ -0,0 +1,82 @@
> +/*  
> ====================================================================
> + * The Apache Software License, Version 1.1
> + *
> + * Copyright (c) 2003 The Apache Software Foundation.  All rights
> + * reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + *
> + * 2. Redistributions in binary form must reproduce the above  
> copyright
> + *    notice, this list of conditions and the following disclaimer in
> + *    the documentation and/or other materials provided with the
> + *    distribution.
> + *
> + * 3. The end-user documentation included with the redistribution,
> + *    if any, must include the following acknowledgment:
> + *       "This product includes software developed by the
> + *        Apache Software Foundation (http://www.apache.org/)."
> + *    Alternately, this acknowledgment may appear in the software  
> itself,
> + *    if and wherever such third-party acknowledgments normally  
> appear.
> + *
> + * 4. The names "Apache" and "Apache Software Foundation" and
> + *    "Apache Geronimo" must not be used to endorse or promote  
> products
> + *    derived from this software without prior written permission. For
> + *    written permission, please contact apache@apache.org.
> + *
> + * 5. Products derived from this software may not be called "Apache",
> + *    "Apache Geronimo", nor may "Apache" appear in their name,  
> without
> + *    prior written permission of the Apache Software Foundation.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + *  
> ====================================================================
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals on behalf of the Apache Software Foundation.  For more
> + * information on the Apache Software Foundation, please see
> + * <http://www.apache.org/>.
> + *
> + *  
> ====================================================================
> + */
> +package org.apache.geronimo.common;
> +
> +import junit.framework.TestCase;
> +
> +/**
> + * Unit test for {@link NullArgumentException} class.
> + *
> + * @version $Revision$ $Date$
> + */
> +public class NullArgumentExceptionTest extends TestCase {
> +
> +    public void testCheckForNull() {
> +        try {
> +            NullArgumentException.checkForNull("notNull", "notNull");
> +        } catch (NullArgumentException nae) {
> +            fail("Should not throw NullArgumentException for non null  
> object");
> +        }
> +
> +        try {
> +            NullArgumentException.checkForNull("notNull", null);
> +            fail("Expected NullArgumentException for null object");
> +        } catch (NullArgumentException nae) {
> +            //ignore it
> +        }
> +    }
> +
> +}
>

James
-------
http://radio.weblogs.com/0112098/


Mime
View raw message