/* Copyright 2004, 2005 Acegi Technology Pty Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.sf.acegisecurity.domain.impl;

import net.sf.acegisecurity.domain.util.CollectionIgnoringReflectionToStringBuilder;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.Serializable;


/**
 * A business domain object.
 * 
 * <p>
 * Only minimal convenience methods are provided by
 * <code>BusinessObject</code>. Whilst many other methods could easily be
 * offered (and overridden on an as-required basis) it is felt the default
 * behaviour of {@link java.lang.Object} is widely understood and an
 * appropriate default.
 * </p>
 *
 * @author Carlos Sanchez
 * @author Ben Alex
 * @version $Id$
 */
public abstract class BusinessObject implements Serializable, Cloneable {
    //~ Instance fields ========================================================

    protected final transient Log logger = LogFactory.getLog(getClass());

    //~ Methods ================================================================

    /**
     * Swallow cloning.
     * 
     * <p>
     * This method delegates to BeanUtils.cloneBean().
     * </p>
     *
     * @return a clone of the current instance
     *
     * @throws IllegalStateException if there are any problems with swallow
     *         cloning
     *
     * @see java.lang.Object#clone()
     * @see BeanUtils#cloneBean(Object)
     */
    public Object clone() {
        try {
            return BeanUtils.cloneBean(this);
        } catch (Exception e) {
            logger.error(e);
            throw new IllegalStateException(e);
        }
    }

    /**
     * Delegates to {@link CollectionIgnoringReflectionToStringBuilder}.
     *
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new CollectionIgnoringReflectionToStringBuilder(this).toString();
    }
}

@@ -1297,16 +1297,42 @@
 en Alex%0A
+ * @author Matthew Porter%0A
  * @vers
@@ -2052,16 +2052,50 @@
  clone()
+ throws CloneNotSupportedException
  %7B%0A     
@@ -2232,28 +2232,33 @@
 row new 
-IllegalSta
+CloneNotSuppor
 te
+d
 Exceptio
@@ -2260,16 +2260,29 @@
 eption(e
+.getMessage()
 );%0A     

Change clone() method to throw CloneNotSupportedException.