It looks good -- I checked it in.  Thanks!
Rich

Carlin Rogers wrote:

I have a request to check in some fixes and changes for
some minor issues and clean up. The patch file is attached
below.

- Fixed a possible StringIndexOutOfBoundsException
  in PageFlowTagUtils.getActionMapping().

- Fixed a backward compatibility issue with the support
  for the old URLRewriterService API. The OldURLRewriterWrapper
  needed to call the allowParamsOnFormAction() method of
  the old URLRewriter it delegated to.

- Removed some calls to String.trim() from the MutableURI
  to be more in line with java.net.URI as far as handling
  the inputs for URI components and improve performance.

- Removed an unused variable in the TreeItem tag code.

Thanks,
Carlin

------------------------------------------------------------------------

Index: netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeItem.java
===================================================================
--- netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeItem.java (revision 122969)
+++ netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeItem.java (working copy)
@@ -301,7 +301,6 @@
PageContext pageContext = getPageContext();
if (_action != null) {
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
- HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
boolean isAction = PageFlowTagUtils.isAction(request, _action);
if (!isAction) {
registerTagError(Bundle.getString("Tags_BadAction", _action), null);
Index: netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java
===================================================================
--- netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java (revision 122969)
+++ netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java (working copy)
@@ -205,7 +205,11 @@
else if ( dot < action.length() - 1 )
{
String sharedFlowName = action.substring( 0, dot );
- if ( sharedFlowName.charAt( 0 ) == '/' ) sharedFlowName = sharedFlowName.substring( 1 );
+ if ( sharedFlowName.length() > 0 && sharedFlowName.charAt( 0 ) == '/' )
+ {
+ sharedFlowName = sharedFlowName.substring( 1 );
+ }
+
FlowController sharedFlow = PageFlowUtils.getSharedFlows( request ).get( sharedFlowName );
if ( sharedFlow != null )
Index: netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.java
===================================================================
--- netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.java (revision 122969)
+++ netui/src/pageflow/org/apache/beehive/netui/pageflow/util/OldURLRewriterWrapper.java (working copy)
@@ -111,6 +111,16 @@
}


    /**
+     * Tell whether rewritten form actions should be allowed to have query 
parameters.  If this returns
+     * <code>false</code>, then a form-tag implementation should render query 
parameters into hidden
+     * fields on the form instead of allowing them to remain in the URL.
+     */
+    public boolean allowParamsOnFormAction( ServletContext servletContext, 
ServletRequest request )
+    {
+        return _oldURLRewriter.allowParamsOnFormAction( servletContext, 
request );
+    }
+
+    /**
     * Determines if the passed-in Object is equivalent to this 
DefaultURLRewriter.
     * Since there is no member data for this class they will all be equal.
     *
Index: netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java
===================================================================
--- netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java   
(revision 122969)
+++ netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java   
(working copy)
@@ -235,13 +235,9 @@
    public void setScheme( String scheme )
    {
        _scheme = null;
-        if ( scheme != null )
+        if ( scheme != null && scheme.length() > 0 )
        {
-            scheme = scheme.trim();
-            if ( scheme.length() > 0 )
-            {
-                _scheme = scheme;
-            }
+            _scheme = scheme;
        }
    }

@@ -264,13 +260,9 @@
    public void setUserInfo( String userInfo )
    {
        _userInfo = null;
-        if ( userInfo != null )
+        if ( userInfo != null && userInfo.length() > 0 )
        {
-            userInfo = userInfo.trim();
-            if ( userInfo.length() > 0 )
-            {
-                _userInfo = userInfo;
-            }
+            _userInfo = userInfo;
        }
    }

@@ -293,32 +285,28 @@
    public void setHost( String host )
    {
        _host = null;
-        if ( host != null )
+        if ( host != null && host.length() > 0 )
        {
-            host = host.trim();
-            if ( host.length() > 0 )
-            {
-                //
-                // Here's some very minimal support for IPv6 addresses.
-                // If the literal IPv6 address is not enclosed in square 
brackets
-                // then add them.
-                //
-                boolean needBrackets = ( ( host.indexOf( ':' ) >= 0 )
-                        && !host.startsWith( "[" )
-                        && !host.endsWith( "]" ) );
+            //
+            // Here's some very minimal support for IPv6 addresses.
+            // If the literal IPv6 address is not enclosed in square brackets
+            // then add them.
+            //
+            boolean needBrackets = ( ( host.indexOf( ':' ) >= 0 )
+                    && !host.startsWith( "[" )
+                    && !host.endsWith( "]" ) );

-                if ( needBrackets )
-                {
-                    _host = '[' + host + ']';
-                }
-                else
-                {
-                    _host = host;
-                }
+            if ( needBrackets )
+            {
+                _host = '[' + host + ']';
            }
+            else
+            {
+                _host = host;
+            }
        }

-        if ( host == null )
+        if ( _host == null )
        {
            setUserInfo( null );
            setPort( UNDEFINED_PORT );
@@ -382,7 +370,7 @@
        }
        else
        {
-            _path = path.trim();
+            _path = path;
        }
    }

@@ -406,15 +394,15 @@
    {
        _params = null;

-        if ( query == null || query.trim().length() == 0 ) { return; }
+        if ( query == null || query.length() == 0 ) { return; }

-        for ( StringTokenizer tok = new StringTokenizer( query.trim(), "&" ); 
tok.hasMoreElements(); )
+        for ( StringTokenizer tok = new StringTokenizer( query, "&" ); 
tok.hasMoreElements(); )
        {
-            String queryItem = tok.nextToken().trim();
+            String queryItem = tok.nextToken();
            int eq = queryItem.indexOf( '=' );
            if ( eq != -1 )
            {
-                addParameter( queryItem.substring( 0, eq ).trim() , 
queryItem.substring( eq + 1 ).trim(), true );
+                addParameter( queryItem.substring( 0, eq ) , 
queryItem.substring( eq + 1 ), true );
            }
            else
            {
@@ -686,13 +674,9 @@
    public void setFragment( String fragment )
    {
        _fragment = null;
-        if ( fragment != null )
+        if ( fragment != null && fragment.length() > 0 )
        {
-            fragment = fragment.trim();
-            if ( fragment.length() > 0 )
-            {
-                _fragment = fragment;
-            }
+            _fragment = fragment;
        }
    }



Reply via email to