You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/09/09 09:34:40 UTC
[tomcat] branch 7.0.x updated: Fix Javadoc errors with Java 9 and
align with 8.5.x
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push:
new 3c3cf99 Fix Javadoc errors with Java 9 and align with 8.5.x
3c3cf99 is described below
commit 3c3cf997d48601ad3124cc55a2f80c89c8dbfa14
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 9 10:33:42 2019 +0100
Fix Javadoc errors with Java 9 and align with 8.5.x
Primarily fixing Javadoc errors but align with 8.5.x where the
opportunity arises.
---
.ant-targets-build.xml | 82 +++++
java/org/apache/catalina/Authenticator.java | 9 +-
java/org/apache/catalina/Contained.java | 19 +-
java/org/apache/catalina/Valve.java | 9 +-
.../catalina/ant/BaseRedirectorHelperTask.java | 152 +++++----
java/org/apache/catalina/ant/FindLeaksTask.java | 8 +-
java/org/apache/catalina/ant/JMXQueryTask.java | 3 +-
java/org/apache/catalina/connector/Connector.java | 218 ++++++-------
.../apache/catalina/connector/CoyoteAdapter.java | 5 +-
.../catalina/loader/WebappClassLoaderBase.java | 8 +-
java/org/apache/catalina/manager/JspHelper.java | 26 +-
.../apache/catalina/realm/GenericPrincipal.java | 40 +--
java/org/apache/catalina/realm/JNDIRealm.java | 177 +++++-----
.../org/apache/catalina/security/SecurityUtil.java | 66 ++--
java/org/apache/catalina/tribes/Channel.java | 6 +-
.../apache/catalina/tribes/ChannelInterceptor.java | 11 +-
.../apache/catalina/tribes/group/GroupChannel.java | 47 +--
.../apache/catalina/tribes/group/RpcChannel.java | 11 +-
.../apache/catalina/util/LifecycleMBeanBase.java | 6 +-
java/org/apache/coyote/AbstractProcessor.java | 9 +-
java/org/apache/coyote/InputBuffer.java | 32 +-
java/org/apache/coyote/Processor.java | 1 -
java/org/apache/coyote/Request.java | 69 ++--
java/org/apache/jasper/compiler/AntCompiler.java | 8 +-
.../org/apache/jasper/runtime/PageContextImpl.java | 5 +-
java/org/apache/juli/logging/LogFactory.java | 34 +-
.../org/apache/naming/resources/ResourceCache.java | 2 +-
.../apache/tomcat/dbcp/dbcp/AbandonedConfig.java | 6 +-
.../tomcat/dbcp/dbcp/AbandonedObjectPool.java | 6 +-
.../apache/tomcat/dbcp/dbcp/BasicDataSource.java | 12 +-
.../tomcat/dbcp/jocl/JOCLContentHandler.java | 12 +-
.../dbcp/pool/KeyedPoolableObjectFactory.java | 1 -
.../dbcp/pool/impl/GenericKeyedObjectPool.java | 4 +-
.../tomcat/dbcp/pool/impl/GenericObjectPool.java | 8 +-
.../dbcp/pool/impl/SoftReferenceObjectPool.java | 1 -
.../tomcat/dbcp/pool/impl/StackObjectPool.java | 2 +-
.../apache/tomcat/util/codec/binary/Base64.java | 2 +-
.../tomcat/util/codec/binary/BaseNCodec.java | 6 +-
java/org/apache/tomcat/util/digester/Digester.java | 362 ++++++++-------------
.../org/apache/tomcat/util/http/CookieSupport.java | 2 +-
.../apache/tomcat/util/log/SystemLogHandler.java | 10 +-
.../apache/tomcat/util/modeler/BaseModelMBean.java | 180 +---------
.../apache/tomcat/util/net/AbstractEndpoint.java | 52 ++-
.../apache/tomcat/util/net/SecureNioChannel.java | 166 ++++++----
.../apache/tomcat/util/net/SocketProperties.java | 15 +-
45 files changed, 893 insertions(+), 1017 deletions(-)
diff --git a/.ant-targets-build.xml b/.ant-targets-build.xml
new file mode 100644
index 0000000..c2293ea
--- /dev/null
+++ b/.ant-targets-build.xml
@@ -0,0 +1,82 @@
+build-docs
+build-manifests
+build-prepare
+build-tomcat-jdbc-src
+check-java7
+clean
+cobertura-disabled
+cobertura-disabled-log
+cobertura-init
+cobertura-instrument
+cobertura-report
+compile
+compile-java6
+compile-java7
+compile-prepare
+compile-webapp-examples
+deploy
+dist-deployer
+dist-prepare
+dist-source
+dist-static
+download-cobertura
+download-compile
+download-deps
+download-dist
+download-test-compile
+download-validate
+downloadfile
+downloadfile-2
+downloadgz
+downloadgz-2
+downloadzip
+downloadzip-2
+echoproperties
+embed
+embed-extras
+embed-jars
+embed-sources
+examples-sources
+extras
+extras-commons-logging
+extras-commons-logging-prepare
+extras-jmx-remote
+extras-prepare
+extras-webservices
+extras-webservices-prepare
+gpg-init-1
+gpg-init-2
+guess-java7
+ide-eclipse
+ide-eclipse-websocket
+installer-sign
+javadoc
+package
+package-deployer-tgz
+package-deployer-zip
+package-docs-tgz
+package-java7
+package-src-jar
+package-src-jar-java7
+package-src-tgz
+package-src-zip
+package-tgz
+package-winzip
+package-zip
+release
+release-init
+setproxy
+sign
+test
+test-apr
+test-apr-exists
+test-bio
+test-compile
+test-init
+test-nio
+test-status
+testexist
+trydownload
+trydownload.check
+validate
+validate-eoln
diff --git a/java/org/apache/catalina/Authenticator.java b/java/org/apache/catalina/Authenticator.java
index c49850d..c310238 100644
--- a/java/org/apache/catalina/Authenticator.java
+++ b/java/org/apache/catalina/Authenticator.java
@@ -53,15 +53,18 @@ public interface Authenticator {
/**
* Authenticate the user making this request, based on the specified
- * login configuration. Return <code>true</code> if any specified
- * constraint has been satisfied, or <code>false</code> if we have
- * created a response challenge already.
+ * login configuration.
*
* @param request Request we are processing
* @param response Response we are populating
* @param config Login configuration describing how authentication
* should be performed
*
+ * @return <code>true</code> if any specified constraints have been
+ * satisfied, or <code>false</code> if one more constraints were not
+ * satisfied (in which case an authentication challenge will have
+ * been written to the response).
+ *
* @exception IOException if an input/output error occurs
*
* @deprecated Use {@link #authenticate(Request, HttpServletResponse)}.
diff --git a/java/org/apache/catalina/Contained.java b/java/org/apache/catalina/Contained.java
index a09808b..7288893 100644
--- a/java/org/apache/catalina/Contained.java
+++ b/java/org/apache/catalina/Contained.java
@@ -14,11 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina;
-
/**
* <p>Decoupling interface which specifies that an implementing class is
* associated with at most one <strong>Container</strong> instance.</p>
@@ -28,15 +25,13 @@ package org.apache.catalina;
*/
public interface Contained {
-
- //-------------------------------------------------------------- Properties
-
-
/**
- * Return the <code>Container</code> with which this instance is associated
- * (if any); otherwise return <code>null</code>.
+ * Get the {@link Container} with which this instance is associated.
+ *
+ * @return The Container with which this instance is associated or
+ * <code>null</code> if not associated with a Container
*/
- public Container getContainer();
+ Container getContainer();
/**
@@ -46,7 +41,5 @@ public interface Contained {
* be associated, or <code>null</code> to disassociate this instance
* from any Container
*/
- public void setContainer(Container container);
-
-
+ void setContainer(Container container);
}
diff --git a/java/org/apache/catalina/Valve.java b/java/org/apache/catalina/Valve.java
index bd52c63..89a17a2 100644
--- a/java/org/apache/catalina/Valve.java
+++ b/java/org/apache/catalina/Valve.java
@@ -14,11 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina;
-
import java.io.IOException;
import javax.servlet.ServletException;
@@ -27,7 +24,6 @@ import org.apache.catalina.comet.CometEvent;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-
/**
* <p>A <b>Valve</b> is a request processing component associated with a
* particular Container. A series of Valves are generally associated with
@@ -47,7 +43,6 @@ public interface Valve {
//-------------------------------------------------------------- Properties
-
/**
* Return descriptive information about this Valve implementation.
*/
@@ -55,7 +50,7 @@ public interface Valve {
/**
- * Return the next Valve in the pipeline containing this Valve, if any.
+ * @return the next Valve in the pipeline containing this Valve, if any.
*/
public Valve getNext();
@@ -146,6 +141,4 @@ public interface Valve {
public boolean isAsyncSupported();
-
-
}
diff --git a/java/org/apache/catalina/ant/BaseRedirectorHelperTask.java b/java/org/apache/catalina/ant/BaseRedirectorHelperTask.java
index 6423c0b..1a5b477 100644
--- a/java/org/apache/catalina/ant/BaseRedirectorHelperTask.java
+++ b/java/org/apache/catalina/ant/BaseRedirectorHelperTask.java
@@ -14,11 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina.ant;
-
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
@@ -30,17 +27,15 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Redirector;
import org.apache.tools.ant.types.RedirectorElement;
-
/**
- * Abstract base class to add output redirection support for Catalina
- * Ant tasks. These tasks require Ant 1.5 or later.
- * <br>
- * <strong>WARNING:</strong> due to depends chain, Ant could call a Task
- * more than once and this can affect the output redirection when configured.
- * If you are collecting the output in a property, it will collect the output
- * of only the first run, since Ant properties are immutable and once created
- * they cannot be changed.
+ * Abstract base class to add output redirection support for Catalina Ant tasks.
+ * These tasks require Ant 1.5 or later.
* <br>
+ * <strong>WARNING:</strong> due to depends chain, Ant could call a Task more
+ * than once and this can affect the output redirection when configured. If you
+ * are collecting the output in a property, it will collect the output of only
+ * the first run, since Ant properties are immutable and once created they
+ * cannot be changed. <br>
* If you are collecting output in a file the file will be overwritten with the
* output of the last run, unless you set append="true", in which case each run
* will append it's output to the file.
@@ -51,67 +46,72 @@ import org.apache.tools.ant.types.RedirectorElement;
*/
public abstract class BaseRedirectorHelperTask extends Task {
- // ------------------------------------------------------------- Properties
-
/** Redirector helper */
protected Redirector redirector = new Redirector(this);
- //protected Redirector redirector = null;
+
/** Redirector element for this task */
protected RedirectorElement redirectorElement = null;
+
/** The stream for info output */
protected OutputStream redirectOutStream = null;
+
/** The stream for error output */
protected OutputStream redirectErrStream = null;
+
/** The print stream for info output */
PrintStream redirectOutPrintStream = null;
+
/** The print stream for error output */
PrintStream redirectErrPrintStream = null;
- /**
- * Whether to fail (with a BuildException) if
- * ManagerServlet returns an error. The default behavior is
- * to do so.
- * <b>
- * This flag does not control parameters checking. If the task is called
- * with wrong or invalid parameters, it will throw BuildException
- * independently from the setting of this flag.
+ /**
+ * Whether to fail (with a BuildException) if ManagerServlet returns an
+ * error. The default behavior is to do so. <b> This flag does not control
+ * parameters checking. If the task is called with wrong or invalid
+ * parameters, it will throw BuildException independently from the setting
+ * of this flag. </b>
*/
protected boolean failOnError = true;
/**
- * <code>true</code> true when output redirection is requested for this task .
- * Default is to log on Ant log.
- */
+ * <code>true</code> true when output redirection is requested for this task.
+ * Default is to log on Ant log.
+ */
protected boolean redirectOutput = false;
/**
- * will be set to <code>true</code> when the configuration of the Redirector is
- * complete.
- */
+ * will be set to <code>true</code> when the configuration of the Redirector
+ * is complete.
+ */
protected boolean redirectorConfigured = false;
/**
- * Flag which indicates that, if redirected, output should also be
- * always sent to the log. Default is that output is sent only to
- * redirected streams.
+ * Flag which indicates that, if redirected, output should also be always
+ * sent to the log. Default is that output is sent only to redirected
+ * streams.
*/
protected boolean alwaysLog = false;
+
/**
- * Whether to fail (with a BuildException) if
- * ManagerServlet returns an error. The default behavior is
- * to do so.
+ * Whether to fail (with a BuildException) if ManagerServlet returns an
+ * error. The default behavior is to do so.
+ *
+ * @param fail The new value of failonerror
*/
public void setFailonerror(boolean fail) {
failOnError = fail;
}
+
/**
- * Returns the value of the failOnError
- * property.
+ * Returns the value of the failOnError property.
+ *
+ * @return <code>true</code> if the task should will if an error occurs,
+ * otherwise <code>false</code>
*/
public boolean isFailOnError() {
- return failOnError;
+ return failOnError;
}
@@ -125,6 +125,7 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutput = true;
}
+
/**
* File the error output of the task is redirected to.
*
@@ -136,22 +137,22 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutput = true;
}
+
/**
- * Controls whether error output is logged. This is only useful
- * when output is being redirected and error output is desired in the
- * Ant log
+ * Controls whether error output is logged. This is only useful when output
+ * is being redirected and error output is desired in the Ant log
*
* @param logError if true the standard error is sent to the Ant log system
- * and not sent to output stream.
+ * and not sent to output stream.
*/
public void setLogError(boolean logError) {
redirector.setLogError(logError);
redirectOutput = true;
}
+
/**
- * Property name whose value should be set to the output of
- * the task.
+ * Property name whose value should be set to the output of the task.
*
* @param outputProperty property name
*
@@ -161,9 +162,9 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutput = true;
}
+
/**
- * Property name whose value should be set to the error of
- * the task..
+ * Property name whose value should be set to the error of the task.
*
* @param errorProperty property name
*
@@ -173,6 +174,7 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutput = true;
}
+
/**
* If true, append output to existing file.
*
@@ -184,24 +186,27 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutput = true;
}
+
/**
- * If true, (error and non-error) output will be redirected
- * as specified while being sent to Ant's logging mechanism as if no
- * redirection had taken place. Defaults to false.
+ * If true, (error and non-error) output will be redirected as specified
+ * while being sent to Ant's logging mechanism as if no redirection had
+ * taken place. Defaults to false.
* <br>
- * Actually handled internally, with Ant 1.6.3 it will be handled by
- * the <code>Redirector</code> itself.
+ * Actually handled internally, with Ant 1.6.3 it will be handled by the
+ * <code>Redirector</code> itself.
+ *
* @param alwaysLog <code>boolean</code>
*/
public void setAlwaysLog(boolean alwaysLog) {
this.alwaysLog = alwaysLog;
- //redirector.setAlwaysLog(alwaysLog);
redirectOutput = true;
}
+
/**
* Whether output and error files should be created even when empty.
* Defaults to true.
+ *
* @param createEmptyFiles <CODE>boolean</CODE>.
*/
public void setCreateEmptyFiles(boolean createEmptyFiles) {
@@ -209,9 +214,11 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutput = true;
}
+
/**
* Add a <CODE>RedirectorElement</CODE> to this task.
- * @param redirectorElement <CODE>RedirectorElement</CODE>.
+ *
+ * @param redirectorElement <CODE>RedirectorElement</CODE>.
*/
public void addConfiguredRedirector(RedirectorElement redirectorElement) {
if (this.redirectorElement != null) {
@@ -221,6 +228,7 @@ public abstract class BaseRedirectorHelperTask extends Task {
}
}
+
/**
* Set up properties on the Redirector from RedirectorElement if present.
*/
@@ -230,18 +238,19 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutput = true;
}
/*
- * Due to depends chain, Ant could call the Task more than once,
- * this is to prevent that we attempt to configure uselessly
- * more than once the Redirector.
+ * Due to depends chain, Ant could call the Task more than once, this is
+ * to prevent that we attempt to configure uselessly more than once the
+ * Redirector.
*/
redirectorConfigured = true;
}
+
/**
* Set up properties on the Redirector and create output streams.
*/
protected void openRedirector() {
- if (! redirectorConfigured) {
+ if (!redirectorConfigured) {
configureRedirector();
}
if (redirectOutput) {
@@ -251,13 +260,14 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectErrStream = redirector.getErrorStream();
redirectErrPrintStream = new PrintStream(redirectErrStream);
}
- }
+ }
+
/**
- * Ask redirector to close all the streams. It is necessary to call this method
- * before leaving the Task to have the Streams flush their contents. If you are
- * collecting output in a property, it will be created only if this method is
- * called, otherwise you'll find it unset.
+ * Ask redirector to close all the streams. It is necessary to call this
+ * method before leaving the Task to have the Streams flush their contents.
+ * If you are collecting output in a property, it will be created only if
+ * this method is called, otherwise you'll find it unset.
*/
protected void closeRedirector() {
try {
@@ -265,13 +275,11 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirector.complete();
}
} catch (IOException ioe) {
- log("Error closing redirector: "
- + ioe.getMessage(), Project.MSG_ERR);
+ log("Error closing redirector: " + ioe.getMessage(), Project.MSG_ERR);
}
/*
- * Due to depends chain, Ant could call the Task more than once,
- * this is to prevent that we attempt to reuse the previously
- * closed Streams.
+ * Due to depends chain, Ant could call the Task more than once, this is
+ * to prevent that we attempt to reuse the previously closed Streams.
*/
redirectOutStream = null;
redirectOutPrintStream = null;
@@ -279,6 +287,7 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectErrPrintStream = null;
}
+
/**
* Handles output with the INFO priority.
*
@@ -299,6 +308,7 @@ public abstract class BaseRedirectorHelperTask extends Task {
}
}
+
/**
* Handles output with the INFO priority and flushes the stream.
*
@@ -311,6 +321,7 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectOutPrintStream.flush();
}
+
/**
* Handles error output with the ERR priority.
*
@@ -331,6 +342,7 @@ public abstract class BaseRedirectorHelperTask extends Task {
}
}
+
/**
* Handles error output with the ERR priority and flushes the stream.
*
@@ -343,11 +355,13 @@ public abstract class BaseRedirectorHelperTask extends Task {
redirectErrPrintStream.flush();
}
+
/**
- * Handles output with ERR priority to error stream and all other
- * priorities to output stream.
+ * Handles output with ERR priority to error stream and all other priorities
+ * to output stream.
*
* @param output The output to log. Should not be <code>null</code>.
+ * @param priority The priority level that should be used
*/
protected void handleOutput(String output, int priority) {
if (priority == Project.MSG_ERR) {
diff --git a/java/org/apache/catalina/ant/FindLeaksTask.java b/java/org/apache/catalina/ant/FindLeaksTask.java
index 2db6aad..4be0996 100644
--- a/java/org/apache/catalina/ant/FindLeaksTask.java
+++ b/java/org/apache/catalina/ant/FindLeaksTask.java
@@ -29,6 +29,8 @@ public class FindLeaksTask extends AbstractCatalinaTask {
/**
* Sets the statusLine parameter that controls if the response includes a
* status line or not.
+ *
+ * @param statusLine <code>true</code> if the status line should be included
*/
public void setStatusLine(boolean statusLine) {
this.statusLine = statusLine;
@@ -37,11 +39,15 @@ public class FindLeaksTask extends AbstractCatalinaTask {
/**
* Returns the statusLine parameter that controls if the response includes a
* status line or not.
+ *
+ * @return <code>true</code> if the status line should be included,
+ * otherwise <code>false</code>
*/
public boolean getStatusLine() {
return statusLine;
}
+
/**
* Execute the requested operation.
*
@@ -49,9 +55,7 @@ public class FindLeaksTask extends AbstractCatalinaTask {
*/
@Override
public void execute() throws BuildException {
-
super.execute();
execute("/findleaks?statusLine=" + Boolean.toString(statusLine));
}
-
}
diff --git a/java/org/apache/catalina/ant/JMXQueryTask.java b/java/org/apache/catalina/ant/JMXQueryTask.java
index d2e1c71..9757603 100644
--- a/java/org/apache/catalina/ant/JMXQueryTask.java
+++ b/java/org/apache/catalina/ant/JMXQueryTask.java
@@ -53,14 +53,13 @@ public class JMXQueryTask extends AbstractCatalinaTask {
/**
* Set method for the JMX query string.
- * <P>Examples of query format:
+ * <p>Examples of query format:</p>
* <UL>
* <LI>*:*</LI>
* <LI>*:type=RequestProcessor,*</LI>
* <LI>*:j2eeType=Servlet,*</LI>
* <LI>Catalina:type=Environment,resourcetype=Global,name=simpleValue</LI>
* </UL>
- * </P>
* @param query JMX Query string
*/
public void setQuery (String query) {
diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index fd09be5..5df2711 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -261,7 +261,10 @@ public class Connector extends LifecycleMBeanBase {
// ------------------------------------------------------------- Properties
/**
- * Return a configured property.
+ * Return a property from the protocol handler.
+ *
+ * @param name the property name
+ * @return the property value
*/
public Object getProperty(String name) {
String repl = name;
@@ -273,7 +276,11 @@ public class Connector extends LifecycleMBeanBase {
/**
- * Set a configured property.
+ * Set a property on the protocol handler.
+ *
+ * @param name the property name
+ * @param value the property value
+ * @return <code>true</code> if the property was successfully set
*/
public boolean setProperty(String name, String value) {
String repl = name;
@@ -283,8 +290,12 @@ public class Connector extends LifecycleMBeanBase {
return IntrospectionUtils.setProperty(protocolHandler, repl, value);
}
+
/**
- * Return a configured property.
+ * Return a property from the protocol handler.
+ *
+ * @param name the property name
+ * @return the property value
*/
public Object getAttribute(String name) {
return getProperty(name);
@@ -292,7 +303,10 @@ public class Connector extends LifecycleMBeanBase {
/**
- * Set a configured property.
+ * Set a property on the protocol handler.
+ *
+ * @param name the property name
+ * @param value the property value
*/
public void setAttribute(String name, Object value) {
setProperty(name, String.valueOf(value));
@@ -300,12 +314,10 @@ public class Connector extends LifecycleMBeanBase {
/**
- * Return the <code>Service</code> with which we are associated (if any).
+ * @return the <code>Service</code> with which we are associated (if any).
*/
public Service getService() {
-
- return (this.service);
-
+ return this.service;
}
@@ -315,19 +327,16 @@ public class Connector extends LifecycleMBeanBase {
* @param service The service that owns this Engine
*/
public void setService(Service service) {
-
this.service = service;
-
}
/**
- * True if the TRACE method is allowed. Default value is "false".
+ * @return <code>true</code> if the TRACE method is allowed. Default value
+ * is <code>false</code>.
*/
public boolean getAllowTrace() {
-
- return (this.allowTrace);
-
+ return this.allowTrace;
}
@@ -337,20 +346,16 @@ public class Connector extends LifecycleMBeanBase {
* @param allowTrace The new allowTrace flag
*/
public void setAllowTrace(boolean allowTrace) {
-
this.allowTrace = allowTrace;
setProperty("allowTrace", String.valueOf(allowTrace));
-
}
/**
- * Return the default timeout for async requests in ms.
+ * @return the default timeout for async requests in ms.
*/
public long getAsyncTimeout() {
-
return asyncTimeout;
-
}
@@ -360,20 +365,16 @@ public class Connector extends LifecycleMBeanBase {
* @param asyncTimeout The new timeout in ms.
*/
public void setAsyncTimeout(long asyncTimeout) {
-
this.asyncTimeout= asyncTimeout;
setProperty("asyncTimeout", String.valueOf(asyncTimeout));
-
}
/**
- * Return the "enable DNS lookups" flag.
+ * @return the "enable DNS lookups" flag.
*/
public boolean getEnableLookups() {
-
- return (this.enableLookups);
-
+ return this.enableLookups;
}
@@ -383,10 +384,8 @@ public class Connector extends LifecycleMBeanBase {
* @param enableLookups The new "enable DNS lookups" flag value
*/
public void setEnableLookups(boolean enableLookups) {
-
this.enableLookups = enableLookups;
setProperty("enableLookups", String.valueOf(enableLookups));
-
}
@@ -427,7 +426,7 @@ public class Connector extends LifecycleMBeanBase {
}
/**
- * Return the maximum number of parameters (GET plus POST) that will be
+ * @return the maximum number of parameters (GET plus POST) that will be
* automatically parsed by the container. A value of less than 0 means no
* limit.
*/
@@ -449,13 +448,11 @@ public class Connector extends LifecycleMBeanBase {
/**
- * Return the maximum size of a POST which will be automatically
+ * @return the maximum size of a POST which will be automatically
* parsed by the container.
*/
public int getMaxPostSize() {
-
- return (maxPostSize);
-
+ return maxPostSize;
}
@@ -467,19 +464,16 @@ public class Connector extends LifecycleMBeanBase {
* be automatically parsed by the container
*/
public void setMaxPostSize(int maxPostSize) {
-
this.maxPostSize = maxPostSize;
}
/**
- * Return the maximum size of a POST which will be saved by the container
+ * @return the maximum size of a POST which will be saved by the container
* during authentication.
*/
public int getMaxSavePostSize() {
-
- return (maxSavePostSize);
-
+ return maxSavePostSize;
}
@@ -491,27 +485,34 @@ public class Connector extends LifecycleMBeanBase {
* be saved by the container during authentication.
*/
public void setMaxSavePostSize(int maxSavePostSize) {
-
this.maxSavePostSize = maxSavePostSize;
setProperty("maxSavePostSize", String.valueOf(maxSavePostSize));
}
+ /**
+ * @return the HTTP methods which will support body parameters parsing
+ */
public String getParseBodyMethods() {
-
return this.parseBodyMethods;
-
}
+
+ /**
+ * Set list of HTTP methods which should allow body parameter
+ * parsing. This defaults to <code>POST</code>.
+ *
+ * @param methods Comma separated list of HTTP method names
+ */
public void setParseBodyMethods(String methods) {
HashSet<String> methodSet = new HashSet<String>();
- if( null != methods ) {
+ if (null != methods) {
methodSet.addAll(Arrays.asList(methods.split("\\s*,\\s*")));
}
- if( methodSet.contains("TRACE") ) {
+ if (methodSet.contains("TRACE")) {
throw new IllegalArgumentException(sm.getString("coyoteConnector.parseBodyMethodNoTrace"));
}
@@ -520,21 +521,19 @@ public class Connector extends LifecycleMBeanBase {
}
- protected boolean isParseBodyMethod(String method) {
+ protected boolean isParseBodyMethod(String method) {
return parseBodyMethodsSet.contains(method);
-
}
+
/**
- * Return the port number on which this connector is configured to listen
+ * @return the port number on which this connector is configured to listen
* for requests. The special value of 0 means select a random free port
* when the socket is bound.
*/
public int getPort() {
-
- return (this.port);
-
+ return this.port;
}
@@ -544,16 +543,14 @@ public class Connector extends LifecycleMBeanBase {
* @param port The new port number
*/
public void setPort(int port) {
-
this.port = port;
setProperty("port", String.valueOf(port));
-
}
/**
- * Return the port number on which this connector is listening to requests.
- * If the special value for {@link #port} of zero is used then this method
+ * @return the port number on which this connector is listening to requests.
+ * If the special value for {@link #getPort} of zero is used then this method
* will report the actual port bound.
*/
public int getLocalPort() {
@@ -562,7 +559,7 @@ public class Connector extends LifecycleMBeanBase {
/**
- * Return the Coyote protocol handler in use.
+ * @return the Coyote protocol handler in use.
*/
public String getProtocol() {
@@ -578,7 +575,6 @@ public class Connector extends LifecycleMBeanBase {
return "AJP/1.3";
}
return getProtocolHandlerClassName();
-
}
@@ -618,12 +614,10 @@ public class Connector extends LifecycleMBeanBase {
/**
- * Return the class name of the Coyote protocol handler in use.
+ * @return the class name of the Coyote protocol handler in use.
*/
public String getProtocolHandlerClassName() {
-
- return (this.protocolHandlerClassName);
-
+ return this.protocolHandlerClassName;
}
@@ -641,22 +635,18 @@ public class Connector extends LifecycleMBeanBase {
/**
- * Return the protocol handler associated with the connector.
+ * @return the protocol handler associated with the connector.
*/
public ProtocolHandler getProtocolHandler() {
-
- return (this.protocolHandler);
-
+ return this.protocolHandler;
}
/**
- * Return the proxy server name for this Connector.
+ * @return the proxy server name for this Connector.
*/
public String getProxyName() {
-
- return (this.proxyName);
-
+ return this.proxyName;
}
@@ -669,21 +659,18 @@ public class Connector extends LifecycleMBeanBase {
if(proxyName != null && proxyName.length() > 0) {
this.proxyName = proxyName;
- setProperty("proxyName", proxyName);
} else {
this.proxyName = null;
}
-
+ setProperty("proxyName", this.proxyName);
}
/**
- * Return the proxy server port for this Connector.
+ * @return the proxy server port for this Connector.
*/
public int getProxyPort() {
-
- return (this.proxyPort);
-
+ return this.proxyPort;
}
@@ -693,22 +680,18 @@ public class Connector extends LifecycleMBeanBase {
* @param proxyPort The new proxy server port
*/
public void setProxyPort(int proxyPort) {
-
this.proxyPort = proxyPort;
setProperty("proxyPort", String.valueOf(proxyPort));
-
}
/**
- * Return the port number to which a request should be redirected if
+ * @return the port number to which a request should be redirected if
* it comes in on a non-SSL port and is subject to a security constraint
* with a transport guarantee that requires SSL.
*/
public int getRedirectPort() {
-
- return (this.redirectPort);
-
+ return this.redirectPort;
}
@@ -718,21 +701,17 @@ public class Connector extends LifecycleMBeanBase {
* @param redirectPort The redirect port number (non-SSL to SSL)
*/
public void setRedirectPort(int redirectPort) {
-
this.redirectPort = redirectPort;
setProperty("redirectPort", String.valueOf(redirectPort));
-
}
/**
- * Return the scheme that will be assigned to requests received
+ * @return the scheme that will be assigned to requests received
* through this connector. Default value is "http".
*/
public String getScheme() {
-
- return (this.scheme);
-
+ return this.scheme;
}
@@ -743,20 +722,16 @@ public class Connector extends LifecycleMBeanBase {
* @param scheme The new scheme
*/
public void setScheme(String scheme) {
-
this.scheme = scheme;
-
}
/**
- * Return the secure connection flag that will be assigned to requests
+ * @return the secure connection flag that will be assigned to requests
* received through this connector. Default value is "false".
*/
public boolean getSecure() {
-
- return (this.secure);
-
+ return this.secure;
}
@@ -767,18 +742,17 @@ public class Connector extends LifecycleMBeanBase {
* @param secure The new secure connection flag
*/
public void setSecure(boolean secure) {
-
this.secure = secure;
setProperty("secure", Boolean.toString(secure));
}
+
/**
- * Return the character encoding to be used for the URI.
+ * @return the name of character encoding to be used for the URI using the
+ * original case.
*/
public String getURIEncoding() {
-
- return (this.URIEncoding);
-
+ return this.URIEncoding;
}
@@ -788,20 +762,16 @@ public class Connector extends LifecycleMBeanBase {
* @param URIEncoding The new URI character encoding.
*/
public void setURIEncoding(String URIEncoding) {
-
this.URIEncoding = URIEncoding;
setProperty("uRIEncoding", URIEncoding);
-
}
/**
- * Return the true if the entity body encoding should be used for the URI.
+ * @return the true if the entity body encoding should be used for the URI.
*/
public boolean getUseBodyEncodingForURI() {
-
- return (this.useBodyEncodingForURI);
-
+ return this.useBodyEncodingForURI;
}
@@ -811,18 +781,15 @@ public class Connector extends LifecycleMBeanBase {
* @param useBodyEncodingForURI The new value for the flag.
*/
public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) {
-
this.useBodyEncodingForURI = useBodyEncodingForURI;
- setProperty
- ("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
-
+ setProperty("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
}
/**
* Indicates whether the generation of an X-Powered-By response header for
- * servlet-generated responses is enabled or disabled for this Connector.
+ * Servlet-generated responses is enabled or disabled for this Connector.
*
- * @return true if generation of X-Powered-By response header is enabled,
+ * @return <code>true</code> if generation of X-Powered-By response header is enabled,
* false otherwise
*/
public boolean getXpoweredBy() {
@@ -843,19 +810,23 @@ public class Connector extends LifecycleMBeanBase {
setProperty("xpoweredBy", String.valueOf(xpoweredBy));
}
+
/**
* Enable the use of IP-based virtual hosting.
*
* @param useIPVHosts <code>true</code> if Hosts are identified by IP,
- * <code>false/code> if Hosts are identified by name.
+ * <code>false</code> if Hosts are identified by name.
*/
public void setUseIPVHosts(boolean useIPVHosts) {
this.useIPVHosts = useIPVHosts;
setProperty("useIPVHosts", String.valueOf(useIPVHosts));
}
+
/**
* Test if IP-based virtual hosting is enabled.
+ *
+ * @return <code>true</code> if IP vhosts are enabled
*/
public boolean getUseIPVHosts() {
return useIPVHosts;
@@ -870,12 +841,14 @@ public class Connector extends LifecycleMBeanBase {
return "Internal";
}
- // --------------------------------------------------------- Public Methods
+ // --------------------------------------------------------- Public Methods
/**
* Create (or allocate) and return a Request object suitable for
* specifying the contents of a Request to the responsible Container.
+ *
+ * @return a new Servlet request object
*/
public Request createRequest() {
@@ -889,6 +862,8 @@ public class Connector extends LifecycleMBeanBase {
/**
* Create (or allocate) and return a Response object suitable for
* receiving the contents of a Response from the responsible Container.
+ *
+ * @return a new Servlet response object
*/
public Response createResponse() {
@@ -934,21 +909,19 @@ public class Connector extends LifecycleMBeanBase {
try {
protocolHandler.pause();
} catch (Exception e) {
- log.error(sm.getString
- ("coyoteConnector.protocolHandlerPauseFailed"), e);
+ log.error(sm.getString("coyoteConnector.protocolHandlerPauseFailed"), e);
}
}
/**
- * Pause the connector.
+ * Resume the connector.
*/
public void resume() {
try {
protocolHandler.resume();
} catch (Exception e) {
- log.error(sm.getString
- ("coyoteConnector.protocolHandlerResumeFailed"), e);
+ log.error(sm.getString("coyoteConnector.protocolHandlerResumeFailed"), e);
}
}
@@ -963,7 +936,7 @@ public class Connector extends LifecycleMBeanBase {
protocolHandler.setAdapter(adapter);
// Make sure parseBodyMethodsSet has a default
- if( null == parseBodyMethodsSet ) {
+ if (null == parseBodyMethodsSet) {
setParseBodyMethods(getParseBodyMethods());
}
@@ -977,9 +950,8 @@ public class Connector extends LifecycleMBeanBase {
try {
protocolHandler.init();
} catch (Exception e) {
- throw new LifecycleException
- (sm.getString
- ("coyoteConnector.protocolHandlerInitializationFailed"), e);
+ throw new LifecycleException(
+ sm.getString("coyoteConnector.protocolHandlerInitializationFailed"), e);
}
// Initialize mapper listener
@@ -1033,9 +1005,8 @@ public class Connector extends LifecycleMBeanBase {
try {
protocolHandler.stop();
} catch (Exception e) {
- throw new LifecycleException
- (sm.getString
- ("coyoteConnector.protocolHandlerStopFailed"), e);
+ throw new LifecycleException(
+ sm.getString("coyoteConnector.protocolHandlerStopFailed"), e);
}
mapperListener.stop();
@@ -1049,9 +1020,8 @@ public class Connector extends LifecycleMBeanBase {
try {
protocolHandler.destroy();
} catch (Exception e) {
- throw new LifecycleException
- (sm.getString
- ("coyoteConnector.protocolHandlerDestroyFailed"), e);
+ throw new LifecycleException(
+ sm.getString("coyoteConnector.protocolHandlerDestroyFailed"), e);
}
if (getService() != null) {
diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 3813073..724eaa3 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -677,8 +677,9 @@ public class CoyoteAdapter implements Adapter {
*
* @throws IOException If there is insufficient space in a buffer while
* processing headers
- * @throws ServletException If the supported methods of the target servlet
- * cannot be determined
+ * @throws javax.servlet.ServletException
+ If the supported methods of the target servlet
+ * cannot be determined
*/
protected boolean postParseRequest(org.apache.coyote.Request req, Request request,
org.apache.coyote.Response res, Response response) throws Exception {
diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index b24ed31..b86d38a 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -14,8 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina.loader;
import java.io.ByteArrayInputStream;
@@ -222,7 +220,6 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
// ------------------------------------------------------- Static Variables
-
/**
* The set of trigger classes that will cause a proposed repository not
* to be added if this class is visible to the class loader that loaded
@@ -250,8 +247,8 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
*/
boolean antiJARLocking = false;
- // ----------------------------------------------------------- Constructors
+ // ----------------------------------------------------------- Constructors
/**
* Construct a new ClassLoader with no defined repositories and no
@@ -320,7 +317,6 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
// ----------------------------------------------------- Instance Variables
-
/**
* Associated directory context giving access to the resources in this
* webapp.
@@ -480,7 +476,7 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
/**
* The bootstrap class loader used to load the JavaSE classes. In some
- * implementations this class loader is always <code>null</null> and in
+ * implementations this class loader is always <code>null</code> and in
* those cases {@link ClassLoader#getParent()} will be called recursively on
* the system class loader and the last non-null result used.
*/
diff --git a/java/org/apache/catalina/manager/JspHelper.java b/java/org/apache/catalina/manager/JspHelper.java
index d9095ea..197618f 100644
--- a/java/org/apache/catalina/manager/JspHelper.java
+++ b/java/org/apache/catalina/manager/JspHelper.java
@@ -45,8 +45,11 @@ public class JspHelper {
/**
* Try to get user locale from the session, if possible.
- * IMPLEMENTATION NOTE: this method has explicit support for Tapestry 3 and Struts 1.x
- * @param in_session
+ * IMPLEMENTATION NOTE: this method has explicit support for Tapestry 3 and
+ * Struts 1.x
+ *
+ * @param in_session Session from which the locale should be guessed
+ *
* @return String
*/
public static String guessDisplayLocaleFromSession(Session in_session) {
@@ -62,8 +65,8 @@ public class JspHelper {
/**
* Try to get user name from the session, if possible.
- * @param in_session
- * @return String
+ * @param in_session The Servlet session
+ * @return the user name
*/
public static String guessDisplayUserFromSession(Session in_session) {
Object user = SessionUtils.guessUserFromSession(in_session);
@@ -168,7 +171,8 @@ public class JspHelper {
*/
private static final int HIGHEST_SPECIAL = '>';
- private static char[][] specialCharactersRepresentation = new char[HIGHEST_SPECIAL + 1][];
+ private static final char[][] specialCharactersRepresentation =
+ new char[HIGHEST_SPECIAL + 1][];
static {
specialCharactersRepresentation['&'] = "&".toCharArray();
specialCharactersRepresentation['<'] = "<".toCharArray();
@@ -191,13 +195,15 @@ public class JspHelper {
* Performs the following substring replacements
* (to facilitate output to XML/HTML pages):
*
- * & -> &
- * < -> <
- * > -> >
- * " -> "
- * ' -> '
+ * & -> &amp;
+ * < -> &lt;
+ * > -> &gt;
+ * " -> &#034;
+ * ' -> &#039;
*
* See also OutSupport.writeEscapedXml().
+ * @param buffer The XML to escape
+ * @return the escaped XML
*/
@SuppressWarnings("null") // escapedBuffer cannot be null
public static String escapeXml(String buffer) {
diff --git a/java/org/apache/catalina/realm/GenericPrincipal.java b/java/org/apache/catalina/realm/GenericPrincipal.java
index cec6692..706daeb 100644
--- a/java/org/apache/catalina/realm/GenericPrincipal.java
+++ b/java/org/apache/catalina/realm/GenericPrincipal.java
@@ -14,8 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina.realm;
@@ -27,7 +25,6 @@ import javax.security.auth.login.LoginContext;
import org.ietf.jgss.GSSCredential;
-
/**
* Generic implementation of <strong>java.security.Principal</strong> that
* is available for use by <code>Realm</code> implementations.
@@ -116,7 +113,7 @@ public class GenericPrincipal implements Principal {
* getUserPrincipal call if not null; if null, this will be returned
* @param loginContext - If provided, this will be used to log out the user
* at the appropriate time
- * @param gssCredential - If provided, the user's delegated credentials
+ * @param gssCredential - If provided, the user's delegated credentials
*/
public GenericPrincipal(String name, String password, List<String> roles,
Principal userPrincipal, LoginContext loginContext,
@@ -136,8 +133,7 @@ public class GenericPrincipal implements Principal {
}
- // ------------------------------------------------------------- Properties
-
+ // -------------------------------------------------------------- Properties
/**
* The username of the user represented by this Principal.
@@ -146,7 +142,7 @@ public class GenericPrincipal implements Principal {
@Override
public String getName() {
- return (this.name);
+ return this.name;
}
@@ -157,7 +153,7 @@ public class GenericPrincipal implements Principal {
protected String password = null;
public String getPassword() {
- return (this.password);
+ return this.password;
}
@@ -167,7 +163,7 @@ public class GenericPrincipal implements Principal {
protected String roles[] = new String[0];
public String[] getRoles() {
- return (this.roles);
+ return this.roles;
}
@@ -193,7 +189,7 @@ public class GenericPrincipal implements Principal {
/**
- * The user's delegated credentials.
+ * The user's delegated credentials.
*/
protected GSSCredential gssCredential = null;
@@ -204,22 +200,25 @@ public class GenericPrincipal implements Principal {
this.gssCredential = gssCredential;
}
- // --------------------------------------------------------- Public Methods
+ // ---------------------------------------------------------- Public Methods
/**
* Does the user represented by this Principal possess the specified role?
*
* @param role Role to be tested
+ *
+ * @return <code>true</code> if this Principal has been assigned the given
+ * role, otherwise <code>false</code>
*/
public boolean hasRole(String role) {
-
- if("*".equals(role)) // Special 2.4 role meaning everyone
+ if ("*".equals(role)) { // Special 2.4 role meaning everyone
return true;
- if (role == null)
- return (false);
- return (Arrays.binarySearch(roles, role) >= 0);
-
+ }
+ if (role == null) {
+ return false;
+ }
+ return Arrays.binarySearch(roles, role) >= 0;
}
@@ -229,16 +228,14 @@ public class GenericPrincipal implements Principal {
*/
@Override
public String toString() {
-
StringBuilder sb = new StringBuilder("GenericPrincipal[");
sb.append(this.name);
sb.append("(");
- for( int i=0;i<roles.length; i++ ) {
+ for (int i = 0; i < roles.length; i++ ) {
sb.append( roles[i]).append(",");
}
sb.append(")]");
- return (sb.toString());
-
+ return sb.toString();
}
@@ -250,7 +247,6 @@ public class GenericPrincipal implements Principal {
* to allow for future expansion of this method to cover
* other logout mechanisms that might throw a different
* exception to LoginContext
- *
*/
public void logout() throws Exception {
if (loginContext != null) {
diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java
index 1b83276..e5104b6 100644
--- a/java/org/apache/catalina/realm/JNDIRealm.java
+++ b/java/org/apache/catalina/realm/JNDIRealm.java
@@ -17,6 +17,7 @@
package org.apache.catalina.realm;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.KeyManagementException;
@@ -28,7 +29,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -75,7 +75,7 @@ import org.ietf.jgss.GSSCredential;
* element in the top level <code>DirContext</code> that is accessed
* via the <code>connectionURL</code> property.</li>
*
- * <li>If a socket connection can not be made to the <code>connectURL</code>
+ * <li>If a socket connection cannot be made to the <code>connectURL</code>
* an attempt will be made to use the <code>alternateURL</code> if it
* exists.</li>
*
@@ -523,7 +523,7 @@ public class JNDIRealm extends RealmBase {
}
/**
- * Return the type of authentication to use.
+ * @return the type of authentication to use.
*/
public String getAuthentication() {
@@ -543,7 +543,7 @@ public class JNDIRealm extends RealmBase {
}
/**
- * Return the connection username for this Realm.
+ * @return the connection username for this Realm.
*/
public String getConnectionName() {
@@ -565,7 +565,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the connection password for this Realm.
+ * @return the connection password for this Realm.
*/
public String getConnectionPassword() {
@@ -587,7 +587,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the connection URL for this Realm.
+ * @return the connection URL for this Realm.
*/
public String getConnectionURL() {
@@ -609,7 +609,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the JNDI context factory for this Realm.
+ * @return the JNDI context factory for this Realm.
*/
public String getContextFactory() {
@@ -630,7 +630,7 @@ public class JNDIRealm extends RealmBase {
}
/**
- * Return the derefAliases setting to be used.
+ * @return the derefAliases setting to be used.
*/
public java.lang.String getDerefAliases() {
return derefAliases;
@@ -646,7 +646,7 @@ public class JNDIRealm extends RealmBase {
}
/**
- * Return the protocol to be used.
+ * @return the protocol to be used.
*/
public String getProtocol() {
@@ -667,7 +667,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Returns the current settings for handling PartialResultExceptions
+ * @return the current settings for handling PartialResultExceptions
*/
public boolean getAdCompat () {
return adCompat;
@@ -677,6 +677,7 @@ public class JNDIRealm extends RealmBase {
/**
* How do we handle PartialResultExceptions?
* True: ignore all PartialResultExceptions.
+ * @param adCompat <code>true</code> to ignore partial results
*/
public void setAdCompat (boolean adCompat) {
this.adCompat = adCompat;
@@ -684,7 +685,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Returns the current settings for handling JNDI referrals.
+ * @return the current settings for handling JNDI referrals.
*/
public String getReferrals () {
return referrals;
@@ -694,6 +695,7 @@ public class JNDIRealm extends RealmBase {
/**
* How do we handle JNDI referrals? ignore, follow, or throw
* (see javax.naming.Context.REFERRAL for more information).
+ * @param referrals The referral handling
*/
public void setReferrals (String referrals) {
this.referrals = referrals;
@@ -701,7 +703,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the base element for user searches.
+ * @return the base element for user searches.
*/
public String getUserBase() {
@@ -723,7 +725,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the message format pattern for selecting users in this Realm.
+ * @return the message format pattern for selecting users in this Realm.
*/
public String getUserSearch() {
@@ -759,7 +761,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the "search subtree for users" flag.
+ * @return the "search subtree for users" flag.
*/
public boolean getUserSubtree() {
@@ -781,7 +783,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the user role name attribute name for this Realm.
+ * @return the user role name attribute name for this Realm.
*/
public String getUserRoleName() {
@@ -802,7 +804,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the base element for role searches.
+ * @return the base element for role searches.
*/
public String getRoleBase() {
@@ -828,7 +830,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the role name attribute name for this Realm.
+ * @return the role name attribute name for this Realm.
*/
public String getRoleName() {
@@ -850,7 +852,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the message format pattern for selecting roles in this Realm.
+ * @return the message format pattern for selecting roles in this Realm.
*/
public String getRoleSearch() {
@@ -886,7 +888,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the "search subtree for roles" flag.
+ * @return the "search subtree for roles" flag.
*/
public boolean getRoleSubtree() {
@@ -907,7 +909,7 @@ public class JNDIRealm extends RealmBase {
}
/**
- * Return the "The nested group search flag" flag.
+ * @return the "The nested group search flag" flag.
*/
public boolean getRoleNested() {
@@ -929,7 +931,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the password attribute used to retrieve the user password.
+ * @return the password attribute used to retrieve the user password.
*/
public String getUserPassword() {
@@ -959,7 +961,7 @@ public class JNDIRealm extends RealmBase {
}
/**
- * Return the message format pattern for selecting users in this Realm.
+ * @return the message format pattern for selecting users in this Realm.
*/
public String getUserPattern() {
@@ -976,7 +978,7 @@ public class JNDIRealm extends RealmBase {
* separated by parentheses. (for example, either "cn={0}", or
* "(cn={0})(cn={0},o=myorg)" Full LDAP search strings are also supported,
* but only the "OR", "|" syntax, so "(|(cn={0})(cn={0},o=myorg))" is
- * also valid. Complex search strings with &, etc are NOT supported.
+ * also valid. Complex search strings with &, etc are NOT supported.
*
* @param userPattern The new user pattern
*/
@@ -1022,7 +1024,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the common role
+ * @return the common role
*/
public String getCommonRole() {
@@ -1044,7 +1046,7 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the connection timeout.
+ * @return the connection timeout.
*/
public String getConnectionTimeout() {
@@ -1167,7 +1169,7 @@ public class JNDIRealm extends RealmBase {
} else {
this.cipherSuitesArray = cipherSuites.trim().split("\\s*,\\s*");
containerLog.debug(sm.getString("jndiRealm.cipherSuites",
- Arrays.asList(this.cipherSuitesArray)));
+ Arrays.toString(this.cipherSuitesArray)));
}
return this.cipherSuitesArray;
}
@@ -1249,6 +1251,18 @@ public class JNDIRealm extends RealmBase {
throw new IllegalArgumentException(sm.getString(
"jndiRealm.invalidHostnameVerifier",
hostNameVerifierClassName), e);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException(sm.getString(
+ "jndiRealm.invalidHostnameVerifier",
+ hostNameVerifierClassName), e);
+ } catch (InvocationTargetException e) {
+ throw new IllegalArgumentException(sm.getString(
+ "jndiRealm.invalidHostnameVerifier",
+ hostNameVerifierClassName), e);
+ } catch (NoSuchMethodException e) {
+ throw new IllegalArgumentException(sm.getString(
+ "jndiRealm.invalidHostnameVerifier",
+ hostNameVerifierClassName), e);
}
}
@@ -1290,9 +1304,9 @@ public class JNDIRealm extends RealmBase {
private Object constructInstance(String className)
throws ClassNotFoundException, InstantiationException,
- IllegalAccessException {
+ IllegalAccessException, IllegalArgumentException, SecurityException, InvocationTargetException, NoSuchMethodException {
Class<?> clazz = Class.forName(className);
- return clazz.newInstance();
+ return clazz.getConstructor().newInstance();
}
// ---------------------------------------------------------- Realm Methods
@@ -1309,6 +1323,7 @@ public class JNDIRealm extends RealmBase {
* @param username Username of the Principal to look up
* @param credentials Password or other credentials to use in
* authenticating this username
+ * @return the associated principal, or <code>null</code> if there is none.
*/
@Override
public Principal authenticate(String username, String credentials) {
@@ -1321,7 +1336,7 @@ public class JNDIRealm extends RealmBase {
// Ensure that we have a directory context available
context = open();
- // Occassionally the directory context will timeout. Try one more
+ // Occasionally the directory context will timeout. Try one more
// time before giving up.
try {
@@ -1412,6 +1427,7 @@ public class JNDIRealm extends RealmBase {
* @param username Username of the Principal to look up
* @param credentials Password or other credentials to use in
* authenticating this username
+ * @return the associated principal, or <code>null</code> if there is none.
*
* @exception NamingException if a directory server error occurs
*/
@@ -1440,15 +1456,9 @@ public class JNDIRealm extends RealmBase {
// Search for additional roles
List<String> roles = getRoles(context, user);
if (containerLog.isDebugEnabled()) {
- Iterator<String> it = roles.iterator();
- // TODO: Use a single log message
- while (it.hasNext()) {
- containerLog.debug("Found role: " + it.next());
- }
+ containerLog.debug("Found roles: " + roles.toString());
}
- return (new GenericPrincipal(username,
- credentials,
- roles));
+ return new GenericPrincipal(username, credentials, roles);
}
} catch (InvalidNameException ine) {
// Log the problem for posterity
@@ -1474,11 +1484,7 @@ public class JNDIRealm extends RealmBase {
// Search for additional roles
List<String> roles = getRoles(context, user);
if (containerLog.isDebugEnabled()) {
- Iterator<String> it = roles.iterator();
- // TODO: Use a single log message
- while (it.hasNext()) {
- containerLog.debug("Found role: " + it.next());
- }
+ containerLog.debug("Found roles: " + roles.toString());
}
// Create and return a suitable Principal for this user
@@ -1494,7 +1500,7 @@ public class JNDIRealm extends RealmBase {
*
* @param context The directory context
* @param username Username to be looked up
- *
+ * @return the User object
* @exception NamingException if a directory server error occurs
*
* @see #getUser(DirContext, String, String, int)
@@ -1514,7 +1520,7 @@ public class JNDIRealm extends RealmBase {
* @param context The directory context
* @param username Username to be looked up
* @param credentials User credentials (optional)
- *
+ * @return the User object
* @exception NamingException if a directory server error occurs
*
* @see #getUser(DirContext, String, String, int)
@@ -1541,7 +1547,7 @@ public class JNDIRealm extends RealmBase {
* @param username Username to be looked up
* @param credentials User credentials (optional)
* @param curUserPattern Index into userPatternFormatArray
- *
+ * @return the User object
* @exception NamingException if a directory server error occurs
*/
protected User getUser(DirContext context, String username,
@@ -1606,7 +1612,7 @@ public class JNDIRealm extends RealmBase {
* @param attrIds String[]containing names of attributes to
* @param dn Distinguished name of the user
* retrieve.
- *
+ * @return the User object
* @exception NamingException if a directory server error occurs
*/
protected User getUserByPattern(DirContext context,
@@ -1660,7 +1666,7 @@ public class JNDIRealm extends RealmBase {
* @param credentials User credentials (optional)
* @param attrIds String[]containing names of attributes to
* @param curUserPattern Index into userPatternFormatArray
- *
+ * @return the User object
* @exception NamingException if a directory server error occurs
* @see #getUserByPattern(DirContext, String, String[], String)
*/
@@ -1706,7 +1712,7 @@ public class JNDIRealm extends RealmBase {
* @param context The directory context
* @param username The username
* @param attrIds String[]containing names of attributes to retrieve.
- *
+ * @return the User object
* @exception NamingException if a directory server error occurs
*/
protected User getUserBySearch(DirContext context,
@@ -1815,7 +1821,7 @@ public class JNDIRealm extends RealmBase {
* @param context The directory context
* @param user The User to be authenticated
* @param credentials The credentials presented by the user
- *
+ * @return <code>true</code> if the credentials are validated
* @exception NamingException if a directory server error occurs
*/
protected boolean checkCredentials(DirContext context,
@@ -1851,7 +1857,7 @@ public class JNDIRealm extends RealmBase {
* @param context The directory context
* @param info The User to be authenticated
* @param credentials Authentication credentials
- *
+ * @return <code>true</code> if the credentials are validated
* @exception NamingException if a directory server error occurs
*/
protected boolean compareCredentials(DirContext context,
@@ -1864,7 +1870,7 @@ public class JNDIRealm extends RealmBase {
containerLog.trace(" validating credentials");
if (info == null || credentials == null)
- return (false);
+ return false;
String password = info.getPassword();
@@ -1878,7 +1884,7 @@ public class JNDIRealm extends RealmBase {
* @param context The directory context
* @param user The User to be authenticated
* @param credentials Authentication credentials
- *
+ * @return <code>true</code> if the credentials are validated
* @exception NamingException if a directory server error occurs
*/
protected boolean bindAsUser(DirContext context,
@@ -1887,11 +1893,11 @@ public class JNDIRealm extends RealmBase {
throws NamingException {
if (credentials == null || user == null)
- return (false);
+ return false;
String dn = user.getDN();
if (dn == null)
- return (false);
+ return false;
// Validate the credentials specified by the user
if (containerLog.isTraceEnabled()) {
@@ -1927,6 +1933,7 @@ public class JNDIRealm extends RealmBase {
* @param context DirContext to configure
* @param dn Distinguished name of user
* @param credentials Credentials of user
+ * @exception NamingException if a directory server error occurs
*/
private void userCredentialsAdd(DirContext context, String dn,
String credentials) throws NamingException {
@@ -1941,6 +1948,7 @@ public class JNDIRealm extends RealmBase {
* those attributes are not specified.
*
* @param context DirContext to configure
+ * @exception NamingException if a directory server error occurs
*/
private void userCredentialsRemove(DirContext context)
throws NamingException {
@@ -1969,7 +1977,7 @@ public class JNDIRealm extends RealmBase {
*
* @param context The directory context we are searching
* @param user The User to be checked
- *
+ * @return the list of role names
* @exception NamingException if a directory server error occurs
*/
protected List<String> getRoles(DirContext context, User user)
@@ -1999,8 +2007,7 @@ public class JNDIRealm extends RealmBase {
if (containerLog.isTraceEnabled()) {
containerLog.trace(" Found " + list.size() + " user internal roles");
- for (int i=0; i<list.size(); i++)
- containerLog.trace( " Found user internal role " + list.get(i));
+ containerLog.trace(" Found user internal roles " + list.toString());
}
// Are we configured to do role searches?
@@ -2165,7 +2172,7 @@ public class JNDIRealm extends RealmBase {
*
* @param attrId Attribute name
* @param attrs Attributes containing the required value
- *
+ * @return the attribute value
* @exception NamingException if a directory server error occurs
*/
private String getAttributeValue(String attrId, Attributes attrs)
@@ -2199,7 +2206,7 @@ public class JNDIRealm extends RealmBase {
* @param attrId Attribute name
* @param attrs Attributes containing the new values
* @param values ArrayList containing values found so far
- *
+ * @return the list of attribute values
* @exception NamingException if a directory server error occurs
*/
private ArrayList<String> addAttributeValues(String attrId,
@@ -2264,19 +2271,16 @@ public class JNDIRealm extends RealmBase {
}
- /**
- * Return a short name for this Realm implementation.
- */
@Override
protected String getName() {
-
return name;
-
}
/**
- * Return the password associated with the given principal's user name.
+ * Get the password for the specified user.
+ * @param username The user name
+ * @return the password associated with the given principal's user name.
*/
@Override
protected String getPassword(String username) {
@@ -2301,7 +2305,9 @@ public class JNDIRealm extends RealmBase {
}
/**
- * Return the Principal associated with the given user name.
+ * Get the principal associated with the specified certificate.
+ * @param username The user name
+ * @return the Principal associated with the given certificate.
*/
@Override
protected Principal getPrincipal(String username) {
@@ -2385,7 +2391,12 @@ public class JNDIRealm extends RealmBase {
/**
- * Return the Principal associated with the given user name.
+ * Get the principal associated with the specified certificate.
+ * @param context The directory context
+ * @param username The user name
+ * @param gssCredential The credentials
+ * @return the Principal associated with the given certificate.
+ * @exception NamingException if a directory server error occurs
*/
protected synchronized Principal getPrincipal(DirContext context,
String username, GSSCredential gssCredential)
@@ -2446,7 +2457,7 @@ public class JNDIRealm extends RealmBase {
/**
* Open (if necessary) and return a connection to the configured
* directory server for this Realm.
- *
+ * @return the directory context
* @exception NamingException if a directory server error occurs
*/
protected DirContext open() throws NamingException {
@@ -2541,6 +2552,18 @@ public class JNDIRealm extends RealmBase {
throw new IllegalArgumentException(sm.getString(
"jndiRealm.invalidSslSocketFactory",
className), e);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException(sm.getString(
+ "jndiRealm.invalidSslSocketFactory",
+ className), e);
+ } catch (InvocationTargetException e) {
+ throw new IllegalArgumentException(sm.getString(
+ "jndiRealm.invalidSslSocketFactory",
+ className), e);
+ } catch (NoSuchMethodException e) {
+ throw new IllegalArgumentException(sm.getString(
+ "jndiRealm.invalidSslSocketFactory",
+ className), e);
}
}
@@ -2727,6 +2750,7 @@ public class JNDIRealm extends RealmBase {
*
* @param userPatternString - a string LDAP search paths surrounded by
* parentheses
+ * @return a parsed string array
*/
protected String[] parseUserPatternString(String userPatternString) {
@@ -2769,13 +2793,13 @@ public class JNDIRealm extends RealmBase {
* Given an LDAP search string, returns the string with certain characters
* escaped according to RFC 2254 guidelines.
* The character mapping is as follows:
- * char -> Replacement
+ * char -> Replacement
* ---------------------------
- * * -> \2a
- * ( -> \28
- * ) -> \29
- * \ -> \5c
- * \0 -> \00
+ * * -> \2a
+ * ( -> \28
+ * ) -> \29
+ * \ -> \5c
+ * \0 -> \00
* @param inString string to escape according to RFC 2254 guidelines
* @return String the escaped/encoded result
*/
@@ -2815,6 +2839,7 @@ public class JNDIRealm extends RealmBase {
* @param base The base DN
* @param result The search result
* @return String containing the distinguished name
+ * @exception NamingException if a directory server error occurs
*/
protected String getDistinguishedName(DirContext context, String base,
SearchResult result) throws NamingException {
@@ -2991,9 +3016,7 @@ public class JNDIRealm extends RealmBase {
public String getUserRoleId() {
return userRoleId;
+ }
}
-
-
-}
}
diff --git a/java/org/apache/catalina/security/SecurityUtil.java b/java/org/apache/catalina/security/SecurityUtil.java
index e359c78..ed5ff3a 100644
--- a/java/org/apache/catalina/security/SecurityUtil.java
+++ b/java/org/apache/catalina/security/SecurityUtil.java
@@ -47,8 +47,6 @@ import org.apache.tomcat.util.res.StringManager;
* Servlet/Filter.
*
* This class uses reflection to invoke the methods.
- *
- * @author Jean-Francois Arcand
*/
public final class SecurityUtil{
@@ -90,7 +88,7 @@ public final class SecurityUtil{
/**
- * Perform work as a particular </code>Subject</code>. Here the work
+ * Perform work as a particular <code>Subject</code>. Here the work
* will be granted to a <code>null</code> subject.
*
* @param methodName the method to apply the security restriction
@@ -98,13 +96,13 @@ public final class SecurityUtil{
* be called.
*/
public static void doAsPrivilege(final String methodName,
- final Servlet targetObject) throws java.lang.Exception{
+ final Servlet targetObject) throws Exception {
doAsPrivilege(methodName, targetObject, null, null, null);
}
/**
- * Perform work as a particular </code>Subject</code>. Here the work
+ * Perform work as a particular <code>Subject</code>. Here the work
* will be granted to a <code>null</code> subject.
*
* @param methodName the method to apply the security restriction
@@ -114,12 +112,13 @@ public final class SecurityUtil{
* <code>Method</code> object.
* @param targetArguments <code>Object</code> array contains the runtime
* parameters instance.
+ * @throws Exception an execution error occurred
*/
public static void doAsPrivilege(final String methodName,
final Servlet targetObject,
final Class<?>[] targetType,
final Object[] targetArguments)
- throws java.lang.Exception{
+ throws Exception {
doAsPrivilege(methodName,
targetObject,
@@ -130,25 +129,26 @@ public final class SecurityUtil{
/**
- * Perform work as a particular </code>Subject</code>. Here the work
+ * Perform work as a particular <code>Subject</code>. Here the work
* will be granted to a <code>null</code> subject.
*
* @param methodName the method to apply the security restriction
* @param targetObject the <code>Servlet</code> on which the method will
- * be called.
+ * be called.
* @param targetParameterTypes <code>Class</code> array used to instantiate a
- * <code>Method</code> object.
+ * <code>Method</code> object.
* @param targetArguments <code>Object</code> array contains the
- * runtime parameters instance.
+ * runtime parameters instance.
* @param principal the <code>Principal</code> to which the security
- * privilege apply..
+ * privilege applies
+ * @throws Exception an execution error occurred
*/
public static void doAsPrivilege(final String methodName,
final Servlet targetObject,
final Class<?>[] targetParameterTypes,
final Object[] targetArguments,
Principal principal)
- throws java.lang.Exception{
+ throws Exception {
// CometProcessor instances must not be cached as Servlet or
// NoSuchMethodException will be thrown.
@@ -177,16 +177,17 @@ public final class SecurityUtil{
/**
- * Perform work as a particular </code>Subject</code>. Here the work
+ * Perform work as a particular <code>Subject</code>. Here the work
* will be granted to a <code>null</code> subject.
*
* @param methodName the method to apply the security restriction
* @param targetObject the <code>Filter</code> on which the method will
- * be called.
+ * be called.
+ * @throws Exception an execution error occurred
*/
public static void doAsPrivilege(final String methodName,
final Filter targetObject)
- throws java.lang.Exception{
+ throws Exception {
doAsPrivilege(methodName, targetObject, null, null);
}
@@ -198,17 +199,18 @@ public final class SecurityUtil{
*
* @param methodName the method to apply the security restriction
* @param targetObject the <code>Filter</code> on which the method will
- * be called.
+ * be called.
* @param targetType <code>Class</code> array used to instantiate a
- * <code>Method</code> object.
+ * <code>Method</code> object.
* @param targetArguments <code>Object</code> array contains the
- * runtime parameters instance.
+ * runtime parameters instance.
+ * @throws Exception an execution error occurred
*/
public static void doAsPrivilege(final String methodName,
final Filter targetObject,
final Class<?>[] targetType,
final Object[] targetArguments)
- throws java.lang.Exception{
+ throws Exception {
doAsPrivilege(
methodName, targetObject, targetType, targetArguments, null);
@@ -220,20 +222,21 @@ public final class SecurityUtil{
*
* @param methodName the method to apply the security restriction
* @param targetObject the <code>Filter</code> on which the method will
- * be called.
+ * be called.
* @param targetParameterTypes <code>Class</code> array used to instantiate a
- * <code>Method</code> object.
+ * <code>Method</code> object.
* @param targetParameterValues <code>Object</code> array contains the
- * runtime parameters instance.
+ * runtime parameters instance.
* @param principal the <code>Principal</code> to which the security
- * privilege apply
+ * privilege applies
+ * @throws Exception an execution error occurred
*/
public static void doAsPrivilege(final String methodName,
final Filter targetObject,
final Class<?>[] targetParameterTypes,
final Object[] targetParameterValues,
Principal principal)
- throws java.lang.Exception{
+ throws Exception {
// CometFilter instances must not be cached as Filter or
// NoSuchMethodException will be thrown.
@@ -262,22 +265,23 @@ public final class SecurityUtil{
/**
- * Perform work as a particular </code>Subject</code>. Here the work
+ * Perform work as a particular <code>Subject</code>. Here the work
* will be granted to a <code>null</code> subject.
*
* @param method the method to apply the security restriction
* @param targetObject the <code>Servlet</code> on which the method will
- * be called.
+ * be called.
* @param targetArguments <code>Object</code> array contains the
- * runtime parameters instance.
+ * runtime parameters instance.
* @param principal the <code>Principal</code> to which the security
- * privilege applies
+ * privilege applies
+ * @throws Exception an execution error occurred
*/
private static void execute(final Method method,
final Object targetObject,
final Object[] targetArguments,
Principal principal)
- throws java.lang.Exception{
+ throws Exception {
try{
Subject subject = null;
@@ -376,8 +380,9 @@ public final class SecurityUtil{
* @param targetType the class on which the method will be called.
* @param methodName the method to apply the security restriction
* @param parameterTypes <code>Class</code> array used to instantiate a
- * <code>Method</code> object.
+ * <code>Method</code> object.
* @return the method instance.
+ * @throws Exception an execution error occurred
*/
private static Method createMethodAndCacheIt(Method[] methodsCache,
Class<?> targetType,
@@ -424,6 +429,7 @@ public final class SecurityUtil{
/**
* Return the <code>SecurityManager</code> only if Security is enabled AND
* package protection mechanism is enabled.
+ * @return <code>true</code> if package level protection is enabled
*/
public static boolean isPackageProtectionEnabled(){
if (packageDefinitionEnabled && Globals.IS_SECURITY_ENABLED){
diff --git a/java/org/apache/catalina/tribes/Channel.java b/java/org/apache/catalina/tribes/Channel.java
index 9c2b599..be23cfe 100644
--- a/java/org/apache/catalina/tribes/Channel.java
+++ b/java/org/apache/catalina/tribes/Channel.java
@@ -65,7 +65,6 @@ import java.io.Serializable;
* </code></pre>
*
* For example usage @see org.apache.catalina.tribes.group.GroupChannel
- * @author Filip Hanik
*/
public interface Channel {
@@ -247,13 +246,14 @@ public interface Channel {
/**
* Send a message to one or more members in the cluster
- * @param destination Member[] - the destinations, can not be null or zero length, the reason for that
+ * @param destination Member[] - the destinations, cannot be null or zero length, the reason for that
* is that a membership change can occur and at that time the application is uncertain what group the message
* actually got sent to.
* @param msg Serializable - the message to send, has to be serializable, or a <code>ByteMessage</code> to
* send a pure byte array
* @param options int - sender options, see class documentation for each interceptor that is configured in order to trigger interceptors
* @return a unique Id that identifies the message that is sent
+ * @throws ChannelException if a serialization error happens.
* @see ByteMessage
* @see #SEND_OPTIONS_USE_ACK
* @see #SEND_OPTIONS_ASYNCHRONOUS
@@ -324,7 +324,7 @@ public interface Channel {
/**
* Returns true if there are any members in the group,
- * this call is the same as <code>getMembers().length>0</code>
+ * this call is the same as <code>getMembers().length > 0</code>
* @return boolean - true if there are any members automatically discovered
*/
public boolean hasMembers() ;
diff --git a/java/org/apache/catalina/tribes/ChannelInterceptor.java b/java/org/apache/catalina/tribes/ChannelInterceptor.java
index 1af1af3..9c7368f 100644
--- a/java/org/apache/catalina/tribes/ChannelInterceptor.java
+++ b/java/org/apache/catalina/tribes/ChannelInterceptor.java
@@ -25,7 +25,6 @@ import org.apache.catalina.tribes.group.InterceptorPayload;
* other actions when a message is sent or received.<br>
* Interceptors are tied together in a linked list.
* @see org.apache.catalina.tribes.group.ChannelInterceptorBase
- * @author Filip Hanik
*/
public interface ChannelInterceptor extends MembershipListener, Heartbeat {
@@ -35,7 +34,7 @@ public interface ChannelInterceptor extends MembershipListener, Heartbeat {
* When a message is sent, the options can be retrieved from ChannelMessage.getOptions()
* and if the bit is set, this interceptor will react to it.<br>
* A simple evaluation if an interceptor should react to the message would be:<br>
- * <code>boolean react = (getOptionFlag() == (getOptionFlag() & ChannelMessage.getOptions()));</code><br>
+ * <code>boolean react = (getOptionFlag() == (getOptionFlag() & ChannelMessage.getOptions()));</code><br>
* The default option is 0, meaning there is no way for the application to trigger the
* interceptor. The interceptor itself will decide.<br>
* @return int
@@ -87,7 +86,7 @@ public interface ChannelInterceptor extends MembershipListener, Heartbeat {
* @param destination Member[] - the destination for this message
* @param msg ChannelMessage - the message to be sent
* @param payload InterceptorPayload - the payload, carrying an error handler and future useful data, can be null
- * @throws ChannelException
+ * @throws ChannelException if a serialization error happens.
* @see ErrorHandler
* @see InterceptorPayload
*/
@@ -117,14 +116,14 @@ public interface ChannelInterceptor extends MembershipListener, Heartbeat {
public boolean hasMembers() ;
/**
- * Intercepts the code>Channel.getMembers()</code> method
+ * Intercepts the <code>Channel.getMembers()</code> method
* @return Member[]
* @see Channel#getMembers()
*/
public Member[] getMembers() ;
/**
- * Intercepts the code>Channel.getLocalMember(boolean)</code> method
+ * Intercepts the <code>Channel.getLocalMember(boolean)</code> method
* @param incAliveTime boolean
* @return Member
* @see Channel#getLocalMember(boolean)
@@ -132,7 +131,7 @@ public interface ChannelInterceptor extends MembershipListener, Heartbeat {
public Member getLocalMember(boolean incAliveTime) ;
/**
- * Intercepts the code>Channel.getMember(Member)</code> method
+ * Intercepts the <code>Channel.getMember(Member)</code> method
* @param mbr Member
* @return Member - the actual member information, including stay alive
* @see Channel#getMember(Member)
diff --git a/java/org/apache/catalina/tribes/group/GroupChannel.java b/java/org/apache/catalina/tribes/group/GroupChannel.java
index 85a5f9c..e758e90 100644
--- a/java/org/apache/catalina/tribes/group/GroupChannel.java
+++ b/java/org/apache/catalina/tribes/group/GroupChannel.java
@@ -53,7 +53,6 @@ import org.apache.juli.logging.LogFactory;
* message being sent and received with membership announcements.
* The channel has an chain of interceptors that can modify the message or perform other logic.<br>
* It manages a complete group, both membership and replication.
- * @author Filip Hanik
*/
public class GroupChannel extends ChannelInterceptorBase implements ManagedChannel {
private static final Log log = LogFactory.getLog(GroupChannel.class);
@@ -63,6 +62,7 @@ public class GroupChannel extends ChannelInterceptorBase implements ManagedChann
* If set to true, the channel will start a local thread for the heart beat.
*/
protected boolean heartbeat = true;
+
/**
* If <code>heartbeat == true</code> then how often do we want this
* heartbeat to run. default is one minute
@@ -126,9 +126,9 @@ public class GroupChannel extends ChannelInterceptorBase implements ManagedChann
* <code>channel.addInterceptor(C);</code><br>
* <code>channel.addInterceptor(B);</code><br>
* Will result in a interceptor stack like this:<br>
- * <code>A -> C -> B</code><br>
+ * <code>A -> C -> B</code><br>
* The complete stack will look like this:<br>
- * <code>Channel -> A -> C -> B -> ChannelCoordinator</code><br>
+ * <code>Channel -> A -> C -> B -> ChannelCoordinator</code><br>
* @param interceptor ChannelInterceptorBase
*/
@Override
@@ -174,37 +174,44 @@ public class GroupChannel extends ChannelInterceptorBase implements ManagedChann
/**
* Send a message to the destinations specified
- * @param destination Member[] - destination.length > 0
+ * @param destination Member[] - destination.length > 0
* @param msg Serializable - the message to send
- * @param options int - sender options, options can trigger guarantee levels and different interceptors to
- * react to the message see class documentation for the <code>Channel</code> object.<br>
+ * @param options sender options, options can trigger guarantee levels and different
+ * interceptors to react to the message see class documentation for the
+ * <code>Channel</code> object.<br>
* @return UniqueId - the unique Id that was assigned to this message
* @throws ChannelException - if an error occurs processing the message
* @see org.apache.catalina.tribes.Channel
*/
@Override
- public UniqueId send(Member[] destination, Serializable msg, int options) throws ChannelException {
+ public UniqueId send(Member[] destination, Serializable msg, int options)
+ throws ChannelException {
return send(destination,msg,options,null);
}
/**
*
- * @param destination Member[] - destination.length > 0
+ * @param destination Member[] - destination.length > 0
* @param msg Serializable - the message to send
- * @param options int - sender options, options can trigger guarantee levels and different interceptors to
- * react to the message see class documentation for the <code>Channel</code> object.<br>
- * @param handler - callback object for error handling and completion notification, used when a message is
- * sent asynchronously using the <code>Channel.SEND_OPTIONS_ASYNCHRONOUS</code> flag enabled.
+ * @param options sender options, options can trigger guarantee levels and different
+ * interceptors to react to the message see class documentation for the
+ * <code>Channel</code> object.<br>
+ * @param handler - callback object for error handling and completion notification,
+ * used when a message is sent asynchronously using the
+ * <code>Channel.SEND_OPTIONS_ASYNCHRONOUS</code> flag enabled.
* @return UniqueId - the unique Id that was assigned to this message
* @throws ChannelException - if an error occurs processing the message
* @see org.apache.catalina.tribes.Channel
*/
@Override
- public UniqueId send(Member[] destination, Serializable msg, int options, ErrorHandler handler) throws ChannelException {
+ public UniqueId send(Member[] destination, Serializable msg, int options, ErrorHandler handler)
+ throws ChannelException {
if ( msg == null ) throw new ChannelException("Cant send a NULL message");
XByteBuffer buffer = null;
try {
- if ( destination == null || destination.length == 0) throw new ChannelException("No destination given");
+ if (destination == null || destination.length == 0) {
+ throw new ChannelException("No destination given");
+ }
ChannelData data = new ChannelData(true);//generates a unique Id
data.setAddress(getLocalMember(false));
data.setTimestamp(System.currentTimeMillis());
@@ -353,7 +360,7 @@ public class GroupChannel extends ChannelInterceptorBase implements ManagedChann
/**
* Sets up the default implementation interceptor stack
* if no interceptors have been added
- * @throws ChannelException
+ * @throws ChannelException Cluster error
*/
protected synchronized void setupDefaultStack() throws ChannelException {
@@ -387,7 +394,7 @@ public class GroupChannel extends ChannelInterceptorBase implements ManagedChann
/**
* Validates the option flags that each interceptor is using and reports
* an error if two interceptor share the same flag.
- * @throws ChannelException
+ * @throws ChannelException Error with option flag
*/
protected void checkOptionFlags() throws ChannelException {
StringBuilder conflicts = new StringBuilder();
@@ -419,9 +426,9 @@ public class GroupChannel extends ChannelInterceptorBase implements ManagedChann
}
/**
- * Starts the channel
+ * Starts the channel.
* @param svc int - what service to start
- * @throws ChannelException
+ * @throws ChannelException Start error
* @see org.apache.catalina.tribes.Channel#start(int)
*/
@Override
@@ -436,9 +443,9 @@ public class GroupChannel extends ChannelInterceptorBase implements ManagedChann
}
/**
- * Stops the channel
+ * Stops the channel.
* @param svc int
- * @throws ChannelException
+ * @throws ChannelException Stop error
* @see org.apache.catalina.tribes.Channel#stop(int)
*/
@Override
diff --git a/java/org/apache/catalina/tribes/group/RpcChannel.java b/java/org/apache/catalina/tribes/group/RpcChannel.java
index 8ad9748..56acb26 100644
--- a/java/org/apache/catalina/tribes/group/RpcChannel.java
+++ b/java/org/apache/catalina/tribes/group/RpcChannel.java
@@ -34,7 +34,6 @@ import org.apache.juli.logging.LogFactory;
/**
* A channel to handle RPC messaging
- * @author Filip Hanik
*/
public class RpcChannel implements ChannelListener {
private static final Log log = LogFactory.getLog(RpcChannel.class);
@@ -74,7 +73,7 @@ public class RpcChannel implements ChannelListener {
* @param channelOptions channel sender options
* @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
* @return Response[] - an array of response objects.
- * @throws ChannelException
+ * @throws ChannelException Error sending message
*/
public Response[] send(Member[] destination,
Serializable message,
@@ -225,7 +224,6 @@ public class RpcChannel implements ChannelListener {
/**
*
* Class that holds all response.
- * @author not attributable
* @version 1.0
*/
public static class RpcCollector {
@@ -240,8 +238,7 @@ public class RpcChannel implements ChannelListener {
public long timeout;
/**
- * @deprecated Use {@link
- * RpcChannel.RpcCollector#RpcChannel.RpcCollector(
+ * @deprecated Use {@link RpcChannel.RpcCollector#RpcChannel.RpcCollector(
* RpcChannel.RpcCollectorKey, int, int)}
*/
@Deprecated
@@ -268,10 +265,8 @@ public class RpcChannel implements ChannelListener {
case ALL_REPLY:
return destcnt == responses.size();
case MAJORITY_REPLY:
- {
float perc = ((float)responses.size()) / ((float)destcnt);
return perc >= 0.50f;
- }
case FIRST_REPLY:
return responses.size()>0;
default:
@@ -298,7 +293,7 @@ public class RpcChannel implements ChannelListener {
}
public static class RpcCollectorKey {
- byte[] id;
+ final byte[] id;
public RpcCollectorKey(byte[] id) {
this.id = id;
}
diff --git a/java/org/apache/catalina/util/LifecycleMBeanBase.java b/java/org/apache/catalina/util/LifecycleMBeanBase.java
index cfeb7e2..304e0c5 100644
--- a/java/org/apache/catalina/util/LifecycleMBeanBase.java
+++ b/java/org/apache/catalina/util/LifecycleMBeanBase.java
@@ -52,7 +52,6 @@ public abstract class LifecycleMBeanBase extends LifecycleBase
*/
@Override
protected void initInternal() throws LifecycleException {
-
// If oname is not null then registration has already happened via
// preRegister().
if (oname == null) {
@@ -131,7 +130,7 @@ public abstract class LifecycleMBeanBase extends LifecycleBase
/**
* Utility method to enable sub-classes to easily register additional
* components that don't implement {@link MBeanRegistration} with
- * an MBean server.<br/>
+ * an MBean server.<br>
* Note: This method should only be used once {@link #initInternal()} has
* been called and before {@link #destroyInternal()} has been called.
*
@@ -154,7 +153,6 @@ public abstract class LifecycleMBeanBase extends LifecycleBase
try {
on = new ObjectName(name.toString());
-
Registry.getRegistry(null, null).registerComponent(obj, on, null);
} catch (MalformedObjectNameException e) {
log.warn(sm.getString("lifecycleMBeanBase.registerFail", obj, name),
@@ -171,7 +169,7 @@ public abstract class LifecycleMBeanBase extends LifecycleBase
/**
* Utility method to enable sub-classes to easily unregister additional
* components that don't implement {@link MBeanRegistration} with
- * an MBean server.<br/>
+ * an MBean server.<br>
* Note: This method should only be used once {@link #initInternal()} has
* been called and before {@link #destroyInternal()} has been called.
*
diff --git a/java/org/apache/coyote/AbstractProcessor.java b/java/org/apache/coyote/AbstractProcessor.java
index 871e9e7..80ed7c3 100644
--- a/java/org/apache/coyote/AbstractProcessor.java
+++ b/java/org/apache/coyote/AbstractProcessor.java
@@ -82,6 +82,8 @@ public abstract class AbstractProcessor<S> implements ActionHook, Processor<S> {
/**
* Update the current error state to the new error state if the new error
* state is more severe than the current error state.
+ * @param errorState The error status details
+ * @param t The error which occurred
*/
protected void setErrorState(ErrorState errorState, Throwable t) {
boolean blockIo = this.errorState.isIoAllowed() && !errorState.isIoAllowed();
@@ -158,6 +160,7 @@ public abstract class AbstractProcessor<S> implements ActionHook, Processor<S> {
/**
* Set the socket wrapper being used.
+ * @param socketWrapper The socket wrapper
*/
protected final void setSocketWrapper(SocketWrapper<S> socketWrapper) {
this.socketWrapper = socketWrapper;
@@ -165,7 +168,7 @@ public abstract class AbstractProcessor<S> implements ActionHook, Processor<S> {
/**
- * Get the socket wrapper being used.
+ * @return the socket wrapper being used.
*/
protected final SocketWrapper<S> getSocketWrapper() {
return socketWrapper;
@@ -173,7 +176,7 @@ public abstract class AbstractProcessor<S> implements ActionHook, Processor<S> {
/**
- * Obtain the Executor used by the underlying endpoint.
+ * @return the Executor used by the underlying endpoint.
*/
@Override
public Executor getExecutor() {
@@ -192,6 +195,7 @@ public abstract class AbstractProcessor<S> implements ActionHook, Processor<S> {
return asyncStateMachine.asyncPostProcess();
}
+
@Override
public void errorDispatch() {
getAdapter().errorDispatch(request, response);
@@ -350,5 +354,4 @@ public abstract class AbstractProcessor<S> implements ActionHook, Processor<S> {
public final AsyncStateMachine<S> getAsyncStateMachine() {
return asyncStateMachine;
}
-
}
diff --git a/java/org/apache/coyote/InputBuffer.java b/java/org/apache/coyote/InputBuffer.java
index f84982e..a38cc5c 100644
--- a/java/org/apache/coyote/InputBuffer.java
+++ b/java/org/apache/coyote/InputBuffer.java
@@ -14,31 +14,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.coyote;
import java.io.IOException;
import org.apache.tomcat.util.buf.ByteChunk;
-
/**
- * Input buffer.
- *
- * This class is used only in the protocol implementation. All reading from
- * Tomcat ( or adapter ) should be done using Request.doRead().
- *
- *
- * @author Remy Maucherat
+ * This class is only for internal use in the protocol implementation. All
+ * reading from Tomcat (or adapter) should be done using Request.doRead().
*/
public interface InputBuffer {
-
- /** Return from the input stream.
- IMPORTANT: the current model assumes that the protocol will 'own' the
- buffer and return a pointer to it in ByteChunk ( i.e. the param will
- have chunk.getBytes()==null before call, and the result after the call ).
- */
+ /**
+ * Read from the input stream into the given buffer.
+ * IMPORTANT: the current model assumes that the protocol will 'own' the
+ * buffer and return a pointer to it in ByteChunk (i.e. the param will
+ * have chunk.getBytes()==null before call, and the result after the call).
+ *
+ * @param chunk The buffer to read data into.
+ * @param request The associated request
+ *
+ * @return The number of bytes that have been added to the buffer or -1 for
+ * end of stream
+ *
+ * @throws IOException If an I/O error occurs reading from the input stream
+ *
+ */
public int doRead(ByteChunk chunk, Request request)
throws IOException;
diff --git a/java/org/apache/coyote/Processor.java b/java/org/apache/coyote/Processor.java
index a41b53f..62638e4 100644
--- a/java/org/apache/coyote/Processor.java
+++ b/java/org/apache/coyote/Processor.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.coyote;
import java.io.IOException;
diff --git a/java/org/apache/coyote/Request.java b/java/org/apache/coyote/Request.java
index 9759767..a71507d 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.coyote;
import java.io.IOException;
@@ -67,18 +66,14 @@ public final class Request {
// ----------------------------------------------------------- Constructors
-
public Request() {
-
parameters.setQuery(queryMB);
parameters.setURLDecoder(urlDecoder);
-
}
// ----------------------------------------------------- Instance Variables
-
private int serverPort = -1;
private MessageBytes serverNameMB = MessageBytes.newInstance();
@@ -169,8 +164,8 @@ public final class Request {
return urlDecoder;
}
- // -------------------- Request data --------------------
+ // -------------------- Request data --------------------
public MessageBytes scheme() {
return schemeMB;
@@ -201,11 +196,11 @@ public final class Request {
}
/**
- * Return the buffer holding the server name, if
- * any. Use isNull() to check if there is no value
- * set.
- * This is the "virtual host", derived from the
- * Host: header.
+ * Get the "virtual host", derived from the Host: header associated with
+ * this request.
+ *
+ * @return The buffer holding the server name, if any. Use isNull() to check
+ * if there is no value set.
*/
public MessageBytes serverName() {
return serverNameMB;
@@ -251,20 +246,18 @@ public final class Request {
this.localPort = port;
}
- // -------------------- encoding/type --------------------
+ // -------------------- encoding/type --------------------
/**
* Get the character encoding used for this request.
*/
public String getCharacterEncoding() {
-
- if (charEncoding != null)
+ if (charEncoding != null) {
return charEncoding;
-
+ }
charEncoding = ContentType.getCharsetFromContentType(getContentType());
return charEncoding;
-
}
@@ -288,7 +281,9 @@ public final class Request {
}
public long getContentLengthLong() {
- if( contentLength > -1 ) return contentLength;
+ if( contentLength > -1 ) {
+ return contentLength;
+ }
MessageBytes clB = headers.getUniqueValue("content-length");
contentLength = (clB == null || clB.isNull()) ? -1 : clB.getLong();
@@ -298,8 +293,9 @@ public final class Request {
public String getContentType() {
contentType();
- if ((contentTypeMB == null) || contentTypeMB.isNull())
+ if ((contentTypeMB == null) || contentTypeMB.isNull()) {
return null;
+ }
return contentTypeMB.toString();
}
@@ -310,8 +306,9 @@ public final class Request {
public MessageBytes contentType() {
- if (contentTypeMB == null)
+ if (contentTypeMB == null) {
contentTypeMB = headers.getValue("content-type");
+ }
return contentTypeMB;
}
@@ -331,9 +328,9 @@ public final class Request {
return response;
}
- public void setResponse( Response response ) {
- this.response=response;
- response.setRequest( this );
+ public void setResponse(Response response) {
+ this.response = response;
+ response.setRequest(this);
}
public void action(ActionCode actionCode, Object param) {
@@ -341,10 +338,11 @@ public final class Request {
hook=response.getHook();
if (hook != null) {
- if( param==null )
+ if (param == null) {
hook.action(actionCode, this);
- else
+ } else {
hook.action(actionCode, param);
+ }
}
}
@@ -359,7 +357,6 @@ public final class Request {
// -------------------- Parameters --------------------
-
public Parameters getParameters() {
return parameters;
}
@@ -427,11 +424,18 @@ public final class Request {
/**
* Read data from the input buffer and put it into a byte chunk.
*
- * The buffer is owned by the protocol implementation - it will be reused on the next read.
- * The Adapter must either process the data in place or copy it to a separate buffer if it needs
- * to hold it. In most cases this is done during byte->char conversions or via InputStream. Unlike
- * InputStream, this interface allows the app to process data in place, without copy.
+ * The buffer is owned by the protocol implementation - it will be reused on
+ * the next read. The Adapter must either process the data in place or copy
+ * it to a separate buffer if it needs to hold it. In most cases this is
+ * done during byte->char conversions or via InputStream. Unlike
+ * InputStream, this interface allows the app to process data in place,
+ * without copy.
+ *
+ * @param chunk The destination to which to copy the data
+ *
+ * @return The number of bytes copied
*
+ * @throws IOException If an I/O error occurs during the copy
*/
public int doRead(ByteChunk chunk)
throws IOException {
@@ -467,10 +471,6 @@ public final class Request {
* be faster than ThreadLocal for very frequent operations.
*
* Example use:
- * Jk:
- * HandlerRequest.HOSTBUFFER = 10 CharChunk, buffer for Host decoding
- * WorkerEnv: SSL_CERT_NOTE=16 - MessageBytes containing the cert
- *
* Catalina CoyoteAdapter:
* ADAPTER_NOTES = 1 - stores the HttpServletRequest object ( req/res)
*
@@ -479,6 +479,9 @@ public final class Request {
* for connector use.
*
* 17-31 range is not allocated or used.
+ *
+ * @param pos Index to use to store the note
+ * @param value The value to store at that index
*/
public final void setNote(int pos, Object value) {
notes[pos] = value;
diff --git a/java/org/apache/jasper/compiler/AntCompiler.java b/java/org/apache/jasper/compiler/AntCompiler.java
index 820a571..7ee28fc 100644
--- a/java/org/apache/jasper/compiler/AntCompiler.java
+++ b/java/org/apache/jasper/compiler/AntCompiler.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.jasper.compiler;
import java.io.ByteArrayOutputStream;
@@ -312,6 +311,7 @@ public class AntCompiler extends Compiler {
/**
* Construct the handler to capture the output of the given steam.
+ * @param wrapped The wrapped stream
*/
public SystemLogHandler(PrintStream wrapped) {
super(wrapped);
@@ -329,14 +329,14 @@ public class AntCompiler extends Compiler {
/**
- * Thread <-> PrintStream associations.
+ * Thread <-> PrintStream associations.
*/
protected static ThreadLocal<PrintStream> streams =
new ThreadLocal<PrintStream>();
/**
- * Thread <-> ByteArrayOutputStream associations.
+ * Thread <-> ByteArrayOutputStream associations.
*/
protected static ThreadLocal<ByteArrayOutputStream> data =
new ThreadLocal<ByteArrayOutputStream>();
@@ -365,6 +365,7 @@ public class AntCompiler extends Compiler {
/**
* Stop capturing thread's output and return captured data as a String.
+ * @return the captured output
*/
public static String unsetThread() {
ByteArrayOutputStream baos = data.get();
@@ -382,6 +383,7 @@ public class AntCompiler extends Compiler {
/**
* Find PrintStream to which the output must be written to.
+ * @return the current stream
*/
protected PrintStream findStream() {
PrintStream ps = streams.get();
diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java b/java/org/apache/jasper/runtime/PageContextImpl.java
index f81c1c3..848f4b9 100644
--- a/java/org/apache/jasper/runtime/PageContextImpl.java
+++ b/java/org/apache/jasper/runtime/PageContextImpl.java
@@ -612,7 +612,8 @@ public class PageContextImpl extends PageContext {
}
/**
- * Returns the exception associated with this page context, if any. <p/>
+ * Returns the exception associated with this page context, if any.
+ * <p>
* Added wrapping for Throwables to avoid ClassCastException: see Bugzilla
* 31171 for details.
*
@@ -932,6 +933,7 @@ public class PageContextImpl extends PageContext {
* @param functionMap
* Maps prefix and name to Method
* @return The result of the evaluation
+ * @throws ELException If an error occurs during the evaluation
*/
public static Object proprietaryEvaluate(final String expression,
final Class<?> expectedType, final PageContext pageContext,
@@ -957,5 +959,4 @@ public class PageContextImpl extends PageContext {
}
return this.elContext;
}
-
}
diff --git a/java/org/apache/juli/logging/LogFactory.java b/java/org/apache/juli/logging/LogFactory.java
index 33fd4e4..14b66e8 100644
--- a/java/org/apache/juli/logging/LogFactory.java
+++ b/java/org/apache/juli/logging/LogFactory.java
@@ -33,19 +33,18 @@ import java.util.logging.LogManager;
* that corresponds to their logger of choice. This completely avoids any discovery
* problem, while still allowing the user to switch.
*
- * Note that this implementation is not just a wrapper around JDK logging ( like
- * the original commons-logging impl ). It adds 2 features - a simpler configuration
- * ( which is in fact a subset of log4j.properties ) and a formatter that is
- * less ugly.
+ * Note that this implementation is not just a wrapper around JDK logging (like
+ * the original commons-logging impl). It adds 2 features - a simpler
+ * configuration (which is in fact a subset of log4j.properties) and a
+ * formatter that is less ugly.
*
- * The removal of 'abstract' preserves binary backward compatibility. It is possible
- * to preserve the abstract - and introduce another ( hardcoded ) factory - but I
- * see no benefit.
+ * The removal of 'abstract' preserves binary backward compatibility. It is
+ * possible to preserve the abstract - and introduce another (hardcoded) factory
+ * - but I see no benefit.
*
- * Since this class is not intended to be extended - and provides
- * no plugin for other LogFactory implementation - all protected methods are removed.
- * This can be changed - but again, there is little value in keeping dead code.
- * Just take a quick look at the removed code ( and it's complexity)
+ * Since this class is not intended to be extended - all protected methods are
+ * removed. This can be changed - but again, there is little value in keeping
+ * dead code. Just take a quick look at the removed code ( and it's complexity).
*
* --------------
*
@@ -93,33 +92,30 @@ public class LogFactory {
* </p>
* <p>
* <strong>Note:</strong> <code>LogFactory</code> will print:
- * <code><pre>
- * [ERROR] LogFactory: Load of custom hashtable failed</em>
- * </code></pre>
+ * <pre>
+ * [ERROR] LogFactory: Load of custom hashtable failed
+ * </pre>
* to system error and then continue using a standard Hashtable.
- * </p>
* <p>
* <strong>Usage:</strong> Set this property when Java is invoked
* and <code>LogFactory</code> will attempt to load a new instance
* of the given implementation class.
* For example, running the following ant scriptlet:
- * <code><pre>
+ * <pre>
* <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
* ...
* <sysproperty
* key="org.apache.commons.logging.LogFactory.HashtableImpl"
* value="org.apache.commons.logging.AltHashtable"/>
* </java>
- * </pre></code>
+ * </pre>
* will mean that <code>LogFactory</code> will load an instance of
* <code>org.apache.commons.logging.AltHashtable</code>.
- * </p>
* <p>
* A typical use case is to allow a custom
* Hashtable implementation using weak references to be substituted.
* This will allow classloaders to be garbage collected without
* the need to release them (on 1.3+ JVMs only, of course ;)
- * </p>
*/
public static final String HASHTABLE_IMPLEMENTATION_PROPERTY =
"org.apache.commons.logging.LogFactory.HashtableImpl";
diff --git a/java/org/apache/naming/resources/ResourceCache.java b/java/org/apache/naming/resources/ResourceCache.java
index 21aae91..87cc52c 100644
--- a/java/org/apache/naming/resources/ResourceCache.java
+++ b/java/org/apache/naming/resources/ResourceCache.java
@@ -48,7 +48,7 @@ public class ResourceCache {
/**
* Cache.
- * Path -> Cache entry.
+ * Path -> Cache entry.
*/
protected CacheEntry[] cache = new CacheEntry[0];
diff --git a/java/org/apache/tomcat/dbcp/dbcp/AbandonedConfig.java b/java/org/apache/tomcat/dbcp/dbcp/AbandonedConfig.java
index 2239b55..9c64e19 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/AbandonedConfig.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/AbandonedConfig.java
@@ -77,12 +77,12 @@ public class AbandonedConfig {
* resets the lastUsed property of the parent connection.</p>
*
* <p>Abandoned connection cleanup happens when
- * <code><ul>
- * <li><code>{@link #getRemoveAbandoned() removeAbandoned} == true</li>
+ * <ul>
+ * <li>{@link #getRemoveAbandoned() removeAbandoned} == true</li>
* <li>{@link AbandonedObjectPool#getNumIdle() numIdle} < 2</li>
* <li>{@link AbandonedObjectPool#getNumActive() numActive} >
* {@link AbandonedObjectPool#getMaxActive() maxActive} - 3</li>
- * </ul></code></p>
+ * </ul></p>
*
* <p>The default value is 300 seconds.</p>
*/
diff --git a/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java b/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java
index 983ed3d..cf1bad7 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java
@@ -60,9 +60,9 @@ public class AbandonedObjectPool<T extends AbandonedTrace> extends GenericObject
* Get a db connection from the pool.
*
* If removeAbandoned=true, recovers db connections which
- * have been idle > removeAbandonedTimeout and
- * getNumActive() > getMaxActive() - 3 and
- * getNumIdle() < 2
+ * have been idle > removeAbandonedTimeout and
+ * getNumActive() > getMaxActive() - 3 and
+ * getNumIdle() < 2
*
* @return Object JDBC Connection
* @throws Exception if an exception occurs retrieving a
diff --git a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
index 44d8e5f..5d351a7 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
@@ -432,7 +432,7 @@ public class BasicDataSource implements DataSource {
/**
* The maximum number of milliseconds that the pool will wait (when there
* are no available connections) for a connection to be returned before
- * throwing an exception, or <= 0 to wait indefinitely.
+ * throwing an exception, or <= 0 to wait indefinitely.
*/
protected long maxWait = GenericObjectPool.DEFAULT_MAX_WAIT;
@@ -1214,8 +1214,8 @@ public class BasicDataSource implements DataSource {
* <p>Abandoned connections are identified and removed when
* {@link #getConnection()} is invoked and the following conditions hold
* <ul><li>{@link #getRemoveAbandoned()} = true </li>
- * <li>{@link #getNumActive()} > {@link #getMaxActive()} - 3 </li>
- * <li>{@link #getNumIdle()} < 2 </li></ul></p>
+ * <li>{@link #getNumActive()} > {@link #getMaxActive()} - 3 </li>
+ * <li>{@link #getNumIdle()} < 2 </li></ul>
*
* @see #getRemoveAbandonedTimeout()
*/
@@ -1256,11 +1256,11 @@ public class BasicDataSource implements DataSource {
* resets the lastUsed property of the parent connection.</p>
*
* <p>Abandoned connection cleanup happens when
- * <code><ul>
- * <li><code>{@link #getRemoveAbandoned() removeAbandoned} == true</li>
+ * <ul>
+ * <li>{@link #getRemoveAbandoned() removeAbandoned} == true</li>
* <li>{@link #getNumIdle() numIdle} < 2</li>
* <li>{@link #getNumActive() numActive} > {@link #getMaxActive() maxActive} - 3</li>
- * </ul></code></p>
+ * </ul>
*
* <p>The default value is 300 seconds.</p>
*/
diff --git a/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java b/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java
index efcd584..199da8a 100644
--- a/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java
+++ b/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java
@@ -46,7 +46,7 @@ import java.util.ArrayList;
* JOCL provides an XML syntax for constructing arbitrary Java
* {@link java.lang.Object} instances. It does not define a full
* XML document type (there's no root element), but rather an
- * XML fragment describing the {@link java.lang.Object <code>Object</code>s} to be
+ * XML fragment describing the {@link java.lang.Object Objects} to be
* constructed.
* <p>
* In a JOCL fragment, one may define a series of objects using
@@ -76,7 +76,7 @@ import java.util.ArrayList;
* The {@link #getTypeArray} method
* will return an array composed
* of two instances of <code>java.util.Date</code>. The sequence of
- * {@link java.lang.Object <code>Object</code>s} in the array
+ * {@link java.lang.Object Objects} in the array
* will correspond to the sequence of <code><object></code> elements in the JOCL fragment.
* <p>
* As we've seen, when used with no child-elements, the <code><object></code>
@@ -92,7 +92,6 @@ import java.util.ArrayList;
* <p>
* There is a special syntax available creating primitive values and arguments,
* as well as for constructing {@link java.lang.String <code>String</code>}s. Some examples:
- * <p>
* <pre> <byte value="3"/>
* <boolean value="false"/>
* <char value="c"/>
@@ -105,18 +104,16 @@ import java.util.ArrayList;
* <p>
* When invoked at the "root" level (that is, with no <code><object></code> parent),
* this will cause the corresponding "object wrapper" to be added to the list of
- * {@link java.lang.Object <code>Object</code>}s. The {@link #getType type} for these
+ * {@link java.lang.Object Object}s. The {@link #getType type} for these
* objects will reflect the proper primitive type, however. When invoked with an
* <code><object></code> parent, these will be treated as primitive arguments to the
- * specified {@link java.lang.Object <code>Object</code>}'s constructor. For example, while:
- * <p>
+ * specified {@link java.lang.Object Object}'s constructor. For example, while:
* <pre> <int value="5"/>
* <int value="26"/>
* <int value="100"/></pre>
* <p>
* results in three {@link java.lang.Integer} instances being added to the
* list of values, with types corresponding to {@link java.lang.Integer}, the fragment:
- * <p>
* <pre> <int value="5"/>
* <int value="26"/>
* <int value="100"/></pre>
@@ -165,7 +162,6 @@ import java.util.ArrayList;
* </arbitrary-root></pre>
* <p>
* Formally, a DTD for the JOCL grammar is as follows:
- * <p>
* <pre>
* <!ELEMENT object (object|array|collection|list|byte|boolean|char|double|float|int|long|short|string)*>
* <!ATTLIST object
diff --git a/java/org/apache/tomcat/dbcp/pool/KeyedPoolableObjectFactory.java b/java/org/apache/tomcat/dbcp/pool/KeyedPoolableObjectFactory.java
index a8813af..51324ac 100644
--- a/java/org/apache/tomcat/dbcp/pool/KeyedPoolableObjectFactory.java
+++ b/java/org/apache/tomcat/dbcp/pool/KeyedPoolableObjectFactory.java
@@ -56,7 +56,6 @@ package org.apache.tomcat.dbcp.pool;
* be considered active, passive or in a generally consistent state.
* </li>
* </ol>
- * </p>
* <p>
* {@link KeyedPoolableObjectFactory} must be thread-safe. The only promise
* an {@link KeyedObjectPool} makes is that the same instance of an object will not
diff --git a/java/org/apache/tomcat/dbcp/pool/impl/GenericKeyedObjectPool.java b/java/org/apache/tomcat/dbcp/pool/impl/GenericKeyedObjectPool.java
index b5b7c9a..d99c66f 100644
--- a/java/org/apache/tomcat/dbcp/pool/impl/GenericKeyedObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool/impl/GenericKeyedObjectPool.java
@@ -1381,7 +1381,7 @@ public class GenericKeyedObjectPool<K, V> extends BaseKeyedObjectPool<K, V> {
* returned to the idle instance pool, even during its execution. It locks
* the pool only during instance removal. Additional instances may be returned
* while removed items are being destroyed.</li>
- * <li>Exceptions encountered destroying idle instances are swallowed.</li></ul></p>
+ * <li>Exceptions encountered destroying idle instances are swallowed.</li></ul>
*/
@Override
public void clear() {
@@ -1778,7 +1778,7 @@ public class GenericKeyedObjectPool<K, V> extends BaseKeyedObjectPool<K, V> {
* Registers a key for pool control.
*
* If <code>populateImmediately</code> is <code>true</code> and
- * <code>minIdle > 0,</code> the pool under the given key will be
+ * <code>minIdle > 0,</code> the pool under the given key will be
* populated immediately with <code>minIdle</code> idle instances.
*
* @param key - The key to register for pool control.
diff --git a/java/org/apache/tomcat/dbcp/pool/impl/GenericObjectPool.java b/java/org/apache/tomcat/dbcp/pool/impl/GenericObjectPool.java
index 64826d0..5528418 100644
--- a/java/org/apache/tomcat/dbcp/pool/impl/GenericObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool/impl/GenericObjectPool.java
@@ -745,9 +745,9 @@ public class GenericObjectPool<T> extends BaseObjectPool<T> {
* Sets the minimum number of objects allowed in the pool
* before the evictor thread (if active) spawns new objects.
* Note that no objects are created when
- * <code>numActive + numIdle >= maxActive.</code>
+ * <code>numActive + numIdle >= maxActive.</code>
* This setting has no effect if the idle object evictor is disabled
- * (i.e. if <code>timeBetweenEvictionRunsMillis <= 0</code>).
+ * (i.e. if <code>timeBetweenEvictionRunsMillis <= 0</code>).
* <p>
* If the configured value of minIdle is greater than the configured value
* for maxIdle then the value of maxIdle will be used instead.
@@ -766,7 +766,7 @@ public class GenericObjectPool<T> extends BaseObjectPool<T> {
/**
* Returns the minimum number of objects allowed in the pool
* before the evictor thread (if active) spawns new objects.
- * (Note no objects are created when: numActive + numIdle >= maxActive)
+ * (Note no objects are created when: numActive + numIdle >= maxActive)
* <p>
* If the configured value of minIdle is greater than the configured value
* for maxIdle then the value of maxIdle will be used instead.
@@ -1322,7 +1322,7 @@ public class GenericObjectPool<T> extends BaseObjectPool<T> {
* returned to the idle instance pool, even during its execution. It locks
* the pool only during instance removal. Additional instances may be returned
* while removed items are being destroyed.</li>
- * <li>Exceptions encountered destroying idle instances are swallowed.</li></ul></p>
+ * <li>Exceptions encountered destroying idle instances are swallowed.</li></ul>
*/
@Override
public void clear() {
diff --git a/java/org/apache/tomcat/dbcp/pool/impl/SoftReferenceObjectPool.java b/java/org/apache/tomcat/dbcp/pool/impl/SoftReferenceObjectPool.java
index 8bc8d99..67418b0 100644
--- a/java/org/apache/tomcat/dbcp/pool/impl/SoftReferenceObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool/impl/SoftReferenceObjectPool.java
@@ -162,7 +162,6 @@ public class SoftReferenceObjectPool<T> extends BaseObjectPool<T> {
* <li>{@link PoolableObjectFactory#validateObject(Object) validation} fails</li>
* <li>{@link PoolableObjectFactory#passivateObject(Object) passivation} throws an exception</li>
* </ul>
- *</p>
*
* <p>Exceptions passivating or destroying instances are silently swallowed. Exceptions validating
* instances are propagated to the client.</p>
diff --git a/java/org/apache/tomcat/dbcp/pool/impl/StackObjectPool.java b/java/org/apache/tomcat/dbcp/pool/impl/StackObjectPool.java
index 3e0cf2f..6be923d 100644
--- a/java/org/apache/tomcat/dbcp/pool/impl/StackObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/pool/impl/StackObjectPool.java
@@ -216,7 +216,7 @@ public class StackObjectPool<T> extends BaseObjectPool<T> {
* </ul>
* If adding a validated, passivated returning instance to the stack would cause
* {@link #getMaxSleeping() maxSleeping} to be exceeded, the oldest (bottom) instance on the stack
- * is destroyed to make room for the returning instance, which is pushed on top of the stack.</p>
+ * is destroyed to make room for the returning instance, which is pushed on top of the stack.
*
* <p>Exceptions passivating or destroying instances are silently swallowed. Exceptions validating
* instances are propagated to the client.</p>
diff --git a/java/org/apache/tomcat/util/codec/binary/Base64.java b/java/org/apache/tomcat/util/codec/binary/Base64.java
index 28d1c5d..3d40748 100644
--- a/java/org/apache/tomcat/util/codec/binary/Base64.java
+++ b/java/org/apache/tomcat/util/codec/binary/Base64.java
@@ -256,7 +256,7 @@ public class Base64 extends BaseNCodec {
*
* @param lineLength
* Each line of encoded data will be at most of the given length (rounded down to nearest multiple of
- * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when
+ * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when
* decoding.
* @param lineSeparator
* Each line of encoded data will end with this sequence of bytes.
diff --git a/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java b/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
index d6f343e..ecc761d 100644
--- a/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
+++ b/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java
@@ -75,7 +75,7 @@ public abstract class BaseNCodec implements BinaryEncoder, BinaryDecoder {
/**
* Variable tracks how many characters have been written to the current line. Only used when encoding. We use
- * it to make sure each encoded line never goes beyond lineLength (if lineLength > 0).
+ * it to make sure each encoded line never goes beyond lineLength (if lineLength > 0).
*/
int currentLinePos;
@@ -401,7 +401,7 @@ public abstract class BaseNCodec implements BinaryEncoder, BinaryDecoder {
*
* @param pArray
* a byte array containing binary data
- * @return A byte array containing only the basen alphabetic character data
+ * @return A byte array containing only the base N alphabetic character data
*/
@Override
public byte[] encode(final byte[] pArray) {
@@ -492,7 +492,7 @@ public abstract class BaseNCodec implements BinaryEncoder, BinaryDecoder {
* @param pArray byte[] array which will later be encoded
*
* @return amount of space needed to encoded the supplied array.
- * Returns a long since a max-len array will require > Integer.MAX_VALUE
+ * Returns a long since a max-len array will require > Integer.MAX_VALUE
*/
public long getEncodedLength(final byte[] pArray) {
// Calculate non-chunked size - rounded up to allow for padding
diff --git a/java/org/apache/tomcat/util/digester/Digester.java b/java/org/apache/tomcat/util/digester/Digester.java
index f427b5b..8985649 100644
--- a/java/org/apache/tomcat/util/digester/Digester.java
+++ b/java/org/apache/tomcat/util/digester/Digester.java
@@ -14,10 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.tomcat.util.digester;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -78,14 +76,13 @@ import org.xml.sax.helpers.AttributesImpl;
*/
public class Digester extends DefaultHandler2 {
-
// ---------------------------------------------------------- Static Fields
protected static IntrospectionUtils.PropertySource propertySource = null;
static {
String className = System.getProperty("org.apache.tomcat.util.digester.PROPERTY_SOURCE");
- if (className!=null) {
+ if (className != null) {
ClassLoader[] cls = new ClassLoader[] {Digester.class.getClassLoader(),Thread.currentThread().getContextClassLoader()};
for (int i = 0; i < cls.length; i++) {
try {
@@ -104,7 +101,6 @@ public class Digester extends DefaultHandler2 {
// --------------------------------------------------------- Constructors
-
/**
* Construct a new Digester with default properties.
*/
@@ -115,7 +111,6 @@ public class Digester extends DefaultHandler2 {
if (propertySource != null) {
source = new IntrospectionUtils.PropertySource[] { propertySource, source[0] };
}
-
}
@@ -135,7 +130,6 @@ public class Digester extends DefaultHandler2 {
if (propertySource != null) {
source = new IntrospectionUtils.PropertySource[] { propertySource, source[0] };
}
-
}
@@ -155,10 +149,8 @@ public class Digester extends DefaultHandler2 {
if (propertySource != null) {
source = new IntrospectionUtils.PropertySource[] { propertySource, source[0] };
}
-
}
-
// --------------------------------------------------- Instance Variables
@@ -190,8 +182,7 @@ public class Digester extends DefaultHandler2 {
/**
* The stack of body text string buffers for surrounding elements.
*/
- protected ArrayStack<StringBuilder> bodyTexts =
- new ArrayStack<StringBuilder>();
+ protected ArrayStack<StringBuilder> bodyTexts = new ArrayStack<StringBuilder>();
/**
@@ -230,8 +221,7 @@ public class Digester extends DefaultHandler2 {
* The URLs of entityValidator that have been registered, keyed by the public
* identifier that corresponds.
*/
- protected HashMap<String,String> entityValidator =
- new HashMap<String,String>();
+ protected HashMap<String, String> entityValidator = new HashMap<String,String>();
/**
@@ -272,8 +262,8 @@ public class Digester extends DefaultHandler2 {
* is required because documents can declare nested uses of the same
* prefix for different Namespace URIs).
*/
- protected HashMap<String,ArrayStack<String>> namespaces =
- new HashMap<String,ArrayStack<String>>();
+ protected HashMap<String, ArrayStack<String>> namespaces =
+ new HashMap<String,ArrayStack<String>>();
/**
@@ -351,15 +341,12 @@ public class Digester extends DefaultHandler2 {
/**
* The Log to which most logging calls will be made.
*/
- protected Log log =
- LogFactory.getLog("org.apache.tomcat.util.digester.Digester");
-
+ protected Log log = LogFactory.getLog(Digester.class);
/**
* The Log to which all SAX event related logging calls will be made.
*/
- protected Log saxLog =
- LogFactory.getLog("org.apache.tomcat.util.digester.Digester.sax");
+ protected Log saxLog = LogFactory.getLog("org.apache.tomcat.util.digester.Digester.sax");
/** Stacks used for interrule communication, indexed by name String */
@@ -374,19 +361,18 @@ public class Digester extends DefaultHandler2 {
* go dynamically as the document is parsed.
*
* @param prefix Prefix to look up
+ * @return the namespace URI
*/
public String findNamespaceURI(String prefix) {
-
ArrayStack<String> stack = namespaces.get(prefix);
if (stack == null) {
- return (null);
+ return null;
}
try {
return stack.peek();
} catch (EmptyStackException e) {
- return (null);
+ return null;
}
-
}
@@ -399,21 +385,19 @@ public class Digester extends DefaultHandler2 {
* <code>useContextClassLoader</code> property is set to true</li>
* <li>The class loader used to load the Digester class itself.
* </ul>
+ * @return the classloader
*/
public ClassLoader getClassLoader() {
-
if (this.classLoader != null) {
- return (this.classLoader);
+ return this.classLoader;
}
if (this.useContextClassLoader) {
- ClassLoader classLoader =
- Thread.currentThread().getContextClassLoader();
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
- return (classLoader);
+ return classLoader;
}
}
- return (this.getClass().getClassLoader());
-
+ return this.getClass().getClassLoader();
}
@@ -425,44 +409,36 @@ public class Digester extends DefaultHandler2 {
* to revert to the standard rules
*/
public void setClassLoader(ClassLoader classLoader) {
-
this.classLoader = classLoader;
-
}
/**
- * Return the current depth of the element stack.
+ * @return the current depth of the element stack.
*/
public int getCount() {
-
- return (stack.size());
-
+ return stack.size();
}
/**
- * Return the name of the XML element that is currently being processed.
+ * @return the name of the XML element that is currently being processed.
*/
public String getCurrentElementName() {
-
String elementName = match;
int lastSlash = elementName.lastIndexOf('/');
if (lastSlash >= 0) {
elementName = elementName.substring(lastSlash + 1);
}
- return (elementName);
-
+ return elementName;
}
/**
- * Return the error handler for this Digester.
+ * @return the error handler for this Digester.
*/
public ErrorHandler getErrorHandler() {
-
- return (this.errorHandler);
-
+ return this.errorHandler;
}
@@ -472,21 +448,19 @@ public class Digester extends DefaultHandler2 {
* @param errorHandler The new error handler
*/
public void setErrorHandler(ErrorHandler errorHandler) {
-
this.errorHandler = errorHandler;
-
}
/**
- * Return the SAXParserFactory we will use, creating one if necessary.
- * @throws ParserConfigurationException
- * @throws SAXNotSupportedException
- * @throws SAXNotRecognizedException
+ * SAX parser factory method.
+ * @return the SAXParserFactory we will use, creating one if necessary.
+ * @throws ParserConfigurationException Error creating parser
+ * @throws SAXNotSupportedException Error creating parser
+ * @throws SAXNotRecognizedException Error creating parser
*/
- public SAXParserFactory getFactory()
- throws SAXNotRecognizedException, SAXNotSupportedException,
- ParserConfigurationException {
+ public SAXParserFactory getFactory() throws SAXNotRecognizedException, SAXNotSupportedException,
+ ParserConfigurationException {
if (factory == null) {
factory = SAXParserFactory.newInstance();
@@ -494,32 +468,25 @@ public class Digester extends DefaultHandler2 {
factory.setNamespaceAware(namespaceAware);
// Preserve xmlns attributes
if (namespaceAware) {
- factory.setFeature(
- "http://xml.org/sax/features/namespace-prefixes",
- true);
+ factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
}
factory.setValidating(validating);
if (validating) {
// Enable DTD validation
- factory.setFeature(
- "http://xml.org/sax/features/validation",
- true);
+ factory.setFeature("http://xml.org/sax/features/validation", true);
// Enable schema validation
- factory.setFeature(
- "http://apache.org/xml/features/validation/schema",
- true);
+ factory.setFeature("http://apache.org/xml/features/validation/schema", true);
}
}
- return (factory);
-
+ return factory;
}
/**
* Returns a flag indicating whether the requested feature is supported
* by the underlying implementation of <code>org.xml.sax.XMLReader</code>.
- * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
+ * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description">
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 feature flags.
*
@@ -544,7 +511,7 @@ public class Digester extends DefaultHandler2 {
/**
* Sets a flag indicating whether the requested feature is supported
* by the underlying implementation of <code>org.xml.sax.XMLReader</code>.
- * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
+ * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description">
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 feature flags. In order to be
* effective, this method must be called <strong>before</strong> the
@@ -561,9 +528,8 @@ public class Digester extends DefaultHandler2 {
* @exception SAXNotSupportedException if the property name is
* recognized but not supported
*/
- public void setFeature(String feature, boolean value)
- throws ParserConfigurationException, SAXNotRecognizedException,
- SAXNotSupportedException {
+ public void setFeature(String feature, boolean value) throws ParserConfigurationException,
+ SAXNotRecognizedException, SAXNotSupportedException {
getFactory().setFeature(feature, value);
@@ -571,7 +537,7 @@ public class Digester extends DefaultHandler2 {
/**
- * Return the current Logger associated with this instance of the Digester
+ * @return the current Logger associated with this instance of the Digester
*/
public Log getLogger() {
@@ -582,6 +548,7 @@ public class Digester extends DefaultHandler2 {
/**
* Set the current logger for this Digester.
+ * @param log The logger that will be used
*/
public void setLogger(Log log) {
@@ -594,6 +561,7 @@ public class Digester extends DefaultHandler2 {
* <strong>Note</strong> the output is finely grained.
*
* @since 1.6
+ * @return the SAX logger
*/
public Log getSAXLogger() {
@@ -614,7 +582,7 @@ public class Digester extends DefaultHandler2 {
}
/**
- * Return the current rule match path
+ * @return the current rule match path
*/
public String getMatch() {
@@ -624,12 +592,10 @@ public class Digester extends DefaultHandler2 {
/**
- * Return the "namespace aware" flag for parsers we create.
+ * @return the "namespace aware" flag for parsers we create.
*/
public boolean getNamespaceAware() {
-
- return (this.namespaceAware);
-
+ return this.namespaceAware;
}
@@ -639,9 +605,7 @@ public class Digester extends DefaultHandler2 {
* @param namespaceAware The new "namespace aware" flag
*/
public void setNamespaceAware(boolean namespaceAware) {
-
this.namespaceAware = namespaceAware;
-
}
@@ -649,19 +613,17 @@ public class Digester extends DefaultHandler2 {
* Set the public id of the current file being parse.
* @param publicId the DTD/Schema public's id.
*/
- public void setPublicId(String publicId){
+ public void setPublicId(String publicId) {
this.publicId = publicId;
}
/**
- * Return the public identifier of the DTD we are currently
+ * @return the public identifier of the DTD we are currently
* parsing under, if any.
*/
public String getPublicId() {
-
- return (this.publicId);
-
+ return this.publicId;
}
@@ -670,9 +632,7 @@ public class Digester extends DefaultHandler2 {
* added <code>Rule</code> objects.
*/
public String getRuleNamespaceURI() {
-
return (getRules().getNamespaceURI());
-
}
@@ -685,21 +645,19 @@ public class Digester extends DefaultHandler2 {
* regardless of the current namespace URI
*/
public void setRuleNamespaceURI(String ruleNamespaceURI) {
-
getRules().setNamespaceURI(ruleNamespaceURI);
-
}
/**
- * Return the SAXParser we will use to parse the input stream. If there
+ * @return the SAXParser we will use to parse the input stream. If there
* is a problem creating the parser, return <code>null</code>.
*/
public SAXParser getParser() {
// Return the parser we already created (if any)
if (parser != null) {
- return (parser);
+ return parser;
}
// Create a new parser
@@ -707,40 +665,38 @@ public class Digester extends DefaultHandler2 {
parser = getFactory().newSAXParser();
} catch (Exception e) {
log.error("Digester.getParser: ", e);
- return (null);
+ return null;
}
- return (parser);
-
+ return parser;
}
/**
* Return the current value of the specified property for the underlying
* <code>XMLReader</code> implementation.
- * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
+ * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description">
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 properties.
*
* @param property Property name to be retrieved
- *
+ * @return the property value
* @exception SAXNotRecognizedException if the property name is
* not recognized
* @exception SAXNotSupportedException if the property name is
* recognized but not supported
*/
public Object getProperty(String property)
- throws SAXNotRecognizedException, SAXNotSupportedException {
-
- return (getParser().getProperty(property));
+ throws SAXNotRecognizedException, SAXNotSupportedException {
+ return getParser().getProperty(property);
}
/**
* Set the current value of the specified property for the underlying
* <code>XMLReader</code> implementation.
- * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
+ * See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description">
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 properties.
*
@@ -764,15 +720,14 @@ public class Digester extends DefaultHandler2 {
* Return the <code>Rules</code> implementation object containing our
* rules collection and associated matching policy. If none has been
* established, a default implementation will be created and returned.
+ * @return the rules
*/
public Rules getRules() {
-
if (this.rules == null) {
this.rules = new RulesBase();
this.rules.setDigester(this);
}
- return (this.rules);
-
+ return this.rules;
}
@@ -783,20 +738,16 @@ public class Digester extends DefaultHandler2 {
* @param rules New Rules implementation
*/
public void setRules(Rules rules) {
-
this.rules = rules;
this.rules.setDigester(this);
-
}
/**
- * Return the boolean as to whether the context classloader should be used.
+ * @return the boolean as to whether the context classloader should be used.
*/
public boolean getUseContextClassLoader() {
-
return useContextClassLoader;
-
}
@@ -817,12 +768,10 @@ public class Digester extends DefaultHandler2 {
/**
- * Return the validating parser flag.
+ * @return the validating parser flag.
*/
public boolean getValidating() {
-
- return (this.validating);
-
+ return this.validating;
}
@@ -833,19 +782,15 @@ public class Digester extends DefaultHandler2 {
* @param validating The new validating parser flag.
*/
public void setValidating(boolean validating) {
-
this.validating = validating;
-
}
/**
- * Return the rules validation flag.
+ * @return the rules validation flag.
*/
public boolean getRulesValidation() {
-
- return (this.rulesValidation);
-
+ return this.rulesValidation;
}
@@ -856,27 +801,25 @@ public class Digester extends DefaultHandler2 {
* @param rulesValidation The new rules validation flag.
*/
public void setRulesValidation(boolean rulesValidation) {
-
this.rulesValidation = rulesValidation;
-
}
/**
- * Return the fake attributes list.
+ * @return the fake attributes list.
*/
public Map<Class<?>, List<String>> getFakeAttributes() {
-
- return (this.fakeAttributes);
-
+ return this.fakeAttributes;
}
/**
* Determine if an attribute is a fake attribute.
+ * @param object The object
+ * @param name The attribute name
+ * @return <code>true</code> if this is a fake attribute
*/
public boolean isFakeAttribute(Object object, String name) {
-
if (fakeAttributes == null) {
return false;
}
@@ -889,7 +832,6 @@ public class Digester extends DefaultHandler2 {
} else {
return result.contains(name);
}
-
}
@@ -910,24 +852,24 @@ public class Digester extends DefaultHandler2 {
*
* FIX ME: there is a bug in JAXP/XERCES that prevent the use of a
* parser that contains a schema with a DTD.
+ * @return the XML reader
* @exception SAXException if no XMLReader can be instantiated
*/
public XMLReader getXMLReader() throws SAXException {
- if (reader == null){
+ if (reader == null) {
reader = getParser().getXMLReader();
}
reader.setDTDHandler(this);
reader.setContentHandler(this);
- if (entityResolver == null){
+ if (entityResolver == null) {
reader.setEntityResolver(this);
} else {
reader.setEntityResolver(entityResolver);
}
- reader.setProperty(
- "http://xml.org/sax/properties/lexical-handler", this);
+ reader.setProperty("http://xml.org/sax/properties/lexical-handler", this);
reader.setErrorHandler(this);
return reader;
@@ -969,8 +911,7 @@ public class Digester extends DefaultHandler2 {
if (saxLog.isDebugEnabled()) {
if (getCount() > 1) {
- saxLog.debug("endDocument(): " + getCount() +
- " elements left");
+ saxLog.debug("endDocument(): " + getCount() + " elements left");
} else {
saxLog.debug("endDocument()");
}
@@ -1014,15 +955,14 @@ public class Digester extends DefaultHandler2 {
* @exception SAXException if a parsing error is to be reported
*/
@Override
- public void endElement(String namespaceURI, String localName,
- String qName) throws SAXException {
+ public void endElement(String namespaceURI, String localName, String qName)
+ throws SAXException {
boolean debug = log.isDebugEnabled();
if (debug) {
if (saxLog.isDebugEnabled()) {
- saxLog.debug("endElement(" + namespaceURI + "," + localName +
- "," + qName + ")");
+ saxLog.debug("endElement(" + namespaceURI + "," + localName + "," + qName + ")");
}
log.debug(" match='" + match + "'");
log.debug(" bodyText='" + bodyText + "'");
@@ -1141,12 +1081,10 @@ public class Digester extends DefaultHandler2 {
* @exception SAXException if a parsing error is to be reported
*/
@Override
- public void ignorableWhitespace(char buffer[], int start, int len)
- throws SAXException {
+ public void ignorableWhitespace(char buffer[], int start, int len) throws SAXException {
if (saxLog.isDebugEnabled()) {
- saxLog.debug("ignorableWhitespace(" +
- new String(buffer, start, len) + ")");
+ saxLog.debug("ignorableWhitespace(" + new String(buffer, start, len) + ")");
}
// No processing required
@@ -1163,8 +1101,7 @@ public class Digester extends DefaultHandler2 {
* @exception SAXException if a parsing error is to be reported
*/
@Override
- public void processingInstruction(String target, String data)
- throws SAXException {
+ public void processingInstruction(String target, String data) throws SAXException {
if (saxLog.isDebugEnabled()) {
saxLog.debug("processingInstruction('" + target + "','" + data + "')");
@@ -1255,14 +1192,12 @@ public class Digester extends DefaultHandler2 {
* @exception SAXException if a parsing error is to be reported
*/
@Override
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes list)
+ public void startElement(String namespaceURI, String localName, String qName, Attributes list)
throws SAXException {
boolean debug = log.isDebugEnabled();
if (saxLog.isDebugEnabled()) {
- saxLog.debug("startElement(" + namespaceURI + "," + localName + "," +
- qName + ")");
+ saxLog.debug("startElement(" + namespaceURI + "," + localName + "," + qName + ")");
}
// Parse system properties
@@ -1327,8 +1262,7 @@ public class Digester extends DefaultHandler2 {
* @exception SAXException if a parsing error is to be reported
*/
@Override
- public void startPrefixMapping(String prefix, String namespaceURI)
- throws SAXException {
+ public void startPrefixMapping(String prefix, String namespaceURI) throws SAXException {
if (saxLog.isDebugEnabled()) {
saxLog.debug("startPrefixMapping(" + prefix + "," + namespaceURI + ")");
@@ -1359,8 +1293,7 @@ public class Digester extends DefaultHandler2 {
public void notationDecl(String name, String publicId, String systemId) {
if (saxLog.isDebugEnabled()) {
- saxLog.debug("notationDecl(" + name + "," + publicId + "," +
- systemId + ")");
+ saxLog.debug("notationDecl(" + name + "," + publicId + "," + systemId + ")");
}
}
@@ -1375,12 +1308,11 @@ public class Digester extends DefaultHandler2 {
* @param notation The name of the associated notation
*/
@Override
- public void unparsedEntityDecl(String name, String publicId,
- String systemId, String notation) {
+ public void unparsedEntityDecl(String name, String publicId, String systemId, String notation) {
if (saxLog.isDebugEnabled()) {
- saxLog.debug("unparsedEntityDecl(" + name + "," + publicId + "," +
- systemId + "," + notation + ")");
+ saxLog.debug("unparsedEntityDecl(" + name + "," + publicId + "," + systemId + ","
+ + notation + ")");
}
}
@@ -1394,7 +1326,7 @@ public class Digester extends DefaultHandler2 {
* This must be called before the first call to <code>parse()</code>.
* @param entityResolver a class that implement the <code>EntityResolver</code> interface.
*/
- public void setEntityResolver(EntityResolver entityResolver){
+ public void setEntityResolver(EntityResolver entityResolver) {
this.entityResolver = entityResolver;
}
@@ -1403,17 +1335,17 @@ public class Digester extends DefaultHandler2 {
* Return the Entity Resolver used by the SAX parser.
* @return Return the Entity Resolver used by the SAX parser.
*/
- public EntityResolver getEntityResolver(){
+ public EntityResolver getEntityResolver() {
return entityResolver;
}
@Override
- public InputSource resolveEntity(String name, String publicId,
- String baseURI, String systemId) throws SAXException, IOException {
+ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId)
+ throws SAXException, IOException {
if (saxLog.isDebugEnabled()) {
- saxLog.debug("resolveEntity('" + publicId + "', '" + systemId +
- "', '" + baseURI + "')");
+ saxLog.debug(
+ "resolveEntity('" + publicId + "', '" + systemId + "', '" + baseURI + "')");
}
// Has this system identifier been registered?
@@ -1428,13 +1360,12 @@ public class Digester extends DefaultHandler2 {
if (log.isDebugEnabled()) {
log.debug(" Cannot resolve entity: '" + publicId + "'");
}
- return (null);
+ return null;
} else {
// try to resolve using system ID
if (log.isDebugEnabled()) {
- log.debug(" Trying to resolve using system ID '" +
- systemId + "'");
+ log.debug(" Trying to resolve using system ID '" + systemId + "'");
}
entityURL = systemId;
// resolve systemId against baseURI if it is not absolute
@@ -1446,8 +1377,7 @@ public class Digester extends DefaultHandler2 {
}
} catch (URISyntaxException e) {
if (log.isDebugEnabled()) {
- log.debug("Invalid URI '" + baseURI + "' or '" +
- systemId + "'");
+ log.debug("Invalid URI '" + baseURI + "' or '" + systemId + "'");
}
}
}
@@ -1460,7 +1390,7 @@ public class Digester extends DefaultHandler2 {
}
try {
- return (new InputSource(entityURL));
+ return new InputSource(entityURL);
} catch (Exception e) {
throw createSAXException(e);
}
@@ -1470,8 +1400,7 @@ public class Digester extends DefaultHandler2 {
// ----------------------------------------------- LexicalHandler Methods
@Override
- public void startDTD(String name, String publicId, String systemId)
- throws SAXException {
+ public void startDTD(String name, String publicId, String systemId) throws SAXException {
setPublicId(publicId);
}
@@ -1488,14 +1417,12 @@ public class Digester extends DefaultHandler2 {
*/
@Override
public void error(SAXParseException exception) throws SAXException {
-
log.error("Parse Error at line " + exception.getLineNumber() +
" column " + exception.getColumnNumber() + ": " +
exception.getMessage(), exception);
if (errorHandler != null) {
errorHandler.error(exception);
}
-
}
@@ -1509,14 +1436,12 @@ public class Digester extends DefaultHandler2 {
*/
@Override
public void fatalError(SAXParseException exception) throws SAXException {
-
log.error("Parse Fatal Error at line " + exception.getLineNumber() +
" column " + exception.getColumnNumber() + ": " +
exception.getMessage(), exception);
if (errorHandler != null) {
errorHandler.fatalError(exception);
}
-
}
@@ -1548,34 +1473,32 @@ public class Digester extends DefaultHandler2 {
* the root element from the object stack (if any).
*
* @param file File containing the XML data to be parsed
- *
+ * @return the root object
* @exception IOException if an input/output error occurs
* @exception SAXException if a parsing exception occurs
*/
public Object parse(File file) throws IOException, SAXException {
-
configure();
InputSource input = new InputSource(new FileInputStream(file));
input.setSystemId("file://" + file.getAbsolutePath());
getXMLReader().parse(input);
- return (root);
-
+ return root;
}
+
+
/**
* Parse the content of the specified input source using this Digester.
* Returns the root element from the object stack (if any).
*
* @param input Input source containing the XML data to be parsed
- *
+ * @return the root object
* @exception IOException if an input/output error occurs
* @exception SAXException if a parsing exception occurs
*/
public Object parse(InputSource input) throws IOException, SAXException {
-
configure();
getXMLReader().parse(input);
- return (root);
-
+ return root;
}
@@ -1584,17 +1507,15 @@ public class Digester extends DefaultHandler2 {
* Returns the root element from the object stack (if any).
*
* @param input Input stream containing the XML data to be parsed
- *
+ * @return the root object
* @exception IOException if an input/output error occurs
* @exception SAXException if a parsing exception occurs
*/
public Object parse(InputStream input) throws IOException, SAXException {
-
configure();
InputSource is = new InputSource(input);
getXMLReader().parse(is);
- return (root);
-
+ return root;
}
@@ -1704,7 +1625,6 @@ public class Digester extends DefaultHandler2 {
setRuleNamespaceURI(newNamespaceURI);
ruleSet.addRuleInstances(this);
setRuleNamespaceURI(oldNamespaceURI);
-
}
@@ -1717,9 +1637,7 @@ public class Digester extends DefaultHandler2 {
*/
public void addCallMethod(String pattern, String methodName) {
- addRule(
- pattern,
- new CallMethodRule(methodName));
+ addRule(pattern, new CallMethodRule(methodName));
}
@@ -1732,11 +1650,9 @@ public class Digester extends DefaultHandler2 {
* for a single parameter from the body of this element)
* @see CallMethodRule
*/
- public void addCallMethod(String pattern, String methodName,
- int paramCount) {
+ public void addCallMethod(String pattern, String methodName, int paramCount) {
- addRule(pattern,
- new CallMethodRule(methodName, paramCount));
+ addRule(pattern, new CallMethodRule(methodName, paramCount));
}
@@ -1810,8 +1726,7 @@ public class Digester extends DefaultHandler2 {
*/
public void addCallParam(String pattern, int paramIndex) {
- addRule(pattern,
- new CallParamRule(paramIndex));
+ addRule(pattern, new CallParamRule(paramIndex));
}
@@ -1999,14 +1914,9 @@ public class Digester extends DefaultHandler2 {
* object creation will be ignored.
* @see FactoryCreateRule
*/
- public void addFactoryCreate(
- String pattern,
- String className,
- boolean ignoreCreateExceptions) {
+ public void addFactoryCreate(String pattern, String className, boolean ignoreCreateExceptions) {
- addRule(
- pattern,
- new FactoryCreateRule(className, ignoreCreateExceptions));
+ addRule(pattern, new FactoryCreateRule(className, ignoreCreateExceptions));
}
@@ -2370,16 +2280,15 @@ public class Digester extends DefaultHandler2 {
/**
* Return the top object on the stack without removing it. If there are
* no objects on the stack, return <code>null</code>.
+ * @return the top object
*/
public Object peek() {
-
try {
- return (stack.peek());
+ return stack.peek();
} catch (EmptyStackException e) {
log.warn("Empty stack (returning null)");
- return (null);
+ return null;
}
-
}
@@ -2390,32 +2299,30 @@ public class Digester extends DefaultHandler2 {
*
* @param n Index of the desired element, where 0 is the top of the stack,
* 1 is the next element down, and so on.
+ * @return the specified object
*/
public Object peek(int n) {
-
try {
- return (stack.peek(n));
+ return stack.peek(n);
} catch (EmptyStackException e) {
log.warn("Empty stack (returning null)");
- return (null);
+ return null;
}
-
}
/**
* Pop the top object off of the stack, and return it. If there are
* no objects on the stack, return <code>null</code>.
+ * @return the top object
*/
public Object pop() {
-
try {
- return (stack.pop());
+ return stack.pop();
} catch (EmptyStackException e) {
log.warn("Empty stack (returning null)");
- return (null);
+ return null;
}
-
}
@@ -2625,16 +2532,15 @@ public class Digester extends DefaultHandler2 {
*
* <p>The parameters stack is used to store <code>CallMethodRule</code> parameters.
* See {@link #params}.</p>
+ * @return the top object on the parameters stack
*/
public Object peekParams() {
-
try {
- return (params.peek());
+ return params.peek();
} catch (EmptyStackException e) {
log.warn("Empty stack (returning null)");
- return (null);
+ return null;
}
-
}
@@ -2667,19 +2573,18 @@ public class Digester extends DefaultHandler2 {
*
* <p>The parameters stack is used to store <code>CallMethodRule</code> parameters.
* See {@link #params}.</p>
+ * @return the top object on the parameters stack
*/
public Object popParams() {
-
try {
if (log.isTraceEnabled()) {
log.trace("Popping params");
}
- return (params.pop());
+ return params.pop();
} catch (EmptyStackException e) {
log.warn("Empty stack (returning null)");
- return (null);
+ return null;
}
-
}
@@ -2702,12 +2607,12 @@ public class Digester extends DefaultHandler2 {
/**
* Create a SAX exception which also understands about the location in
* the digester file where the exception occurs
- *
+ * @param message The error message
+ * @param e The root cause
* @return the new exception
*/
public SAXException createSAXException(String message, Exception e) {
- if ((e != null) &&
- (e instanceof InvocationTargetException)) {
+ if ((e != null) && (e instanceof InvocationTargetException)) {
Throwable t = e.getCause();
if (t instanceof ThreadDeath) {
throw (ThreadDeath) t;
@@ -2739,7 +2644,7 @@ public class Digester extends DefaultHandler2 {
/**
* Create a SAX exception which also understands about the location in
* the digester file where the exception occurs
- *
+ * @param e The root cause
* @return the new exception
*/
public SAXException createSAXException(Exception e) {
@@ -2761,7 +2666,7 @@ public class Digester extends DefaultHandler2 {
/**
* Create a SAX exception which also understands about the location in
* the digester file where the exception occurs
- *
+ * @param message The error message
* @return the new exception
*/
public SAXException createSAXException(String message) {
@@ -2789,8 +2694,7 @@ public class Digester extends DefaultHandler2 {
String value = newAttrs.getValue(i);
try {
newAttrs.setValue(i, IntrospectionUtils.replaceProperties(value, null, source).intern());
- }
- catch (Exception e) {
+ } catch (Exception e) {
log.warn("Attribute [" + newAttrs.getLocalName(i) + "] failed to update and remains [" + value + "].", e);
}
}
@@ -2809,11 +2713,11 @@ public class Digester extends DefaultHandler2 {
String out;
try {
out = IntrospectionUtils.replaceProperties(in, null, source);
- } catch(Exception e) {
+ } catch (Exception e) {
return bodyText; // return unchanged data
}
- if (out == in) {
+ if (out == in) {
// No substitutions required. Don't waste memory creating
// a new buffer
return bodyText;
@@ -2821,6 +2725,4 @@ public class Digester extends DefaultHandler2 {
return new StringBuilder(out);
}
}
-
-
}
diff --git a/java/org/apache/tomcat/util/http/CookieSupport.java b/java/org/apache/tomcat/util/http/CookieSupport.java
index 6870a39..ada5235 100644
--- a/java/org/apache/tomcat/util/http/CookieSupport.java
+++ b/java/org/apache/tomcat/util/http/CookieSupport.java
@@ -38,7 +38,7 @@ public final class CookieSupport {
/**
* If true, separators that are not explicitly dis-allowed by the v0 cookie
* spec but are disallowed by the HTTP spec will be allowed in v0 cookie
- * names and values. These characters are: \"()/:<=>?@[\\]{} Note that the
+ * names and values. These characters are: \"()/:<=>?@[\\]{} Note that the
* inclusion of / depends on the value of {@link #FWD_SLASH_IS_SEPARATOR}.
*/
public static final boolean ALLOW_HTTP_SEPARATORS_IN_V0;
diff --git a/java/org/apache/tomcat/util/log/SystemLogHandler.java b/java/org/apache/tomcat/util/log/SystemLogHandler.java
index cc41d08..570ad74 100644
--- a/java/org/apache/tomcat/util/log/SystemLogHandler.java
+++ b/java/org/apache/tomcat/util/log/SystemLogHandler.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.tomcat.util.log;
import java.io.IOException;
@@ -40,6 +39,8 @@ public class SystemLogHandler extends PrintStream {
/**
* Construct the handler to capture the output of the given steam.
+ *
+ * @param wrapped The stream to capture
*/
public SystemLogHandler(PrintStream wrapped) {
super(wrapped);
@@ -57,7 +58,7 @@ public class SystemLogHandler extends PrintStream {
/**
- * Thread <-> CaptureLog associations.
+ * Thread <-> CaptureLog associations.
*/
protected static ThreadLocal<Stack<CaptureLog>> logs =
new ThreadLocal<Stack<CaptureLog>>();
@@ -96,7 +97,9 @@ public class SystemLogHandler extends PrintStream {
/**
- * Stop capturing thread's output and return captured data as a String.
+ * Stop capturing thread's output.
+ *
+ * @return The captured data
*/
public static String stopCapture() {
Stack<CaptureLog> stack = logs.get();
@@ -119,6 +122,7 @@ public class SystemLogHandler extends PrintStream {
/**
* Find PrintStream to which the output must be written to.
+ * @return the print stream
*/
protected PrintStream findStream() {
Stack<CaptureLog> stack = logs.get();
diff --git a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
index 81be8b8..fbf4877 100644
--- a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
+++ b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
@@ -100,7 +100,9 @@ import org.apache.juli.logging.LogFactory;
* @author Craig R. McClanahan
* @author Costin Manolache
*/
-public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBeanNotificationBroadcaster {
+public class BaseModelMBean implements DynamicMBean, MBeanRegistration,
+ ModelMBeanNotificationBroadcaster {
+
private static final Log log = LogFactory.getLog(BaseModelMBean.class);
// ----------------------------------------------------------- Constructors
@@ -209,7 +211,7 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
// Return the results of this method invocation
// FIXME - should we validate the return type?
- return (result);
+ return result;
}
@@ -237,7 +239,7 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
// is the indication of a getter problem
}
}
- return (response);
+ return response;
}
@@ -322,7 +324,7 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
// Return the results of this method invocation
// FIXME - should we validate the return type?
- return (result);
+ return result;
}
@@ -485,7 +487,7 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
}
}
- return (getAttributes(names));
+ return getAttributes(names);
}
@@ -497,6 +499,7 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
* Get the instance handle of the object against which we execute
* all methods in this ModelMBean management interface.
*
+ * @return the backend managed object
* @exception InstanceNotFoundException if the managed resource object
* cannot be found
* @exception InvalidTargetObjectTypeException if the managed resource
@@ -524,11 +527,7 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
* Set the instance handle of the object against which we will execute
* all methods in this ModelMBean management interface.
*
- * <strike>This method will detect and call "setModelMbean" method. A resource
- * can implement this method to get a reference to the model mbean.
- * The reference can be used to send notification and access the
- * registry.
- * </strike> The caller can provide the mbean instance or the object name to
+ * The caller can provide the mbean instance or the object name to
* the resource, if needed.
*
* @param resource The resource object to be managed
@@ -861,7 +860,7 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
// Copy remaining notifications as reported by the application
System.arraycopy(current, 0, response, 2, current.length);
- return (response);
+ return response;
}
@@ -935,127 +934,6 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
}
- // ------------------------------------------------ PersistentMBean Methods
-
-
-// /**
-// * Instantiates this MBean instance from data found in the persistent
-// * store. The data loaded could include attribute and operation values.
-// * This method should be called during construction or initialization
-// * of the instance, and before the MBean is registered with the
-// * <code>MBeanServer</code>.
-// *
-// * <p><strong>IMPLEMENTATION NOTE</strong> - This implementation does
-// * not support persistence.</p>
-// *
-// * @exception InstanceNotFoundException if the managed resource object
-// * cannot be found
-// * @exception MBeanException if the initializer of the object throws
-// * an exception
-// * @exception RuntimeOperationsException if an exception is reported
-// * by the persistence mechanism
-// */
-// public void load() throws InstanceNotFoundException,
-// MBeanException, RuntimeOperationsException {
-// // XXX If a context was set, use it to load the data
-// throw new MBeanException
-// (new IllegalStateException("Persistence is not supported"),
-// "Persistence is not supported");
-//
-// }
-
-
-// /**
-// * Capture the current state of this MBean instance and write it out
-// * to the persistent store. The state stored could include attribute
-// * and operation values. If one of these methods of persistence is not
-// * supported, a "service not found" exception will be thrown.
-// *
-// * <p><strong>IMPLEMENTATION NOTE</strong> - This implementation does
-// * not support persistence.</p>
-// *
-// * @exception InstanceNotFoundException if the managed resource object
-// * cannot be found
-// * @exception MBeanException if the initializer of the object throws
-// * an exception, or persistence is not supported
-// * @exception RuntimeOperationsException if an exception is reported
-// * by the persistence mechanism
-// */
-// public void store() throws InstanceNotFoundException,
-// MBeanException, RuntimeOperationsException {
-//
-// // XXX if a context was set, use it to store the data
-// throw new MBeanException
-// (new IllegalStateException("Persistence is not supported"),
-// "Persistence is not supported");
-//
-// }
-
- // -------------------- BaseModelMBean methods --------------------
-
-// /** Set the type of the mbean. This is used as a key to locate
-// * the description in the Registry.
-// *
-// * @param type the type of classname of the modeled object
-// */
-// void setModeledType( String type ) {
-// initModelInfo(type);
-// createResource();
-// }
-// /** Set the type of the mbean. This is used as a key to locate
-// * the description in the Registry.
-// *
-// * @param type the type of classname of the modeled object
-// */
-// void initModelInfo( String type ) {
-// try {
-// if( log.isDebugEnabled())
-// log.debug("setModeledType " + type);
-//
-// log.debug( "Set model Info " + type);
-// if(type==null) {
-// return;
-// }
-// resourceType=type;
-// //Thread.currentThread().setContextClassLoader(BaseModelMBean.class.getClassLoader());
-// Class c=null;
-// try {
-// c=Class.forName( type);
-// } catch( Throwable t ) {
-// log.debug( "Error creating class " + t);
-// }
-//
-// // The class c doesn't need to exist
-// ManagedBean descriptor=getRegistry().findManagedBean(c, type);
-// if( descriptor==null )
-// return;
-// this.setModelMBeanInfo(descriptor.createMBeanInfo());
-// } catch( Throwable ex) {
-// log.error( "TCL: " + Thread.currentThread().getContextClassLoader(),
-// ex);
-// }
-// }
-
-// /** Set the type of the mbean. This is used as a key to locate
-// * the description in the Registry.
-// */
-// protected void createResource() {
-// try {
-// //Thread.currentThread().setContextClassLoader(BaseModelMBean.class.getClassLoader());
-// Class c=null;
-// try {
-// c=Class.forName( resourceType );
-// resource = c.newInstance();
-// } catch( Throwable t ) {
-// log.error( "Error creating class " + t);
-// }
-// } catch( Throwable ex) {
-// log.error( "TCL: " + Thread.currentThread().getContextClassLoader(),
-// ex);
-// }
-// }
-
-
public String getModelerType() {
return resourceType;
}
@@ -1076,44 +954,6 @@ public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBe
}
}
-// public void setRegistry(Registry registry) {
-// this.registry = registry;
-// }
-//
-// public Registry getRegistry() {
-// // XXX Need a better solution - to avoid the static
-// if( registry == null )
-// registry=Registry.getRegistry();
-//
-// return registry;
-// }
-
- // ------------------------------------------------------ Protected Methods
-
-
-// /**
-// * Create and return a default <code>ModelMBeanInfo</code> object.
-// */
-// protected ModelMBeanInfo createDefaultModelMBeanInfo() {
-//
-// return (new ModelMBeanInfoSupport(this.getClass().getName(),
-// "Default ModelMBean",
-// null, null, null, null));
-//
-// }
-
-// /**
-// * Is the specified <code>ModelMBeanInfo</code> instance valid?
-// *
-// * <p><strong>IMPLEMENTATION NOTE</strong> - This implementation
-// * does not check anything, but this method can be overridden
-// * as required.</p>
-// *
-// * @param info The <code>ModelMBeanInfo object to check
-// */
-// protected boolean isModelMBeanInfoValid(ModelMBeanInfo info) {
-// return (true);
-// }
// -------------------- Registration --------------------
// XXX We can add some method patterns here- like setName() and
diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 9ae615c..b5f3936 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -42,6 +42,7 @@ import org.apache.tomcat.util.threads.ResizableExecutor;
import org.apache.tomcat.util.threads.TaskQueue;
import org.apache.tomcat.util.threads.TaskThreadFactory;
import org.apache.tomcat.util.threads.ThreadPoolExecutor;
+
/**
*
* @author fhanik
@@ -67,6 +68,8 @@ public abstract class AbstractEndpoint<S> {
/**
* Obtain the GlobalRequestProcessor associated with the handler.
+ *
+ * @return the GlobalRequestProcessor
*/
public Object getGlobal();
@@ -227,7 +230,7 @@ public abstract class AbstractEndpoint<S> {
private Executor executor = null;
public void setExecutor(Executor executor) {
this.executor = executor;
- this.internalExecutor = (executor==null);
+ this.internalExecutor = (executor == null);
}
public Executor getExecutor() { return executor; }
@@ -248,8 +251,9 @@ public abstract class AbstractEndpoint<S> {
public InetAddress getAddress() { return address; }
public void setAddress(InetAddress address) { this.address = address; }
+
/**
- * Allows the server developer to specify the backlog that
+ * Allows the server developer to specify the acceptCount (backlog) that
* should be used for server sockets. By default, this value
* is 100.
*/
@@ -286,6 +290,9 @@ public abstract class AbstractEndpoint<S> {
/**
* Socket TCP no delay.
+ *
+ * @return The current TCP no delay setting for sockets created by this
+ * endpoint
*/
public boolean getTcpNoDelay() { return socketProperties.getTcpNoDelay();}
public void setTcpNoDelay(boolean tcpNoDelay) { socketProperties.setTcpNoDelay(tcpNoDelay); }
@@ -293,6 +300,9 @@ public abstract class AbstractEndpoint<S> {
/**
* Socket linger.
+ *
+ * @return The current socket linger time for sockets created by this
+ * endpoint
*/
public int getSoLinger() { return socketProperties.getSoLingerTime(); }
public void setSoLinger(int soLinger) {
@@ -303,6 +313,8 @@ public abstract class AbstractEndpoint<S> {
/**
* Socket timeout.
+ *
+ * @return The current socket timeout for sockets created by this endpoint
*/
public int getSoTimeout() { return socketProperties.getSoTimeout(); }
public void setSoTimeout(int soTimeout) { socketProperties.setSoTimeout(soTimeout); }
@@ -446,14 +458,16 @@ public abstract class AbstractEndpoint<S> {
* sub-component is the
* {@link org.apache.tomcat.util.net.ServerSocketFactory}.
*/
- protected HashMap<String, Object> attributes =
- new HashMap<String, Object>();
+ protected HashMap<String, Object> attributes = new HashMap<String, Object>();
/**
* Generic property setter called when a property for which a specific
* setter already exists within the
* {@link org.apache.coyote.ProtocolHandler} needs to be made available to
* sub-components. The specific setter will call this method to populate the
* attributes.
+ *
+ * @param name Name of property to set
+ * @param value The value to set the property to
*/
public void setAttribute(String name, Object value) {
if (getLog().isTraceEnabled()) {
@@ -464,6 +478,11 @@ public abstract class AbstractEndpoint<S> {
}
/**
* Used by sub-components to retrieve configuration information.
+ *
+ * @param key The name of the property for which the value should be
+ * retrieved
+ *
+ * @return The value of the specified property
*/
public Object getAttribute(String key) {
Object value = attributes.get(key);
@@ -500,11 +519,12 @@ public abstract class AbstractEndpoint<S> {
* @return the amount of threads that are managed by the pool
*/
public int getCurrentThreadCount() {
- if (executor!=null) {
+ Executor executor = this.executor;
+ if (executor != null) {
if (executor instanceof ThreadPoolExecutor) {
- return ((ThreadPoolExecutor)executor).getPoolSize();
+ return ((ThreadPoolExecutor) executor).getPoolSize();
} else if (executor instanceof ResizableExecutor) {
- return ((ResizableExecutor)executor).getPoolSize();
+ return ((ResizableExecutor) executor).getPoolSize();
} else {
return -1;
}
@@ -519,11 +539,12 @@ public abstract class AbstractEndpoint<S> {
* @return the amount of threads that are in use
*/
public int getCurrentThreadsBusy() {
- if (executor!=null) {
+ Executor executor = this.executor;
+ if (executor != null) {
if (executor instanceof ThreadPoolExecutor) {
- return ((ThreadPoolExecutor)executor).getActiveCount();
+ return ((ThreadPoolExecutor) executor).getActiveCount();
} else if (executor instanceof ResizableExecutor) {
- return ((ResizableExecutor)executor).getActiveCount();
+ return ((ResizableExecutor) executor).getActiveCount();
} else {
return -1;
}
@@ -550,8 +571,10 @@ public abstract class AbstractEndpoint<S> {
}
public void shutdownExecutor() {
- if ( executor!=null && internalExecutor ) {
- if ( executor instanceof ThreadPoolExecutor ) {
+ Executor executor = this.executor;
+ if (executor != null && internalExecutor) {
+ this.executor = null;
+ if (executor instanceof ThreadPoolExecutor) {
//this is our internal one, so we need to shut it down
ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor;
tpe.shutdownNow();
@@ -569,7 +592,6 @@ public abstract class AbstractEndpoint<S> {
TaskQueue queue = (TaskQueue) tpe.getQueue();
queue.setParent(null);
}
- executor = null;
}
}
@@ -1021,8 +1043,8 @@ public abstract class AbstractEndpoint<S> {
* Configures SSLEngine to honor cipher suites ordering based upon
* endpoint configuration.
*
- * @throws InvalidAlgorithmParameterException If the runtime JVM doesn't
- * support this setting.
+ * @throws java.security.InvalidAlgorithmParameterException If the runtime
+ * JVM doesn't support this setting.
*/
protected void configureUseServerCipherSuitesOrder(SSLEngine engine) {
String useServerCipherSuitesOrderStr = this
diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index 5872735..24884d1e 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -34,12 +34,8 @@ import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
/**
- *
* Implementation of a secure socket channel
- * @author Filip Hanik
- * @version 1.0
*/
-
public class SecureNioChannel extends NioChannel {
protected static final Log log = LogFactory.getLog(SecureNioChannel.class);
@@ -104,27 +100,28 @@ public class SecureNioChannel extends NioChannel {
return size;
}
-
//===========================================================================================
// NIO SSL METHODS
//===========================================================================================
+
/**
* Flush the channel.
*
* @param block Should a blocking write be used?
- * @param s
- * @param timeout
+ * @param s The selector to use for blocking, if null then a busy
+ * write will be initiated
+ * @param timeout The timeout for this write operation in milliseconds,
+ * -1 means no timeout
* @return <code>true</code> if the network buffer has been flushed out and
* is empty else <code>false</code>
- * @throws IOException
+ * @throws IOException If an I/O error occurs during the operation
*/
@Override
- public boolean flush(boolean block, Selector s, long timeout)
- throws IOException {
+ public boolean flush(boolean block, Selector s, long timeout) throws IOException {
if (!block) {
flush(netOutBuffer);
} else {
- pool.write(netOutBuffer, this, s, timeout,block);
+ pool.write(netOutBuffer, this, s, timeout, block);
}
return !netOutBuffer.hasRemaining();
}
@@ -133,28 +130,33 @@ public class SecureNioChannel extends NioChannel {
* Flushes the buffer to the network, non blocking
* @param buf ByteBuffer
* @return boolean true if the buffer has been emptied out, false otherwise
- * @throws IOException
+ * @throws IOException An IO error occurred writing data
*/
protected boolean flush(ByteBuffer buf) throws IOException {
int remaining = buf.remaining();
- if ( remaining > 0 ) {
- int written = sc.write(buf);
- return written >= remaining;
- }else {
+ if (remaining > 0) {
+ return (sc.write(buf) >= remaining);
+ } else {
return true;
}
}
/**
- * Performs SSL handshake, non blocking, but performs NEED_TASK on the same thread.<br>
- * Hence, you should never call this method using your Acceptor thread, as you would slow down
- * your system significantly.<br>
- * The return for this operation is 0 if the handshake is complete and a positive value if it is not complete.
- * In the event of a positive value coming back, reregister the selection key for the return values interestOps.
+ * Performs SSL handshake, non blocking, but performs NEED_TASK on the same
+ * thread. Hence, you should never call this method using your Acceptor
+ * thread, as you would slow down your system significantly. If the return
+ * value from this method is positive, the selection key should be
+ * registered interestOps given by the return value.
+ *
* @param read boolean - true if the underlying channel is readable
* @param write boolean - true if the underlying channel is writable
- * @return int - 0 if hand shake is complete, otherwise it returns a SelectionKey interestOps value
- * @throws IOException
+ *
+ * @return 0 if hand shake is complete, -1 if an error (other than an
+ * IOException) occurred, otherwise it returns a SelectionKey
+ * interestOps value
+ *
+ * @throws IOException If an I/O error occurs during the handshake or if the
+ * handshake fails during wrapping or unwrapping
*/
@Override
public int handshake(boolean read, boolean write) throws IOException {
@@ -283,8 +285,18 @@ public class SecureNioChannel extends NioChannel {
IOException x = new IOException(cx);
throw x;
} finally {
- if (key!=null) try {key.cancel();} catch (Exception ignore) {}
- if (selector!=null) try {selector.close();} catch (Exception ignore) {}
+ if (key != null) {
+ try {
+ key.cancel();
+ } catch (Exception ignore) {
+ }
+ }
+ if (selector != null) {
+ try {
+ selector.close();
+ } catch (Exception ignore) {
+ }
+ }
}
}
@@ -292,11 +304,11 @@ public class SecureNioChannel extends NioChannel {
/**
* Executes all the tasks needed on the same thread.
- * @return HandshakeStatus
+ * @return the status
*/
protected SSLEngineResult.HandshakeStatus tasks() {
Runnable r = null;
- while ( (r = sslEngine.getDelegatedTask()) != null) {
+ while ((r = sslEngine.getDelegatedTask()) != null) {
r.run();
}
return sslEngine.getHandshakeStatus();
@@ -305,8 +317,8 @@ public class SecureNioChannel extends NioChannel {
/**
* Performs the WRAP function
* @param doWrite boolean
- * @return SSLEngineResult
- * @throws IOException
+ * @return the result
+ * @throws IOException An IO error occurred
*/
protected SSLEngineResult handshakeWrap(boolean doWrite) throws IOException {
//this should never be called with a network buffer that contains data
@@ -319,15 +331,17 @@ public class SecureNioChannel extends NioChannel {
//set the status
handshakeStatus = result.getHandshakeStatus();
//optimization, if we do have a writable channel, write it now
- if ( doWrite ) flush(netOutBuffer);
+ if (doWrite) {
+ flush(netOutBuffer);
+ }
return result;
}
/**
* Perform handshake unwrap
* @param doread boolean
- * @return SSLEngineResult
- * @throws IOException
+ * @return the result
+ * @throws IOException An IO error occurred
*/
protected SSLEngineResult handshakeUnwrap(boolean doread) throws IOException {
@@ -335,10 +349,12 @@ public class SecureNioChannel extends NioChannel {
//clear the buffer if we have emptied it out on data
netInBuffer.clear();
}
- if ( doread ) {
+ if (doread) {
//if we have data to read, read it
int read = sc.read(netInBuffer);
- if (read == -1) throw new IOException("EOF encountered during handshake.");
+ if (read == -1) {
+ throw new IOException("EOF encountered during handshake.");
+ }
}
SSLEngineResult result;
boolean cont = false;
@@ -365,20 +381,22 @@ public class SecureNioChannel extends NioChannel {
}
/**
- * Sends a SSL close message, will not physically close the connection here.<br>
- * To close the connection, you could do something like
+ * Sends a SSL close message, will not physically close the connection here.
+ * <br>To close the connection, you could do something like
* <pre><code>
* close();
- * while (isOpen() && !myTimeoutFunction()) Thread.sleep(25);
+ * while (isOpen() && !myTimeoutFunction()) Thread.sleep(25);
* if ( isOpen() ) close(true); //forces a close if you timed out
* </code></pre>
* @throws IOException if an I/O error occurs
- * @throws IOException if there is data on the outgoing network buffer and we are unable to flush it
- * TODO Implement this java.io.Closeable method
+ * @throws IOException if there is data on the outgoing network buffer and
+ * we are unable to flush it
*/
@Override
public void close() throws IOException {
- if (closing) return;
+ if (closing) {
+ return;
+ }
closing = true;
sslEngine.closeOutbound();
@@ -402,17 +420,13 @@ public class SecureNioChannel extends NioChannel {
closed = (!netOutBuffer.hasRemaining() && (handshake.getHandshakeStatus() != HandshakeStatus.NEED_WRAP));
}
- /**
- * Force a close, can throw an IOException
- * @param force boolean
- * @throws IOException
- */
+
@Override
public void close(boolean force) throws IOException {
try {
close();
- }finally {
- if ( force || closed ) {
+ } finally {
+ if (force || closed) {
closed = true;
sc.socket().close();
sc.close();
@@ -424,22 +438,29 @@ public class SecureNioChannel extends NioChannel {
* Reads a sequence of bytes from this channel into the given buffer.
*
* @param dst The buffer into which bytes are to be transferred
- * @return The number of bytes read, possibly zero, or <code>-1</code> if the channel has reached end-of-stream
+ * @return The number of bytes read, possibly zero, or <code>-1</code> if
+ * the channel has reached end-of-stream
* @throws IOException If some other I/O error occurs
- * @throws IllegalArgumentException if the destination buffer is different than bufHandler.getReadBuffer()
- * TODO Implement this java.nio.channels.ReadableByteChannel method
+ * @throws IllegalArgumentException if the destination buffer is different
+ * than getBufHandler().getReadBuffer()
*/
@Override
public int read(ByteBuffer dst) throws IOException {
//are we in the middle of closing or closed?
- if ( closing || closed) return -1;
+ if (closing || closed) {
+ return -1;
+ }
//did we finish our handshake?
- if (!handshakeComplete) throw new IllegalStateException("Handshake incomplete, you must complete handshake before reading data.");
+ if (!handshakeComplete) {
+ throw new IllegalStateException("Handshake incomplete, you must complete handshake before reading data.");
+ }
//read from the network
int netread = sc.read(netInBuffer);
//did we reach EOF? if so send EOF up one layer.
- if (netread == -1) return -1;
+ if (netread == -1) {
+ return -1;
+ }
//the data read
int read = 0;
@@ -453,18 +474,22 @@ public class SecureNioChannel extends NioChannel {
//compact the buffer
netInBuffer.compact();
- if ( unwrap.getStatus()==Status.OK || unwrap.getStatus()==Status.BUFFER_UNDERFLOW ) {
+ if (unwrap.getStatus() == Status.OK || unwrap.getStatus() == Status.BUFFER_UNDERFLOW) {
//we did receive some data, add it to our total
read += unwrap.bytesProduced();
//perform any tasks if needed
- if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks();
+ if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ tasks();
+ }
//if we need more network data, then bail out for now.
- if ( unwrap.getStatus() == Status.BUFFER_UNDERFLOW ) break;
- }else if ( unwrap.getStatus()==Status.BUFFER_OVERFLOW && read>0 ) {
+ if (unwrap.getStatus() == Status.BUFFER_UNDERFLOW) {
+ break;
+ }
+ } else if (unwrap.getStatus()==Status.BUFFER_OVERFLOW && read>0) {
//buffer overflow can happen, if we have read data, then
//empty out the dst buffer before we do another read
break;
- }else {
+ } else {
//here we should trap BUFFER_OVERFLOW and call expand on the buffer
//for now, throw an exception, as we initialized the buffers
//in the constructor
@@ -480,35 +505,32 @@ public class SecureNioChannel extends NioChannel {
* @param src The buffer from which bytes are to be retrieved
* @return The number of bytes written, possibly zero
* @throws IOException If some other I/O error occurs
- * TODO Implement this java.nio.channels.WritableByteChannel method
*/
@Override
public int write(ByteBuffer src) throws IOException {
checkInterruptStatus();
- if ( src == this.netOutBuffer ) {
+ if (src == this.netOutBuffer) {
//we can get here through a recursive call
//by using the NioBlockingSelector
int written = sc.write(src);
return written;
} else {
- //are we closing or closed?
- if ( closing || closed) throw new IOException("Channel is in closing state.");
-
- //the number of bytes written
- int written = 0;
+ // Are we closing or closed?
+ if (closing || closed) {
+ throw new IOException("Channel is in closing state.");
+ }
if (!flush(netOutBuffer)) {
- //we haven't emptied out the buffer yet
- return written;
+ // We haven't emptied out the buffer yet
+ return 0;
}
- /*
- * The data buffer is empty, we can reuse the entire buffer.
- */
+ // The data buffer is empty, we can reuse the entire buffer.
netOutBuffer.clear();
SSLEngineResult result = sslEngine.wrap(src, netOutBuffer);
- written = result.bytesConsumed();
+ // The number of bytes written
+ int written = result.bytesConsumed();
netOutBuffer.flip();
if (result.getStatus() == Status.OK) {
@@ -517,7 +539,7 @@ public class SecureNioChannel extends NioChannel {
throw new IOException("Unable to wrap data, invalid engine state: " +result.getStatus());
}
- //force a flush
+ // Force a flush
flush(netOutBuffer);
return written;
diff --git a/java/org/apache/tomcat/util/net/SocketProperties.java b/java/org/apache/tomcat/util/net/SocketProperties.java
index 0216954..f84b71a 100644
--- a/java/org/apache/tomcat/util/net/SocketProperties.java
+++ b/java/org/apache/tomcat/util/net/SocketProperties.java
@@ -24,8 +24,6 @@ import java.net.SocketException;
* Properties that can be set in the <Connector> element
* in server.xml. All properties are prefixed with "socket."
* and are currently only working for the Nio connector
- *
- * @author Filip Hanik
*/
public class SocketProperties {
/**
@@ -52,7 +50,7 @@ public class SocketProperties {
* Default is 500
* -1 is unlimited
* 0 is disabled
- * >0 the max number of objects to keep in cache.
+ * >0 the max number of objects to keep in cache.
*/
protected int eventCache = 500;
@@ -195,8 +193,13 @@ public class SocketProperties {
soLingerTime.intValue());
if (soTimeout != null && soTimeout.intValue() >= 0)
socket.setSoTimeout(soTimeout.intValue());
- if (tcpNoDelay != null)
- socket.setTcpNoDelay(tcpNoDelay.booleanValue());
+ if (tcpNoDelay != null) {
+ try {
+ socket.setTcpNoDelay(tcpNoDelay.booleanValue());
+ } catch (SocketException e) {
+ // Some socket types may not support this option which is set by default
+ }
+ }
}
public void setProperties(ServerSocket socket) throws SocketException{
@@ -399,6 +402,4 @@ public class SocketProperties {
public void setUnlockTimeout(int unlockTimeout) {
this.unlockTimeout = unlockTimeout;
}
-
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org