jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r814372 - in /incubator/jspwiki/trunk: ./ src/java/org/apache/wiki/ src/java/org/apache/wiki/action/ src/java/org/apache/wiki/content/ src/java/org/apache/wiki/content/jcr/ src/java/org/apache/wiki/tags/
Date Sun, 13 Sep 2009 18:06:10 GMT
Author: metskem
Date: Sun Sep 13 18:06:09 2009
New Revision: 814372

URL: http://svn.apache.org/viewvc?rev=814372&view=rev
Log:
3.0.0-svn-156
        
        * JSPWIKI-595: Fixed EditActionBean to set the ChangeNote
        when saving a page.
        
        * Fixed a bunch of JavaDoc errors and CheckStyle warnings
        
        * Added more error logging to JCRWikiPage

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/HistoryIteratorTag.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=814372&r1=814371&r2=814372&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun Sep 13 18:06:09 2009
@@ -1,3 +1,14 @@
+2009-09-12 Harry Metske <metskem@apache.org>
+
+        * 3.0.0-svn-156
+        
+        * JSPWIKI-595: Fixed EditActionBean to set the ChangeNote
+        when saving a page.
+        
+        * Fixed a bunch of JavaDoc errors and CheckStyle warnings
+        
+        * Added more error logging to JCRWikiPage
+        
 2009-09-13 Andrew Jaquith <ajaquith AT apache DOT org>
 
         * 3.0.0-svn-155

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=814372&r1=814371&r2=814372&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Sun Sep 13 18:06:09 2009
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "155";
+    public static final String     BUILD         = "156";
 
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java?rev=814372&r1=814371&r2=814372&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java Sun Sep 13
18:06:09 2009
@@ -400,6 +400,10 @@
         // Set author information and other metadata
         WikiPage modifiedPage = (WikiPage) wikiContext.getPage().clone();
         modifiedPage.setAuthor( m_author );
+        if( m_changeNote != null )
+        {
+            modifiedPage.setAttribute( WikiPage.CHANGENOTE, m_changeNote );
+        }
 
         // If this is an append, add it to the page.
         // If a full edit, replace the previous contents.

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=814372&r1=814371&r2=814372&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java Sun Sep 13
18:06:09 2009
@@ -1093,7 +1093,7 @@
                     {
                         i.remove();
 
-                        log.error( "Reaped lock: " + p );
+                        log.info( "Reaped lock: " + p );
                     }
                 }
             }

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java?rev=814372&r1=814371&r2=814372&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java Sun Sep
13 18:06:09 2009
@@ -35,6 +35,8 @@
 import org.apache.wiki.content.ContentManager;
 import org.apache.wiki.content.PageNotFoundException;
 import org.apache.wiki.content.WikiPath;
+import org.apache.wiki.log.Logger;
+import org.apache.wiki.log.LoggerFactory;
 import org.apache.wiki.providers.ProviderException;
 
 
@@ -61,14 +63,19 @@
 
     private static final String ATTR_CONTENT = "wiki:content";
 
-    public static final String ATTR_VERSION  = "wiki:version";
+    /** The name of the version attribute */
+    public static final String ATTR_VERSION = "wiki:version";
     
+    /** The name of the contentType  attribute */
     public  static final String CONTENTTYPE  = "wiki:contentType";
     
+    private WikiPath m_path;
 
-    private       WikiPath   m_path;
-    private       WikiEngine m_engine;
-    private String           m_jcrPath = null;
+    private WikiEngine m_engine;
+
+    private String m_jcrPath;
+    
+    private static final Logger log = LoggerFactory.getLogger( JCRWikiPage.class);
     
     /** 
      * Use {@link WikiEngine#createPage(WikiPath)} instead. 
@@ -84,10 +91,10 @@
     /**
      *  Creates a JCRWikiPage using the default path.
      *  
-     *  @param engine
-     *  @param node
-     *  @throws RepositoryException
-     *  @throws ProviderException
+     *  @param engine a reference to the {@link org.apache.wiki.WikiEngine}
+     *  @param node the JCR {@link javax.jcr.Node}
+     *  @throws ProviderException if the provider failed
+     *  @throws RepositoryException If the page cannot be located.
      */
     public JCRWikiPage(WikiEngine engine, Node node)
         throws RepositoryException, ProviderException
@@ -101,10 +108,10 @@
      *  default page hierarchy, for example when you need to create
      *  a temporary storage for workflows.
      *  
