You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2017/12/03 18:56:53 UTC
[01/15] jspwiki git commit: Fixed JSPWIKI-843 - generate test-jar for
jspwiki-war (wasn't being generated)
Repository: jspwiki
Updated Branches:
refs/heads/master 5d14e2ca6 -> 719a1a1e3
Fixed JSPWIKI-843 - generate test-jar for jspwiki-war (wasn't being generated)
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/b9173165
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/b9173165
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/b9173165
Branch: refs/heads/master
Commit: b9173165be8fd31f623b72e79d9b392feef9d66b
Parents: 5d14e2c
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 01:03:20 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 01:03:20 2017 +0100
----------------------------------------------------------------------
jspwiki-war/pom.xml | 17 +++++++++++++++++
pom.xml | 9 +--------
2 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/b9173165/jspwiki-war/pom.xml
----------------------------------------------------------------------
diff --git a/jspwiki-war/pom.xml b/jspwiki-war/pom.xml
index a5f57e1..74d3a15 100644
--- a/jspwiki-war/pom.xml
+++ b/jspwiki-war/pom.xml
@@ -207,6 +207,23 @@
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
+
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <excludes>
+ <exclude>**/test*/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<!-- Surefire plugin (running unit tests):
http://maven.apache.org/surefire/maven-surefire-plugin/
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/b9173165/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 42890dd..8d59078 100644
--- a/pom.xml
+++ b/pom.xml
@@ -359,7 +359,7 @@
<plugin>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.6</version>
+ <version>3.0.2</version>
<configuration>
<archive>
<manifest>
@@ -371,13 +371,6 @@
</manifestEntries>
</archive>
</configuration>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
[02/15] jspwiki git commit: Move (private)
JSPWikiMarkupParser#getLocalBooleanProperty to (public)
WikiContext#getBooleanWikiProperty
Posted by ju...@apache.org.
Move (private) JSPWikiMarkupParser#getLocalBooleanProperty to (public) WikiContext#getBooleanWikiProperty
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/a39e7581
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/a39e7581
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/a39e7581
Branch: refs/heads/master
Commit: a39e7581fd69a05762cc982a7309a4e456812774
Parents: b917316
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 01:09:18 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 01:09:18 2017 +0100
----------------------------------------------------------------------
.../main/java/org/apache/wiki/WikiContext.java | 27 +++++++++--
.../apache/wiki/parser/JSPWikiMarkupParser.java | 47 +++-----------------
2 files changed, 28 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/a39e7581/jspwiki-war/src/main/java/org/apache/wiki/WikiContext.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/WikiContext.java b/jspwiki-war/src/main/java/org/apache/wiki/WikiContext.java
index ee7f2fb..b916e92 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/WikiContext.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/WikiContext.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki;
@@ -39,6 +39,7 @@ import org.apache.wiki.ui.GroupCommand;
import org.apache.wiki.ui.Installer;
import org.apache.wiki.ui.PageCommand;
import org.apache.wiki.ui.WikiCommand;
+import org.apache.wiki.util.TextUtil;
/**
* <p>Provides state information throughout the processing of a page. A
@@ -465,6 +466,24 @@ public class WikiContext
}
/**
+ * This is just a simple helper method which will first check the context
+ * if there is already an override in place, and if there is not,
+ * it will then check the given properties.
+ *
+ * @param key What key are we searching for?
+ * @param defValue Default value for the boolean
+ * @return {@code true} or {@code false}.
+ */
+ public boolean getBooleanWikiProperty( final String key, final boolean defValue ) {
+ Object bool = getVariable( key );
+ if( bool != null ) {
+ return TextUtil.isPositive( (String) bool );
+ }
+
+ return TextUtil.getBooleanProperty( getEngine().getWikiProperties(), key, defValue );
+ }
+
+ /**
* This method will safely return any HTTP parameters that
* might have been defined. You should use this method instead
* of peeking directly into the result of getHttpRequest(), since
@@ -654,7 +673,7 @@ public class WikiContext
/**
* Creates a deep clone of the WikiContext. This is useful when you want
* to be sure that you don't accidentally mess with page attributes, etc.
- *
+ *
* @since 2.8.0
* @return A deep clone of the WikiContext.
*/
@@ -682,7 +701,7 @@ public class WikiContext
return null;
}
-
+
/**
* Returns the WikiSession associated with the context.
* This method is guaranteed to always return a valid WikiSession.
@@ -698,7 +717,7 @@ public class WikiContext
/**
* This method can be used to find the WikiContext programmatically
- * from a JSP PageContext. We check the request context.
+ * from a JSP PageContext. We check the request context.
* The wiki context, if it exists,
* is looked up using the key
* {@link org.apache.wiki.tags.WikiTagBase#ATTR_CONTEXT}.
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/a39e7581/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 407328d..c3ea8b6 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -250,30 +250,17 @@ public class JSPWikiMarkupParser extends MarkupParser {
m_camelCaseLinks );
}
-
-
Boolean wysiwygVariable = (Boolean)m_context.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE );
if( wysiwygVariable != null )
{
m_wysiwygEditorMode = wysiwygVariable.booleanValue();
}
- m_plainUris = getLocalBooleanProperty( m_context,
- PROP_PLAINURIS,
- m_plainUris );
- m_useOutlinkImage = getLocalBooleanProperty( m_context,
- PROP_USEOUTLINKIMAGE,
- m_useOutlinkImage );
- m_useAttachmentImage = getLocalBooleanProperty( m_context,
- PROP_USEATTACHMENTIMAGE,
- m_useAttachmentImage );
- m_allowHTML = getLocalBooleanProperty( m_context,
- MarkupParser.PROP_ALLOWHTML,
- m_allowHTML );
-
- m_useRelNofollow = getLocalBooleanProperty( m_context,
- PROP_USERELNOFOLLOW,
- m_useRelNofollow );
+ m_plainUris = m_context.getBooleanWikiProperty( PROP_PLAINURIS, m_plainUris );
+ m_useOutlinkImage = m_context.getBooleanWikiProperty( PROP_USEOUTLINKIMAGE, m_useOutlinkImage );
+ m_useAttachmentImage = m_context.getBooleanWikiProperty( PROP_USEATTACHMENTIMAGE, m_useAttachmentImage );
+ m_allowHTML = m_context.getBooleanWikiProperty( PROP_ALLOWHTML, m_allowHTML );
+ m_useRelNofollow = m_context.getBooleanWikiProperty( PROP_USERELNOFOLLOW, m_useRelNofollow );
if( m_engine.getUserManager().getUserDatabase() == null || m_engine.getAuthorizationManager() == null )
{
@@ -284,30 +271,6 @@ public class JSPWikiMarkupParser extends MarkupParser {
}
/**
- * This is just a simple helper method which will first check the context
- * if there is already an override in place, and if there is not,
- * it will then check the given properties.
- *
- * @param context WikiContext to check first
- * @param key What key are we searching for?
- * @param defValue Default value for the boolean
- * @return True or false
- */
- private static boolean getLocalBooleanProperty( WikiContext context,
- String key,
- boolean defValue )
- {
- Object bool = context.getVariable(key);
-
- if( bool != null )
- {
- return TextUtil.isPositive( (String) bool );
- }
-
- return TextUtil.getBooleanProperty( context.getEngine().getWikiProperties(), key, defValue );
- }
-
- /**
* Returns link name, if it exists; otherwise it returns null.
*/
private String linkExists( String page )
[13/15] jspwiki git commit: get rid of easy to fix compilation
warnings
Posted by ju...@apache.org.
get rid of easy to fix compilation warnings
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/1cd2e94b
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/1cd2e94b
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/1cd2e94b
Branch: refs/heads/master
Commit: 1cd2e94b54684b780ed32e1a5a99a2507790e504
Parents: cc253b3
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 19:06:10 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 19:06:10 2017 +0100
----------------------------------------------------------------------
.../main/java/org/apache/wiki/PageManager.java | 5 +-
.../org/apache/wiki/forms/FormTextarea.java | 21 +++--
.../htmltowiki/HtmlStringToWikiTranslator.java | 28 +++----
.../wiki/parser/CreoleToJSPWikiTranslator.java | 29 +++----
.../java/org/apache/wiki/parser/LinkParser.java | 4 +-
.../java/org/apache/wiki/plugin/Denounce.java | 18 ++--
.../java/org/apache/wiki/plugin/InsertPage.java | 28 +++----
.../apache/wiki/plugin/ReferredPagesPlugin.java | 11 +--
.../apache/wiki/plugin/UnusedPagesPlugin.java | 20 ++---
.../apache/wiki/plugin/WeblogArchivePlugin.java | 37 ++++-----
.../org/apache/wiki/plugin/WeblogPlugin.java | 6 +-
.../apache/wiki/preferences/Preferences.java | 1 -
.../apache/wiki/providers/CachingProvider.java | 10 +--
.../wiki/providers/VersioningFileProvider.java | 86 ++++++++++----------
.../org/apache/wiki/render/CreoleRenderer.java | 44 +++++-----
.../wiki/render/WysiwygEditingRenderer.java | 2 -
.../java/org/apache/wiki/rss/RSS20Feed.java | 10 +--
.../org/apache/wiki/search/SearchManager.java | 33 ++++----
.../org/apache/wiki/ui/TemplateManager.java | 38 ++++-----
.../java/org/apache/wiki/ui/WikiJSPFilter.java | 78 +++++++++---------
.../apache/wiki/url/DefaultURLConstructor.java | 69 ++++++++--------
.../java/org/apache/wiki/xmlrpc/RPCServlet.java | 9 +-
jspwiki-war/src/test/java/SamplePlugin2.java | 4 +-
.../src/test/java/org/apache/wiki/Util.java | 7 +-
.../org/apache/wiki/VariableManagerTest.java | 15 ++--
.../wiki/auth/AuthenticationManagerTest.java | 10 +--
.../auth/login/AnonymousLoginModuleTest.java | 15 ++--
.../login/CookieAssertionLoginModuleTest.java | 21 ++---
.../auth/login/UserDatabaseLoginModuleTest.java | 23 +++---
.../auth/login/WebContainerLoginModuleTest.java | 14 ++--
.../AllPermissionCollectionTest.java | 20 ++---
.../org/apache/wiki/plugin/SamplePlugin3.java | 8 +-
.../org/apache/wiki/rss/RSSGeneratorTest.java | 11 ++-
.../wiki/url/DefaultURLConstructorTest.java | 47 ++++++-----
.../wiki/url/ShortURLConstructorTest.java | 47 ++++++-----
.../wiki/url/ShortViewURLConstructorTest.java | 47 ++++++-----
.../org/apache/wiki/util/PriorityListTest.java | 22 ++---
37 files changed, 437 insertions(+), 461 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java b/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
index a0a33ea..08cdd6d 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki;
@@ -696,7 +696,7 @@ public class PageManager extends ModuleManager implements WikiEventListener {
public Collection modules() {
return null;
}
-
+
/**
* Returns null!
* {@inheritDoc}
@@ -706,7 +706,6 @@ public class PageManager extends ModuleManager implements WikiEventListener {
return null;
}
-
/**
* Listens for {@link org.apache.wiki.event.WikiSecurityEvent#PROFILE_NAME_CHANGED}
* events. If a user profile's name changes, each page ACL is inspected. If an entry contains
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/forms/FormTextarea.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/forms/FormTextarea.java b/jspwiki-war/src/main/java/org/apache/wiki/forms/FormTextarea.java
index 094b051..a2e4be2 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/forms/FormTextarea.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/forms/FormTextarea.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,11 +14,15 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.forms;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
+
import org.apache.wiki.WikiContext;
import org.apache.wiki.api.exceptions.PluginException;
import org.apache.wiki.api.plugin.WikiPlugin;
@@ -26,22 +30,17 @@ import org.apache.wiki.preferences.Preferences;
import org.apache.wiki.util.XHTML;
import org.apache.wiki.util.XhtmlUtil;
import org.jdom2.Element;
-import org.jdom2.output.Format;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ResourceBundle;
/**
* Creates a Form text area element. You may specify the size of the textarea
* by using the {@link #PARAM_COLS} and {@link #PARAM_ROWS} to signify the width
- * and height of the area.
+ * and height of the area.
*/
public class FormTextarea extends FormElement
{
/** Parameter name for setting the rows value. Value is <tt>{@value}</tt>. */
public static final String PARAM_ROWS = "rows";
-
+
/** Parameter name for setting the columns value. Value is <tt>{@value}</tt>. */
public static final String PARAM_COLS = "cols";
@@ -93,10 +92,10 @@ public class FormTextarea extends FormElement
if ( rows != null ) {
field.setAttribute(XHTML.ATTR_rows,rows);
}
- if ( cols != null ) {
+ if ( cols != null ) {
field.setAttribute(XHTML.ATTR_cols,cols);
}
-
+
if ( previousValues != null )
{
String oldValue = previousValues.get( inputName );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslator.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslator.java b/jspwiki-war/src/main/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslator.java
index 3d5bc82..327aabc 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslator.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslator.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,25 +14,25 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.htmltowiki;
import java.io.IOException;
import java.io.StringReader;
+import org.apache.wiki.WikiContext;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
+import org.jdom2.input.sax.XMLReaderSAX2Factory;
import org.jdom2.output.XMLOutputter;
-import org.apache.wiki.WikiContext;
-
/**
* Converting Html to Wiki Markup with NekoHtml for converting html to xhtml and
* Xhtml2WikiTranslator for converting xhtml to Wiki Markup.
- *
+ *
*/
public class HtmlStringToWikiTranslator
{
@@ -48,10 +48,10 @@ public class HtmlStringToWikiTranslator
/**
* Translates text from HTML into WikiMarkup without a WikiContext (meaning
* some things perhaps cannot be translated). Uses the default configuration.
- *
+ *
* @param html HTML text to translate
* @return WikiMarkup
- *
+ *
* @throws JDOMException If parsing fails
* @throws IOException For other kinds of errors.
*/
@@ -63,11 +63,11 @@ public class HtmlStringToWikiTranslator
/**
* Translates text from HTML into WikiMarkup with a WikiContext. The translation
* accuracy is better. Uses the default configuration.
- *
+ *
* @param html HTML text to translate
* @param wikiContext The WikiContext to use.
* @return WikiMarkup
- *
+ *
* @throws JDOMException If parsing fails
* @throws IOException For other kinds of errors.
*/
@@ -78,11 +78,11 @@ public class HtmlStringToWikiTranslator
/**
* Translates text from HTML into WikiMarkup using a specified configuration.
- *
+ *
* @param html HTML text to translate
* @param config The configuration to use.
* @return WikiMarkup
- *
+ *
* @throws JDOMException If parsing fails
* @throws IOException For other kinds of errors.
*/
@@ -97,7 +97,7 @@ public class HtmlStringToWikiTranslator
/**
* Use NekoHtml to parse HTML like well formed XHTML
- *
+ *
* @param html
* @return xhtml jdom root element (node "HTML")
* @throws JDOMException
@@ -105,7 +105,7 @@ public class HtmlStringToWikiTranslator
*/
private Element htmlStringToElement( String html ) throws JDOMException, IOException
{
- SAXBuilder builder = new SAXBuilder( CYBERNEKO_PARSER, true );
+ SAXBuilder builder = new SAXBuilder( new XMLReaderSAX2Factory( true, CYBERNEKO_PARSER), null, null );
Document doc = builder.build( new StringReader( html ) );
Element element = doc.getRootElement();
return element;
@@ -113,7 +113,7 @@ public class HtmlStringToWikiTranslator
/**
* A static helper method to create HTML from an Element.
- *
+ *
* @param element The element to get HTML from.
* @return HTML
*/
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/parser/CreoleToJSPWikiTranslator.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/CreoleToJSPWikiTranslator.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/CreoleToJSPWikiTranslator.java
index 14736db..0c7e431 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/CreoleToJSPWikiTranslator.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/CreoleToJSPWikiTranslator.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.parser;
@@ -168,7 +168,7 @@ public class CreoleToJSPWikiTranslator
/**
* I have no idea what this method does. Could someone please tell me?
- *
+ *
* @param wikiProps A property set
* @param content The content to translate?
* @param username The username in the signature?
@@ -206,9 +206,9 @@ public class CreoleToJSPWikiTranslator
return result;
}
- /**
- * Translates Creole markup to JSPWiki markup
- *
+ /**
+ * Translates Creole markup to JSPWiki markup
+ *
* @param wikiProps A set of Wiki Properties
* @param content Creole markup
* @return Wiki markup
@@ -322,13 +322,13 @@ public class CreoleToJSPWikiTranslator
}
counter = 0;
}
-
+
// Fixes testExtensions5
- if( content.endsWith( "\n" ) && result.charAt( result.length()-1 ) != '\n' )
+ if( content.endsWith( "\n" ) && result.charAt( result.length()-1 ) != '\n' )
{
result.append( '\n' );
}
-
+
return result.toString();
}
@@ -393,9 +393,9 @@ public class CreoleToJSPWikiTranslator
return content;
}
- private ArrayList readPlaceholderProperties(Properties wikiProps)
+ private ArrayList< String[] > readPlaceholderProperties(Properties wikiProps)
{
- Set keySet = wikiProps.keySet();
+ Set< Object > keySet = wikiProps.keySet();
Object[] keys = keySet.toArray();
ArrayList<String[]> result = new ArrayList<String[]>();
@@ -420,7 +420,7 @@ public class CreoleToJSPWikiTranslator
Matcher matcher = Pattern.compile(markupRegex, Pattern.MULTILINE | Pattern.DOTALL).matcher(content);
String contentCopy = content;
- ArrayList plProperties = readPlaceholderProperties(wikiProps);
+ ArrayList< String[] > plProperties = readPlaceholderProperties(wikiProps);
while (matcher.find())
{
@@ -439,13 +439,14 @@ public class CreoleToJSPWikiTranslator
// Replace placeholder params
for (int j = 0; j < plProperties.size(); j++)
{
- String[] pair = (String[]) plProperties.get(j);
+ String[] pair = plProperties.get(j);
String key = pair[0];
String value = pair[1];
String code = param.replaceAll("(?i)([0-9]+)" + key, value + "<check>" + "$1" + "</check>");
code = code.replaceAll("(.*?)%(.*?)<check>(.*?)</check>", "$1$3$2");
- if (!code.equals(param))
+ if (!code.equals(param)) {
paramsString += code;
+ }
}
// Check if it is a number
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
index 1623865..e8f618f 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
@@ -559,10 +559,10 @@ public class LinkParser
{
sb.append( ' ' );
sb.append( '|' );
- Iterator it = getAttributes();
+ Iterator< Attribute > it = getAttributes();
while ( it.hasNext() )
{
- Attribute a = (Attribute)it.next();
+ Attribute a = it.next();
sb.append( ' ' );
sb.append( a.getName() );
sb.append( '=' );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/plugin/Denounce.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/plugin/Denounce.java b/jspwiki-war/src/main/java/org/apache/wiki/plugin/Denounce.java
index 031473f..b2f73d9 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/plugin/Denounce.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/plugin/Denounce.java
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 2003 Janne Jalkanen (Janne.Jalkanen@iki.fi)
Licensed to the Apache Software Foundation (ASF) under one
@@ -16,7 +16,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.plugin;
@@ -34,9 +34,9 @@ import org.apache.wiki.api.exceptions.PluginException;
import org.apache.wiki.api.plugin.WikiPlugin;
/**
- * Denounces a link by removing it from any search engine.
+ * Denounces a link by removing it from any search engine.
* <br> The bots are listed in org/apache/wiki/plugin/denounce.properties.
- *
+ *
* <p>Parameters : </p>
* <ul>
* <li><b>link</b> - The link to be denounced, this parameter is required</li>
@@ -94,7 +94,7 @@ public class Denounce implements WikiPlugin
{
String name = (String) e.nextElement();
- try
+ try
{
if( name.startsWith( PROP_REFERERPATTERN ) )
{
@@ -163,13 +163,13 @@ public class Denounce implements WikiPlugin
/**
* Returns true, if the path is found among the referers.
*/
- private boolean matchPattern( List list, String path )
+ private boolean matchPattern( List< Pattern > list, String path )
{
PatternMatcher matcher = new Perl5Matcher();
- for( Iterator i = list.iterator(); i.hasNext(); )
+ for( Iterator< Pattern > i = list.iterator(); i.hasNext(); )
{
- if( matcher.matches( path, (Pattern)i.next() ) )
+ if( matcher.matches( path, i.next() ) )
{
return true;
}
@@ -208,7 +208,7 @@ public class Denounce implements WikiPlugin
//
// Host
- //
+ //
String host = request.getRemoteHost();
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/plugin/InsertPage.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/plugin/InsertPage.java b/jspwiki-war/src/main/java/org/apache/wiki/plugin/InsertPage.java
index 5b3e017..478bf35 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/plugin/InsertPage.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/plugin/InsertPage.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.plugin;
@@ -44,7 +44,7 @@ import org.apache.wiki.util.TextUtil;
* <li><b>section</b> - the section of the page that has to be inserted (separated by "----"</li>
* <li><b>default</b> - the text to insert if the requested page does not exist</li>
* </ul>
- *
+ *
* @since 2.1.37
*/
public class InsertPage
@@ -69,7 +69,7 @@ public class InsertPage
* have circular references.
*/
public static final String ATTR_RECURSE = "org.apache.wiki.plugin.InsertPage.recurseCheck";
-
+
/**
* {@inheritDoc}
*/
@@ -112,15 +112,15 @@ public class InsertPage
res.append( "<span class=\"error\">Page could not be found by the page provider.</span>" );
return res.toString();
}
-
+
if( page != null )
{
//
// Check for recursivity
//
-
- List<String> previousIncludes = (List)context.getVariable( ATTR_RECURSE );
-
+
+ List<String> previousIncludes = (List<String>)context.getVariable( ATTR_RECURSE );
+
if( previousIncludes != null )
{
if( previousIncludes.contains( page.getName() ) )
@@ -132,10 +132,10 @@ public class InsertPage
{
previousIncludes = new ArrayList<String>();
}
-
+
previousIncludes.add( page.getName() );
context.setVariable( ATTR_RECURSE, previousIncludes );
-
+
//
// Check for permissions
//
@@ -152,7 +152,7 @@ public class InsertPage
* We want inclusion to occur within the context of
* its own page, because we need the links to be correct.
*/
-
+
WikiContext includedContext = (WikiContext) context.clone();
includedContext.setPage( page );
@@ -171,7 +171,7 @@ public class InsertPage
}
}
- if( pageData.length() > maxlen )
+ if( pageData.length() > maxlen )
{
pageData = pageData.substring( 0, maxlen )+" ...";
moreLink = "<p><a href=\""+context.getURL(WikiContext.VIEW,includedPage)+"\">More...</a></p>";
@@ -181,7 +181,7 @@ public class InsertPage
res.append( engine.textToHTML( includedContext, pageData ) );
res.append( moreLink );
res.append("</div>");
-
+
//
// Remove the name from the stack; we're now done with this.
//
@@ -190,7 +190,7 @@ public class InsertPage
}
else
{
- if( defaultstr != null )
+ if( defaultstr != null )
{
res.append( defaultstr );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java b/jspwiki-war/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
index 9253a57..7048c5c 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
@@ -201,17 +201,14 @@ public class ReferredPagesPlugin implements WikiPlugin
if( m_formatSort ) context.getEngine().getPageSorter().sort( allLinks );
- for( Iterator i = allLinks.iterator(); i.hasNext(); )
+ for( Iterator<String> i = allLinks.iterator(); i.hasNext(); )
{
- String link = (String) i.next() ;
+ String link = i.next() ;
- if( localLinkSet.contains( link ) ) continue; // skip multiple
- // links to the same
- // page
+ if( localLinkSet.contains( link ) ) continue; // skip multiple links to the same page
localLinkSet.add( link );
- if( !m_engine.pageExists( link ) ) continue; // hide links to non
- // existing pages
+ if( !m_engine.pageExists( link ) ) continue; // hide links to non existing pages
if( m_matcher.matches( link , m_excludePattern ) ) continue;
if( !m_matcher.matches( link , m_includePattern ) ) continue;
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java b/jspwiki-war/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
index fa61506..47e797b 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.plugin;
@@ -49,7 +49,6 @@ public class UnusedPagesPlugin
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
@@ -59,15 +58,14 @@ public class UnusedPagesPlugin
// filter out attachments if "excludeattachments" was requested:
//
String prop = params.get( PARAM_EXCLUDEATTS );
- if( TextUtil.isPositive(prop) )
+ if( TextUtil.isPositive(prop) )
{
// remove links to attachments (recognizable by a slash in it)
- // FIXME: In 3.0, this assumption is going to fail. FIXME3.0
- Iterator iterator = links.iterator();
- while( iterator.hasNext() )
+ Iterator< String > iterator = links.iterator();
+ while( iterator.hasNext() )
{
- String link = (String) iterator.next();
- if (link.indexOf("/")!=-1)
+ String link = iterator.next();
+ if (link.indexOf("/")!=-1)
{
iterator.remove();
}
@@ -79,7 +77,7 @@ public class UnusedPagesPlugin
links = filterAndSortCollection( links );
String wikitext = null;
-
+
if (m_show.equals(PARAM_SHOW_VALUE_COUNT))
{
wikitext = "" + links.size();
@@ -91,7 +89,7 @@ public class UnusedPagesPlugin
else
{
wikitext = wikitizeCollection( links, m_separator, ALL_ITEMS );
- }
+ }
return makeHTML( context, wikitext );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogArchivePlugin.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogArchivePlugin.java b/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogArchivePlugin.java
index ef303ed..1e3ae87 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogArchivePlugin.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogArchivePlugin.java
@@ -88,7 +88,7 @@ public class WeblogArchivePlugin implements WikiPlugin
try
{
- Collection months = collectMonths( engine, weblogName );
+ Collection< Calendar > months = collectMonths( engine, weblogName );
int year = 0;
//
@@ -99,14 +99,14 @@ public class WeblogArchivePlugin implements WikiPlugin
if( months.size() > 0 )
{
- year = ((Calendar)months.iterator().next()).get( Calendar.YEAR );
+ year = (months.iterator().next()).get( Calendar.YEAR );
sb.append( "<li class=\"archiveyear\">"+year+"</li>\n" );
}
- for( Iterator i = months.iterator(); i.hasNext(); )
+ for( Iterator< Calendar > i = months.iterator(); i.hasNext(); )
{
- Calendar cal = (Calendar) i.next();
+ Calendar cal = i.next();
if( cal.get( Calendar.YEAR ) != year )
{
@@ -135,21 +135,19 @@ public class WeblogArchivePlugin implements WikiPlugin
return sb.toString();
}
- @SuppressWarnings("unchecked")
- private SortedSet collectMonths( WikiEngine engine, String page )
+ private SortedSet< Calendar > collectMonths( WikiEngine engine, String page )
throws ProviderException
{
- Comparator comp = new ArchiveComparator();
+ Comparator< Calendar > comp = new ArchiveComparator();
TreeSet<Calendar> res = new TreeSet<Calendar>( comp );
WeblogPlugin pl = new WeblogPlugin();
- List blogEntries = pl.findBlogEntries( engine,
- page, new Date(0L), new Date() );
+ List< WikiPage > blogEntries = pl.findBlogEntries( engine, page, new Date(0L), new Date() );
- for( Iterator i = blogEntries.iterator(); i.hasNext(); )
+ for( Iterator< WikiPage > i = blogEntries.iterator(); i.hasNext(); )
{
- WikiPage p = (WikiPage) i.next();
+ WikiPage p = i.next();
// FIXME: Not correct, should parse page creation time.
@@ -194,28 +192,23 @@ public class WeblogArchivePlugin implements WikiPlugin
* This is a simple comparator for ordering weblog archive entries.
* Two dates in the same month are considered equal.
*/
- private static class ArchiveComparator
- implements Comparator
- {
+ private static class ArchiveComparator implements Comparator< Calendar > {
- public int compare( Object a, Object b )
+ public int compare( Calendar a, Calendar b )
{
- if( a == null || b == null ||
- !(a instanceof Calendar) || !(b instanceof Calendar) )
+ if( a == null || b == null )
{
throw new ClassCastException( "Invalid calendar supplied for comparison." );
}
- Calendar ca = (Calendar) a;
- Calendar cb = (Calendar) b;
- if( ca.get( Calendar.YEAR ) == cb.get( Calendar.YEAR ) &&
- ca.get( Calendar.MONTH ) == cb.get( Calendar.MONTH ) )
+ if( a.get( Calendar.YEAR ) == b.get( Calendar.YEAR ) &&
+ a.get( Calendar.MONTH ) == b.get( Calendar.MONTH ) )
{
return 0;
}
//sort recent dates first
- return cb.getTime().before( ca.getTime() ) ? -1 : 1;
+ return b.getTime().before( a.getTime() ) ? -1 : 1;
}
}
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java b/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java
index 48685ff..5d4c9de 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java
@@ -19,20 +19,19 @@
package org.apache.wiki.plugin;
import java.text.DateFormat;
+import java.text.MessageFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import java.util.Map;
import java.util.ResourceBundle;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -446,7 +445,6 @@ public class WeblogPlugin
ArrayList<WikiPage> result = new ArrayList<WikiPage>();
baseName = makeEntryPage( baseName );
- SimpleDateFormat fmt = new SimpleDateFormat(DEFAULT_DATEFORMAT);
for( Iterator i = allPages.iterator(); i.hasNext(); )
{
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/preferences/Preferences.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/preferences/Preferences.java b/jspwiki-war/src/main/java/org/apache/wiki/preferences/Preferences.java
index 56cd83a..299b17b 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/preferences/Preferences.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/preferences/Preferences.java
@@ -30,7 +30,6 @@ import java.util.ResourceBundle;
import java.util.TimeZone;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import org.apache.commons.lang.StringUtils;
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/providers/CachingProvider.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/providers/CachingProvider.java b/jspwiki-war/src/main/java/org/apache/wiki/providers/CachingProvider.java
index f8e2f02..78cd42e 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/providers/CachingProvider.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/providers/CachingProvider.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.providers;
@@ -323,8 +323,6 @@ public class CachingProvider implements WikiPageProvider {
if (pageName == null) return null;
- WikiPage page = getPageInfoFromCache(pageName);
-
Element cacheElement = m_textCache.get(pageName);
if (cacheElement != null) {
@@ -391,14 +389,14 @@ public class CachingProvider implements WikiPageProvider {
}
}
}
-
+
if( all.size() >= m_cache.getCacheConfiguration().getMaxEntriesLocalHeap() ) {
log.warn( "seems " + m_cache.getName() + " can't hold all pages from your page repository, " +
"so we're delegating on the underlying provider instead. Please consider increasing " +
"your cache sizes on ehcache.xml to avoid this behaviour" );
return m_provider.getAllPages();
}
-
+
return all;
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/providers/VersioningFileProvider.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/providers/VersioningFileProvider.java b/jspwiki-war/src/main/java/org/apache/wiki/providers/VersioningFileProvider.java
index e5739a0..718056e 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/providers/VersioningFileProvider.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/providers/VersioningFileProvider.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.providers;
@@ -73,15 +73,15 @@ public class VersioningFileProvider
extends AbstractFileProvider
{
private static final Logger log = Logger.getLogger(VersioningFileProvider.class);
-
+
/** Name of the directory where the old versions are stored. */
public static final String PAGEDIR = "OLD";
-
+
/** Name of the property file which stores the metadata. */
public static final String PROPERTYFILE = "page.properties";
private CachedProperties m_cachedProperties;
-
+
/**
* {@inheritDoc}
*/
@@ -128,7 +128,7 @@ public class VersioningFileProvider
return new File( oldpages, mangleName(page) );
}
-
+
/**
* Goes through the repository and decides which version is
* the newest one in that directory.
@@ -178,32 +178,32 @@ public class VersioningFileProvider
private int findLatestVersion( String page )
{
int version = -1;
-
+
try
{
Properties props = getPageProperties( page );
-
- for( Iterator i = props.keySet().iterator(); i.hasNext(); )
+
+ for( Iterator<Object> i = props.keySet().iterator(); i.hasNext(); )
{
String key = (String)i.next();
-
+
if( key.endsWith(".author") )
{
int cutpoint = key.indexOf('.');
if( cutpoint > 0 )
{
String pageNum = key.substring(0,cutpoint);
-
+
try
{
int res = Integer.parseInt( pageNum );
-
+
if( res > version )
{
version = res;
}
}
- catch( NumberFormatException e ) {} // It's okay to skip these.
+ catch( NumberFormatException e ) {} // It's okay to skip these.
}
}
}
@@ -212,7 +212,7 @@ public class VersioningFileProvider
{
log.error("Unable to figure out latest version - dying...",e);
}
-
+
return version;
}
@@ -233,20 +233,20 @@ public class VersioningFileProvider
// was read just as much times as there were versions of that file. The loading
// of a propertyfile is a cpu-intensive job. So now hold on to the last propertyfile
// read because the next method will with a high probability ask for the same propertyfile.
- // The time it took to show a historypage with 267 versions dropped with 300%.
+ // The time it took to show a historypage with 267 versions dropped with 300%.
//
-
+
CachedProperties cp = m_cachedProperties;
-
- if( cp != null
- && cp.m_page.equals(page)
+
+ if( cp != null
+ && cp.m_page.equals(page)
&& cp.m_lastModified == lastModified)
{
return cp.m_props;
}
-
+
InputStream in = null;
-
+
try
{
in = new BufferedInputStream(new FileInputStream( propertyFile ));
@@ -265,7 +265,7 @@ public class VersioningFileProvider
IOUtils.closeQuietly( in );
}
}
-
+
return new Properties(); // Returns an empty object
}
@@ -278,7 +278,7 @@ public class VersioningFileProvider
{
File propertyFile = new File( findOldPageDir(page), PROPERTYFILE );
OutputStream out = null;
-
+
try
{
out = new FileOutputStream( propertyFile );
@@ -353,7 +353,7 @@ public class VersioningFileProvider
if( !pageFile.exists() )
throw new NoSuchVersionException("Version "+version+"does not exist.");
-
+
return readFile( pageFile );
}
@@ -370,7 +370,7 @@ public class VersioningFileProvider
if( pagedata.canRead() )
{
try
- {
+ {
in = new FileInputStream( pagedata );
result = FileUtil.readContents( in, m_encoding );
}
@@ -401,7 +401,7 @@ public class VersioningFileProvider
}
// FIXME: This method has no rollback whatsoever.
-
+
/*
This is how the page directory should look like:
@@ -521,7 +521,7 @@ public class VersioningFileProvider
// Get additional custom properties from page and add to props
getCustomProperties(page, props);
-
+
putPageProperties( page.getName(), props );
}
catch( IOException e )
@@ -543,7 +543,7 @@ public class VersioningFileProvider
WikiPage p = null;
if( version == WikiPageProvider.LATEST_VERSION ||
- version == latest ||
+ version == latest ||
(version == 1 && latest == -1) )
{
//
@@ -660,7 +660,7 @@ public class VersioningFileProvider
int latest = findLatestVersion( page );
// list.add( getPageInfo(page,WikiPageProvider.LATEST_VERSION) );
-
+
for( int i = latest; i > 0; i-- )
{
WikiPage info = getPageInfo( page, i );
@@ -736,7 +736,7 @@ public class VersioningFileProvider
* Removes the relevant page directory under "OLD" -directory as well,
* but does not remove any extra subdirectories from it. It will only
* touch those files that it thinks to be WikiPages.
- *
+ *
* @param page {@inheritDoc}
* @throws {@inheritDoc}
*/
@@ -770,11 +770,11 @@ public class VersioningFileProvider
/**
* {@inheritDoc}
- *
+ *
* Deleting versions has never really worked,
- * JSPWiki assumes that version histories are "not gappy".
+ * JSPWiki assumes that version histories are "not gappy".
* Using deleteVersion() is definitely not recommended.
- *
+ *
*/
public void deleteVersion( String page, int version )
throws ProviderException
@@ -784,7 +784,7 @@ public class VersioningFileProvider
int latest = findLatestVersion( page );
if( version == WikiPageProvider.LATEST_VERSION ||
- version == latest ||
+ version == latest ||
(version == 1 && latest == -1) )
{
//
@@ -805,18 +805,18 @@ public class VersioningFileProvider
// We can let the FileSystemProvider take care
// of the actual deletion
super.deleteVersion( page, WikiPageProvider.LATEST_VERSION );
-
+
//
// Copy the old file to the new location
//
latest = findLatestVersion( page );
-
+
File pageDir = findOldPageDir( page );
File previousFile = new File( pageDir, Integer.toString(latest)+FILE_EXT );
InputStream in = null;
OutputStream out = null;
-
+
try
{
if( previousFile.exists() )
@@ -842,7 +842,7 @@ public class VersioningFileProvider
IOUtils.closeQuietly( in );
IOUtils.closeQuietly( out );
}
-
+
return;
}
@@ -869,19 +869,19 @@ public class VersioningFileProvider
{
Collection pages = super.getAllPages();
Collection<WikiPage> returnedPages = new ArrayList<WikiPage>();
-
+
for( Iterator i = pages.iterator(); i.hasNext(); )
{
WikiPage page = (WikiPage) i.next();
-
+
WikiPage info = getPageInfo( page.getName(), WikiProvider.LATEST_VERSION );
-
+
returnedPages.add( info );
}
-
+
return returnedPages;
}
-
+
/**
* {@inheritDoc}
*/
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/render/CreoleRenderer.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/render/CreoleRenderer.java b/jspwiki-war/src/main/java/org/apache/wiki/render/CreoleRenderer.java
index d2d2353..9700228 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/render/CreoleRenderer.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/render/CreoleRenderer.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.render;
@@ -34,7 +34,7 @@ import org.jdom2.Text;
* Implements DOM-to-Creole rendering.
* <p>
* FIXME: This class is not yet completely done.
- *
+ *
*/
public class CreoleRenderer extends WikiRenderer
{
@@ -59,7 +59,7 @@ public class CreoleRenderer extends WikiRenderer
private static final String P = "p";
private static final String A = "a";
private static final String PRE = "pre";
-
+
/**
* Contains element, start markup, end markup
*/
@@ -72,7 +72,7 @@ public class CreoleRenderer extends WikiRenderer
"hr", "----" , EMPTY_STRING,
"tt", "<<{{>>", "<<}}>>"
};
-
+
private int m_listCount = 0;
private char m_listChar = 'x';
@@ -80,13 +80,13 @@ public class CreoleRenderer extends WikiRenderer
/**
* Creates a new Creole Renderer.
- *
+ *
*/
public CreoleRenderer( WikiContext ctx, WikiDocument doc )
{
super( ctx, doc );
}
-
+
/**
* Renders an element into the StringBuilder given
* @param ce
@@ -103,7 +103,7 @@ public class CreoleRenderer extends WikiRenderer
endEl = ELEMENTS[i+2];
}
}
-
+
if( UL.equals(ce.getName()) )
{
m_listCount++;
@@ -123,7 +123,7 @@ public class CreoleRenderer extends WikiRenderer
{
String href = ce.getAttributeValue( HREF_ATTRIBUTE );
String text = ce.getText();
-
+
if( href.equals(text) )
{
sb.append( HREF_START + href + HREF_END );
@@ -132,7 +132,7 @@ public class CreoleRenderer extends WikiRenderer
{
sb.append( HREF_START + href+ HREF_DELIMITER + text +HREF_END);
}
- // Do not render anything else
+ // Do not render anything else
return;
}
else if( PRE.equals(ce.getName()) )
@@ -140,21 +140,21 @@ public class CreoleRenderer extends WikiRenderer
sb.append( PRE_START );
sb.append( ce.getText() );
sb.append( PRE_END );
-
+
return;
}
-
+
//
// Go through the children
//
- for( Iterator i = ce.getContent().iterator(); i.hasNext(); )
+ for( Iterator< Content > i = ce.getContent().iterator(); i.hasNext(); )
{
- Content c = (Content)i.next();
-
+ Content c = i.next();
+
if( c instanceof PluginContent )
{
PluginContent pc = (PluginContent)c;
-
+
if( pc.getPluginName().equals( PLUGIN_IMAGE ) )
{
sb.append( IMG_START + pc.getParameter( PARAM_SRC ) + IMG_END );
@@ -183,25 +183,25 @@ public class CreoleRenderer extends WikiRenderer
{
sb.append( LINEBREAK );
}
-
+
sb.append(endEl);
}
-
+
/**
* {@inheritDoc}
*/
public String getString() throws IOException
{
StringBuilder sb = new StringBuilder(1000);
-
+
Element ce = m_document.getRootElement();
-
+
//
// Traverse through the entire tree of everything.
//
-
+
renderElement( ce, sb );
-
+
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/render/WysiwygEditingRenderer.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/render/WysiwygEditingRenderer.java b/jspwiki-war/src/main/java/org/apache/wiki/render/WysiwygEditingRenderer.java
index f8b1392..bc42aeb 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/render/WysiwygEditingRenderer.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/render/WysiwygEditingRenderer.java
@@ -47,8 +47,6 @@ public class WysiwygEditingRenderer
private static final String CLASS_ATTRIBUTE = "class";
private static final String HREF_ATTRIBUTE = "href";
private static final String TITLE_ATTRIBUTE = "title";
- private static final String EDITPAGE = "createpage";
- private static final String WIKIPAGE = "wikipage";
private static final String LINEBREAK = "\n";
/**
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS20Feed.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS20Feed.java b/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS20Feed.java
index b73431c..0da6e65 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS20Feed.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS20Feed.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.rss;
@@ -45,7 +45,7 @@ public class RSS20Feed extends Feed
{
/**
* Creates an RSS 2.0 feed for the specified Context.
- *
+ *
* @param context The WikiContext.
*/
public RSS20Feed( WikiContext context )
@@ -64,9 +64,9 @@ public class RSS20Feed extends Feed
if( m_wikiContext.getHttpRequest() != null )
servletContext = m_wikiContext.getHttpRequest().getSession().getServletContext();
- for( Iterator i = m_entries.iterator(); i.hasNext(); )
+ for( Iterator< Entry > i = m_entries.iterator(); i.hasNext(); )
{
- Entry e = (Entry)i.next();
+ Entry e = i.next();
WikiPage p = e.getPage();
String url = e.getURL();
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java b/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java
index 7dc0134..6b6ed99 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.search;
@@ -51,7 +51,6 @@ import org.apache.wiki.event.WikiEventUtils;
import org.apache.wiki.event.WikiPageEvent;
import org.apache.wiki.modules.InternalModule;
import org.apache.wiki.parser.MarkupParser;
-import org.apache.wiki.tags.WikiTagBase;
import org.apache.wiki.util.ClassUtil;
import org.apache.wiki.util.TextUtil;
@@ -65,10 +64,10 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
private static final Logger log = Logger.getLogger(SearchManager.class);
private static final String DEFAULT_SEARCHPROVIDER = "org.apache.wiki.search.LuceneSearchProvider";
-
+
/** Old option, now deprecated. */
private static final String PROP_USE_LUCENE = "jspwiki.useLucene";
-
+
/**
* Property name for setting the search provider. Value is <tt>{@value}</tt>.
*/
@@ -83,7 +82,7 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
/**
* Creates a new SearchManager.
- *
+ *
* @param engine The WikiEngine that owns this SearchManager.
* @param properties The list of Properties.
* @throws FilterException If it cannot be instantiated.
@@ -108,13 +107,13 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
public static final String AJAX_ACTION_SUGGESTIONS = "suggestions";
public static final String AJAX_ACTION_PAGES = "pages";
public static final int DEFAULT_MAX_RESULTS = 20;
- public int maxResults = DEFAULT_MAX_RESULTS;
-
+ public int maxResults = DEFAULT_MAX_RESULTS;
+
@Override
public String getServletMapping() {
return JSON_SEARCH;
}
-
+
@Override
public void service(HttpServletRequest req, HttpServletResponse resp, String actionName, List<String> params)
throws ServletException, IOException {
@@ -154,7 +153,7 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
log.debug("result="+result);
resp.getWriter().write(result);
}
-
+
/**
* Provides a list of suggestions to use for a page name.
* Currently the algorithm just looks into the value parameter,
@@ -172,16 +171,16 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
if( wikiName.length() > 0 )
{
-
+
// split pagename and attachment filename
String filename = "";
int pos = wikiName.indexOf("/");
- if( pos >= 0 )
+ if( pos >= 0 )
{
filename = wikiName.substring( pos ).toLowerCase();
wikiName = wikiName.substring( 0, pos );
}
-
+
String cleanWikiName = MarkupParser.cleanLink(wikiName).toLowerCase() + filename;
String oldStyleName = MarkupParser.wikifyLink(wikiName).toLowerCase() + filename;
@@ -231,7 +230,7 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
} else {
c = m_searchProvider.findPages( searchString, wikiContext );
}
-
+
int count = 0;
for( Iterator i = c.iterator(); i.hasNext() && count < maxLength; count++ )
{
@@ -314,7 +313,7 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
try
{
- Class providerClass = ClassUtil.findClass( "org.apache.wiki.search", providerClassName );
+ Class<?> providerClass = ClassUtil.findClass( "org.apache.wiki.search", providerClassName );
m_searchProvider = (SearchProvider)providerClass.newInstance();
}
catch( ClassNotFoundException e )
@@ -340,7 +339,7 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
/**
* Returns the SearchProvider used.
- *
+ *
* @return The current SearchProvider.
*/
public SearchProvider getSearchEngine()
@@ -378,7 +377,7 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
/**
* Reindexes the page.
- *
+ *
* @param wikiContext {@inheritDoc}
* @param content {@inheritDoc}
*/
@@ -405,7 +404,7 @@ public class SearchManager extends BasicPageFilter implements InternalModule, Wi
/**
* If the page has been deleted, removes it from the index.
- *
+ *
* @param event {@inheritDoc}
*/
public void actionPerformed(WikiEvent event)
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java b/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java
index a899c85..03ccdd4 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.ui;
@@ -260,7 +260,7 @@ public class TemplateManager extends ModuleManager {
{
int idx = 0;
if( name.startsWith( "/" ) ) idx = 1;
-
+
idx = name.indexOf('/', idx);
if( idx != -1 )
{
@@ -437,7 +437,7 @@ public class TemplateManager extends ModuleManager {
* List all installed i18n language properties by classpath searching for files like :
* templates/default_*.properties
* templates/default.properties
- *
+ *
* @param pageContext
* @return map of installed Languages
* @since 2.7.x
@@ -473,14 +473,14 @@ public class TemplateManager extends ModuleManager {
/**
* List all available timeformats, read from the jspwiki.properties
- *
+ *
* @param pageContext
* @return map of TimeFormats
* @since 2.7.x
*/
public Map listTimeFormats(PageContext pageContext)
{
- WikiContext context = WikiContext.findContext( pageContext );
+ WikiContext context = WikiContext.findContext( pageContext );
Properties props = m_engine.getWikiProperties();
ArrayList<String> tfArr = new ArrayList<String>(40);
LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();
@@ -557,7 +557,7 @@ public class TemplateManager extends ModuleManager {
/**
* List all timezones, with special marker for server timezone
- *
+ *
* @param pageContext
* @return map of TimeZones
* @since 2.7.x
@@ -567,14 +567,14 @@ public class TemplateManager extends ModuleManager {
LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();
String[][] tzs = { { "GMT-12", "Enitwetok, Kwajalien" },
- { "GMT-11", "Nome, Midway Island, Samoa" },
+ { "GMT-11", "Nome, Midway Island, Samoa" },
{ "GMT-10", "Hawaii" },
- { "GMT-9", "Alaska" },
+ { "GMT-9", "Alaska" },
{ "GMT-8", "Pacific Time" },
- { "GMT-7", "Mountain Time" },
+ { "GMT-7", "Mountain Time" },
{ "GMT-6", "Central Time, Mexico City" },
{ "GMT-5", "Eastern Time, Bogota, Lima, Quito" },
- { "GMT-4", "Atlantic Time, Caracas, La Paz" },
+ { "GMT-4", "Atlantic Time, Caracas, La Paz" },
{ "GMT-3:30", "Newfoundland" },
{ "GMT-3", "Brazil, Buenos Aires, Georgetown, Falkland Is." },
{ "GMT-2", "Mid-Atlantic, Ascention Is., St Helena" },
@@ -582,13 +582,13 @@ public class TemplateManager extends ModuleManager {
{ "GMT", "Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia" },
{ "GMT+1", "Berlin, Brussels, Copenhagen, Madrid, Paris, Rome" },
{ "GMT+2", "Helsinki, Athens, Kaliningrad, South Africa, Warsaw" },
- { "GMT+3", "Baghdad, Riyadh, Moscow, Nairobi" },
+ { "GMT+3", "Baghdad, Riyadh, Moscow, Nairobi" },
{ "GMT+3:30", "Tehran" },
- { "GMT+4", "Adu Dhabi, Baku, Muscat, Tbilisi" },
+ { "GMT+4", "Adu Dhabi, Baku, Muscat, Tbilisi" },
{ "GMT+4:30", "Kabul" },
{ "GMT+5", "Islamabad, Karachi, Tashkent" },
{ "GMT+5:30", "Bombay, Calcutta, Madras, New Delhi" },
- { "GMT+6", "Almaty, Colomba, Dhakra" },
+ { "GMT+6", "Almaty, Colomba, Dhakra" },
{ "GMT+7", "Bangkok, Hanoi, Jakarta" },
{ "GMT+8", "Beijing, Hong Kong, Perth, Singapore, Taipei" },
{ "GMT+9", "Osaka, Sapporo, Seoul, Tokyo, Yakutsk" },
@@ -603,16 +603,16 @@ public class TemplateManager extends ModuleManager {
{
String tzID = tzs[i][0];
java.util.TimeZone tz = java.util.TimeZone.getTimeZone(tzID);
-
+
String serverTimeZone = "";
if( servertz.getRawOffset() == tz.getRawOffset() )
{
serverTimeZone = LocaleSupport.getLocalizedMessage(pageContext, I18NSERVER_TIMEZONE);
- tzID = servertz.getID();
+ tzID = servertz.getID();
}
- resultMap.put(tzID, "(" + tzs[i][0] + ") "+tzs[i][1] + " " + serverTimeZone);
+ resultMap.put(tzID, "(" + tzs[i][0] + ") "+tzs[i][1] + " " + serverTimeZone);
}
return resultMap;
@@ -842,9 +842,9 @@ public class TemplateManager extends ModuleManager {
@Override
public Collection modules()
{
- return new ArrayList();
+ return new ArrayList<WikiModuleInfo>();
}
-
+
/**
* Returns null!
* {@inheritDoc}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java b/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
index d2b7fd6..b796327 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,20 +14,18 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.ui;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
@@ -50,7 +48,7 @@ import org.apache.wiki.util.TextUtil;
/**
* This filter goes through the generated page response prior and
* places requested resources at the appropriate inclusion markers.
- * This is done to let dynamic content (e.g. plugins, editors)
+ * This is done to let dynamic content (e.g. plugins, editors)
* include custom resources, even after the HTML head section is
* in fact built. This filter is typically the last filter to execute,
* and it <em>must</em> run after servlet or JSP code that performs
@@ -72,7 +70,7 @@ import org.apache.wiki.util.TextUtil;
* <pre>
* TemplateManager.addResourceRequest( context, TemplateManager.RESOURCE_SCRIPT, "scripts/customresource.js" );
* </pre>
- *
+ *
* @see TemplateManager
* @see org.apache.wiki.tags.RequestResourceTag
*/
@@ -86,10 +84,8 @@ public class WikiJSPFilter extends WikiServletFilter
{
super.init( config );
m_wiki_encoding = m_engine.getWikiProperties().getProperty(WikiEngine.PROP_ENCODING);
-
- useEncoding = !(new Boolean(m_engine.getWikiProperties().getProperty(WikiEngine.PROP_NO_FILTER_ENCODING, "false").trim()).booleanValue());
-
- ServletContext context = config.getServletContext();
+
+ useEncoding = !(new Boolean(m_engine.getWikiProperties().getProperty(WikiEngine.PROP_NO_FILTER_ENCODING, "false").trim()).booleanValue());
}
public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
@@ -102,9 +98,9 @@ public class WikiJSPFilter extends WikiServletFilter
w.enterState("Filtering for URL "+((HttpServletRequest)request).getRequestURI(), 90 );
HttpServletResponseWrapper responseWrapper;
-
+
responseWrapper = new MyServletResponseWrapper( (HttpServletResponse)response, m_wiki_encoding, useEncoding);
-
+
// fire PAGE_REQUESTED event
String pagename = DefaultURLConstructor.parsePageFromURL(
(HttpServletRequest)request, response.getCharacterEncoding() );
@@ -113,7 +109,7 @@ public class WikiJSPFilter extends WikiServletFilter
super.doFilter( request, responseWrapper, chain );
// The response is now complete. Lets replace the markers now.
-
+
// WikiContext is only available after doFilter! (That is after
// interpreting the jsp)
@@ -122,20 +118,20 @@ public class WikiJSPFilter extends WikiServletFilter
w.enterState( "Delivering response", 30 );
WikiContext wikiContext = getWikiContext( request );
String r = filter( wikiContext, responseWrapper );
-
- if (useEncoding)
+
+ if (useEncoding)
{
- OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream(),
+ OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream(),
response.getCharacterEncoding());
out.write(r);
out.flush();
out.close();
}
- else
+ else
{
response.getWriter().write(r);
}
-
+
// Clean up the UI messages and loggers
if( wikiContext != null )
{
@@ -161,7 +157,7 @@ public class WikiJSPFilter extends WikiServletFilter
/**
* Goes through all types and writes the appropriate response.
- *
+ *
* @param wikiContext The usual processing context
* @param response The source string
* @return The modified string with all the insertions in place.
@@ -178,13 +174,13 @@ public class WikiJSPFilter extends WikiServletFilter
{
string = insertResources( wikiContext, string, resourceTypes[i] );
}
-
+
//
// Add HTTP header Resource Requests
//
String[] headers = TemplateManager.getResourceRequests( wikiContext,
TemplateManager.RESOURCE_HTTPHEADER );
-
+
for( int i = 0; i < headers.length; i++ )
{
String key = headers[i];
@@ -195,7 +191,7 @@ public class WikiJSPFilter extends WikiServletFilter
key = headers[i].substring( 0, split );
value = headers[i].substring( split+1 );
}
-
+
response.addHeader( key.trim(), value.trim() );
}
}
@@ -207,7 +203,7 @@ public class WikiJSPFilter extends WikiServletFilter
* Inserts whatever resources
* were requested by any plugins or other components for this particular
* type.
- *
+ *
* @param wikiContext The usual processing context
* @param string The source string
* @param type Type identifier for insertion
@@ -222,32 +218,32 @@ public class WikiJSPFilter extends WikiServletFilter
String marker = TemplateManager.getMarker( wikiContext, type );
int idx = string.indexOf( marker );
-
+
if( idx == -1 )
{
return string;
}
-
+
log.debug("...Inserting...");
-
+
String[] resources = TemplateManager.getResourceRequests( wikiContext, type );
-
+
StringBuilder concat = new StringBuilder( resources.length * 40 );
-
+
for( int i = 0; i < resources.length; i++ )
{
log.debug("...:::"+resources[i]);
concat.append( resources[i] );
}
- string = TextUtil.replaceString( string,
- idx,
- idx+marker.length(),
+ string = TextUtil.replaceString( string,
+ idx,
+ idx+marker.length(),
concat.toString() );
-
+
return string;
}
-
+
/**
* Simple response wrapper that just allows us to gobble through the entire
* response before it's output.
@@ -260,14 +256,14 @@ public class WikiJSPFilter extends WikiServletFilter
private PrintWriter m_writer;
private HttpServletResponse m_response;
private boolean useEncoding;
-
- /**
+
+ /**
* How large the initial buffer should be. This should be tuned to achieve
* a balance in speed and memory consumption.
*/
private static final int INIT_BUFFER_SIZE = 0x8000;
-
-
+
+
public MyServletResponseWrapper( HttpServletResponse r, final String wiki_encoding, boolean useEncoding)
throws UnsupportedEncodingException {
super(r);
@@ -275,7 +271,7 @@ public class WikiJSPFilter extends WikiServletFilter
m_servletOut = new MyServletOutputStream(m_output);
m_writer = new PrintWriter(new OutputStreamWriter(m_servletOut, wiki_encoding), true);
this.useEncoding = useEncoding;
-
+
m_response = r;
}
@@ -292,7 +288,7 @@ public class WikiJSPFilter extends WikiServletFilter
{
return m_servletOut;
}
-
+
public void flushBuffer() throws IOException
{
m_writer.flush();
@@ -315,7 +311,7 @@ public class WikiJSPFilter extends WikiServletFilter
m_buffer.write( aInt );
}
}
-
+
/**
* Returns whatever was written so far into the Writer.
*/
@@ -338,7 +334,7 @@ public class WikiJSPFilter extends WikiServletFilter
}
return m_output.toString();
- }
+ }
catch( UnsupportedEncodingException e )
{
log.error( e );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java b/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
index dca6d25..7d596b8 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,19 +14,16 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.url;
import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
-
import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiEngine;
import org.apache.wiki.ui.Command;
@@ -37,7 +34,7 @@ import org.apache.wiki.util.TextUtil;
* Implements the default URL constructor using links directly to the
* JSP pages. This is what JSPWiki by default is using. For example,
* WikiContext.VIEW points at "Wiki.jsp", etc.
- *
+ *
* @since 2.2
*/
public class DefaultURLConstructor
@@ -50,12 +47,12 @@ public class DefaultURLConstructor
* actual servlet (which is the m_urlPrefix).
*/
protected String m_pathPrefix = "";
-
+
/**
- *
+ *
* {@inheritDoc}
*/
- public void initialize( WikiEngine engine,
+ public void initialize( WikiEngine engine,
Properties properties )
{
m_engine = engine;
@@ -65,7 +62,7 @@ public class DefaultURLConstructor
/**
* Does replacement of some particular variables. The variables are:
- *
+ *
* <ul>
* <li> "%u" - inserts either the base URL (when absolute is required), or the base path
* (which is an absolute path without the host name).
@@ -73,7 +70,7 @@ public class DefaultURLConstructor
* <li> "%p" - always inserts the base path
* <li> "%n" - inserts the page name
* </ul>
- *
+ *
* @param baseptrn The pattern to use
* @param name The page name
* @param absolute If true, %u is always the entire base URL, otherwise it depends on
@@ -98,19 +95,19 @@ public class DefaultURLConstructor
* URLEncoder returns pluses, when we want to have the percent
* encoding. See http://issues.apache.org/bugzilla/show_bug.cgi?id=39278
* for more info.
- *
+ *
* We also convert any %2F's back to slashes to make nicer-looking URLs.
*/
private String encodeURI( String uri )
{
uri = m_engine.encodeName(uri);
-
+
uri = StringUtils.replace( uri, "+", "%20" );
uri = StringUtils.replace( uri, "%2F", "/" );
-
+
return uri;
}
-
+
/**
* Returns the URL pattern for a supplied wiki request context.
* @param context the wiki context
@@ -126,13 +123,13 @@ public class DefaultURLConstructor
// FIXME
return "%uWiki.jsp";
}
-
+
// Find the action matching our pattern (could throw exception)
Command command = CommandResolver.findCommand( context );
-
+
return command.getURLPattern();
}
-
+
/**
* Constructs the actual URL based on the context.
*/
@@ -146,7 +143,7 @@ public class DefaultURLConstructor
/**
* Constructs the URL with a bunch of parameters.
* @param parameters If null or empty, no parameters are added.
- *
+ *
* {@inheritDoc}
*/
public String makeURL( String context,
@@ -155,7 +152,7 @@ public class DefaultURLConstructor
String parameters )
{
if( parameters != null && parameters.length() > 0 )
- {
+ {
if( context.equals(WikiContext.ATTACH) )
{
parameters = "?"+parameters;
@@ -179,7 +176,7 @@ public class DefaultURLConstructor
/**
* Should parse the "page" parameter from the actual
* request.
- *
+ *
* {@inheritDoc}
*/
public String parsePage( String context,
@@ -207,11 +204,11 @@ public class DefaultURLConstructor
* <p>
* Please see <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=39278">Tomcat Bug 39278</a>
* for more information.
- *
+ *
* @param request A HTTP servlet request
* @param encoding The used encoding
- * @return a String, decoded by JSPWiki, specifying extra path information that comes
- * after the servlet path but before the query string in the request URL;
+ * @return a String, decoded by JSPWiki, specifying extra path information that comes
+ * after the servlet path but before the query string in the request URL;
* or null if the URL does not have any extra path information
* @throws UnsupportedEncodingException
*/
@@ -222,14 +219,14 @@ public class DefaultURLConstructor
String c = request.getContextPath(); // Undecoded
String s = request.getServletPath(); // Decoded
String u = request.getRequestURI(); // Undecoded
-
+
c = URLDecoder.decode( c, encoding );
u = URLDecoder.decode( u, encoding );
-
+
String pi = u.substring( s.length()+c.length() );
-
+
if( pi.length() == 0 ) pi = null;
-
+
return pi;
}
*/
@@ -237,12 +234,12 @@ public class DefaultURLConstructor
* Takes the name of the page from the request URI.
* The initial slash is also removed. If there is no page,
* returns null.
- *
+ *
* @param request The request to parse
* @param encoding The encoding to use
- *
+ *
* @return a parsed page name, or null, if it cannot be found
- *
+ *
* @throws UnsupportedEncodingException If the encoding is not recognized.
*/
public static String parsePageFromURL( HttpServletRequest request,
@@ -259,21 +256,21 @@ public class DefaultURLConstructor
{
name = name.substring(1);
}
-
+
//
// This is required, because by default all URLs are handled
// as Latin1, even if they are really UTF-8.
//
-
+
// name = TextUtil.urlDecode( name, encoding );
-
+
return name;
}
-
+
/**
* This method is not needed for the DefaultURLConstructor.
- *
+ *
* @param request The HTTP Request that was used to end up in this page.
* @return "Wiki.jsp", "PageInfo.jsp", etc. Just return the name,
* JSPWiki will figure out the page.
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java b/jspwiki-war/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java
index 0f22e9a..b470dc7 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.xmlrpc;
@@ -31,10 +31,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
-import org.apache.xmlrpc.*;
import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiEngine;
-import org.apache.wiki.ajax.WikiAjaxDispatcherServlet;
+import org.apache.xmlrpc.ContextXmlRpcHandler;
+import org.apache.xmlrpc.Invoker;
+import org.apache.xmlrpc.XmlRpcContext;
+import org.apache.xmlrpc.XmlRpcHandlerMapping;
+import org.apache.xmlrpc.XmlRpcServer;
/**
* Handles all incoming servlet requests for XML-RPC calls.
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/SamplePlugin2.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/SamplePlugin2.java b/jspwiki-war/src/test/java/SamplePlugin2.java
index 6201895..950458b 100644
--- a/jspwiki-war/src/test/java/SamplePlugin2.java
+++ b/jspwiki-war/src/test/java/SamplePlugin2.java
@@ -34,10 +34,10 @@ public class SamplePlugin2
{
}
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map< String, String > params )
throws PluginException
{
- return (String)params.get("text");
+ return params.get("text");
}
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/Util.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/Util.java b/jspwiki-war/src/test/java/org/apache/wiki/Util.java
index 8e30b89..5c1ed57 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/Util.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/Util.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,11 +14,12 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki;
-import java.util.*;
+import java.util.Collection;
+import java.util.Iterator;
/**
* Utilities for tests.
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
index dfa30e3..df1a086 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,19 +14,20 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki;
-import junit.framework.*;
+import java.util.Properties;
-import java.io.*;
-import java.util.*;
-
-import org.apache.log4j.*;
+import org.apache.log4j.PropertyConfigurator;
import org.apache.wiki.api.exceptions.NoSuchVariableException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class VariableManagerTest extends TestCase
{
VariableManager m_variableManager;
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
index d0b1228..b2f65cb 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth;
@@ -40,7 +40,7 @@ import org.apache.wiki.auth.login.CookieAssertionLoginModule;
/**
* Tests the AuthorizationManager class.
- *
+ *
*/
public class AuthenticationManagerTest extends TestCase
{
@@ -113,7 +113,7 @@ public class AuthenticationManagerTest extends TestCase
/**
* Tests a dummy WebAuthorizer that is guaranteed to return true for one
* role for each of the two <code>isInRole</code> methods.
- *
+ *
* @throws Exception
*/
public void testCustomAuthorizer() throws Exception
@@ -132,7 +132,7 @@ public class AuthenticationManagerTest extends TestCase
assertTrue( session.hasPrincipal( new Role( "AuthorizerRole") ) );
assertFalse( session.hasPrincipal( new Role( "ContainerRole") ) );
assertFalse( session.hasPrincipal( new Role( "DummyRole") ) );
-
+
// Try again with a container-authenticated session: DummyAuthorizer should ALSO allow ContainerRole
session = WikiSessionTest.containerAuthenticatedSession( m_engine, Users.JANNE, new Principal[0] );
assertTrue( session.hasPrincipal( Role.ALL ) );
@@ -217,7 +217,7 @@ public class AuthenticationManagerTest extends TestCase
// Log in 'janne' and verify there are 5 principals in the subject
// (ALL, AUTHENTICATED, login, fullname, wikiname Principals)
WikiSession session = WikiSession.guestSession( m_engine );
- m_auth.login( session, Users.JANNE, Users.JANNE_PASS );
+ m_auth.login( session, null, Users.JANNE, Users.JANNE_PASS );
assertEquals( 3, session.getPrincipals().length );
assertEquals( 2, session.getRoles().length );
assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
[03/15] jspwiki git commit: Extract WikiLink parsing operations from
JSPWikiMarkupParser/LinkParser to their own class, LinkParsingOperations
Posted by ju...@apache.org.
Extract WikiLink parsing operations from JSPWikiMarkupParser/LinkParser to their own class, LinkParsingOperations
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/4128154e
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/4128154e
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/4128154e
Branch: refs/heads/master
Commit: 4128154eb881cba0fd40524bf052ad66765692a4
Parents: a39e758
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 01:39:48 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 01:39:48 2017 +0100
----------------------------------------------------------------------
.../wiki/parser/LinkParsingOperations.java | 196 +++++++++++++++++++
.../org/apache/wiki/parser/MarkupParser.java | 2 +
2 files changed, 198 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/4128154e/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
new file mode 100755
index 0000000..0697ba2
--- /dev/null
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -0,0 +1,196 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.wiki.parser;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.apache.oro.text.regex.Pattern;
+import org.apache.oro.text.regex.Perl5Matcher;
+import org.apache.wiki.VariableManager;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.exceptions.ProviderException;
+
+
+/**
+ * Link parsing operations
+ */
+public class LinkParsingOperations {
+
+ private static Logger log = Logger.getLogger( LinkParsingOperations.class );
+ private final WikiContext wikiContext;
+
+ /**
+ * This list contains all IANA registered URI protocol
+ * types as of September 2004 + a few well-known extra types.
+ *
+ * JSPWiki recognises all of them as external links.
+ *
+ * This array is sorted during class load, so you can just dump
+ * here whatever you want in whatever order you want.
+ */
+ static final String[] EXTERNAL_LINKS = {
+ "http:", "ftp:", "https:", "mailto:",
+ "news:", "file:", "rtsp:", "mms:", "ldap:",
+ "gopher:", "nntp:", "telnet:", "wais:",
+ "prospero:", "z39.50s", "z39.50r", "vemmi:",
+ "imap:", "nfs:", "acap:", "tip:", "pop:",
+ "dav:", "opaquelocktoken:", "sip:", "sips:",
+ "tel:", "fax:", "modem:", "soap.beep:", "soap.beeps",
+ "xmlrpc.beep", "xmlrpc.beeps", "urn:", "go:",
+ "h323:", "ipp:", "tftp:", "mupdate:", "pres:",
+ "im:", "mtqp", "smb:"
+ };
+
+ static {
+ Arrays.sort( EXTERNAL_LINKS );
+ }
+
+ public LinkParsingOperations( final WikiContext wikiContext ) {
+ this.wikiContext = wikiContext;
+ }
+
+ /**
+ * @see {@link JSPWikiMarkupParser#isAccessRule()}
+ */
+ public boolean isAccessRule( final String link ) {
+ return link.startsWith("{ALLOW") || link.startsWith("{DENY");
+ }
+
+ /**
+ * @see {@link JSPWikiMarkupParser#isPluginLink()}
+ */
+ public boolean isPluginLink( final String link ) {
+ return link.startsWith( "{INSERT" ) ||
+ ( link.startsWith( "{" ) && !link.startsWith( "{$" ) );
+ }
+
+ /**
+ * @see {@link JSPWikiMarkupParser#isMetadata()}
+ */
+ public boolean isMetadata( final String link ) {
+ return link.startsWith( "{SET" );
+ }
+
+ /**
+ * @see {@link VariableManager#isVariableLink()}
+ */
+ public boolean isVariableLink( String link ) {
+ return link.startsWith( "{$" );
+ }
+
+ /**
+ * something similar at {@link LinkParser.Link#isInterwikiLink()}.
+ * @param page
+ * @return
+ */
+ public boolean isInterWikiLink( final String page ) {
+ return page.indexOf( ':' ) != -1;
+ }
+
+ /**
+ * @see at {@link JSPWikiMarkupParser#isExternalLink(String)}.
+ */
+ public boolean isExternalLink( final String page ) {
+ int idx = Arrays.binarySearch( EXTERNAL_LINKS, page, new StartingComparator() );
+
+ //
+ // We need to check here once again; otherwise we might get a match for something like "h".
+ //
+ if( idx >= 0 && page.startsWith( EXTERNAL_LINKS[ idx ] ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @see at {@link JSPWikiMarkupParser#isImageLink(String)}.
+ */
+ public boolean isImageLink( String link ) {
+ if( wikiContext.getEngine().getRenderingManager().getParser( wikiContext, link ).isImageInlining() )
+ {
+ link = link.toLowerCase();
+ List< Pattern > inlineImagePatterns = wikiContext.getEngine().getRenderingManager()
+ .getParser( wikiContext, link ).getInlineImagePatterns();
+
+ for( Iterator< Pattern > i = inlineImagePatterns.iterator(); i.hasNext(); ) {
+ if( new Perl5Matcher().matches( link, i.next() ) )
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean linkExists( final String page ) {
+ if( page == null || page.length() == 0 ) {
+ return false;
+ }
+ try {
+ return wikiContext.getEngine().getFinalPageName( page ) != null;
+ } catch( ProviderException e ) {
+ log.warn( "TranslatorReader got a faulty page name [" + page + "]!", e );
+ return false;
+ }
+ }
+
+ public String linkIfExists( final String page ) {
+ if( page == null || page.length() == 0 ) {
+ return null;
+ }
+ try {
+ return wikiContext.getEngine().getFinalPageName( page );
+ } catch( ProviderException e ) {
+ log.warn( "TranslatorReader got a faulty page name [" + page + "]!", e );
+ return null;
+ }
+ }
+
+ /**
+ * Compares two Strings, and if one starts with the other, then returns null. Otherwise just like the normal Comparator for strings.
+ *
+ * @since
+ */
+ private static class StartingComparator implements Comparator< String > {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see Comparator#compare(String, String)
+ */
+ @Override
+ public int compare( final String s1, final String s2 ) {
+ if( s1.length() > s2.length() ) {
+ if( s1.startsWith( s2 ) && s2.length() > 1 ) {
+ return 0;
+ }
+ } else if( s2.startsWith( s1 ) && s1.length() > 1 ) {
+ return 0;
+ }
+
+ return s1.compareTo( s2 );
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/4128154e/jspwiki-war/src/main/java/org/apache/wiki/parser/MarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/MarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/MarkupParser.java
index 96d2b9c..f8e58df 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/MarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/MarkupParser.java
@@ -65,6 +65,7 @@ public abstract class MarkupParser
protected boolean m_parseAccessRules = true;
/** Keeps image regexp Patterns */
protected List< Pattern > m_inlineImagePatterns = null;
+ protected LinkParsingOperations m_linkParsingOperations;
private static Logger log = Logger.getLogger( MarkupParser.class );
@@ -152,6 +153,7 @@ public abstract class MarkupParser
{
m_engine = context.getEngine();
m_context = context;
+ m_linkParsingOperations = new LinkParsingOperations( m_context );
setInputReader( in );
}
[04/15] jspwiki git commit: deprecate
JSPWikiMarkupParser#isExternalLink(String) and use
LinkParsingOperations#isExternalLink(String) instead
Posted by ju...@apache.org.
deprecate JSPWikiMarkupParser#isExternalLink(String) and use LinkParsingOperations#isExternalLink(String) instead
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/0b5016d0
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/0b5016d0
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/0b5016d0
Branch: refs/heads/master
Commit: 0b5016d08061d6786c4d873edb2b14c6bbc13542
Parents: 4128154
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 01:43:07 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 01:43:07 2017 +0100
----------------------------------------------------------------------
.../apache/wiki/parser/JSPWikiMarkupParser.java | 81 ++------------------
.../wiki/parser/LinkParsingOperations.java | 7 +-
.../main/java/org/apache/wiki/tags/LinkTag.java | 4 +-
3 files changed, 14 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/0b5016d0/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index c3ea8b6..a7f0504 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -165,41 +165,8 @@ public class JSPWikiMarkupParser extends MarkupParser {
private Heading m_lastHeading = null;
- /**
- * This list contains all IANA registered URI protocol
- * types as of September 2004 + a few well-known extra types.
- *
- * JSPWiki recognises all of them as external links.
- *
- * This array is sorted during class load, so you can just dump
- * here whatever you want in whatever order you want.
- */
- static final String[] EXTERNAL_LINKS = {
- "http:", "ftp:", "https:", "mailto:",
- "news:", "file:", "rtsp:", "mms:", "ldap:",
- "gopher:", "nntp:", "telnet:", "wais:",
- "prospero:", "z39.50s", "z39.50r", "vemmi:",
- "imap:", "nfs:", "acap:", "tip:", "pop:",
- "dav:", "opaquelocktoken:", "sip:", "sips:",
- "tel:", "fax:", "modem:", "soap.beep:", "soap.beeps",
- "xmlrpc.beep", "xmlrpc.beeps", "urn:", "go:",
- "h323:", "ipp:", "tftp:", "mupdate:", "pres:",
- "im:", "mtqp", "smb:" };
-
private static final String CAMELCASE_PATTERN = "JSPWikiMarkupParser.camelCasePattern";
-
- /**
- * This Comparator is used to find an external link from c_externalLinks. It
- * checks if the link starts with the other arraythingie.
- */
- private static Comparator<String> c_startingComparator = new StartingComparator();
-
- static
- {
- Arrays.sort( EXTERNAL_LINKS );
- }
-
/**
* Creates a markup parser.
*
@@ -504,20 +471,12 @@ public class JSPWikiMarkupParser extends MarkupParser {
* @param link The link to check.
* @return true, if this is a link outside of this wiki.
* @since 2.4
+ * @deprecated - use {@link LinkParsingOperations#isExternalLink(String)} instead.
*/
-
+ @Deprecated
public static boolean isExternalLink( String link )
{
- int idx = Arrays.binarySearch( EXTERNAL_LINKS, link,
- c_startingComparator );
-
- //
- // We need to check here once again; otherwise we might
- // get a match for something like "h".
- //
- if( idx >= 0 && link.startsWith(EXTERNAL_LINKS[idx]) ) return true;
-
- return false;
+ return new LinkParsingOperations(null).isExternalLink( link );
}
/**
@@ -1185,7 +1144,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
{
String possiblePage = MarkupParser.cleanLink( link );
- if( isExternalLink( link ) && hasLinkText )
+ if( m_linkParsingOperations.isExternalLink( link ) && hasLinkText )
{
return makeLink( IMAGELINK, reallink, link, null, null );
}
@@ -1361,7 +1320,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
addElement( el );
}
- else if( isExternalLink( linkref ) )
+ else if( m_linkParsingOperations.isExternalLink( linkref ) )
{
// It's an external link, out of this Wiki
@@ -1415,7 +1374,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
makeLink( INTERWIKI, urlReference, linktext, null, link.getAttributes() );
}
- if( isExternalLink(urlReference) )
+ if( m_linkParsingOperations.isExternalLink(urlReference) )
{
addElement( outlinkImage() );
}
@@ -2826,32 +2785,4 @@ public class JSPWikiMarkupParser extends MarkupParser {
}
}
-
- /**
- * Compares two Strings, and if one starts with the other, then
- * returns null. Otherwise just like the normal Comparator
- * for strings.
- *
- * @since
- */
- private static class StartingComparator implements Comparator<String>
- {
- public int compare( String s1, String s2 )
- {
- if( s1.length() > s2.length() )
- {
- if( s1.startsWith(s2) && s2.length() > 1 ) return 0;
- }
- else
- {
- if( s2.startsWith(s1) && s1.length() > 1 ) return 0;
- }
-
- return s1.compareTo( s2 );
- }
-
- }
-
-
}
-
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/0b5016d0/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index 0697ba2..ef8e238 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -108,7 +108,12 @@ public class LinkParsingOperations {
}
/**
- * @see at {@link JSPWikiMarkupParser#isExternalLink(String)}.
+ * Figures out if a link is an off-site link. This recognizes
+ * the most common protocols by checking how it starts.
+ *
+ * @param link The link to check.
+ * @return true, if this is a link outside of this wiki.
+ * @since 2.10.3
*/
public boolean isExternalLink( final String page ) {
int idx = Arrays.binarySearch( EXTERNAL_LINKS, page, new StartingComparator() );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/0b5016d0/jspwiki-war/src/main/java/org/apache/wiki/tags/LinkTag.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/tags/LinkTag.java b/jspwiki-war/src/main/java/org/apache/wiki/tags/LinkTag.java
index f4ea321..a05cec2 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/tags/LinkTag.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/tags/LinkTag.java
@@ -34,7 +34,7 @@ import org.apache.wiki.WikiPage;
import org.apache.wiki.WikiProvider;
import org.apache.wiki.api.exceptions.ProviderException;
import org.apache.wiki.attachment.Attachment;
-import org.apache.wiki.parser.JSPWikiMarkupParser;
+import org.apache.wiki.parser.LinkParsingOperations;
import org.apache.wiki.parser.MarkupParser;
import org.apache.wiki.util.TextUtil;
@@ -209,7 +209,7 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
{
int interwikipoint;
- if( JSPWikiMarkupParser.isExternalLink(m_ref) )
+ if( new LinkParsingOperations( m_wikiContext ).isExternalLink(m_ref) )
{
url = m_ref;
}
[12/15] jspwiki git commit: get rid of easy to fix compilation
warnings
Posted by ju...@apache.org.
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
index cbb407a..6fb6171 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
@@ -14,10 +14,11 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
+import java.security.Principal;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
@@ -28,8 +29,6 @@ import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
import javax.servlet.http.HttpServletRequest;
-import junit.framework.TestCase;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
import org.apache.wiki.auth.WikiPrincipal;
@@ -37,6 +36,8 @@ import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
+import junit.framework.TestCase;
+
/**
*/
public class AnonymousLoginModuleTest extends TestCase
@@ -58,7 +59,7 @@ public class AnonymousLoginModuleTest extends TestCase
module.initialize( m_subject, handler, new HashMap<String, Object>(), new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
@@ -78,12 +79,12 @@ public class AnonymousLoginModuleTest extends TestCase
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new AnonymousLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
index 8b0ee8b..277a017 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
@@ -14,10 +14,11 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
+import java.security.Principal;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
@@ -28,9 +29,6 @@ import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
import javax.servlet.http.Cookie;
-import junit.framework.TestCase;
-import net.sourceforge.stripes.mock.MockHttpServletRequest;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
import org.apache.wiki.auth.WikiPrincipal;
@@ -38,6 +36,9 @@ import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
+import junit.framework.TestCase;
+import net.sourceforge.stripes.mock.MockHttpServletRequest;
+
/**
*/
public class CookieAssertionLoginModuleTest extends TestCase
@@ -62,12 +63,12 @@ public class CookieAssertionLoginModuleTest extends TestCase
m_subject = new Subject();
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new CookieAssertionLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
assertFalse( principals.contains( Role.ASSERTED ) );
@@ -89,12 +90,12 @@ public class CookieAssertionLoginModuleTest extends TestCase
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new CookieAssertionLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
index 5144d4e..97cbe50 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
@@ -14,10 +14,11 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
+import java.security.Principal;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
@@ -54,23 +55,23 @@ public class UserDatabaseLoginModuleTest extends TestCase
// Log in with a user that isn't in the database
CallbackHandler handler = new WikiCallbackHandler( m_engine, null, "user", "password" );
LoginModule module = new UserDatabaseLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
assertFalse( principals.contains( Role.ALL ) );
-
+
// Login with a user that IS in the database
m_subject = new Subject();
handler = new WikiCallbackHandler( m_engine, null, "janne", "myP@5sw0rd" );
module = new UserDatabaseLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
@@ -78,7 +79,7 @@ public class UserDatabaseLoginModuleTest extends TestCase
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "janne", WikiPrincipal.LOGIN_NAME ) ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
- assertFalse( principals.contains( Role.ALL ) );
+ assertFalse( principals.contains( Role.ALL ) );
}
catch( LoginException e )
{
@@ -93,12 +94,12 @@ public class UserDatabaseLoginModuleTest extends TestCase
{
CallbackHandler handler = new WikiCallbackHandler( m_engine, null, "user", "password" );
LoginModule module = new UserDatabaseLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
index b6db88f..86c3405 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
@@ -58,12 +58,12 @@ public class WebContainerLoginModuleTest extends TestCase
// Test using Principal (WebContainerLoginModule succeeds)
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new WebContainerLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>());
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( principal ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
@@ -87,12 +87,12 @@ public class WebContainerLoginModuleTest extends TestCase
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new WebContainerLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>());
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( principal ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
index 948c4b7..10c5d12 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.permissions;
@@ -59,7 +59,7 @@ public class AllPermissionCollectionTest extends TestCase
c_all.add( all4 );
assertEquals( 3, count( c_all ) );
}
-
+
public void testAddPagePermission()
{
PagePermission p1 = new PagePermission( "JSPWiki:Main", "edit" );
@@ -80,7 +80,7 @@ public class AllPermissionCollectionTest extends TestCase
c_all.add( p4 );
assertEquals( 3, count( c_all ) );
}
-
+
public void testAddWikiPermission()
{
WikiPermission p1 = new WikiPermission( "JSPWiki", "login" );
@@ -101,7 +101,7 @@ public class AllPermissionCollectionTest extends TestCase
c_all.add( p4 );
assertEquals( 3, count( c_all ) );
}
-
+
public void testReadOnly()
{
AllPermission all1 = new AllPermission( "*" );
@@ -202,7 +202,7 @@ public class AllPermissionCollectionTest extends TestCase
assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
assertTrue( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
}
-
+
public void testImpliesMixedPermissions()
{
Permission p1 = new AllPermission( "JSPWiki" );
@@ -229,7 +229,7 @@ public class AllPermissionCollectionTest extends TestCase
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
-
+
c_all.add( p3 );
assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
@@ -239,7 +239,7 @@ public class AllPermissionCollectionTest extends TestCase
assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
-
+
c_all.add( p4 );
assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
@@ -250,11 +250,11 @@ public class AllPermissionCollectionTest extends TestCase
assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
}
-
+
private int count( AllPermissionCollection collection )
{
int i = 0;
- Enumeration perms = collection.elements();
+ Enumeration< Permission > perms = collection.elements();
while( perms.hasMoreElements() )
{
perms.nextElement();
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java b/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
index 462b485..dc10d00 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.plugin;
@@ -38,10 +38,10 @@ public class SamplePlugin3
{
}
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map< String, String > params )
throws PluginException
{
- return (String)params.get("text");
+ return params.get("text");
}
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
index 3be134c..8cc5b2b 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
@@ -27,18 +27,17 @@ import java.util.Date;
import java.util.List;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import net.sf.ehcache.CacheManager;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.plugin.WeblogEntryPlugin;
import org.apache.wiki.plugin.WeblogPlugin;
import org.apache.wiki.providers.FileSystemProvider;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import net.sf.ehcache.CacheManager;
+
/**
*
* @since
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
index 0cab8ac..c1966b2 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,49 +14,48 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
/*
* (C) Janne Jalkanen 2005
- *
+ *
*/
package org.apache.wiki.url;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.api.exceptions.WikiException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class DefaultURLConstructorTest extends TestCase
{
TestEngine testEngine;
Properties props = TestEngine.getTestProperties();
-
+
private URLConstructor getConstructor( String prefix )
throws WikiException
{
if( prefix != null ) props.setProperty( ShortViewURLConstructor.PROP_PREFIX, prefix );
-
+
testEngine = new TestEngine(props);
URLConstructor constr = new DefaultURLConstructor();
-
+
constr.initialize( testEngine, props );
-
+
return constr;
}
-
+
public void testViewURL1()
throws Exception
{
URLConstructor c = getConstructor("wiki/" );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -64,15 +63,15 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
public void testViewURL3()
throws Exception
- {
+ {
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -80,7 +79,7 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",false,null) );
}
@@ -88,15 +87,15 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( "" );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
-
+
public void testViewURL6()
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -112,7 +111,7 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Edit.jsp?page=Main", c.makeURL(WikiContext.EDIT,"Main",true,null) );
}
@@ -139,12 +138,12 @@ public class DefaultURLConstructorTest extends TestCase
assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",true,null) );
}
-
+
public void testOtherURL2()
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/foo.jsp?a=1&b=2", c.makeURL(WikiContext.NONE,"foo.jsp",true,"a=1&b=2") );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
index 6b7de52..75a8726 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,49 +14,48 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
/*
* (C) Janne Jalkanen 2005
- *
+ *
*/
package org.apache.wiki.url;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.api.exceptions.WikiException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class ShortURLConstructorTest extends TestCase
{
TestEngine testEngine;
Properties props = TestEngine.getTestProperties();
-
+
private URLConstructor getConstructor(String prefix)
throws WikiException
{
if( prefix != null ) props.setProperty( ShortURLConstructor.PROP_PREFIX, prefix );
-
+
testEngine = new TestEngine(props);
URLConstructor constr = new ShortURLConstructor();
-
+
constr.initialize( testEngine, props );
-
+
return constr;
}
-
+
public void testViewURL1()
throws Exception
{
URLConstructor c = getConstructor("wiki/" );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -64,15 +63,15 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
public void testViewURL3()
throws Exception
- {
+ {
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -80,7 +79,7 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",false,null) );
}
@@ -88,15 +87,15 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor("" );
-
+
assertEquals( "/test/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
-
+
public void testViewURL6()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -112,7 +111,7 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main?do=Edit", c.makeURL(WikiContext.EDIT,"Main",true,null) );
}
@@ -139,12 +138,12 @@ public class ShortURLConstructorTest extends TestCase
assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",true,null) );
}
-
+
public void testOtherURL2()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/foo.jsp?a=1&b=2", c.makeURL(WikiContext.NONE,"foo.jsp",true,"a=1&b=2") );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
index 3270a59..cdc4b19 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,49 +14,48 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
/*
* (C) Janne Jalkanen 2005
- *
+ *
*/
package org.apache.wiki.url;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.api.exceptions.WikiException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class ShortViewURLConstructorTest extends TestCase
{
TestEngine testEngine;
Properties props = TestEngine.getTestProperties();
-
+
private URLConstructor getConstructor(String prefix)
throws WikiException
{
if( prefix != null ) props.setProperty( ShortViewURLConstructor.PROP_PREFIX, prefix );
-
+
testEngine = new TestEngine(props);
URLConstructor constr = new ShortViewURLConstructor();
-
+
constr.initialize( testEngine, props );
-
+
return constr;
}
-
+
public void testViewURL1()
throws Exception
{
URLConstructor c = getConstructor("wiki/" );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -64,15 +63,15 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
public void testViewURL3()
throws Exception
- {
+ {
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -80,7 +79,7 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",false,null) );
}
@@ -88,15 +87,15 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor("" );
-
+
assertEquals( "/test/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
-
+
public void testViewURL6()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -112,7 +111,7 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/Edit.jsp?page=Main", c.makeURL(WikiContext.EDIT,"Main",true,null) );
}
@@ -139,12 +138,12 @@ public class ShortViewURLConstructorTest extends TestCase
assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",true,null) );
}
-
+
public void testOtherURL2()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/foo.jsp?a=1&b=2", c.makeURL(WikiContext.NONE,"foo.jsp",true,"a=1&b=2") );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java b/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
index 0b564df..683b613 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.util;
@@ -27,14 +27,14 @@ public class PriorityListTest extends TestCase
{
super( s );
}
-
+
public void testInsert()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 2 );
-
+
assertEquals( "size", 2, p.size() );
assertEquals( "Two", "Two", p.get(0) );
@@ -47,11 +47,11 @@ public class PriorityListTest extends TestCase
*/
public void testInsertSame()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 1 );
-
+
assertEquals( "size", 2, p.size() );
assertEquals( "One", "One", p.get(0) );
@@ -60,12 +60,12 @@ public class PriorityListTest extends TestCase
public void testInsertSame2()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 2 );
p.add( "Three", 3 );
-
+
assertEquals( "size", 3, p.size() );
assertEquals( "Three", "Three", p.get(0) );
@@ -84,14 +84,14 @@ public class PriorityListTest extends TestCase
public void testInsertSame3()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 2 );
p.add( "Two2", 2 );
p.add( "Two3", 2 );
p.add( "Three", 3 );
-
+
assertEquals( "size", 5, p.size() );
assertEquals( "Three", "Three", p.get(0) );
[14/15] jspwiki git commit: 2.10.3-git-43
Posted by ju...@apache.org.
2.10.3-git-43
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/5dd24d95
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/5dd24d95
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/5dd24d95
Branch: refs/heads/master
Commit: 5dd24d95ec332caddfaabe9ab823c2e94b734678
Parents: 1cd2e94
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 19:07:49 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 19:07:49 2017 +0100
----------------------------------------------------------------------
ChangeLog | 12 ++++++++++++
jspwiki-war/src/main/java/org/apache/wiki/Release.java | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/5dd24d95/ChangeLog
----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 1501521..f67f30a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-12-03 Juan Pablo Santos (juanpablo AT apache DOT org)
+
+ * 2.10.3-git-43
+
+ * Fixed JSPWIKI-843 - generate test-jar for jspwiki-war (wasn't being generated)
+
+ * Extract WikiLink parsing operations from JSPWikiMarkupParser, LinkParser,
+ VariableManager to their own class, LinkParsingOperations
+
+ * Move (private) JSPWikiMarkupParser#getLocalBooleanProperty to
+ (public) WikiContext#getBooleanWikiProperty
+
2017-11-16 Juan Pablo Santos (juanpablo AT apache DOT org)
* 2.10.3-git-42
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/5dd24d95/jspwiki-war/src/main/java/org/apache/wiki/Release.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/Release.java b/jspwiki-war/src/main/java/org/apache/wiki/Release.java
index da5833c..1a1f509 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/Release.java
@@ -72,7 +72,7 @@ public final class Release {
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "42";
+ public static final String BUILD = "43";
/**
* This is the generic version string you should use when printing out the version. It is of
[07/15] jspwiki git commit: delete JSPWikiMarkupParser#isMetadata()
and use LinkParsingOperations#isMetadata(String) instead
Posted by ju...@apache.org.
delete JSPWikiMarkupParser#isMetadata() and use LinkParsingOperations#isMetadata(String) instead
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/b6ad5dad
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/b6ad5dad
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/b6ad5dad
Branch: refs/heads/master
Commit: b6ad5dadc5e54c38f03725e6ea060049d32f5c3b
Parents: a96dd18
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 02:10:23 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 02:10:23 2017 +0100
----------------------------------------------------------------------
.../apache/wiki/parser/JSPWikiMarkupParser.java | 8 +----
.../wiki/parser/LinkParsingOperations.java | 34 +++++++++++---------
2 files changed, 19 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/b6ad5dad/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 765ef23..cb74995 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -48,7 +48,6 @@ import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.apache.wiki.InternalWikiException;
import org.apache.wiki.StringTransmutator;
-import org.apache.wiki.VariableManager;
import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiPage;
import org.apache.wiki.api.exceptions.PluginException;
@@ -524,11 +523,6 @@ public class JSPWikiMarkupParser extends MarkupParser {
return false;
}
- private static boolean isMetadata( String link )
- {
- return link.startsWith("{SET");
- }
-
/**
* These are all of the HTML 4.01 block-level elements.
*/
@@ -1262,7 +1256,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
return handleAccessRule( linktext );
}
- if( isMetadata( linktext ) )
+ if( m_linkParsingOperations.isMetadata( linktext ) )
{
return handleMetadata( linktext );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/b6ad5dad/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index edc43d7..9aedc1b 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -26,13 +26,14 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.apache.oro.text.regex.Pattern;
import org.apache.oro.text.regex.Perl5Matcher;
-import org.apache.wiki.VariableManager;
import org.apache.wiki.WikiContext;
import org.apache.wiki.api.exceptions.ProviderException;
/**
- * Link parsing operations
+ * Link parsing operations.
+ *
+ * @since 2.10.3
*/
public class LinkParsingOperations {
@@ -85,41 +86,42 @@ public class LinkParsingOperations {
}
/**
- * @see {@link JSPWikiMarkupParser#isMetadata()}
+ * Returns true if the link is a metadata link
+ *
+ * @param link The link text
+ * @return {@code true}, if this represents a metadata link.
*/
public boolean isMetadata( final String link ) {
return link.startsWith( "{SET" );
}
/**
- * Returns true if the link is really command to insert
- * a variable.
- * <P>
- * Currently we just check if the link starts with "{$".
+ * Returns true if the link is really command to insert a variable.
+ * <P>
+ * Currently we just check if the link starts with "{$".
*
- * @param link The link text
- * @return {@code true}, if this represents a variable link.
+ * @param link The link text
+ * @return {@code true}, if this represents a variable link.
*/
public boolean isVariableLink( String link ) {
return link.startsWith( "{$" );
}
/**
- * Returns true, if this Link represents an InterWiki link (of the form wiki:page).
+ * Returns true, if this Link represents an InterWiki link (of the form wiki:page).
*
- * @return {@code true}, if this Link represents an InterWiki link, {@code false} otherwise.
+ * @return {@code true}, if this Link represents an InterWiki link, {@code false} otherwise.
*/
public boolean isInterWikiLink( final String page ) {
return page.indexOf( ':' ) != -1;
}
/**
- * Figures out if a link is an off-site link. This recognizes
- * the most common protocols by checking how it starts.
+ * Figures out if a link is an off-site link. This recognizes
+ * the most common protocols by checking how it starts.
*
- * @param link The link to check.
- * @return true, if this is a link outside of this wiki.
- * @since 2.10.3
+ * @param link The link to check.
+ * @return true, if this is a link outside of this wiki.
*/
public boolean isExternalLink( final String page ) {
int idx = Arrays.binarySearch( EXTERNAL_LINKS, page, new StartingComparator() );
[05/15] jspwiki git commit: delegate
LinkParser.Link#isInterwikiLink() on
LinkParsingOperations#isInterWikiLink(String)
Posted by ju...@apache.org.
delegate LinkParser.Link#isInterwikiLink() on LinkParsingOperations#isInterWikiLink(String)
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/15e17d72
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/15e17d72
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/15e17d72
Branch: refs/heads/master
Commit: 15e17d726885562d098a71824c04376f2bd1e8d7
Parents: 0b5016d
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 01:49:27 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 01:49:27 2017 +0100
----------------------------------------------------------------------
.../apache/wiki/parser/JSPWikiMarkupParser.java | 1 -
.../java/org/apache/wiki/parser/LinkParser.java | 62 ++++++++++----------
.../wiki/parser/LinkParsingOperations.java | 6 +-
3 files changed, 33 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/15e17d72/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index a7f0504..5cbe771 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -25,7 +25,6 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Comparator;
import java.util.EmptyStackException;
import java.util.HashMap;
import java.util.Iterator;
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/15e17d72/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
index 709b5bd..1623865 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.parser;
@@ -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 m_EMPTY = new ArrayList();
+ private static final List< Attribute > m_EMPTY = new ArrayList< Attribute >();
// ............
@@ -312,10 +312,10 @@ public class LinkParser
}
- /**
+ /**
* Returns true if the String <tt>s</tt> is completely
* composed of whitespace.
- *
+ *
* @param s The string to check
* @return True, if "s" is all XML whitespace.
*/
@@ -329,10 +329,10 @@ public class LinkParser
}
- /**
+ /**
* Returns true if char <tt>c</tt> is a member of
* <tt>S</tt> (space) [XML 1.1 production 3].
- *
+ *
* @param c Character to check.
* @return True, if the character is an XML space.
*/
@@ -375,7 +375,7 @@ public class LinkParser
/**
* Create a new link with a given text and hyperlink (reference).
- *
+ *
* @param text The link text.
* @param ref The hypertext reference.
* @throws ParseException If the link text or reference are illegal.
@@ -388,7 +388,7 @@ public class LinkParser
/**
* Sets the link text.
- *
+ *
* @param text The link text.
* @throws ParseException If the text is illegal (e.g. null).
*/
@@ -403,7 +403,7 @@ public class LinkParser
/**
* Returns the link text.
- *
+ *
* @return Link text.
*/
public String getText()
@@ -414,7 +414,7 @@ public class LinkParser
/**
* Sets the hypertext reference. Typically, this is an URI or an interwiki link,
* or a wikilink.
- *
+ *
* @param ref The reference.
* @throws ParseException If the reference is illegal.
*/
@@ -429,7 +429,7 @@ public class LinkParser
/**
* Returns true, if there is a reference.
- *
+ *
* @return True, if there's a reference; false otherwise.
*/
public boolean hasReference()
@@ -437,9 +437,9 @@ public class LinkParser
return m_ref != null;
}
- /**
- * Returns the link reference, or the link text if null.
- *
+ /**
+ * Returns the link reference, or the link text if null.
+ *
* @return A link reference.
*/
public String getReference()
@@ -451,25 +451,23 @@ public class LinkParser
/**
* Returns true, if this Link represents an InterWiki link (of the form wiki:page).
- *
+ *
* @return True, if this Link represents an InterWiki link.
*/
public boolean isInterwikiLink()
{
if( !hasReference() ) m_ref = m_text;
- m_interwikiPoint = m_ref.indexOf(':');
-
- return m_interwikiPoint != -1;
+ return new LinkParsingOperations( null ).isInterWikiLink( m_ref );
}
/**
- * Returns the name of the wiki if this is an interwiki link.
+ * Returns the name of the wiki if this is an interwiki link.
* <pre>
* Link link = new Link("Foo","Wikipedia:Foobar");
* assert( link.getExternalWikiPage(), "Wikipedia" );
- * </pre>
- *
+ * </pre>
+ *
* @return Name of the wiki, or null, if this is not an interwiki link.
*/
public String getExternalWiki()
@@ -478,17 +476,17 @@ public class LinkParser
{
return m_ref.substring( 0, m_interwikiPoint );
}
-
+
return null;
}
- /**
+ /**
* Returns the wikiname part of an interwiki link. Used only with interwiki links.
* <pre>
* Link link = new Link("Foo","Wikipedia:Foobar");
* assert( link.getExternalWikiPage(), "Foobar" );
- * </pre>
- *
+ * </pre>
+ *
* @return Wikiname part, or null, if this is not an interwiki link.
*/
public String getExternalWikiPage()
@@ -497,13 +495,13 @@ public class LinkParser
{
return m_ref.substring( m_interwikiPoint+1 );
}
-
+
return null;
}
/**
* Returns the number of attributes on this link.
- *
+ *
* @return The number of attributes.
*/
public int attributeCount()
@@ -515,7 +513,7 @@ public class LinkParser
/**
* Adds another attribute to the link.
- *
+ *
* @param attr A JDOM Attribute.
*/
public void addAttribute( Attribute attr )
@@ -527,9 +525,9 @@ public class LinkParser
m_attribs.add(attr);
}
- /**
+ /**
* Returns an Iterator over the list of JDOM Attributes.
- *
+ *
* @return Iterator over the attributes.
*/
public Iterator getAttributes()
@@ -539,8 +537,8 @@ public class LinkParser
: m_EMPTY.iterator() ;
}
- /**
- * Returns a wikitext string representation of this Link.
+ /**
+ * Returns a wikitext string representation of this Link.
* @return WikiText.
*/
public String toString()
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/15e17d72/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index ef8e238..4348315 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -99,9 +99,9 @@ public class LinkParsingOperations {
}
/**
- * something similar at {@link LinkParser.Link#isInterwikiLink()}.
- * @param page
- * @return
+ * Returns true, if this Link represents an InterWiki link (of the form wiki:page).
+ *
+ * @return {@code true}, if this Link represents an InterWiki link, {@code false} otherwise.
*/
public boolean isInterWikiLink( final String page ) {
return page.indexOf( ':' ) != -1;
[11/15] jspwiki git commit: delete
JSPWikiMarkupParser#linkExists(String) and use
LinkParsingOperations#linkExists(String) /
LinkParsingOperations#linkIfExists(String) instead
Posted by ju...@apache.org.
delete JSPWikiMarkupParser#linkExists(String) and use LinkParsingOperations#linkExists(String) / LinkParsingOperations#linkIfExists(String) instead
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/cc253b3c
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/cc253b3c
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/cc253b3c
Branch: refs/heads/master
Commit: cc253b3c801f5839b929d27e902f367a362dced2
Parents: 2a87ca5
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 19:04:31 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 19:04:31 2017 +0100
----------------------------------------------------------------------
.../apache/wiki/parser/JSPWikiMarkupParser.java | 55 ++++----------------
.../wiki/parser/LinkParsingOperations.java | 12 +++++
2 files changed, 22 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/cc253b3c/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 0f4ec48..7c7f1af 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -51,7 +51,6 @@ import org.apache.wiki.StringTransmutator;
import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiPage;
import org.apache.wiki.api.exceptions.PluginException;
-import org.apache.wiki.api.exceptions.ProviderException;
import org.apache.wiki.api.plugin.WikiPlugin;
import org.apache.wiki.auth.WikiSecurityException;
import org.apache.wiki.auth.acl.Acl;
@@ -106,14 +105,11 @@ public class JSPWikiMarkupParser extends MarkupParser {
private StringBuilder m_genlistBulletBuffer = new StringBuilder(10); // stores the # and * pattern
private boolean m_allowPHPWikiStyleLists = true;
-
private boolean m_isOpenParagraph = false;
/** Parser for extended link functionality. */
private LinkParser m_linkParser = new LinkParser();
- private PatternMatcher m_inlineMatcher = new Perl5Matcher();
-
/** Keeps track of any plain text that gets put in the Text nodes */
private StringBuilder m_plainTextBuf = new StringBuilder(20);
@@ -236,25 +232,6 @@ public class JSPWikiMarkupParser extends MarkupParser {
}
/**
- * Returns link name, if it exists; otherwise it returns null.
- */
- private String linkExists( String page )
- {
- try
- {
- if( page == null || page.length() == 0 ) return null;
-
- return m_engine.getFinalPageName( page );
- }
- catch( ProviderException e )
- {
- log.warn("TranslatorReader got a faulty page name!",e);
-
- return page; // FIXME: What would be the correct way to go back?
- }
- }
-
- /**
* Calls a transmutator chain.
*
* @param list Chain to call
@@ -461,7 +438,6 @@ public class JSPWikiMarkupParser extends MarkupParser {
return el;
}
-
/**
* Figures out if a link is an off-site link. This recognizes
* the most common protocols by checking how it starts.
@@ -1001,16 +977,13 @@ public class JSPWikiMarkupParser extends MarkupParser {
*/
private Element makeCamelCaseLink( String wikiname )
{
- String matchedLink;
+ String matchedLink = m_linkParsingOperations.linkIfExists( wikiname );
callMutatorChain( m_localLinkMutatorChain, wikiname );
- if( (matchedLink = linkExists( wikiname )) != null )
- {
+ if( matchedLink != null ) {
makeLink( READ, matchedLink, wikiname, null, null );
- }
- else
- {
+ } else {
makeLink( EDIT, wikiname, wikiname, null, null );
}
@@ -1112,8 +1085,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
{
return makeLink( IMAGELINK, reallink, link, null, null );
}
- else if( ( linkExists( possiblePage ) ) != null &&
- hasLinkText )
+ else if( m_linkParsingOperations.linkExists( possiblePage ) && hasLinkText )
{
// System.out.println("Orig="+link+", Matched: "+matchedLink);
callMutatorChain( m_localLinkMutatorChain, possiblePage );
@@ -1393,15 +1365,12 @@ public class JSPWikiMarkupParser extends MarkupParser {
callMutatorChain( m_localLinkMutatorChain, linkref );
- String matchedLink;
- if( (matchedLink = linkExists( linkref )) != null )
- {
+ String matchedLink = m_linkParsingOperations.linkIfExists( linkref );
+ if( matchedLink != null ) {
String sectref = "section-"+m_engine.encodeName(matchedLink+"-"+wikifyLink(namedSection));
sectref = sectref.replace('%', '_');
makeLink( READ, matchedLink, linktext, sectref, link.getAttributes() );
- }
- else
- {
+ } else {
makeLink( EDIT, linkref, linktext, null, link.getAttributes() );
}
}
@@ -1412,14 +1381,10 @@ public class JSPWikiMarkupParser extends MarkupParser {
callMutatorChain( m_localLinkMutatorChain, linkref );
- String matchedLink = linkExists( linkref );
-
- if( matchedLink != null )
- {
+ String matchedLink = m_linkParsingOperations.linkIfExists( linkref );
+ if( matchedLink != null ) {
makeLink( READ, matchedLink, linktext, null, link.getAttributes() );
- }
- else
- {
+ } else {
makeLink( EDIT, linkref, linktext, null, link.getAttributes() );
}
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/cc253b3c/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index c05c6d7..0a631a8 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -165,6 +165,12 @@ public class LinkParsingOperations {
return false;
}
+ /**
+ * Returns {@code true}, if the link name exists; otherwise it returns {@code false}.
+ *
+ * @param page link name
+ * @return {@code true}, if the link name exists; otherwise it returns {@code false}.
+ */
public boolean linkExists( final String page ) {
if( page == null || page.length() == 0 ) {
return false;
@@ -177,6 +183,12 @@ public class LinkParsingOperations {
}
}
+ /**
+ * Returns link name, if it exists; otherwise it returns {@code null}.
+ *
+ * @param page link name
+ * @return link name, if it exists; otherwise it returns {@code null}.
+ */
public String linkIfExists( final String page ) {
if( page == null || page.length() == 0 ) {
return null;
[15/15] jspwiki git commit: fix failing tests due to the use of
LinkParsingOperations
Posted by ju...@apache.org.
fix failing tests due to the use of LinkParsingOperations
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/719a1a1e
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/719a1a1e
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/719a1a1e
Branch: refs/heads/master
Commit: 719a1a1e3547991bccdce87b2cc7af4b2b8af37b
Parents: 5dd24d9
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 19:56:29 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 19:56:29 2017 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/wiki/parser/LinkParser.java | 5 +++--
.../org/apache/wiki/parser/LinkParsingOperations.java | 11 ++++++++++-
2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/719a1a1e/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
index e8f618f..b1c0882 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParser.java
@@ -456,9 +456,10 @@ public class LinkParser
*/
public boolean isInterwikiLink()
{
+ LinkParsingOperations lpo = new LinkParsingOperations( null );
if( !hasReference() ) m_ref = m_text;
-
- return new LinkParsingOperations( null ).isInterWikiLink( m_ref );
+ m_interwikiPoint = lpo.interWikiLinkAt( m_ref );
+ return lpo.isInterWikiLink( m_ref );
}
/**
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/719a1a1e/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index 0a631a8..dfd8676 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -122,7 +122,16 @@ public class LinkParsingOperations {
* @return {@code true}, if this Link represents an InterWiki link, {@code false} otherwise.
*/
public boolean isInterWikiLink( final String page ) {
- return page.indexOf( ':' ) != -1;
+ return interWikiLinkAt( page ) != -1;
+ }
+
+ /**
+ * Returns true, if this Link represents an InterWiki link (of the form wiki:page).
+ *
+ * @return {@code true}, if this Link represents an InterWiki link, {@code false} otherwise.
+ */
+ public int interWikiLinkAt( final String page ) {
+ return page.indexOf( ':' );
}
/**
[10/15] jspwiki git commit: delete
JSPWikiMarkupParser#isImageLink(String) and use
LinkParsingOperations#isImageLink(String) instead
Posted by ju...@apache.org.
delete JSPWikiMarkupParser#isImageLink(String) and use LinkParsingOperations#isImageLink(String) instead
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/2a87ca5d
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/2a87ca5d
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/2a87ca5d
Branch: refs/heads/master
Commit: 2a87ca5d0ca9f7d2d4035447b215ef277ca6b849
Parents: 4ef7ebc
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 02:18:22 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 02:18:22 2017 +0100
----------------------------------------------------------------------
.../apache/wiki/parser/JSPWikiMarkupParser.java | 29 +++-----------------
.../wiki/parser/LinkParsingOperations.java | 3 +-
2 files changed, 6 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/2a87ca5d/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 3c594be..0f4ec48 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -495,27 +495,6 @@ public class JSPWikiMarkupParser extends MarkupParser {
}
/**
- * Matches the given link to the list of image name patterns
- * to determine whether it should be treated as an inline image
- * or not.
- */
- private boolean isImageLink( String link )
- {
- if( m_inlineImages )
- {
- link = link.toLowerCase();
-
- for( Iterator< Pattern > i = m_inlineImagePatterns.iterator(); i.hasNext(); )
- {
- if( m_inlineMatcher.matches( link, i.next() ) )
- return true;
- }
- }
-
- return false;
- }
-
- /**
* These are all of the HTML 4.01 block-level elements.
*/
private static final String[] BLOCK_ELEMENTS = {
@@ -1092,7 +1071,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
callMutatorChain( m_externalLinkMutatorChain, url );
- if( isImageLink( url ) )
+ if( m_linkParsingOperations.isImageLink( url ) )
{
result = handleImageLink( StringUtils.replace(url,"&","&"), url, false );
}
@@ -1311,7 +1290,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
callMutatorChain( m_externalLinkMutatorChain, linkref );
- if( isImageLink( linkref ) )
+ if( m_linkParsingOperations.isImageLink( linkref ) )
{
handleImageLink( linkref, linktext, link.hasReference() );
}
@@ -1350,7 +1329,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
urlReference = TextUtil.replaceString( urlReference, "%s", wikiPage );
urlReference = callMutatorChain( m_externalLinkMutatorChain, urlReference );
- if( isImageLink(urlReference) )
+ if( m_linkParsingOperations.isImageLink(urlReference) )
{
handleImageLink( urlReference, linktext, link.hasReference() );
}
@@ -1393,7 +1372,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
{
callMutatorChain( m_attachmentLinkMutatorChain, attachment );
- if( isImageLink( linkref ) )
+ if( m_linkParsingOperations.isImageLink( linkref ) )
{
attachment = m_context.getURL( WikiContext.ATTACH, attachment );
sb.append( handleImageLink( attachment, linktext, link.hasReference() ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/2a87ca5d/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index bb19311..c05c6d7 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -146,7 +146,8 @@ public class LinkParsingOperations {
}
/**
- * @see at {@link JSPWikiMarkupParser#isImageLink(String)}.
+ * Matches the given link to the list of image name patterns to
+ * determine whether it should be treated as an inline image or not.
*/
public boolean isImageLink( String link ) {
if( wikiContext.getEngine().getRenderingManager().getParser( wikiContext, link ).isImageInlining() )
[09/15] jspwiki git commit: deprecate
JSPWikiMarkupParser#isPluginLink(String) and use
LinkParsingOperations#isPluginLink(String) instead
Posted by ju...@apache.org.
deprecate JSPWikiMarkupParser#isPluginLink(String) and use LinkParsingOperations#isPluginLink(String) instead
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/4ef7ebcb
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/4ef7ebcb
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/4ef7ebcb
Branch: refs/heads/master
Commit: 4ef7ebcbd4b285c351051fd71fd1cd8e7f445c19
Parents: 55852b9
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 02:16:38 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 02:16:38 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/wiki/parser/JSPWikiMarkupParser.java | 7 ++++---
.../java/org/apache/wiki/parser/LinkParsingOperations.java | 8 +++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/4ef7ebcb/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 84726f6..3c594be 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -486,11 +486,12 @@ public class JSPWikiMarkupParser extends MarkupParser {
*
* @param link Link text, i.e. the contents of text between [].
* @return True, if this link seems to be a command to insert a plugin here.
+ * @deprecated Use {@link LinkParsingOperations#isPluginLink(String)} instead,
*/
+ @Deprecated
public static boolean isPluginLink( String link )
{
- return link.startsWith( "{INSERT" ) ||
- ( link.startsWith( "{" ) && !link.startsWith( "{$" ) );
+ return new LinkParsingOperations( null ).isPluginLink( link );
}
/**
@@ -1252,7 +1253,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
return handleMetadata( linktext );
}
- if( isPluginLink( linktext ) )
+ if( m_linkParsingOperations.isPluginLink( linktext ) )
{
try
{
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/4ef7ebcb/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index 0ae9632..bb19311 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -81,7 +81,13 @@ public class LinkParsingOperations {
}
/**
- * @see {@link JSPWikiMarkupParser#isPluginLink()}
+ * Returns true if the link is really command to insert a plugin.
+ * <P>
+ * Currently we just check if the link starts with "{INSERT",
+ * or just plain "{" but not "{$".
+ *
+ * @param link Link text, i.e. the contents of text between [].
+ * @return True, if this link seems to be a command to insert a plugin here.
*/
public boolean isPluginLink( final String link ) {
return link.startsWith( "{INSERT" ) ||
[06/15] jspwiki git commit: deprecate
VariableManager#isVariableLink() and use
LinkParsingOperations#isVariableLink(String) instead
Posted by ju...@apache.org.
deprecate VariableManager#isVariableLink() and use LinkParsingOperations#isVariableLink(String) instead
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/a96dd18f
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/a96dd18f
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/a96dd18f
Branch: refs/heads/master
Commit: a96dd18ff04ffa33967ac399ef8b4151f9e8e4e8
Parents: 15e17d7
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 01:58:53 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 01:58:53 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/wiki/VariableManager.java | 63 ++++++++++----------
.../apache/wiki/parser/JSPWikiMarkupParser.java | 2 +-
.../wiki/parser/LinkParsingOperations.java | 8 ++-
3 files changed, 41 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/a96dd18f/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java b/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
index ce342db..5299d78 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki;
@@ -35,6 +35,7 @@ import org.apache.wiki.api.exceptions.NoSuchVariableException;
import org.apache.wiki.api.filters.PageFilter;
import org.apache.wiki.i18n.InternationalizationManager;
import org.apache.wiki.modules.InternalModule;
+import org.apache.wiki.parser.LinkParsingOperations;
import org.apache.wiki.preferences.Preferences;
/**
@@ -46,20 +47,20 @@ import org.apache.wiki.preferences.Preferences;
public class VariableManager
{
private static Logger log = Logger.getLogger( VariableManager.class );
-
+
// FIXME: These are probably obsolete.
public static final String VAR_ERROR = "error";
public static final String VAR_MSG = "msg";
-
+
/**
* Contains a list of those properties that shall never be shown.
* Put names here in lower case.
*/
-
+
static final String[] THE_BIG_NO_NO_LIST = {
"jspwiki.auth.masterpassword"
};
-
+
/**
* Creates a VariableManager object using the property list given.
* @param props The properties.
@@ -73,25 +74,27 @@ public class VariableManager
* a variable.
* <P>
* Currently we just check if the link starts with "{$".
- *
+ *
* @param link The link text
* @return true, if this represents a variable link.
+ * @deprecated Use {@link LinkParsingOperations#isVariableLink(String)}
*/
+ @Deprecated
public static boolean isVariableLink( String link )
{
- return link.startsWith("{$");
+ return new LinkParsingOperations( null ).isVariableLink( link );
}
/**
- * Parses the link and finds a value. This is essentially used
- * once {@link #isVariableLink(String)} has found that the link text
- * actually contains a variable. For example, you could pass in
- * "{$username}" and get back "JanneJalkanen".
+ * Parses the link and finds a value. This is essentially used once
+ * {@link LinkParsingOperations#isVariableLink(String)} has found that
+ * the link text actually contains a variable. For example, you could
+ * pass in "{$username}" and get back "JanneJalkanen".
*
* @param context The WikiContext
* @param link The link text containing the variable name.
* @return The variable value.
- * @throws IllegalArgumentException If the format is not valid (does not
+ * @throws IllegalArgumentException If the format is not valid (does not
* start with "{$", is zero length, etc.)
* @throws NoSuchVariableException If a variable is not known.
*/
@@ -116,7 +119,7 @@ public class VariableManager
* the expansion is not done twice, that is, a variable containing text $variable
* will not be expanded.
* <P>
- * The variables should be in the same format ({$variablename} as in the web
+ * The variables should be in the same format ({$variablename} as in the web
* pages.
*
* @param context The WikiContext of the current page.
@@ -178,7 +181,7 @@ public class VariableManager
* Returns the value of a named variable. See {@link #getValue(WikiContext, String)}.
* The only difference is that this method does not throw an exception, but it
* returns the given default value instead.
- *
+ *
* @param context WikiContext
* @param varName The name of the variable
* @param defValue A default value.
@@ -195,7 +198,7 @@ public class VariableManager
return defValue;
}
}
-
+
/**
* Returns a value of the named variable. The resolving order is
* <ol>
@@ -211,12 +214,12 @@ public class VariableManager
*
* Use this method only whenever you really need to have a parameter that
* can be overridden by anyone using the wiki.
- *
+ *
* @param context The WikiContext
* @param varName Name of the variable.
*
* @return The variable value.
- *
+ *
* @throws IllegalArgumentException If the name is somehow broken.
* @throws NoSuchVariableException If a variable is not known.
*/
@@ -239,7 +242,7 @@ public class VariableManager
if( name.equals(THE_BIG_NO_NO_LIST[i]) )
return ""; // FIXME: Should this be something different?
}
-
+
try
{
//
@@ -258,7 +261,7 @@ public class VariableManager
}
catch( NoSuchMethodException e1 )
{
- //
+ //
// It is not a system var. Time to handle the other cases.
//
// Check if such a context variable exists,
@@ -270,7 +273,7 @@ public class VariableManager
}
//
- // Well, I guess it wasn't a final straw. We also allow
+ // Well, I guess it wasn't a final straw. We also allow
// variables from the session and the request (in this order).
//
@@ -282,7 +285,7 @@ public class VariableManager
try
{
String s;
-
+
if( (s = (String)session.getAttribute( varName )) != null )
return s;
@@ -295,7 +298,7 @@ public class VariableManager
//
// And the final straw: see if the current page has named metadata.
//
-
+
WikiPage pg = context.getPage();
if( pg != null )
{
@@ -303,7 +306,7 @@ public class VariableManager
if( metadata != null )
return metadata.toString();
}
-
+
//
// And the final straw part 2: see if the "real" current page has
// named metadata. This allows a parent page to control a inserted
@@ -316,14 +319,14 @@ public class VariableManager
if( metadata != null )
return metadata.toString();
}
-
+
//
// Next-to-final straw: attempt to fetch using property name
// We don't allow fetching any other properties than those starting
// with "jspwiki.". I know my own code, but I can't vouch for bugs
// in other people's code... :-)
//
-
+
if( varName.startsWith("jspwiki.") )
{
Properties props = context.getEngine().getWikiProperties();
@@ -334,14 +337,14 @@ public class VariableManager
return s;
}
}
-
+
//
// Final defaults for some known quantities.
//
if( varName.equals( VAR_ERROR ) || varName.equals( VAR_MSG ) )
return "";
-
+
throw new NoSuchVariableException( "No variable "+varName+" defined." );
}
catch( Exception e )
@@ -363,7 +366,7 @@ public class VariableManager
* calls var.toLowerCase(), the getters for the variables do not have
* capitalization anywhere. This may look a bit odd, but then again, this
* is not meant to be a public class.
- *
+ *
* @since 2.7.0
*
*/
@@ -434,7 +437,7 @@ public class VariableManager
String link = i.next();
res.append( link );
res.append( " --> " );
- res.append( m_context.getEngine().getInterWikiURL(link) );
+ res.append( m_context.getEngine().getInterWikiURL(link) );
}
return res.toString();
}
@@ -488,7 +491,7 @@ public class VariableManager
public String getUsername()
{
Principal wup = m_context.getCurrentUser();
-
+
ResourceBundle rb = Preferences.getBundle( m_context, InternationalizationManager.CORE_BUNDLE );
return wup != null ? wup.getName() : rb.getString( "varmgr.not.logged.in" );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/a96dd18f/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 5cbe771..765ef23 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -1313,7 +1313,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
//
// In many cases these are the same. [linktext|linkref].
//
- if( VariableManager.isVariableLink( linktext ) )
+ if( m_linkParsingOperations.isVariableLink( linktext ) )
{
Content el = new VariableContent(linktext);
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/a96dd18f/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index 4348315..edc43d7 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -92,7 +92,13 @@ public class LinkParsingOperations {
}
/**
- * @see {@link VariableManager#isVariableLink()}
+ * Returns true if the link is really command to insert
+ * a variable.
+ * <P>
+ * Currently we just check if the link starts with "{$".
+ *
+ * @param link The link text
+ * @return {@code true}, if this represents a variable link.
*/
public boolean isVariableLink( String link ) {
return link.startsWith( "{$" );
[08/15] jspwiki git commit: delete
JSPWikiMarkupParser#isAccessRule(String) and use
LinkParsingOperations#isAccessRule(String) instead
Posted by ju...@apache.org.
delete JSPWikiMarkupParser#isAccessRule(String) and use LinkParsingOperations#isAccessRule(String) instead
Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/55852b9b
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/55852b9b
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/55852b9b
Branch: refs/heads/master
Commit: 55852b9b6ca82454d5b7833e08f06891a3f61fdc
Parents: b6ad5da
Author: juanpablo <ju...@apache.org>
Authored: Sun Dec 3 02:13:27 2017 +0100
Committer: juanpablo <ju...@apache.org>
Committed: Sun Dec 3 02:13:27 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/wiki/parser/JSPWikiMarkupParser.java | 11 +----------
.../org/apache/wiki/parser/LinkParsingOperations.java | 7 +++++--
2 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/55852b9b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index cb74995..84726f6 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -478,15 +478,6 @@ public class JSPWikiMarkupParser extends MarkupParser {
}
/**
- * Returns true, if the link in question is an access
- * rule.
- */
- private static boolean isAccessRule( String link )
- {
- return link.startsWith("{ALLOW") || link.startsWith("{DENY");
- }
-
- /**
* Returns true if the link is really command to insert
* a plugin.
* <P>
@@ -1251,7 +1242,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
StringBuilder sb = new StringBuilder(linktext.length()+80);
- if( isAccessRule( linktext ) )
+ if( m_linkParsingOperations.isAccessRule( linktext ) )
{
return handleAccessRule( linktext );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/55852b9b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
index 9aedc1b..0ae9632 100755
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/LinkParsingOperations.java
@@ -71,7 +71,10 @@ public class LinkParsingOperations {
}
/**
- * @see {@link JSPWikiMarkupParser#isAccessRule()}
+ * Returns true, if the link in question is an access rule.
+ *
+ * @param link The link text
+ * @return {@code true}, if this represents an access rule.
*/
public boolean isAccessRule( final String link ) {
return link.startsWith("{ALLOW") || link.startsWith("{DENY");
@@ -86,7 +89,7 @@ public class LinkParsingOperations {
}
/**
- * Returns true if the link is a metadata link
+ * Returns true if the link is a metadata link.
*
* @param link The link text
* @return {@code true}, if this represents a metadata link.