Package org.apache.wiki.api.exceptions

Examples of org.apache.wiki.api.exceptions.WikiException


        //
        //  Sanity checks first
        //
        if( renameFrom == null || renameFrom.length() == 0 )
        {
            throw new WikiException( "From name may not be null or empty" );
        }
        if( renameTo == null || renameTo.length() == 0 )
        {
            throw new WikiException( "To name may not be null or empty" );
        }
      
        //
        //  Clean up the "to" -name so that it does not contain anything illegal
        //
       
        String renameToClean = MarkupParser.cleanLink( renameTo.trim() );
       
        if( renameToClean.equals(renameFrom) )
        {
            throw new WikiException( "You cannot rename the page to itself" );
        }
       
        //
        //  Preconditions: "from" page must exist, and "to" page must not yet exist.
        //
        WikiEngine engine = context.getEngine();
        WikiPage fromPage = engine.getPage( renameFrom );
       
        if( fromPage == null )
        {
            throw new WikiException("No such page "+renameFrom);
        }
       
        WikiPage toPage = engine.getPage( renameToClean );
       
        if( toPage != null )
        {
            throw new WikiException( "Page already exists " + renameToClean );
        }
       
        //
        //  Options
        //
View Full Code Here


        }
        catch( InstantiationException e )
        {
            log.info( "Cannot instantiate requested class "+requestedClass, e );
           
            throw new WikiException("Failed to instantiate class "+requestedClass, e );
        }
        catch (IllegalAccessException e)
        {
            log.info( "Cannot access requested class "+requestedClass, e );
           
            throw new WikiException("Failed to instantiate class "+requestedClass, e );
        }
        catch (IllegalArgumentException e)
        {
            log.info( "Illegal arguments when constructing new object", e );
           
            throw new WikiException("Failed to instantiate class "+requestedClass, e );
        }
        catch (InvocationTargetException e)
        {
            log.info( "You tried to instantiate an abstract class "+requestedClass, e );
           
            throw new WikiException("Failed to instantiate class "+requestedClass, e );
        }
    }
View Full Code Here

        }
        catch (ClassNotFoundException e)
        {
            log.info( "Cannot find requested class", e );
           
            throw new WikiException("Failed to instantiate class "+requestedClass, e );
        }
    }
View Full Code Here

        {
            log.error( "Unable to locate the WikiRenderer(WikiContext,WikiDocument) constructor for "  + renderImplName );
        }
        if( m_rendererConstructor == null )
        {
            throw new WikiException( "Failed to get WikiRenderer '" + renderImplName + "'." );
        }
        log.info( "Rendering content with " + renderImplName + "." );

        WikiEventUtils.addWikiEventListener(m_engine, WikiPageEvent.POST_SAVE_BEGIN, this);
    }
View Full Code Here

            m_loginModuleClass = (Class<? extends LoginModule>) Class.forName( loginModuleClassName );
        }
        catch (ClassNotFoundException e)
        {
            e.printStackTrace();
            throw new WikiException( "Could not instantiate LoginModule class.", e );
        }
       
        // Initialize the LoginModule options
        initLoginModuleOptions( props );
    }
View Full Code Here

            log.debug("Initializing page provider class " + m_provider);
            m_provider.initialize(m_engine, props);
        } catch (ClassNotFoundException e) {
            log.error("Unable to locate provider class '" + classname + "'", e);
            throw new WikiException("No provider class.", e);
        } catch (InstantiationException e) {
            log.error("Unable to create provider class '" + classname + "'", e);
            throw new WikiException("Faulty provider class.", e);
        } catch (IllegalAccessException e) {
            log.error("Illegal access to provider class '" + classname + "'", e);
            throw new WikiException("Illegal provider class.", e);
        } catch (NoRequiredPropertyException e) {
            log.error("Provider did not found a property it was looking for: " + e.getMessage(), e);
            throw e;  // Same exception works.
        } catch (IOException e) {
            log.error("An I/O exception occurred while trying to create a new page provider: " + classname, e);
            throw new WikiException("Unable to start page provider: " + e.getMessage(), e);
        }

    }
View Full Code Here

            }
        }
        catch ( PolicyException e )
        {
            log.error("Could not initialize local security policy: " + e.getMessage() );
            throw new WikiException( "Could not initialize local security policy: " + e.getMessage(), e );
        }
    }
View Full Code Here

                return impl;
            }
            catch( ClassNotFoundException e )
            {
                log.fatal( "Authorizer " + clazz + " cannot be found", e );
                throw new WikiException( "Authorizer " + clazz + " cannot be found", e );
            }
            catch( InstantiationException e )
            {
                log.fatal( "Authorizer " + clazz + " cannot be created", e );
                throw new WikiException( "Authorizer " + clazz + " cannot be created", e );
            }
            catch( IllegalAccessException e )
            {
                log.fatal( "You are not allowed to access this authorizer class", e );
                throw new WikiException( "You are not allowed to access this authorizer class", e );
            }
        }

        throw new NoRequiredPropertyException( "Unable to find a " + PROP_AUTHORIZER + " entry in the properties.",
                                               PROP_AUTHORIZER );
View Full Code Here

    public Principal getApprover( String messageKey ) throws WikiException
    {
        Principal approver = m_approvers.get( messageKey );
        if ( approver == null )
        {
            throw new WikiException( "Workflow '" + messageKey + "' does not require approval." );
        }

        // Try to resolve UnresolvedPrincipals
        if ( approver instanceof UnresolvedPrincipal )
        {
            String name = approver.getName();
            approver = m_engine.getAuthorizationManager().resolvePrincipal( name );

            // If still unresolved, throw exception; otherwise, freshen our
            // cache
            if ( approver instanceof UnresolvedPrincipal )
            {
                throw new WikiException( "Workflow approver '" + name + "' cannot not be resolved." );
            }

            m_approvers.put( messageKey, approver );
        }
        return approver;
View Full Code Here

            String msg = Release.APPNAME+": Unable to load and setup properties from jspwiki.properties. "+e.getMessage();
            if ( context != null )
            {
                context.log( msg );
            }
            throw new WikiException( msg, e );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.wiki.api.exceptions.WikiException

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.