fix #2295 replace with job processing exception
This commit is contained in:
parent
79861dbe06
commit
c4b323f95a
8 changed files with 24 additions and 31 deletions
|
@ -19,10 +19,10 @@ import org.codelibs.core.timer.TimeoutTask;
|
|||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.es.config.exentity.JobLog;
|
||||
import org.codelibs.fess.es.config.exentity.ScheduledJob;
|
||||
import org.codelibs.fess.exception.ScheduledJobException;
|
||||
import org.codelibs.fess.helper.JobHelper;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
import org.codelibs.fess.job.JobExecutor;
|
||||
import org.codelibs.fess.job.ScheduledJobException;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.lastaflute.job.JobManager;
|
||||
import org.lastaflute.job.LaJob;
|
||||
|
@ -101,7 +101,7 @@ public class ScriptExecutorJob implements LaJob {
|
|||
}
|
||||
jobLog.setJobStatus(Constants.OK);
|
||||
} catch (final Throwable t) {
|
||||
logger.error("Failed to execute " + id + ": " + script, t);
|
||||
logger.warn("Failed to execute " + id + ": " + script, t);
|
||||
jobLog.setJobStatus(Constants.FAIL);
|
||||
jobLog.setScriptResult(systemHelper.abbreviateLongText(t.getLocalizedMessage()));
|
||||
} finally {
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package org.codelibs.fess.exception;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class JobProcessingException extends FessSystemException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -25,8 +23,12 @@ public class JobProcessingException extends FessSystemException {
|
|||
super(e);
|
||||
}
|
||||
|
||||
public JobProcessingException(final String message, final IOException e) {
|
||||
public JobProcessingException(final String message, final Throwable e) {
|
||||
super(message, e);
|
||||
}
|
||||
|
||||
public JobProcessingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.codelibs.fess.job;
|
||||
|
||||
import org.codelibs.fess.exception.FessSystemException;
|
||||
package org.codelibs.fess.exception;
|
||||
|
||||
public class ScheduledJobException extends FessSystemException {
|
||||
|
||||
|
@ -27,7 +25,6 @@ public class ScheduledJobException extends FessSystemException {
|
|||
*/
|
||||
public ScheduledJobException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +32,6 @@ public class ScheduledJobException extends FessSystemException {
|
|||
*/
|
||||
public ScheduledJobException(final String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -27,7 +27,7 @@ import org.codelibs.fess.es.config.exbhv.JobLogBhv;
|
|||
import org.codelibs.fess.es.config.exbhv.ScheduledJobBhv;
|
||||
import org.codelibs.fess.es.config.exentity.JobLog;
|
||||
import org.codelibs.fess.es.config.exentity.ScheduledJob;
|
||||
import org.codelibs.fess.job.ScheduledJobException;
|
||||
import org.codelibs.fess.exception.ScheduledJobException;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.dbflute.optional.OptionalThing;
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.commons.lang3.SystemUtils;
|
|||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.es.config.exbhv.ScheduledJobBhv;
|
||||
import org.codelibs.fess.exception.FessSystemException;
|
||||
import org.codelibs.fess.exception.JobProcessingException;
|
||||
import org.codelibs.fess.exec.Crawler;
|
||||
import org.codelibs.fess.helper.ProcessHelper;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
|
@ -97,8 +97,8 @@ public class CrawlJob extends ExecJob {
|
|||
if (maxCrawlerProcesses > 0) {
|
||||
final int runningJobCount = getRunningJobCount();
|
||||
if (runningJobCount > maxCrawlerProcesses) {
|
||||
throw new FessSystemException(runningJobCount + " crawler processes are running. Max processes are " + maxCrawlerProcesses
|
||||
+ ".");
|
||||
throw new JobProcessingException(runningJobCount + " crawler processes are running. Max processes are "
|
||||
+ maxCrawlerProcesses + ".");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,8 @@ public class CrawlJob extends ExecJob {
|
|||
try {
|
||||
executeCrawler();
|
||||
ComponentUtil.getKeyMatchHelper().update();
|
||||
} catch (final FessSystemException e) {
|
||||
throw e;
|
||||
} catch (final Exception e) {
|
||||
throw new FessSystemException("Failed to execute a crawl job.", e);
|
||||
throw new JobProcessingException("Failed to execute a crawl job.", e);
|
||||
}
|
||||
|
||||
return resultBuf.toString();
|
||||
|
@ -355,14 +353,12 @@ public class CrawlJob extends ExecJob {
|
|||
logger.info("Crawler: Exit Code=" + exitValue + " - Crawler Process Output:\n" + it.getOutput());
|
||||
}
|
||||
if (exitValue != 0) {
|
||||
throw new FessSystemException("Exit Code: " + exitValue + "\nOutput:\n" + it.getOutput());
|
||||
throw new JobProcessingException("Exit Code: " + exitValue + "\nOutput:\n" + it.getOutput());
|
||||
}
|
||||
} catch (final FessSystemException e) {
|
||||
throw e;
|
||||
} catch (final InterruptedException e) {
|
||||
logger.warn("Crawler Process interrupted.");
|
||||
} catch (final Exception e) {
|
||||
throw new FessSystemException("Crawler Process terminated.", e);
|
||||
throw new JobProcessingException("Crawler Process terminated.", e);
|
||||
} finally {
|
||||
try {
|
||||
processHelper.destroyProcess(sessionId);
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.commons.lang3.RandomStringUtils;
|
|||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.exception.FessSystemException;
|
||||
import org.codelibs.fess.exception.JobProcessingException;
|
||||
import org.codelibs.fess.exec.ThumbnailGenerator;
|
||||
import org.codelibs.fess.helper.ProcessHelper;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
|
@ -236,15 +236,13 @@ public class GenerateThumbnailJob extends ExecJob {
|
|||
logger.info("ThumbnailGenerator: Exit Code=" + exitValue + " - ThumbnailGenerator Process Output:\n" + it.getOutput());
|
||||
}
|
||||
if (exitValue != 0) {
|
||||
throw new FessSystemException("Exit Code: " + exitValue + "\nOutput:\n" + it.getOutput());
|
||||
throw new JobProcessingException("Exit Code: " + exitValue + "\nOutput:\n" + it.getOutput());
|
||||
}
|
||||
ComponentUtil.getPopularWordHelper().clearCache();
|
||||
} catch (final FessSystemException e) {
|
||||
throw e;
|
||||
} catch (final InterruptedException e) {
|
||||
logger.warn("ThumbnailGenerator Process interrupted.");
|
||||
} catch (final Exception e) {
|
||||
throw new FessSystemException("ThumbnailGenerator Process terminated.", e);
|
||||
throw new JobProcessingException("ThumbnailGenerator Process terminated.", e);
|
||||
} finally {
|
||||
try {
|
||||
processHelper.destroyProcess(sessionId);
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.commons.lang3.RandomStringUtils;
|
|||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.exception.FessSystemException;
|
||||
import org.codelibs.fess.exception.JobProcessingException;
|
||||
import org.codelibs.fess.exec.SuggestCreator;
|
||||
import org.codelibs.fess.helper.ProcessHelper;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
|
@ -218,15 +218,13 @@ public class SuggestJob extends ExecJob {
|
|||
logger.info("SuggestCreator: Exit Code=" + exitValue + " - SuggestCreator Process Output:\n" + it.getOutput());
|
||||
}
|
||||
if (exitValue != 0) {
|
||||
throw new FessSystemException("Exit Code: " + exitValue + "\nOutput:\n" + it.getOutput());
|
||||
throw new JobProcessingException("Exit Code: " + exitValue + "\nOutput:\n" + it.getOutput());
|
||||
}
|
||||
ComponentUtil.getPopularWordHelper().clearCache();
|
||||
} catch (final FessSystemException e) {
|
||||
throw e;
|
||||
} catch (final InterruptedException e) {
|
||||
logger.warn("SuggestCreator Process interrupted.");
|
||||
} catch (final Exception e) {
|
||||
throw new FessSystemException("SuggestCreator Process terminated.", e);
|
||||
throw new JobProcessingException("SuggestCreator Process terminated.", e);
|
||||
} finally {
|
||||
try {
|
||||
processHelper.destroyProcess(sessionId);
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.codelibs.fess.util;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.codelibs.fess.exception.JobProcessingException;
|
||||
import org.lastaflute.di.core.factory.SingletonLaContainerFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -39,6 +40,8 @@ public final class GroovyUtil {
|
|||
final GroovyShell groovyShell = new GroovyShell(new Binding(bindingMap));
|
||||
try {
|
||||
return groovyShell.evaluate(template);
|
||||
} catch (final JobProcessingException e) {
|
||||
throw e;
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to evalue groovy script: " + template + " => " + paramMap, e);
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue