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 * <ul>
22 * <li>The cookie string is null</li>
23 * <li>The cookie name is empty or invalid</li>
24 * <li>The domain attribute is malformed or invalid</li>
25 * <li>The expires attribute cannot be parsed as a valid date</li>
26 * <li>The max-age attribute is not a valid integer</li>
27 * <li>Any other violation of the HTTP cookie specification (RFC 2109, RFC 2965, Netscape spec)</li>
28 * </ul>
29 *
30 * @author Ronald Brill
31 */
32 public class MalformedCookieException extends Exception {
33
34 /**
35 * Constructs a new MalformedCookieException with the specified detail message.
36 *
37 * @param message the detail message explaining why the cookie is malformed
38 */
39 public MalformedCookieException(final String message) {
40 super(message);
41 }
42
43 /**
44 * Constructs a new MalformedCookieException with the specified detail message and cause.
45 *
46 * @param message the detail message explaining why the cookie is malformed
47 * @param cause the underlying cause of this exception (e.g., a parsing exception)
48 */
49 public MalformedCookieException(final String message, final Throwable cause) {
50 super(message, cause);
51 }
52 }