This is an automated email from the ASF dual-hosted git repository. juanpablo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/jspwiki.git
commit ae7c1a205e3b323459fbd20399040c3ed4795286 Author: juanpablo <juanpa...@apache.org> AuthorDate: Tue Nov 13 00:26:00 2018 +0100 add @Overrides, code format --- .../src/main/java/org/apache/wiki/PageManager.java | 2 +- .../src/main/java/org/apache/wiki/WikiEngine.java | 29 +++++++--------------- .../wiki/auth/authorize/XMLGroupDatabase.java | 19 ++++++++------ .../java/org/apache/wiki/parser/LinkParser.java | 7 +++--- 4 files changed, 26 insertions(+), 31 deletions(-) diff --git a/jspwiki-main/src/main/java/org/apache/wiki/PageManager.java b/jspwiki-main/src/main/java/org/apache/wiki/PageManager.java index 8776890..35605ed 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/PageManager.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/PageManager.java @@ -438,7 +438,7 @@ public class PageManager extends ModuleManager implements WikiEventListener { * @return If the page does not exist, returns null, otherwise a List of WikiPages. * @throws ProviderException If the repository fails. */ - public List getVersionHistory(String pageName) throws ProviderException { + public List< WikiPage > getVersionHistory(String pageName) throws ProviderException { if (pageExists(pageName)) { return m_provider.getVersionHistory(pageName); } diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java index 289d475..98a88d0 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java @@ -1853,29 +1853,21 @@ public class WikiEngine /** - * Returns a Collection of WikiPages containing the - * version history of a page. + * Returns a Collection of WikiPages containing the version history of a page. * * @param page Name of the page to look for - * @return an ordered List of WikiPages, each corresponding to a different - * revision of the page. + * @return an ordered List of WikiPages, each corresponding to a different revision of the page. */ - - public List< ? extends WikiPage > getVersionHistory( String page ) - { + public List< ? extends WikiPage > getVersionHistory( String page ) { List< ? extends WikiPage > c = null; - try - { + try { c = m_pageManager.getVersionHistory( page ); - if( c == null ) - { + if( c == null ) { c = m_attachmentManager.getVersionHistory( page ); } - } - catch( ProviderException e ) - { + } catch( ProviderException e ) { log.error( "FIXME", e ); } @@ -1888,13 +1880,10 @@ public class WikiEngine * Note that the API was changed in 2.6 to provide a WikiContext object! * * @param context The WikiContext of the page you wish to get a diff from - * @param version1 Version number of the old page. If - * WikiPageProvider.LATEST_VERSION (-1), then uses current page. - * @param version2 Version number of the new page. If - * WikiPageProvider.LATEST_VERSION (-1), then uses current page. + * @param version1 Version number of the old page. If WikiPageProvider.LATEST_VERSION (-1), then uses current page. + * @param version2 Version number of the new page. If WikiPageProvider.LATEST_VERSION (-1), then uses current page. * - * @return A HTML-ized difference between two pages. If there is no difference, - * returns an empty string. + * @return A HTML-ized difference between two pages. If there is no difference, returns an empty string. */ public String getDiff( WikiContext context, int version1, int version2 ) { diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java index ac07015..a6d2446 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java @@ -39,16 +39,16 @@ import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.lang.StringEscapeUtils; import org.apache.log4j.Logger; -import org.apache.wiki.util.TextUtil; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; import org.apache.wiki.WikiEngine; import org.apache.wiki.api.exceptions.NoRequiredPropertyException; import org.apache.wiki.auth.NoSuchPrincipalException; import org.apache.wiki.auth.WikiPrincipal; import org.apache.wiki.auth.WikiSecurityException; +import org.apache.wiki.util.TextUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; /** * <p> @@ -110,7 +110,7 @@ public class XMLGroupDatabase implements GroupDatabase private WikiEngine m_engine = null; - private Map<String, Group> m_groups = new HashMap<String, Group>(); + private Map<String, Group> m_groups = new HashMap<>(); /** * No-op method that in previous versions of JSPWiki was intended to @@ -121,7 +121,8 @@ public class XMLGroupDatabase implements GroupDatabase * @deprecated there is no need to call this method because the save and * delete methods contain their own commit logic */ - @SuppressWarnings("deprecation") + @Deprecated + @Override public void commit() throws WikiSecurityException { } @@ -135,6 +136,7 @@ public class XMLGroupDatabase implements GroupDatabase * supplied group (thrown as {@link NoSuchPrincipalException}) or if * the commit did not succeed */ + @Override public void delete( Group group ) throws WikiSecurityException { String index = group.getName(); @@ -160,6 +162,7 @@ public class XMLGroupDatabase implements GroupDatabase * @return the wiki groups * @throws WikiSecurityException if the groups cannot be returned by the back-end */ + @Override public Group[] groups() throws WikiSecurityException { buildDOM(); @@ -177,6 +180,7 @@ public class XMLGroupDatabase implements GroupDatabase * located, parsed, or opened * @throws WikiSecurityException if the database could not be initialized successfully */ + @Override public void initialize( WikiEngine engine, Properties props ) throws NoRequiredPropertyException, WikiSecurityException { m_engine = engine; @@ -221,6 +225,7 @@ public class XMLGroupDatabase implements GroupDatabase * @param modifier the user who saved the Group * @throws WikiSecurityException if the Group could not be saved successfully */ + @Override public void save( Group group, Principal modifier ) throws WikiSecurityException { if ( group == null || modifier == null ) diff --git a/jspwiki-main/src/main/java/org/apache/wiki/parser/LinkParser.java b/jspwiki-main/src/main/java/org/apache/wiki/parser/LinkParser.java index b1c0882..0fb69c0 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/parser/LinkParser.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/parser/LinkParser.java @@ -169,7 +169,7 @@ public class LinkParser private static final String TARGET = "target"; private static final String DELIMS = " \t\n\r\f="; - private static final List< Attribute > m_EMPTY = new ArrayList< Attribute >(); + private static final List< Attribute > m_EMPTY = new ArrayList< >(); // ............ @@ -521,7 +521,7 @@ public class LinkParser { if( m_attribs == null ) { - m_attribs = new ArrayList<Attribute>(); + m_attribs = new ArrayList<>(); } m_attribs.add(attr); } @@ -531,7 +531,7 @@ public class LinkParser * * @return Iterator over the attributes. */ - public Iterator getAttributes() + public Iterator< Attribute > getAttributes() { return m_attribs != null ? m_attribs.iterator() @@ -542,6 +542,7 @@ public class LinkParser * Returns a wikitext string representation of this Link. * @return WikiText. */ + @Override public String toString() { StringBuilder sb = new StringBuilder();