Revision: 1035
          http://stripes.svn.sourceforge.net/stripes/?rev=1035&view=rev
Author:   fdaoud
Date:     2009-01-21 16:16:27 +0000 (Wed, 21 Jan 2009)

Log Message:
-----------
Fix for STS-641

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java

Property Changed:
----------------
    branches/1.5.x/


Property changes on: branches/1.5.x
___________________________________________________________________
Modified: svn:ignore
   - .classpath
.project
.settings

   + .classpath
.project
.settings
dist


Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java
       2009-01-21 16:15:09 UTC (rev 1034)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java
       2009-01-21 16:16:27 UTC (rev 1035)
@@ -15,6 +15,7 @@
 package net.sourceforge.stripes.tag.layout;
 
 import net.sourceforge.stripes.tag.StripesTagSupport;
+import net.sourceforge.stripes.util.Log;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTag;
@@ -28,6 +29,7 @@
  * @since Stripes 1.1
  */
 public class LayoutComponentTag extends StripesTagSupport implements BodyTag {
+    private static final Log log = Log.getInstance(LayoutComponentTag.class);
     private String name;
     private BodyContent bodyContent;
     private LayoutDefinitionTag definitionTag;
@@ -37,7 +39,23 @@
     public String getName() { return name; }
 
     /** Sets the name of the component. */
-    public void setName(String name) { this.name = name; }
+    public void setName(String name) {
+        if (name != null && name.length() > 0) {
+            int length = name.length();
+            boolean validJava = 
Character.isJavaIdentifierStart(name.charAt(0));
+            int index = 1;
+            while (validJava && index < length) {
+                validJava = Character.isJavaIdentifierPart(name.charAt(index));
+                index++;
+            }
+            if (!validJava) {
+                log.warn("The layout-component name '", name, "' is not a 
valid Java identifier. ",
+                    "While this may work, it can cause bugs that are difficult 
to track down. Please ",
+                    "consider using valid Java identifiers for component names 
(no hyphens, no spaces, etc.)");
+            }
+        }
+        this.name = name;
+    }
 
     /** Save the body content output by the tag. */
     public void setBodyContent(BodyContent bodyContent) {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to