View Javadoc
1   /*
2    * Copyright (c) 2002-2026 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.http;
16  
17  /**
18   * Exception thrown when a cookie string cannot be parsed or does not conform to the cookie specification.
19   * <p>
20   * This exception is thrown in the following scenarios:
21   * </p>
22   * <ul>
23   *   <li>The cookie string is null</li>
24   *   <li>The cookie name is empty or invalid</li>
25   *   <li>The domain attribute is malformed or invalid</li>
26   *   <li>The expires attribute cannot be parsed as a valid date</li>
27   *   <li>The max-age attribute is not a valid integer</li>
28   *   <li>Any other violation of the HTTP cookie specification (RFC 2109, RFC 2965, Netscape spec)</li>
29   * </ul>
30   *
31   * @author Ronald Brill
32   */
33  public class MalformedCookieException extends Exception {
34  
35      /**
36       * Constructs a new MalformedCookieException with the specified detail message.
37       *
38       * @param message the detail message explaining why the cookie is malformed
39       */
40      public MalformedCookieException(final String message) {
41          super(message);
42      }
43  
44      /**
45       * Constructs a new MalformedCookieException with the specified detail message and cause.
46       *
47       * @param message the detail message explaining why the cookie is malformed
48       * @param cause the underlying cause of this exception (e.g., a parsing exception)
49       */
50      public MalformedCookieException(final String message, final Throwable cause) {
51          super(message, cause);
52      }
53  }