use of java.io.InvalidClassException in project adempiere by adempiere.
the class ProcessCtl method startProcess.
// startWorkflow
/**************************************************************************
* Start Java Process Class.
* instanciate the class implementing the interface ProcessCall.
* The class can be a Server/Client class (when in Package
* org adempiere.process or org.compiere.model) or a client only class
* (e.g. in org.compiere.report)
*
* @return true if success
*/
private boolean startProcess() {
log.fine(processInstance.toString());
boolean started = false;
//hengsin, bug [ 1633995 ]
boolean clientOnly = false;
if (!processInstance.getClassName().toLowerCase().startsWith(MRule.SCRIPT_PREFIX)) {
try {
Class<?> processClass = Class.forName(processInstance.getClassName());
if (ClientProcess.class.isAssignableFrom(processClass))
clientOnly = true;
} catch (Exception e) {
}
}
if (isServerProcess && !clientOnly) {
Server server = CConnection.get().getServer();
try {
if (server != null) {
// See ServerBean
processInstance = server.process(Env.getRemoteCallCtx(Env.getCtx()), processInstance);
log.finest("server => " + processInstance);
started = true;
}
} catch (UndeclaredThrowableException ex) {
Throwable cause = ex.getCause();
if (cause != null) {
if (cause instanceof InvalidClassException)
log.log(Level.SEVERE, "Version Server <> Client: " + cause.toString() + " - " + processInstance, ex);
else
log.log(Level.SEVERE, "AppsServer error(1b): " + cause.toString() + " - " + processInstance, ex);
} else
log.log(Level.SEVERE, " AppsServer error(1) - " + processInstance, ex);
started = false;
} catch (Exception ex) {
Throwable cause = ex.getCause();
if (cause == null)
cause = ex;
log.log(Level.SEVERE, "AppsServer error - " + processInstance, cause);
started = false;
}
}
// Run locally
if (!started && (!isServerProcess || clientOnly)) {
if (processInstance.getClassName().toLowerCase().startsWith(MRule.SCRIPT_PREFIX)) {
return ProcessUtil.startScriptProcess(Env.getCtx(), processInstance, m_trx);
} else {
if (processInstance.isManagedTransaction())
return ProcessUtil.startJavaProcess(Env.getCtx(), processInstance, m_trx);
else
return ProcessUtil.startJavaProcess(Env.getCtx(), processInstance, m_trx, processInstance.isManagedTransaction());
}
}
return !processInstance.isError();
}
use of java.io.InvalidClassException in project adempiere by adempiere.
the class ServerProcessCtl method startProcess.
// startWorkflow
/**************************************************************************
* Start Java Process Class.
* instanciate the class implementing the interface ProcessCall.
* The class can be a Server/Client class (when in Package
* org adempiere.process or org.compiere.model) or a client only class
* (e.g. in org.compiere.report)
*
* @return true if success
*/
protected boolean startProcess() {
log.fine(processInfo.toString());
boolean started = false;
//hengsin, bug [ 1633995 ]
boolean clientOnly = false;
if (!processInfo.getClassName().toLowerCase().startsWith(MRule.SCRIPT_PREFIX)) {
try {
Class<?> processClass = Class.forName(processInfo.getClassName());
if (ClientProcess.class.isAssignableFrom(processClass))
clientOnly = true;
} catch (Exception e) {
}
}
if (isServerProcess && !clientOnly) {
Server server = CConnection.get().getServer();
try {
if (server != null) {
// See ServerBean
processInfo = server.process(Env.getRemoteCallCtx(Env.getCtx()), processInfo);
log.finest("server => " + processInfo);
started = true;
}
} catch (UndeclaredThrowableException ex) {
Throwable cause = ex.getCause();
if (cause != null) {
if (cause instanceof InvalidClassException)
log.log(Level.SEVERE, "Version Server <> Client: " + cause.toString() + " - " + processInfo, ex);
else
log.log(Level.SEVERE, "AppsServer error(1b): " + cause.toString() + " - " + processInfo, ex);
} else
log.log(Level.SEVERE, " AppsServer error(1) - " + processInfo, ex);
started = false;
} catch (Exception ex) {
Throwable cause = ex.getCause();
if (cause == null)
cause = ex;
log.log(Level.SEVERE, "AppsServer error - " + processInfo, cause);
started = false;
}
}
// Run locally
if (!started && (!isServerProcess || clientOnly)) {
if (processInfo.getClassName().toLowerCase().startsWith(MRule.SCRIPT_PREFIX)) {
return ProcessUtil.startScriptProcess(Env.getCtx(), processInfo, trx);
} else {
if (processInfo.isManagedTransaction())
return ProcessUtil.startJavaProcess(Env.getCtx(), processInfo, trx);
else
return ProcessUtil.startJavaProcess(Env.getCtx(), processInfo, trx, processInfo.isManagedTransaction());
}
}
return !processInfo.isError();
}
use of java.io.InvalidClassException in project adempiere by adempiere.
the class ProcessCtl method startDBProcess.
// startProcess
/**************************************************************************
* Start Database Process
* @param ProcedureName PL/SQL procedure name
* @return true if success
*/
private boolean startDBProcess(String ProcedureName) {
// execute on this thread/connection
log.fine(ProcedureName + "(" + processInstance.getAD_PInstance_ID() + ")");
boolean started = false;
if (isServerProcess) {
Server server = CConnection.get().getServer();
try {
if (server != null) {
// See ServerBean
processInstance = server.dbProcess(processInstance, ProcedureName);
log.finest("server => " + processInstance);
started = true;
}
} catch (UndeclaredThrowableException ex) {
Throwable cause = ex.getCause();
if (cause != null) {
if (cause instanceof InvalidClassException)
log.log(Level.SEVERE, "Version Server <> Client: " + cause.toString() + " - " + processInstance, ex);
else
log.log(Level.SEVERE, "AppsServer error(1b): " + cause.toString() + " - " + processInstance, ex);
} else {
log.log(Level.SEVERE, " AppsServer error(1) - " + processInstance, ex);
cause = ex;
}
processInstance.setSummary(Msg.getMsg(Env.getCtx(), "ProcessRunError") + " " + cause.getLocalizedMessage());
processInstance.setError(true);
return false;
} catch (Exception ex) {
Throwable cause = ex.getCause();
if (cause == null)
cause = ex;
log.log(Level.SEVERE, "AppsServer error - " + processInstance, cause);
processInstance.setSummary(Msg.getMsg(Env.getCtx(), "ProcessRunError") + " " + cause.getLocalizedMessage());
processInstance.setError(true);
return false;
}
}
//try locally
if (!started) {
if (processInstance.isManagedTransaction())
return ProcessUtil.startDatabaseProcedure(processInstance, ProcedureName, m_trx);
else
return ProcessUtil.startDatabaseProcedure(processInstance, ProcedureName, m_trx, processInstance.isManagedTransaction());
}
// log.fine(Log.l4_Data, "ProcessCtl.startProcess - done");
return true;
}
use of java.io.InvalidClassException in project Remindy by abicelis.
the class TaskSortingUtil method generateProgrammedTaskHeaderList.
/* Programmed Tasks */
public ArrayList<TaskViewModel> generateProgrammedTaskHeaderList(List<Task> tasks, TaskSortType sortType, Resources resources) throws InvalidClassException {
ArrayList<TaskViewModel> result = new ArrayList<>();
clearTaskBuckets();
if (sortType == TaskSortType.DATE) {
//TODO: this comparator needs to take into account the RepeatingReminder's "next" event date to sort Tasks with RepeatingReminders properly
Collections.sort(tasks, new TasksByReminderDateComparator());
for (Task current : tasks) {
if (current.getReminderType() == null)
throw new NullPointerException("NULL ReminderType passed into TaskSortingUtil.generateProgrammedTaskHeaderList()");
switch(current.getReminderType()) {
case NONE:
throw new InvalidClassException("Wrong ReminderType passed into TaskSortingUtil.generateProgrammedTaskHeaderList()");
case LOCATION_BASED:
tasksLocationBased.add(current);
break;
case ONE_TIME:
insertProgrammedTaskIntoBucket(current, TaskUtil.getReminderEndCalendar(current.getReminder()));
break;
case REPEATING:
insertProgrammedTaskIntoBucket(current, TaskUtil.getRepeatingReminderNextCalendar(((RepeatingReminder) current.getReminder())));
break;
default:
throw new InvalidParameterException("Unhandled ReminderType passed into TaskSortingUtil.generateProgrammedTaskHeaderList()");
}
}
if (tasksOverdue.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_overdue), true));
dumpTaskBucketIntoViewModelList(tasksOverdue, result);
}
if (tasksLocationBased.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_location_based), false));
dumpTaskBucketIntoViewModelList(tasksLocationBased, result);
}
if (tasksToday.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_today), false));
dumpTaskBucketIntoViewModelList(tasksToday, result);
}
if (tasksTomorrow.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_tomorrow), false));
dumpTaskBucketIntoViewModelList(tasksTomorrow, result);
}
if (tasksThisWeek.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_this_week), false));
dumpTaskBucketIntoViewModelList(tasksThisWeek, result);
}
if (tasksNextWeek.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_next_week), false));
dumpTaskBucketIntoViewModelList(tasksNextWeek, result);
}
if (tasksThisMonth.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_this_month), false));
dumpTaskBucketIntoViewModelList(tasksThisMonth, result);
}
if (tasksNextMonth.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_next_month), false));
dumpTaskBucketIntoViewModelList(tasksNextMonth, result);
}
if (tasksThisYear.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_this_year), false));
dumpTaskBucketIntoViewModelList(tasksThisYear, result);
}
if (tasksNextYear.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_next_year), false));
dumpTaskBucketIntoViewModelList(tasksNextYear, result);
}
if (tasksFuture.size() > 0) {
result.add(new TaskViewModel(resources.getString(R.string.task_header_future), false));
dumpTaskBucketIntoViewModelList(tasksFuture, result);
}
} else if (sortType == TaskSortType.PLACE) {
handleSortingByPlace(tasks, result, resources);
}
return result;
}
use of java.io.InvalidClassException in project openhab1-addons by openhab.
the class RMEGenericBindingProvider method processBindingConfiguration.
/**
* {@inheritDoc}
*/
@Override
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException {
super.processBindingConfiguration(context, item, bindingConfig);
if (bindingConfig != null) {
RMEBindingConfig config = new RMEBindingConfig();
String valueSelectorString = null;
String[] configParts = bindingConfig.trim().split(":");
if (configParts.length != 2) {
throw new BindingConfigParseException("RME binding must contain two parts separated by ':'");
}
config.serialPort = configParts[0].trim();
valueSelectorString = configParts[1].trim();
try {
RMEValueSelector.validateBinding(valueSelectorString, item);
config.valueSelector = RMEValueSelector.getValueSelector(valueSelectorString);
addBindingConfig(item, config);
} catch (IllegalArgumentException e1) {
throw new BindingConfigParseException("Invalid value selector '" + valueSelectorString + "'!");
} catch (InvalidClassException e1) {
throw new BindingConfigParseException("Invalid item type for value selector '" + valueSelectorString + "'!");
}
} else {
logger.warn("bindingConfig is NULL (item=" + item + ") -> processing bindingConfig aborted!");
}
}
Aggregations