/** * Create an {@link RuntimeException} for an internal error. * * @param cause underlying cause * @return an {@link RuntimeException} for an internal error */ public static RuntimeException createInternalError(final Throwable cause) { return new OpenEJBRuntimeException("internal error, please fill a bug report at https://issues.apache.org/jira/browse/MATH", cause); }
/** * Create an {@link RuntimeException} for an internal error. * * @param cause underlying cause * @return an {@link RuntimeException} for an internal error */ public static RuntimeException createInternalError(final Throwable cause) { return new OpenEJBRuntimeException("internal error, please fill a bug report at https://issues.apache.org/jira/browse/MATH", cause); }
public UpdatableSessionContextManager() { try { contextById = (Map<String, SessionContext>) scField.get(this); } catch (final IllegalAccessException e) { throw new OpenEJBRuntimeException("can't get session contexts", e); } }
public static void setThreadProperties(final Properties p) { ActiveMQFactory.init(); try { setThreadProperties.invoke(instance, p); } catch (final IllegalAccessException e) { throw new OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalAccessException", e); } catch (final IllegalArgumentException e) { throw new OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalArgumentException", e); } catch (final InvocationTargetException e) { throw new OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.InvocationTargetException", e); } }
public static void setThreadProperties(final Properties p) { ActiveMQFactory.init(); try { setThreadProperties.invoke(instance, p); } catch (final IllegalAccessException e) { throw new OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalAccessException", e); } catch (final IllegalArgumentException e) { throw new OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.IllegalArgumentException", e); } catch (final InvocationTargetException e) { throw new OpenEJBRuntimeException("ActiveMQFactory.setThreadProperties.InvocationTargetException", e); } }
public ImportSql(final ClassLoader cl, final String resource, final DataSource ds) { dataSource = ds; done = false; if (dataSource == null) { throw new NullPointerException("datasource can't be null"); } try { imports = cl.getResources(IMPORT_FILE_PREFIX.concat(resource).concat(IMPORT_FILE_EXTENSION)); } catch (final IOException e) { throw new OpenEJBRuntimeException("can't look for init sql script", e); } }
@Override protected List<? extends Extension> loadExtensions(final ClassLoader classLoader) { final List<Extension> list = new ArrayList<>(); for (final Class<? extends Extension> e : extensions) { try { list.add(e.newInstance()); } catch (final Exception e1) { throw new OpenEJBRuntimeException(e1); } } return list; } }
public ImportSql(final ClassLoader cl, final String resource, final DataSource ds) { dataSource = ds; done = false; if (dataSource == null) { throw new NullPointerException("datasource can't be null"); } try { imports = cl.getResources(IMPORT_FILE_PREFIX.concat(resource).concat(IMPORT_FILE_EXTENSION)); } catch (final IOException e) { throw new OpenEJBRuntimeException("can't look for init sql script", e); } }
@Override protected List<? extends Extension> loadExtensions(final ClassLoader classLoader) { final List<Extension> list = new ArrayList<Extension>(); for (final Class<? extends Extension> e : extensions) { try { list.add(e.newInstance()); } catch (final Exception e1) { throw new OpenEJBRuntimeException(e1); } } return list; } }
private T rethrow(final Throwable t) throws Exception { if (Exception.class.isInstance(t)) { throw Exception.class.cast(t); } else if (Error.class.isInstance(t)) { throw Error.class.cast(t); } throw new OpenEJBRuntimeException(t.getMessage(), t); }
private EJBDSerializer instance() { try { return EJBDSerializer.class.cast(Thread.currentThread().getContextClassLoader().loadClass(classname).newInstance()); } catch (final Exception e) { throw new OpenEJBRuntimeException(e); } } }
<T> T createQuery(final Class<T> expected, final EntityManager entityManager, final Method method, final Object... args) { try { return expected.cast(method.invoke(entityManager, args)); } catch (final IllegalAccessException e) { throw new IllegalStateException(e); } catch (final InvocationTargetException e) { final Throwable t = e.getCause(); if (RuntimeException.class.isInstance(t)) { throw RuntimeException.class.cast(t); } throw new OpenEJBRuntimeException(t.getMessage(), t); } }
<T> T createQuery(final Class<T> expected, final EntityManager entityManager, final Method method, final Object... args) { try { return expected.cast(method.invoke(entityManager, args)); } catch (final IllegalAccessException e) { throw new IllegalStateException(e); } catch (final InvocationTargetException e) { final Throwable t = e.getCause(); if (RuntimeException.class.isInstance(t)) { throw RuntimeException.class.cast(t); } throw new OpenEJBRuntimeException(t.getMessage(), t); } }
private Convert(final Class primitiveClass, final Class objectClass, final String toPrimitiveMethodName) { objectType = Type.getType(objectClass); try { toObject = objectClass.getMethod("valueOf", primitiveClass); toPrimitive = objectClass.getMethod(toPrimitiveMethodName); } catch (final NoSuchMethodException e) { throw new OpenEJBRuntimeException(e); } conversionsByPrimitive.put(primitiveClass, this); }
private Deployer getDeployer() { final String deployerJndi = System.getProperty("openejb.deployer.jndiname", "openejb/DeployerBusinessRemote"); if (deployer == null) { try { final Properties p = new Properties(); p.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); p.put("java.naming.provider.url", openejbUri); final InitialContext ctx = new InitialContext(p); deployer = (Deployer) ctx.lookup(deployerJndi); } catch (final Exception e) { throw new OpenEJBRuntimeException(e); } } return deployer; }
@Override public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) { try { delegate.after(); } catch (final Exception e) { throw new OpenEJBRuntimeException(e); } } }
public void unregister() { try { LocalMBeanServer.get().unregisterMBean(objectName); } catch (final Exception e) { throw new OpenEJBRuntimeException(e); } }
private Convert(final Class primitiveClass, final Class objectClass, final String toPrimitiveMethodName) { objectType = Type.getType(objectClass); try { toObject = objectClass.getMethod("valueOf", primitiveClass); toPrimitive = objectClass.getMethod(toPrimitiveMethodName); } catch (final NoSuchMethodException e) { throw new OpenEJBRuntimeException(e); } conversionsByPrimitive.put(primitiveClass, this); }
@Override public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) { try { delegate.after(); } catch (final Exception e) { throw new OpenEJBRuntimeException(e); } } }
public IvmJndiFactory() { jndiRootContext = IvmContext.createRootContext(); try { jndiRootContext.bind("openejb/local/.", ""); jndiRootContext.bind("openejb/remote/.", ""); jndiRootContext.bind("openejb/client/.", ""); jndiRootContext.bind("openejb/Deployment/.", ""); jndiRootContext.bind("openejb/global/.", ""); } catch (final NamingException e) { throw new OpenEJBRuntimeException("this should not happen", e); } }