cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r391548 - in /cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal: coplet/impl/DefaultCopletFactory.java layout/impl/DefaultLayoutFactory.java util/PortalUtils.java
Date Wed, 05 Apr 2006 06:40:58 GMT
Author: cziegeler
Date: Tue Apr  4 23:40:55 2006
New Revision: 391548

URL: http://svn.apache.org/viewcvs?rev=391548&view=rev
Log:
Stricter rules for ids

Modified:
    cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
    cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
    cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/PortalUtils.java

Modified: cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java?rev=391548&r1=391547&r2=391548&view=diff
==============================================================================
--- cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
(original)
+++ cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/coplet/impl/DefaultCopletFactory.java
Tue Apr  4 23:40:55 2006
@@ -93,7 +93,7 @@
     throws PortalException {
         if (id == null ) {
             synchronized (this) {
-                id = copletBaseData.getId() + '-' + idCounter;
+                id = copletBaseData.getId() + '_' + idCounter;
                 idCounter += 1;
             }
         }

Modified: cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java?rev=391548&r1=391547&r2=391548&view=diff
==============================================================================
--- cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
(original)
+++ cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
Tue Apr  4 23:40:55 2006
@@ -236,7 +236,7 @@
 
         if ( layoutDescription.createId() && id == null ) {
             synchronized (this) {
-                id = layoutName + '-' + idCounter;
+                id = layoutName + '_' + idCounter;
                 idCounter += 1;
             }
         }

Modified: cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/PortalUtils.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/PortalUtils.java?rev=391548&r1=391547&r2=391548&view=diff
==============================================================================
--- cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/PortalUtils.java
(original)
+++ cocoon/trunk/blocks-tobeconverted/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/PortalUtils.java
Tue Apr  4 23:40:55 2006
@@ -26,13 +26,16 @@
 
     /**
      * Tests if the string represents a correct id for any portal object.
+     * The id of an object follows very strict rules: only characters, an underscore and
numbers are allowed
+     * and the id has to start with a character. This allows to use the id as an identifier
+     * for ajax/javascript based portlets.
      */
     public static String testId(String id) {
         if ( id == null || id.length() == 0 ) {
             return "Id must not be null or empty.";
         }
-        if ( !StringUtils.containsOnly(id, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789
") ) {
-            return "Id contains invalid characters (only a-z,A-Z,0-9, space and '-' are allowed):
" + id;
+        if ( !StringUtils.containsOnly(id, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_")
) {
+            return "Id contains invalid characters (only a-z,A-Z, 0-9 and '_' are allowed):
" + id;
         }
         final char firstChar = id.charAt(0);
         if ( firstChar >= 'a' && firstChar <= 'z' ) {



Mime
View raw message