I was getting the following when I hit the delete button:

JSPWiki has detected an error

Error Message
    An unknown exception java.lang.NullPointerException was caught by Error.jsp.
Place where detected
    com.ecyrd.jspwiki.ReferenceManager.pageRemoved(), line 572 

Easily fixed by putting a quick check on the pageRemoved method of com.ecyrd.jspwiki.ReferenceManager.

     * Updates the m_referedTo and m_referredBy hashmaps when a page has been
     * deleted.
     * <P>
     * Within the m_refersTo map the pagename is a key. The whole key-value-set
     * has to be removed to keep the map clean.
     * Within the m_referredBy map the name is stored as a value. Since a key
     * can have more than one value we have to delete just the key-value-pair
     * referring page:deleted page.
     *  @param page Name of the page to remove from the maps.
    public synchronized void pageRemoved( WikiPage page )
        String pageName = page.getName();

        Collection refTo = (Collection)m_refersTo.get( pageName );
        if (!(refTo == null || refTo.isEmpty())) {
            Iterator it_refTo = refTo.iterator();
            while( it_refTo.hasNext() )
                String referredPageName = (String)it_refTo.next();
                Set refBy = (Set)m_referredBy.get( referredPageName );

                if( refBy == null )
                    throw new InternalWikiException("Refmgr out of sync: page "+pageName+" refers to "+referredPageName+", which has null referrers.");


                m_referredBy.remove( referredPageName );

                // We won't put it back again if it becomes empty and does not exist.  It will be added
                // later on anyway, if it becomes referenced again.
                if( !(refBy.isEmpty() && !m_engine.pageExists(referredPageName)) )
                    m_referredBy.put( referredPageName, refBy );

        log.debug("Removing from m_refersTo HashMap key:value "+pageName+":"+m_refersTo.get( pageName ));
        m_refersTo.remove( pageName );

        Set refBy = (Set) m_referredBy.get( pageName );
        if( refBy == null || refBy.isEmpty() )
            m_referredBy.remove( pageName );


This was possibly because I hand-added some text files and didn't put a directory in, but a null-check never hurts anyway.

Thanks, but could you please also state the version against which your change is? There are so many versions around these days... :)

-- JanneJalkanen

Hmm. I'd like to say "the latest". Let me go check... it works for 2.3.100 . Looks fixed in 2.4.6-beta-150506 -- JMarquart

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-6) was last changed on 15-May-2006 18:46 by J Marquart