You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ma...@apache.org on 2005/05/07 17:41:45 UTC
svn commit: r169086 - in /struts/core/trunk/src/share/org/apache/struts:
action/ actions/ chain/contexts/ config/ mock/ upload/ util/ validator/
Author: martinc
Date: Sat May 7 08:41:44 2005
New Revision: 169086
URL: http://svn.apache.org/viewcvs?rev=169086&view=rev
Log:
Detab sources. Somebody doesn't have their editor set up properly...
Modified:
struts/core/trunk/src/share/org/apache/struts/action/Action.java
struts/core/trunk/src/share/org/apache/struts/action/ActionMessage.java
struts/core/trunk/src/share/org/apache/struts/action/ActionMessages.java
struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java
struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java
struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java
struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java
struts/core/trunk/src/share/org/apache/struts/mock/MockHttpServletRequest.java
struts/core/trunk/src/share/org/apache/struts/upload/MultipartValueStream.java
struts/core/trunk/src/share/org/apache/struts/util/LabelValueBean.java
struts/core/trunk/src/share/org/apache/struts/util/ModuleException.java
struts/core/trunk/src/share/org/apache/struts/util/ModuleUtils.java
struts/core/trunk/src/share/org/apache/struts/util/PropertyMessageResources.java
struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java
struts/core/trunk/src/share/org/apache/struts/util/ResponseUtils.java
struts/core/trunk/src/share/org/apache/struts/validator/FieldChecks.java
Modified: struts/core/trunk/src/share/org/apache/struts/action/Action.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/Action.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/action/Action.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/action/Action.java Sat May 7 08:41:44 2005
@@ -200,81 +200,81 @@
// ---------------------------------------------------- Protected Methods
- /**
- * Adds the specified messages keys into the appropriate request
- * attribute for use by the <html:messages> tag (if
- * messages="true" is set), if any messages are required.
- * Initialize the attribute if it has not already been.
- * Otherwise, ensure that the request attribute is not set.
- *
- * @param request The servlet request we are processing
- * @param messages Messages object
- * @since Struts 1.2.1
- */
- protected void addMessages(
- HttpServletRequest request,
- ActionMessages messages) {
-
- if (messages == null){
- // bad programmer! *slap*
- return;
- }
-
- // get any existing messages from the request, or make a new one
- ActionMessages requestMessages = (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
- if (requestMessages == null){
- requestMessages = new ActionMessages();
- }
- // add incoming messages
- requestMessages.add(messages);
-
- // if still empty, just wipe it out from the request
- if (requestMessages.isEmpty()) {
- request.removeAttribute(Globals.MESSAGE_KEY);
- return;
- }
-
- // Save the messages
- request.setAttribute(Globals.MESSAGE_KEY, requestMessages);
- }
+ /**
+ * Adds the specified messages keys into the appropriate request
+ * attribute for use by the <html:messages> tag (if
+ * messages="true" is set), if any messages are required.
+ * Initialize the attribute if it has not already been.
+ * Otherwise, ensure that the request attribute is not set.
+ *
+ * @param request The servlet request we are processing
+ * @param messages Messages object
+ * @since Struts 1.2.1
+ */
+ protected void addMessages(
+ HttpServletRequest request,
+ ActionMessages messages) {
+
+ if (messages == null){
+ // bad programmer! *slap*
+ return;
+ }
+
+ // get any existing messages from the request, or make a new one
+ ActionMessages requestMessages = (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
+ if (requestMessages == null){
+ requestMessages = new ActionMessages();
+ }
+ // add incoming messages
+ requestMessages.add(messages);
+ // if still empty, just wipe it out from the request
+ if (requestMessages.isEmpty()) {
+ request.removeAttribute(Globals.MESSAGE_KEY);
+ return;
+ }
- /**
- * Adds the specified errors keys into the appropriate request attribute
+ // Save the messages
+ request.setAttribute(Globals.MESSAGE_KEY, requestMessages);
+ }
+
+
+ /**
+ * Adds the specified errors keys into the appropriate request attribute
* for use by the <html:errors> tag, if any messages are required.
- * Initialize the attribute if it has not already been. Otherwise, ensure
+ * Initialize the attribute if it has not already been. Otherwise, ensure
* that the request attribute is not set.
- *
- * @param request The servlet request we are processing
- * @param errors Errors object
- * @since Struts 1.2.1
- */
- protected void addErrors(
- HttpServletRequest request,
- ActionMessages errors) {
-
- if (errors == null){
- // bad programmer! *slap*
- return;
- }
-
- // get any existing errors from the request, or make a new one
- ActionMessages requestErrors = (ActionMessages)request.getAttribute(Globals.ERROR_KEY);
- if (requestErrors == null){
- requestErrors = new ActionMessages();
- }
- // add incoming errors
- requestErrors.add(errors);
-
- // if still empty, just wipe it out from the request
- if (requestErrors.isEmpty()) {
- request.removeAttribute(Globals.ERROR_KEY);
- return;
- }
-
- // Save the errors
- request.setAttribute(Globals.ERROR_KEY, requestErrors);
- }
+ *
+ * @param request The servlet request we are processing
+ * @param errors Errors object
+ * @since Struts 1.2.1
+ */
+ protected void addErrors(
+ HttpServletRequest request,
+ ActionMessages errors) {
+
+ if (errors == null){
+ // bad programmer! *slap*
+ return;
+ }
+
+ // get any existing errors from the request, or make a new one
+ ActionMessages requestErrors = (ActionMessages)request.getAttribute(Globals.ERROR_KEY);
+ if (requestErrors == null){
+ requestErrors = new ActionMessages();
+ }
+ // add incoming errors
+ requestErrors.add(errors);
+
+ // if still empty, just wipe it out from the request
+ if (requestErrors.isEmpty()) {
+ request.removeAttribute(Globals.ERROR_KEY);
+ return;
+ }
+
+ // Save the errors
+ request.setAttribute(Globals.ERROR_KEY, requestErrors);
+ }
/**
@@ -319,23 +319,23 @@
}
- /**
- * Retrieves any existing messages placed in the request by previous actions. This method could be called instead
- * of creating a <code>new ActionMessages()<code> at the beginning of an <code>Action<code>
- * This will prevent saveMessages() from wiping out any existing Messages
- *
- * @return the Messages that already exist in the request, or a new ActionMessages object if empty.
- * @param request The servlet request we are processing
+ /**
+ * Retrieves any existing messages placed in the request by previous actions. This method could be called instead
+ * of creating a <code>new ActionMessages()<code> at the beginning of an <code>Action<code>
+ * This will prevent saveMessages() from wiping out any existing Messages
+ *
+ * @return the Messages that already exist in the request, or a new ActionMessages object if empty.
+ * @param request The servlet request we are processing
* @since Struts 1.2.1
- */
- protected ActionMessages getMessages(HttpServletRequest request) {
- ActionMessages messages =
- (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
- if (messages == null) {
- messages = new ActionMessages();
- }
- return messages;
- }
+ */
+ protected ActionMessages getMessages(HttpServletRequest request) {
+ ActionMessages messages =
+ (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
+ if (messages == null) {
+ messages = new ActionMessages();
+ }
+ return messages;
+ }
/**
Modified: struts/core/trunk/src/share/org/apache/struts/action/ActionMessage.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/ActionMessage.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/action/ActionMessage.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/action/ActionMessage.java Sat May 7 08:41:44 2005
@@ -185,29 +185,29 @@
*
* @see java.lang.Object#toString()
*/
- public String toString() {
- StringBuffer buff = new StringBuffer();
- buff.append(this.key);
- buff.append("[");
+ public String toString() {
+ StringBuffer buff = new StringBuffer();
+ buff.append(this.key);
+ buff.append("[");
- if (this.values != null) {
+ if (this.values != null) {
- for (int i = 0; i < this.values.length; i++) {
+ for (int i = 0; i < this.values.length; i++) {
- buff.append(this.values[i]);
+ buff.append(this.values[i]);
// don't append comma to last entry
- if (i < this.values.length - 1) {
- buff.append(", ");
- }
+ if (i < this.values.length - 1) {
+ buff.append(", ");
+ }
- }
- }
+ }
+ }
- buff.append("]");
+ buff.append("]");
- return buff.toString();
- }
+ return buff.toString();
+ }
}
Modified: struts/core/trunk/src/share/org/apache/struts/action/ActionMessages.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/ActionMessages.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/action/ActionMessages.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/action/ActionMessages.java Sat May 7 08:41:44 2005
@@ -64,8 +64,8 @@
* <p>The "property name" marker to use for global messages, as opposed to
* those related to a specific property.</p>
*/
- public static final String GLOBAL_MESSAGE =
- "org.apache.struts.action.GLOBAL_MESSAGE";
+ public static final String GLOBAL_MESSAGE =
+ "org.apache.struts.action.GLOBAL_MESSAGE";
// ----------------------------------------------------- Instance Variables
@@ -338,12 +338,12 @@
*
* @param property Property name (or ActionMessages.GLOBAL_MESSAGE)
*/
- public int size(String property) {
+ public int size(String property) {
- ActionMessageItem item = (ActionMessageItem) messages.get(property);
+ ActionMessageItem item = (ActionMessageItem) messages.get(property);
- return (item == null) ? 0 : item.getList().size();
- }
+ return (item == null) ? 0 : item.getList().size();
+ }
/**
@@ -351,9 +351,9 @@
* property name=message list mapping.</p>
* @see java.lang.Object#toString()
*/
- public String toString() {
+ public String toString() {
return this.messages.toString();
- }
+ }
/**
Modified: struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/DispatchAction.java Sat May 7 08:41:44 2005
@@ -170,14 +170,14 @@
String name = getMethodName(mapping, form, request, response, parameter);
- // Prevent recursive calls
- if ("execute".equals(name) || "perform".equals(name)){
- String message =
- messages.getMessage("dispatch.recursive", mapping.getPath());
+ // Prevent recursive calls
+ if ("execute".equals(name) || "perform".equals(name)){
+ String message =
+ messages.getMessage("dispatch.recursive", mapping.getPath());
- log.error(message);
- throw new ServletException(message);
- }
+ log.error(message);
+ throw new ServletException(message);
+ }
// Invoke the named method, and return the result
Modified: struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/actions/MappingDispatchAction.java Sat May 7 08:41:44 2005
@@ -123,85 +123,85 @@
public class MappingDispatchAction extends DispatchAction {
- // -------------------------------------------------------- Class Variables
+ // -------------------------------------------------------- Class Variables
- /**
- * Commons Logging instance.
- */
- private static Log log =
- LogFactory.getLog(MappingDispatchAction.class);
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Process the specified HTTP request, and create the corresponding HTTP
- * response (or forward to another web component that will create it).
- * Return an <code>ActionForward</code> instance describing where and how
- * control should be forwarded, or <code>null</code> if the response has
- * already been completed.
- *
- * This method dispatches the request to other methods of
- * <code>MappingDispatchAction</code> using the 'parameter' attribute of
- * <code>ActionMapping</code> and Java Introspection.
- *
- * @param mapping The ActionMapping used to select this instance
- * @param form The optional ActionForm bean for this request (if any)
- * @param request The HTTP request we are processing
- * @param response The HTTP response we are creating
- *
- * @return Return an <code>ActionForward</code> instance describing where
- * and how control should be forwarded, or <code>null</code> if
- * the response has already been completed.
- *
- * @exception Exception if an exception occurs
- */
- public ActionForward execute(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response)
- throws Exception {
+ /**
+ * Commons Logging instance.
+ */
+ private static Log log =
+ LogFactory.getLog(MappingDispatchAction.class);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Process the specified HTTP request, and create the corresponding HTTP
+ * response (or forward to another web component that will create it).
+ * Return an <code>ActionForward</code> instance describing where and how
+ * control should be forwarded, or <code>null</code> if the response has
+ * already been completed.
+ *
+ * This method dispatches the request to other methods of
+ * <code>MappingDispatchAction</code> using the 'parameter' attribute of
+ * <code>ActionMapping</code> and Java Introspection.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The HTTP request we are processing
+ * @param response The HTTP response we are creating
+ *
+ * @return Return an <code>ActionForward</code> instance describing where
+ * and how control should be forwarded, or <code>null</code> if
+ * the response has already been completed.
+ *
+ * @exception Exception if an exception occurs
+ */
+ public ActionForward execute(
+ ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
// Use the overridden getMethodName.
return super.execute(mapping, form, request, response);
- }
+ }
- /**
- * Method which is dispatched to when there is no value for the
- * parameter in the ActionMapping. Subclasses of
- * <code>MappingDispatchAction</code> should override this method
- * if they wish to provide default behavior different than throwing a
- * ServletException.
- *
- * @param mapping The ActionMapping used to select this instance
- * @param form The optional ActionForm bean for this request (if any)
- * @param request The HTTP request we are processing
- * @param response The HTTP response we are creating
- *
- * @return Return an <code>ActionForward</code> instance describing where
- * and how control should be forwarded, or <code>null</code> if
- * the response has already been completed.
- *
- * @exception Exception if an exception occurs
- */
- protected ActionForward unspecified(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response)
- throws Exception {
+ /**
+ * Method which is dispatched to when there is no value for the
+ * parameter in the ActionMapping. Subclasses of
+ * <code>MappingDispatchAction</code> should override this method
+ * if they wish to provide default behavior different than throwing a
+ * ServletException.
+ *
+ * @param mapping The ActionMapping used to select this instance
+ * @param form The optional ActionForm bean for this request (if any)
+ * @param request The HTTP request we are processing
+ * @param response The HTTP response we are creating
+ *
+ * @return Return an <code>ActionForward</code> instance describing where
+ * and how control should be forwarded, or <code>null</code> if
+ * the response has already been completed.
+ *
+ * @exception Exception if an exception occurs
+ */
+ protected ActionForward unspecified(
+ ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
- String message =
- messages.getMessage("mapping.parameter", mapping.getPath());
+ String message =
+ messages.getMessage("mapping.parameter", mapping.getPath());
- log.error(message);
+ log.error(message);
- throw new ServletException(message);
- }
+ throw new ServletException(message);
+ }
/**
* Returns the method name, given a parameter's value.
Modified: struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java Sat May 7 08:41:44 2005
@@ -212,7 +212,7 @@
public void addActionMessages(String key, ActionMessages msgs) {
if (msgs == null){
- // bad programmer! *slap*
+ // bad programmer! *slap*
return;
}
Modified: struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/config/ForwardConfig.java Sat May 7 08:41:44 2005
@@ -222,28 +222,28 @@
}
- /**
- * <p>The prefix of the module to which this <code>ForwardConfig</code> entry points,
- * which must start with a slash ("/") character. </p>
+ /**
+ * <p>The prefix of the module to which this <code>ForwardConfig</code> entry points,
+ * which must start with a slash ("/") character. </p>
* <p>Usage note: If a forward config is used in a hyperlink,
* and a module is specified, the path must lead to another
* action and not directly to a page. This is in keeping with
* rule that in a modular application all links must be to
* an action rather than a page.
* </p>
- */
- protected String module = null;
+ */
+ protected String module = null;
- public String getModule() {
- return (this.module);
- }
+ public String getModule() {
+ return (this.module);
+ }
- public void setModule(String module) {
- if (configured) {
- throw new IllegalStateException("Configuration is frozen");
- }
- this.module = module;
- }
+ public void setModule(String module) {
+ if (configured) {
+ throw new IllegalStateException("Configuration is frozen");
+ }
+ this.module = module;
+ }
/**
Modified: struts/core/trunk/src/share/org/apache/struts/mock/MockHttpServletRequest.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/mock/MockHttpServletRequest.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/mock/MockHttpServletRequest.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/mock/MockHttpServletRequest.java Sat May 7 08:41:44 2005
@@ -303,9 +303,9 @@
if (create && (session == null)) {
session = new MockHttpSession();
- // modified to act like the real deal,
- // call with (false) if you want null
- // throw new UnsupportedOperationException();
+ // modified to act like the real deal,
+ // call with (false) if you want null
+ // throw new UnsupportedOperationException();
}
return (session);
}
Modified: struts/core/trunk/src/share/org/apache/struts/upload/MultipartValueStream.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/upload/MultipartValueStream.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/upload/MultipartValueStream.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/upload/MultipartValueStream.java Sat May 7 08:41:44 2005
@@ -73,32 +73,32 @@
* NOTE: the boundary parameter is without the trailing dashes "--".
*/
public MultipartValueStream(InputStream in, String boundary)
- throws IOException
+ throws IOException
{
- this.in = in;
- this.boundaryBytes = ("\r\n" + boundary).getBytes(HEADER_ENCODING);
- this.matchedBoundaryBytes = 0;
- this.readAheadBytes = new byte[this.boundaryBytes.length];
-
- /* Fill read ahead buffer */
- if (in.read(readAheadBytes, 0, readAheadBytes.length) != readAheadBytes.length) {
- throw new IOException("end of stream before boundary found!");
- }
-
- /* Count the number of matched chars */
- for (int i = 0; i < readAheadBytes.length; i++) {
- if (readAheadBytes[i] == boundaryBytes[matchedBoundaryBytes]) {
- matchedBoundaryBytes++;
- } else {
- matchedBoundaryBytes = 0;
- if (readAheadBytes[i] == boundaryBytes[0]) {
- matchedBoundaryBytes = 1;
- }
- }
- }
+ this.in = in;
+ this.boundaryBytes = ("\r\n" + boundary).getBytes(HEADER_ENCODING);
+ this.matchedBoundaryBytes = 0;
+ this.readAheadBytes = new byte[this.boundaryBytes.length];
+
+ /* Fill read ahead buffer */
+ if (in.read(readAheadBytes, 0, readAheadBytes.length) != readAheadBytes.length) {
+ throw new IOException("end of stream before boundary found!");
+ }
+
+ /* Count the number of matched chars */
+ for (int i = 0; i < readAheadBytes.length; i++) {
+ if (readAheadBytes[i] == boundaryBytes[matchedBoundaryBytes]) {
+ matchedBoundaryBytes++;
+ } else {
+ matchedBoundaryBytes = 0;
+ if (readAheadBytes[i] == boundaryBytes[0]) {
+ matchedBoundaryBytes = 1;
+ }
+ }
+ }
- readAheadBufferStartI = 0;
- readAheadBufferEndI = readAheadBytes.length - 1;
+ readAheadBufferStartI = 0;
+ readAheadBufferEndI = readAheadBytes.length - 1;
}
@@ -111,84 +111,84 @@
*/
public int read() throws IOException {
- if (boundaryReached) {
- return -1;
- }
- if (matchedBoundaryBytes == boundaryBytes.length) {
-
- boundaryReached = true;
-
- /*
- * Boundary found...
- *
- * Read two more bytes:
- * 1. the bytes are "--": this is the last parameter value (then read "\r\n" too)
- * 2. the bytes are "\r\n": this is not the last value
- * 3. the bytes are somthing else: Exception
- */
-
- byte buf[] = new byte[2];
- if (in.read(buf) != 2) {
- throw new IOException("end of stream before boundary found!");
- }
-
- String readStr = new String(buf, HEADER_ENCODING);
- if (readStr.equals("--")) {
-
- if (in.read(buf) != 2) {
- throw new IOException("invalid end of final boundary found!");
- }
- readStr = new String(buf, HEADER_ENCODING);
- if (!readStr.equals("\r\n")) {
- throw new IOException("invalid end of final boundary found!");
- }
- finalBoundaryReached = true;
-
- } else if (readStr.equals("\r\n")) {
- finalBoundaryReached = false;
- } else {
- throw new IOException("invalid end of boundary found!");
- }
-
- return -1;
- }
-
- /*
- * Might seem odd, but we are supposed to return
- * a byte as an int in range 0 - 255, and the byte type
- * is signed (-128 to 127)
- *
- */
- int returnByte = (int)(char) readAheadBytes[readAheadBufferStartI];
-
- /* Move cyclic-buffers start pointer */
- readAheadBufferStartI++;
- if (readAheadBufferStartI == readAheadBytes.length) {
- readAheadBufferStartI = 0;
- }
-
- /* read from the underlying stream */
- int underlyingRead = in.read();
- if (underlyingRead == -1) {
- throw new IOException("end of stream before boundary found!");
- }
-
- /* Move cyclic-buffers end pointer */
- readAheadBufferEndI++;
- if (readAheadBufferEndI == readAheadBytes.length) {
- readAheadBufferEndI = 0;
- }
- readAheadBytes[readAheadBufferEndI] = (byte) underlyingRead;
-
- if (readAheadBytes[readAheadBufferEndI] == boundaryBytes[matchedBoundaryBytes]) {
- matchedBoundaryBytes++;
- } else {
- matchedBoundaryBytes = 0;
- if (readAheadBytes[readAheadBufferEndI] == boundaryBytes[0]) {
- matchedBoundaryBytes = 1;
- }
- }
- return returnByte;
+ if (boundaryReached) {
+ return -1;
+ }
+ if (matchedBoundaryBytes == boundaryBytes.length) {
+
+ boundaryReached = true;
+
+ /*
+ * Boundary found...
+ *
+ * Read two more bytes:
+ * 1. the bytes are "--": this is the last parameter value (then read "\r\n" too)
+ * 2. the bytes are "\r\n": this is not the last value
+ * 3. the bytes are somthing else: Exception
+ */
+
+ byte buf[] = new byte[2];
+ if (in.read(buf) != 2) {
+ throw new IOException("end of stream before boundary found!");
+ }
+
+ String readStr = new String(buf, HEADER_ENCODING);
+ if (readStr.equals("--")) {
+
+ if (in.read(buf) != 2) {
+ throw new IOException("invalid end of final boundary found!");
+ }
+ readStr = new String(buf, HEADER_ENCODING);
+ if (!readStr.equals("\r\n")) {
+ throw new IOException("invalid end of final boundary found!");
+ }
+ finalBoundaryReached = true;
+
+ } else if (readStr.equals("\r\n")) {
+ finalBoundaryReached = false;
+ } else {
+ throw new IOException("invalid end of boundary found!");
+ }
+
+ return -1;
+ }
+
+ /*
+ * Might seem odd, but we are supposed to return
+ * a byte as an int in range 0 - 255, and the byte type
+ * is signed (-128 to 127)
+ *
+ */
+ int returnByte = (int)(char) readAheadBytes[readAheadBufferStartI];
+
+ /* Move cyclic-buffers start pointer */
+ readAheadBufferStartI++;
+ if (readAheadBufferStartI == readAheadBytes.length) {
+ readAheadBufferStartI = 0;
+ }
+
+ /* read from the underlying stream */
+ int underlyingRead = in.read();
+ if (underlyingRead == -1) {
+ throw new IOException("end of stream before boundary found!");
+ }
+
+ /* Move cyclic-buffers end pointer */
+ readAheadBufferEndI++;
+ if (readAheadBufferEndI == readAheadBytes.length) {
+ readAheadBufferEndI = 0;
+ }
+ readAheadBytes[readAheadBufferEndI] = (byte) underlyingRead;
+
+ if (readAheadBytes[readAheadBufferEndI] == boundaryBytes[matchedBoundaryBytes]) {
+ matchedBoundaryBytes++;
+ } else {
+ matchedBoundaryBytes = 0;
+ if (readAheadBytes[readAheadBufferEndI] == boundaryBytes[0]) {
+ matchedBoundaryBytes = 1;
+ }
+ }
+ return returnByte;
}
/**
@@ -199,11 +199,11 @@
*/
public boolean encounteredFinalBoundary()
- throws ServletException
+ throws ServletException
{
- if (!boundaryReached) {
- throw new ServletException("have not reached boundary yet!");
- }
- return finalBoundaryReached;
+ if (!boundaryReached) {
+ throw new ServletException("have not reached boundary yet!");
+ }
+ return finalBoundaryReached;
}
}
Modified: struts/core/trunk/src/share/org/apache/struts/util/LabelValueBean.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/util/LabelValueBean.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/LabelValueBean.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/util/LabelValueBean.java Sat May 7 08:41:44 2005
@@ -40,11 +40,11 @@
* <code>LabelValueBean</code> objects.
*/
public static final Comparator CASE_INSENSITIVE_ORDER = new Comparator() {
- public int compare(Object o1, Object o2) {
- String label1 = ((LabelValueBean) o1).getLabel();
- String label2 = ((LabelValueBean) o2).getLabel();
- return label1.compareToIgnoreCase(label2);
- }
+ public int compare(Object o1, Object o2) {
+ String label1 = ((LabelValueBean) o1).getLabel();
+ String label2 = ((LabelValueBean) o2).getLabel();
+ return label1.compareToIgnoreCase(label2);
+ }
};
@@ -103,18 +103,18 @@
// --------------------------------------------------------- Public Methods
- /**
- * Compare LabelValueBeans based on the label, because that's the human
+ /**
+ * Compare LabelValueBeans based on the label, because that's the human
* viewable part of the object.
- * @see Comparable
- */
- public int compareTo(Object o) {
- // Implicitly tests for the correct type, throwing
+ * @see Comparable
+ */
+ public int compareTo(Object o) {
+ // Implicitly tests for the correct type, throwing
// ClassCastException as required by interface
- String otherLabel = ((LabelValueBean) o).getLabel();
+ String otherLabel = ((LabelValueBean) o).getLabel();
- return this.getLabel().compareTo(otherLabel);
- }
+ return this.getLabel().compareTo(otherLabel);
+ }
/**
* Return a string representation of this object.
Modified: struts/core/trunk/src/share/org/apache/struts/util/ModuleException.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/util/ModuleException.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/ModuleException.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/util/ModuleException.java Sat May 7 08:41:44 2005
@@ -38,108 +38,108 @@
*/
protected ActionMessage message = null;
- /**
- * Construct an module exception with no replacement values.
- *
- * @param key Message key for this error message
- */
+ /**
+ * Construct an module exception with no replacement values.
+ *
+ * @param key Message key for this error message
+ */
public ModuleException(String key) {
super(key);
- error = new ActionError(key);
+ error = new ActionError(key);
message = new ActionMessage(key);
}
- /**
- * Construct an module exception with the specified replacement values.
- *
- * @param key Message key for this error message
- * @param value First replacement value
- */
- public ModuleException(String key, Object value) {
- super(key);
- error = new ActionError(key, value);
+ /**
+ * Construct an module exception with the specified replacement values.
+ *
+ * @param key Message key for this error message
+ * @param value First replacement value
+ */
+ public ModuleException(String key, Object value) {
+ super(key);
+ error = new ActionError(key, value);
message = new ActionMessage(key, value);
- }
+ }
- /**
- * Construct an module exception with the specified replacement values.
- *
- * @param key Message key for this error message
- * @param value0 First replacement value
- * @param value1 Second replacement value
- */
- public ModuleException(String key, Object value0, Object value1) {
- super(key);
- error = new ActionError(key, value0, value1);
+ /**
+ * Construct an module exception with the specified replacement values.
+ *
+ * @param key Message key for this error message
+ * @param value0 First replacement value
+ * @param value1 Second replacement value
+ */
+ public ModuleException(String key, Object value0, Object value1) {
+ super(key);
+ error = new ActionError(key, value0, value1);
message = new ActionMessage(key, value0, value1);
- }
+ }
- /**
- * Construct an module exception with the specified replacement values.
- *
- * @param key Message key for this error message
- * @param value0 First replacement value
- * @param value1 Second replacement value
- * @param value2 Third replacement value
- */
- public ModuleException(String key, Object value0, Object value1, Object value2) {
- super(key);
- error = new ActionError(key, value0, value1, value2);
+ /**
+ * Construct an module exception with the specified replacement values.
+ *
+ * @param key Message key for this error message
+ * @param value0 First replacement value
+ * @param value1 Second replacement value
+ * @param value2 Third replacement value
+ */
+ public ModuleException(String key, Object value0, Object value1, Object value2) {
+ super(key);
+ error = new ActionError(key, value0, value1, value2);
message = new ActionMessage(key, value0, value1, value2);
- }
+ }
- /**
- * Construct an module exception with the specified replacement values.
- *
- * @param key Message key for this error message
- * @param value0 First replacement value
- * @param value1 Second replacement value
- * @param value2 Third replacement value
- * @param value3 Fourth replacement value
- */
- public ModuleException(String key, Object value0, Object value1, Object value2, Object value3) {
- super(key);
- error = new ActionError(key, value0, value1, value2, value3);
+ /**
+ * Construct an module exception with the specified replacement values.
+ *
+ * @param key Message key for this error message
+ * @param value0 First replacement value
+ * @param value1 Second replacement value
+ * @param value2 Third replacement value
+ * @param value3 Fourth replacement value
+ */
+ public ModuleException(String key, Object value0, Object value1, Object value2, Object value3) {
+ super(key);
+ error = new ActionError(key, value0, value1, value2, value3);
message = new ActionMessage(key, value0, value1, value2, value3);
- }
+ }
- /**
- * Construct an action error with the specified replacement values.
- *
- * @param key Message key for this message
- * @param values Array of replacement values
- */
- public ModuleException(String key, Object[] values) {
- super(key);
- error = new ActionError(key, values);
+ /**
+ * Construct an action error with the specified replacement values.
+ *
+ * @param key Message key for this message
+ * @param values Array of replacement values
+ */
+ public ModuleException(String key, Object[] values) {
+ super(key);
+ error = new ActionError(key, values);
message = new ActionMessage(key, values);
- }
+ }
/**
- * Returns the property associated with the exception.
- * @return Value of property.
- */
- public String getProperty() {
- return (property != null) ? property : message.getKey();
- }
-
- /**
- * Set the property associated with the exception.
- * It can be a name of the edit field, which 'caused' the exception.
- */
- public void setProperty(String property) {
- this.property = property;
- }
+ * Returns the property associated with the exception.
+ * @return Value of property.
+ */
+ public String getProperty() {
+ return (property != null) ? property : message.getKey();
+ }
/**
- * Returns the error associated with the exception.
- * @return Value of property error.
+ * Set the property associated with the exception.
+ * It can be a name of the edit field, which 'caused' the exception.
+ */
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ /**
+ * Returns the error associated with the exception.
+ * @return Value of property error.
* @deprecated Use getActionMessage() instead. This will be removed
* after Struts 1.2.
- */
- public ActionError getError() {
- return error;
- }
+ */
+ public ActionError getError() {
+ return error;
+ }
/**
* Returns the error associated with the exception.
Modified: struts/core/trunk/src/share/org/apache/struts/util/ModuleUtils.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/util/ModuleUtils.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/ModuleUtils.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/util/ModuleUtils.java Sat May 7 08:41:44 2005
@@ -60,59 +60,59 @@
super();
}
- /**
- * Return the current ModuleConfig object stored in request, if it exists,
- * null otherwise.
- * This method can be used by plugin to retrieve the current module config
- * object. If no moduleConfig is found, this means that the request haven't
- * hit the server throught the struts servlet. The appropriate module config
- * can be set and found with
- * <code>{@link RequestUtils#selectModule(HttpServletRequest, ServletContext)} </code>.
- * @param request The servlet request we are processing
- * @return the ModuleConfig object from request, or null if none is set in
- * the request.
- */
- public ModuleConfig getModuleConfig(HttpServletRequest request) {
- return (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
- }
+ /**
+ * Return the current ModuleConfig object stored in request, if it exists,
+ * null otherwise.
+ * This method can be used by plugin to retrieve the current module config
+ * object. If no moduleConfig is found, this means that the request haven't
+ * hit the server throught the struts servlet. The appropriate module config
+ * can be set and found with
+ * <code>{@link RequestUtils#selectModule(HttpServletRequest, ServletContext)} </code>.
+ * @param request The servlet request we are processing
+ * @return the ModuleConfig object from request, or null if none is set in
+ * the request.
+ */
+ public ModuleConfig getModuleConfig(HttpServletRequest request) {
+ return (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
+ }
- /**
- * Return the desired ModuleConfig object stored in context, if it exists,
- * null otherwise.
- *
+ /**
+ * Return the desired ModuleConfig object stored in context, if it exists,
+ * null otherwise.
+ *
* @param prefix The module prefix of the desired module
* @param context The ServletContext for this web application
- * @return the ModuleConfig object specified, or null if not found in
- * the context.
- */
- public ModuleConfig getModuleConfig(String prefix, ServletContext context) {
- return (ModuleConfig) context.getAttribute(Globals.MODULE_KEY + prefix);
- }
+ * @return the ModuleConfig object specified, or null if not found in
+ * the context.
+ */
+ public ModuleConfig getModuleConfig(String prefix, ServletContext context) {
+ return (ModuleConfig) context.getAttribute(Globals.MODULE_KEY + prefix);
+ }
- /**
- * Return the desired ModuleConfig object stored in context, if it exists,
- * otherwise return the current ModuleConfig
- *
- * @param prefix The module prefix of the desired module
- * @param request The servlet request we are processing
- * @param context The ServletContext for this web application
- * @return the ModuleConfig object specified, or null if not found in
- * the context.
- */
- public ModuleConfig getModuleConfig(String prefix, HttpServletRequest request, ServletContext context) {
- ModuleConfig moduleConfig = null;
-
-
- if(prefix != null) {
- //lookup module stored with the given prefix.
- moduleConfig = this.getModuleConfig(prefix, context);
- }
- else {
- //return the current module if no prefix was supplied.
- moduleConfig = this.getModuleConfig(request, context);
- }
- return moduleConfig;
- }
+ /**
+ * Return the desired ModuleConfig object stored in context, if it exists,
+ * otherwise return the current ModuleConfig
+ *
+ * @param prefix The module prefix of the desired module
+ * @param request The servlet request we are processing
+ * @param context The ServletContext for this web application
+ * @return the ModuleConfig object specified, or null if not found in
+ * the context.
+ */
+ public ModuleConfig getModuleConfig(String prefix, HttpServletRequest request, ServletContext context) {
+ ModuleConfig moduleConfig = null;
+
+
+ if(prefix != null) {
+ //lookup module stored with the given prefix.
+ moduleConfig = this.getModuleConfig(prefix, context);
+ }
+ else {
+ //return the current module if no prefix was supplied.
+ moduleConfig = this.getModuleConfig(request, context);
+ }
+ return moduleConfig;
+ }
/**
* Return the ModuleConfig object is it exists, null otherwise.
@@ -124,14 +124,14 @@
HttpServletRequest request,
ServletContext context) {
- ModuleConfig moduleConfig = this.getModuleConfig(request);
+ ModuleConfig moduleConfig = this.getModuleConfig(request);
- if (moduleConfig == null) {
- moduleConfig = this.getModuleConfig("", context);
- request.setAttribute(Globals.MODULE_KEY, moduleConfig);
- }
+ if (moduleConfig == null) {
+ moduleConfig = this.getModuleConfig("", context);
+ request.setAttribute(Globals.MODULE_KEY, moduleConfig);
+ }
- return moduleConfig;
+ return moduleConfig;
}
Modified: struts/core/trunk/src/share/org/apache/struts/util/PropertyMessageResources.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/util/PropertyMessageResources.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/PropertyMessageResources.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/util/PropertyMessageResources.java Sat May 7 08:41:44 2005
@@ -98,8 +98,8 @@
/**
* The <code>Log</code> instance for this class.
*/
- protected static final Log log =
- LogFactory.getLog(PropertyMessageResources.class);
+ protected static final Log log =
+ LogFactory.getLog(PropertyMessageResources.class);
/**
Modified: struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/util/RequestUtils.java Sat May 7 08:41:44 2005
@@ -683,123 +683,123 @@
return forwardURL(request,forward,null);
}
- /**
- * <p>Return the context-relative URL that corresponds to the specified
- * <code>ForwardConfig</code>. The URL is calculated based on the properties
- * of the {@link ForwardConfig} instance as follows:</p>
- * <ul>
- * <li>If the <code>contextRelative</code> property is set, it is
- * assumed that the <code>path</code> property contains a path
- * that is already context-relative:
- * <ul>
- * <li>If the <code>path</code> property value starts with a slash,
- * it is returned unmodified.</li>
- * <li>If the <code>path</code> property value does not start
- * with a slash, a slash is prepended.</li>
- * </ul></li>
- * <li>Acquire the <code>forwardPattern</code> property from the
- * <code>ControllerConfig</code> for the application module used
- * to process this request. If no pattern was configured, default
- * to a pattern of <code>$M$P</code>, which is compatible with the
- * hard-coded mapping behavior in Struts 1.0.</li>
- * <li>Process the acquired <code>forwardPattern</code>, performing the
- * following substitutions:
- * <ul>
- * <li><strong>$M</strong> - Replaced by the module prefix for the
- * application module processing this request.</li>
- * <li><strong>$P</strong> - Replaced by the <code>path</code>
- * property of the specified {@link ForwardConfig}, prepended
- * with a slash if it does not start with one.</li>
- * <li><strong>$$</strong> - Replaced by a single dollar sign
- * character.</li>
- * <li><strong>$x</strong> (where "x" is any charater not listed
- * above) - Silently omit these two characters from the result
- * value. (This has the side effect of causing all other
- * $+letter combinations to be reserved.)</li>
- * </ul></li>
- * </ul>
- *
- * @param request The servlet request we are processing
- * @param forward ForwardConfig to be evaluated
+ /**
+ * <p>Return the context-relative URL that corresponds to the specified
+ * <code>ForwardConfig</code>. The URL is calculated based on the properties
+ * of the {@link ForwardConfig} instance as follows:</p>
+ * <ul>
+ * <li>If the <code>contextRelative</code> property is set, it is
+ * assumed that the <code>path</code> property contains a path
+ * that is already context-relative:
+ * <ul>
+ * <li>If the <code>path</code> property value starts with a slash,
+ * it is returned unmodified.</li>
+ * <li>If the <code>path</code> property value does not start
+ * with a slash, a slash is prepended.</li>
+ * </ul></li>
+ * <li>Acquire the <code>forwardPattern</code> property from the
+ * <code>ControllerConfig</code> for the application module used
+ * to process this request. If no pattern was configured, default
+ * to a pattern of <code>$M$P</code>, which is compatible with the
+ * hard-coded mapping behavior in Struts 1.0.</li>
+ * <li>Process the acquired <code>forwardPattern</code>, performing the
+ * following substitutions:
+ * <ul>
+ * <li><strong>$M</strong> - Replaced by the module prefix for the
+ * application module processing this request.</li>
+ * <li><strong>$P</strong> - Replaced by the <code>path</code>
+ * property of the specified {@link ForwardConfig}, prepended
+ * with a slash if it does not start with one.</li>
+ * <li><strong>$$</strong> - Replaced by a single dollar sign
+ * character.</li>
+ * <li><strong>$x</strong> (where "x" is any charater not listed
+ * above) - Silently omit these two characters from the result
+ * value. (This has the side effect of causing all other
+ * $+letter combinations to be reserved.)</li>
+ * </ul></li>
+ * </ul>
+ *
+ * @param request The servlet request we are processing
+ * @param forward ForwardConfig to be evaluated
* @param moduleConfig Base forward on this module config.
- *
- * @return context-relative URL
- * @since Struts 1.2
- */
- public static String forwardURL(HttpServletRequest request, ForwardConfig forward, ModuleConfig moduleConfig) {
- //load the current moduleConfig, if null
- if(moduleConfig == null) {
- moduleConfig = ModuleUtils.getInstance().getModuleConfig(request);
- }
-
- String path = forward.getPath();
- //load default prefix
- String prefix = moduleConfig.getPrefix();
-
- //override prefix if supplied by forward
- if(forward.getModule() != null) {
- prefix = forward.getModule();
+ *
+ * @return context-relative URL
+ * @since Struts 1.2
+ */
+ public static String forwardURL(HttpServletRequest request, ForwardConfig forward, ModuleConfig moduleConfig) {
+ //load the current moduleConfig, if null
+ if(moduleConfig == null) {
+ moduleConfig = ModuleUtils.getInstance().getModuleConfig(request);
+ }
+
+ String path = forward.getPath();
+ //load default prefix
+ String prefix = moduleConfig.getPrefix();
+
+ //override prefix if supplied by forward
+ if(forward.getModule() != null) {
+ prefix = forward.getModule();
if ("/".equals(prefix)) {
prefix = "";
}
- }
+ }
- // Handle a ForwardConfig marked as context relative
- StringBuffer sb = new StringBuffer();
- if (forward.getContextRelative()) {
- if (!path.startsWith("/")) {
- sb.append("/");
- }
- sb.append(path);
- return (sb.toString());
- }
+ // Handle a ForwardConfig marked as context relative
+ StringBuffer sb = new StringBuffer();
+ if (forward.getContextRelative()) {
+ if (!path.startsWith("/")) {
+ sb.append("/");
+ }
+ sb.append(path);
+ return (sb.toString());
+ }
- // Calculate a context relative path for this ForwardConfig
- String forwardPattern = moduleConfig.getControllerConfig().getForwardPattern();
- if (forwardPattern == null) {
- // Performance optimization for previous default behavior
- sb.append(prefix);
- // smoothly insert a '/' if needed
- if (!path.startsWith("/")) {
- sb.append("/");
- }
- sb.append(path);
+ // Calculate a context relative path for this ForwardConfig
+ String forwardPattern = moduleConfig.getControllerConfig().getForwardPattern();
+ if (forwardPattern == null) {
+ // Performance optimization for previous default behavior
+ sb.append(prefix);
+ // smoothly insert a '/' if needed
+ if (!path.startsWith("/")) {
+ sb.append("/");
+ }
+ sb.append(path);
- } else {
- boolean dollar = false;
- for (int i = 0; i < forwardPattern.length(); i++) {
- char ch = forwardPattern.charAt(i);
- if (dollar) {
- switch (ch) {
- case 'M':
- sb.append(prefix);
- break;
- case 'P':
- // add '/' if needed
- if (!path.startsWith("/")) {
- sb.append("/");
- }
- sb.append(path);
- break;
- case '$':
- sb.append('$');
- break;
- default :
- ; // Silently swallow
- }
- dollar = false;
- continue;
- } else if (ch == '$') {
- dollar = true;
- } else {
- sb.append(ch);
- }
- }
- }
+ } else {
+ boolean dollar = false;
+ for (int i = 0; i < forwardPattern.length(); i++) {
+ char ch = forwardPattern.charAt(i);
+ if (dollar) {
+ switch (ch) {
+ case 'M':
+ sb.append(prefix);
+ break;
+ case 'P':
+ // add '/' if needed
+ if (!path.startsWith("/")) {
+ sb.append("/");
+ }
+ sb.append(path);
+ break;
+ case '$':
+ sb.append('$');
+ break;
+ default :
+ ; // Silently swallow
+ }
+ dollar = false;
+ continue;
+ } else if (ch == '$') {
+ dollar = true;
+ } else {
+ sb.append(ch);
+ }
+ }
+ }
- return (sb.toString());
+ return (sb.toString());
- }
+ }
/**
Modified: struts/core/trunk/src/share/org/apache/struts/util/ResponseUtils.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/util/ResponseUtils.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/util/ResponseUtils.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/util/ResponseUtils.java Sat May 7 08:41:44 2005
@@ -131,17 +131,17 @@
return result == null ? value : result.toString();
}
-
+
/**
- * URLencodes a string assuming the character encoding is UTF-8.
- *
- * @param url
- * @return String The encoded url in UTF-8
- */
- public static String encodeURL(String url) {
- return encodeURL(url, "UTF-8");
- }
+ * URLencodes a string assuming the character encoding is UTF-8.
+ *
+ * @param url
+ * @return String The encoded url in UTF-8
+ */
+ public static String encodeURL(String url) {
+ return encodeURL(url, "UTF-8");
+ }
/**
* Use the new URLEncoder.encode() method from Java 1.4 if available, else
@@ -154,9 +154,9 @@
public static String encodeURL(String url, String enc) {
try {
- if(enc==null || enc.length()==0){
- enc = "UTF-8";
- }
+ if(enc==null || enc.length()==0){
+ enc = "UTF-8";
+ }
// encode url with new 1.4 method and UTF-8 encoding
if (encode != null) {
Modified: struts/core/trunk/src/share/org/apache/struts/validator/FieldChecks.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/FieldChecks.java?rev=169086&r1=169085&r2=169086&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/FieldChecks.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/FieldChecks.java Sat May 7 08:41:44 2005
@@ -181,18 +181,18 @@
i++;
}
- if (required) {
- if (GenericValidator.isBlankOrNull(value)) {
- errors.add(
- field.getKey(),
- Resources.getActionMessage(validator, request, va, field));
+ if (required) {
+ if (GenericValidator.isBlankOrNull(value)) {
+ errors.add(
+ field.getKey(),
+ Resources.getActionMessage(validator, request, va, field));
return false;
- } else {
- return true;
- }
- }
+ } else {
+ return true;
+ }
+ }
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org