-     *  @param engine
-     *  @param name
-     *  @param node
-     *  @throws RepositoryException
+     *  @param engine a reference to the {@link org.apache.wiki.WikiEngine}
+     *  @param name the {@link org.apache.wiki.api.WikiPath}
+     *  @param node the JCR {@link javax.jcr.Node}
+     *  @throws RepositoryException If the page cannot be located.
      */
     public JCRWikiPage(WikiEngine engine, WikiPath name, Node node) 
         throws RepositoryException
@@ -125,24 +132,24 @@
         return m_engine.getContentManager().getJCRNode(m_jcrPath);
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getName()
+    /**
+     * {@inheritDoc}
      */
     public String getName()
     {
         return m_path.getPath();
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getQualifiedName()
+    /**
+     * {@inheritDoc}
      */
     public WikiPath getPath()
     {
         return m_path;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getAttribute(java.lang.String)
+    /**
+     * {@inheritDoc}
      */
     public Serializable getAttribute( String key )
     {
@@ -159,9 +166,17 @@
                 throw new IllegalStateException( "The value returned by " + key + " was not
a Serializable, as expected.");
             }
         }
-        catch( ItemNotFoundException e ) {}
-        catch( RepositoryException e ) {} // FIXME: Should log this at least.
-        
+        catch( ItemNotFoundException e )
+        {
+            log.error( "ItemNotFoundException occurred while getting Attribute " + key, e
);
+        }
+        catch( RepositoryException e )
+        {
+            // the following exception still occurs quite often, so no stacktrace for now
+            log.warn( "RepositoryException occurred while getting Attribute " + key + " :
"  +  e );
+        }
+        // until this is fixed we want some more diagnostic info 
+        log.warn("attribute value for key " + key + " is not Serializable, returning null
value");
         return null;
     }
 
@@ -170,8 +185,8 @@
      *  
      *  @param key the key for which we want the property
      *  @return Property
-     *  @throws PathNotFoundException
-     *  @throws RepositoryException
+     *  @throws PathNotFoundException if the path to the property cannot be found
+     *  @throws RepositoryException general {@link javax.jcr.RepositoryException} exception
      */
     public Property getProperty( String key ) throws PathNotFoundException, RepositoryException
     {
@@ -184,8 +199,10 @@
         {
             case PropertyType.STRING:
                 return property.getString();
+            default:
+                break;
         }
-        
+
         return property.getString();
     }
 
@@ -200,9 +217,15 @@
             // the right thing to do here.
             getJCRNode().setProperty( key, attribute.toString() );
         }
-        catch(RepositoryException e) {} // FIXME: Should log
+        catch(RepositoryException e) 
+        {
+            log.error( "Exception occurred while setting (Serializable) attribute " + key,
e );
+        }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setAttribute( String key, Date attribute )
     {
         try
@@ -211,11 +234,14 @@
             c.setTime( attribute );
             getJCRNode().setProperty( key, c );
         }
-        catch(RepositoryException e) {} // FIXME: Should log        
+        catch(RepositoryException e) 
+        {
+            log.error( "Exception occurred while setting (Date) attribute " + key, e );
+        }
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getAttributes()
+    /**
+     * {@inheritDoc}
      */
     //
     // This method will be removed, since it makes no sense to get
@@ -226,8 +252,8 @@
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#removeAttribute(java.lang.String)
+    /**
+     * {@inheritDoc}
      */
     public Serializable removeAttribute( String key )
     {
@@ -266,21 +292,21 @@
         }
         catch( RepositoryException e )
         {
-            // FIXME: Should rethrow
+            log.warn( "RepositoryException while getting lastModified : " + e ); 
         }
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#setLastModified(java.util.Date)
+    /**
+     * {@inheritDoc}
      */
     public void setLastModified( Date date )
     {
         setAttribute( LASTMODIFIED, date );
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getVersion()
+    /**
+     * {@inheritDoc}
      */
     public int getVersion()
     {
@@ -297,8 +323,8 @@
         return 0;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getSize()
+    /**
+     * {@inheritDoc}
      */
     public long getSize()
     {
@@ -311,8 +337,8 @@
         return -1;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getAcl()
+    /**
+     * {@inheritDoc}
      */
     public Acl getAcl()
     {
@@ -334,18 +360,15 @@
         }
         catch( RepositoryException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "RepositoryException occurred while getting ACL ", e );
         }
         catch( IOException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "IOException occurred while getting ACL ", e );
         }
         catch( ClassNotFoundException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "ClassNotFoundException occurred while getting ACL ", e );
         }
         finally
         {
@@ -362,8 +385,8 @@
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#setAcl(org.apache.wiki.auth.acl.Acl)
+    /**
+     * {@inheritDoc}
      */
     public void setAcl( Acl acl )
     {
@@ -381,55 +404,49 @@
         }
         catch( IOException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "IOException occurred while setting ACL ", e );
         }
         catch( ValueFormatException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "ValueFormatException occurred while setting ACL ", e );
         }
         catch( VersionException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "VersionException occurred while setting ACL ", e );
         }
         catch( LockException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "LockException occurred while setting ACL ", e );
         }
         catch( ConstraintViolationException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "ConstraintViolationException occurred while setting ACL ", e );
         }
         catch( RepositoryException e )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error( "RepositoryException occurred while setting ACL ", e );
         }
         
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#setAuthor(java.lang.String)
+    /**
+     * {@inheritDoc}
      */
     public void setAuthor( String author )
     {
         setAttribute( AUTHOR, author );
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getAuthor()
+    /**
+     * {@inheritDoc}
      */
     public String getAuthor()
     {
         return (String)getAttribute( AUTHOR );
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#getWiki()
+    /**
+     * {@inheritDoc}
      */
     // FIXME: Should we rename this method?
     public String getWiki()
@@ -437,16 +454,16 @@
         return m_path.getSpace();
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#toString()
+    /**
+     * {@inheritDoc}
      */
     public String toString()
     {
         return "WikiPage ["+m_path+",ver="+getVersion()+",mod="+getLastModified()+"]";
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#clone()
+    /**
+     * {@inheritDoc}
      */
     public Object clone()
     {
@@ -493,14 +510,17 @@
         return false;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.wiki.WikiPage#hashCode()
+    /**
+     *  {@inheritDoc}
      */
     public int hashCode()
     {
         return m_path.hashCode() * getVersion();
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public InputStream getContentAsStream() throws ProviderException
     {
         try
@@ -519,22 +539,34 @@
         return null;
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public String getContentType()
     {
         return (String)getAttribute( CONTENTTYPE );
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public List<WikiPath> getReferrers() throws ProviderException
     {
         return m_engine.getReferenceManager().getReferredBy( m_path );
     }
     
+    /**
+     *  {@inheritDoc}
+     */
     public List<WikiPath> getRefersTo() throws ProviderException
     {
         return m_engine.getReferenceManager().getRefersTo( m_path );
     }
     
 
+    /**
+     *  {@inheritDoc}
+     */
     public void setContent( InputStream in ) throws ProviderException
     {
         try
@@ -547,6 +579,9 @@
         }
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public void setContentType( String contentType )
     {
         setAttribute( CONTENTTYPE, contentType );
@@ -567,6 +602,9 @@
         }
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public String getContentAsString() throws ProviderException
     {
         try
@@ -586,6 +624,9 @@
         return null;
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public void setContent( String content ) throws ProviderException
     {
         try
@@ -617,6 +658,9 @@
         return m_path.getName();
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public boolean isLatest() throws RepositoryException
     {
         // TODO: This is a bit kludgish, but works.
@@ -637,6 +681,9 @@
         
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public void setFileName( String name )
     {
         // TODO Auto-generated method stub
@@ -718,6 +765,9 @@
         return (JCRWikiPage)p;
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public JCRWikiPage getCurrentVersion() throws ProviderException
     {
         try

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/HistoryIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/HistoryIteratorTag.java?rev=814372&r1=814371&r2=814372&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/HistoryIteratorTag.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/HistoryIteratorTag.java Sun Sep
13 18:06:09 2009
@@ -50,10 +50,11 @@
 
     private static final Collection<WikiPage> EMPTY_COLLECTION = Collections.unmodifiableCollection(
new ArrayList<WikiPage>() );
 
-    static Logger log = LoggerFactory.getLogger( HistoryIteratorTag.class );
+   private  static final Logger log = LoggerFactory.getLogger( HistoryIteratorTag.class );
 
     /**
      * Returns the historical versions of the current WikiPage.
+     * @return a collection of {@link org.apache.content.WikiPage} objects
      */
     @Override
     protected Collection<WikiPage> initItems()
@@ -69,7 +70,7 @@
         }
         catch( PageNotFoundException e )
         {
-            log.error( "Provider claims page " + page.getName() + " doesn't exists, right
after it said it did. This is odd!", e );
+            log.error( "Provider claims page " + page.getName() + " doesn't exist, right
after it said it did. This is odd!", e );
         }
         catch( ProviderException e )
         {



Mime
View raw message