Package groovy.lang

Examples of groovy.lang.GroovyRuntimeException


                    inStream = url.openStream();
                    properties.load(inStream);
                    ((MetaClassRegistryImpl)GroovySystem.getMetaClassRegistry()).registerExtensionModuleFromProperties(properties, classLoader, map);
                }
                catch (IOException e) {
                    throw new GroovyRuntimeException("Unable to load module META-INF descriptor", e);
                }
                finally {
                    if(inStream != null) {
                        inStream.close();
                    }
View Full Code Here


            }
        }
        try {
            return scriptClass.newInstance();
        } catch (Exception e) {
            throw new GroovyRuntimeException("Failed to create Script instance for class: "+ scriptClass + ". Reason: " + e, e);
        }
    }
View Full Code Here

        this.staticExtensionClasses = staticExtensionClasses;
    }

    public static MetaInfExtensionModule newModule(final Properties properties, final ClassLoader loader) {
        String name = properties.getProperty(PropertiesModuleFactory.MODULE_NAME_KEY);
        if (name==null) throw new GroovyRuntimeException("Module file hasn't set the module name using key ["+PropertiesModuleFactory.MODULE_NAME_KEY+"]");
        String version = properties.getProperty(PropertiesModuleFactory.MODULE_VERSION_KEY);
        if (version==null) throw new GroovyRuntimeException("Module file hasn't set the module version using key ["+PropertiesModuleFactory.MODULE_VERSION_KEY+"]");
        String[] extensionClasses = properties.getProperty(MODULE_INSTANCE_CLASSES_KEY, "").trim().split("[,; ]");
        String[] staticExtensionClasses = properties.getProperty(MODULE_STATIC_CLASSES_KEY, "").trim().split("[,; ]");
        List<Class> instanceClasses = new ArrayList<Class>(extensionClasses.length);
        List<Class> staticClasses = new ArrayList<Class>(staticExtensionClasses.length);
        List<String> errors = new LinkedList<String>();
View Full Code Here

            try {
                Class<? extends PropertiesModuleFactory> factoryClass = (Class<? extends PropertiesModuleFactory>) classLoader.loadClass(factoryName);
                PropertiesModuleFactory delegate = factoryClass.newInstance();
                return delegate.newModule(properties, classLoader);
            } catch (ClassNotFoundException e) {
                throw new GroovyRuntimeException("Unable to load module factory ["+factoryName+"]",e);
            } catch (InstantiationException e) {
                throw new GroovyRuntimeException("Unable to instantiate module factory ["+factoryName+"]",e);
            } catch (IllegalAccessException e) {
                throw new GroovyRuntimeException("Unable to instantiate module factory ["+factoryName+"]",e);
            }
        }
        return MetaInfExtensionModule.newModule(properties, classLoader);
    }
View Full Code Here

        InputStream inStream = null;
        try {
            inStream = metadata.openStream();
            properties.load(inStream);
        } catch (IOException e) {
            throw new GroovyRuntimeException("Unable to load module META-INF descriptor", e);
        } finally {
            closeQuietly(inStream);
        }
        scanExtensionModuleFromProperties(properties);
    }
View Full Code Here

        return buf.toString();
    }

    private void throwException(String m, Exception e) {
        if (!ignoreErrors) {
            throw new GroovyRuntimeException(m + e, e);
        }
    }
View Full Code Here

        }
    }

    private void throwExceptionWithTarget(String m, MBeanException e) {
        if (!ignoreErrors) {
            throw new GroovyRuntimeException(m + e, e.getTargetException());
        }
    }
View Full Code Here

    /**
     * Throws a <code>GroovyRuntimeException</code>, because this method is not implemented yet.
     */
    public GPathResult parents() {
        // TODO Auto-generated method stub
        throw new GroovyRuntimeException("parents() not implemented yet");
    }
View Full Code Here

    /**
     * Throws a <code>GroovyRuntimeException</code>, because an attribute can have no children.
     */
    public Iterator childNodes() {
        throw new GroovyRuntimeException("can't call childNodes() in the attribute " + this.name);
    }
View Full Code Here

    /**
     * Throws a <code>GroovyRuntimeException</code>, because attributes can have no children.
     */
    public Iterator childNodes() {
        throw new GroovyRuntimeException("Can't get the child nodes on a GPath expression selecting attributes: ...." + this.parent.name() + "." + name() + ".childNodes()");
    }
View Full Code Here

TOP

Related Classes of groovy.lang.GroovyRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.