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 2020/01/28 20:34:08 UTC
[jspwiki] 07/32: apply intellij's suggested formatting
This is an automated email from the ASF dual-hosted git repository.
juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git
commit 9d3daeaba0dbd76fdaa42202386501d75247e9e0
Author: juanpablo <ju...@apache.org>
AuthorDate: Sat Jan 18 15:30:22 2020 +0100
apply intellij's suggested formatting
---
.../main/java/org/apache/wiki/ajax/AjaxUtil.java | 70 +++++++++++-----------
.../java/org/apache/wiki/ajax/WikiAjaxServlet.java | 11 ++--
.../org/apache/wiki/ui/progress/ProgressItem.java | 17 +++---
.../apache/wiki/ui/progress/ProgressManager.java | 2 +-
4 files changed, 49 insertions(+), 51 deletions(-)
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java b/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java
index 3cd1801..8deda32 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java
@@ -35,15 +35,15 @@ public class AjaxUtil extends HttpServlet {
/**
* Uses Google Gson (https://code.google.com/p/google-gson/) to convert to JSON
+ *
* @param input the object to be converted to JSON
* @return the JSON string of the object
*/
- public static String toJson(Object input) {
- String result = "";
- if (input != null) {
- result = gson.toJson(input);
+ public static String toJson( final Object input ) {
+ if( input != null ) {
+ return gson.toJson( input );
}
- return result;
+ return "";
}
/**
@@ -56,37 +56,37 @@ public class AjaxUtil extends HttpServlet {
* @param path the RequestURI to search usually done by calling request.getRequestUri().
* @param lastPart the previousPart of the path to search after.
* @return the next part of the path.
- * @throws ServletException
+ * @throws ServletException if {@code path} does not contain {@code lastPart}
*/
- public static String getNextPathPart(String path, String lastPart) throws ServletException {
- String result = null;
- if (StringUtils.isBlank(path)) {
- return result;
- }
- if (!lastPart.endsWith("/")) {
- lastPart += "/";
- }
- int index = path.indexOf(lastPart);
- if (index<0) {
- lastPart = lastPart.substring(0,lastPart.length()-1);
- index = path.indexOf(lastPart);
- if (index<0) {
- throw new ServletException("Invalid path provided " + path + " does not contain '" + lastPart + "'");
- }
- }
- path = path.substring(index+lastPart.length());
- index = path.indexOf("/");
- if (index == -1) {
- index = path.indexOf("#");
- if (index == -1) {
- index = path.indexOf("?");
- }
- }
- if (index == -1) {
- result = path;
- }
- else {
- result = path.substring(0,index);
+ public static String getNextPathPart( String path, String lastPart ) throws ServletException {
+ if( StringUtils.isBlank( path ) ) {
+ return null;
+ }
+ if( !lastPart.endsWith( "/" ) ) {
+ lastPart += "/";
+ }
+ int index = path.indexOf( lastPart );
+ if( index < 0 ) {
+ lastPart = lastPart.substring( 0, lastPart.length() - 1 );
+ index = path.indexOf( lastPart );
+ if( index < 0 ) {
+ throw new ServletException( "Invalid path provided " + path + " does not contain '" + lastPart + "'" );
+ }
+ }
+ path = path.substring( index + lastPart.length() );
+ index = path.indexOf( "/" );
+ if( index == -1 ) {
+ index = path.indexOf( "#" );
+ if( index == -1 ) {
+ index = path.indexOf( "?" );
+ }
+ }
+
+ final String result;
+ if( index == -1 ) {
+ result = path;
+ } else {
+ result = path.substring( 0, index );
}
return result;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxServlet.java b/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxServlet.java
index f24c94c..366a3e0 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxServlet.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxServlet.java
@@ -19,14 +19,13 @@
*/
package org.apache.wiki.ajax;
-import java.io.IOException;
-import java.util.List;
+import org.apache.wiki.plugin.SampleAjaxPlugin;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-import org.apache.wiki.plugin.SampleAjaxPlugin;
+import java.io.IOException;
+import java.util.List;
/**
* An interface for a servlet that wants to use Ajax functionality.
@@ -36,8 +35,8 @@ import org.apache.wiki.plugin.SampleAjaxPlugin;
*/
public interface WikiAjaxServlet {
- public String getServletMapping();
+ String getServletMapping();
- public void service(HttpServletRequest request, HttpServletResponse response, String actionName, List<String> params) throws ServletException, IOException;
+ void service( HttpServletRequest request, HttpServletResponse response, String actionName, List< String > params ) throws ServletException, IOException;
}
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressItem.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressItem.java
index 2f0a970..b9f3205 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressItem.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressItem.java
@@ -23,11 +23,9 @@ package org.apache.wiki.ui.progress;
*
* @since 2.6
*/
-public abstract class ProgressItem
-{
- /**
- * Status: The PI is created.
- */
+public abstract class ProgressItem {
+
+ /** Status: The PI is created. */
public static final int CREATED = 0;
/** Status: The PI is started. */
@@ -43,10 +41,10 @@ public abstract class ProgressItem
/**
* Get the state of the ProgressItem.
+ *
* @return CREATED, STARTED, STOPPED or FINISHED.
*/
- public int getState()
- {
+ public int getState() {
return m_state;
}
@@ -55,14 +53,15 @@ public abstract class ProgressItem
*
* @param state One of the CREATED, STARTED, STOPPED or FINISHED.
*/
- public void setState( int state )
- {
+ public void setState( final int state ) {
m_state = state;
}
/**
* Returns the progress in percents.
+ *
* @return An integer 0-100.
*/
public abstract int getProgress();
+
}
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressManager.java
index 8552a3f..6ce37ce 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/progress/ProgressManager.java
@@ -40,7 +40,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class ProgressManager {
- private Map< String,ProgressItem > m_progressingTasks = new ConcurrentHashMap<>();
+ private final Map< String,ProgressItem > m_progressingTasks = new ConcurrentHashMap<>();
/** The name of the progress tracker JSON object. The current value is "{@value}", */
public static final String JSON_PROGRESSTRACKER = "progressTracker";