1 /*
2 * Copyright 2012-2025 CodeLibs Project and the Others.
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 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.codelibs.fess.exception;
17
18 import org.codelibs.fess.app.web.RootAction;
19
20 /**
21 * Exception thrown when user role authentication fails during login attempts.
22 * This exception is used to indicate that a user does not have the required role
23 * to access a specific action or resource.
24 *
25 */
26 public class UserRoleLoginException extends RuntimeException {
27
28 private static final long serialVersionUID = 1L;
29
30 /** The action class that requires specific user roles */
31 private final Class<? extends RootAction> actionClass;
32
33 /**
34 * Constructs a new UserRoleLoginException with the specified action class.
35 *
36 * @param actionClass the action class that requires specific user roles
37 */
38 public UserRoleLoginException(final Class<? extends RootAction> actionClass) {
39 this.actionClass = actionClass;
40 }
41
42 /**
43 * Gets the action class associated with this exception.
44 *
45 * @return the action class that requires specific user roles
46 */
47 public Class<? extends RootAction> getActionClass() {
48 return actionClass;
49 }
50
51 /**
52 * Overrides fillInStackTrace to return null for performance optimization.
53 * This prevents stack trace generation for this exception type.
54 *
55 * @return null to skip stack trace generation
56 */
57 @Override
58 public synchronized Throwable fillInStackTrace() {
59 return null;
60 }
61 }