You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2004/09/30 19:27:58 UTC
svn commit: rev 47597 - in incubator/beehive/trunk/netui/src: compiler/org/apache/beehive/netui/compiler compiler/org/apache/beehive/netui/compiler/grammar pageflow/org/apache/beehive/netui/pageflow scoping/org/apache/beehive/netui/pageflow/scoping/internal util/org/apache/beehive/netui/util
Author: rich
Date: Thu Sep 30 10:27:58 2004
New Revision: 47597
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModule.java
incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/AttributeContainer.java
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/FileUtils.java
Log:
Mosty very minor cleanup. Added a new error when a @Jpf.ActionOutput annotation is used in a @Jpf.Forward that has:
- the 'redirect' attribute set to true, or
- a 'path' attribute with an absolute URI (e.g., "http://www.apache.org"), which automatically causes a redirect.
DRT: netui (WinXP)
BB: self (linux)
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java Thu Sep 30 10:27:58 2004
@@ -999,4 +999,31 @@
throw new IllegalStateException( "not implemented " );
}
}
+
+ /**
+ * This is the same logic that we have in the runtime, in PageFlowRequestProcessor. Can't share the code, though.
+ */
+ public static boolean isAbsoluteURI( String uri )
+ {
+ //
+ // This method needs to be fast, so it can't use java.net.URI.
+ //
+ if ( uri.length() == 0 || uri.charAt( 0 ) == '/' ) return false;
+
+ for ( int i = 0, len = uri.length(); i < len; ++i )
+ {
+ char c = uri.charAt( i );
+
+ if ( c == ':' )
+ {
+ return true;
+ }
+ else if ( c == '/' )
+ {
+ return false;
+ }
+ }
+
+ return false;
+ }
}
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FormBeanChecker.java Thu Sep 30 10:27:58 2004
@@ -147,7 +147,7 @@
{
if ( memberDecl.getSimpleName().equals( PROPERTY_NAME_ATTR ) )
{
- addError( member, "error.validatable-field-property-name-not-allowed" );
+ addError( member, "error.validatable-field-property-name-not-allowed", PROPERTY_NAME_ATTR );
}
}
}
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java Thu Sep 30 10:27:58 2004
@@ -170,17 +170,21 @@
//
File parentDir = jpfFile.getParentFile();
File[] peers = parentDir.listFiles( JPF_FILE_FILTER );
- for ( int i = 0; i < peers.length; i++ )
+
+ if ( peers != null ) // make sure the directory hasn't been deleted while we're running
{
- File peer = peers[i];
- if ( ! peer.equals( jpfFile ) )
+ for ( int i = 0; i < peers.length; i++ )
{
- String name = peer.getName();
-
- if ( ! overlapping.contains( name ) )
+ File peer = peers[i];
+ if ( ! peer.equals( jpfFile ) )
{
- overlapping.add( name );
- overlappingFiles.add( peer );
+ String name = peer.getName();
+
+ if ( ! overlapping.contains( name ) )
+ {
+ overlapping.add( name );
+ overlappingFiles.add( peer );
+ }
}
}
}
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties Thu Sep 30 10:27:58 2004
@@ -154,3 +154,6 @@
error.roles-with-no-login-required = The rolesAllowed attribute may not be used when loginRequired is set to false.
error.min-float = This value must be no less than {0}.
error.max-float = This value must be no greater than {0}.
+error.action-outputs-with-redirect = Action outputs may not be used when the "{0}" attribute is true.
+error.action-outputs-with-absolute-uri = \
+Action outputs may not be used when the "{0}" attribute is an absolute URI, which automatically causes a redirect.
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java Thu Sep 30 10:27:58 2004
@@ -132,6 +132,20 @@
}
}
+ if ( valueName.equals( ACTION_OUTPUTS_ATTR ) && ( ( List ) value.getValue() ).size() > 0 )
+ {
+ if ( CompilerUtils.getBoolean( annotation, REDIRECT_ATTR, false ) )
+ {
+ addError( value, "error.action-outputs-with-redirect", REDIRECT_ATTR );
+ }
+
+ String path = CompilerUtils.getString( annotation, PATH_ATTR, true );
+ if ( path != null && CompilerUtils.isAbsoluteURI( path ) )
+ {
+ addError( value, "error.action-outputs-with-absolute-uri", PATH_ATTR );
+ }
+ }
+
//
// If this is a return-action, store its info in the FlowControllerInfo (which is eventually provided to tools.
//
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModule.java
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModule.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModule.java Thu Sep 30 10:27:58 2004
@@ -38,7 +38,8 @@
*/
public StrutsModule( String modulePath )
{
- assert modulePath.startsWith( "/" ) : modulePath;
+ // The path for the root module is "".
+ assert modulePath.length() == 0 || modulePath.startsWith( "/" ) : modulePath;
_modulePath = modulePath;
}
Modified: incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/AttributeContainer.java
==============================================================================
--- incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/AttributeContainer.java (original)
+++ incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/AttributeContainer.java Thu Sep 30 10:27:58 2004
@@ -96,9 +96,9 @@
}
else
{
- if ( logger.isEnabledFor( Priority.WARN ) )
+ if ( logger.isEnabledFor( Priority.INFO ) )
{
- logger.warn( "Dropping non-serializable request attribute " + entry.getKey()
+ logger.info( "Dropping non-serializable request attribute " + entry.getKey()
+ " (" + entry.getValue() + ")." );
}
}
Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/FileUtils.java
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/FileUtils.java (original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/FileUtils.java Thu Sep 30 10:27:58 2004
@@ -35,10 +35,7 @@
//
// This method needs to be fast, so it can't use java.net.URI.
//
- if ( uri.startsWith( "/" ) )
- {
- return false;
- }
+ if ( uri.length() == 0 || uri.charAt( 0 ) == '/' ) return false;
for ( int i = 0, len = uri.length(); i < len; ++i )
{