View Javadoc
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.mylasta.action.FessMessages;
19  import org.lastaflute.web.validation.VaMessenger;
20  
21  /**
22   * Exception thrown during SSO (Single Sign-On) processing with message code support.
23   *
24   * This exception is used to indicate errors that occur during SSO authentication
25   * and authorization processes. It carries both a message code for internationalization
26   * and localization purposes, as well as detailed error information. The message code
27   * can be used by the UI layer to display appropriate error messages to users.
28   */
29  public class SsoMessageException extends FessSystemException {
30  
31      private static final long serialVersionUID = 1L;
32  
33      /** The message code for internationalized error messages. */
34      private final transient VaMessenger<FessMessages> messageCode;
35  
36      /**
37       * Constructs a new SSO message exception with message code, detailed message, and cause.
38       *
39       * @param messageCode The message code for internationalized error display
40       * @param message The detailed error message
41       * @param cause The underlying cause of this exception
42       */
43      public SsoMessageException(final VaMessenger<FessMessages> messageCode, final String message, final Throwable cause) {
44          super(message, cause);
45          this.messageCode = messageCode;
46      }
47  
48      /**
49       * Constructs a new SSO message exception with message code and detailed message.
50       *
51       * @param messageCode The message code for internationalized error display
52       * @param message The detailed error message
53       */
54      public SsoMessageException(final VaMessenger<FessMessages> messageCode, final String message) {
55          super(message);
56          this.messageCode = messageCode;
57      }
58  
59      /**
60       * Gets the message code for internationalized error display.
61       *
62       * The message code can be used by the presentation layer to retrieve
63       * localized error messages appropriate for the user's language settings.
64       *
65       * @return The message code for error message localization
66       */
67      public VaMessenger<FessMessages> getMessageCode() {
68          return messageCode;
69      }
70  
71  }