This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new fb921d8855 Code and javadoc cleanup in Jasper fb921d8855 is described below commit fb921d8855d78ec7ba815b5e58c9ce7c72503109 Author: remm <r...@apache.org> AuthorDate: Mon May 27 16:57:36 2024 +0200 Code and javadoc cleanup in Jasper --- java/org/apache/jasper/EmbeddedServletOptions.java | 64 ----- java/org/apache/jasper/compiler/AntCompiler.java | 3 - .../jasper/compiler/DefaultErrorHandler.java | 27 -- java/org/apache/jasper/compiler/JDTCompiler.java | 3 - .../apache/jasper/compiler/JspDocumentParser.java | 20 -- java/org/apache/jasper/compiler/PageDataImpl.java | 54 ++-- java/org/apache/jasper/compiler/SmapStratum.java | 6 - .../org/apache/jasper/runtime/BodyContentImpl.java | 272 --------------------- java/org/apache/jasper/runtime/HttpJspBase.java | 3 - java/org/apache/jasper/runtime/JspWriterImpl.java | 190 +------------- .../runtime/ServletResponseWrapperInclude.java | 2 +- .../apache/jasper/servlet/JspCServletContext.java | 101 -------- java/org/apache/jasper/servlet/JspServlet.java | 3 - 13 files changed, 29 insertions(+), 719 deletions(-) diff --git a/java/org/apache/jasper/EmbeddedServletOptions.java b/java/org/apache/jasper/EmbeddedServletOptions.java index a0a88dea46..cfaa2db9e9 100644 --- a/java/org/apache/jasper/EmbeddedServletOptions.java +++ b/java/org/apache/jasper/EmbeddedServletOptions.java @@ -248,9 +248,6 @@ public final class EmbeddedServletOptions implements Options { return quoteAttributeEL; } - /** - * Are we keeping generated code around? - */ @Override public boolean getKeepGenerated() { return keepGenerated; @@ -266,130 +263,81 @@ public final class EmbeddedServletOptions implements Options { return isPoolingEnabled; } - /** - * Are we supporting HTML mapped servlets? - */ @Override public boolean getMappedFile() { return mappedFile; } - /** - * Should class files be compiled with debug information? - */ @Override public boolean getClassDebugInfo() { return classDebugInfo; } - /** - * Background JSP compile thread check interval - */ @Override public int getCheckInterval() { return checkInterval; } - /** - * Modification test interval. - */ @Override public int getModificationTestInterval() { return modificationTestInterval; } - /** - * Re-compile on failure. - */ @Override public boolean getRecompileOnFail() { return recompileOnFail; } - /** - * Is Jasper being used in development mode? - */ @Override public boolean getDevelopment() { return development; } - /** - * Is the generation of SMAP info for JSR45 debugging suppressed? - */ @Override public boolean isSmapSuppressed() { return isSmapSuppressed; } - /** - * Should SMAP info for JSR45 debugging be dumped to a file? - */ @Override public boolean isSmapDumped() { return isSmapDumped; } - /** - * Are Text strings to be generated as char arrays? - */ @Override public boolean genStringAsCharArray() { return this.genStringAsCharArray; } - /** - * What is my scratch dir? - */ @Override public File getScratchDir() { return scratchDir; } - /** - * What classpath should I use while compiling the servlets - * generated from JSP files? - */ @Override public String getClassPath() { return classpath; } - /** - * Is generation of X-Powered-By response header enabled/disabled? - */ @Override public boolean isXpoweredBy() { return xpoweredBy; } - /** - * Compiler to use. - */ @Override public String getCompiler() { return compiler; } - /** - * @see Options#getCompilerTargetVM - */ @Override public String getCompilerTargetVM() { return compilerTargetVM; } - /** - * @see Options#getCompilerSourceVM - */ @Override public String getCompilerSourceVM() { return compilerSourceVM; } - /** - * Java compiler class to use. - */ @Override public String getCompilerClassName() { return compilerClassName; @@ -443,28 +391,16 @@ public final class EmbeddedServletOptions implements Options { return null; } - /** - * Should we include a source fragment in exception messages, which could be displayed - * to the developer ? - */ @Override public boolean getDisplaySourceFragment() { return displaySourceFragment; } - /** - * Should jsps be unloaded if to many are loaded? - * If set to a value greater than 0 eviction of jsps is started. Default: -1 - */ @Override public int getMaxLoadedJsps() { return maxLoadedJsps; } - /** - * Should any jsps be unloaded when being idle for this time in seconds? - * If set to a value greater than 0 eviction of jsps is started. Default: -1 - */ @Override public int getJspIdleTimeout() { return jspIdleTimeout; diff --git a/java/org/apache/jasper/compiler/AntCompiler.java b/java/org/apache/jasper/compiler/AntCompiler.java index 632954e23b..721933f448 100644 --- a/java/org/apache/jasper/compiler/AntCompiler.java +++ b/java/org/apache/jasper/compiler/AntCompiler.java @@ -116,9 +116,6 @@ public class AntCompiler extends Compiler { // --------------------------------------------------------- Public Methods - /** - * Compile the servlet from .java file to .class file - */ @Override protected void generateClass(Map<String,SmapStratum> smaps) throws FileNotFoundException, JasperException, Exception { diff --git a/java/org/apache/jasper/compiler/DefaultErrorHandler.java b/java/org/apache/jasper/compiler/DefaultErrorHandler.java index d1d6819931..7ba79b9fd3 100644 --- a/java/org/apache/jasper/compiler/DefaultErrorHandler.java +++ b/java/org/apache/jasper/compiler/DefaultErrorHandler.java @@ -25,15 +25,6 @@ import org.apache.jasper.JasperException; */ class DefaultErrorHandler implements ErrorHandler { - /* - * Processes the given JSP parse error. - * - * @param fname Name of the JSP file in which the parse error occurred - * @param line Parse error line number - * @param column Parse error column number - * @param errMsg Parse error message - * @param exception Parse exception - */ @Override public void jspError(String fname, int line, int column, String errMsg, Exception ex) throws JasperException { @@ -43,23 +34,11 @@ class DefaultErrorHandler implements ErrorHandler { ") " + errMsg, ex); } - /* - * Processes the given JSP parse error. - * - * @param errMsg Parse error message - * @param exception Parse exception - */ @Override public void jspError(String errMsg, Exception ex) throws JasperException { throw new JasperException(errMsg, ex); } - /* - * Processes the given javac compilation errors. - * - * @param details Array of JavacErrorDetail instances corresponding to the - * compilation errors - */ @Override public void javacError(JavacErrorDetail[] details) throws JasperException { @@ -102,12 +81,6 @@ class DefaultErrorHandler implements ErrorHandler { Localizer.getMessage("jsp.error.unable.compile") + ": " + buf); } - /** - * Processes the given javac error report and exception. - * - * @param errorReport Compilation error report - * @param exception Compilation exception - */ @Override public void javacError(String errorReport, Exception exception) throws JasperException { diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java b/java/org/apache/jasper/compiler/JDTCompiler.java index 5231a4e1eb..6720413810 100644 --- a/java/org/apache/jasper/compiler/JDTCompiler.java +++ b/java/org/apache/jasper/compiler/JDTCompiler.java @@ -66,9 +66,6 @@ public class JDTCompiler extends org.apache.jasper.compiler.Compiler { private final Log log = LogFactory.getLog(JDTCompiler.class); // must not be static - /** - * Compile the servlet from .java file to .class file - */ @Override protected void generateClass(Map<String,SmapStratum> smaps) throws FileNotFoundException, JasperException, Exception { diff --git a/java/org/apache/jasper/compiler/JspDocumentParser.java b/java/org/apache/jasper/compiler/JspDocumentParser.java index 085ba694c4..930cd0da9b 100644 --- a/java/org/apache/jasper/compiler/JspDocumentParser.java +++ b/java/org/apache/jasper/compiler/JspDocumentParser.java @@ -635,9 +635,6 @@ class JspDocumentParser charBuffer = null; } - /* - * Receives notification of the end of an element. - */ @Override public void endElement(String uri, String localName, String qName) throws SAXException { @@ -715,11 +712,6 @@ class JspDocumentParser } } - /* - * Receives the document locator. - * - * @param locator the document locator - */ @Override public void setDocumentLocator(Locator locator) { this.locator = locator; @@ -799,25 +791,16 @@ class JspDocumentParser inDTD = false; } - /* - * Receives notification of a non-recoverable error. - */ @Override public void fatalError(SAXParseException e) throws SAXException { throw e; } - /* - * Receives notification of a recoverable error. - */ @Override public void error(SAXParseException e) throws SAXException { throw e; } - /* - * Receives notification of the start of a Namespace mapping. - */ @Override public void startPrefixMapping(String prefix, String uri) throws SAXException { @@ -846,9 +829,6 @@ class JspDocumentParser } } - /* - * Receives notification of the end of a Namespace mapping. - */ @Override public void endPrefixMapping(String prefix) throws SAXException { diff --git a/java/org/apache/jasper/compiler/PageDataImpl.java b/java/org/apache/jasper/compiler/PageDataImpl.java index 2c6219a9b2..8520d3f51c 100644 --- a/java/org/apache/jasper/compiler/PageDataImpl.java +++ b/java/org/apache/jasper/compiler/PageDataImpl.java @@ -259,7 +259,7 @@ class PageDataImpl extends PageData implements TagConstants { * Visits root node. */ @Override - public void visit(Node.Root n) throws JasperException { + public void visit(Node.Root n) throws JasperException { if (n == this.root) { // top-level page appendXmlProlog(); @@ -281,48 +281,48 @@ class PageDataImpl extends PageData implements TagConstants { * include directive) are ignored. */ @Override - public void visit(Node.JspRoot n) throws JasperException { + public void visit(Node.JspRoot n) throws JasperException { visitBody(n); } @Override - public void visit(Node.PageDirective n) throws JasperException { + public void visit(Node.PageDirective n) throws JasperException { appendPageDirective(n); } @Override - public void visit(Node.IncludeDirective n) throws JasperException { + public void visit(Node.IncludeDirective n) throws JasperException { // expand in place visitBody(n); } @Override - public void visit(Node.Comment n) throws JasperException { + public void visit(Node.Comment n) throws JasperException { // Comments are ignored in XML view } @Override - public void visit(Node.Declaration n) throws JasperException { + public void visit(Node.Declaration n) throws JasperException { appendTag(n); } @Override - public void visit(Node.Expression n) throws JasperException { + public void visit(Node.Expression n) throws JasperException { appendTag(n); } @Override - public void visit(Node.Scriptlet n) throws JasperException { + public void visit(Node.Scriptlet n) throws JasperException { appendTag(n); } @Override - public void visit(Node.JspElement n) throws JasperException { + public void visit(Node.JspElement n) throws JasperException { appendTag(n); } @Override - public void visit(Node.ELExpression n) throws JasperException { + public void visit(Node.ELExpression n) throws JasperException { if (!n.getRoot().isXmlSyntax()) { buf.append('<').append(JSP_TEXT_ACTION); buf.append(' '); @@ -340,47 +340,47 @@ class PageDataImpl extends PageData implements TagConstants { } @Override - public void visit(Node.IncludeAction n) throws JasperException { + public void visit(Node.IncludeAction n) throws JasperException { appendTag(n); } @Override - public void visit(Node.ForwardAction n) throws JasperException { + public void visit(Node.ForwardAction n) throws JasperException { appendTag(n); } @Override - public void visit(Node.GetProperty n) throws JasperException { + public void visit(Node.GetProperty n) throws JasperException { appendTag(n); } @Override - public void visit(Node.SetProperty n) throws JasperException { + public void visit(Node.SetProperty n) throws JasperException { appendTag(n); } @Override - public void visit(Node.ParamAction n) throws JasperException { + public void visit(Node.ParamAction n) throws JasperException { appendTag(n); } @Override - public void visit(Node.ParamsAction n) throws JasperException { + public void visit(Node.ParamsAction n) throws JasperException { appendTag(n); } @Override - public void visit(Node.FallBackAction n) throws JasperException { + public void visit(Node.FallBackAction n) throws JasperException { appendTag(n); } @Override - public void visit(Node.UseBean n) throws JasperException { + public void visit(Node.UseBean n) throws JasperException { appendTag(n); } @Override - public void visit(Node.PlugIn n) throws JasperException { + public void visit(Node.PlugIn n) throws JasperException { appendTag(n); } @@ -395,26 +395,26 @@ class PageDataImpl extends PageData implements TagConstants { } @Override - public void visit(Node.CustomTag n) throws JasperException { + public void visit(Node.CustomTag n) throws JasperException { boolean resetDefaultNSSave = resetDefaultNS; appendTag(n, resetDefaultNS); resetDefaultNS = resetDefaultNSSave; } @Override - public void visit(Node.UninterpretedTag n) throws JasperException { + public void visit(Node.UninterpretedTag n) throws JasperException { boolean resetDefaultNSSave = resetDefaultNS; appendTag(n, resetDefaultNS); resetDefaultNS = resetDefaultNSSave; } @Override - public void visit(Node.JspText n) throws JasperException { + public void visit(Node.JspText n) throws JasperException { appendTag(n); } @Override - public void visit(Node.DoBodyAction n) throws JasperException { + public void visit(Node.DoBodyAction n) throws JasperException { appendTag(n); } @@ -424,22 +424,22 @@ class PageDataImpl extends PageData implements TagConstants { } @Override - public void visit(Node.TagDirective n) throws JasperException { + public void visit(Node.TagDirective n) throws JasperException { appendTagDirective(n); } @Override - public void visit(Node.AttributeDirective n) throws JasperException { + public void visit(Node.AttributeDirective n) throws JasperException { appendTag(n); } @Override - public void visit(Node.VariableDirective n) throws JasperException { + public void visit(Node.VariableDirective n) throws JasperException { appendTag(n); } @Override - public void visit(Node.TemplateText n) throws JasperException { + public void visit(Node.TemplateText n) throws JasperException { /* * If the template text came from a JSP page written in JSP syntax, * create a jsp:text element for it (JSP 5.3.2). diff --git a/java/org/apache/jasper/compiler/SmapStratum.java b/java/org/apache/jasper/compiler/SmapStratum.java index 5632dda35d..9e549211ab 100644 --- a/java/org/apache/jasper/compiler/SmapStratum.java +++ b/java/org/apache/jasper/compiler/SmapStratum.java @@ -172,12 +172,6 @@ public class SmapStratum { */ public void optimizeLineSection() { -/* Some debugging code - for (int i = 0; i < lineData.size(); i++) { - LineInfo li = (LineInfo)lineData.get(i); - System.out.print(li.toString()); - } - */ //Incorporate each LineInfo into the previous LineInfo's //outputLineIncrement, if possible int i = 0; diff --git a/java/org/apache/jasper/runtime/BodyContentImpl.java b/java/org/apache/jasper/runtime/BodyContentImpl.java index 4c698f0572..9203008aa5 100644 --- a/java/org/apache/jasper/runtime/BodyContentImpl.java +++ b/java/org/apache/jasper/runtime/BodyContentImpl.java @@ -66,11 +66,6 @@ public class BodyContentImpl extends BodyContent { closed = false; } - /** - * Write a single character. - * @param c The char to write - * @throws IOException Error writing to wrapped writer - */ @Override public void write(int c) throws IOException { if (writer != null) { @@ -84,22 +79,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Write a portion of an array of characters. - * - * <p> Ordinarily this method stores characters from the given array into - * this stream's buffer, flushing the buffer to the underlying stream as - * needed. If the requested length is at least as large as the buffer, - * however, then this method will flush the buffer and write the characters - * directly to the underlying stream. Thus redundant - * <code>DiscardableBufferedWriter</code>s will not copy data - * unnecessarily. - * - * @param cbuf A character array - * @param off Offset from which to start reading characters - * @param len Number of characters to write - * @throws IOException Error writing to wrapped writer - */ @Override public void write(char[] cbuf, int off, int len) throws IOException { if (writer != null) { @@ -123,12 +102,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Write an array of characters. This method cannot be inherited from the - * Writer class because it must suppress I/O exceptions. - * @param buf Content to write - * @throws IOException Error writing to wrapped writer - */ @Override public void write(char[] buf) throws IOException { if (writer != null) { @@ -138,14 +111,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Write a portion of a String. - * - * @param s String to be written - * @param off Offset from which to start reading characters - * @param len Number of characters to be written - * @throws IOException Error writing to wrapped writer - */ @Override public void write(String s, int off, int len) throws IOException { if (writer != null) { @@ -161,12 +126,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Write a string. This method cannot be inherited from the Writer class - * because it must suppress I/O exceptions. - * @param s String to be written - * @throws IOException Error writing to wrapped writer - */ @Override public void write(String s) throws IOException { if (writer != null) { @@ -176,13 +135,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Write a line separator. The line separator string is defined by the - * system property <code>line.separator</code>, and is not necessarily a - * single newline ('\n') character. - * - * @throws IOException Error writing to wrapped writer - */ @Override public void newLine() throws IOException { if (writer != null) { @@ -192,16 +144,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print a boolean value. The string produced by <code>{@link - * String#valueOf(boolean)}</code> is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link - * #write(int)}</code> method. - * - * @param b The <code>boolean</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(boolean b) throws IOException { if (writer != null) { @@ -211,15 +153,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print a character. The character is translated into one or more bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link - * #write(int)}</code> method. - * - * @param c The <code>char</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(char c) throws IOException { if (writer != null) { @@ -229,16 +162,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print an integer. The string produced by <code>{@link - * String#valueOf(int)}</code> is translated into bytes according - * to the platform's default character encoding, and these bytes are - * written in exactly the manner of the <code>{@link #write(int)}</code> - * method. - * - * @param i The <code>int</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(int i) throws IOException { if (writer != null) { @@ -248,16 +171,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print a long integer. The string produced by <code>{@link - * String#valueOf(long)}</code> is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * <code>{@link #write(int)}</code> method. - * - * @param l The <code>long</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(long l) throws IOException { if (writer != null) { @@ -267,16 +180,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print a floating-point number. The string produced by <code>{@link - * String#valueOf(float)}</code> is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * <code>{@link #write(int)}</code> method. - * - * @param f The <code>float</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(float f) throws IOException { if (writer != null) { @@ -286,16 +189,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print a double-precision floating-point number. The string produced by - * <code>{@link String#valueOf(double)}</code> is translated into - * bytes according to the platform's default character encoding, and these - * bytes are written in exactly the manner of the <code>{@link - * #write(int)}</code> method. - * - * @param d The <code>double</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(double d) throws IOException { if (writer != null) { @@ -305,17 +198,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print an array of characters. The characters are converted into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * <code>{@link #write(int)}</code> method. - * - * @param s The array of chars to be printed - * - * @throws NullPointerException If <code>s</code> is <code>null</code> - * @throws IOException Error writing to wrapped writer - */ @Override public void print(char[] s) throws IOException { if (writer != null) { @@ -325,16 +207,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print a string. If the argument is <code>null</code> then the string - * <code>"null"</code> is printed. Otherwise, the string's characters are - * converted into bytes according to the platform's default character - * encoding, and these bytes are written in exactly the manner of the - * <code>{@link #write(int)}</code> method. - * - * @param s The <code>String</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(String s) throws IOException { if (s == null) { @@ -347,16 +219,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Print an object. The string produced by the <code>{@link - * String#valueOf(Object)}</code> method is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * <code>{@link #write(int)}</code> method. - * - * @param obj The <code>Object</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void print(Object obj) throws IOException { if (writer != null) { @@ -366,153 +228,65 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Terminate the current line by writing the line separator string. The - * line separator string is defined by the system property - * <code>line.separator</code>, and is not necessarily a single newline - * character (<code>'\n'</code>). - * - * @throws IOException Error writing to wrapped writer - */ @Override public void println() throws IOException { newLine(); } - /** - * Print a boolean value and then terminate the line. This method behaves - * as though it invokes <code>{@link #print(boolean)}</code> and then - * <code>{@link #println()}</code>. - * - * @param x The <code>boolean</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(boolean x) throws IOException { print(x); println(); } - /** - * Print a character and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(char)}</code> and then - * <code>{@link #println()}</code>. - * - * @param x The <code>char</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(char x) throws IOException { print(x); println(); } - /** - * Print an integer and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(int)}</code> and then - * <code>{@link #println()}</code>. - * - * @param x The <code>int</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(int x) throws IOException { print(x); println(); } - /** - * Print a long integer and then terminate the line. This method behaves - * as though it invokes <code>{@link #print(long)}</code> and then - * <code>{@link #println()}</code>. - * - * @param x The <code>long</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(long x) throws IOException { print(x); println(); } - /** - * Print a floating-point number and then terminate the line. This method - * behaves as though it invokes <code>{@link #print(float)}</code> and then - * <code>{@link #println()}</code>. - * - * @param x The <code>float</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(float x) throws IOException { print(x); println(); } - /** - * Print a double-precision floating-point number and then terminate the - * line. This method behaves as though it invokes <code>{@link - * #print(double)}</code> and then <code>{@link #println()}</code>. - * - * @param x The <code>double</code> to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(double x) throws IOException{ print(x); println(); } - /** - * Print an array of characters and then terminate the line. This method - * behaves as though it invokes <code>{@link #print(char[])}</code> and - * then <code>{@link #println()}</code>. - * - * @param x The <code>char</code> array to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(char x[]) throws IOException { print(x); println(); } - /** - * Print a String and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(String)}</code> and then - * <code>{@link #println()}</code>. - * - * @param x The string to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(String x) throws IOException { print(x); println(); } - /** - * Print an Object and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(Object)}</code> and then - * <code>{@link #println()}</code>. - * - * @param x The object to be printed - * @throws IOException Error writing to wrapped writer - */ @Override public void println(Object x) throws IOException { print(x); println(); } - /** - * Clear the contents of the buffer. If the buffer has been already - * been flushed then the clear operation shall throw an IOException - * to signal the fact that some data has already been irrevocably - * written to the client response stream. - * - * @throws IOException If there is no wrapped writer - */ @Override public void clear() throws IOException { if (writer != null) { @@ -526,14 +300,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Clears the current contents of the buffer. Unlike clear(), this - * method will not throw an IOException if the buffer has already been - * flushed. It merely clears the current content of the buffer and - * returns. - * - * @throws IOException Should not happen - */ @Override public void clearBuffer() throws IOException { if (writer == null) { @@ -541,13 +307,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * Close the stream, flushing it first. Once a stream has been closed, - * further write() or flush() invocations will cause an IOException to be - * thrown. Closing a previously-closed stream, however, has no effect. - * - * @throws IOException Error writing to wrapped writer - */ @Override public void close() throws IOException { if (writer != null) { @@ -557,11 +316,6 @@ public class BodyContentImpl extends BodyContent { } } - /** - * This method returns the size of the buffer used by the JspWriter. - * - * @return the size of the buffer in bytes, or 0 is unbuffered. - */ @Override public int getBufferSize() { // According to the spec, the JspWriter returned by @@ -571,47 +325,21 @@ public class BodyContentImpl extends BodyContent { return (writer == null) ? bufferSize : 0; } - /** - * @return the number of bytes unused in the buffer - */ @Override public int getRemaining() { return (writer == null) ? bufferSize-nextChar : 0; } - /** - * Return the value of this BodyJspWriter as a Reader. - * Note: this is after evaluation!! There are no scriptlets, - * etc in this stream. - * - * @return the value of this BodyJspWriter as a Reader - */ @Override public Reader getReader() { return (writer == null) ? new CharArrayReader (cb, 0, nextChar) : null; } - /** - * Return the value of the BodyJspWriter as a String. - * Note: this is after evaluation!! There are no scriptlets, - * etc in this stream. - * - * @return the value of the BodyJspWriter as a String - */ @Override public String getString() { return (writer == null) ? new String(cb, 0, nextChar) : null; } - /** - * Write the contents of this BodyJspWriter into a Writer. - * Subclasses are likely to do interesting things with the - * implementation so some things are extra efficient. - * - * @param out The writer into which to place the contents of this body - * evaluation - * @throws IOException Error writing to writer - */ @Override public void writeOut(Writer out) throws IOException { if (writer == null) { diff --git a/java/org/apache/jasper/runtime/HttpJspBase.java b/java/org/apache/jasper/runtime/HttpJspBase.java index e5e974fd53..705c6f8ca9 100644 --- a/java/org/apache/jasper/runtime/HttpJspBase.java +++ b/java/org/apache/jasper/runtime/HttpJspBase.java @@ -60,9 +60,6 @@ public abstract class HttpJspBase extends HttpServlet implements HttpJspPage { _jspDestroy(); } - /** - * Entry point into service. - */ @Override public final void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException diff --git a/java/org/apache/jasper/runtime/JspWriterImpl.java b/java/org/apache/jasper/runtime/JspWriterImpl.java index 06b14c1b3b..0415492a07 100644 --- a/java/org/apache/jasper/runtime/JspWriterImpl.java +++ b/java/org/apache/jasper/runtime/JspWriterImpl.java @@ -129,9 +129,6 @@ public class JspWriterImpl extends JspWriter { } } - /** - * Discard the output buffer. - */ @Override public final void clear() throws IOException { if ((bufferSize == 0) && (out != null)) { @@ -161,10 +158,6 @@ public class JspWriterImpl extends JspWriter { throw new IOException(Localizer.getMessage("jsp.error.overflow")); } - /** - * Flush the stream. - * - */ @Override public void flush() throws IOException { flushBuffer(); @@ -173,10 +166,6 @@ public class JspWriterImpl extends JspWriter { } } - /** - * Close the stream. - * - */ @Override public void close() throws IOException { if (response == null || closed) { @@ -191,9 +180,6 @@ public class JspWriterImpl extends JspWriter { closed = true; } - /** - * @return the number of bytes unused in the buffer - */ @Override public int getRemaining() { return bufferSize - nextChar; @@ -207,9 +193,6 @@ public class JspWriterImpl extends JspWriter { } - /** - * Write a single character. - */ @Override public void write(int c) throws IOException { ensureOpen(); @@ -239,24 +222,8 @@ public class JspWriterImpl extends JspWriter { return b; } - /** - * Write a portion of an array of characters. - * - * <p> Ordinarily this method stores characters from the given array into - * this stream's buffer, flushing the buffer to the underlying stream as - * needed. If the requested length is at least as large as the buffer, - * however, then this method will flush the buffer and write the characters - * directly to the underlying stream. Thus redundant - * <code>DiscardableBufferedWriter</code>s will not copy data unnecessarily. - * - * @param cbuf A character array - * @param off Offset from which to start reading characters - * @param len Number of characters to write - */ @Override - public void write(char cbuf[], int off, int len) - throws IOException - { + public void write(char cbuf[], int off, int len) throws IOException { ensureOpen(); if (bufferSize == 0) { @@ -303,22 +270,11 @@ public class JspWriterImpl extends JspWriter { } - /** - * Write an array of characters. This method cannot be inherited from the - * Writer class because it must suppress I/O exceptions. - */ @Override public void write(char buf[]) throws IOException { write(buf, 0, buf.length); } - /** - * Write a portion of a String. - * - * @param s String to be written - * @param off Offset from which to start reading characters - * @param len Number of characters to be written - */ @Override public void write(String s, int off, int len) throws IOException { ensureOpen(); @@ -344,14 +300,6 @@ public class JspWriterImpl extends JspWriter { } - /** - * Write a line separator. The line separator string is defined by the - * system property <code>line.separator</code>, and is not necessarily a - * single newline ('\n') character. - * - * @exception IOException If an I/O error occurs - */ - @Override public void newLine() throws IOException { write(System.lineSeparator()); @@ -360,113 +308,41 @@ public class JspWriterImpl extends JspWriter { /* Methods that do not terminate lines */ - /** - * Print a boolean value. The string produced by <code>{@link - * String#valueOf(boolean)}</code> is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link - * #write(int)}</code> method. - * - * @param b The <code>boolean</code> to be printed - */ @Override public void print(boolean b) throws IOException { write(b ? "true" : "false"); } - /** - * Print a character. The character is translated into one or more bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link - * #write(int)}</code> method. - * - * @param c The <code>char</code> to be printed - */ @Override public void print(char c) throws IOException { write(String.valueOf(c)); } - /** - * Print an integer. The string produced by <code>{@link - * String#valueOf(int)}</code> is translated into bytes according - * to the platform's default character encoding, and these bytes are - * written in exactly the manner of the <code>{@link #write(int)}</code> - * method. - * - * @param i The <code>int</code> to be printed - */ @Override public void print(int i) throws IOException { write(String.valueOf(i)); } - /** - * Print a long integer. The string produced by <code>{@link - * String#valueOf(long)}</code> is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link #write(int)}</code> - * method. - * - * @param l The <code>long</code> to be printed - */ @Override public void print(long l) throws IOException { write(String.valueOf(l)); } - /** - * Print a floating-point number. The string produced by <code>{@link - * String#valueOf(float)}</code> is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link #write(int)}</code> - * method. - * - * @param f The <code>float</code> to be printed - */ @Override public void print(float f) throws IOException { write(String.valueOf(f)); } - /** - * Print a double-precision floating-point number. The string produced by - * <code>{@link String#valueOf(double)}</code> is translated into - * bytes according to the platform's default character encoding, and these - * bytes are written in exactly the manner of the <code>{@link - * #write(int)}</code> method. - * - * @param d The <code>double</code> to be printed - */ @Override public void print(double d) throws IOException { write(String.valueOf(d)); } - /** - * Print an array of characters. The characters are converted into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link #write(int)}</code> - * method. - * - * @param s The array of chars to be printed - * - * @throws NullPointerException If <code>s</code> is <code>null</code> - */ @Override public void print(char s[]) throws IOException { write(s); } - /** - * Print a string. If the argument is <code>null</code> then the string - * <code>"null"</code> is printed. Otherwise, the string's characters are - * converted into bytes according to the platform's default character - * encoding, and these bytes are written in exactly the manner of the - * <code>{@link #write(int)}</code> method. - * - * @param s The <code>String</code> to be printed - */ @Override public void print(String s) throws IOException { if (s == null) { @@ -475,15 +351,6 @@ public class JspWriterImpl extends JspWriter { write(s); } - /** - * Print an object. The string produced by the <code>{@link - * String#valueOf(Object)}</code> method is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the <code>{@link #write(int)}</code> - * method. - * - * @param obj The <code>Object</code> to be printed - */ @Override public void print(Object obj) throws IOException { write(String.valueOf(obj)); @@ -491,114 +358,59 @@ public class JspWriterImpl extends JspWriter { /* Methods that do terminate lines */ - /** - * Terminate the current line by writing the line separator string. The - * line separator string is defined by the system property - * <code>line.separator</code>, and is not necessarily a single newline - * character (<code>'\n'</code>). - * - * Need to change this from PrintWriter because the default - * println() writes to the sink directly instead of through the - * write method... - */ @Override public void println() throws IOException { newLine(); } - /** - * Print a boolean value and then terminate the line. This method behaves - * as though it invokes <code>{@link #print(boolean)}</code> and then - * <code>{@link #println()}</code>. - */ @Override public void println(boolean x) throws IOException { print(x); println(); } - /** - * Print a character and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(char)}</code> and then <code>{@link - * #println()}</code>. - */ @Override public void println(char x) throws IOException { print(x); println(); } - /** - * Print an integer and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(int)}</code> and then <code>{@link - * #println()}</code>. - */ @Override public void println(int x) throws IOException { print(x); println(); } - /** - * Print a long integer and then terminate the line. This method behaves - * as though it invokes <code>{@link #print(long)}</code> and then - * <code>{@link #println()}</code>. - */ @Override public void println(long x) throws IOException { print(x); println(); } - /** - * Print a floating-point number and then terminate the line. This method - * behaves as though it invokes <code>{@link #print(float)}</code> and then - * <code>{@link #println()}</code>. - */ @Override public void println(float x) throws IOException { print(x); println(); } - /** - * Print a double-precision floating-point number and then terminate the - * line. This method behaves as though it invokes <code>{@link - * #print(double)}</code> and then <code>{@link #println()}</code>. - */ @Override public void println(double x) throws IOException { print(x); println(); } - /** - * Print an array of characters and then terminate the line. This method - * behaves as though it invokes <code>{@link #print(char[])}</code> and then - * <code>{@link #println()}</code>. - */ @Override public void println(char x[]) throws IOException { print(x); println(); } - /** - * Print a String and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(String)}</code> and then - * <code>{@link #println()}</code>. - */ @Override public void println(String x) throws IOException { print(x); println(); } - /** - * Print an Object and then terminate the line. This method behaves as - * though it invokes <code>{@link #print(Object)}</code> and then - * <code>{@link #println()}</code>. - */ @Override public void println(Object x) throws IOException { print(x); diff --git a/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java b/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java index e0fa3d8398..4083ec203c 100644 --- a/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java +++ b/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java @@ -52,7 +52,7 @@ public class ServletResponseWrapperInclude extends HttpServletResponseWrapper { } /** - * Returns a wrapper around the JspWriter of the including page. + * @return a wrapper around the JspWriter of the including page. */ @Override public PrintWriter getWriter() throws IOException { diff --git a/java/org/apache/jasper/servlet/JspCServletContext.java b/java/org/apache/jasper/servlet/JspCServletContext.java index 53743b40e6..c359138b84 100644 --- a/java/org/apache/jasper/servlet/JspCServletContext.java +++ b/java/org/apache/jasper/servlet/JspCServletContext.java @@ -232,113 +232,66 @@ public class JspCServletContext implements ServletContext { // --------------------------------------------------------- Public Methods - /** - * Return the specified context attribute, if any. - * - * @param name Name of the requested attribute - */ @Override public Object getAttribute(String name) { return myAttributes.get(name); } - /** - * Return an enumeration of context attribute names. - */ @Override public Enumeration<String> getAttributeNames() { return Collections.enumeration(myAttributes.keySet()); } - /** - * Return the servlet context for the specified path. - * - * @param uripath Server-relative path starting with '/' - */ @Override public ServletContext getContext(String uripath) { return null; } - /** - * Return the context path. - */ @Override public String getContextPath() { return null; } - /** - * Return the specified context initialization parameter. - * - * @param name Name of the requested parameter - */ @Override public String getInitParameter(String name) { return myParameters.get(name); } - /** - * Return an enumeration of the names of context initialization - * parameters. - */ @Override public Enumeration<String> getInitParameterNames() { return Collections.enumeration(myParameters.keySet()); } - /** - * Return the Servlet API major version number. - */ @Override public int getMajorVersion() { return 4; } - /** - * Return the MIME type for the specified filename. - * - * @param file Filename whose MIME type is requested - */ @Override public String getMimeType(String file) { return null; } - /** - * Return the Servlet API minor version number. - */ @Override public int getMinorVersion() { return 0; } - /** - * Return a request dispatcher for the specified servlet name. - * - * @param name Name of the requested servlet - */ @Override public RequestDispatcher getNamedDispatcher(String name) { return null; } - /** - * Return the real path for the specified context-relative - * virtual path. - * - * @param path The context-relative virtual path to resolve - */ @Override public String getRealPath(String path) { if (!myResourceBaseURL.getProtocol().equals("file")) { @@ -361,26 +314,12 @@ public class JspCServletContext implements ServletContext { } - /** - * Return a request dispatcher for the specified context-relative path. - * - * @param path Context-relative path for which to acquire a dispatcher - */ @Override public RequestDispatcher getRequestDispatcher(String path) { return null; } - /** - * Return a URL object of a resource that is mapped to the - * specified context-relative path. - * - * @param path Context-relative path of the desired resource - * - * @exception MalformedURLException if the resource path is - * not properly formed - */ @Override public URL getResource(String path) throws MalformedURLException { @@ -420,12 +359,6 @@ public class JspCServletContext implements ServletContext { } - /** - * Return an InputStream allowing access to the resource at the - * specified context-relative path. - * - * @param path Context-relative path of the desired resource - */ @Override public InputStream getResourceAsStream(String path) { try { @@ -441,12 +374,6 @@ public class JspCServletContext implements ServletContext { } - /** - * Return the set of resource paths for the "directory" at the - * specified context path. - * - * @param path Context-relative base path - */ @Override public Set<String> getResourcePaths(String path) { @@ -505,41 +432,24 @@ public class JspCServletContext implements ServletContext { } - /** - * Return descriptive information about this server. - */ @Override public String getServerInfo() { return "JspC/ApacheTomcat10"; } - /** - * Return the name of this servlet context. - */ @Override public String getServletContextName() { return getServerInfo(); } - /** - * Log the specified message. - * - * @param message The message to be logged - */ @Override public void log(String message) { myLogWriter.println(message); } - /** - * Log the specified message and exception. - * - * @param message The message to be logged - * @param exception The exception to be logged - */ @Override public void log(String message, Throwable exception) { myLogWriter.println(message); @@ -547,23 +457,12 @@ public class JspCServletContext implements ServletContext { } - /** - * Remove the specified context attribute. - * - * @param name Name of the attribute to remove - */ @Override public void removeAttribute(String name) { myAttributes.remove(name); } - /** - * Set or replace the specified context attribute. - * - * @param name Name of the context attribute to set - * @param value Corresponding attribute value - */ @Override public void setAttribute(String name, Object value) { myAttributes.put(name, value); diff --git a/java/org/apache/jasper/servlet/JspServlet.java b/java/org/apache/jasper/servlet/JspServlet.java index d5deb7a2f1..04348a89b0 100644 --- a/java/org/apache/jasper/servlet/JspServlet.java +++ b/java/org/apache/jasper/servlet/JspServlet.java @@ -76,9 +76,6 @@ public class JspServlet extends HttpServlet implements PeriodicEventListener { private String jspFile; - /* - * Initializes this JspServlet. - */ @Override public void init(ServletConfig config) throws ServletException { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org