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.crawler.exception.CrawlingAccessException;
19
20 /**
21 * Exception thrown when an error occurs during data store crawling operations.
22 * This exception provides information about the URL where the error occurred
23 * and whether the crawling process should be aborted.
24 */
25 public class DataStoreCrawlingException extends CrawlingAccessException {
26
27 private static final long serialVersionUID = 1L;
28
29 /**
30 * The URL where the crawling error occurred.
31 */
32 private final String url;
33
34 /**
35 * Flag indicating whether the crawling process should be aborted.
36 */
37 private final boolean abort;
38
39 /**
40 * Creates a new DataStoreCrawlingException with the specified URL, message, and cause.
41 * The abort flag is set to false by default.
42 *
43 * @param url the URL where the crawling error occurred
44 * @param message the error message
45 * @param cause the underlying exception that caused this error
46 */
47 public DataStoreCrawlingException(final String url, final String message, final Throwable cause) {
48 this(url, message, cause, false);
49 }
50
51 /**
52 * Creates a new DataStoreCrawlingException with the specified URL, message, cause, and abort flag.
53 *
54 * @param url the URL where the crawling error occurred
55 * @param message the error message
56 * @param cause the underlying exception that caused this error
57 * @param abort whether the crawling process should be aborted due to this error
58 */
59 public DataStoreCrawlingException(final String url, final String message, final Throwable cause, final boolean abort) {
60 super(message, cause);
61 this.url = url;
62 this.abort = abort;
63 }
64
65 /**
66 * Gets the URL where the crawling error occurred.
67 *
68 * @return the URL associated with this exception
69 */
70 public String getUrl() {
71 return url;
72 }
73
74 /**
75 * Checks whether the crawling process should be aborted due to this exception.
76 *
77 * @return true if the crawling should be aborted, false otherwise
78 */
79 public boolean aborted() {
80 return abort;
81 }
82 }