lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject svn commit: r529573 - /lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java
Date Tue, 17 Apr 2007 12:16:48 GMT
Author: andreas
Date: Tue Apr 17 05:16:46 2007
New Revision: 529573

URL: http://svn.apache.org/viewvc?view=rev&rev=529573
Log:
Don't rely on the NODE_NAME parameter in CreateDocument. Thanks to Michael Ralston for spotting.

Modified:
    lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java

Modified: lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java?view=diff&rev=529573&r1=529572&r2=529573
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java
(original)
+++ lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java
Tue Apr 17 05:16:46 2007
@@ -89,7 +89,6 @@
     protected void doCheckExecutionConditions() throws Exception {
         super.doCheckExecutionConditions();
 
-        String nodeName = getParameterAsString(NODE_NAME).trim();
         String relation = getParameterAsString(RELATION);
 
         if (!Arrays.asList(getSupportedRelations()).contains(relation)) {
@@ -107,15 +106,18 @@
                 String[] params = { newPath };
                 addErrorMessage("path-already-exists", params);
             }
-        } else if (nodeName.equals("")) {
-            addErrorMessage("missing-node-name");
-        } else if (!builder.isValidDocumentName(nodeName)) {
-            addErrorMessage("node-name-special-characters");
+        } else {
+            String nodeName = getParameterAsString(NODE_NAME).trim();
+            if (nodeName.equals("")) {
+                addErrorMessage("missing-node-name");
+            } else if (!builder.isValidDocumentName(nodeName)) {
+                addErrorMessage("node-name-special-characters");
+            }
         }
     }
 
     protected boolean isPathValid() {
-        String nodeName = getParameterAsString(NODE_NAME);
+        String nodeName = getNewDocumentName();
         DocumentBuilder builder = getPublication().getDocumentBuilder();
         return !nodeName.trim().equals("") && builder.isValidDocumentName(nodeName);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org


Mime
View raw message