Package org.apache.avalon.framework

Examples of org.apache.avalon.framework.CascadingException


        catch( final Throwable e )
        {
            final String error =
              "Error creating factory with class " + className;
            getLogger().error( "## CLASSLOADER: " + Thread.currentThread().getContextClassLoader() );
            throw new CascadingException( error, e );
        }

        ContainerUtil.enableLogging( factory, getLogger() );
        ContainerUtil.contextualize( factory, m_context );
        ContainerUtil.configure( factory, configuration );
View Full Code Here


*/
public class CascadingExceptionTestCase extends TestCase
{
    public void testConstructor()
    {
        assertNotNull( new CascadingException( null, null ) );
        assertNotNull( new CascadingException( "msg", null ) );
        assertNotNull(
                new CascadingException( "msg", new RuntimeException() ) );
        assertNotNull( new CascadingException( null, new RuntimeException() ) );

        assertNotNull( new CascadingException( "msg" ) );
        // ambiguous assertNotNull( new CascadingException( null ) );
        //assertNotNull( new CascadingException() );
    }
View Full Code Here

    }

    public void testGetCause()
    {
        RuntimeException re = new RuntimeException();
        CascadingException e = new CascadingException( "msg", re );

        assertEquals( re, e.getCause() );

        e = new CascadingException( "msg", null );
        assertNull( e.getCause() );

        // default to jdk 1.3 cause (not that it seems to help,
        // but it still makes sense)
        /*Exception exc = new Exception("blah");
        try
View Full Code Here

        }*/
    }

    public void testCasts()
    {
        CascadingException e = new CascadingException( "msg", null );
        assertTrue( e instanceof Exception );
        assertTrue( e instanceof CascadingThrowable );
    }
View Full Code Here

            InputSource inputSource = new InputSource(source.getInputStream());
            inputSource.setSystemId(source.getURI());
            formDocument = DomHelper.parse(inputSource);
        }
        catch (Exception exc) {
            throw new CascadingException("Could not parse form definition from " + source.getURI(), exc);
        }

        Element formElement = formDocument.getDocumentElement();

        // check that the root element is a wd:form element
View Full Code Here

     */
    protected Expression parseExpression(String exprString, Element element, String attrName) throws Exception {
        try {
            return expressionManager.parse(exprString);
        } catch (TokenMgrError e) {
            throw new CascadingException("Error in expression \"" + exprString + "\" in attribute \"" + attrName + "\" at " + DomHelper.getLocation(element), e);
        } catch (Exception e) {
            throw new CascadingException("Error in expression \"" + exprString + "\" in attribute \"" + attrName + "\" at " + DomHelper.getLocation(element), e);
        }
    }
View Full Code Here

                        while ((read = reader.read(ary)) != -1) {
                            super.characters(ary,0,read);
                        }
                    } catch (SourceNotFoundException e) {
                        useFallbackLevel++;
                        fallBackException = new CascadingException("Resource not found: " + url.getURI());
                        getLogger().error("xIncluded resource not found: " + url.getURI(), e);
                    } finally {
                        if (reader != null) reader.close();
                        if (isr != null) isr.close();
                        if (is != null) is.close();
                    }
                } else if (parse.equals("xml")) {
                    getLogger().debug("Parse type is XML");

                    // Check loop inclusion
                    if (isLoopInclusion(url.getURI(), xpointer)) {
                        throw new ProcessingException("Detected loop inclusion of href=" + url.getURI() + ", xpointer=" + xpointer);
                    }

                    XIncludePipe subPipe = new XIncludePipe();
                    subPipe.enableLogging(getLogger());
                    subPipe.init(url.getURI(), xpointer);
                    subPipe.setConsumer(xmlConsumer);
                    subPipe.setParent(this);

                    try {
                        if (xpointer != null && xpointer.length() > 0) {
                            XPointer xptr;
                            xptr = XPointerFrameworkParser.parse(NetUtils.decodePath(xpointer));
                            XPointerContext context = new XPointerContext(xpointer, url, subPipe, getLogger(), manager);
                            xptr.process(context);
                        } else {
                            SourceUtil.toSAX(url, new IncludeXMLConsumer(subPipe));
                        }
                        // restore locator on the consumer
                        if (locator != null)
                            xmlConsumer.setDocumentLocator(locator);
                    } catch (ResourceNotFoundException e) {
                        useFallbackLevel++;
                        fallBackException = new CascadingException("Resource not found: " + url.getURI());
                        getLogger().error("xIncluded resource not found: " + url.getURI(), e);
                    } catch (ParseException e) {
                        // this exception is thrown in case of an invalid xpointer expression
                        useFallbackLevel++;
                        fallBackException = new CascadingException("Error parsing xPointer expression", e);
                        fallBackException.fillInStackTrace();
                        getLogger().error("Error parsing XPointer expression, will try to use fallback.", e);
                    } catch(SAXException e) {
                        getLogger().error("Error in processXIncludeElement", e);
                        throw e;
View Full Code Here

        String typeName = DomHelper.getAttribute(datatypeElement, "base");
        DatatypeBuilder builder = null;
        try {
            builder = (DatatypeBuilder)typeBuilderSelector.select(typeName);
        } catch (ServiceException e) {
            throw new CascadingException("Unknown datatype '" + typeName + "' specified at " + DomHelper.getLocation(datatypeElement), e);
        }
        return builder.build(datatypeElement, arrayType, this);
    }
View Full Code Here

        String name  = validationRuleElement.getLocalName();
        ValidationRuleBuilder builder = null;
        try {
            builder = (ValidationRuleBuilder)validationRuleBuilderSelector.select(name);
        } catch (ServiceException e) {
            throw new CascadingException("Unknown validation rule \"" + name + "\" specified at " + DomHelper.getLocation(validationRuleElement), e);
        }
        return builder.build(validationRuleElement);
    }
View Full Code Here

            try {
                InputSource inputSource = new InputSource(source.getInputStream());
                inputSource.setSystemId(source.getURI());
                formDocument = DomHelper.parse(inputSource, this.manager);
            } catch (Exception e) {
                throw new CascadingException("Could not parse form definition from " +
                                             source.getURI(), e);
            }

            Element formElement = formDocument.getDocumentElement();
            formDefinition = getFormDefinition(formElement);
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.CascadingException

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.