public static BonitaInternalException build(RuntimeException exception) { String message = exception.getMessage(); if (exception instanceof BonitaRuntimeException) { return new BonitaInternalException(message, exception); } String newMessage = "Unexpected Exception arrived in Bonita: " + message; return new BonitaInternalException(newMessage, exception); }
public Object invoke(final Object proxy, final Method method, final Object[] args) throws BonitaException { try { // If already in environment: use the same environment to execute the // command directly if (Environment.getCurrent() != null) { return new APIInterceptorCommand(method, args, true).execute(Environment.getCurrent()); } // If no environment: use directly the command Service with interceptors final EnvironmentFactory envFactory = GlobalEnvironmentFactory.getEnvironmentFactory(); return envFactory.get(CommandService.class).execute(new APIInterceptorCommand(method, args, false)); } catch (final PvmException e) { final Throwable cause = e.getCause(); if (cause instanceof BonitaException) { throw (BonitaException) cause; } throw e; } catch (final BonitaException e) { throw e; } catch (final InvalidEnvironmentException e) { // Don't throw BonitaInternalException if Environment parsing failed. // This is a configuration problem, not an engine bug. throw e; } catch (final BonitaWrapperException e) { throw (RuntimeException) e.getCause(); } catch (final RuntimeException e) { throw BonitaInternalException.build(e); } catch (final Exception t) { throw new BonitaInternalException("Ouch! Unexpected error: " + t, t); } }
} catch (final BonitaInternalException e) { final Throwable cause = e.getCause(); if (cause instanceof UnRollbackableException) { final Throwable originalCause = cause.getCause();
throw e; } catch (final RuntimeException e) { throw BonitaInternalException.build(e); } catch (final Exception t) { final String message = ExceptionManager.getInstance().getFullMessage("bai_APII_2", t); throw new BonitaInternalException(message, t);
public Object execute(final Environment env) throws Exception { if (!this.isSecuritySet) { APIInterceptor.this.setSecurityContext(); } try { return this.m.invoke(APIInterceptor.this.api, this.args); } catch (final InvocationTargetException e) { final Throwable t = e.getCause(); if (t instanceof Exception) { throw (Exception) t; } else if (t instanceof Error) { throw (Error) t; } else { throw new BonitaInternalException("Ouch! Unexpected error: " + t, t); } } }
public static UnAuthorizedUserException build(Throwable e) { if (!(e instanceof UnAuthorizedUserException)) { throw new BonitaInternalException("Cannot create a UnAuthorizedUserException", e); } return new UnAuthorizedUserException((UnAuthorizedUserException)e); }
public static ParticipantNotFoundException build(Throwable e) { if (!(e instanceof ParticipantNotFoundException)) { throw new BonitaInternalException("Cannot create a ProcessNotFoundException", e); } return new ParticipantNotFoundException((ParticipantNotFoundException)e); } public String getParticipantId() {
public static IllegalTaskStateException build(Throwable e) { if (!(e instanceof IllegalTaskStateException)) { throw new BonitaInternalException("Cannot create a IllegalTaskStateException", e); } return new IllegalTaskStateException((IllegalTaskStateException)e); }
public static ActivityDefNotFoundException build(Throwable e) { if (!(e instanceof ActivityDefNotFoundException)) { throw new BonitaInternalException("Cannot create an ActivityDefNotFoundException", e); } return new ActivityDefNotFoundException((ActivityDefNotFoundException)e); }
public static InstanceNotFoundException build(Throwable e) { if (!(e instanceof InstanceNotFoundException)) { throw new BonitaInternalException("Cannot create a InstanceNotFoundException", e); } return new InstanceNotFoundException((InstanceNotFoundException)e); }
public static BonitaInternalException build(final RuntimeException exception) { final String message = exception.getMessage(); if (exception instanceof BonitaRuntimeException) { return new BonitaInternalException(message, exception); } final String msg = ExceptionManager.getInstance().getMessage("BIE1", message); return new BonitaInternalException(msg, exception); }
public static BonitaInternalException build(final RuntimeException exception) { final String message = exception.getMessage(); if (exception instanceof BonitaRuntimeException) { return new BonitaInternalException(message, exception); } final String msg = ExceptionManager.getInstance().getMessage("BIE1", message); return new BonitaInternalException(msg, exception); }
public static TaskNotFoundException build(Throwable e) { if (!(e instanceof TaskNotFoundException)) { throw new BonitaInternalException("Cannot create a TaskNotFoundException", e); } return new TaskNotFoundException((TaskNotFoundException)e); }
public static DataFieldNotFoundException build(Throwable e) { if (!(e instanceof DataFieldNotFoundException)) { throw new BonitaInternalException("Cannot create a DataFieldNotFoundException", e); } return new DataFieldNotFoundException((DataFieldNotFoundException)e); }
public static VariableNotFoundException build(Throwable e) { if (!(e instanceof VariableNotFoundException)) { throw new BonitaInternalException("Cannot create a VariableNotFoundException", e); } return new VariableNotFoundException((VariableNotFoundException)e); }
public static PackageNotFoundException build(Throwable e) { if (!(e instanceof PackageNotFoundException)) { throw new BonitaInternalException("Cannot create a ProcessNotFoundException", e); } return new PackageNotFoundException((PackageNotFoundException)e); } public String getPackageId() {
private static String getDefaultIndexesDirectorPath(final Configuration configuration) { String indexBasePath = getIndexesDirectoryPath(configuration); if (indexBasePath == null || "".equals(indexBasePath.trim())) { throw new BonitaInternalException("The hibernate.search.default.indexBase property is not set"); } if (indexBasePath.startsWith("${" + BonitaConstants.HOME + "}")) { indexBasePath = indexBasePath.replace("${" + BonitaConstants.HOME + "}", System.getProperty(BonitaConstants.HOME)); } if(LOG.isLoggable(Level.FINE)) { LOG.fine("Hibernate search index base:" + indexBasePath); } return indexBasePath; }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { final Method m = api.getClass().getMethod(method.getName(), method.getParameterTypes()); return m.invoke(api, args); } catch (Exception e) { if (e instanceof InvocationTargetException) { Throwable invocationExceptionCause = e.getCause(); if (invocationExceptionCause instanceof BonitaException) { //normally we should never be here as we are in remote mode throw invocationExceptionCause; } else if (invocationExceptionCause instanceof RemoteException) { RemoteException remoteException = (RemoteException) invocationExceptionCause; Throwable remoteCause = getRemoteCause(remoteException); EJBUtil.manageInvokeExceptionCause(method, remoteCause); } } throw new BonitaInternalException("Ouch! Unexpected error: " + e, e); } }
private static Properties getMapping() throws IOException { synchronized (LOCK) { if (mapping == null) { final Properties map = new Properties(); final ClassLoader cl = Thread.currentThread().getContextClassLoader(); final InputStream inStream = cl.getResourceAsStream("org.ow2.bonita.api.implementations"); if (inStream != null) { try { map.load(inStream); } finally { inStream.close(); } } else { String message = ExceptionManager.getInstance().getFullMessage("baa_SIAPIAF_1"); throw new BonitaInternalException(message); } mapping = map; } } return mapping; }
private static Properties getMapping() throws IOException { synchronized (LOCK) { if (mapping == null) { final Properties map = new Properties(); final ClassLoader cl = Thread.currentThread().getContextClassLoader(); final InputStream inStream = cl.getResourceAsStream("org.ow2.bonita.api.implementations"); if (inStream != null) { try { map.load(inStream); } finally { inStream.close(); } } else { String message = ExceptionManager.getInstance().getFullMessage("baa_SIAPIAF_1"); throw new BonitaInternalException(message); } mapping = map; } } return mapping; }