/*
 * Licensed to Apereo under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Apereo licenses this file to you 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 the following location:
 *
 *   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 org.jasig.cas.support.oauth;

import org.jasig.cas.authentication.RootCasException;

/**
 * The exception to throw when a parameter is invalid or missing.
 *
 * @author Michael Haselton
 * @since 4.1.0
 */
public class InvalidParameterException extends RootCasException {

    private static final long serialVersionUID = -6122987319096575896L;

    /** The code description. */
    private static final String CODE = "INVALID_PARAMETER";

    private final String name;

    /**
     * Constructs a InvalidParameterException with the default exception code.
     * @param name the name of the parameter that originally caused this exception to be thrown.
     */
    public InvalidParameterException(final String name) {
        super(CODE);
        this.name = name;
    }

    /**
     * Constructs a InvalidParameterException with the default exception code and
     * the original exception that was thrown.
     *
     * @param throwable the chained exception
     * @param name the name of the parameter that originally caused this exception to be thrown.
     */
    public InvalidParameterException(final Throwable throwable, final String name) {
        super(CODE, throwable);
        this.name = name;
    }

    /**
     * Returns the message of this exception.
     * @return the message
     * @see InvalidParameterException#name
     */
    @Override
    public String getMessage() {
        return String.format("Invalid or missing parameter '%s'", this.name);
    }
}

@@ -986,16 +986,39 @@
 aselton%0A
+ * @author Longze Chen%0A
  * @sinc
@@ -1023,17 +1023,17 @@
 nce 4.1.
-0
+5
 %0A */%0Apub
@@ -1096,16 +1096,89 @@
 tion %7B%0A%0A
+    /** Log instance for logging events, info, warnings, errors, etc. */%0A
     priv
@@ -1336,16 +1336,73 @@
 ETER%22;%0A%0A
+    /** The name of the invalid or missing parameter. */%0A
     priv
@@ -1436,36 +1436,45 @@
  /**%0A     * 
-Constructs a
+Instantiates a %7B@link
  InvalidPara
@@ -1479,32 +1479,33 @@
 rameterException
+%7D
  with the defaul
@@ -1520,17 +1520,51 @@
 ion code
-.
+ and a given parameter name.%0A     *
 %0A     * 
@@ -1643,33 +1643,32 @@
 ion to be thrown
-.
 %0A     */%0A    pub
@@ -1791,20 +1791,29 @@
   * 
-Constructs a
+Instantiates a %7B@link
  Inv
@@ -1834,16 +1834,17 @@
 xception
+%7D
  with th
@@ -1871,19 +1871,9 @@
 code
- and%0A     *
+,
  the
@@ -1896,16 +1896,23 @@
 ion that
+%0A     *
  was thr
@@ -1910,24 +1910,51 @@
 * was thrown
+ and a given parameter name
 .%0A     *%0A   
@@ -2305,16 +2305,23 @@
 eption.%0A
+     *%0A
      * @

Update comments & style for the invalid parameter exception